Skip to content

Instantly share code, notes, and snippets.

View bryanl's full-sized avatar
🚩
Out in the streets

Bryan Liles bryanl

🚩
Out in the streets
View GitHub Profile
@bryanl
bryanl / run_tags.rb
Created April 2, 2009 16:49 — forked from tobias/run_tags.rb
http://vimeo.com/3989493 <--- more info here
#!/usr/bin/ruby
#-*-ruby-*-
# A script to run ctags on all .rb files in a project. Can be run on
# the current dir, called from a git callback, or install itself as a
# git post-merge and post-commit callback.
CTAGS = '/opt/local/bin/ctags'
HOOKS = %w{ post-merge post-commit post-checkout }
HOOKS_DIR = '.git/hooks'
trait Shape {
var x : Int
var y : Int
def draw
def moveTo(newx: Int, newy: Int) = {
x = newx
y = newy
}
@bryanl
bryanl / .zshrc
Created April 25, 2009 15:56 — forked from qrush/.zshrc
# autocompletion for ruby_test
# # works with tu/tf aliases
# # see also ~/bin/ruby_test.rb
_ruby_tests() {
if [[ -n $words[2] ]]; then
compadd `ruby_test -l ${words[2]}`
fi
}
compdef _ruby_tests ruby_test
alias tu="ruby_test unit"
def const_accessor(sym, value, remove=false, freeze=true)
value.deepfreeze if freeze
sym = sym.to_s
down, up = sym.downcase, sym.upcase
sym = up.to_sym
remove_const sym if remove and const_defined? sym
const_set sym, value
class_eval "def #{down}; #{up}; end\ndef self.#{down}; #{up}; end"
end
module Sinatra
module Authorization
def auth
@auth ||= Rack::Auth::Basic::Request.new(request.env)
end
def unauthorized!(realm="flixcloud.com")
response['WWW-Authenticate'] = %(Basic realm="#{realm}")
throw :halt, [ 401, 'Authorization Required' ]
# from lib/ruby/1.8/open-uri.rb at around line 230
# this only breaks on my mac
http = klass.new(target_host, target_port)
if target.class == URI::HTTPS
require 'net/https'
http.use_ssl = true
# commented this out because we aren't going to verify due
# to the bus error
/Users/bryan/Development/ruby/lib/ruby/1.8/i686-darwin9.7.0/openssl.bundle:
/usr/lib/libssl.0.9.7.dylib (compatibility version 0.9.7, current version 0.9.7)
/usr/lib/libcrypto.0.9.7.dylib (compatibility version 0.9.7, current version 0.9.7)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.4)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 227.0.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
def event_sql()
%q{events.id, events.user_id, events.name, events.description,
CONVERT_TZ( CASE
WHEN recur_unit = 'mweek' THEN
NWEEKDAY_DATETIME(
today_time + INTERVAL IF(DAY(now_time) > NWEEKDAY_DAY(now_time, recur_every), 1, 0) MONTH,
recur_every
)
WHEN recur_unit = 'month' THEN
today_time - INTERVAL (DAY(today_time) - DAY(start_time)) DAY
has_many_using :memberships, :using=>:group_ids, :group=>'@alias@.user_id', :readonly=>true,
:include=>:user, :conditions=>"users.completed = 1", :with_deleted=>true,
:select=>%q{
MIN(@alias@.id) id, @alias@.user_id, NULL group_id, NULL primary_email,
BIT_OR(@alias@.desired_personas) desired_personas,
MIN(@alias@.prof_photo_id) pp_photo_id, MIN(@alias@.pers_photo_id) ps_photo_id,
BIT_OR(@alias@.profile_flags) profile_flags,
MIN(@alias@.pers_name_privacy) pers_name_privacy, MIN(@alias@.prof_name_privacy) prof_name_privacy,
MIN(@alias@.pers_birthday_privacy) pers_birthday_privacy, MIN(@alias@.prof_birthday_privacy) prof_birthday_privacy,
MIN(@alias@.hide_relationship_status) hide_relationship_status, MIN(@alias@.hide_looking_for) hide_looking_for,
[error]: NoMethodError: undefined method `count' for []:Array
[error]: in generator YARD::Generators::AttributesGenerator: /Users/bryan/Development/ruby/lib/ruby/gems/1.8/gems/yard-0.2.3/bin/../lib/../templates/default/attributes/html/header.erb
[error]: /Users/bryan/Development/ruby/lib/ruby/gems/1.8/gems/yard-0.2.3/bin/../lib/../templates/default/attributes/html/header.erb:10:in `render_method'
/Users/bryan/Development/ruby/lib/ruby/gems/1.8/gems/yard-0.2.3/bin/../lib/../templates/default/attributes/html/header.erb:8:in `each'
/Users/bryan/Development/ruby/lib/ruby/gems/1.8/gems/yard-0.2.3/bin/../lib/../templates/default/attributes/html/header.erb:8:in `render_method'
/Users/bryan/Development/ruby/lib/ruby/gems/1.8/gems/yard-0.2.3/bin/../lib/../templates/default/attributes/html/header.erb:4:in `each'
/Users/bryan/Development/ruby/lib/ruby/gems/1.8/gems/yard-0.2.3/bin/../lib/../templates/default/attributes/html/header.erb:4:in `render_method'
/Users/bryan/Development/ruby/lib/ruby/gems/1.8/gems/yard-0.2.3/bi