Skip to content

Instantly share code, notes, and snippets.

View wilson's full-sized avatar

Wilson Bilkovich wilson

View GitHub Profile
if Bundler.requires_sudo?
Bundler.user_bundle_path.join(Bundler.ruby_scope).join(git_scope)
else
Bundler.install_path.join(git_scope)
end
def requires_sudo?
path = bundle_path
path = path.parent until path.exist?
sudo_present = !`which sudo 2>#{NULL}`.empty?
settings.allow_sudo? && !File.writable?(path) && sudo_present
end
def extract_static_instance_method_defs_from(block)
klass = Class.new do
# swallow any missing class method errors;
# we only care to capture the raw method definitions here.
def self.method_missing(*a); end
# skip any dynamic method definitions
def self.define_method(*a); end
# run the block so our instance methods get defined
def address(separator, seperator2=' ')
fields_array = %w(address1 address2 city state zip phone).map {|t| [:billing,t].join('_').to_sym}
(0..10).inject("") { |string, i|
if i.odd?
field = :seperator
field = (field.to_s + '2').intern if i == 7
else
field = fields_array[i/2]
end
temp = send(field) rescue nil
count = 0
Thread.new do
sleep 1
count += 1
end
system 'sleep 10'
puts count
diff -r bffbd5686e74 common/content/buffer.js
--- a/common/content/buffer.js Mon Jun 28 23:40:01 2010 +0200
+++ b/common/content/buffer.js Tue Jun 29 12:38:35 2010 -0400
@@ -1532,7 +1532,7 @@
if (count < 1 && buffer.lastInputField)
buffer.focusElement(buffer.lastInputField);
else {
- let xpath = ["input[not(@type) or @type='text' or @type='password' or @type='file']",
+ let xpath = ["input[not(@type) or @type='text' or @type='password' or @type='file' or @type='search']",
"textarea[not(@disabled) and not(@readonly)]",
text = "the quick brown fox jumped over the lazy dog"
text.scan(/(\w) /) do
p Regexp.last_match
end
>ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-darwin10.3.1]
> which ruby
/Users/wilson/.rvm/rubies/ruby-1.8.7-p249/bin/ruby
> which rbx
rbx not found
> ./configure --prefix=/tmp/doesnotexist --skip-system
Configuring LLVM...
Checking for existing LLVM tree: not found.
Checking for prebuilt LLVM build...
本拠> bin/rbx-build lib/ext/dl/extconf.rb |grep rbx ~/p/rbx
"bindir"=>"/Users/wilson/.rvm/rubies/rbx-head/rubinius/1.0/bin",
"RUBY_INSTALL_NAME"=>"rbx",
"ruby_install_name"=>"rbx",
"rubylibdir"=>"/Users/wilson/.rvm/rubies/rbx-head/rubinius/1.0/site",
"sitedir"=>"/Users/wilson/.rvm/rubies/rbx-head/rubinius/1.0/site",
"rubyhdrdir"=>"/Users/wilson/.rvm/rubies/rbx-head/rubinius/1.0/include",
"/Users/wilson/.rvm/rubies/rbx-head/rubinius/1.0/site/x86_64-darwin10.3.1",
"sitelibdir"=>"/Users/wilson/.rvm/rubies/rbx-head/rubinius/1.0/site",
"/Users/wilson/.rvm/rubies/rbx-head/rubinius/1.0/site/x86_64-darwin10.3.1",
begin
# Try to use the SystemTimer gem instead of Ruby's timeout library
# when running on Ruby 1.8.x. See:
# http://ph7spot.com/articles/system_timer
# We don't want to bother trying to load SystemTimer on jruby,
# ruby 1.9+ and rbx.
if !defined?(RUBY_ENGINE) || (RUBY_ENGINE == 'ruby' && RUBY_VERSION < '1.9.0')
require 'system_timer'
MemCacheTimer = SystemTimer
else