Skip to content

Instantly share code, notes, and snippets.

hello
@secwang
secwang / gist:0d332f0e9fce78e8e2f5
Created December 28, 2014 14:39
snippets for subset of list
(defn subsets [things]
(if (empty? things) '(())
(let [srt (subsets (rest things))]
(concat (map #(cons (first things) %) srt) srt))))
(defn redirect
([url] (redirect url :found))
([url type]
{:status (case type
:permanent 301
:found 302
:see-other 303
:not-modified 304
:proxy 305
:temporary 307)

emacs

emacs 是一个简单的文本编辑器,不过它开始于 1976 年。一个软件的生命周期如果超过快 40 年的话,那么它一定是有可取之处的。


basic config

For OS X:

(defprotocol Greet
(sayHello [this]))
(defrecord Person [firstName lastName]
Greet
(sayHello [this] firstName))
(def a (Person. "a" "b"))
(sayHello a)

Rich Hickey on becoming a better developer

Rich Hickey • 3 years ago

Sorry, I have to disagree with the entire premise here.

A wide variety of experiences might lead to well-roundedness, but not to greatness, nor even goodness. By constantly switching from one thing to another you are always reaching above your comfort zone, yes, but doing so by resetting your skill and knowledge level to zero.

Mastery comes from a combination of at least several of the following:

(defn dups [seq]
(for [[id freq] (frequencies seq)
:when (> freq 1)]
id))
@secwang
secwang / gist:4c79d2a8e7fbf3296575
Created March 23, 2015 03:06
a list of tuple to hash map
user=> (into {} [[:a 1] [:b 2]])
@secwang
secwang / System Design.md
Created April 21, 2016 08:19 — forked from vasanthk/System Design.md
System Design Cheatsheet

#System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

##Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@secwang
secwang / markdownhere.css
Last active July 22, 2016 05:05 — forked from xiaolai/markdownhere.css
markdown-here-css
.markdown-here-wrapper {
font-size: 16px;
line-height: 1.8em;
letter-spacing: 0.1em;
}
pre, code {
font-size: 14px;
font-family: Roboto, 'Courier New', Consolas, Inconsolata, Courier, monospace;