This file contains 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 | |
# usage: | |
# $ das_download.rb email password [download_directory] | |
require "mechanize" | |
class DasDownloader | |
attr_reader :agent, :email, :password | |
def initialize(email, password) |
This file contains 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
jasondew@phi /tmp $ cat 3q.hs | |
q a b c=putStrLn $ b ++ [toEnum 10,'q','('] ++ show b ++ [','] ++ show c ++ [','] ++ show a ++ [')'] | |
main=q "q a b c=putStrLn $ b ++ [toEnum 10,'q','('] ++ show b ++ [','] ++ show c ++ [','] ++ show a ++ [')']" "def q(a,b,c):print b+chr(10)+'q('+repr(b)+','+repr(c)+','+repr(a)+')'" "def e(x) return 34.chr+x+34.chr end;def q(a,b,c) print b+10.chr+'main=q '+e(b)+' '+e(c)+' '+e(a)+' '+10.chr end" | |
jasondew@phi /tmp $ cat 3q.hs | runhaskell | python | ruby | |
q a b c=putStrLn $ b ++ [toEnum 10,'q','('] ++ show b ++ [','] ++ show c ++ [','] ++ show a ++ [')'] | |
main=q "q a b c=putStrLn $ b ++ [toEnum 10,'q','('] ++ show b ++ [','] ++ show c ++ [','] ++ show a ++ [')']" "def q(a,b,c):print b+chr(10)+'q('+repr(b)+','+repr(c)+','+repr(a)+')'" "def e(x) return 34.chr+x+34.chr end;def q(a,b,c) print b+10.chr+'main=q '+e(b)+' '+e(c)+' '+e(a)+' '+10.chr end" |
This file contains 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/app/controllers/reviews_controller.rb b/app/controllers/reviews_controller.rb | |
index fdaa06b..85133e5 100644 | |
--- a/app/controllers/reviews_controller.rb | |
+++ b/app/controllers/reviews_controller.rb | |
@@ -26,8 +26,9 @@ class ReviewsController < ApplicationController | |
duplicated_room = @duplicate_center_version.rooms.create room.duplicated_attributes | |
room.memberships.each do |membership| | |
- new_staff_id = staff_id_map[membership.staff_id] | |
- duplicated_room.memberships.create membership.attributes.merge(:staff_id => new_staff_id) |
This file contains 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 validate | |
# elided | |
errors.add(:assessed_on, "must be in the past") if assessed_on and assessed_on > Date.today | |
end |
This file contains 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
static VALUE | |
time_cmp(time1, time2) | |
VALUE time1, time2; | |
{ | |
struct time_object *tobj1, *tobj2; | |
GetTimeval(time1, tobj1); | |
if (TYPE(time2) == T_DATA && RDATA(time2)->dfree == time_free) { | |
GetTimeval(time2, tobj2); | |
if (tobj1->tv.tv_sec == tobj2->tv.tv_sec) |
This file contains 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
1.day.ago > Date.today # true??!? |
This file contains 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
@client.diagnoses.include?(Diagnosis.find_by_name("HIV")) | |
# or, worse | |
@client.diagnoses.detect {|diagnosis| diagnosis.id == 42 } |
This file contains 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 Client < ActiveRecord::Base | |
has_many :diagnoses | |
end | |
class Diagnosis < ActiveRecord::Base | |
belongs_to :client | |
end |
This file contains 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
puts 'require "quine"' | |
module Kernel | |
def method_missing name, *args | |
print name | |
metaclass = class << (o = Object.new); self; end | |
metaclass.send(:define_method, :method_missing) do |name, *args| | |
print ".#{name}" | |
self | |
end |
This file contains 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
foo.rb:1: syntax error, unexpected tINTEGER, expecting tSTRING_CONTENT or tSTRING_DBEG or tSTRING_DVAR or tSTRING_END | |
foo.rb:1: syntax error, unexpected tI... | |
^ |
NewerOlder