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 React, { PropTypes } from "react"; | |
import { isMultiSelect, retrieveSchema } from "zbyte64/react-jsonschema-form/src/utils"; | |
import ArrayField from "zbyte64/react-jsonschema-form/src/components/fields/ArrayField"; | |
import BooleanField from "zbyte64/react-jsonschema-form/src/components/fields/BooleanField"; | |
import NumberField from "zbyte64/react-jsonschema-form/src/components/fields/NumberField"; | |
import ObjectField from "zbyte64/react-jsonschema-form/src/components/fields/ObjectField"; | |
import StringField from "zbyte64/react-jsonschema-form/src/components/fields/StringField"; | |
import UnsupportedField from "zbyte64/react-jsonschema-form/src/components/fields/UnsupportedField"; |
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 rethinkdb.net import ConnectionInstance, SocketWrapper, Connection, decodeUTF | |
from rethinkdb.errors import * | |
import socket | |
import time | |
import ssl | |
class TLSConnectionInstance(ConnectionInstance): | |
def connect(self, timeout): | |
self._socket = TLSSocketWrapper(self, timeout) |
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 io | |
numbers = { | |
(' _ ', '| |', '|_|'): 0, | |
(' ', ' |', ' |'): 1, | |
(' _ ', ' _|', '|_ '): 2, | |
(' _ ', ' _|', ' _|'): 3, | |
(' ', '|_|', ' |'): 4, | |
(' _ ', '|_ ', ' _|'): 5, |
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 gevent import monkey; monkey.patch_all() | |
from gevent.pool import Pool | |
import stripe | |
to_delete = list() | |
pool = Pool(10) | |
def check_customer(customer): | |
if customer['subscription'] or customer['default_card']: | |
return False |
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 boto.s3.cors import CORSConfiguration | |
from boto.s3.connection import S3Connection | |
conn = S3Connection('<aws access key>', '<aws secret key>') | |
bucket = conn.create_bucket('mybucket') | |
config = CORSConfiguration() | |
config.add_rule(allowed_method=['GET'], allowed_origin=['*'], allowed_header=['Content-*', 'Host'], max_age_seconds=3000) | |
bucket.set_cors(config) |
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 simplecart.discounts.models import * | |
from simplecart.orders.models import SKU | |
from decimal import Decimal | |
import datetime | |
from django import forms | |
class r(str): | |
pass |
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
/* | |
Registers the following tags (use is property): | |
* x-googlemap (iframe with api-key & address properties) | |
be sure to enable polyfill: https://github.com/WebReflection/document-register-element | |
*/ | |
(function() { | |
var GoogleMapProto = Object.create(HTMLElement.prototype); |
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 django.views.debug import technical_500_response | |
import sys | |
import webbrowser | |
import tempfile | |
class BrowserExceptionMiddleware(object): | |
def process_exception(self, request, exception): | |
response = technical_500_response(request, *sys.exc_info()) | |
path = tempfile.mkstemp(suffix='html')[1] | |
open(path, 'w').write(response.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
<Route path="/" component={AdminPanel}> | |
<Route path="users" component={CrudList}> | |
<Route path="/add" component={CrudAdd}/> | |
<Route path="/:id" component={CrudDetail}/> | |
<Route path="/:id/delete" component={CrudDelete}/> | |
<Route path="/:id/transfer" component={TransferAccount}/> | |
</Route> | |
<Route path="industries" component={CrudList}> |
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
function mergeElements(target, source) { | |
var seen = {}; | |
if (target.tagName != source.tagName) { | |
console.log("tagname change:", target.tagName, source.tagName, source) | |
target.parentNode.replaceChild(source, target); | |
return; | |
} | |
_.each(source.attributes, function(att) { | |
seen[att.nodeName] = true; | |
if (att.nodeName === 'data-reactid') { |