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
10.print "HELLO WORLD" | |
20.goto 10 |
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 pm(object) | |
identifiers = %w[ + - > ] | |
list = | |
case (object) | |
when Class: | |
puts "#{object} (Class)" | |
[ | |
(object.methods.sort - Class.methods), | |
(object.private_methods.sort - Class.private_methods), |
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
HTTP/1.0 500 Internal Server Error | |
Date: Mon, 02 Mar 2009 23:26:11 GMT | |
Server: Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.8e-fips-rhel5 | |
Set-Cookie: PHPSESSID=98bef3ac7d4ff6ba2c97822d2de167ee; path=/ | |
Expires: Thu, 19 Nov 1981 08:52:00 GMT | |
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 | |
Pragma: no-cache | |
Set-Cookie: kaboom_playspacefinder=connect.kaboom.org%2C189.182.114.45%2C98bef3a | |
c7d4ff6ba2c97822d2de167ee; expires=Tue, 03-Mar-2009 00:26:11 GMT; domain=kaboom. | |
org |
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 pm(object) | |
identifiers = %w[ + - > # ] | |
list = | |
case (object) | |
when Class: | |
puts "#{object} (Class)" | |
[ | |
(object.methods.sort - Class.methods), | |
(object.private_methods.sort - Class.private_methods), |
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 | |
class Array | |
def unique_by | |
inject(Hash.new(0)) do |h, i| | |
h[yield(i)] += 1 | |
h | |
end.size == size | |
end | |
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
class Hash | |
def dig(*path) | |
path.inject(self) do |location, key| | |
location.respond_to?(:keys) ? location[key] : nil | |
end | |
end | |
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
#!/usr/bin/env ruby | |
require File.dirname(__FILE__) + '/../config/environment' | |
conn = ActiveRecord::Base.connection | |
STDOUT.sync = true | |
while (true) | |
print "\e[;H" |
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 Multiplexer | |
instance_methods.each do |m| | |
undef_method m unless(m.match(/^__/)) | |
end | |
def initialize(*objects) | |
@objects = objects | |
end | |
def method_missing(m, *args) |
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 self.link(account, user, params = nil) | |
found = find(:first, :conditions => { :account_id => account.to_id, :user_id => user.to_id }) | |
if (found) | |
found.update_attributes!(params) if (params) | |
found | |
else | |
create_params = { :account_id => account.to_id, :user_id => user.to_id } | |
create_params.merge(params) if (params) |
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 ApplicationController < ActionController::Base | |
before_filter :set_time_zone | |
protected | |
# -- Page Title ----------------------------------------------------------- | |
def page_title | |
@page_title ||= [ ] | |
end |
OlderNewer