Skip to content

Instantly share code, notes, and snippets.

View dmitriid's full-sized avatar

Dmitrii 'Mamut' Dimandt dmitriid

View GitHub Profile
get_status_url_prop() ->
?FORALL( {Username, Lower}
, gen_username()
, <<"profiles/", Lower/binary ,"/data/status.json">> == util_content:get_status_url(Username)
).
gen_username() ->
?LET( Username
, list(char())
, begin
$ brew outdated
caskroom/cask/brew-cask (0.54.1 < 0.60.1)
cask (0.7.2 < 0.7.4)
elixir (1.0.5, 1.1.1 < 1.2.0)
erlang (17.5, 18.1 < 18.2.1)
ffmpeg (2.6.2 < 2.8.4)
gettext (0.19.4, 0.19.6 < 0.19.7)
ghc (7.10.2 < 7.10.3b)
glib (2.44.0, 2.46.0 < 2.46.2)
gmp (6.0.0a < 6.1.0)
@dmitriid
dmitriid / j.c
Last active January 15, 2016 09:46
A jtjgets(J jt,C*p){A y;B b;C*v;I j,k,m,n;UC*s;
*jt->adbreak=0;
if(b=1==*p)p=""; /* 1 means literal input */
if(jt->dcs){
++jt->dcs->dcn; j=jt->dcs->dci;
y=jt->dcs->dcy; n=AN(y); s=UAV(y);
RZ(j<n);
jt->dcs->dcj=k=j;
jt->dcs->dci=j=advl(j,n,s);
m=j-k; if(m&&32>s[k+m-1])--m; if(m&&32>s[k+m-1])--m;
///////////
// main.js
///////////
import Rx from 'rx';
import {h} from '@cycle/dom';
const main = (sources) => {
const HELLO_URL = 'https://something/api/v2/or-other/26';
const request$ = Rx.Observable.just(HELLO_URL);
@dmitriid
dmitriid / api.ex
Created February 24, 2016 09:17
A bright and glorious vision of da future!
# Plugins
#
# Плагину достаточно выставить наружу command, принимающую context
#
# Где context — это
# %{ :scope => :jabber, # или там :slack или там :icq
# :from => ...,
# :to => ...,
# :room => ...
# }
@dmitriid
dmitriid / slax.md
Last active February 25, 2016 14:46
Auto screenshot uploader w/Elixir

Running

> ies -S mix
elixir> Slax.Monitor start

Source

##mix.exs

// @mariuslundgard
// The component
import {pluckSwitch} from './stream-helpers'
function main (sources) {
const sinks$ = NodeComponent({...sources})
// etc.
return {
DOM: pluckSwitch('DOM', sinks$),

The problem concerns the following: How to properly isolate components in lists, and work with events from those components?

Problem description:

  • retrieve a list of objects (called events) from the server
  • create and display a list of these events
  • each event display has a "Sign up" button. When clicking this button we should produce a reaction to the corresponding event

Given the code below:

  • The HTTP request is for some reason performed twice (should happen only once, on startup).
@dmitriid
dmitriid / closure-compiler.md
Last active November 12, 2016 16:48
Why I'm not using Google's closure compiler

The question

tl;dr: Closure compiler makes little to no sense outside of Google's ecosystem.

Nolan Lawson conducted a very nice research on how various Javasctip tools bundle/compile Javascript. I highly recommend it: The cost of small modules.

This article has made several rounds on Twitter and many people have asked: Why aren't more people using Closure? There are many reasons for that.

Considering the dire state of Javascript tools today, Google's Closure compiler is yet another cryptic, badly configured, half-baked tool to throw into the ever-groing pile of twigs and sticks called Javascript infrastructure.

/*
* No hyperscript helpers
*/
import { h } from '../../snabbdom.wrapper'
import UserStore from '../../stores/UserStore'
import Link from '../components/Link'
import Form from '../components/Form'