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
Arthur-Nevess-MacBook-Pro:github arthurnn$ mkdir v | |
Arthur-Nevess-MacBook-Pro:github arthurnn$ cd v | |
Arthur-Nevess-MacBook-Pro:v arthurnn$ vagrant init lucid32 http://files.vagrantup.com/lucid32.box | |
A `Vagrantfile` has been placed in this directory. You are now | |
ready to `vagrant up` your first virtual environment! Please read | |
the comments in the Vagrantfile as well as documentation on | |
`vagrantup.com` for more information on using Vagrant. | |
Arthur-Nevess-MacBook-Pro:v arthurnn$ vagrant up | |
[default] Box lucid32 was not found. Fetching box from specified URL... | |
[vagrant] Downloading with Vagrant::Downloaders::HTTP... |
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
public class LoginActivity extends Activity implements XAuth500pxTask.Delegate{ | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
XAuth500pxTask loginTask = new XAuth500pxTask(this); | |
loginTask.execute(getString(R.string.px_consumer_key), getString(R.string.px_consumer_secret),"username","pass"); | |
} |
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
1.9.3p194 :004 > UserSettings.first.updated_at | |
NoMethodError: undefined method `updated_at' for #<UserSettings:0x007fb2f085f2a0> | |
from /Users/arthurnn/.rvm/gems/ruby-1.9.3-p194/gems/mongoid-2.4.12/lib/mongoid/attributes.rb:166:in `method_missing' | |
from (irb):4 | |
from /Users/arthurnn/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.1.6/lib/rails/commands/console.rb:45:in `start' | |
from /Users/arthurnn/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.1.6/lib/rails/commands/console.rb:8:in `start' | |
from /Users/arthurnn/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.1.6/lib/rails/commands.rb:40:in `<top (required)>' | |
from script/rails:6:in `require' | |
from script/rails:6:in `<main>' | |
1.9.3p194 :005 > UserSettings.first.cache_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
1.9.3p194 :008 > Atm.create! :name => 'td' | |
=> #<Atm _id: 50da19f3803a9372a4000001, name: "td", _type: "Atm"> | |
1.9.3p194 :009 > Item.create! :name => 'item' | |
=> #<Item _id: 50da19fb803a9372a4000002, name: "item", _type: "Item"> | |
1.9.3p194 :010 > Item.all.map &:_type | |
=> ["Atm", "Item"] | |
1.9.3p194 :011 > Item.all | |
=> #<Mongoid::Criteria | |
selector: {} | |
options: {} |
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
BSON::ObjectId.new | |
user system total real | |
10gen-mongo 0.910000 0.000000 0.910000 ( 0.920081) | |
moped 0.250000 0.000000 0.250000 ( 0.247459) | |
BSON::ObjectId.to_s | |
user system total real | |
10gen-mongo 5.920000 0.010000 5.930000 ( 5.929247) | |
moped 5.090000 0.010000 5.100000 ( 5.095296) |
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 "benchmark" | |
require 'moped' | |
require 'mongo' | |
include Mongo | |
@client = MongoClient.new('localhost', 27017) | |
@db = @client['mongo_benchmark'] | |
@coll = @db['mongo10gen'] | |
@coll.remove |
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 Order | |
include Mongoid::Document | |
field :state | |
field :sent_at, type: Time | |
field :number, type: Integer | |
index({ sent_at: 1 }) | |
scope :sent, any_in(state: [:sent]).desc(:sent_at) |
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 I18n | |
extend ActiveSupport::Concern | |
included do | |
attr_accessor :forced_locale | |
end | |
module ClassMethods | |
def i18n_field(*syms) |
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 "bundler/capistrano" | |
set :application, "set your application name here" | |
set :user, "set your Locaweb's user" | |
set :server_addr, "set the Locaweb's server ip address or your ftp address" | |
set :deploy_to, "/home/#{user}/rails_app/#{application}" | |
set :rails_env, "production" | |
set :use_sudo, false | |
# Git settings |
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 FaviconLogosUploader < CarrierWave::Uploader::Base | |
include CarrierWave::MiniMagick | |
version :favicon do | |
process :resize_to_fit => [32, 32] | |
process :convert => :ico | |
def full_filename(for_file) | |
"favicon.ico" if original_filename | |
end |