- fzf
- neovim
- qrcp https://github.com/claudiodangelis/qrcp
- zsh + oh-my-zsh
- httpie
- z
- rg
- fd
- ngrok
- fx https://github.com/antonmedv/fx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fs from 'fs/promises' | |
import satori from 'satori' | |
let html = { | |
type: 'div', | |
props: { | |
style: { | |
height: '100%', | |
width: '100%', | |
display: 'flex', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// a good reference on how react-hooks work https://youtu.be/KJP1E-Y-xyo | |
// Also see brisk reconciler https://github.com/briskml/brisk-reconciler | |
let useTimer() = hook { | |
let! (now, setNow) = useState(0) | |
do! useEffect1 (fun () -> | |
let interval = setInterval 1_000 (fun () -> n+1 |> setNow) | |
fun () -> interval.clear() | |
) [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let add = (a, b) => a + b; | |
// modules with test attribute will be stripped from source in production mode | |
// running `esy test` should find and run all the functions inside test modules | |
[@test] | |
module Test { | |
[@desciption "1 + 1 is equal to 2"] | |
let test_1 = () => { | |
Assert.areEqual(2, add(1, 1)); | |
} |
There are two ways to declare a component in brisk-reconciler:
- By using a normal function
let%component counterButtons = () => {
let%hook (count, setCount) = Hooks.state(0);
<view>
<button title="Decrement" onPress={() => setCount(count => count - 1)} />
<text text={"Counter: " ++ str(count)} />
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# inspired by https://khady.info/opam-npm.html | |
USAGE="A convenience wrapper for opam | |
USAGE: | |
opamx [options] [command] | |
OPTIONS: | |
-h, --help Print help information |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Given a list of sets [set1, set2, set3, ... setn], and a window with start and end such that (end - start) is constant. | |
// What is the fastest way to get all possible aggregates of the sets by moving start and end by 1 each time? | |
// | |
// example: | |
// const data = [set1, set2, set3, set4, set5, set6, set7, set8, set9]; | |
// const windowSize = 4 | |
// const [s, e] = [0, windowSize] | |
// | |
// in this case, our result should be: | |
// const result = [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const gridToLine = (x, y, width, height) => { | |
return (y * width) + x; | |
} | |
const lineTogrid = (a, width, height) => { | |
const x = a % width; | |
const y = a / width; | |
return [x, y] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// .babelrc | |
// {"plugins": [["@babel/plugin-proposal-pipeline-operator", { "proposal": "minimal" }]]} | |
const pipeable = (class_) => new Proxy({}, { | |
get: (target, prop) => ( | |
(prop in class_.prototype) | |
? (...args) => (receiver) => class_.prototype[prop].call(receiver, ...args) | |
: class_[prop].bind(class_) // https://stackoverflow.com/a/30819436/5915221 | |
) | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[derive(Debug)] | |
struct User { | |
name: String, | |
email: String, | |
sign_in_count: u64, | |
active: bool, | |
} | |
impl Default for User { | |
fn default() -> Self { |
NewerOlder