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 | |
import os, shutil | |
PAGE_ORDER = ['header', 'banner', 'content', \ | |
'footer', 'sidebar', 'analytics'] | |
def createPage(content, dest = None): | |
page, w_target = '', 'site' | |
for section in PAGE_ORDER: | |
if section is 'content': |
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
from PyQt4.QtCore import * | |
from PyQt4.QtGui import * | |
from PyQt4.QtNetwork import * | |
import sys | |
import urllib2 | |
from lxml.html import fromstring | |
import random, string | |
class AlbumCreator(QDialog): | |
def __init__(self, parent = None): |
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
from setuptools import setup | |
APP = ['albumart.py'] | |
DATA_FILES = [] | |
OPTIONS = {'argv_emulation': True, "includes":["sip", "lxml._elementpath", "gzip", "PyQt4.QtNetwork"]} | |
setup( | |
app=APP, | |
data_files=DATA_FILES, | |
options={'py2app': OPTIONS}, |
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
import os | |
class Cat(object): | |
"""Any variety of feline""" | |
def eat(self, food): | |
os.remove(food) | |
print "Meow" | |
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
from BeautifulSoup import BeautifulStoneSoup | |
class Villager(object): | |
"""Just a gullible simpleton...""" | |
@staticmethod | |
def throw_in_pot(pot, item): | |
pot.append(item) | |
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
class Question(Document): | |
score = IntField(required = True, default = 0) | |
voters = ListField(ReferenceField(User), default = lambda : []) | |
def vote_up(self, username): | |
Question.objects(id=self.id).update_one(inc__score=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
function get_random_color() { | |
var letters = '0123456789ABCDEF'.split(''); | |
var color = '#'; | |
for (var i = 0; i < 6; i++ ) { | |
color += letters[Math.round(Math.random() * 15)]; | |
} | |
return color; | |
} | |
function getRandomArbitary (min, max) { |
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
data = 'FourscoreandsevenyearsagoourfaathersbroughtforthonthiscontainentanewnationconceivedinzLibertyanddedicatedtothepropositionthatallmenarecreatedequalNowweareengagedinagreahtcivilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvancedItisratherforustobeherededicatedtothegreattdafskremainingbeforeusthatfromthesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastpfullmeasureofdevotionthatweherehighlyresolvethatthese |
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
void queue_swap(event_t *a, event_t *b) | |
{ | |
event_t *tmp; | |
// make sure the parent links are updated to point to the new children | |
if (a->parent && a->parent->left == a) | |
{ | |
a->parent->left = b; | |
} | |
else if (a->parent) |
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
- items.forEach(function(item){ | |
li | |
textarea.item(disabled=true)= item | |
button.edit edit | |
button.delete delete | |
- }) |
OlderNewer