Skip to content

Instantly share code, notes, and snippets.

View texel's full-sized avatar

Leigh Caplan texel

View GitHub Profile
DEPRECATION WARNING: @folder will no longer be implicitly assigned to folder. (called from check at /Users/brandon/Documents/git/macchiato/app/models/permission.rb:279)
DEBUG: check on line 279 of /Users/brandon/Documents/git/macchiato/app/models/permission.rb:
July 21, 2010 01:59 PM: object boolean: true and id: 4 and my_object_id: 2234023680 and my_class: ActiveSupport::Deprecation::DeprecatedObjectProxy
DEBUG: check on line 280 of /Users/brandon/Documents/git/macchiato/app/models/permission.rb:
July 21, 2010 01:59 PM: nil boolean: false and id: 4 and my_object_id: 4 and my_class: NilClass
DEBUG: check on line 282 of /Users/brandon/Documents/git/macchiato/app/models/permission.rb:
July 21, 2010 01:59 PM: ruby version: ruby-1.8.7-p174
DEBUG: check on line 284 of /Users/brandon/Documents/git/macchiato/app/models/permission.rb:
July 21, 2010 01:59 PM: nil bytes: 0x4
DEBUG: check on line 285 of /Users/brandon/Documents/git/macchiato/app/models/permission.rb:
#include "ruby.h"
VALUE ValuePrinter = Qnil;
void Init_value_printer();
VALUE method_inspect_bytes(VALUE object);
void Init_value_printer() {
ValuePrinter = rb_define_module("ValuePrinter");
rb_define_method(ValuePrinter, "inspect_bytes", method_inspect_bytes, 0);
def dfs_order(vertex)
vertex.mark!
vertex.set_discover_time(@time += 1)
vertex.edges.each do |edge_vertex|
unless edge_vertex.visited?
edge_vertex.parent = vertex
dfs_order(edge_vertex)
end
end
end
# Balls!
class Ball
attr_accessor :x_pos, :y_pos, :x_speed, :y_speed
def initialize(x_pos, y_pos, x_speed, y_speed)
self.x_pos = x_pos
self.y_pos = y_pos
self.x_speed = x_speed
self.y_speed = y_speed
class Foo
def initialize
self.collection = []
collection.extend Finder
end
end
module Finder
def [](name)
function aspec {
args=""
for var in "$@"
do
args="$args spec/*/$var\_spec.rb app/*/$var.rb app/processors/$var.rb app/models/*/$var.rb spec/*/controls/$var\_spec.rb spec/models/*/$var\_spec.rb app/*/controls/$var.rb lib/$var.rb"
done
echo "Running autospec $args"
autospec $args
}
foo, bar = nil, nil
begin
transaction do
foo = FooClass.create!(:blah => 'blah')
bar = BarClass.create!(:bleh => 'bleh')
return foo, bar, 'success'
end
rescue ActiveRecord::RecordInvalid => e
function aspec {
args=""
for var in "$@"
do
args="$args spec/*/$var\_spec.rb app/*/$var.rb app/processors/$var.rb app/models/*/$var.rb spec/*/controls/$var\_spec.rb spec/models/*/$var\_spec.rb app/*/controls/$var.rb lib/$var.rb"
done
echo "Running autospec $args"
autospec $args
}
require 'autotest/fsevent'
require 'autotest/growl'
Autotest::Growl::remote_notification = true
Autotest.add_hook :initialize do |at|
at.sleep = 1
%w{.svn .hg .git vendor}.each {|exception| at.add_exception(exception)}
unless ARGV.empty?
table_for @discount_codes do |table|
table.column :code
table.column :description
table.column :max_uses, :label => 'Maximum Uses' do |discount_code|
discount_code.max_uses || 'Unlimited'
end
end
# I want to be able to do this: