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 foo(a:, b:, c:) | |
puts "a: #{a}, b: #{b}, c: #{c}" | |
end | |
foo(a: 1, c: 3, b: 2) # a: 1, b: 2, c: 3 | |
#or with hash | |
params = {a: 1, b: 2, c: 3} |
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 CustomFields | |
def initialize | |
@hash = {} | |
end | |
def []=(key, value) | |
@hash[key] = value | |
end | |
def to_hash |
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
React.createClass( | |
componentDidMount: -> | |
video = @getVideoElement() | |
video.addEventListener "ended", @ended, false | |
video.addEventListener "durationchange", @durationChange, false | |
video.addEventListener "timeupdate", @timeUpdate, false | |
video.play() |
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
#!/usr/bin/env ruby | |
skip_methods = %w(new create edit update destroy index show initialize to_s call as_json page per_page build up down change) | |
output = `grep -hr "^\s*def\s" app/` | |
methods = output.split("\n") | |
puts "Found #{methods.size} methods." | |
unused_methods = [] | |
methods.each_with_index do |line, i| |
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
#nginx_cors/recipes/default.rb | |
#create new directory in cookbooks/ in your ey-cloud-recipes repository | |
#upload recipie, apply and restart nginx on all servers | |
# | |
# Cookbook Name:: nginx_cors | |
# Recipe:: default | |
# | |
if ['app_master', 'app', 'solo'].include?(node[:instance_role]) |
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
#app/controllers/application_controller.rb | |
around_filter :log_objects_creation | |
protected | |
def log_objects_creation |
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
//bower install --save ember-cli-leaflet | |
//bower install --save ember-cli-ember-leaflet | |
//bower install --save fontawesome | |
//bower install --save Leaflet.awesome-markers | |
var EmberApp = require('ember-cli/lib/broccoli/ember-app'); | |
var mergeTrees = require('broccoli-merge-trees'); | |
var pickFiles = require('broccoli-static-compiler'); |
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
Ember.Test.registerAsyncHelper 'leaveBusinessName', | |
(app, name, context) -> | |
triggerEvent('input[name="businessName"]', 'blur') | |
test 'Signup form', -> | |
click('input[name="businessName"]') | |
fillIn('input[name="businessName"]', "Some name") | |
leaveBusinessName() | |
andThen -> | |
ok(find("div.businessName span.help-block.error").is(':visible'), "Should see error message on previous field") |
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
test 'Signup form', -> | |
click('input[name="businessName"]') | |
fillIn('input[name="businessName"]', "Some name") | |
click('input[name="contactName"]') | |
andThen -> | |
ok(find("div.businessName span.help-block.error").is(':visible'), "Should see error message on previous field") |
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
#ugly code | |
window.SpaAppActivity = [] | |
window.SpaAppErrorsCount = 0 | |
if window.RailsEnv != 'development' && window.RailsEnv != 'test' | |
Ember.onerror = (error) -> | |
console.log(error.stack) | |
console.log(error.message) | |
if window.SpaAppErrorsCount < 2 |