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 foo() { | |
this.a = function () { return 96 } | |
this.b = function () { return this.a() * 10101 } | |
} | |
function bar() {} | |
bar.prototype = new foo | |
b = new bar | |
b.a() // 96 |
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
macro _sin { | |
case { _($x:lit) } => | |
{ | |
var res = Math.sin(unwrapSyntax(#{ $x })) | |
return [makeValue(res, #{ $x })] | |
} | |
case { _($x) } => | |
{ | |
return #{ Math.sin($x) } |
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 load(images, done) { | |
var toLoad = images.length | |
var res = Array(toLoad) | |
var loaded = 0 | |
images.forEach(function (url, i) { | |
var image = new Image | |
image.onload = function () { | |
res[i] = this | |
if (++loaded == toLoad) |
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
# Tests for antialiasing a high-frequency image in various ways | |
# Nathan Reed, July 2014 | |
# Written for Python 3.4; requires numpy and Pillow to be installed | |
import concurrent.futures | |
import math | |
import multiprocessing | |
import numpy as np | |
import optparse | |
import random |
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 | |
import sys | |
import io | |
import tarfile | |
import urllib.request | |
ARCHIVE_URL = 'http://d.pr/f/YqS5+' | |
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 jmp { cd -P "$JMP_PATH/$1" 2>/dev/null || echo Not found; } | |
function setjmp { ln -s "`pwd`" "$JMP_PATH/$1"; } | |
function deljmp { rm -i "$JMP_PATH/$1"; } | |
export JMP_PATH="$HOME/.jmp" |
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
var res = [] | |
parse(document.documentElement) | |
chrome.runtime.sendMessage(res) | |
function parse(node) { | |
var i, a, name = node.tagName.toLowerCase() | |
res.push({type: 'o', name: name}) | |
for (i = 0; i < node.attributes.length; ++i) { |
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 re | |
from hashlib import md5 | |
def gfm(text): | |
# Extract pre blocks. | |
extractions = {} | |
def pre_extraction_callback(matchobj): | |
digest = md5(matchobj.group(0)).hexdigest() | |
extractions[digest] = matchobj.group(0) | |
return "{gfm-extraction-%s}" % digest |
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 perl | |
use 5.01; | |
do { say "USAGE: $0 <postfix.txt>"; exit 0 } | |
unless $ARGV[0]; | |
# --------------- main ----------------- | |
my (@data, $char, $result, @stack); |
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 <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
#define OPEN_BRACKET_STATE 1 | |
#define CLOSE_BRACKET_STATE 2 | |
#define NUMBER_STATE 3 | |
#define OPERATOR_STATE 4 | |
char OPERATORS[] = {'/', '*', '-', '+'}; |
OlderNewer