Skip to content

Instantly share code, notes, and snippets.

Pindi Albert pindia

Block or report user

Report or block pindia

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
pindia / gist:9b7787a607a5a676c6d8
Last active Feb 27, 2017
Django session cookie migration
View gist:9b7787a607a5a676c6d8
#
from django.conf import settings
from importlib import import_module
class UpdateSessionCookieMiddleware(object):
Migrates session data from an old (hardcoded) session cookie name and domain to the name and
domain currently defined in the Django settings.
View gist:3868246
Which of the following formal propositions says that there is no largest prime, where P(x) means "x is prime"? (There may be more than one. You have to select all correct propositions.) The variables denote natural numbers. [6 points]
Math : ∀x∃y[P(x)∧P(y)∧(x<y)]
MathEnglish: For all x there exists y such that x and y are both prime, and y is greater than x.
INCORRECT: not all numbers are prime
English : There is no largest prime number.
Slightly mathy English: For all prime numbers, there exists a larger prime number.
pindia / gist:3836713
Created Oct 4, 2012
Python truth table calculator
View gist:3836713
from itertools import izip, product, tee
# Logic functions: take and return iterators of truth values
def AND(a, b):
for p, q in izip(a, b):
yield p and q
def OR(a, b):
for p, q in izip(a, b):
pindia / gist:3166678
Created Jul 23, 2012
Step by step from jQuery to Agility.js
View gist:3166678

Step by step from jQuery to Agility.js

There's probably hundreds of Javascript MVC frameworks out there. But my favorite, Agility.js, seems to be barely ever mentioned. Agility has served me well in several projects both big and small, so I'm writing a tutorial in the spirit of Step by step from jQuery to Backbone for Agility.

What makes Agility different from other MVC frameworks? In short, the lack of boilerplate and the completeness. Other frameworks involve many, many lines of boilerplate that provide a significant barrier to entry and detract from the readability of the final product. Agility minimizes this, lets you get started fast, and stays out of your way. But it doesn't sacrifice either completeness or maintainability. Agility is feature-rich, including two-way model-view bindings, declarative controller-events, prototypical inheritance, server persistance, and everything else

View gist:1450560
import base64, marshal
exec marshal.loads(base64.b64decode('''YwAAAAABAAAAAwAAAEMAAABzIAAAAGQB
View gist:1449696
import base64
exec base64.b64decode('''CnggPSAiYmFzZTY0LmI2NGRlY29kZSgnWW1GelpUWTBMbUkyTkdSbFkyOWtaU2duV1cxR2V
You can’t perform that action at this time.