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
# -*- coding: utf-8 -*- | |
#source: https://github.com/cython/cython/wiki/PackageHierarchy | |
import sys, os | |
from distutils.core import setup, Extension | |
from Cython.Distutils import build_ext | |
package_name = 'gd' | |
package_dir = 'gd' |
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
# -*- coding: utf-8 -*- | |
def decorator_without_params(fn): | |
def wrapper(*args, **kwargs): | |
fn_result = fn(*args, **kwargs) | |
return '%s from decorator without params' % fn_result | |
return wrapper | |
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
# -*- coding: utf-8 -*- | |
class Greetings(object): | |
def __init__(self): | |
self.text = 'hello world' | |
def say(self): | |
print 'My engine is: %s' % self.text |
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
# Byte-compiled / optimized / DLL files | |
__pycache__/ | |
*.py[cod] | |
*$py.class | |
# C extensions | |
*.so | |
#OSX | |
.DS_Store |
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
import json | |
class Model(object): | |
def __init__(self, *args, **kwargs): | |
if len(args) > 0 and isinstance(args[0], dict): | |
for item in args[0]: | |
setattr(self, item, args[0][item]) | |
for item in kwargs: | |
setattr(self, item, kwargs[item]) |
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
#!/bin/sh | |
(cordova plugin add https://github.com/apache/cordova-plugin-whitelist.git; | |
cordova plugin add cordova-plugin-splashscreen; | |
cordova plugin add cordova-plugin-inappbrowser@~1.2.0; | |
cordova plugin add cordova-plugin-camera; | |
cordova plugin add ionic-plugin-keyboard; | |
cordova plugin add https://github.com/danwilson/google-analytics-plugin.git; | |
cordova plugin add cordova-plugin-console; | |
cordova plugin add cordova-plugin-geolocation; |
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
# -*- encoding: utf-8 -*- | |
from functools import wraps | |
class C(object): | |
def __init__(self): | |
self.methods = {} | |
def method(self, name): | |
def decorator(fn): |
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
function ObjectId () { | |
this.str = this.genID(); | |
} | |
ObjectId.prototype.genID = function () { | |
var float32 = 16777216; | |
var int16 = 65536; | |
var ts = Math.floor(Date.now() / 1000).toString(16); | |
var mid = Math.floor(Math.random() * (int16)).toString(16); |
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
#!/usr/bin/env python | |
#./upload.py --key KEY --secret SECRET --bucket BUCKET --path /path/to/file --file /absolute-path-to-upload --mimetype image/png --acl public-read | |
import argparse | |
import sys | |
import boto | |
parser = argparse.ArgumentParser(description='uploads file to s3') | |
parser.add_argument('--key', '-k', type=str, required=True, help='s3 auth key') |
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
#!/usr/bin/env python | |
import importlib | |
import importlib.util | |
import pip | |
def install(name, version=None): | |
args = [ | |
'install', |
OlderNewer