Skip to content

Instantly share code, notes, and snippets.

@karmi
karmi / whats-wrong-with-ruby-libraries-for-couchdb.markdown
Created August 1, 2010 19:17
What's wrong with Ruby libraries for CouchDB?

What's wrong with Ruby libraries for CouchDB?

During the last year, I have worked on couple of Ruby/Rails based projects where the primary datastore was CouchDB. CouchDB, to me, is a dream database for web developer come true. The simplicity, the HTTP-based API, the abandonment of SQL semantics, the inspiring community, that all reminds me of when I came into Rails years ago.

However, working with Couch in Ruby and Rails is very, very painful, in my opinion. I'd like to briefly summarize some of my frustrations here. Maybe they are shared, maybe not -- if they are, I think we should launch some coordinate effort to make using Couch in Ruby a pleasure and intelectual satisfaction, not endless loops of research and hacks to „make it work“.

Please note, that my interest is solely to stir the debate. I may be severely mistaken in any point. But, I'd like using Couch in a Ruby application to be a joy, not a frustration, which is what I've met more times than I'd ha

require 'pickle/world'
module Pickle::Session
def create_model(pickle_ref, fields = nil)
factory, label = *parse_model(pickle_ref)
raise ArgumentError, "Can't create with an ordinal (e.g. 1st user)" if label.is_a?(Integer)
fields = fields.is_a?(Hash) ? parse_hash(fields) : parse_fields(fields)
#my addition
fields = allow_json_fields(fields)
@nu7hatch
nu7hatch / Gemfile
Created August 4, 2010 09:32
Padrino authentication with Warden
# ...
gem 'padrino-warden', :git => "git://github.com/zmack/padrino-warden.git"
gem 'authtools'
@jcf
jcf / spork-1.9.2-p0-error.txt
Created August 19, 2010 13:29
Output from spork crash
Using RSpec
Preloading Rails environment
Loading Spork.prefork block...
No server is running
Running specs locally:
dyld: lazy symbol binding failed: Symbol not found: _rb_method_node
Referenced from: /Users/jcf/.rvm/gems/ruby-1.9.2-p0/gems/ruby-debug-base19-0.11.23/lib/ruby_debug.bundle
Expected in: flat namespace
dyld: Symbol not found: _rb_method_node
@joshwand
joshwand / What Killed Waterfall could Kill Agile.textile
Created November 22, 2010 23:50
What Killed Waterfall Could Kill Agile.

ganked from unreadable scribd doc here: http://cleancoder.posterous.com/what-killed-waterfall-could-kill-agile

What Killed Waterfall could Kill Agile.

Robert C. Martin
20 Nov, 2010

In 1970 a software engineer named Dr. Winston W. Royce wrote a seminal paper entitled Managing the Development of Large Software Systems. This paper described the software process that Royce felt was appropriate for large-scale systems. As a designer for the Aerospace industry, he was uniquely qualified.

He began the paper by setting up a straw-man process to knock down. He described this naïve process as “grandiose”. He depicted it with a simple diagram on an early page of his paper. Then the paper methodically tears this “grandiose” process apart. In the end, Royce proposed a far more nuanced and insightful approach, leaving the reader to giggle at the silliness of the “grandiose” model.

@tenderlove
tenderlove / a_query.rb
Created April 12, 2011 17:08
An example using lolquery
###
# lolquery is an fresh new take on SQL DSLs. NEVER WRITE SQL AGAIN! Using
# amazing lolquery technology, you too will never have to write another SQL
# statement again!
#
# Check out this simple example of using lolquery. Bask in it's simplicity,
# it's expressiveness, but most importantly, it's lack of writing SQL!
#
# <3 <3 <3 <3 <3
@MyArtChannel
MyArtChannel / development.rb
Created April 25, 2011 20:42
Use Pry as IRB replacement in rails 3 console
# Add this to the end of your development.rb and add
#
# gem 'pry'
#
# to your Gemfile and run bundle to install.
silence_warnings do
begin
require 'pry'
IRB = Pry
@ryanb
ryanb / rails_3_1_rc4_changes.md
Created May 6, 2011 01:10
The Changelogs for Rails 3.1 Beta 1

Railties 3.1 RC4

  • The new rake task assets:clean removes precompiled assets. [fxn]

  • Application and plugin generation run bundle install unless --skip-gemfile or --skip-bundle. [fxn]

  • Fixed database tasks for jdbc* adapters #jruby [Rashmi Yadav]

  • Template generation for jdbcpostgresql #jruby [Vishnu Atrai]

@jordanbyron
jordanbyron / users.md
Created June 23, 2011 14:48
Discussion and design ideas for University Web's User API

le API design

A consumer needs to lookup a single user by their github name (jordanbyron). That consumer doesn't know the user's ID. There is a possibility to also search by email and twitter.

"/users.json?github=jordanbyron"
=> [{github: "jordanbyron", id: 1}]

When there are no results an empty array is returned

"/users.json?github=noexist"

@avdi
avdi / when.rb
Created December 5, 2011 22:17
Experimenting with Object#when in Ruby
def maybe_a_sandwich
nil
end
# Methods that might return nil are annoying. We want to write a nice
# confident chain:
result = nil
result = maybe_a_sandwich.add_horseradish.get_into_my_belly! rescue $!
result # => #<NoMethodError: undefined method `add_horseradish' for nil:NilClass>