Skip to content

Instantly share code, notes, and snippets.

@outbreak
outbreak / channels.json
Last active February 1, 2021 08:34
Radio streams
[
{
"title": "161 FM",
"url": "http://stream.161fm.ru:8000/256"
},
{
"title": "Deep (DFM)",
"url": "https://dfm-dfmdeep.hostingradio.ru/dfmdeep96.aacp"
},
{
@outbreak
outbreak / index.js
Last active February 13, 2019 05:08
Debug effects and events for effector (https://github.com/zerobias/effector)
import {
createDomain
} from 'effector'
import useDomainLogger from './useDomainLogger.js'
const DEBUG = true
const app = createDomain('app')

Keybase proof

I hereby claim:

  • I am outbreak on github.
  • I am outbreak (https://keybase.io/outbreak) on keybase.
  • I have a public key ASBWjPWuq3cGqRo6ZtOGmaCzutjlvF2uakytSe5UC8peego

To claim this, I am signing this object:

@outbreak
outbreak / lens.js
Last active July 31, 2018 11:28
Functional Lenses (Van Laarhoven)
// Combinators
const K = a => b => a
const I = a => a
// Operators
const eq = a => b => a === b
// Types
const typeOf = a => typeof a
const isArray = a => Array.isArray(a)
@outbreak
outbreak / lens.js
Last active June 9, 2020 11:13
Functional Lenses
// Operators
const eq = (a) => (b) => a === b
// Types
const typeOf = (a) => typeof a
const isArray = (a) => Array.isArray(a)
const isUndefined = (a) => eq('undefined')(typeOf(a))
// Lists
const reverse = (xs) => xs.reverse()
// addTo :: HTML, HTML -> HTML
function addTo(container, html) {
$(container).append(html)
return container
}
// addAllTo :: HTML, [HTML] -> HTML
function addAllTo(container, htmls) {
htmls.map(function(html){ addTo(container, html) })
return container
@outbreak
outbreak / observer.js
Created December 20, 2016 04:14
Javascript Observer pattern
function Event() {
this.observers = [];
}
Event.prototype.raise = function (data) {
for (var i in this.observers) {
var item = this.observers[i];
item.observer.call(item.context, data);
}
};
@outbreak
outbreak / dispatcher.js
Last active March 30, 2018 08:07
Dispatcher pub/sub pattern
var Dispatcher = (function() {
var instance
var subscribers
var reset = function () {
subscribers = {}
}
var unsubscribe = function (type, handler, context) {
context = context || null
@outbreak
outbreak / uuid.js
Created October 25, 2016 17:39
UUID v4 JavaScript implementation with window.crypto.getRandomValues()
function uuid () {
function getRandomSymbol (symbol) {
var array;
if (symbol === 'y') {
array = ['8', '9', 'a', 'b'];
return array[Math.floor(Math.random() * array.length)];
}
array = new Uint8Array(1);