Skip to content

Instantly share code, notes, and snippets.

@timcharper
timcharper / company.el
Last active August 29, 2015 14:12
Some initializers
(require 'company)
(global-company-mode t)
(global-set-key (kbd "s-;") 'company-dabbrev)
(global-set-key (kbd "s-:") 'company-complete)
(global-auto-complete-mode 0) ;; disable this!!! they fight eachother and it is annoying.
def multi(dispatch_fn):
def _inner(*args, **kwargs):
return _inner.__multi__.get(
dispatch_fn(*args, **kwargs),
_inner.__multi_default__
)(*args, **kwargs)
_inner.__multi__ = {}
_inner.__multi_default__ = lambda *args, **kwargs: None # Default default
return _inner
(ns racehub.om.facebook
(:require [cljs.core.async :as a]
[racehub.schema :as rs]
[schema.core :as s :include-macros true]))
;; ## Utilities
(defn prune
"Takes a mapping of keys -> new key names and a map and returns a
map with nils removed and keys swapped where they're present in the
@loganlinn
loganlinn / schema_extensions.clj
Last active August 29, 2015 14:10
variants in schema extensions
(ns schema-client.schema-extensions
"Schemas representing abstract classes and subclasses"
(:use plumbing.core)
(:require
[clojure.string :as str]
[plumbing.map :as map]
[schema.core :as s]
[schema.utils :as utils]
[schema.macros :as sm]))
@grandchild
grandchild / selfspy.conf
Last active August 29, 2015 14:07
An example config for selfspy
# Example selfspy.conf. Put this in your ~/.config/ to use it
# with the systemd .service file.
# Note: You cannot indent lines in here!
# Defaults, used by both selfspy and selfstats.
[Defaults]
# Don't use quotes around the password, they'd be part of it!
# Example:
(sm/defn coupon-lookup
"If the code supplied is empty, sends a failed discount on
immediately. (This won't affect the rendering, since nothing's
shown if the code is blank.) If the code is NOT blank, fires off an
Ajax request to the server to look up the discount.
TODO: Ideally we'd have a channel that could signal a dissoc,
instead of only adding items to the state."
[title :- regatta/Title
code :- coupon/Code
@eraserhd
eraserhd / macros.clj
Created April 19, 2014 23:17
in-> and ->' macros
(ns avi.compose)
(declare ^:private splice-form)
(defn- splice-normal-form
[value form]
(apply list (first form) value (rest form)))
(defn- splice-if-form
[value form]
@gustavla
gustavla / gist:9499068
Created March 12, 2014 01:45
_isotonic.pyx
# Author: Nelle Varoquaux, Andrew Tulloch
# Uses the pool adjacent violators algorithm (PAVA), with the
# enhancement of searching for the longest decreasing subsequence to
# pool at each step.
import numpy as np
cimport numpy as np
cimport cython
@bitemyapp
bitemyapp / gist:8739525
Last active May 7, 2021 23:22
Learning Haskell