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
mouse.vusb.enable = "TRUE" | |
mouse.vusb.useBasicMouse = "FALSE" | |
mks.mouse.pixelScrollSensitivity = "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
// This code will teach you how to write a simple recursive descent parser. | |
// Corners will be cut, but by the end you will have the basis of most | |
// programming languages out there: strings, numbers, identifiers, and | |
// infix arithmetic expressions with precendence. | |
// At under 100 lines, I promise it won't take long. Happy Hacking! | |
// -- James Keane | |
// | |
// First the source code has to be tokenized, for the parser. | |
// Let's do five tokens, and ignore whitespace: | |
// 1. operators (+, -, *, etc.) |
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 tco(f) { | |
let isin = false; | |
return function() { | |
if (isin) throw [this, arguments]; | |
isin = true; | |
let args = [this, arguments]; | |
while(true) { | |
try { | |
const ret = f.apply(args[0], args[1]); | |
isIn = false; |
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 inspect import getfullargspec, getsourcelines | |
type_map = { | |
int: 'integer' | |
} | |
tmpl = """ | |
CREATE FUNCTION {func_name} ({args}) | |
RETURNS {return_t} | |
AS $$ |
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
border: no |
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
border: no |
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 nails | |
class IndexController(nails.Controller): | |
def index(self, request): | |
return "Hello World from controller!" | |
def proof(self, request): | |
return "Proof that routing is working" |
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
# Uses django-signals behind the scenes to throw the events around | |
# Also uses gevent.pywsgi.WSGIServer to stream the event source. | |
# Basic usage | |
from django.dispatch import Events | |
from django.contrib.auth.models import User, Group | |
# Basic support for individual users | |
user = User.objects.get(id=1) | |
user.subcribe('event:name another:event') # subscriptions are session persistent (configurable to db)? |
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
// Top hat monocle - third party module API | |
// ===== | |
// ## Module Discovery | |
// All 3rd party modules _must_ be discoverable based on a simple http resource URI | |
// i.e. | |
// GET /modules/question | |
{ | |
name: "Question Module", |
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
Coffeescript + types + haskell = compiled language | |
========= | |
- Increments an infinite precision number, represented as a linked list with least significant digit as head | |
increment = (x: [Num]) -> | |
switch x | |
when [] then [1] | |
when (9::tail) then 0::increment(tail) | |
when (h::t) then (h+1)::t |
NewerOlder