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 Processor(instructions) | |
{ | |
this.instructions = instructions.map(i => i); | |
this.instructionPointer = 0; | |
this.input = []; | |
this.inputPointer = 0; | |
this.output = null; | |
this.running = false; | |
this.sendOutput = null; | |
this.relativebase = 0; |
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
const NORMAL = 0; | |
const FOUNDAMP = 1; | |
const FOUNDHASH = 2; | |
const FOUNDX = 3; | |
const FOUNDHEX = 4; | |
const GOTENTITY = 5; | |
const FOUNDDEC = 6; | |
function replaceNumericEntities(input) | |
{ |
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
#! python | |
import os | |
import shutil | |
import argparse | |
import json | |
parser = argparse.ArgumentParser(description='Creates a report about the distribution over folders of disk use.') | |
parser.add_argument('drive_letter', nargs=1, metavar='drive letter', help='The drive that should be analysed.') |
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
def string_distance(s1, s2): | |
allchars = ''.join(sorted(set(s1+s2))) | |
s1vals = [allchars.index(c) for c in s1] | |
s2vals = [allchars.index(c) for c in s2] | |
diffs = [abs(x-y) for x,y in zip(s1vals,s2vals)] | |
lengthdiff = abs(len(s1)-len(s2)) | |
return sum(diffs)+lengthdiff |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>sandpile</title> | |
</head> | |
<body> | |
<canvas id="canv" width="300" height="300"></canvas> | |
<script src="js/sandpile.js" type="text/javascript"></script> | |
</body> | |
</html> |
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
// ==UserScript== | |
// @name Chat Commands | |
// @namespace StackScripts | |
// @description commands that can be executed in chat | |
// @version 1 | |
// @grant none | |
// @include http://chat.stackexchange.com/rooms/1/sandbox | |
// @include http://chat.stackexchange.com/rooms/35/the-bridge | |
// @author http://english.stackexchange.com/users/3559/matt-%D0%AD%D0%BB%D0%BB%D0%B5%D0%BD | |
// ==/UserScript== |
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
var p = Math.log(20)/Math.log(2) - 1; | |
function binarise(x) | |
{ | |
if(x === 0) | |
{ | |
return 0; | |
} | |
if(x === 1) |
NewerOlder