Skip to content

Instantly share code, notes, and snippets.

View zeckson's full-sized avatar

Eugene Shchepotev zeckson

View GitHub Profile
@zeckson
zeckson / eslint-process-exit.js
Created October 6, 2016 11:59
Зачем нужно правило ESLint process-exit
// На просторах интернетов нашел такой паттерн с `exit`:
// 1. В сабмодулях не используется `exit`, чтобы избежать проблем с отладкой и пониманием и т.д. и т.п.
// 2. В сабмодулях если надо кидается exception `throw new Error('Все пропало, шеф!')`
// 3. exit разрешен только во входной точке
// Входная точка должна выглядеть как-то так:
var subModule = require('sub-module');
var exit = process.exit;
@zeckson
zeckson / eventloop.js
Created March 29, 2017 11:23
Test of event loop
var begin = function(i) {
console.log(i + 'this is the start');
setTimeout(function cb() {
console.log(i + 'this is a msg from call back');
});
console.log(i + 'this is just a message');
@zeckson
zeckson / light.js
Created June 5, 2017 09:02
Controls yeelight WiFi
var Yeelight = require('node-yeelight');
var y = new Yeelight;
y.on('ready', function() {
y.discover(); // scan network for active Yeelights
console.log('discover');
});
y.listen();
@zeckson
zeckson / loaded.txt
Created February 17, 2018 13:50
MD loaded file
# JAVASCRIPTING
## __INTRODUCTION__ (_Exercise 1 of 19_)
To keep things organized, let's create a folder for this workshop.
Run this command to make a directory called `javascripting` (or something else if you like):
```bash
export const myObject = {one: `two`};
export const myNumber = 42;
export const myBoolean = true;
export default () => console.log(`Exported arrow-function`);