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
config.after_initialize do | |
Dir["#{RAILS_ROOT}/app/models/**/*.rb"].each { |f| require(f) } | |
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 Class | |
def extends?(klass) | |
not superclass.nil? and ( superclass == klass or superclass.extends? klass ) | |
end | |
def descendants(&block) | |
Module.constants.select do |constant_name| | |
constant = eval constant_name | |
if not constant.nil? and constant.is_a? Class and constant.extends? self | |
block_given? ? (constant if block.call(constant)) : constant |
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
raw = 'PARAM1 = #{param_1}, PARAM2 = #{param_2}' | |
params = { :param_1 => "foo", :param_2 => "bar" } | |
query = proc do |*args| | |
@params = params | |
def method_missing(key) | |
@params[key.to_sym] | |
end | |
eval('"' + raw + '"') | |
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 | |
# made by the folks at Integrallis (http://www.integrallis.com), enjoy! | |
require 'cgi' | |
require 'ostruct' | |
target = $TM_FILEPATH | |
f = IO.popen(%[java org.mozilla.javascript.tools.shell.Main -f $1 "$TM_FILEPATH" 2>&1]) | |
lines = f.readlines() | |
f.close_read |
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
public class Simple { | |
private String foo; | |
private String bar; | |
private String baz; | |
public String getBar() { | |
return bar; | |
} | |
public String getFoo() { |
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
require 'java' | |
require 'java/core/simple.jar' | |
module MyModule | |
include_package 'my.package' | |
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
require 'rbconfig' | |
Config = RbConfig | |
if defined?(Rails) | |
Dir.glob("#{Rails.root}/app/models/**/*.rb").each { |file| require file } | |
end | |
def clear | |
system 'clear' | |
nil |
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
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" |
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
brew install cassandra | |
brew install python | |
easy_install cql |
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
cd ~/temp | |
wget http://www.us.apache.org/dist/cassandra/2.1.2/apache-cassandra-2.1.2-bin.tar.gz | |
tar -xvzf apache-cassandra-2.1.2-bin.tar.gz | |
mv apache-cassandra-2.1.2 ~/cassandra |
OlderNewer