Skip to content

Instantly share code, notes, and snippets.

я котик пур-пур mvasilkov

Block or report user

Report or block mvasilkov

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
ghoseb /
Created Nov 14, 2008
The evolution of a Python Programmer
#Newbie programmer
def factorial(x):
if x == 0:
return 1
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal
rozza /
Created Oct 18, 2010
A decorator for django management commands that ensures only one process is running at any one time.
A decorator for management commands (or any class method) to ensure that there is
only ever one process running the method at any one time.
Requires lockfile - (pip install lockfile)
Author: Ross Lawley
import time
balupton / bind.trigger.prototype.js
Created Jan 26, 2011
Bind and Trigger Custom and Native Events in Prototype
View bind.trigger.prototype.js
* Bind and Trigger custom and native events in Prototype
* @author Juriy Zaytsev (kangax)
* @author Benjamin Lupton (balupton)
* @copyright MIT license
var eventMatchers = {
'HTMLEvents': /^(?:load|unload|abort|error|select|hashchange|popstate|change|submit|reset|focus|blur|resize|scroll)$/,
simurai / Overlay Grid
Created Feb 26, 2011
A flexible grid overlay to test your site's alignment.
View Overlay Grid
/* Grid */
html:before, html:after {
content: "";
position: absolute;
top: 0;
right: 0;
pointer-events: none;
/* change to px if you get a scrollbar */
"""GitHub flavoured markdown: because normal markdown has some vicious
Further reading on the gotchas:
This is a Python port of GitHub code, taken from
To run the tests, install nose ($ easy_install nose) then:
tschellenbach / Django Mock Request
Created Apr 18, 2011
Fake django requests for testing purposes
View Django Mock Request
from django.core.handlers.base import BaseHandler
from django.test.client import RequestFactory
class RequestMock(RequestFactory):
def request(self, **request):
"Construct a generic request object."
request = RequestFactory.request(self, **request)
handler = BaseHandler()
for middleware_method in handler._request_middleware:
View alea.js
// From
function Alea() {
return (function(args) {
// Johannes Baagøe <>, 2010
var s0 = 0;
var s1 = 0;
var s2 = 0;
var c = 1;
if (args.length == 0) {
paraboul / command line
Created Mar 14, 2012
JavaScript + C Preprocessor
View command line
/usr/bin/cpp -P -undef -Wundef -std=c99 -nostdinc -Wtrigraphs -fdollars-in-identifiers -C < foo.js
erikh /
Created Mar 31, 2012 — forked from DAddYE/
OSX For Hackers
#!/usr/bin/env sh
# This is script with usefull tips taken from:
# install it:
# curl -sL | sh
View gist:2317969
import inspect
def marmoset_patch(func, s, r):
source = inspect.getsource(func).replace(s, r)
exec source in func.func_globals
func.func_code = func.func_globals[func.__name__].func_code
def foo():
print 1
print 2
You can’t perform that action at this time.