Skip to content

Instantly share code, notes, and snippets.

View axilleasiv's full-sized avatar

Achilleas Kiritsakas axilleasiv

View GitHub Profile
@axilleasiv
axilleasiv / piping-experiments.js
Created July 7, 2020 20:41 — forked from ducaale/piping-experiments.js
Using ES6 Proxies to turn methods into pipe friendly functions
// .babelrc
// {"plugins": [["@babel/plugin-proposal-pipeline-operator", { "proposal": "minimal" }]]}
const pipeable = (class_) => new Proxy({}, {
get: (target, prop) => (
(prop in class_.prototype)
? (...args) => (receiver) => class_.prototype[prop].call(receiver, ...args)
: class_[prop].bind(class_) // https://stackoverflow.com/a/30819436/5915221
)
});
@axilleasiv
axilleasiv / example.js
Created April 18, 2020 10:34 — forked from staltz/example.js
Build your own RxJS
function createObservable(subscribe) {
return {
subscribe,
pipe: function(operator) {
return operator(this);
},
};
}
const numberObservable = createObservable(function(observer) {
@axilleasiv
axilleasiv / plink-plonk.js
Created February 15, 2020 10:27 — forked from tomhicks/plink-plonk.js
Listen to your web pages
@axilleasiv
axilleasiv / better-nodejs-require-paths.md
Created February 23, 2019 01:42 — forked from branneman/better-nodejs-require-paths.md
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@axilleasiv
axilleasiv / 0_reuse_code.js
Created March 27, 2017 23:03
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console