Skip to content

Instantly share code, notes, and snippets.

View jdsiegel's full-sized avatar

Jeff Siegel jdsiegel

  • The Nation Network
  • Edmonton
View GitHub Profile
@jdsiegel
jdsiegel / hover.scss
Created November 1, 2016 18:48
SASS hover
$link-color: #555;
a {
color: $link-color;
&:hover {
color: lighten($link-color);
}
}
@jdsiegel
jdsiegel / strings.rs
Created June 23, 2014 06:06
Messing around with strings, iterators, and hash maps
use std::collections::HashMap;
use std::io;
use std::path::Path;
struct Room {
links: Vec<String>,
description: String
}
type RoomMap = HashMap<String, Room>;
@jdsiegel
jdsiegel / gist:6528991
Created September 11, 2013 20:01
VCR deprecation warnings when upgrading to 2
WARNING: `VCR.config` is deprecated. Use VCR.configure instead.
WARNING: `VCR.configure { |c| c.stub_with ... }` is deprecated. Use `VCR.configure { |c| c.hook_into ... }` instead.
WARNING: VCR::RSpec::Macros is deprecated. Use RSpec metadata options instead `:vcr => vcr_options`
and on failing tests:
<redacted cassette file> does not appear to be a valid VCR 2.0 cassette. VCR 1.x cassettes are not valid with VCR 2.0. When upgrading from VCR 1.x, it is recommended that you delete all your existing cassettes and re-record them, or use the provided vcr:migrate_cassettes rake task to migrate them. For more info, see the VCR upgrade guide.
@jdsiegel
jdsiegel / gist:5401715
Created April 17, 2013 04:05
kitchen setup with bats
siegel@jacksparrow:chef-orch_db (test-kitchen) $ be kitchen setup postgre
-----> Starting Kitchen
-----> Setting up <postgres-ubuntu-1204>
Fetching: thor-0.18.1.gem (100%)
Fetching: busser-0.4.0.gem (100%)
Successfully installed thor-0.18.1
Successfully installed busser-0.4.0
2 gems installed
-----> Setting up Busser
Creating BUSSER_ROOT in /opt/busser
@jdsiegel
jdsiegel / gist:4640227
Created January 26, 2013 04:31
Testing out the jr-shunit2 runner
git clone https://github.com/jdsiegel/jr-shunit2.git
cd jr-shunit2
vagrant up
vagrant ssh
sudo /opt/jr/bin/jr test
version = node['orch_app']['chruby']['version']
url = node['orch_app']['chruby'].fetch('url') do
"https://github.com/downloads/postmodern/chruby/chruby-#{version}.tar.gz"
end
checksum = node['orch_app']['chruby']['checksum']
force_install = node['orch_app']['chruby']['force_install']
cache_path = Chef::Config['file_cache_path'] || '/tmp'
dir_name = "chruby-#{version}"
tar_file = "#{dir_name}.tar.gz"
siegel@jacksparrow:rubinius-sinatra-loadtesting (master) $ rainbows -p 4000 -E production -c rainbows_threadpool.rb
I, [2011-09-17T03:15:17.410545 #51170] INFO -- : listening on addr=0.0.0.0:4000 fd=5
E, [2011-09-17T03:15:17.414370 #51170] ERROR -- : Invalid argument
E, [2011-09-17T03:15:17.414578 #51170] ERROR -- : RLIMIT_NOFILE needs to be increased to >=1030 before starting rainbows
E, [2011-09-17T03:15:17.414769 #51170] ERROR -- : Operation not permitted
E, [2011-09-17T03:15:17.414887 #51170] ERROR -- : RLIMIT_NPROC needs to be increased to >=1026 before starting rainbows
I, [2011-09-17T03:15:17.415176 #51170] INFO -- : worker=0 spawning...
I, [2011-09-17T03:15:17.421982 #51170] INFO -- : worker=1 spawning...
I, [2011-09-17T03:15:17.430283 #51180] INFO -- : worker=0 spawned pid=51180
I, [2011-09-17T03:15:17.432503 #51180] INFO -- : Refreshing Gem list
@jdsiegel
jdsiegel / Item.rb
Created August 23, 2011 17:02 — forked from MarkBennett/Item.rb
DOES NOT WORK! Implementing ActiveRecord named scopes with a module
class Item < ActiveRecord::Base
include SpecialScopes
end
# OR
class Item < ActiveRecord::Base
extend SharedScopesAsMethods
end
=== bin/rbx ===
array flatten 1316.4 (±14.7%) i/s - 6300 in 5.022225s (cycle=84)
array flatten! 1394.6 (±7.9%) i/s - 7004 in 5.058865s (cycle=103)
=== ruby ===
array flatten 54772.9 (±12.6%) i/s - 271232 in 5.034272s (cycle=4238)
array flatten! 51140.2 (±19.1%) i/s - 237420 in 5.057635s (cycle=3957)
Comparing benchmark/core/array/flatten.rb:array flatten!:
ruby: 51140 i/s
bin/rbx: 1394 i/s - 36.67x slower
$ time ~/projects/rubinius/bin/rbx -Xint -Xprofile -Xprofiler.graph -S bundle open bundler
Total running time: 5.506432867s
-------------------------------------------------------
0.00 0.00 1/2 FileUtils.fu_list
0.00 0.00 1/3 Bundler::Definition#groups
0.00 0.01 46/1024 Bundler::Resolver#search
0.00 0.01 1/4 Bundler::Resolver#successify
0.00 0.01 166/1162 Gem::Specification#add_dependency_with_type
0.00 0.03 390/2342 Gem::Requirement#initialize