This file contains 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
var Config = { | |
'legal-entities/:id': 'entities#show', | |
'external-contact/current/legal-entities': 'ecEntities#index', | |
'internal-contact/current/legal-entities': 'icEntities#index', | |
'outreach-campaigns': 'oc#index', | |
'outreach-campaigns/new': 'oc#create', | |
'outreach-campaigns/:id': 'oc#show', | |
'outreach-campaigns/:id/edit': 'oc#edit', | |
'outreach-campaigns/:id/legal-entities': 'ocEntities#index' | |
}; |
This file contains 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
var applyToNew = function(Class, args) { | |
var F = function () {}; | |
F.prototype = Class.prototype; | |
var f = new F(); | |
Class.apply(f, args); | |
return f; | |
}; | |
applyToNew(SomeClass, arrayOfArguments); |
This file contains 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
# encoding: utf-8 | |
require "test_notifier/runner/autotest" | |
class Autotest | |
alias :original_get_to_green :get_to_green | |
def get_to_green | |
original_get_to_green | |
rerun_all_tests | |
end |
This file contains 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
== ImportSql: migrating ====================================================== | |
Connected to database | |
- remove all tables from database | |
- import database from /Users/maksim/Projects/tabletennis-by/db/migrate/../tabletennis_onliner_tournament.sql | |
- rename/remove tables | |
- rename/remove/add columns | |
- create group for single games and remove extra columns | |
- delete relations for removed players | |
- apply group changes: | |
extract league id 6903/6903 |
This file contains 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 InheritableAttributes | |
def self.included base | |
base.extend ClassMethods | |
end | |
module ClassMethods | |
def inheritable_attr *attrs | |
attrs.each do |attr| | |
class_eval <<-CODE | |
def self.#{attr} #{attr}=nil |
This file contains 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 "sass" | |
require "compass" | |
def compile_sass(sass_file) | |
sass_dir = File.dirname(sass_file) | |
compass_dir = File.join(Compass.base_directory, "frameworks/compass/stylesheets") | |
Sass.compile(File.read(sass_file), syntax: :sass, load_paths: [sass_dir, compass_dir]) | |
end |
This file contains 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
// Hacking Jasmine: adding matchers outside beforeEach to speed up code | |
jasmine.addMatchers = function(matchers) { | |
var parentClass = jasmine.getEnv().matchersClass; | |
var matchersClass = function() { | |
parentClass.apply(this, arguments); | |
}; | |
jasmine.util.inherit(matchersClass, parentClass); | |
jasmine.Matchers.wrapInto_(matchers, matchersClass); | |
jasmine.getEnv().matchersClass = matchersClass; |
This file contains 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 "sinatra" | |
require "sinatra/async" | |
require "em-synchrony" | |
require "em-synchrony/em-http" | |
class App < Sinatra::Base | |
register Sinatra::Async | |
aget "/" do | |
Fiber.new { |
This file contains 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
NSMutableDictionary *requestConfig = [NSMutableDictionary dictionaryWithObjectsAndKeys: | |
@"GET", @"method", | |
@"/", @"path", | |
[[NSMutableDictionary alloc] init], @"params", | |
^(AFHTTPRequestOperation *operation, id responseObject) { | |
NSLog(@"[Request] Success: %@", responseObject); | |
}, @"success", | |
^(AFHTTPRequestOperation *operation, NSError *error) { | |
NSLog(@"[Request] Failure: %@", error); | |
}, @"failure", |
This file contains 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
"Hello world".replace(/[aeoiu]/g, function(match, matchIndex) { | |
console.log(match, matchIndex); | |
}); | |
// -> e, 1 | |
// -> o, 4 | |
// -> o, 7 |
OlderNewer