Skip to content

Instantly share code, notes, and snippets.

View littleli's full-sized avatar

Aleš Najmann littleli

View GitHub Profile
(fn [input]
(if (coll? input)
(= input (reverse input))
(= input (clojure.string/join "" (reverse input)))))
(fn [num]
(take num (map first (iterate (fn [[a b]] [b (+' a b)]) [1 1]))))
(fn [coll]
(reduce conj '() coll))
;; Count a sequence
(fn [coll]
(reduce (fn [c _] (inc c)) 0 coll))
@littleli
littleli / truffle-material.md
Created December 28, 2017 16:39 — forked from smarr/truffle-material.md
Truffle: Languages and Material
@littleli
littleli / bicycle.ts
Last active May 17, 2017 23:09
Bicycle
class Bicycle {
constructor(public cadence: number, private _speed: number, public gear: number) {}
speed = this._speed
applyBrake = (decrement: number) => this._speed -= decrement
sppedUp = (increment: number) => this._speed += increment
toString = () => `Bicycle: ${this._speed} mph`
@littleli
littleli / README.md
Created January 24, 2017 00:39 — forked from polbins/README.md
Android Studio as default Git Diff Tool

Create Android Studio Command-line Launcher

  1. Open Android Studio
  2. Go to: Tools > Create Command-line Launcher
  3. Leave as default, Press OK

Configure Git to use Android Studio as default Diff Tool

  1. Add the following lines to your .gitconfig
@littleli
littleli / latency.txt
Created November 28, 2016 09:14 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@littleli
littleli / promises-reading-list.md
Created September 23, 2016 15:28 — forked from joepie91/promises-reading-list.md
Promises (Bluebird) reading list

Promises reading list

This is a list of examples and articles, in roughly the order you should follow them, to show and explain how promises work and why you should use them. I'll probably add more things to this list over time.

This list primarily focuses on Bluebird, but the basic functionality should also work in ES6 Promises, and some examples are included on how to replicate Bluebird functionality with ES6 promises. You should still use Bluebird where possible, though - they are faster, less error-prone, and have more utilities.

I'm available for tutoring and code review :)

You may reuse all gists for any purpose under the WTFPL / CC0 (whichever you prefer).