Skip to content

Instantly share code, notes, and snippets.

View imajes's full-sized avatar

James Cox imajes

View GitHub Profile
main » u = UserExperiment.find_by_email('---')
D, [2014-07-14T19:12:44.447225 #58587] DEBUG -- : UserExperiment Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."email" = '---' LIMIT 1
#<UserExperiment:0x000001021c8178> {
:id => 490,
:login => "imajes",
:email => "---",
:encrypted_password => "...",
:reset_password_token => "LdSS1bpDFTXyziEn7s_7",
:reset_password_sent_at => nil,
:remember_created_at => nil,
#!/bin/bash
for branch in `git branch -a | grep remotes | grep -v HEAD | grep -v master`; do
git branch --track ${branch##*/} $branch
done
@imajes
imajes / gist:4314471
Created December 17, 2012 00:10
why i like awesome_print etc
(main)> magic = App.delegate.instance_variable_get('@magic_controller')
=> #<MagicController:0xc072f00>
(main)> ap magic.methods
[
[ 0] !() MagicController (NSObject)
[ 1] !=:(arg1) MagicController (NSObject)
[ 2] !~:(arg1) MagicController (NSObject)
[ 3] <<:(arg1) MagicController (UIViewController)
[ 4] <=>:(arg1) MagicController (NSObject)
[ 5]
@imajes
imajes / gist:4314310
Created December 16, 2012 23:46
Why I like awesome_print, rubymotion, etc..
(main)> magic = App.delegate.instance_variable_get('@magic_controller')
=> #<MagicController:0xc167ff0>
(main)> ap magic.methods
[
[ 0] !() MagicController (NSObject)
[ 1] !=:(arg1) MagicController (NSObject)
[ 2] !~:(arg1) MagicController (NSObject)
[ 3]
@imajes
imajes / test.rb
Created September 25, 2012 19:08
class Foo
class << self
attr_accessor :bar
end
def self.current_thing
@bar ||= calculate_current_thing
end
unless @_mGotData
# If the data starts with BOM, we know it is UTF
if data[0,3] == "\xEF\xBB\xBF":
# EF BB BF UTF-8 with BOM
@result = {"encoding"=> "UTF-8", "confidence"=> 1.0}
elsif data[0,4] == "\xFF\xFE\x00\x00":
# FF FE 00 00 UTF-32, little-endian BOM
@result = {"encoding"=> "UTF-32LE", "confidence"=> 1.0}
elsif data[0,4] == "\x00\x00\xFE\xFF":
# 00 00 FE FF UTF-32, big-endian BOM
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative
(gdb) thread apply all bt
Thread 5 (process 20277):
#0 0x00007fff8df08ce2 in __pthread_kill ()
#1 0x00007fff915517d2 in pthread_kill ()
#2 0x0000000100831b46 in abort () at state.cpp:219
#3 0x000000010001ccfb in bert::Decoder<bert::IOReader>::convert_term (this=0x111483b98, term=0x6) at bert.hpp:846
#4 0x000000010001a9d6 in bert::Decoder<bert::IOReader>::next_value () at /Users/james/.rvm/src/rbx-head/vm/util/bert.hpp:1087
#5 0x000000010001a9d6 in rubinius::QueryAgent::process_commands (this=0x11032f230, client=@0x6) at bert.hpp:368
#6 0x000000010001b28a in rubinius::QueryAgent::perform (this=0x111483ef0) at agent.cpp:572
#0 0x00007fff8df08ce2 in __pthread_kill ()
#1 0x00007fff915517d2 in pthread_kill ()
#2 0x0000000100831b46 in abort () at state.cpp:219
#3 0x000000010001ccfb in bert::Decoder<bert::IOReader>::convert_term (this=0x111483b98, term=0x6) at bert.hpp:846
#4 0x000000010001a9d6 in bert::Decoder<bert::IOReader>::next_value () at /Users/james/.rvm/src/rbx-head/vm/util/bert.hpp:1087
#5 0x000000010001a9d6 in rubinius::QueryAgent::process_commands (this=0x11032f230, client=@0x6) at bert.hpp:368
#6 0x000000010001b28a in rubinius::QueryAgent::perform (this=0x111483ef0) at agent.cpp:572
#7 0x0000000100026e95 in thread::Thread::trampoline (arg=0x11032f230) at thread.hpp:76
#8 0x00007fff9154f8bf in _pthread_start ()
#9 0x00007fff91552b75 in thread_start ()
% rbenv install 1.9.3-p194
Downloading http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz...
Installing yaml-0.1.4...
Installed yaml-0.1.4 to /home/deploy/.rbenv/versions/1.9.3-p194
Downloading http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz...
Installing ruby-1.9.3-p194...
Installed ruby-1.9.3-p194 to /home/deploy/.rbenv/versions/1.9.3-p194
ruby: no such file to load -- ubygems (LoadError)