Skip to content

Instantly share code, notes, and snippets.

@lambdaydoty
lambdaydoty / hello.rkt
Created February 11, 2019 03:04
Hello
((lambda (x) x) "hello")
function printString (str) {
setTimeout(
console.log,
Math.floor(Math.random() * 100) + 1,
str
)
}
function printAll () {
printString('A')
const fact0 = t => n =>
(n === 0) ?
1 :
n * t(n - 1)
const fib0 = t => n =>
(n === 0) ?
1 :
(n === 1) ?
@lambdaydoty
lambdaydoty / async-throw.js
Created March 27, 2019 01:55
#async/await #promise #throw #try/catch
async function main () {
async function asyncThrows (id) {
return new Promise((res, rej) => {
console.log(`ASYNC ERROR ${id}`)
throw `ASYNC ERROR ${id}`
})
}
/* sequentially */
// try {
const trace = require('./javascript-trace-prototype-chain')
class Animal {}
class Dog extends Animal {}
class Bichon extends Dog {}
class Foo extends Bichon {}
const foo = new Foo()
console.log(trace(foo))
console.log(trace('abc'))
/*
* https://medium.freecodecamp.org/requiring-modules-in-node-js-everything-you-need-to-know-e7fbd119be8
*
*/
function(exports, require, module, __filename, __dirname) {
// let exports = module.exports;
// Your Code...
return module.exports;
}
const R = require('ramda')
const { equals, T, cond, always, range } = R
/* dispatch by ramda */
function yaff (n) {
return cond([
[equals(0), always(1)],
[equals(1), always(1)],
[T, x => yaff(x - 1) + yaff(x - 2)],
])(n)
@lambdaydoty
lambdaydoty / gist:12a98ca93f4fdb4dd857870f13c9177c
Created October 10, 2019 05:14 — forked from jb55/gist:2253102
Lambda and arrow digraphs in vim
" lambda λ
imap <C-j> <C-k>l*
" right arrow →
imap <C-l> <C-k>->
" left arrow ←
imap <C-h> <C-k><-
" compose ∘
@lambdaydoty
lambdaydoty / ping_btc.sh
Last active December 25, 2019 03:31
bash-heredoc-curl-password
#!/bin/bash
user=
pass=""
host_port=127.0.0.1:8332
echo password...
read -s pass
while true; do

非常時期家庭常備物品清單

  • 編輯時請以四口之家為準,約三個月的存量。實際使用時請列印出來並標註有效日期。
  • 數量先抓一下,再來驗證。

柴米油鹽類

食物

  • 白米 (2kg 真空包) * 10包
  • 每 125g 約二碗飯