Skip to content

Instantly share code, notes, and snippets.

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

alexander kindziora kindziora

:electron:
coding
View GitHub Profile
@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){}
var a = function () {
this.test1 = function() {
alert('a');
};
return this;
};
@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
@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.

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
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;
@kindziora
kindziora / simplerXHR.js
Last active June 28, 2020 07:32 — forked from sindresorhus/simplexhr.js
Simpler XMLHttpRequest wrapper
var simplerXHR = function( method, url) {
var _xhr = new XMLHttpRequest();
_xhr.open( method, url );
_xhr.setup = function(cb){ // hacky? maybe
cb(_xhr);
return _xhr;
};
_xhr.done = function(cb){ // hacky? maybe
_xhr.onreadystatechange = function() {
if ( _xhr.readyState === 4 ) {
@kindziora
kindziora / download.js
Last active January 19, 2017 18:16
download music from yandex music
function down(uri, name) {console.log(uri,name);
var link = document.createElement("a");
link.download = name;
link.href = uri;
link.click();
}
function links() {
var $tr = $('.page-album__tracks .track_selectable'), l = $tr.length;
var queue = {}, i = 1;
@kindziora
kindziora / fnc-8s.prototxt
Created January 21, 2017 12:26
fnc-8s.prototxt
# data layers
layer {
name: "data"
type: "Data"
top: "data"
include {
phase: TRAIN
}
data_param {
batch_size: 1
@kindziora
kindziora / colors.js
Created January 23, 2017 22:22
colors.js
var cc = ['#804080',
'#800000',
'#808080',
'#0000C0',
'#808000',
'#400080',
'#C0C000',
'#40C000',
'#4080C0',
'#C0C080',