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 tld.domain.component | |
import tld.domain.RouterContext | |
import org.w3c.dom.events.Event | |
import react.RBuilder | |
import react.RProps | |
import react.RPureComponent | |
import react.RState | |
interface LocationComponentProps : RProps { |
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
fun <S> customEnhancer(): Enhancer<S, Action, Action, RAction, WrapperAction> = { next -> | |
{ reducer, initialState -> | |
fun wrapperReducer(reducer: Reducer<S, RAction>): Reducer<S, WrapperAction> = { state, action -> | |
if (!action.asDynamic().isKotlin as Boolean) { | |
reducer(state, action.asDynamic().unsafeCast<RAction>()) | |
} else { | |
reducer(state, action.action) | |
} | |
} |
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
kotlin { | |
target { | |
browser { | |
compilations.all { | |
kotlinOptions { | |
friendModulesDisabled = false | |
metaInfo = true | |
sourceMap = true | |
sourceMapEmbedSources = "always" | |
moduleKind = "commonjs" |
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 . import exceptions | |
from voluptuous import Schema | |
from voluptuous import MultipleInvalid | |
from voluptuous import Required, All, Length, Range, Coerce | |
# https://www.postgresql.org/docs/9.1/static/datatype-numeric.html | |
PG_MAX_BIG_INT = 9223372036854775807 | |
PG_MAX_BIG_INT_LENGTH = 20 | |
PG_INT_RANGE = Range(min=1, max=PG_MAX_BIG_INT) |
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
# -*- coding: utf-8 -*- | |
import asyncio | |
import aiozmq.rpc | |
@asyncio.coroutine | |
def get_rpc_connection(connect='', loop=None): | |
timeout = 1 | |
connection = yield from aiozmq.rpc.connect_rpc(connect=connect, timeout=timeout, loop=loop) | |
return connection |
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.forms.models import fields_for_model | |
import floppyforms | |
def widgets_for_model(model): | |
return {k: v.widget.__class__.__name__ for k, v in fields_for_model(model).items()} | |
def floppyforms_widgets(model): | |
return {field: getattr(floppyforms, widget) for field, widget in widgets_for_model(model).items()} | |
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
# urls.py | |
url(r'^editor/instance/' | |
r'(?:forum/(?P<forum_id>\d+)/)?' | |
r'(?:topic/(?P<topic_id>\d+)/)?' | |
r'(?:post/(?P<post_id>\d+)/)?$', 'forum.views.mked_post', name='mked_post'), | |
# views.py | |
def mked_post(request, **kwargs): | |
return HttpPreResponse( |
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
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import glob | |
import shutil | |
import subprocess | |
import os | |
IMG_PATTERN = '/cam/*/*/*.jpg' | |
VID_PATH = '/cam/video' | |
TMP_PATH = '/tmp/frame_symlinks' |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import re | |
from tornado.web import RequestHandler, Application | |
from tornado.websocket import WebSocketHandler | |
from tornado.ioloop import IOLoop | |
import socket | |
import threading | |
import Queue |
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
# -*- coding: utf-8 -*- | |
from django import template | |
from django.utils.encoding import force_unicode | |
from django.utils import timezone | |
from django.core.cache import cache | |
# import datetime | |
# from django.conf import settings | |
# from django.utils.formats import sanitize_separators | |
# from django.utils.html import conditional_escape as esc |