Skip to content

Instantly share code, notes, and snippets.

View dimsmol's full-sized avatar

Dmitriy Smolin dimsmol

View GitHub Profile
@dimsmol
dimsmol / gist:10009392
Last active August 29, 2015 13:58
JavaScript DSL examples
// contract example
this.addItems([
res('', { // resource at root of this contract (will be connected to some url at upper level)
get: [ // HTTP GET handler
// This array will be replaced with a handler containing number of other handlers
auth().opt, // optional authentication
data({ // input data specification
roomId: vld.Message.roomId, // Message class is defined below
fromDate: opt(dateStr), // date, allowed in string form, optional
@dimsmol
dimsmol / output example
Created March 29, 2012 10:45
why pg doesn't need next example
BEGIN
INSERT
ROLLBACK
BEGIN
INSERT
COMMIT
BEGIN
INSERT
COMMIT
BEGIN
@dimsmol
dimsmol / enum.py
Created May 14, 2010 19:28
Enum implementation example
class Unset(object):
pass
class Item(object):
_cnt = 0
def __init__(self, value=Unset, choice=Unset):
self.key = None
self.value = value
self.choice = choice