Skip to content

Instantly share code, notes, and snippets.

View dmitriid's full-sized avatar

Dmitrii 'Mamut' Dimandt dmitriid

View GitHub Profile
ПРИПЕВ
- Настоящий хотон(коровник) свеж! Барыта!(Все) Балбахынан!(Навозом) Сыбыллыбыт!(Утрамбовано)
- К хотону(коровнику), липнет еще и кэш! Уонна(И)! Бадаран(ГРЯЗЬ)! Эмиэ(ЕЩЕ)!
- Ароматом он пленит кыыс(ДЕВЧОНОК)! Барыта(ВСЕ)! Ынах(КОРОВАМИ)! Сыта(ПАХНЕТ)!
- Эй, детка давай выпьем кумыс! Одьэ(Ооо)! Ынырык(ОЧЕНЬ)! Минигэс(ВКУСНО)!
*
Мои унты(ТОРБАЗА) блестят, в них даже впускают в Европу(В ЯКУТСКЕ ЕСТЬ ТАКОЙ КЛУБ)
Ну, а в Гэлэкси(НАЗВАНИЕ КЛУБА), мне говорят: «- Иди в жопу»!
@dmitriid
dmitriid / b.erl
Last active August 29, 2015 14:06
%% более читабельно
resolve_family({_,_,_,_}, auto) -> inet;
resolve_family({_,_,_,_,_,_,_,_}, auto) -> inet6;
resolve_family(IP, auto) -> throw({error, {strange_family, IP}});
resolve_family(_, F) -> F.
%% менее читабельно
resolve_family({_,_,_,_}, auto) -> inet;
resolve_family({_,_,_,_,_,_,_,_}, auto) -> inet6;
resolve_family(IP, auto) -> throw({error, {strange_family, IP}});
config defaultToCurrentScreen true
bind g:cmd grid padding:5 0:16,8 1:12,4

Как было

> [1, [2], 3] |> List.flatten

Как стало

>> [1, [2], 3] |> List.flatten()
%% 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.
%%
%% передаем в stack ewgi-контекст и список миддлварей таким оразом:
%%
%% stack(Ctx, [
%% module1,
%% module2,
%% {module3, [Option1, Option2]
%% ])
%%
%% миддлварь должна реализовывать run/2 или run/3 таким образом
-module(beep_web_dispatch).
-export([run/2]).
-include("rberl.hrl").
run({ewgi_context, Request, _} = Ctx, App) ->
PathInfo = string:tokens(ewgi_api:path_info(Ctx), "/"),
Path = list_to_binary(PathInfo),
@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)
*/
%% @author Bob Ippolito <bob@mochimedia.com>
%% @copyright 2007 Mochi Media, Inc.
%% @doc Utilities for parsing multipart/form-data. Shamless rip-off off mochiweb
-module(webmachine_multipart2).
-author('dmitrii@dmitriid.com').
-export([parse_form/1, parse_form/2]).
-export([parse_multipart_request/2]).