Skip to content

Instantly share code, notes, and snippets.

@Sinewyk
Sinewyk / example.js
Created June 20, 2015 11:34
No more classes only proxy to functional stuff
/**
* Functional is always better. Keep it simple, just proxy them to classes if you need
* Classes sucks. Try to avoid them.
* Always give a way to use something "class specific" to others
* => don't make it class specific in the first place
* /
function Foo(x) {
this.x = x;
}
var React = require('react');
var Grandparent = React.createClass({
childContextTypes: {
foo: React.PropTypes.string.isRequired
},
getChildContext: function() {
return {
foo: this.props.foo
@Sinewyk
Sinewyk / introrx.md
Created January 24, 2016 17:45 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@Sinewyk
Sinewyk / transformShouldToExpect.js
Created March 15, 2016 16:48
should to expect transform
const printOptions = {
quote: 'single',
trailingComma: true,
};
const SHOULD = 'should';
module.exports = function transform(file, api) {
const source = file.source;
@Sinewyk
Sinewyk / removeArrowFunctionFromMochaTests.js
Last active April 28, 2016 20:49
remove arrow function from mocha tests
const _ = require('underscore');
const printOptions = {
quote: 'single',
trailingComma: true,
};
const mochaFunctions = [
'describe',
'it',
@Sinewyk
Sinewyk / connectToI18n.js
Created March 21, 2016 10:01
from mixin to HoC for i18n
const path = require('path');
const printOptions = {
quote: 'single',
trailingComma: true,
};
const I18N_MIXIN = 'i18nMixin';
const I18N_MIXIN_FILE = 'mixins/i18n';
const CONNECT_TO_I18N = 'connectToI18n';
const log = (scope, item) => () => console.log(`${item} of ${scope}`);
const dummy = () => {};
describe('Outer scope', function() {
before(log(this.title, 'before'));
beforeEach(log(this.title, 'beforeEach'));
afterEach(log(this.title, 'afterEach'));
#!/bin/bash
apt-get update
apt-get install bind9
cat <<EOF > /etc/bind/named.conf.options
options {
directory "/var/cache/bind";
forwarders {
8.8.8.8;
8.8.4.4;
const set = [0, 1, 2];
const retry = n => stream => stream.recoverWith(e => n === 0 ? most.throwError(e) : retry(n - 1, stream));
let i = 0;
most.from(set)
.tap(x => {
if (i === 0 && x === 2)
{
i++;
@Sinewyk
Sinewyk / myBug.js
Last active June 18, 2017 13:30
I'm missing something in how to fix this ...
import { just, iterate } from 'most';
const inputString = 'initial';
just(inputString)
.tap(x => console.log(`my initial string ${x}`))
.chain(() => iterate(x => x + 1, 1))
.tap(x => console.log(`generated chapter url ${x}`))
.take(4) // If I remove this line, I get the requests starting, but then I get stuck in an infinite loop of generated chapters url
.map(x => {