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 encodeFrame(frame, idx) { | |
// RLE: MSB indicates a run-length (2-127) for the subsequent character | |
return frame.replace(/(.)\1{2,127}/g, function(s) { | |
return String.fromCharCode(128 + s.length) + s[0]; | |
}); | |
} | |
var decodeCache = {}; | |
function decodeFrame(frame) { | |
return frame.replace(/[\u0080-\u00FF]./g, function replaceCallback(s) { |
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 is an anonymized but otherwise unmodified copy from the | |
// documentation of a renowned tracking-provider. | |
var toSleep = true; | |
function stopTimer(){toSleep=false;} | |
function clickTracker(LinkName){ | |
var secureID="XXX"; | |
var redirectUrl="http://wehave.teh-trackingz.com/1px.gif"; |
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
class Node | |
constructor: (@p, @value, @childs=[]) -> | |
class HuffmanTreeBuilder | |
_nodes: [] | |
_rootNode: null | |
# probabilities = value1: probability1, value2: probability2, ... | |
constructor: (probabilities = {}) -> | |
(@_add new Node p, value) for value, p of probabilities |
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
RewriteEngine On | |
# alles, was keine datei ist, auf .html endet und nicht index.html ist... | |
RewriteCond ${REQUEST_FILENAME} !-f | |
RewriteCond ${REQUEST_FILENAME} \.html$ | |
RewriteCond ${REQUEST_FILENAME} !^index\.html$ | |
# ... umschreiben zu /.../ und redirecten | |
RewriteRule ^(.*)\.html$ /$1/ [R=301,QSA,L] | |
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 _queue = []; | |
function enqueue(data, itemProcessor, callback) { | |
for(var i=0, n=data.length; i<n; i++) { | |
(function(item) { | |
_queue.push(function(next) { | |
itemProcessor(item, function() { | |
window.setTimeout(next, 0); | |
}); | |
}); | |
} (data[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
# searches a combination of the given elements that matches toMatch | |
# @param c array - initially empty, carries the current combination throught | |
# the recursion | |
# @param els array - the predefined set of elements | |
# @param toMatch string - the rest-string to be matched with the elements | |
# | |
# @return an array of combinations that recursively match | |
searchCombination = (c, els, rest) -> | |
return c if rest.length==0 |
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
# compute the current git branch, if any | |
ps1_git_extra() { | |
local branch=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/') | |
if [ -z "$branch" ] ; then return ; fi | |
echo -n "[$branch]" | |
} | |
if [ "$color_prompt" = yes ]; then | |
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\[\033[33m\]$(ps1_git_extra)\[\033[00m\]\$ ' |
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
RewriteEngine On | |
RewriteBase / | |
# redirect anything from /common/* to /common/prefix/*, except of course | |
# /common/prefix/* itself (and except eventually existing files). | |
# ... dont rewrite if a file with that name exists | |
RewriteCond %{REQUEST_FILENAME} !-f | |
# ... dont rewrite URIs starting with /common/prefix/ (/foo/common/prefix |
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
/** | |
* Scrolling shadows by @kizmarh and @leaverou | |
* Only works in browsers supporting background-attachment: local; & CSS gradients | |
* Degrades gracefully | |
*/ | |
html { | |
background: white; | |
font: 120% sans-serif; | |
} |
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(global) { | |
var tpl = function(template, data) { | |
var proc = function(data) { | |
var ret = template; | |
for (var k in data) { | |
if (data.hasOwnProperty(k)) { | |
ret = ret.replace('#{'+k+'}', data[k]); | |
} | |
} |
OlderNewer