Skip to content

Instantly share code, notes, and snippets.

View jimmycuadra's full-sized avatar
☠️
GitHub profits from the separation of families and the deaths of children.

jimmycuadra

☠️
GitHub profits from the separation of families and the deaths of children.
View GitHub Profile
@jimmycuadra
jimmycuadra / gist:8701761
Created January 30, 2014 03:01
Ruby start up time with and without rbenv
[Black-Milk] [2.1.0] [2.7.5] ~ $ time ruby -e ''
real 0m0.156s
user 0m0.079s
sys 0m0.073s
[Black-Milk] [2.1.0] [2.7.5] ~ $ time /usr/local/opt/rbenv/versions/2.1.0/bin/ruby -e ''
real 0m0.066s
user 0m0.035s
sys 0m0.030s
@jimmycuadra
jimmycuadra / gist:8892213
Created February 9, 2014 00:01
rspec-core segfault
This file has been truncated, but you can view the full file.
........./usr/local/var/lib/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.0.beta1/lib/rspec/core/memoized_helpers.rb:206: [BUG] Segmentation fault at 0x007fff51af7df0
ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin13.0]
-- Crash Report log information --------------------------------------------
See Crash Report log file under the one of following:
* ~/Library/Logs/CrashReporter
* /Library/Logs/CrashReporter
* ~/Library/Logs/DiagnosticReports
* /Library/Logs/DiagnosticReports
@jimmycuadra
jimmycuadra / ruby_2014-02-08-155943.crash
Created February 9, 2014 00:13
rspec-core segfault in Ruby 2.1
Process: ruby [19008]
Path: /usr/local/var/lib/rbenv/versions/2.1.0/bin/ruby
Identifier: ruby
Version: 0
Code Type: X86-64 (Native)
Parent Process: bash [14659]
Responsible: iTerm [324]
User ID: 501
Date/Time: 2014-02-08 15:59:42.908 -0800
@jimmycuadra
jimmycuadra / gist:9012567
Created February 15, 2014 00:41
Kill yourself
Jimmy: what should i back on kickstarter
Mike: anything you want
Mike: why do you care at all
Jimmy: i backed some shit about birds for lita
Jimmy: so now i have an account
Jimmy: and am looking at stuff
Jimmy: the idea of KS is great
Jimmy: but my interests are too narrow for me to make much use of this
Jimmy: i might be more inclined if i felt that software should be financed
Mike: why shouldnt it
@jimmycuadra
jimmycuadra / foo__slash__foo.py
Created March 2, 2014 18:44
Example test structure
class Foo(object):
def bar(self):
pass
def baz(self):
pass
@jimmycuadra
jimmycuadra / Gemfile
Created March 3, 2014 08:39
:provision group from lita.io's Gemfile
group :provision do
# No gem release in many months
gem 'librarian-puppet', github: 'rodjek/librarian-puppet', require: false
gem 'puppet', require: false
gem 'puppet-lint', require: false
# capistrano-rails depends on this, but using HEAD until this fix is released as a gem:
# https://github.com/capistrano/bundler/issues/31
gem 'capistrano-bundler', github: 'capistrano/bundler', require: false
gem 'capistrano-rails', require: false
gem 'capistrano-rbenv', require: false
from mock import patch
@patch('path.to.module.S3Library')
def test_stores_data_in_s3(S3Library):
my_method(data)
assert S3Library.upload_file.called_once_with(data)
@patch('path.to.module.S3Library')
def test_data_contains_some_value(S3Library):
S3Library.get_file.return_value = _stub_data()
@jimmycuadra
jimmycuadra / gist:9341132
Created March 4, 2014 06:09
String and symbol object equality in Ruby
$ pry
[1] pry(main)> string1 = "foo";
[2] pry(main)> string2 = "foo";
[3] pry(main)> symbol1 = :foo;
[4] pry(main)> symbol2 = :foo;
[5] pry(main)> string1 == string2
=> true
[6] pry(main)> string1.object_id == string2.object_id
=> false
[7] pry(main)> [string1.object_id, string2.object_id]
@jimmycuadra
jimmycuadra / attr_reader.rb
Created March 4, 2014 06:25
Instance variable access in Ruby
class Person
attr_reader :name
def initialize(name, age)
@name = name
@age = age
end
end
ted = Person.new("Ted", 25)
@jimmycuadra
jimmycuadra / Makefile
Created March 29, 2014 07:15
Capistrano-like stages with Make
STAGE=staging.lita.io
STAGE_NAME=staging
.PHONY: production
production:
$(eval STAGE=lita.io)
$(eval STAGE_NAME=production)
.PHONY: provision
provision: