Skip to content

Instantly share code, notes, and snippets.

View humorless's full-sized avatar

Laurence Chen humorless

View GitHub Profile
@humorless
humorless / datomic-helpers.clj
Created March 19, 2021 16:54 — forked from bobby/datomic-helpers.clj
Some Datomic helpers I sometimes use with ring or pedestal-service apps
(ns datomic-helpers
(:require [datomic.api :as d]))
;;; Expose Datomic vars here, for convenience
;;; Ring middleware
(defn wrap-datomic
"A Ring middleware that provides a request-consistent database connection and
value for the life of a request."
@humorless
humorless / integrant.md
Last active February 9, 2021 04:53
Enter Integrant: A Micro-framework for Data-Driven Architecture -> 心得

Integrant 是什麼?解決了什麼問題?

  • integrant 是 micro-framework ,處理類似 component, mount 在處理的問題。

比較競品

componentmount

功能是讓 application 裡頭含有 app state 的部分與 code 分開,可以獨立地重新載入。

@humorless
humorless / checklist.md
Last active June 18, 2021 05:38
The checklist of Clojure beginner learning points
  • editor integration
  1. repl-driven development: evaluation & reload & documentation (Evaluation)
  2. syntax highlight & rainbow parentheses (Readability)
  3. formatter: cljfmt for clj/cljs (Formatting)
  4. linter: clj-kondo (Lint)
  5. s-expression editing: slurp, barf, delete surrounding parentheses, etc. (Editing)
  6. search function references: clojure-lsp (Navigation)
  7. search string in current directory: ack.vim (Navigation)
  8. pprint & data visualization: pprint, inspector (Data Visualization)
@humorless
humorless / transparency-through-data.md
Last active November 27, 2020 06:52
Transparency through Data --- James Reeves
  1. Transparency -> understanding -> prediction

  2. Constraints narrow down possibilities.

    • static types
    • immutability
    • pure function
  3. 以搜尋字串來舉例,看看下列的實作,哪一個比較容易預測?哪一個容易理解?

    • clojure 的實作:不保証程式會停。
    • re-find 的實作:保証一定會停。
  • RE2/J 的實作:會停而且只使用 linear 的時間。
@humorless
humorless / deploy-note.md
Last active August 19, 2021 17:04
第三方 API 整合規格書

Deploy note

  1. git clone $repository
  2. yum install gcc-c++
  3. npm ci
  4. copy correct .env file
  5. pm2 start src/index.js (change the process port and test with admin UI)
  6. db schema migration: user and ecpartner
  7. point web address

web address - point mapping

@humorless
humorless / booking-database-schema.md
Last active October 28, 2020 03:22
訂版表規格書

user table schema

:user/email :user/name :user/status :user/team
string string keyword keyword
unique key/identity

possible status keyword

  1. :user.status/pending
  2. :user.status/active
  3. :user.status/inactive
@humorless
humorless / effective-communications.md
Last active November 27, 2020 07:42
Effective communications

Effective communications

  • Communication -> Effective process -> Results
  • The four principles
  • The tool set
  • The five essential questions

The four principles

  1. Communication is perception
    • It is the recipient who commuicates.
  • It is experience, not logic. One cannot communicate a word; the whole man always comes with it.
@humorless
humorless / debug.html
Last active September 24, 2020 07:14
javascript remote debugging snippet
<html>
<head>
<script>
const mockURL = "http://10.20.30.40:3000"
const UID = "XXXX";
const data = JSON.stringify({
origin: window.location.href,
uid: UID
});
fetch(mockURL, {
@humorless
humorless / knap.clj
Created June 22, 2020 04:23
Debugging & knapsack problem in Clojure
(ns knapsack.core
(:require [clojure.tools.trace :as trace])
(:gen-class))
(defn knap
"The return values of knap is a list of possible knap combination"
[sum coll]
(let [knap* (fn [sum coll left]
(let [knaps (knap (- sum left) (rest coll))]
(map (fn [knap-p]
@humorless
humorless / tmux-cheatsheet.markdown
Created June 4, 2020 08:21 — forked from ryerh/tmux-cheatsheet.markdown
Tmux 快捷键 & 速查表 & 简明教程

注意:本文内容适用于 Tmux 2.3 及以上的版本,但是绝大部分的特性低版本也都适用,鼠标支持、VI 模式、插件管理在低版本可能会与本文不兼容。

Tmux 快捷键 & 速查表 & 简明教程

启动新会话:

tmux [new -s 会话名 -n 窗口名]

恢复会话: