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 inspect, types | |
verboten = set(["queryset", "initial", "error_messages"]) | |
NotNone = object() | |
memo = set() | |
def _make_ctor_args(obj): | |
params = [] | |
namesSeen = set() | |
allArgs = [] | |
for cls in inspect.getmro(obj.__class__): |
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
# -- encoding: utf-8 -- | |
""" A fairly advanced HTML/HTML5 compressor. """ | |
from __future__ import with_statement | |
import re | |
from itertools import chain | |
HTML5_BLOCKS = set( | |
'head body title link ' | |
'article aside nav section ' |
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
# Note: This is actually Coco (http://github.com/satyr/coco), not CoffeeScript. | |
# I haven't tested this, just wanted to see how concise I could make of the Coco implementation. | |
el = let | |
doc = document | |
directProperties = { | |
class: \className, \className, \defaultValue, | |
for: \htmlFor, html: \innerHTML, text: \textContent, \value | |
} | |
booleanProperties = {+checked, +defaultChecked, +disabled, +multiple, +selected} |
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 django import template | |
register = template.Library() | |
class VerbatimNode(template.Node): | |
def __init__(self, text): | |
self.text = text | |
def render(self, context): |
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
# This would be your settings module (settings/__init__.py) | |
class Setup(object): | |
def __init__(self, load_from=None): | |
self.commit(load_from) | |
def is_valid_key(self, key): | |
return (key == key.upper() and not key.startswith("_")) | |
def commit(self, source): |
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
### Google cache link crawler | |
### Public domain and all | |
### requires the Requests library for Python (pip install requests / easy_install requests) | |
### requires Python 2.6+, maybe Python 2.7. Who knows! | |
### | |
### TL;DR: | |
### python gcache2.py -p somesite.shelf -a get-links some-site.fi | |
### (get several tons of coffee while it runs - the delays are long) | |
### python gcache2.py -p somesite.shelf -a list-queue |
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
package hurrdurrtest; | |
public class AwesomeService extends ServiceBase { | |
private String context; | |
@Override | |
public void setContext(String ctx) { | |
System.out.println("Yo, the context is " + ctx); | |
context = ctx; | |
} |
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
/* 5.11.2012 22:08 */ | |
using System; | |
using System.Collections.Generic; | |
namespace ServiceManager | |
{ | |
public static class ServiceManager | |
{ | |
private static Dictionary<Type, ServiceBase> _cache = new Dictionary<Type, ServiceBase>(); | |
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
universe = {} | |
purgatory = {} | |
summon = (type, context) -> (purgatory[type] ||= new universe[type]) <<< {context} | |
summonable = -> universe[it.display-name] = it | |
class Base | |
-> console.log "A new <#{@..display-name}> was born!" |
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
#include "kiss_fft.h" | |
#include "kiss_fftr.h" | |
#define FRAMES_PER_BUFFER 2048 | |
kiss_fft_cpx freq_data[FRAMES_PER_BUFFER]; | |
kiss_fft_scalar audio_data[FRAMES_PER_BUFFER]; | |
kiss_fftr_cfg fft_cfg; | |
OlderNewer