Skip to content

Instantly share code, notes, and snippets.

Avatar

Mark Feeney overthink

View GitHub Profile
View install-graphite-ubuntu-10.04.sh
####################################
# BASIC REQUIREMENTS
# http://graphite.wikidot.com/installation
# http://geek.michaelgrace.org/2011/09/how-to-install-graphite-on-ubuntu/
# Last tested & updated 10/13/2011
####################################
sudo apt-get update
sudo apt-get upgrade
@overthink
overthink / gist:3739858
Created Sep 17, 2012
Use Tampermonkey in Chrome to install this.
View gist:3739858
// ==UserScript==
// @name Hide who to follow on twitter
// @namespace http://blog.markfeeney.com
// @version 0.1
// @description Hide the who to follow thing on twitter.
// @match https://twitter.com/*
// @copyright 2012+, Mark Feeney
// ==/UserScript==
// 2 seconds ought to be enough for anyone
@overthink
overthink / content.md
Created Oct 5, 2012 — forked from ayosec/content.md
Why Lisp macros are cool, a Perl perspective
View content.md
@overthink
overthink / gist:6241841
Created Aug 15, 2013
O(n) size by default... great.
View gist:6241841
def time[R](block: => R): R = {
val t0 = System.currentTimeMillis
val result = block // call-by-name
val t1 = System.currentTimeMillis
println("Elapsed time: " + (t1 - t0) + "ms")
result
}
val list1 = 1 to 10000 toList
val ary1 = 1 to 10000 toArray
@overthink
overthink / gist:7669b95275ae2f11e496
Last active Aug 29, 2015
variable-arity arg weirdness
View gist:7669b95275ae2f11e496
(def person1 {:fname "John" :mname "Q" :lname "Doe"})
(def person2 {:fname "Jane" :mname "P" :lname "Doe"})
(defn fname-compare [p1 p2]
(do
(println "Comparing fname")
(compare (:fname p1) (:fname p2))))
(defn lname-compare [p1 p2]
(do
View gist:b55d96f3d1df385163cd
(ns exp.cache
"I keep screwing myself up on this and need to write it out.
Caching impl with these constraints:
- caching is layered onto oblivious source fns
- data to cache is some unparsed source data that is transformed in a non-trivial way
- thr raw source data is not interesting to most users and shouln't mess up the api
- caching the final transformed thing is not desireable since we often change the transformation fn
- not all source data should be cached
View gist:54350e8205d7b0ba5061
~/tmp/units-2.11$ make clean
rm -f *.o units units.fn units.ky units.pg units.tp \
units.vr units.log units.dvi units.1 units.cp distname .chk \
units.toc units.aux units.cps units.op units_cur_inst units_cur
~/tmp/units-2.11$ time (./configure && make)
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
@overthink
overthink / gist:e56f35159f6bc5751d34
Last active Aug 29, 2015
Scala lost guarded exhaustiveness checks at 2.10.x... very annoying
View gist:e56f35159f6bc5751d34
mark@mark-pc2:~/tmp/patterns$ cat Test.scala
sealed trait Foo
case object A extends Foo
case object B extends Foo
object Test {
def f(foo: Foo) {
foo match {
case A if true =>
println("A")
@overthink
overthink / gist:c7efe144abbd23524004
Created Apr 30, 2015
Bytecode for Using.apply()
View gist:c7efe144abbd23524004
public <A extends java/lang/Object, B extends java/lang/Object> B apply(A, scala.Function1<A, B>);
flags: ACC_PUBLIC
Code:
stack=3, locals=7, args_size=3
0: aload_2
1: aload_1
2: invokeinterface #77, 2 // InterfaceMethod scala/Function1.apply:(Ljava/lang/Object;)Ljava/lang/Object;
7: astore_3
8: aload_1
9: ifnull 37
View mocks.clj
(ns foo.core
"Looking at ways to mock out records when testing and also using schema."
(:require
[schema.core :as s]))
;; approach 1 (problematic for mocks) --------------------------------------------------
(s/defrecord Thing
[name :- s/Str
age :- s/Int])
You can’t perform that action at this time.