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
# | |
# hputs(): makes debug messages readable when debugging specs with the TextMate RSpec bundle | |
# | |
def hputs(*args) | |
puts ERB::Util.html_escape(args.join("\n")).gsub(/\r?\n/, '<br/>') + '<br/>' | |
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
function bondage(object, method_name) { | |
return function() { | |
return object[method_name].apply(object, arguments); | |
} | |
} | |
class Person(){ | |
} | |
Person.prototype.doSomething = function() { | |
// Do something... |
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
# lib/development_email_interceptor.rb | |
class DevelopmentMailInterceptor | |
def self.delivering_email(message) | |
File.open(File.join(Rails.root, *%w{log mail.log}), 'a') do |output| | |
output << "___ EMAIL STARTS ______________________________\n" | |
output << message.encoded | |
output << "^^^ EMAIL ENDS ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" | |
end | |
puts "Send email to #{message.to}. Subject: #{message.subject}" |
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
Show hidden characters
{ | |
"extensions": [ "feature" ], | |
"tab_size": 2, | |
"translate_tabs_to_spaces": true, | |
"trim_automatic_white_space": true, | |
"trim_trailing_white_space_on_save": true, | |
"draw_white_space": "all" | |
} |
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 'pp' | |
def substitute_command_tokens(check) | |
unmatched_tokens = Array.new | |
substituted = check[:command].gsub(/:::([^:]*?):::/) do | |
token, default = $1.to_s.split('|', -1) | |
matched = token.split('.').inject(@settings[:client]) do |client, attribute| | |
if client[attribute].nil? | |
default.nil? ? break : default | |
else |
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
def substitute_command_tokens(check) | |
unmatched_tokens = Array.new | |
substituted = check[:command].split(':::').each_with_index do |match, index| | |
next if index % 2 == 1 | |
token, default = $1.to_s.split('|', -1) | |
matched = token.split('.').inject(@settings[:client]) do |client, attribute| | |
if client[attribute].nil? | |
default.nil? ? break : default | |
else | |
client[attribute] |
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
import Ember from 'ember'; | |
export default Ember.Route.extend({ | |
actions: { | |
ping(from) { | |
console.log("ApplicationRoute^ping from", from); | |
} | |
}, | |
}); |
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
import Ember from 'ember'; | |
import MyModel from '../models/my-model'; | |
export default Ember.Route.extend({ | |
model() { | |
return MyModel.create(); | |
}, | |
}); |
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
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName:'Ember Twiddle' | |
}); |
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
import Ember from 'ember'; | |
import ApplicationAdapter from 'london-waits/pods/application/adapter'; | |
import config from 'london-waits/config/environment'; | |
function readStopId(id) { | |
return id.split(':')[0]; | |
} | |
export default ApplicationAdapter.extend({ | |
pathForType(type) { |
OlderNewer