Skip to content

Instantly share code, notes, and snippets.

View viktor-evdokimov's full-sized avatar
👷‍♂️
Focusing

Viktor Evdokimov viktor-evdokimov

👷‍♂️
Focusing
View GitHub Profile
@zdam
zdam / clojure-clr-webserver.cs
Created February 28, 2010 00:00
Use clojureCLR inside an asp.net MVC app
/*
* This is a litle tech demo to demonstrate using clojureCLR in a CLR web app.
*
* A custom IHttpHandler (ClojureHttpHandler) handles invocation of clojure code,
* and a custom IRouteHandler (ClojureRouteHandler) routes requests to the HttpHandler.
*
* See comments in the code for further detail.
*
* Cheers, zdam
* http://zimpler.com/blog/clojureclr-in-an-asp-net-mvc-app
import simplejson as json
import lxml
class objectJSONEncoder(json.JSONEncoder):
"""A specialized JSON encoder that can handle simple lxml objectify types
>>> from lxml import objectify
>>> obj = objectify.fromstring("<Book><price>1.50</price><author>W. Shakespeare</author></Book>")
>>> objectJSONEncoder().encode(obj)
'{"price": 1.5, "author": "W. Shakespeare"}'
"""
@dieseltravis
dieseltravis / changeset.bat
Created April 27, 2011 17:14
get changed files from TFS
@echo off
SET tfs=http://YOUR_TFS_SERVER:8080/
:number
ECHO Enter changeset number (0 to exit):
SET /p chg=
IF NOT %chg% GTR 0 GOTO end
"%ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\TF.exe" changeset /server:%tfs% %chg% /noprompt
GOTO number
:end
@timmyomahony
timmyomahony / nginx.conf
Created June 26, 2011 13:29
Python, UWSGI, Supervisor & Nginx
upstream uwsgi {
ip_hash;
server 127.0.0.1:40000;
}
server {
listen 80;
server_name www.domain.com;
root /sites/mysite/;
access_log /sites/mysite/log/nginx/access.log;
@vojtajina
vojtajina / angular-eventBus.js
Created July 30, 2011 13:41
Angular $eventBus
// pseudocode
angular.service('$eventBus', function() {
var listeners = {};
var mainBus = function(scope) {
return new ChildBus(mainBus, scope);
};
mainBus.emit = function(type) {
var args = Array.prototype.slice.call(arguments, 1);
@siddhi
siddhi / pyconindia_dsl.py
Created September 16, 2011 06:33
Domain Specific Languages in Python - Pycon India - 17 Sep 2011
from pyparsing import *
# By default, PyParsing treats \n as whitespace and ignores it
# In our grammer, \n is significant, so tell PyParsing not to ignore it
ParserElement.setDefaultWhitespaceChars(" \t")
def parse(input_string):
def convert_prop_to_dict(tokens):
"""Convert a list of field property tokens to a dict"""
prop_dict = {}
@Jach
Jach / mig.py
Created December 30, 2011 04:09
Dirty migration script from Jira issues to Github issues
'''
Steps:
1. Create any milestones
2. Create any labels
3. Create each issue, linking them to milestones and labels
3.1: Update status for new issue if closed
4: Create all the comments for each issue
'''
import getpass
import json
@andyhd
andyhd / maybe-monad.js
Created January 16, 2012 01:02
Maybe monad in Javascript
function maybe(value) {
var obj = null;
function isEmpty() { return value === undefined || value === null }
function nonEmpty() { return !isEmpty() }
obj = {
map: function (f) { return isEmpty() ? obj : maybe(f(value)) },
getOrElse: function (n) { return isEmpty() ? n : value },
isEmpty: isEmpty,
nonEmpty: nonEmpty
}
@DazWorrall
DazWorrall / Output
Created February 9, 2012 13:06
Testing file upload handling in Flask
in upload handler
in file close
..
----------------------------------------------------------------------
Ran 2 tests in 0.021s
OK

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name: