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
class ClientSocket | |
constructor: () -> | |
@socket = new io.Socket() | |
@socket.connect() | |
@socket.on 'connect', => | |
this.trigger('connect.server', null) | |
@socket.on 'message', (response) => | |
this.trigger(response.trigger, response.payload) | |
@socket.on 'disconnect', => | |
this.trigger('disconnect.server', null) |
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
Migrate Heroku app to 1.9.2 | |
http://devcenter.heroku.com/articles/bamboo | |
> heroku stack:migrate bamboo-mri-1.9.2 | |
> heroku config:add BUNDLE_WITHOUT="development:test" |
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 'test/unit' | |
class Frame | |
attr_reader :rolls | |
def initialize(first_roll) | |
@rolls = [first_roll] | |
end | |
def << pins |
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
Factory.define :post do |post_factory| | |
post_factory.user { Factory.build(:user) } | |
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
// inserting HTML that contains a script that contains document.write | |
$('a').first().html('<script>document.write("hey! don't be broken")</script>'); |
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
if (window.___dialogEncountered === undefined) { | |
window.___dialogEncountered = false; | |
} | |
if (window.___dialogReturnValue === undefined) { | |
window.___dialogReturnValue = false; | |
} | |
window.___dialogHandler = function(dialogType) { | |
window.parent.___dialogEncountered = dialogType; |
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 'cucumber/step_definition_light' | |
class StepUsage | |
class StepDefKey < Cucumber::StepDefinitionLight | |
end | |
def initialize(step_mother, io, options) | |
@step_mother = step_mother | |
@io = io | |
@stepdef_to_match = Hash.new{|h,stepdef_key| h[stepdef_key] = []} |
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
protected | |
def url_for(options = {}) | |
if options.has_key?(:controller) | |
options[:controller] = "/#{options[:controller]}" | |
end | |
super(options) | |
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
MySQL commands | |
mysql> create database [database_name]; | |
mysql> show databases; | |
CREATE BACKUP | |
mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql | |
RESTORE BACKUP | |
mysql -u root -p[root_password] [database_name] < dumpfilename.sql |
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 NumberFormat | |
def to_comma_separated | |
self.to_s.gsub(/(\d)(?=\d{3}+(\.\d*)?$)/, '\1,') | |
end | |
end | |
class Integer | |
include NumberFormat | |
end | |
class Float |