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 'yaml' | |
file_data = YAML.load_file('shipping.yaml') | |
class ShippingData | |
def initialize(attr={}) | |
@sd_data = attr | |
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
// Set up a collection to contain player information. On the server, | |
// it is backed by a MongoDB collection named "players". | |
Players = new Meteor.Collection("players"); | |
var randomScore = function() { | |
return Math.floor(Math.random()*10)*5; | |
} | |
if (Meteor.isClient) { | |
Template.leaderboard.players = function () { |
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
# Given an array of objects with people's name and age | |
# sort this array based on a person's age | |
# for a given age, do not change the order of the original array | |
people = [ | |
{:name => "Jake", :age => 33}, | |
{:name => "Larry", :age => 31}, | |
{:name => "Chhay", :age => 33}, | |
{:name => "Li", :age => 29}, | |
{:name => "Li2", :age => 32}, |
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
$('a.cne-google').on('mouseenter', function() { | |
$('div#cne-google-tooltip').fadeIn(); | |
}) | |
$('#cne-google').mouseleave( function() { | |
$('#cne-google-tooltip').delay(1000).fadeOut("slow"); | |
}) | |
$('#cne-google-tooltip').mouseenter(function(){ | |
$('a.cne-google').stop(); |
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
package "python-software-properties" do | |
action :install | |
end | |
execute "redis ppa install" do | |
command "/usr/bin/add-apt-repository ppa:chris-lea/redis-server" | |
command "/usr/bin/apt-get -y update" | |
action :run | |
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
[2013-08-16T23:33:35+00:00] DEBUG: Gem::InstallError: ruby_block[Compile Custom OpsWorks Run List] (opsworks_custom_cookbooks::execute line 3) had an error: Gem::InstallError: chef_gem[hipchat] (hipchat::default line 1) had an error: Gem::InstallError: httparty requires multi_xml (>= 0.5.2) | |
/usr/lib/ruby/vendor_ruby/rubygems/installer.rb:232:in `ensure_dependency' | |
/usr/lib/ruby/vendor_ruby/rubygems/installer.rb:408:in `ensure_dependencies_met' | |
/usr/lib/ruby/vendor_ruby/rubygems/installer.rb:407:in `each' | |
/usr/lib/ruby/vendor_ruby/rubygems/installer.rb:407:in `ensure_dependencies_met' | |
/usr/lib/ruby/vendor_ruby/rubygems/installer.rb:158:in `install' | |
/usr/lib/ruby/vendor_ruby/rubygems/dependency_installer.rb:297:in `install' | |
/usr/lib/ruby/1.8/fileutils.rb:243:in `each_with_index' | |
/usr/lib/ruby/vendor_ruby/rubygems/dependency_installer.rb:270:in `each' | |
/usr/lib/ruby/vendor_ruby/rubygems/dependency_installer.rb:270:in `each_with_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
{ | |
"command": "ruby -rubygems -r./custom_plan -eZeus.go", | |
"plan": { | |
"boot": { | |
"default_bundle": { | |
"development_environment": { | |
"prerake": {"rake": []}, | |
"console": ["c"], | |
"generate": ["g"] |
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 'zeus/rails' | |
class CustomPlan < Zeus::Rails | |
# def my_custom_command | |
# # see https://github.com/burke/zeus/blob/master/docs/ruby/modifying.md | |
# end | |
def spec(argv=ARGV) | |
# disable autorun in case the user left it in spec_helper.rb | |
RSpec::Core::Runner.disable_autorun! |
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
{ | |
"command": "ruby -rubygems -r./custom_plan -eZeus.go", | |
"plan": { | |
"boot": { | |
"default_bundle": { | |
"development_environment": { | |
"prerake": {"rake": []}, | |
"console": ["c"], | |
"generate": ["g"] |
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
=> #<User id: 110, email: "[email protected]", crypted_password: "$2a$10$oWWIP/cyDCkdjSAuabsWd.4LmITNER2.snHZNs1n9c8R...", salt: "y85TW1tozJXwXqxWsU7L", created_at: "2014-01-29 22:59:07", updated_at: "2014-01-29 22:59:08", remember_me_token: nil, remember_me_token_expires_at: nil, reset_password_token: nil, reset_password_token_expires_at: nil, reset_password_email_sent_at: nil, last_login_at: "2014-01-29 23:32:53", last_logout_at: nil, last_activity_at: "2014-01-31 16:50:57", first_name: "jaimel", last_name: "gauda", phone_number: "3144948435", zendesk_user_id: "605708293", last_login_from_ip_address: "24.6.52.99", used_free_months: 0, agree_to_tos: true, lead_id: nil, conversion_token: ""> | |
irb(main):005:0> user.invoices | |
[Shard: slave_0] Invoice Load (1.3ms) SELECT `invoices`.* FROM `invoices` WHERE `invoices`.`user_id` = 110 | |
=> #<ActiveRecord::Associations::CollectionProxy [#<Invoice id: 105, order_id: 112, user_id: 110, foreign_key: "in_3Ov9pbVLvRGBRg", aasm_state: "shipped", created_at: " |