This file contains hidden or 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
#Quick Cheat Sheet | |
T.delay(arg, kwarg=value) | |
#always a shortcut to .apply_async. | |
T.apply_async((arg, ), {'kwarg': value}) | |
T.apply_async(countdown=10) | |
#executes 10 seconds from now. |
This file contains hidden or 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
assertEqual(a, b) #a == b | |
assertNotEqual(a, b) #a != b | |
assertTrue(x) #bool(x) is True | |
assertFalse(x) #bool(x) is False | |
assertIs(a, b) #a is b 2.7 | |
assertIsNot(a, b) #a is not b 2.7 | |
assertIsNone(x) #x is None 2.7 | |
assertIsNotNone(x) #x is not None 2.7 | |
assertIn(a, b) #a in b 2.7 | |
assertNotIn(a, b) #a not in b 2.7 |
This file contains hidden or 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
200 OK OK | |
201 CREATED Created | |
204 DELETED No Content [1] | |
400 BAD_REQUEST Bad Request | |
401 FORBIDDEN Unauthorized [2] | |
404 NOT_FOUND Not Found | |
409 DUPLICATE_ENTRY Conflict [3] | |
410 NOT_HERE Gone [4] | |
501 NOT_IMPLEMENTED Not Implemented | |
503 THROTTLED Service Unavailable [5] |
This file contains hidden or 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
grep [PATTERN] [FILE] | |
grep apple fruitlist.txt | |
grep apple *.txt | |
grep ^app fruitlist.txt | |
"-x :: exact line | |
grep -x apple fruitlist.txt |
This file contains hidden or 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
q + (1234567890) | |
=> start record | |
q | |
=> stop | |
@(1234567890) | |
=> play | |
:reg |
This file contains hidden or 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
expect(x).toEqual(y); compares objects or primitives x and y and passes if they are equivalent | |
expect(x).toBe(y); compares objects or primitives x and y and passes if they are the same object | |
expect(x).toMatch(pattern); compares x to string or regular expression pattern and passes if they match | |
expect(x).toBeDefined(); passes if x is not undefined | |
expect(x).toBeUndefined(); passes if x is undefined |
This file contains hidden or 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
from:([email protected] OR [email protected] OR *@not.example.com) |
This file contains hidden or 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
# Start/Stop PostgreSQL | |
If this is your first install, automatically load on login with: | |
mkdir -p ~/Library/LaunchAgents | |
cp /usr/local/Cellar/postgresql/9.1.3/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/ | |
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist | |
If this is an upgrade and you already have the homebrew.mxcl.postgresql.plist loaded: | |
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist | |
cp /usr/local/Cellar/postgresql/9.1.3/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/ |
This file contains hidden or 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
begin | |
#do something... | |
raise Exception, "Error message" | |
raise ArgumentError | |
rescue Exception => e | |
puts e.message | |
rescue ArgumentError => e | |
puts e.message | |
ensure |
This file contains hidden or 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
require "autotest/growl" | |
require "autotest/fsevent" | |
RSPEC=true |