Skip to content

Instantly share code, notes, and snippets.

View martinheidegger's full-sized avatar
😅
working

Martin Heidegger martinheidegger

😅
working
View GitHub Profile
@martinheidegger
martinheidegger / nodeticks.js
Last active April 19, 2017 01:17
An explanatory script to illustrate the timings of intervals and the event loop
#!/usr/bin/env node
const foreverTick = (fn) => {
// Note: Using process.nextTick instead of setImmediate will result in an endless loop!
const ticker = () => {
// stopForever is a nice trick for a stoppable forever function
const stopForever = fn()
if (!stopForever) {
setImmediate(ticker)
}

Node.js Stiftung - Stipendium zur Förderung der Vielfalt

Über das Stipendium

Der Node.js Stiftung ist es ein wichtiges Anliegen jeden in die Community einzuschliessen, aus diesem Grund möchten wir uns an Mitglider aus Technologie und Open-Source Gruppen von Minderheiten und Randgruppen richten.

Drei Personen werden eine Förderung erhalten. Entschieden wird auf Basis von Notlage und des Einflusses der Person.

Die Förderung umfasst

@martinheidegger
martinheidegger / leastCommonMultiple.js
Created December 20, 2016 06:28
Calculates the least common multiple of two numbers.
module.exports = (a, b) => {
let ax = a
let bx = b
while (ax != bx) {
if (ax < bx) {
ax += a
} else {
bx += b
}
}
@martinheidegger
martinheidegger / Readme.md
Last active December 6, 2016 05:03
Timing NPM config performance in various node js versions

Timing npm config get prefix in order to test the performance problems of nvm. To run the tests you need to install 4, 5, 6, 7.0, 7.1 and 7.2 version of node with nvm and you should make sure that the correct version of npm is installed for each node version.

(Related to nvm-sh/nvm#1277)

(Note that the output is of the tests run on ubuntu 14.04)

npm verb headers 'x-timer': 'S1471997327.764304,VS0,VE0',
npm verb headers vary: 'Accept-Encoding' }
npm sill get cb [ 304,
npm sill get { date: 'Wed, 24 Aug 2016 00:08:47 GMT',
npm sill get via: '1.1 varnish',
npm sill get 'cache-control': 'max-age=300',
npm sill get etag: '"D1TWGGBHKVVM93XEZWESFLCE4"',
npm sill get age: '245',
npm sill get connection: 'keep-alive',
npm sill get 'x-served-by': 'cache-fra1238-FRA',
@martinheidegger
martinheidegger / test.js
Last active August 5, 2016 13:22
Explaining methods and `this` at the NodeSchool Vienna #3. This is important, yet basic, JavaScript knowledge. With this way of method handling you should be able to understand callbacks more easily.
var method = function (someParam) {
console.log(this.propA + ' ' + someParam)
}
var objA = {
propA: 'foo:',
myMethod: method
}
var objB = {
propA: 'bar:',
@martinheidegger
martinheidegger / internationalization-nodejs.md
Last active September 2, 2019 08:41
Internationalization in Node.js

Internationalization in Node.js

A primer on i18n in Node.js by Martin Heidegger on the night between Dec. 24 and Dec. 25 2015

Many ways lead to the metaphorical rome to achieve i18n and by extension l10n in Node.js. Several packages such as i18next, i18n or node-gettext provide quite accepted implementations for internationalization, yahoo also has pushed the game and published formatjs. But even with those packages at hand i18n can be tricky! Target platform, workflow, human resources, user experience, revisioning - all of that plays an important role when choosing how to setup internationalization for a system. To give a deeper insight in the matter I collected my understanding of i18n in thi

International NodeSchool 2015

[logo]

Let me start by saying how grateful I am to everyone who contributed to this event. From comment to code, your contributions were essential in shaping the success of the day. So: Thank you! Thank you! Thank you!

The International Day was the biggest coordinated effort of NodeSchool so far. Sure, it was rough around many edges but from where I stood it looked like everyone was having a great time.

[photo]

International Nodeschool 2015

[logo]

Let me start by saying how grateful I am to everyone who contributed to this event. From comment to code, your contributions were essential in shaping the success of the day, so thank you, thank you, thank you.

Did everyone have a good time?

From where I was stood it looked like everyone was having a ball.

var os = require("os"),
start = Date.now(),
former;
function sum(times) {
return times.idle + times.user + times.sys;
}
setInterval(function update() {
var now = os.cpus()[0].times;