Decided to turn this gist into a blog post and did not want to maintain both places.
Full post here: http://johnnunemaker.com/pain-and-programming/
Decided to turn this gist into a blog post and did not want to maintain both places.
Full post here: http://johnnunemaker.com/pain-and-programming/
| module Kestrel | |
| class Client | |
| class BlockingWithCheck < Blocking | |
| attr_accessor :return_check | |
| def get(*args) | |
| count = 0 | |
| while count += 1 |
| source 'https://rubygems.org' | |
| gem 'cassanity' |
| # ****************************************************************************** | |
| # NOTE: You will need to replace keyspace and migrations_path in the rake tasks | |
| # below with whatever makes sense for your application. You will also need a | |
| # task named environment that loads whatever is need to make cassanity available. | |
| # ****************************************************************************** | |
| namespace :db do | |
| desc "Run any pending migrations." | |
| task :migrate => :environment do | |
| require 'cassanity/migrator' |
| Plucky::Query.class_eval do | |
| def paginate_without_total(opts={}) | |
| page = (opts.delete(:page) || 1).to_i | |
| limit = (opts.delete(:per_page) || per_page).to_i | |
| skip = (page - 1) * limit | |
| all(opts.merge(:limit => limit, :skip => skip)) | |
| end | |
| end |
Original source: https://hackpad.com/Web-And-Mobile-Revenue-Models-(final)-EgXuEtSibE7
Stable? In most developer communities, especially Ruby, stable seems nothing short of a curse word. Everyone seems to be addicted to new. I should know, as I once was. Heck, I even own addictedtonew.com.
Over the past few years, my sentiments have changed. Through my experience maintaining and growing a handful of applications, I have grown to respect and love stability.
This talk is jam packed with everything I have learned about building and growing a production application. Stories of mistakes and victories will abound.
| db.command(BSON::OrderedHash['serverStatus', 1, 'repl', 1])['repl']['sources'].first['syncedTo']['time'] |
| require 'pp' | |
| require 'rubygems' | |
| require 'mongo' | |
| conn = Mongo::Connection.new | |
| db = conn.db('test') | |
| col = db['test'] | |
| col.remove | |
| oid = BSON::ObjectId.new |