Skip to content

Instantly share code, notes, and snippets.

View sumeet's full-sized avatar

Sumeet Agarwal sumeet

  • San Francisco, CA
View GitHub Profile
describe MyClass do
it "retrieves data from the data store" do
data = stub
# should_receive would be redundant here because the assertion confirms
# data was passed through.
DataStore.stub!(:find_data).and_return(data)
subject.data.should == data
end
it "sends an email to the user" do
@sumeet
sumeet / gist:2574946
Created May 2, 2012 08:03
I never knew.
>>> xrange(2 ** 100)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OverflowError: long int too large to convert to int
@sumeet
sumeet / gist:3798054
Created September 28, 2012 05:18
add test for accessing let through the class
commit 0e4888f0e49557cdf36e38a91a74f462a1206fc4
Author: Sumeet Agarwal <sumeet.a@gmail.com>
Date: Thu Sep 27 22:05:22 2012 -0700
add test for accessing let through the class
diff --git a/test/test_case_test.py b/test/test_case_test.py
index 66f6fd3..2bd2875 100644
--- a/test/test_case_test.py
+++ b/test/test_case_test.py
@sumeet
sumeet / .minttyrc
Created October 20, 2014 04:57
mitsuhiko colors for mintty
BoldAsFont=yes
Font=monofur
FontHeight=14
FontSmoothing=full
AllowBlinking=yes
Locale=en_US
Charset=UTF-8
Scrollbar=none
FontIsBold=no
#!/usr/bin/env python
import pygments
import re
import sys
from pygments.lexers import RubyLexer
from pygments.formatters import TerminalFormatter
Traceback (most recent call last):
File "blah.py", line 3, in <module>
requests.get("FUCK")
File "/Library/Python/2.7/site-packages/requests-2.3.0-py2.7.egg/requests/api.py", line 55, in get
return request('get', url, **kwargs)
File "/Library/Python/2.7/site-packages/requests-2.3.0-py2.7.egg/requests/api.py", line 44, in request
return session.request(method=method, url=url, **kwargs)
File "/Library/Python/2.7/site-packages/requests-2.3.0-py2.7.egg/requests/sessions.py", line 422, in request
prep = self.prepare_request(req)
File "/Library/Python/2.7/site-packages/requests-2.3.0-py2.7.egg/requests/sessions.py", line 360, in prepare_request
describe "blah" do
let(:blah) { 123 }
it "blah" do
self.class.let(:blah) { 234 }
blah.should == 234
end
end
[0] % yes | head -n 20 | parallel cat
When using programs that use GNU Parallel to process data for publication please cite:
O. Tange (2011): GNU Parallel - The Command-Line Power Tool,
;login: The USENIX Magazine, February 2011:42-47.
This helps funding further development; and it won't cost you a cent.
Or you can get GNU Parallel without this requirement by paying 10000 EUR.
To silence this citation notice run 'parallel --bibtex' once or use '--no-notice'.
require "json"
require "yaml"
cassette_files = `git ls-files features/cassettes spec/vcr_cassettes | grep yml$`.split
p cassette_files
cassette_files.each do |filename|
yaml = YAML.load_file filename
yaml.fetch("http_interactions").each do |interaction|
" Remove extra whitespace before saving
function! <SID>StripTrailingWhitespaces()
" Preparation: save last search, and cursor position.
let _s=@/
let l = line(".")
let c = col(".")
" Do the business:
%s/\s\+$//e
" Clean up: restore previous search history, and cursor position
let @/=_s