Skip to content

Instantly share code, notes, and snippets.

View goloroden's full-sized avatar
💭
The best way to predict the future is to invent it.

Golo Roden goloroden

💭
The best way to predict the future is to invent it.
View GitHub Profile
@goloroden
goloroden / app.js
Last active June 22, 2023 02:10
Async constructors for JavaScript
// In JavaScript, constructors can only be synchronous right now. This makes sense
// from the point of view that a constructor is a function that returns a newly
// initialized object.
//
// On the other hand, it would sometimes be very handy, if one could have async
// constructors, e.g. when a class represents a database connection, and it is
// desired to establish the connection when you create a new instance.
//
// I know that there have been discussions on this on StackOverflow & co., but
// the so-far mentioned counter arguments (such as: doesn't work as expected
@goloroden
goloroden / cla.md
Created May 17, 2017 16:43
Contributor license agreement (CLA) v1

Contributor license agreement (CLA)

This CLA is by and between

the native web GmbH Hauptstraße 8 79359 Riegel am Kaiserstuhl Germany

  • hereinafter referred to as the native web
@goloroden
goloroden / dnn.js
Created August 21, 2016 09:20
A very, very simple neural network (with only 1 neuron ;-))
'use strict';
const input = 0.5;
const expected = 0.8;
let weight = 0.5;
const alpha = 0.1;
const iterations = 100;
for (let i = 0; i < iterations; i++) {
script(id='BoardListTemplate', type='text/x-jQuery-tmpl')
| <p>${Title}</p>
| <ul id="${Id}" class="IterationBoardList">
| <li class="AddNewItem">Add new Item</li>
| {{tmpl(Items) "#BoardListItemTemplate"}}
| </ul>
var middleware = function() {
return function(req, res, next) {
console.log('pre');
next();
console.log('post');
};
};
var connect = require('connect');
var http = require('http');
{
"name": "de.goloroden.www",
"version": "0.0.86",
"engines": {
"node": "0.6.x"
},
"dependencies": {
"express": ">= 2.4.7",
"stylus": ">= 0.0.1",
"jade": ">= 0.0.1",
golo@Eisbaer:~/Projekte/de.goloroden.www/website$ jitsu logs
info: Welcome to Nodejitsu
info: It worked if it ends with Nodejitsu ok
info: Executing command logs app
info: Authenticated as goloroden
data: 2012-01-15T01:29:59.202Z: drone:stderr:Warning: connection.session() MemoryStore is not
data: 2012-01-15T01:29:59.202Z: designed for a production environment, as it will leak
data: 2012-01-15T01:29:59.202Z: memory, and obviously only work within a single process.
data: 2012-01-15T01:29:59.281Z: drone:stderr:
data: 2012-01-15T01:29:59.306Z: drone:stderr:node.js:201
golo@Eisbaer:~/Projekte/de.goloroden.www/website$ jitsu deploy
info: Welcome to Nodejitsu
info: It worked if it ends with Nodejitsu ok
info: Executing command deploy
info: Authenticated as goloroden
info: Analyzing your application dependencies in app.js
warn: Creating new snapshot for version 0.0.82
info: Done creating snapshot 0.0.82
info: Updating application de.goloroden.www
info: Activating snapshot 0.0.82 for de.goloroden.www
golo@Eisbaer:~/Projekte/de.goloroden.www/website$ jitsu deploy
info: Welcome to Nodejitsu
info: It worked if it ends with Nodejitsu ok
info: Executing command deploy
info: Authenticated as goloroden
info: Analyzing your application dependencies in app.js
warn: No application exists for de.goloroden.www
info: Checking app availability de.goloroden.www
info: Creating app de.goloroden.www
warn: Creating new snapshot for version 0.0.64
golo@Eisbaer:~/Projekte/de.goloroden.core/website$ nano package.json
golo@Eisbaer:~/Projekte/de.goloroden.core/website$ jitsu deploy
info: Welcome to Nodejitsu
info: It worked if it ends with Nodejitsu ok
info: Executing command deploy
info: Authenticated as goloroden
info: Analyzing your application dependencies in app.js
warn: Creating new snapshot for version 0.0.24
info: Done creating snapshot 0.0.24
info: Updating application de.goloroden.core