Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View medikoo's full-sized avatar

Mariusz Nowak medikoo

View GitHub Profile
@medikoo
medikoo / stacks-map.js
Last active October 30, 2017 13:31
Serverless: Nested stacks per function
'use strict';
const memoize = require('memoizee');
const namingUtils = require('serverless/lib/plugins/aws/lib/naming');
const getApiGatewayResourceMap = memoize(serverless => {
// AwsCompileApigEvents plugin provides access to data maps and methods
// that allow to easily map generated resources to lambdas
const apiGatewayPlugin = serverless.pluginManager.plugins.find(
plugin => plugin.constructor.name === 'AwsCompileApigEvents'
// Lazy (=on-demand) zip()
for (const [i, x] of zip(naturalNumbers(), naturalNumbers())) {
console.log(i, x);
if (i >= 2) break;
}
// Output:
// 0 0
// 1 1
// 2 2
console.log("1. zip");
for (const [i, x] of zip(naturalNumbers(), naturalNumbers())) {
console.log(i, x);
}
console.log("2. Array.from");
Array.from(naturalNumbers(), function (x, i) {
console.log(i, x);
});
@medikoo
medikoo / cjs-module.js
Last active February 17, 2017 09:17
ES modules in Node.js (basic idea)
// Import CJS module
const otherCJSModule = require('./other-cjs-module');
// Import ES module, relying on upcoming standard
import('./es-module').then(function (esModule) {
...
});
// Import core module
const fs = require('fs');
['foo', 'bar', 'lorem'].some(function (val) { return obj.x === val; });
obj.getDescriptor('x').type.oneOf(obj.x, ['foo', 'bar', 'lorem']);
this.database.oneOf(obj.x, ['foo', 'bar', 'lorem']);
(new Set(['foo', 'bar', 'lorem'])).has(obj.x);
({ foo: true, bar: true, lorem: true })[obj.x];
var memoized = memoize(fuction (arg, options) {
...
}, { normalizer: function (args) {
return [args[0], args[1].opt1, args[1].opt2].join('\0');
} }

Programista/Programistka JavaScript

Do zespołu konsultantów pracujących bezpośrednio dla UNCTAD (organ ONZ) poszukujemy programisty/programistki JavaScript (HTML5 + Node.js)

Zajmujemy się tworzeniem aplikacji, których długofalowym celem jest zmniejszenie szarej strefy w krajach rozwijających się, a konkretniej umożliwienie obywatelom rejestracji różnego rodzaju działalności przez internet.

Realizujemy projekty z wykorzystaniem najnowszych otwartych technologii (full-stack JavaScript, bazowany na ECMAScript 5 oraz implementowalnych w ES5 funkcjonalnościach z najnowszego standardu ES). Pracujemy na in house'owym, modularnym stack’u, bazującym na dziesiątkach niezależnych, stale rozwijanych modułach, w większości opublikowanych na npm’ie. Dajemy możliwość upubliczniania generycznej części pracy na Github'ie lub podobnych serwisach.

Jeżeli lubisz JavaScript, lubisz dyskutować o rozwoju języka, omawiać ciekawe algorytmiczne problemy, i przede wszystkim chcesz się rozwijać jako programista JavaScript, to

@medikoo
medikoo / index.js
Last active August 29, 2015 14:13
Test two lru-queue solutions
'use strict';
var LruQueue = require('lru-queue')
, SnowyuLruQueue = require('./snowyu-lru-queue')
, now = Date.now;
var getMemoize = function (LruQueue) {
return function (fn) {
var cache = {}, queue = new LruQueue(1000);
var not = function (fn) {
return function () {
return !fn.apply(this, arguments);
};
};
var getIncremenentIfTrue = function (fn) {
return function (count, predicate) {
if (fn(predicate)) ++count;
return count;
};
@medikoo
medikoo / populator.js
Created October 8, 2014 09:53
Populator
var generateObject, generateSection, generateProperty, serialize;
serialize = function (id, value, stamp) {
// Add to updates
};
generateObject = function (meta/*, options*/) {
var id = genId(), options = Object(arguments[1])
, stamp = options.stamp ? options.stamp : now();