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
# encoding: utf-8 | |
class GoogleTranslate | |
BASE_URL = 'https://www.googleapis.com/language/translate/v2' | |
URL_OPTIONS = [ :key, :target, :source, :q, :format ] | |
include HTTParty | |
format :json |
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 Accommodation | |
include Mongoid::Document | |
references_many :reservations | |
end |
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
// ========================================================================== | |
// Project: Billapp.ObserveStatus | |
// Copyright: ©2011 Blueberry.cz Apps s.r.o. | |
// ========================================================================== | |
/*globals Billapp */ | |
/** @namespace | |
@version 0.1 | |
*/ |
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
# encoding: utf-8 | |
require 'mongoid_typecast_attributes' | |
module Mongoid | |
module Document | |
include MongoidTypecastAttributes | |
end | |
end |
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 | |
# encoding: utf-8 | |
require 'net/scp' | |
require 'net/ssh' | |
app = 'his' | |
lang = 'en' | |
host = 'zoidberg.blueberry.cz' |
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
# Switch to Ruby 1.8.7 | |
rvm use 1.8.7 | |
# Print out the ruby version | |
ruby -v | |
# But the output of this is: | |
# | |
# $ ./tryrvm | |
# <i> Now using ruby 1.8.7 p249 </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
context "when deleting 2 nested docs" do | |
let(:person) { Person.new } | |
before do | |
person.favorites.build(:title => "Johnny") | |
person.favorites.build(:title => "Ice cream") | |
person.favorites.build(:title => "Coke") | |
person.favorites.build(:title => "Sugar") | |
person.save! |
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
context "when adding a nested doc and updating existing doc's attributes" do | |
let(:person) { Person.new } | |
before do | |
person.addresses << Address.new({ "street" => "Folsom", "city" => "San Francisco" }) | |
person.save! | |
@attributes = { | |
"0" => { "street" => "New Street" }, | |
"1" => { "street" => "5th Street", "city" => "Boston" }, |
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
require 'mongomapper' | |
class Media | |
include MongoMapper::EmbeddedDocument | |
key :file, String | |
end | |
class Video < Media | |
key :length, Integer | |
end |
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 | |
# Configures the git author to a list of developers when pair programming | |
# | |
# Usage: pair lm bh (Sets the author to 'Luke Melia and Bryan Helmkamp') | |
# pair (Unsets the author so the git global config takes effect) | |
# | |
# Author: Bryan Helmkamp (http://brynary.com) | |
####################################################################### |