These characters are all characters that can look similar - I use this to test monspace fonts for legibility.
This file contains hidden or 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
""" | |
Simple forking echo server built with Python's SocketServer library. A more | |
Pythonic version of http://gist.github.com/203520, which itself was inspired | |
by http://tomayko.com/writings/unicorn-is-unix. | |
""" | |
import os | |
import SocketServer | |
class EchoHandler(SocketServer.StreamRequestHandler): |
This file contains hidden or 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
/* SOURCE: https://github.com/supereggbert/GLGE/blob/master/src/core/glge.js%20%20 */ | |
fastHash=function(str){ | |
var s1=0;var s2=0;var s3=0;var s4=0;var s5=0;var s6=0; | |
var c1=0;var c2=0;var c3=0;var c4=0;var c5=0;var c6=0; | |
var i=0; | |
var length=str.length; | |
str+="000000"; | |
while(i<length){ | |
c1=str.charCodeAt(i++);c2=str.charCodeAt(i++);c3=str.charCodeAt(i++); |
This file contains hidden or 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
// A dependentObservable that can be written to and reverted. | |
ko.detatchableDependentObservable = function(value, model) { | |
var root_value = typeof value === 'function' ? ko.dependentObservable(value, model) : ko.observable(value); | |
var public_value = ko.observable(root_value()); | |
root_value.subscribe(function(value){ | |
public_value(value); | |
}); | |
var public_ = ko.dependentObservable({read: public_value, write: function(value){ public_.isConnected(false); public_value(value); }}); |
This file contains hidden or 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
""" | |
Inspired by: | |
http://eli.thegreenplace.net/2009/08/29/co-routines-as-an-alternative-to-state-machines/ | |
""" | |
def parse_args(target): | |
"""A generator that parses a stream of arguments one character at a time. | |
As soon as a flag, or flag value pair ("-a" or "-a value") is processed | |
the pair is sent off as a tuple to the 'target' generator. |
This file contains hidden or 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 | |
""" | |
Tail-Recursion helper in Python. | |
Inspired by the trampoline function at | |
http://jasonmbaker.com/tail-recursion-in-python-using-pysistence | |
Tail-recursive functions return calls to tail-recursive functions | |
(themselves, most of the time). For example, this is tail-recursive: |
This file contains hidden or 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 time import time | |
from logging.config import fileConfig | |
from twisted.internet import epollreactor | |
epollreactor.install() | |
from flask import Flask, request | |
app = Flask(__name__) | |
fileConfig("logging.ini") |
This file contains hidden or 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
/** | |
* Treat generators and coroutines the same | |
* This means we need to treat all generators | |
* as coroutines, rather than the other way around. | |
*/ | |
function *loggingDecorator(gen) { | |
let processed = gen.next(null); | |
while (!processed.done) { | |
console.log("INFO:", processed); | |
let unprocessed = yield processed.value; |
This file contains hidden or 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
gradient-with-fallback(fallback=none, gradient-args...) { | |
args = unquote(join(", ", gradient-args)) | |
fallback = typeof(fallback) == "string" ? unquote(fallback) : fallback | |
background: fallback | |
background-image: -vendor-linear-gradient(args) | |
background-image: linear-gradient(args) | |
} | |
.test { | |
gradient-with-fallback(#FFF 150px, #CCC 100%, fallback: top left repeat-y url("some/image.jpg")) |
This file contains hidden or 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 b() { | |
//The file goes through heuristics that turn object properties into | |
//a hash table | |
//run with | |
//d8 --enable-natives-syntax prop_heuristics.js | |
//Note that even if object has fast properties, there are still 2 kinds of | |
//fast properties (in and out of object) and only one of them is even faster. |