- Mac OSX
- Binary installation from python.org
- Windows
- Binary installation from python.org
- Ubuntu/Debian
- sudo apt-get install python2.7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Python implementation of Conway's Game of Life | |
Somewhat inspired by Jack Diederich's talk `Stop Writing Classes` | |
http://pyvideo.org/video/880/stop-writing-classes | |
Ironically, as I extended the functionality of this module it seems obvious | |
that the next step would be to refactor board into a class with advance and | |
constrain as methods and print_board as __str__. | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// placeholder text fallback | |
// requires modernizer and jQuery | |
$(function () { | |
if (!Modernizr.input.placeholder) { | |
var placeholder_text_color = '#999999'; | |
function hide_placeholder_fake(real, fake) { | |
real.show(); | |
real.focus(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function parse_git_dirty { | |
[[ `git status --porcelain` ]] && echo "*" | |
} | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/" | |
} | |
export PS1="\n\[$BPurple\][\w]\n\[$BCyan\]\u@\h \[$BGreen\]\$(parse_git_branch)\n$\[$Color_Off\] " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
r"""Generate and check password hashes for Ubersmith DE (salted sha1). | |
Example use: | |
>>> my_new_hash = generate_hash('my_new_pass', 'salt') | |
>>> my_new_hash # store this in the database | |
'{ssha1}W77amZWRUSWjDLh04P/dlfsCvYdzYWx0\n' | |
>>> check_password('my_new_pass', my_new_hash) | |
True | |
>>> check_password('not_my_new_pass', my_new_hash) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
"""Naive Monte Carlo approximation of pi.""" | |
from __future__ import division | |
import math | |
from random import random | |
from itertools import repeat | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interval_id = high = low = null | |
ticker = $ '#price' | |
alert_url = 'http://www.angelfire.com/ut/jlpicard/images/picalert.wav' | |
start = -> | |
do nodes.stop.show | |
do nodes.start.hide | |
interval_id = setInterval -> | |
current_price = parseFloat do ticker.text | |
unless high > current_price > low |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Counter() { | |
this.elements = {}; | |
} | |
Counter.prototype.lookup = function (element) { | |
var el, i; | |
el = this.elements[element] || []; | |
for (i = 0; i < el.length; i++) { | |
if (el[i][0] === element) { | |
return el[i][1]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Testing Calculator</title> | |
<style type="text/css"> | |
#display { | |
width: 180px; | |
border: 1px solid black; | |
padding: 5px 7px; |
OlderNewer