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 Foo | |
attr_accessor :n | |
def initialize(i) | |
@n = i | |
end | |
def val | |
n | |
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
{-# LANGUAGE DeriveDataTypeable #-} | |
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE TemplateHaskell #-} | |
{-# LANGUAGE TypeOperators #-} | |
module Main | |
where | |
import Control.Monad.Reader | |
import Data.Data (Data, Typeable) |
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
module Database.PostgreSQL.Simple.Ranges | |
where | |
import Control.Applicative | |
import Data.Attoparsec.Char8 | |
import qualified Data.ByteString as B | |
data Range a = Range a Bool a Bool | Empty deriving Show | |
parseRange :: Char -> (B.ByteString -> a) -> Parser (Range a) |
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 "2.0.0" | |
source "https://rubygems.org" | |
gem "activerecord", "4.0.0.beta1" | |
gem "sqlite3" | |
gem "rspec" |
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 "bundler" | |
Bundler.setup | |
require "active_record" | |
ActiveRecord::Base.establish_connection adapter: "sqlite3", database: ":memory:" | |
ActiveRecord::Migration.create_table :bugs do |t| | |
t.string :name | |
t.integer :reporter_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
~ $ rvm list | |
rvm rubies | |
jruby-1.7.2 [ x86_64 ] | |
=* ruby-1.9.3-p374 [ x86_64 ] | |
# => - current | |
# =* - current && default | |
# * - default |
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 'sinatra' | |
get '/' do | |
%Q{ | |
<html> | |
<head></head> | |
<body> | |
#{request.env['HTTP_ACCEPT_LANGUAGE']} | |
</body> | |
</html> |
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 'bigdecimal' | |
class BigDecimal | |
def inspect; to_s('F'); end | |
end | |
class Account | |
attr_reader :intial_amount, :balance_changes |
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 'bigdecimal' | |
require 'benchmark' | |
require 'rspec/autorun' | |
module Calculator | |
ONE = BigDecimal('1') | |
ONE_HUNDRED = BigDecimal('100') | |
DECIMAL_ROUNDING_SCALE = 6 # number of fractional digits to retain |
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 "mongoid" | |
require "minitest/autorun" | |
Mongoid.configure do |config| | |
config.master = Mongo::Connection.new.db('test_polymorphic_embedding') | |
end | |
class Condition; end | |
# A relation consists of a name and a list of arguments |