Skip to content

Instantly share code, notes, and snippets.


Dmitriy Tkalich creativ

View GitHub Profile
View cors-nginx.conf
# Slightly tighter CORS config for nginx
# A modification of to include a white-list of URLs
# Despite the W3C guidance suggesting that a list of origins can be passed as part of
# Access-Control-Allow-Origin headers, several browsers (well, at least Firefox)
# don't seem to play nicely with this.
# To avoid the use of 'Access-Control-Allow-Origin: *', use a simple-ish whitelisting
creativ / Makefile
Created Aug 6, 2014
Simple Makefile for CoffeeScript projects
View Makefile
COFFEEC = ./node_modules/.bin/coffee
DIST = dist
CONF = src/conf
all: build_dev build_prod
@$(COFFEEC) --join $(DIST)/lib-dev.js --compile src/ $(CONF)/
@echo 'Lib(Dev) successfully builded'
creativ /
Created Aug 17, 2014
Cleverbot usage example
import md5
import urllib
import urllib2
import uuid
import xml.dom.minidom
Copyright (C) 2011
class App.Button extends createjs.Container
constructor: (buttonOptions={}) ->
defaultButtonOptions =
text: null
outlineText: null
@buttonOptions = Psycho.merge defaultButtonOptions, buttonOptions
class App.SignMiddleware
constructor: (@gameData, callback) ->
@name = 'requestSign'
@sessionKey = null
url: "#{@gameData.endpointUrl}user/getSessionKey"
type: 'POST'
data: @_signRequestParams { userId: @gameData.userId }
creativ / factory_v3
Last active Jan 3, 2016
Simple factories
View factory_v3
def shape_factory(type, *args, **kwargs):
if type == "Circle": return Circle(*args, **kwargs)
elif type == "Square": return Square(*args, **kwargs)
else: None
class Shape(object):
def draw(self):
raise NotImplementedError()
def erase(self):
creativ / analytics.js
Created Oct 2, 2014
Google analytics event tracker
View analytics.js
// Google analytics implementation
window.Analytics = (function(ga) {
function Analytics() { }
Analytics.prototype.trackEvent = function(category, action, label, value) {
ga.apply(this, ['send', 'event'].concat(;
Analytics.prototype.trackPage = function(options) {
ga.apply(this, ['send', 'pageview'].concat(;
You can’t perform that action at this time.