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
class ListedProduct(object): | |
def __init__(self, listed_product_tuple): | |
"""Takes a KeyedTuple and transforms it into a listed product. | |
:param listed_product_tuple: A KeyedTuple | |
:type listed_product_tuple: sqlalchemy.KeyedTuple | |
""" | |
self.listed_product_tuple |
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
class ApiError(Exception): pass | |
class User(object): | |
"""Represents an authenticateable user""" | |
def __init__(self, email, password): | |
self.email = email | |
self.password = password | |
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
#!/bin/sh | |
export MY_APP_NAME=superslice | |
export MY_APP_AWS_KEY=super-secret | |
export MY_APP_AWS_SECRET_KEY=super-super-secret | |
# Finally, call whatever command comes after this | |
$* |
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
user@computer:~/app$ ./localsettings.sh bin/app.py --app-arg1 arg1-val --app-arg2 | |
Welcome to superslice | |
['bin/app.py', '--app-arg1', 'arg1-val', '--app-arg2'] |
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
import os | |
# Configuration variable names as constants | |
APP_NAME = 'MY_APP_NAME' | |
APP_AWS_KEY = 'MY_APP_AWS_KEY' | |
APP_AWS_SECRET_KEY = 'MY_APP_AWS_SECRET_KEY' | |
class Config(object): |
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
import sys | |
import config | |
if __name__ == '__main__': | |
cfg = config.Config() | |
print 'Welcome to {}'.format(cfg.get(config.APP_NAME)) | |
print sys.argv |
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
import random | |
adjectives = [ | |
'awkward', 'ginger', 'babyfaced', 'sloppy', 'hairy', 'sweaty', | |
'gangly', 'ugly', 'neckbeard', 'angry', 'constipated', 'wrinkly', | |
'porous', 'oozy', 'cuddly' | |
] | |
nouns = [ |
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
package main | |
import ( | |
"bytes" | |
"bufio" | |
"fmt" | |
"net" | |
"strconv" | |
) |
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
use std::io::TcpStream; | |
use std::str; | |
fn main() { | |
let mut client = match TcpStream::connect("127.0.0.1", 6379) { | |
Ok(c) => c, | |
Err(e) => fail!("Failed: {}", e) | |
}; |
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
let result = List.range 1 1000 | |
|> List.filter ~f:(fun n -> (n mod 3) = 0 || (n mod 5) = 0) | |
|> List.reduce ~f:(+);; |
OlderNewer