This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
langs = %w{bfkegkudem kfpozexksm owfmkcnyvl rahgdgzhwv bukisteksg fxjeegggdx qejjzctbti qvigekhpog bvsqmvedya ewrgfpfrlu | |
bzvuzuanzo zhxcmwkizu ohxyodxkyv oomrfibhfw fzegixttqa kxdzqivfhl hniomtqdqr apphyuifwj ujfcrapeyx djgrcxqrux | |
rvtvpxbnzx bziseafhdp mofuvdculv nffrquughc gwrrvndjur mvzqilbvpi mpptidaosr lfgaxqtduu ldyzyofyar xtgkueabdj | |
wqhmxhcasa yxeoufxrry sphdgsweik hhunpqjpnz fnkkbvirll ncdmbrcvqi hctoategou mqtdyycvun afncjfmngf wjxyvhcsuz | |
puefxeidio nyfllolsvw ghjygztrnv folnzvecis uvtannbdjx jurkwqiavv wmfpexcqch ugmptanwdn eslmaaefez jxqcpsvvwu | |
fellmtwzsw nixzgduncg vupbjbdqke olbdbzufhe pxygpqdwoi jkhjwnpvqz ywludqlmlw kqulfxgqiv wvujqpjjwt wkmwuyazjo | |
mqkqtwbzxv dfeleuxjlt rgoobzxbfr pyykqgaoid qcwdcogibq kwospdrebi fbyhvdjrey uakluudovp eglxbpqtkj nxqpeffrvb | |
rlehisdiuy rhhexyshob flpxyqcjcy indkhpjugw qaoclhadbf ctfhonsqll mvehaiypoq joegipqmds qsblkvrxky abmhqmwnxy | |
zduqzarnxr nuygfvuzge qapxbfzggm yhpeuenslm huknmeiolq noxfaqgmms qovhnrrkju kdvrccwzeh jsvdszywda ldqejpsnsk | |
bqhdoixppa pqpckcqthi r |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActiionController::Base | |
def preload_associations(*associations) | |
collection = get_collection_ivar | |
associations.each do |association| | |
ActiveRecord::Associations::Preloader.new(collection, association).run | |
end | |
set_collection_ivar collection | |
collection | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
clForm and clFormInput working together. | |
With clForm you define context and with clFormInput | |
you customize simple form controls. | |
clForm could be nested. | |
Sample: | |
<form cl-form="package as packageForm" cl-form-prefix="delivery[legs_attributes][0][package_attributes]"> | |
<input cl-form-input="system_of_measurement" ng-model="package.system_of_measurement"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible " We're running Vim, not Vi! | |
set rtp+=~/.vim/bundle/vundle/ | |
call vundle#rc() | |
Bundle 'scrooloose/nerdtree.git' | |
Bundle 'vim-ruby/vim-ruby.git' | |
Bundle 'scrooloose/syntastic.git' | |
Bundle 'rodjek/vim-puppet' | |
Bundle 'vim-scripts/VimClojure.git' | |
Bundle 'vim-scripts/vim-coffee-script.git' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'macaddr' | |
module AngryUID | |
# TODO Now we dont resolve time problems - if | |
# we move time to past, then bad things can happen | |
class UID | |
CLOCK_MULTIPLIER = 10_000_000 # 10ns | |
# Arrange | |
# ------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module AngryData | |
class Attribute | |
def initialize(name, options = {}, &blk) | |
@name = name | |
@options = options | |
@blk = blk | |
end | |
def name | |
@name.to_s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
So, you have some structure from wild. Say this will be some JSON over API. | |
But you cant change this JSON structure. | |
""" | |
sample_data = { | |
'userNameFirst': 'Adam', | |
'userNameSecond': 'Smith', | |
'userPassword': 'supersecretpassword', | |
'userEmail': '[email protected]', | |
'userRoles': 'teacher, worker, admin', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def py3metafix(cls): | |
if not py3: | |
return cls | |
else: | |
newcls = cls.__metaclass__(cls.__name__, (cls,), {}) | |
newcls.__doc__ = cls.__doc__ | |
return newcls |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CONTACT = c.Or( | |
c.String(regex=r'(?P<first_name>^\S+)\s*(?P<last_name>.*\S)\s*<(?P<email>.+@.+.[^.]+)>') >> | |
(lambda match: match.groupdict()), | |
c.String(regex=r'(?P<email>.+@.+..+)') >> | |
(lambda match: {'first_name': 'none', 'second_name': 'none', 'email': match.group()}) | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import contract as c | |
import datetime | |
date_tuple = c.Dict(year=c.Int, month=c.Int, day=c.Int) >> (lambda d: datetime.datetime(**d)) | |
task = c.Dict({ | |
'key': c.String(), | |
c.Key('timestamp', optional=True): date_tuple, | |
}) |