This file contains 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 sys import argv | |
from os import listdir | |
from re import split | |
from collections import Counter | |
class Post(object): | |
def __init__(self, title, content): | |
self.title = title | |
self.content = map(lambda w: w.lower(), content) |
This file contains 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
Rest.li 1.0 URL: /foo/key.x%5B0%5D=a1&key.x%5B1%5D=a2&key.y=123&key~2Ewith~2Edots=val | |
Rest.li 2.0 URL: /foo/(key:(x:List(a1,a2)),y:123,key.with.dots:val) |
This file contains 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
{ | |
"key": { | |
"x": [ | |
"a1", | |
"a2" | |
], | |
"y": 123, | |
"key.with.dots": "val" | |
} | |
} |
This file contains 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
RPC - non uniform API for creating an entity | |
Long createGreeting(Greeting greeting) | |
Long newFortune(Fortune fortune) | |
----------------------------------------------- | |
REST - uniform entity creation | |
POST /greetings {“message”: “Hello”} | |
POST /fortunes {“fortune”: “This is a fortune”} |
This file contains 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
describe('A Jasmine test', function() { | |
it('should be able to test async functions', function() { | |
// variable to check if our function call was successful | |
var wasSuccessful = null; | |
// Dummy Backbone model | |
var testModel = new TestModel(); | |
This file contains 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
... | |
env.roledefs = { | |
"service_A": ["hostA1", "hostA2", ...], | |
"service_B": ["hostB1", "hostB2", ...], | |
"service_C": ["hostC1", "hostC2", ...], | |
... | |
} | |
@task |
This file contains 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
karanparikh@ubuntu:~$ node -v | |
v0.5.0-pre |
This file contains 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
# this works! | |
_Car = __import__("vehicles.four-wheels-car", globals(), locals(), ["Car"]) | |
Car = _Car.Car |
This file contains 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
# this does not work! | |
from vehicles.four-wheels.car import Car |
This file contains 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
# global scope these variables so that | |
# we can use them throughout our code | |
Car = None | |
Bus = None | |
# | |
# exciting stuff happening here | |
# | |
# now, based on the variable vehicle |
NewerOlder