Skip to content

Instantly share code, notes, and snippets.

View bsima's full-sized avatar
drinking coffee

Ben Sima bsima

drinking coffee
View GitHub Profile
@yang-wei
yang-wei / destructuring.md
Last active February 20, 2024 04:40
Elm Destructuring (or Pattern Matching) cheatsheet

Should be work with 0.18

Destructuring(or pattern matching) is a way used to extract data from a data structure(tuple, list, record) that mirros the construction. Compare to other languages, Elm support much less destructuring but let's see what it got !

Tuple

myTuple = ("A", "B", "C")
myNestedTuple = ("A", "B", "C", ("X", "Y", "Z"))
@eruffaldi
eruffaldi / annexgetfile.py
Last active August 23, 2023 13:05
Access to files in git-annex bare repository without using git-annex.
#
# Extract files from Bare git-annex repositories without git-annex
# Supports version v6
#
# See internals: http://git-annex.branchable.com/internals/
#
# Modified: added non-bare repos, added tar file (of symlinks) output for use with archivemount
#
# TODO: improve output
# TODO: use cat-files instead of archive
@fukamachi
fukamachi / clhs.ros
Last active May 5, 2021 06:54
A Roswell script for opening HyperSpec page describing a given symbol in the default browser.
#!/bin/sh
#|-*- mode:lisp -*-|#
#|
exec ros -Q -- $0 "$@"
|#
#|
A Roswell script to open the HyperSpec page of a specified symbol in the default browser.
@cemerick
cemerick / user.clj
Last active August 29, 2015 14:21
user.clj to recover pre-1.7.0 printing of Objects and Throwables in the REPL
; add to your user.clj to recover pre-1.7.0 printing of Objects and Throwables in the REPL
; https://github.com/clojure/clojure/blob/master/changes.md#17-printing-as-data
(in-ns 'clojure.core)
; from 1242c48
(defn- print-object [o, ^Writer w]
(when (instance? clojure.lang.IMeta o)
(print-meta o w))
(.write w "#<")
@obfusk
obfusk / break.py
Last active May 1, 2024 20:32
python "breakpoint" (more or less equivalent to ruby's binding.pry); for a proper debugger, use https://docs.python.org/3/library/pdb.html
import code; code.interact(local=dict(globals(), **locals()))
@bsima
bsima / algorithm-runtime-complexity.md
Last active October 29, 2015 14:42
Table of runtime complexity for algorithms

Common examples of asymptotic runtimes

Complexity Name Examples, Comments
Θ(1) Constant Hash table lookup and modification
Θ(lg n) Logarithmic Binary search. Logarithm base unimportant.
Θ(n) Linear Iterating over a list.
Θ(n lg n) Loglinear Optimal sorting of arbitrary values. Same as Θ(lg n!).
Θ(n2) Quadratic Comparing n objects to each other
Θ(n3) Cubic Floyd and Warshall's algorithms
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@chrisdone
chrisdone / AnIntro.md
Last active March 24, 2024 21:13
Statically Typed Lisp

Basic unit type:

λ> replTy "()"
() :: ()

Basic functions:

@evancz
evancz / Haskell-Style-Guide.md
Last active March 23, 2023 15:27
A style guide for Elm tools

Haskell Style Guide for Elm

Goal: a consistent style throughout all Elm projects that is easy to read and produces clean diffs to make debugging easier. This means valuing regularity and simplicity over cleverness.

Line Length

Keep it under 80 characters. Going over is not the end of the world, but consider refactoring before you decide a line really must be longer.

Variables