Skip to content

Instantly share code, notes, and snippets.

Avatar

Kirill Zaitsev Bugagazavr

  • Cyprus, Limassol
View GitHub Profile
View dry-v.rb
require 'resolv'
require 'dry/types'
require 'dry/validation'
require 'pp'
module MyTypes
include Dry.Types()
REGEX256 = Resolv::IPv4::Regex256
REGEXP = {
View dry-error.rb
require 'dry-types'
require 'dry-validation'
module Types
include Dry::Types.module
end
ctx = Dry::Validation.Schema do
required(:some_int).filled(Types::Strict::Int)
required(:some_bool).filled(Types::Strict::Bool)
View s.rb
require 'test_helper'
class NoisyString
def coerce(value, options = {})
value.to_s.upcase
end
end
class User
include ShallowAttributes
@Bugagazavr
Bugagazavr / 00.howto_install_phantomjs.md
Last active Aug 29, 2015 — forked from julionc/00.howto_install_phantomjs.md
How to install PhantomJS on Debian/Ubuntu
View 00.howto_install_phantomjs.md

How to install PhantomJS on Ubuntu

Version: 1.9.8

Platform: x86_64

First, install or update to the latest system software.

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev
View gist:69268898aeb79b2aed03
<!doctype html>
<html>
<head>
</head>
<body>
<h1>Web Font Loader Demos</h1>
<p>
Demonstrations of pure CSS and JavaScript-enhanced use of @font-face.
</p>
@Bugagazavr
Bugagazavr / gist:0ad1f2b6597af930db63
Created Dec 4, 2014
PostGIS search point in districts polygons
View gist:0ad1f2b6597af930db63
scope :contains, -> (point) { where("ST_contains(polygon, ST_Transform(ST_GeomFromText('#{point}', 4326), 4326))") }
View migrations_test.go
package migrationutil
import (
m "github.com/drone/drone/server/database/migrationutil"
)
// Test create table
type Migrate_100000000001 struct{}
View cw.rb
if ENV['RAILS_ENV'] == 'production'
puts "USING PATCHED CARRIERWAVE"
module CarrierWave
module Uploader
module Url
def url(options = {})
if file.respond_to?(:path)
View example.rb
hash = {lists: @lists}
hash.merge!(default: @lists.index(@default_list)) if @default_list
hash.to_json
View sprockets cache glitch.rb
namespace :deploy do
before 'deploy:assets:precompile', :clean_css_cache do
on roles(:app), in: :sequence, wait: 5 do
within release_path do
if test("[ -d #{shared_path}/tmp/cache/assets ]")
if test("[ -d #{shared_path}/tmp/cache/assets/production ]")
if test("[ -d #{shared_path}/tmp/cache/assets/production/sprockets ]")
out = capture("grep -r -l 'application.css' #{shared_path}/tmp/cache/assets/production/sprockets/")
out.split("\n").each do |o|
execute :rm, o.gsub("\r", '').to_s