Skip to content

Instantly share code, notes, and snippets.

View dmitriid's full-sized avatar

Dmitrii 'Mamut' Dimandt dmitriid

View GitHub Profile
%% Original property, based on docs
prop_seq() ->
?FORALL({From, To, Incr}
, {int(), int(), int()}
, begin
try
%% According to docs
length(lists:seq(From, To, Incr)) == (To - From + Incr) div Incr
catch
do(...) ->
case req(...) of
{no_response, timeout} -> {error, "Timeout"};
end.
req(...) ->
case ltthpc:request(... ) of
{error, timeout} -> {no_response, timeout};
end.
@dmitriid
dmitriid / Makefile
Last active May 26, 2022 08:05
Makefile: webpack, babel, stylus, eslint
### Makefile to be used when compiling assets for Event Manager
### Based on ideas from https://github.com/acdlite/the-react-way/blob/master/Makefile
###
### Requirements/assumptions of this Makefile:
### JS
### - webpack (include json and css loaders to webpack cofig just in case)
### - babel
### - eslint (eslint-plugin-react if you want more lints of your react code)
### - eslint-watch (broken until 2.0.0: https://github.com/rizowski/eslint-watch/issues/8)
### CSS
@dmitriid
dmitriid / experiments.js
Last active August 31, 2015 14:33
Cycle.js. Doing it right?
/*
* This is a simple example taken to extremes (MVI everywhere :) )
*
* - Display N div's containing checkboxes
* - When a checkbox is clicked:
* - a checked checkbox is rendered as checked
- checkbox's label reads "Unchecked" or "Checked"
- the parent div's background changes based on the
status of the checkbox (red for unchecked, green for checked)
*/
@dmitriid
dmitriid / .js
Created September 4, 2015 13:20
return _react2['default'].createElement(
'div',
{ className: 'menu' },
_react2['default'].createElement(
'div',
{ className: 'venue-select ' },
_react2['default'].createElement(
'div',
{ className: 'venue-name' },
_react2['default'].createElement(
@dmitriid
dmitriid / svg-to-virtual-dom.js
Created September 11, 2015 10:30
Convert svg files to virtual-dom's VTree
/*
Convert svg files to virtual-dom's VTree
To use the resulting tree
import svg from 'virtual-dom/virtual-hyperscript/svg'
if you use Cycle.js:
import {svg} from '@cycle/dom';
*/
import fs from 'fs';
@dmitriid
dmitriid / putin.txt
Created September 29, 2015 07:09
putin answers
- Vladimir Vladimirovich, what is two times two?
- I'll be brief. You know, just the other day I was at the Russian Academy of Sciences
and had a discussion with many scientists there, including young scientists,
all of them very bright, by the way. As it happens, we touched upon the present problem,
discussed the current state of the country's economy; they also descibed their plans
for the future. Of course, the number one priority for them is the problem of relevancy;
also, just as important is the question of housing loans, but I can assure you that all
these problems can be solved and we will direct all our efforts to their resolution in
the nearest future.
Among other things this also applies to the subject you raised in your question.
/***
* Compile *.styl files to css.css:
* node build_css.js
*
* Watch *.styl files and compile them to css.css:
* node build_css.js -w
*/
var chokidar = require('chokidar');
var stylus = require('stylus');
-module(lc).

-export([lc/0]).

lc() ->
 [{X, Y} || X <- lists:seq(1, 5), Y <- lists:seq(1, 5), X rem 2 == 0, Y rem 2 == 1 ].

core:

The answer: it should've been .merge in button's model, not .combineLatest. Obviously

Intended behaviour:

  • click the button
  • while the request is sent, display 'Loading...'
  • when the response is received, display original button
  • there are random color changes when the button is clicked (just to see that everything works)