Skip to content

Instantly share code, notes, and snippets.

@kinsteronline
kinsteronline / ultimate-ut-cheat-sheet.md
Created January 30, 2022 13:00 — forked from yoavniran/ultimate-ut-cheat-sheet.md
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai, Sinon, and Jest
  1. Create an app following the official Shadow-CLJS Quick Start instructions.
  2. Modify shadow-cljs.edn
;; shadow-cljs configuration
{:source-paths
 ["src/dev"
  "src/main"
  "src/test"]

 ;; ADD - CIDER middleware for nREPL (required by fireplace.vim)
@kinsteronline
kinsteronline / ohai.js
Created August 13, 2019 21:28
Checking out QuickJS
/*
* qjsc -fno-eval -m -o ohai ohai.js
*/
"use strict";
"use math";
import * as std from "std"
import * as os from "os"
// dl'd from gh for local use
@kinsteronline
kinsteronline / simple-addition.js
Created February 23, 2017 12:46
Simple Addition
//
// it all adds up *whomp whomp*
//
const add = function (a, b) {
return a + b
}
const add10 = x => add(10, x)
const add100 = add.bind(null, 100)
@kinsteronline
kinsteronline / sum.js
Created October 10, 2014 15:29
Sum it up more modern style?
export function sum(...a) {
function loop(arr, total = 0) {
if (arr.length === 0) return total;
else return loop(arr.slice(1), total + arr[0]);
}
return loop(a);
}

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called (Functional) Reactive Programming (FRP).

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

#!/bin/bash
#
# Report time to first byte for the provided URL using a cache buster to ensure
# that we're measuring full cold-cache performance
while (($#)); do
echo $1
curl -so /dev/null -H "Pragma: no-cache" -H "Cache-Control: no-cache" \
-w "%{http_code}\tPre-Transfer: %{time_pretransfer}\tStart Transfer: %{time_starttransfer}\tTotal: %{time_total}\tSize: %{size_download}\n" \
"$1?`date +%s`"
@kinsteronline
kinsteronline / gist:11231760
Created April 23, 2014 20:45
Pick what you need from a hash
warrior = { str: 17, int: 8, dex: 12, con: 16, luk: 10 }
strength, dexterity, luck = warrior.values_at(:str, :dex, :luk)
to_hit = strength ...
@kinsteronline
kinsteronline / gist:11193608
Created April 22, 2014 20:43
Gambler Struct
#
# I like to gamble
#
Gambler = Struct.new(:nick, :chip_count) do
def to_s
"#{nick}: Ð #{chip_count}"
end
end
@kinsteronline
kinsteronline / .muttrc
Last active August 29, 2015 13:56 — forked from jaysonrowe/.muttrc
#
# http://www.mutt.org/doc/manual.txt
#
# basic .muttrc for use with Gmail
# Change the following six lines to match your Gmail account details
set imap_user = "username@gmail.com"
set imap_pass = ""
set smtp_url = "smtp://username@smtp.gmail.com:587/"