This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
go test -run=NONE -bench=. | |
BenchmarkDecimalByDecay-8 50000000 32.7 ns/op | |
BenchmarkDecimalByDecay2-8 50000000 30.5 ns/op | |
BenchmarkDecimalByRecursiveDecay-8 20000000 84.5 ns/op | |
BenchmarkDecimalByLogarithmFloor-8 30000000 46.5 ns/op | |
BenchmarkDecimalByLogarithmCeiling-8 30000000 45.2 ns/op | |
BenchmarkDecimalByLinearTableScan-8 100000000 17.9 ns/op | |
BenchmarkDecimalByLinearTableScan2-8 100000000 18.6 ns/op | |
BenchmarkDecimalByBinaryTableSearch-8 50000000 27.9 ns/op | |
BenchmarkDecimalByManualBinarySearch-8 200000000 6.51 ns/op |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package fargo | |
import ( | |
"net/http" | |
"github.com/hudl/fargo" | |
) | |
// errorBoreHTTPStatusCode returns true if the supplied error originated from an HTTP response | |
// bearing the given HTTP status code. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Package mode provides functions related to the statistical mode of | |
// a set of data, the mode being the value that occurs most frequently | |
// in such a set. | |
package mode | |
import "sort" | |
func sortedIntsFrom(input []int) []int { | |
// Don't bother with sort.IntsAreSorted(). | |
sorted := make([]int, len(input)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; a la Graham's "On Lisp" | |
(defmacro nonzero-bind (var exp &rest body) | |
`(let ((,var ,exp)) | |
(unless (zerop ,var) | |
,@body))) | |
(defun underline-current (&optional str) | |
"Insert multiple copies of STR under and of same width as current line. | |
The default underline string is =. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;:* lisp.el | |
;:*======================= | |
(defmacro make-key-inserter (def) | |
"Substitute for `self-insert-command'." | |
`(lambda (arg) | |
(interactive "*P") | |
(insert-char ,def (prefix-numeric-value arg)))) | |
(define-key lisp-mode-shared-map "[" 'insert-parentheses) | |
(define-key lisp-mode-shared-map "]" 'move-past-close-and-reindent) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"strings" | |
"testing" | |
) | |
func doesntContainRune(s string, r rune) bool { | |
return !strings.ContainsRune(s, r) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require 'rainbow-delimiters) | |
(add-hook 'clojure-mode-hook 'rainbow-delimiters-mode) | |
(add-hook 'slime-repl-mode-hook 'rainbow-delimiters-mode) | |
(let ((depth 0)) | |
(dolist (color | |
;; These are nicked from VIMClojure: | |
;; vimclojure/vim/syntax/clojure.vim | |
'("orange1" | |
"yellow1" | |
"greenyellow" |