Skip to content

Instantly share code, notes, and snippets.

@melbourne2991
melbourne2991 / gist:082609f3b51933c4bc1de1c3091ee319
Created January 4, 2019 13:41
Add reason-cli to path (nvm/yarn)
# Add reason utils to path
export PATH=$PATH:"$HOME/.config/yarn/global/node_modules/reason-cli/bin"
@melbourne2991
melbourne2991 / Rex.re
Last active August 5, 2020 08:51
ReasonML Observables Implementation
type observer('a, 'e) = {
.
next: 'a => unit,
complete: unit => unit,
error: 'e => unit,
};
type subscription = {
.
unsubscribe: unit => unit
@melbourne2991
melbourne2991 / into_iter.rs
Created November 17, 2018 12:37
into_iter implementation
impl<R: Iterator<Item = Result<u8, Error>>> IntoIterator for Lexer<R> {
type Item = Token;
type IntoIter = LexerIterator<R>;
fn into_iter(self) -> Self::IntoIter {
LexerIterator { lexer: self }
}
}
pub struct LexerIterator<R> {
@melbourne2991
melbourne2991 / git-ssh-key-setup.md
Last active January 3, 2019 11:45
Git SSH Key Setup
  1. Generate a key in ~/.ssh with ssh-keygen
  2. Go to gitlab/github and add the public key.
  3. Update or add the ~/.ssh/config file with:
Host gitlab.com:username
  IdentityFile /home/user/.ssh/gitlab

Host github.com:username
@melbourne2991
melbourne2991 / funwithclojure.clj
Created October 26, 2018 05:29
Clojure stuff
(def grid (atom [
[0 0 0]
[0 0 0]
[0 0 0]
]))
(defn update-grid [row-index col-index val]
(swap! grid assoc-in [row-index col-index] val))
(defn full-row? [row]
@melbourne2991
melbourne2991 / cljs-setup.md
Created October 19, 2018 11:57
clojurescript setup
const addNode = <NDS extends INodeDefinitions, K extends keyof NDS>(
definition: K
) => R.over(nodesLens, R.append(createNode<NDS, K>(definition)));
// @flow
import * as R from "ramda";
import { Observable, BehaviorSubject, Subject, empty, of, merge } from "rxjs";
import {
scan,
tap,
share,
startWith,
mergeMap,
@melbourne2991
melbourne2991 / qrscan.sh
Created September 24, 2018 05:37
QR Code Screen Scanner
#!/usr/bin/env bash
# Usage:
# brew install zbar
# run qrscan.sh, drag over qr code.
cd /tmp/
screencapture -i zbarscreen.png
zbarimg -q ./zbarscreen.png || echo "No barcode found."
rm zbarscreen.png
// in current branch
git rebase feature