This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window = 14 | |
latest = Time.parse('12:00 AM') | |
earliest = today - window.days | |
issues = Issue.find(:conditions => ['updated_at > ? AND updated_at < ?', yesterday, today]) | |
issues_by_day = Hash.new { |key| self[key] = [] } | |
issues_by_day = issues.injecting(issues_by_day) do |buckets, issue| | |
buckets[issue.updated_at.strftime('%m/%d')] << issue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Kernel | |
def with(obj, &block) | |
obj.instance_eval(&block) | |
end | |
end | |
with 'Hi' do | |
length # => 2 | |
upcase # => "HI" | |
downcase # => "hi" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Issue < ActiveRecord::Base | |
after_create :send_notification | |
def send_notification; end | |
end | |
class SomeMigration < ActiveRecord::Migration | |
def self.up | |
# Do stuff with Issue | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# Seeking to answer man's eternal question "I wonder how many little Git | |
# repositories I have just floating around in my home directory. Further, I | |
# wonder how many actually have a remote somewhere." | |
# | |
# Usage: | |
# | |
# Search for Git repositories in the specified directory | |
# > ruby git_finder.rb some_dir another_dir ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def dateChosen(sender) | |
puts 'action!' | |
end | |
def makeCalendar | |
frame = calendarView.frame | |
@datePicker = NSDatePicker.alloc.initWithFrame(frame) | |
datePicker.frameOrigin = NSMakePoint(1, 0) | |
datePicker.datePickerStyle = NSClockAndCalendarDatePickerStyle |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# I wanted to build a really common example app but use Git as the backend | |
# instead of a database or the filesystem. And so here we are. | |
# | |
# (c) Copyright 2008 Adam Keys. MIT licensed or some-such. | |
# | |
require 'fileutils' | |
require 'rubygems' | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def whack(objects) | |
objects.inject({}) { |results, o| result.update(o.send('table_name') => o.send('delete_all'] } | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'test/unit' | |
require 'rubygems' | |
require 'shoulda' | |
require 'factory_girl' | |
require 'dm-core' | |
require 'dm-validations' # Needed for save! | |
class User | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
not_found do | |
'Bonk' | |
end | |
error(ActiveRecord::RecordNotFound) do | |
status(404) | |
'Aside not found' | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/vm/compiler.c b/vm/compiler.c | |
index cfd6f57..64e098d 100644 | |
--- a/vm/compiler.c | |
+++ b/vm/compiler.c | |
@@ -138,6 +138,9 @@ void TrCompiler_compile_node(VM, TrCompiler *c, TrBlock *b, TrNode *n, int reg) | |
TrCompiler_compile_node(vm, c, b, (TrNode *)v, reg); | |
}); | |
break; | |
+ case AST_CLOWNCAR: { | |
+ PUSH_OP_A(b, CLOWNCAR, reg); |
OlderNewer