Skip to content

Instantly share code, notes, and snippets.

View kindziora's full-sized avatar
:electron:
coding

alexander kindziora

:electron:
coding
View GitHub Profile
var wrapworker = function (_function, data) {
var wrapr = this;var wrapworker = function (_function, data) {
var wrapr = this;
var mtd = "self.onmessage = function() {postMessage(" + _function.toString().replace('(','du(') + "(" + JSON.stringify(data) + "));};";
blob = new Blob([mtd], { type: 'application/javascript' });
var work = new Worker(URL.createObjectURL(blob));
wrapr.ready = function (cb) { work.onmessage = cb; };
wrapr.error = function (cb) { work.onerror = cb; };
work.postMessage(true);
return wrapr;
Es war einmal ein König,
Der hatt’ einen großen Floh,
Den liebt’ er gar nicht wenig,
Als wie seinen eig’nen Sohn.
Da rief er seinen Schneider,
Der Schneider kam heran;
»Da, miß dem Junker Kleider
Und miß ihm Hosen an!«
In Sammet und in Seide
@kindziora
kindziora / restAPI.markdown
Created April 21, 2016 21:18 — forked from iksose/restAPI.markdown
Creating a REST API using Node.js, Express, and MongoDB

###Creating a REST API using Node.js, Express, and MongoDB

####Installing Node.js

Go to http://nodejs.org, and click the Install button. Run the installer that you just downloaded. When the installer completes, a message indicates that Node was installed at /usr/local/bin/node and npm was installed at /usr/local/bin/npm. At this point node.js is ready to use. Let’s implement the webserver application from the nodejs.org home page. We will use it as a starting point for our project: a RESTful API to access data (retrieve, create, update, delete) in a wine cellar database.

Create a folder named nodecellar anywhere on your file system. In the wincellar folder, create a file named server.js.

@kindziora
kindziora / cache.js
Last active March 18, 2016 17:51
simple javascript caching using localStorage and a time to live (TTL)
var cache = function() {
var store = window.localStorage;
return {
set: function(key, value, ttl){
var time = new Date();
time.setTime(time.getTime() + ttl);
store.setItem(key, JSON.stringify({
ttl: time.getTime(),
content: value
var a = function () {
this.test1 = function() {
alert('a');
};
return this;
};
@kindziora
kindziora / gist:4474805
Last active December 10, 2015 18:29
ideas on a game framework http://jsfiddle.net/pBERS/13/
-Web Audio API
-three.js
-websocket
-indexedDB
var core = function() {
var self = {
'resources' : {
loader : {
load : function(finished){}