Skip to content

Instantly share code, notes, and snippets.

View fwg's full-sized avatar
🐒
I'm a potato.

Friedemann Altrock fwg

🐒
I'm a potato.
View GitHub Profile
@fwg
fwg / currying.js
Last active December 15, 2015 04:50 — forked from puffnfresh/currying.js
function curry(f) {
return function() {
if(arguments.length < f.length)
return curry(f.bind.apply(f, [this].concat([].slice.call(arguments))));
return f.apply(this, arguments);
};
}
var sum = curry(function(x, y) {
return x + y;
@fwg
fwg / testIsArrayOf.js
Created February 1, 2012 17:55 — forked from line-o/testIsArrayOf.js
isArrayOf(array2test, type2match)
var typeUtils =
literals = ['boolean', 'string', 'number', 'object'],
types2test = literals.concat([new RegExp(/asd/), new Number(1), new String('#')]),
testArrays = [
[true, false, true],
[1, 2, 3],
['a', 'b', 'c'],
[/sdf/, /asdf/, /asf/],
[{}, {}, {}],
[new String('a'), new String('b'), new String('c')],
@fwg
fwg / .gitignore
Created January 27, 2012 13:25 — forked from line-o/PS.js
node js module to find a representation for a string with chemical elements
.idea/
*~
*.swp
/*
* Stringverarbeitung.c
*/
#include <stdio.h> // for printf, fgets, stdin
int main() {
printf("String insert:");
char string[100];
fgets(&(string[0]), 100, stdin);
@fwg
fwg / gist:271277
Created January 7, 2010 15:05 — forked from memowe/gist:271270
function drawProgress (factor) {
var progress = $('#progress');
var bar = progress.children('#bar');
var maxwidth = progress.width();
factor = factor > 1 ? 1 : factor < 0 ? 0 : factor;
bar.width( maxwidth * factor );
}
function calculate (params) {
var schwarze = new Array();
@fwg
fwg / cron-test.js
Created November 18, 2009 14:09 — forked from onewland/cron-test.js
use var!!
var cron = require('./cron'), sys = require('sys');
cron.Every((2).seconds(), function() { sys.puts('Working!'); });