Skip to content

Instantly share code, notes, and snippets.

View danielevans's full-sized avatar

Daniel Evans danielevans

  • Anfract
  • Portland, OR
View GitHub Profile
@danielevans
danielevans / output.txt
Created March 16, 2012 21:46
capybara-webkit pushState issue demonstration
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
http://127.0.0.1:54850/
/
--------------------------------------------------------------------------------
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
http://127.0.0.1:54850/
/
--------------------------------------------------------------------------------
@danielevans
danielevans / create_callback.js
Created March 12, 2012 18:12
Bindings Problem
//This responds to a click in the DOM
var newList = App.List.createRecord({});
if(newList.get("valid")) {
newList.store.commit();
} else {
// my most recent attempt to prevent the bindings
App.store.deleteRecord(newList);
@danielevans
danielevans / gist:1287851
Created October 14, 2011 18:06
Broken rails form helper code
Controller:
@estimate = Hashie::Mash.new({
:same_address => 1,
:cc_number => nil,
:shipping_address => Hashie::Mash.new,
:billing_address => Hashie::Mash.new
})
View:
@danielevans
danielevans / gist:1026490
Created June 15, 2011 04:35
Palindrome search space
FourscoreandsevenyearsagoourfaathersbroughtforthonthiscontainentanewnationconceivedinzLibertyanddedicatedtothepropositionthatallmenarecreatedequalNowweareengagedinagreahtcivilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvancedItisratherforustobeherededicatedtothegreattdafskremainingbeforeusthatfromthesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastpfullmeasureofdevotionthatweherehighlyresolvethatthesedeadshal
@danielevans
danielevans / gist:1011309
Created June 6, 2011 23:01
A create admin rake task using the highline gem
namespace :admin do
desc "creates and admin user"
task :create => :environment do
line = HighLine.new # a command line lib that uses erb? Bizarre.
line.say "<%= color('Creating a new administrative user', BOLD) %>"
email = line.ask("Email: ")
pass = line.ask("Password: " ) { |q| q.echo = "*" }
admin = Admin.new(:email => email, :password => pass)
@danielevans
danielevans / attachment.rb
Created May 29, 2011 07:51
multiple dynamic file storage for paperclip
module Paperclip
class Attachment
attr_accessor :queued_for_write, :queued_for_delete
end
end
@danielevans
danielevans / gist:968072
Created May 12, 2011 07:06
JSON api definition for competition server
//ACTION DEFINITIONS
//start_game
{//informs of a game starting
"method": "start_game",
"game": GAME_OBJECT,
"player": PLAYER_OBJECT
}
//response ignored
rvm_dir = File.join([ENV['rvm_path'], 'lib'])
$LOAD_PATH.unshift(rvm_dir) unless $LOAD_PATH.include?(rvm_dir)
require 'rvm'
RVM.use! "default"
RVM.rvm :gemset, :create, app_name
RVM.rvm :use, "default@#{app_name}", :rvmrc => true
@danielevans
danielevans / rvm helper
Created April 17, 2011 08:05
RVM from a ruby script
rvm_dir = File.join([ENV['rvm_path'], 'lib'])
$LOAD_PATH.unshift(rvm_dir) unless $LOAD_PATH.include?(rvm_dir)
require 'rvm'
RVM.use! "ree"
RVM.rvm :gemset, :create, app_name
RVM.rvm :use, "ree@#{app_name}", :rvmrc => true
@danielevans
danielevans / gist:923831
Created April 17, 2011 07:45
rvm install script
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then
source "$HOME/.rvm/scripts/rvm"
elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then
source "/usr/local/rvm/scripts/rvm"
else
printf "ERROR: An RVM installation was not found.\n"
fi
rvm use --create ree@#{app_name}
gem install bundler --no-ri --no-rdoc