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 / anki_mch_fbase_rules.json
Created June 28, 2017 06:46
Anki multiple checkboxes example (Firebase rules)
{
"rules": {
".read": true,
".write": true
}
}
@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_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_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 / 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 / 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 / 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 / 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 / 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 / nginx-tuning.md
Created January 17, 2017 14:45 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.