Skip to content

Instantly share code, notes, and snippets.

@markiz
markiz / n1313.txt
Last active December 25, 2019 14:52
i N time path recursive call count
1: 3 0.00001500 (3: [3, 2, 1]; iterations: 3)
2: 7 0.00000800 (5: [7, 6, 3, 2, 1]; iterations: 7)
3: 31 0.00002300 (6: [31, 30, 6, 3, 2, 1]; iterations: 20)
4: 211 0.00007900 (7: [211, 210, 15, 5, 4, 2, 1]; iterations: 58)
5: 2311 0.00081800 (8: [2311, 2310, 55, 54, 9, 3, 2, 1]; iterations: 203)
6: 30031 0.00235300 (8: [30031, 30030, 195, 15, 5, 4, 2, 1]; iterations: 735)
7: 510511 0.00773800 (8: [510511, 1843, 97, 96, 12, 4, 2, 1]; iterations: 1547)
8: 9699691 0.05817200 (9: [9699691, 9699690, 3135, 57, 56, 8, 4, 2, 1]; iterations: 6528)
9: 223092871 0.59735300 (9: [223092871, 223092870, 15015, 143, 13, 12, 4, 2, 1]; iterations: 34876)
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'graphql', '1.9.8'
gem 'graphql-batch', '0.4.1'
gem 'newrelic_rpm', '6.5.0.357'
end
Product = Struct.new(:name)
1.9.3p327 :001 > Thread.current['a'] = 1
1
1.9.3p327 :002 > Thread.current.keys
[
[0] :__recursive_key__,
[1] :a,
[2] :__awesome_print__
]
1.9.3p327 :003 > Thread.current['a'] = nil
nil
@markiz
markiz / Gemfile
Created May 23, 2012 17:12
Test gist for vcr
source :rubygems
gem 'vcr', '2.1.1'
gem 'webmock', '1.8.6'
gem 'eventmachine', '1.0.0.beta.4'
gem 'em-http-request', '1.0.2'
gem 'rspec', '2.8.0'
require 'rubygems'
require 'listen'
require 'fileutils'
FileUtils.rm_rf("./output")
FileUtils.mkdir_p("output")
listener = Listen.to('.').filter(/\.js$/).ignore('output').change do |*args|
puts "Called back with: #{args.inspect}"
exit!
end
sequel % rake spec_mysql
/Users/mark/.rvm/gems/ruby-1.9.3-p0@global/gems/rake-0.8.7/lib/rake/alt_system.rb:32: Use RbConfig instead of obsolete and deprecated Config.
(in /Users/mark/Code/OpenSource/sequel)
/Users/mark/.rvm/rubies/ruby-1.9.3-p0/bin/ruby -S rspec spec/adapters/mysql_spec.rb spec/integration/associations_test.rb spec/integration/database_test.rb spec/integration/dataset_test.rb spec/integration/eager_loader_test.rb spec/integration/migrator_test.rb spec/integration/model_test.rb spec/integration/plugin_test.rb spec/integration/prepared_statement_test.rb spec/integration/schema_test.rb spec/integration/timezone_test.rb spec/integration/transaction_test.rb spec/integration/type_test.rb
..........................................................................................................................................................................................*...................................*F
Pending:
Simple Dataset operations should have update return the number of matched rows
@markiz
markiz / .gitignore
Created December 7, 2011 13:35 — forked from FND/.gitignore
test case for apparent DataMapper bug when recursively saving associations
Gemfile.lock
@markiz
markiz / stage_1.html
Created October 1, 2011 15:18
lsd-haml
<li itemid='@@id' itemprop='movie' itemscope='itemscope' itemtype='@@movies_url'><h2 itemprop='title'>
@@title
</h2>
<dl>
<!-- if present(item.filename)-->
<dt>
@@t("movies.filename")
</dt>
<dd itemprop='filename'>
@markiz
markiz / js_hash.rb
Created August 11, 2011 16:11
JS-like hash objects
require "test/unit"
class JSHash < BasicObject
def initialize(hash = {})
@_attributes = hash.inject({}) do |res, (k, v)|
k = k.kind_of?(::Symbol) ? k.to_s : k
res[k] = v
res
end
end # initialize
@markiz
markiz / lastfm_rip.rb
Created August 10, 2011 22:06
Simple last.fm ripper
#!/usr/bin/env ruby
#
# Usage:
# ./lastfm_rip.rb "http://www.last.fm/music/Various+Artists/Razor%2B1911%2BChipdisk%2B%25233" "Razor Chipdisk #3"
# Requires: em-http-request, mechanize
require 'rubygems'
require 'mechanize'
require 'fileutils'
require 'em-http-request'
require 'cgi'