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
Exception in thread "Thread-2" java.lang.NoSuchMethodError: data_objects.RubyType.getRubyType(Ljava/lang/String;)Ldata_objects/RubyType; | |
at do_sqlite3.Sqlite3DriverDefinition.setPreparedStatementParam(Sqlite3DriverDefinition.java:163) | |
at data_objects.Command.prepareStatementFromArgs(Command.java:610) | |
at data_objects.Command.execute_reader(Command.java:252) | |
at data_objects.Command$i_method_0_1$RUBYINVOKER$execute_reader.call(data_objects/Command$i_method_0_1$RUBYINVOKER$execute_reader.gen) | |
at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodN.call(JavaMethod.java:631) | |
at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:192) | |
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:350) | |
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:229) | |
at org.jruby.ast.CallSpecialArgNode.interpret(CallSpecialArgNode.java:71) |
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 "rubygems" | |
require "dm-core" | |
require "dm-migrations" | |
DataMapper.setup(:default, { :adapter => 'mysql', | |
:database => 'test', | |
:username => 'test', | |
:password => '', |
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 Sweatshop | |
self.record_map = Hash.new {|h,k| h[k] = Hash.new {|h,k| h[k] = 0}} | |
def self.record(klass, name, instance) | |
# self.record_map[klass][name.to_sym] << instance | |
self.record_map[klass][name.to_sym] += 1 | |
instance | |
end | |
def self.pick(klass, name) |
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 jruby | |
require 'rubygems' | |
require 'dm-core' | |
DataMapper.setup(:default, 'postgres://localhost/test') | |
# DataMapper.setup(:default, 'mysql://localhost/test') | |
class Square | |
include DataMapper::Resource | |
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
# rvm-install added line: | |
if [[ -s /Users/lamb/.rvm/scripts/rvm ]] && [[ $rvm_loaded_flag != 1 ]] ; then source /Users/lamb/.rvm/scripts/rvm ; fi | |
# http://henrik.nyh.se/2008/12/git-dirty-prompt | |
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/ | |
# username@Machine ~/dev/dir[master]$ # clean working directory | |
# username@Machine ~/dev/dir[master*]$ # dirty working directory | |
RED="\[\033[0;31m\]" | |
YELLOW="\[\033[0;33m\]" |
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
"{\"id\":\"ExampleProject/customers\",\"properties\":{\"discount\":\"number\",\"credit\":\"string\",\"payment_count\":\"integer\",\"phone\":\"string\",\"street1\":\"string\",\"zip\":\"string\",\"ytd_payments\":\"number\",\"city\":\"string\",\"since\":\"string\",\"warehouse_id\":\"integer\",\"balance\":\"number\",\"delivery_count\":\"integer\",\"first\":\"string\",\"data\":\"string\",\"middle\":\"string\",\"district_id\":\"integer\",\"credit_limit\":\"number\",\"state\":\"string\",\"street2\":\"string\",\"last\":\"string\"}}" |
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 -w | |
require 'net/http' | |
require 'uri' | |
require 'rubygems' | |
require 'json' | |
require 'ruby-debug' | |
SERVER = 'localhost' |
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 CustomFormBuilder < ActionView::Helpers::FormBuilder | |
helpers = field_helpers + | |
%w(date_select datetime_select time_select collection_select calendar_date_select) + | |
%w(collection_select select country_select time_zone_select) - | |
%w(hidden_field label fields_for) | |
helpers.each do |name| | |
define_method(name) do |field, *args| | |
options = args.last.is_a?(Hash) ? args.pop : {} |
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 FractionalIntegrator | |
# Positive q is derivation | |
# Negative q is integration | |
def initialize(q = 0.5, history_length = 1000) | |
@q = q | |
@history = [] | |
@weights = [] | |
initialize_weights(q, history_length) | |
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
RED="\[\033[0;31m\]" | |
YELLOW="\[\033[0;33m\]" | |
GREEN="\[\033[0;32m\]" | |
BLUE="\[\033[0;34m\]" | |
GRAY="\[\033[1;30m\]" | |
CYAN="\[\033[1;36m\]" | |
LIGHT_RED="\[\033[1;31m\]" | |
LIGHT_GREEN="\[\033[1;32m\]" | |
WHITE="\[\033[1;37m\]" | |
LIGHT_GRAY="\[\033[0;37m\]" |
OlderNewer