Skip to content

Instantly share code, notes, and snippets.

Avatar

Ryan Cook cookrn

View GitHub Profile
@cookrn
cookrn / console.out
Created Apr 8, 2011
rvm errors on upgrade from 1.2.x to 1.6.0
View console.out
/Users/ryancook/Developer/.rvm/scripts/rvm:97: command not found: rvm_error
/Users/ryancook/Developer/.rvm/scripts/rvm:119: command not found: __rvm_conditionally_add_bin_path
~ » Workspace/xyz/cookrn/xyz-core-api
~/Workspace/xyz/cookrn/xyz-core-api » rvm info [develop]
rvm:12: command not found: __rvm_cleanse_variables
@cookrn
cookrn / env.rb
Created Apr 12, 2011
trace from "gem install thin --trace"
View env.rb
RubyGems Environment:
- RUBYGEMS VERSION: 1.7.2
- RUBY VERSION: 1.9.2 (2011-02-18 patchlevel 180) [x86_64-darwin10.7.0]
- INSTALLATION DIRECTORY: /Users/ryancook/Developer/.rvm/gems/ruby-1.9.2-p180@my_proj
- RUBY EXECUTABLE: /Users/ryancook/Developer/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
- EXECUTABLE DIRECTORY: /Users/ryancook/Developer/.rvm/gems/ruby-1.9.2-p180@my_proj/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-10
- GEM PATHS:
@cookrn
cookrn / image.rb
Created Apr 25, 2011
Simple Mount Classes With CarrierWave
View image.rb
class Image
extend CarrierWave::Mount
mount_uploader :image , ImageUploader
end
@cookrn
cookrn / error.out
Created Apr 30, 2011
Cinderella Error
View error.out
INFO: Installing homebrew[git] version 1.7.5
[Sat, 30 Apr 2011 15:08:58 -0600] ERROR: script[updating homebrew from github] (/Users/ryancook/.cinderella/cookbooks/homebrew/recipes/default.rb:59:in `from_file') had an error:
"bash" "/var/folders/qA/qA-aECR1F4GtR+JLdwoQe++++TI/-Tmp-/chef-script20110430-6842-1e4llqv-0" returned 1, expected 0
/Library/Ruby/Gems/1.8/gems/chef-0.9.16/bin/../lib/chef/mixin/command.rb:184:in `handle_command_failures'
/Library/Ruby/Gems/1.8/gems/chef-0.9.16/bin/../lib/chef/mixin/command.rb:131:in `run_command'
/Library/Ruby/Gems/1.8/gems/chef-0.9.16/bin/../lib/chef/provider/execute.rb:49:in `action_run'
/Library/Ruby/Gems/1.8/gems/chef-0.9.16/bin/../lib/chef/provider/script.rb:33:in `action_run'
/Library/Ruby/Gems/1.8/gems/chef-0.9.16/bin/../lib/chef/resource.rb:395:in `send'
/Library/Ruby/Gems/1.8/gems/chef-0.9.16/bin/../lib/chef/resource.rb:395:in `run_action'
/Library/Ruby/Gems/1.8/gems/chef-0.9.16/bin/../lib/chef/runner.rb:53:in `run_action'
@cookrn
cookrn / other_resource_presenter.rb
Created May 3, 2011
Presenters As A Solution To as_json Woes In Rails APIs
View other_resource_presenter.rb
# app/presenters/api/v1/other_resource_presenter.rb
class Api::V1::OtherResourcePresenter
attr_reader :other_resource
def initialize( other_resource )
@other_resource = other_resource
end
def as_json( include_root = false )
@cookrn
cookrn / config.ru
Created Jun 10, 2011
Rack 1.3.0 & Serving Static Files
View config.ru
# Set Our Root Path
::ROOT = File.dirname( File.expand_path( __FILE__ ) )
# Boot The App
require "#{ROOT}/config/boot.rb"
# Serve our index file by default
use Rack::Static , :urls => { "/" => "index.html" } , :root => "public"
# Setup Rack
@cookrn
cookrn / core.clj
Created Jul 27, 2011
Your First Clojure Web App
View core.clj
(ns myfirstwebapp.core)
(defn app [req]
{:status 200
:headers {"content-Type" "text/html"}
:body "Hello World!"})
View hole1_fizzbuzz.rb
# HOLE 1
#
# Given a number the function returns “Fizz” if it is a multiple of 3,
# “Buzz” if it is a multiple of 5 and “FizzBuzz” if it is a multiple of
# 15. If the number is not a multiple of 3 or 5 then the number is
# returned as a string.
# Original answer
def fizzbuzz( n )
b,m="Buzz",n%5==0;n%3==0?"Fizz#{b if m}":m ?b:n
@cookrn
cookrn / Gemfile
Created Dec 12, 2011
Sample RBX Error Output
View Gemfile
source :rubygems
gem "sinatra"
group :development do
gem "foreman"
end
@cookrn
cookrn / app.js
Created Dec 26, 2011
Push to Resque Queue from Node
View app.js
require( './boot' );
var DbItem = require( './db_item' )
, item = new DbItem( '123456abcdefg' );
item.queue( function( error , response ){
console.log( 'Response: ' + response );
process.exit();
} );