Skip to content

Instantly share code, notes, and snippets.

Avatar

Dmitrii 'Mamut' Dimandt dmitriid

View GitHub Profile
View eqc.erl
%% 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
View psc.erl
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 Mar 20, 2020
Makefile: webpack, babel, stylus, eslint
View Makefile
### 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 Aug 31, 2015
Cycle.js. Doing it right?
View experiments.js
/*
* 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)
*/
View .js
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 Sep 11, 2015
Convert svg files to virtual-dom's VTree
View svg-to-virtual-dom.js
/*
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';
View putin.txt
- 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.
View bundle_css.js
/***
* 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');
View lc.md
-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:

View httpcycle.md

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)