Skip to content

Instantly share code, notes, and snippets.

View AZaviruha's full-sized avatar

Alexei Zaviruha AZaviruha

  • Nikolaev, Ukraine
View GitHub Profile
@AZaviruha
AZaviruha / promise-monad-proof.js
Created January 22, 2017 19:14 — forked from briancavalier/promise-monad-proof.js
A proof that Promises/A is a Monad
//-------------------------------------------------------------
//
// Hypothesis:
//
// Promises/A is a Monad
//
// To be a Monad, it must provide at least:
// - A unit (aka return or mreturn) operation that creates a corresponding
// monadic value from a non-monadic value.
// - A bind operation that applies a function to a monadic value
@AZaviruha
AZaviruha / interp_identity.hs
Last active January 26, 2017 19:20
Wadler's interpreter for Identity monad
module Main where
import Lib
main :: IO ()
main = putStrLn "Monad Interpreter v0.1"
-- >> putStrLn ("Demo term: \"" ++ (show term0) ++ "\"")
-- >> putStrLn ("Result: " ++ (test term0))
>> putStrLn "-------------------------------------"
>> putStrLn "Input test term:"
@AZaviruha
AZaviruha / interp_errors.hs
Created January 27, 2017 11:14
Wadler's interpreter for Either monad
module Main where
import Lib
main :: IO ()
main = putStrLn "Monad Interpreter v0.2"
>> putStrLn "-------------------------------------"
>> putStrLn "Input test term:"
>> getLine >>= putStrLn . test . (read :: String -> Term)
>> return ()
@AZaviruha
AZaviruha / curl.md
Created April 8, 2017 15:21 — forked from btoone/curl.md
A curl tutorial using GitHub's API

Introduction

An introduction to curl using GitHub's API.

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin
@AZaviruha
AZaviruha / README.md
Created May 25, 2017 17:40 — forked from joyrexus/README.md
curl tutorial

An introduction to curl using GitHub's API.

Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin

Includes HTTP-Header information in the output

@AZaviruha
AZaviruha / anki_mch_backside.html
Last active June 28, 2017 05:42
Anki multiple checkboxes example (backside)
{{FrontSide}}
<script language="javascript">
(function () {
/**
* Rendering all variants, in disabled state
*/
var elems = document.querySelectorAll('#splitted-question input[type="checkbox"]');
for (var i = 0, len = elems.length; i < len; i++) {
@AZaviruha
AZaviruha / anki_mch_frontside.html
Created June 28, 2017 05:46
Anki multiple checkboxes example (frontside)
<div class="question-text">{{Question}}</div>
<div class="all-variants to-split">{{AllVariants}}</div>
<div id="splitted-question"></div>
<script language="javascript">
var FB_DB_NAME = '...';
// Renders possible answer variants.
@AZaviruha
AZaviruha / anki_mch_styles.css
Created June 28, 2017 06:31
Anki multiple checkboxes example (styles)
.card {
font-family: arial;
font-size: 20px;
text-align: center;
color: black;
background-color: #EEDFA6;
}
.question-text{
text-align: left
@AZaviruha
AZaviruha / anki_mch_fbase_rules.json
Created June 28, 2017 06:46
Anki multiple checkboxes example (Firebase rules)
{
"rules": {
".read": true,
".write": true
}
}
@AZaviruha
AZaviruha / Main.elm
Created July 25, 2017 12:06 — forked from mdemin914/Main.elm
example of fetching data with elm and remote data
module Main exposing (..)
import RemoteData exposing (WebData, RemoteData(..), asCmd, fromTask)
import Html exposing (Html, text, div, input, br)
import Html.Events exposing (onClick)
import Html.Attributes exposing (type_, value)
import Http exposing (get, toTask)
import Json.Decode exposing (Decoder, string)
import Json.Decode.Pipeline exposing (decode, required)
import Random exposing (int, generate)