Skip to content

Instantly share code, notes, and snippets.

View humorless's full-sized avatar

Laurence Chen humorless

View GitHub Profile
@humorless
humorless / emacs.md
Last active October 14, 2021 06:35
project quality control

invoke function

SPC SPC = M-x
- load-theme
- add-project
- global-linum-mode

special commands

@humorless
humorless / melvn.yaml
Last active September 28, 2021 14:09
The tmuxp config file for melvn
session_name: melvn
start_directory: ~/clo/runeleven
environment:
RUNELEVEN_DIR: /Users/laurence/clo/runeleven
windows:
- window_name: one-repl
panes:
@humorless
humorless / core.clj
Created September 15, 2021 03:19 — forked from plexus/core.clj
(ns my-backend.core
(:gen-class)
(:require [compojure.core :as c]
[compojure.route :as route]
[ring.adapter.jetty :as jetty]
[ring.middleware.defaults :as ring-defaults]
[hiccup2.core :as h]
#_[muuntaja.core :as m]
[muuntaja.middleware :as muuntaja]))
@humorless
humorless / my-solution.csv
Last active July 10, 2021 17:16
The sitemap can be used with https://www.webscraper.io to scrape your 4clojure.com answers
web-scraper-order web-scraper-start-url code
1625935994-72 https://www.4clojure.com/problem/71 1  last
1625936020-84 https://www.4clojure.com/problem/59 123  (fn gg [& f] (fn [& coll] (vec (map #(apply % coll) f))))
1625936081-105 https://www.4clojure.com/problem/32 12345  (fn t [[x & args]] (if (empty? args) (list x x) (cons x (cons x (t args)))))
1625935881-29 https://www.4clojure.com/problem/121 1
1625935861-20 https://www.4clojure.com/problem/130 1
1625935897-36 https://www.4clojure.com/problem/114 1
1625935899-37 https://www.4clojure.com/problem/113 1
1625935906-40 https://www.4clojure.com/problem/110 1
1625935991-71 https://www.4clojure.com/problem/72 1  reduce +
@humorless
humorless / how-to-write-comments.md
Last active June 2, 2021 08:39
Some Clojure ideas

There are three important comments:

  1. Horizonal comments
  2. doc string comment
  3. FIXME

Horizontal comments

Horizonal comment splits a namespace into sub sections

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Connection
@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