Skip to content

Instantly share code, notes, and snippets.

Avatar

Randall Schulz RSchulz

  • Box, Inc,
  • Silicon Valley
View GitHub Profile
@RSchulz
RSchulz / 00_Description
Last active December 31, 2015 17:18
Unexpected By-Name Parameter Evaluation
View 00_Description
This code is a simplification (mostly the removal of type parameters) of an attempt, as an exercise,
to create a syntax that approximates the C- and Java-like conditional expression (“question-colon”).
The first attempt was eager, which is of course less than ideal. Next I tried to alter the code to
produce a form that evaluated only one of the value expressions. In doing so I found that the left-
hand (true) expression is always evaluated, even when the controlling Boolean is false. It appears
that the by-name parameter used to convey the left-hand value expression is being evaluated at the
point in the source where it appears (lexically). The right-hand (false case) expression is only
evaluated when the controlling Boolean is false and the stack trace indicates that the evalutation
is triggered where expected, in the body of TrueLeftFalseRight.right.
View gist:9338200
// Scala WTF #15189...
scala> trait A { }
defined trait A
trait B { }
defined trait B
val a1 = new A { }
a1: A = $anon$1@33c239aa
View gist:8581033
import scala.reflect.runtime.universe._
def classType[T](c: Class[T]): Type =
runtimeMirror(c.getClassLoader)
.staticClass(c.getName)
.selfType
def prodType(p: Product): Type = {
val mirror = runtimeMirror(p.getClass.getClassLoader)
val cSym = mirror.staticClass(p.getClass.getName)
View config.log
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by libffi configure 3.0.13, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ .././configure --srcdir=.. --enable-builddir=x86_64-apple-darwin12.3.0 --disable-debug --disable-dependency-tracking --prefix=/usr/local/Cellar/libffi/3.0.13
## --------- ##
## Platform. ##
@RSchulz
RSchulz / .bash_profile
Created January 10, 2013 16:12
RSchulz's .bash_profile
View .bash_profile
export >|"$HOME/.env-initial"
brewPortsPATH=(
/usr/local/bin
)
pathEntries=(
""
"$HOME/bin"
@RSchulz
RSchulz / brew-doctor-out
Created January 9, 2013 20:30
Attempt to install libtool fails on OS X 10.8.2
View brew-doctor-out
Your system is raring to brew.
@RSchulz
RSchulz / "brew install libtool --env=std" output
Last active December 10, 2015 21:29
Homebrew libtool install problem
View "brew install libtool --env=std" output
brew install libtool --env=std
==> Downloading http://ftpmirror.gnu.org/libtool/libtool-2.4.2.tar.gz
Already downloaded: /Library/Caches/Homebrew/libtool-2.4.2.tar.gz
==> ./configure --prefix=/usr/local/Cellar/libtool/2.4.2 --program-prefix=g --enable-ltdl-install
==> make install
make[2]: *** [libltdl/dlopen.la] Error 1
make[2]: *** Waiting for unfinished jobs....
libtool: compile: /usr/bin/clang -DHAVE_CONFIG_H -I. -DLTDLOPEN=libltdl "-DLT_CONFIG_H=<config.h>" -DLTDL -I. -I. -Ilibltdl -I./libltdl -I./libltdl/libltdl -Os -w -pipe -march=native -Qunused-arguments -mmacosx-version-min=10.8 -c libltdl/ltdl.c -o libltdl/libltdl_libltdl_la-ltdl.o >/dev/null 2>&1
make[1]: *** [install-recursive] Error 1
make: *** [install] Error 2
View gist:3382076
#!/bin/bash
declare prob="${0##*/}"
declare progDir="${0%/*}"
declare sbtJAR="$progDir/sbt.jar"
declare -a jxArgs=( $SBT_JOPTS )
View gist:3380683
This file has been truncated, but you can view the full file.
[residual] arg = 'gen-idea'
[addSbt] arg = 'set logLevel in Global := Level.Debug'
Detected sbt version 0.12.0
Downloading sbt launcher 0.12.0:
From http://typesafe.artifactoryonline.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/0.12.0/sbt-launch.jar
To /box/www/rrs-common/bin/.lib/0.12.0/sbt-launch.jar
[addJava] arg = '-Dsbt.global.base=/Users/rschulz/.sbt/0.12.0'
Using /Users/rschulz/.sbt/0.12.0 as sbt dir, -sbt-dir to override.
# Executing command line:
java
View gist:3316563
Setting version to 2.9.1
[info] Set current project to box-common (in build file:/box/www/box-common/)
[info] Updating {file:/box/www/box-common/}default-20c7ac...
[info] Resolving org.scala-lang#scala-library;2.9.1 ...
[info] Resolving ch.qos.logback#logback-classic;0.9.29 ...
[info] Resolving ch.qos.logback#logback-core;0.9.29 ...
[info] Resolving org.slf4j#slf4j-api;1.6.1 ...
[info] Resolving com.weiglewilczek.slf4s#slf4s_2.9.1;1.0.7 ...
[info] Resolving org.slf4j#log4j-over-slf4j;1.6.1 ...
[info] Resolving com.linkedin.norbert#norbert-cluster_2.8.0;0.6.1 ...