Common Tools for development in Mac
- version
xcode-select --version
// xcode-select version 2392.- Install
| # ini membutuhkan direnv | |
| # maka install juga direnv | |
| # agar .envrc dapat dijalankan | |
| # isi dari .envrc adalah | |
| use nix |
| window: | |
| dimensions: | |
| columns: 0 | |
| lines: 0 | |
| padding: | |
| x: 0 | |
| y: 0 | |
| dynamic_padding: false |
| use flake |
| // we write Maybe module (stolen from haskell) | |
| module Maybe = { | |
| type t<'a> = | |
| | Just('a) | |
| | Nothing | |
| let fmap = (x, fn) => | |
| switch x { | |
| | Just(x) => Just(x->fn) | |
| | Nothing => Nothing |
| const add = (a, b) => a + b | |
| const adds = (...n) => n.reduce(add) | |
| const mul = (a, b) => a * b | |
| const muls = (...n) => n.reduce(mul) | |
| const div = (a, b) => a / b | |
| const divs = (...n) => n.reduce(div) | |
| const mod = (a, b) => a % b |
| /** | |
| * @param {Number} n | |
| * @return {Number} | |
| * @example | |
| * | |
| * reverseNumber(123) // 321 | |
| * reverseNumber(212) // 212 | |
| * reverseNumber(123456789) // 987654321 | |
| */ | |
| const reverseNumber = (input) => { |
| use nix |
| // HEY TAYO HEY TAYO DIA SI FUNGSI NAKAL MELAJU MENGHAJAR | |
| // basic operation {a + b} {a - b} as function | |
| let add = (a, b) => a + b; | |
| let sub = (a, b) => a - b; | |
| // function for add one {a + 1} | |
| let addOne = (b) => add(1, b); | |
| // function for reverse value by length that defined as {a} | |
| // and solve with Math | |
| let reverse = (a, b) => addOne(sub(a, b)); | |
| // function for know the maximum value of numbers |
| /** | |
| * Example `FizzBuzz` with JavaScript (Pattern-Matching Like????????????) λ_(ツ)_/¯ | |
| * I Love this tweet | |
| * @see https://twitter.com/cajuinaoverflow/status/1395022027204005889 | |
| * JavaScript will make You Crazy (Trust Me!) | |
| */ | |
| const FizzBuzz = n => ({ | |
| true: n, | |
| [ n % 5 === 0]: "Buzz", | |
| [ n % 3 === 0]: "Fizz", |