Skip to content

Instantly share code, notes, and snippets.

View banister's full-sized avatar
🇳🇱

John Mair banister

🇳🇱
View GitHub Profile
@banister
banister / o.rb
Created November 1, 2012 17:23
Run last line when enter is pressed in pry
[12] pry(main)> Pry.commands.block_command /^$/, "blah" do
| run "history --replay -1"
| end
=> #<class(Pry::Command /^$/)>
[13] pry(main)> 3
=> 3
[14] pry(main)>
=> 3
[16] pry(main)> ls
self.methods: include private public to_s
@datenimperator
datenimperator / Gemfile
Created September 7, 2012 18:55
Sinatra, sprockets, compass, bootstrap-sass playing together
source :rubygems
gem 'shotgun', :group=>:development
gem 'rack-cache'
gem 'sinatra', :require => 'sinatra/base'
gem 'sinatra-support'
gem 'haml'
[28] (pry) main: 0> class Peter
[28] (pry) main: 0* extend FakeOverloader
[28] (pry) main: 0* def ui
[28] (pry) main: 0* puts "hi"
[28] (pry) main: 0* end
[28] (pry) main: 0* def ui(v)
[28] (pry) main: 0* puts "trick"
[28] (pry) main: 0* end
[28] (pry) main: 0* end
=> nil
[7] (pry) main: 0> require 'sqlite3'
=> true
[8] (pry) main: 0> cd SQLite3
[9] (pry) main / SQLite3: 1> ls -M
[10] (pry) main / SQLite3: 1> ls -m
SQLite3.methods: const_missing libversion
[11] (pry) main / SQLite3: 1> ls -c
constants: AbortException AuthorizationException Backup Blob BusyException CantOpenException Constants ConstraintException CorruptException Database EmptyException Exception FormatException FullException InternalException InterruptException IOException LockedException MemoryException MismatchException MisuseException NotADatabaseException NotFoundException PermissionException Pragmas ProtocolException RangeException ReadOnlyException ResultSet SchemaChangedException SQLException SQLITE_VERSION SQLITE_VERSION_NUMBER Statement TooBigException Translator UnsupportedException Value VERSION VersionProxy
[12] (pry) main / SQLite3: 1> ls -M Backup
SQLite3::Backup#methods: finish pagecount remaining step
require 'Qt4'
require 'set'
require 'pry'
# Fight fire with fire
class << Qt::Internal
alias _pride_find_pclassid find_pclassid
private :_pride_find_pclassid
def find_pclassid(val)
require 'pry'
require 'pry-exception_explorer'
require 'pry-exception_explorer/shim_builder'
binary_name = "lib_overrides.#{PryExceptionExplorer::ShimBuilder::Dyname}"
if !File.exists? File.join PryExceptionExplorer::ShimBuilder.dir, binary_name
puts "First run, building shim"
PryExceptionExplorer::ShimBuilder.compile
puts "Hopefully built...!"
@burke
burke / 0-readme.md
Created January 27, 2012 13:44 — forked from funny-falcon/cumulative_performance.patch
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

system ~/projects/jruby $ jirb
>> require 'java'
=> true
>> binding = Thread.current.to_java.getContext.nth_binding(4)
=> #<Java::OrgJrubyRuntime::Binding:0x304648>
>> binding = org.jruby.RubyBinding.new(JRuby.runtime, JRuby.runtime.binding, binding)
=> #<Binding:0x8b3bb3>
>> binding = JRuby.dereference(binding)
=> #<Binding:0x8b3bb3>
>> eval "__FILE__", binding
@banister
banister / gist:1680784
Created January 26, 2012 03:30
binding of caller in JRuby
whitequark
headius: I just opened javadoc of jruby and tried to poke some classes through require 'java'
headius
ok
headius
whitequark: require 'jruby'; runtime = JRuby.runtime; context = runtime.current_context
headius
maybe you can poke at it from there
whitequark
class Match
attr_accessor :matcher, :action
def initialize(matcher, action)
@matcher, @action = matcher, action
end
end
class SwitchBitch
def initialize(value, &block)