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
# In-memory test database | |
# The schema has been simplified for the discussion (yes, it should have some domain_id somewhere !) | |
# | |
# Values in the content field for a SOA, are, in order : | |
# ns email serial refresh retry expiry minimum | |
DB = Sequel.sqlite | |
DB.run "CREATE TABLE records (name VARCHAR(255) PRIMARY KEY NOT NULL, type VARCHAR(5), content VARCHAR(255))" | |
DB.run "INSERT INTO records VALUES ('example.com', 'SOA', 'ns.example.com root.example.com 2012333335 28800 86400 3600000 86400')" | |
# Just an assert function for basic testing |
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
one: {:name=>"Acme Enterprises, Inc.", :commplanname=>"All Transactions", :policynum=>"21IL909GL341234", :class=>"WORK", :billingtype=>"D", :term=>"A", :territory=>nil, :location=>1, :effective=>2008-10-05 00:00:00 -0500, :expires=>2009-10-04 00:00:00 -0500, :cancelled=>false, :decverified=>nil, :totprem=>#<BigDecimal:1d2da07,'0.1492E4',4(12)>, :policyfee=>#<BigDecimal:1e80cc2,'0.0',1(4)>, :adminfee=>#<BigDecimal:19db869,'0.0',1(4)>, :tax=>#<BigDecimal:1b5f860,'0.0',1(4)>, :otherfee=>#<BigDecimal:1c5822c,'0.0',1(4)>} | |
two: Acme Enterprises, Inc. |
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
Calculating ------------------------------------- | |
AR new 1110 i/100ms | |
AR new args 479 i/100ms | |
AR create 57 i/100ms | |
AR find 131 i/100ms | |
------------------------------------------------- | |
AR new 13570.5 (±5.4%) i/s - 67710 in 5.003359s | |
AR new args 5271.7 (±6.5%) i/s - 26345 in 5.018283s | |
AR create 576.4 (±6.2%) i/s - 2907 in 5.062781s | |
AR find 1357.2 (±4.2%) i/s - 6812 in 5.027665s |
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
# in sequel/plugins/foo.rb | |
module Sequel::Plugin::Foo | |
def self.apply(model) | |
model.plugin :timestamps, :create => :created_on, :update => :updated_on | |
model.plugin :validation_helpers | |
model.many_to_one :user | |
end | |
module InstanceMethods | |
# Note that it's probably a bad idea to override initialize unless you |
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
daedalus: Nothing to do for vm/vm | |
Invoke spec (first_time) | |
** Invoke build (first_time) | |
** Invoke build:build (first_time) | |
** Invoke build:llvm (first_time) | |
** Execute build:llvm | |
** Invoke vm/vm (first_time) | |
** Invoke vm/gen/config_variables.h (first_time, not_needed) | |
** Invoke library/rubinius/configuration.rb (first_time, not_needed) | |
** Invoke config.rb (first_time, not_needed) |
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) | |
Dir.home raises an ArgumentError if the named user doesn't exist FAILED | |
Expected ArgumentError | |
but got Errno::ENOENT (No such file or directory - retrieving user home directory - getpwnam_r(3)) | |
{ } in Object#__script__ at spec/ruby/core/dir/home_spec.rb:23 | |
BasicObject(Object)#instance_eval at kernel/common/eval.rb:43 | |
{ } in Enumerable(Array)#all? at kernel/common/enumerable.rb:304 | |
Array#each at kernel/bootstrap/array.rb:66 | |
Enumerable(Array)#all? at kernel/common/enumerable.rb:304 | |
Integer(Fixnum)#times at kernel/common/integer.rb:198 |
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.0p247 (2013-06-27 revision 41674) [i386-openbsd] | |
.................F....F........................................................................................................E..F...................................................................................................................................................F..F.F...........................................................................................................................F.....................F...........................................................E...................E................E............................................................................................................................................................................................................................................................................................F.................................FF...F.........FF...E......E...E.........................................FF.............................................. |
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
# Run from jekyll dir | |
Dir['/path/to/toto/articles/*.txt'].sort.each do |path| | |
file = File.basename(path) | |
new_file = "_posts/#{file.sub(/\.txt\z/, '.md')}" | |
text = File.read(path) | |
headers, md = text.split("\n\n", 2) | |
raise "No title" unless headers =~ /^title: (.+)$/ | |
title = $1 | |
File.write(new_file, "---\n layout: post\n title: #{title}\n---\n\n#{md}") | |
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
# Let's say you were stupid and used the postgres account for something you | |
# shouldn't have, so you have a database owned by postgres, with all objects | |
# inside owned by postgres. You regain sanity and want to transfer the | |
# ownership to an account that isn't a database superuser. | |
# | |
# In most cases, reassigning ownership is as simple as using | |
# REASSIGNED OWNED. However, that does not work if you are using the | |
# postgres account, so you have to alter the ownership manually. | |
# | |
# First, make sure you connect to the database using the postgres account. |
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
gem 'activerecord', '4.0.4' | |
require 'active_record' | |
require 'minitest/autorun' | |
require 'logger' | |
# Ensure backward compatibility with Minitest 4 | |
Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test) | |
# This connection will do for database-independent bug reports. | |
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:') |