Skip to content

Instantly share code, notes, and snippets.

View noahlz's full-sized avatar
🕵️‍♂️
Secret Stuff for SEI Novus. I might take 1 - 3 days to respond.

Noah Zucker noahlz

🕵️‍♂️
Secret Stuff for SEI Novus. I might take 1 - 3 days to respond.
View GitHub Profile
@noahlz
noahlz / gvim-clojure.md
Last active December 16, 2015 05:38
Notes on setting up vim for Clojure development.
@noahlz
noahlz / concajconsliststar.clj
Created May 3, 2013 15:49
concat vs. conj vs. cons vs. list vs. list*
user=> (concat '(1 2 3) '(4 5 6))
(1 2 3 4 5 6)
user=> (conj '(1 2 3) '(4 5 6))
((4 5 6) 1 2 3)
user=> (cons '(1 2 3) '(4 5 6))
((1 2 3) 4 5 6)
user=> (list '(1 2 3) '(4 5 6))
@noahlz
noahlz / build.log
Created May 24, 2013 19:39
For stackoverflow
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 08:51:28-0500)
Maven home: /home/nzucker/java/maven-latest
Java version: 1.6.0_31, vendor: Sun Microsystems Inc.
Java home: /home/nzucker/java/jdk1.6.0_31/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.18-194.el5", arch: "amd64", family: "unix"
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from /home/nzucker/java/maven-latest/conf/settings.xml
[DEBUG] Reading user settings from /home/nzucker/.m2/settings.xml
[DEBUG] Using local repository at /home/nzucker/.m2/repository
@noahlz
noahlz / char-reflection.clj
Last active December 19, 2015 10:49
Understanding type hints for char primitives in clojure.
user=> (set! *warn-on-reflection* true)
true
user=> (defn is-letter? [c] (Character/isLetter c))
Reflection warning, NO_SOURCE_PATH:1:22 - call to isLetter can't be resolved.
#'user/is-letter?
user=> (defn is-letter? [^char c] (Character/isLetter c))
user=> CompilerException java.lang.IllegalArgumentException: Only long and double primitives are supported, compiling:(NO_SOURCE_PATH:1:1)
;; Ugh...no.
@noahlz
noahlz / char-benchmark-results.txt
Created July 7, 2013 20:40
Benchmarking ^char type-hint vs (char)
====== Benching (Character/isLetter ^char c) ======
WARNING: Final GC required 3.956775511289807 % of runtime
amd64 Linux 3.2.0-48-generic 2 cpu(s)
Java HotSpot(TM) 64-Bit Server VM 23.21-b01
Runtime arguments: -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Dclojure.compile.path=/tmp/oneoff/classes -Doneoff.version=0.1 -Dfile.encoding=UTF-8 -Dclojure.debug=false
Evaluation count : 5580540 in 60 samples of 93009 calls.
Execution time sample mean : 11.046857 µs
Execution time mean : 11.046903 µs
Execution time sample std-deviation : 24.758483 ns
Execution time std-deviation : 24.947300 ns
@noahlz
noahlz / gitLOL.txt
Created July 14, 2013 22:37
Fixing some erroneous commits in Stringly.
[noahlz:stringly]$ git checkout master
Switched to branch 'master'
[noahlz:stringly]$ git log -6 --oneline
d230ce9 merge branch develop [no ci]
908e62b only build master
0416e6c Added a few words about Perforate to the readme.
621565e only build master
5832d26 Added a few words about Perforate to the readme.
3ca1764 Merge branch 'issues/6/upgrade-perforate'
[noahlz:stringly]$ git reset --soft HEAD~3
@noahlz
noahlz / scala_impatient_gotchas.md
Last active January 13, 2018 12:22
Notes while working through "Scala for the Impatient"

Free excerpt from TypeSafe (pdf): Scala for the Impatient

Class Setters

I discovered the special syntax for a field setter:

class Person {
  private var privateAge = 0 // Make private and rename
  def age = privateAge
 def age_ = (newValue: Int) {
// Reference: http://www.cforcoding.com/2012/01/interview-programming-problems-done.html
object PascalsTriangle {
def nextrow(prev: List[Int]) :Stream[List[Int]] = {
val curr = collection.mutable.ArrayBuffer(1)
for(i <- 1 until prev.length) {
curr += prev(i - 1) + prev(i)
// See: http://nurkiewicz.blogspot.com/2012/04/secret-powers-of-foldleft-in-scala.html
def transformString(s: String, fns: List[Function1[String,String]]) :String =
(s /: fns) { (s: String, f: Function1[String,String]) => f apply s }
val toUpper = (s: String) => s.toUpperCase
val reverse = (s: String) => s.reverse
val disenvowel = (s: String) => s filterNot { Set('a','e','i','o','u') contains _ }
// scala> transformString("blah",List(disenvowel))
// res175: String = blh
@noahlz
noahlz / Implicits.scala
Created August 30, 2013 04:04
Understanding implicit parameter resolution provided from the companion-object scope.
package app;
object Bar {
implicit val b: Bar = new Bar(5)
}
class Bar(val x: Int) {
def doStuff() {
println(x)
}