Skip to content

Instantly share code, notes, and snippets.

View adam-singer's full-sized avatar
👾

Adam Singer adam-singer

👾
View GitHub Profile
#!/bin/sh
# one way (older scala version will be installed)
# sudo apt-get install scala
#2nd way
sudo apt-get remove scala-library scala
wget www.scala-lang.org/files/archive/scala-2.10.3.deb
sudo dpkg -i scala-2.10.3.deb
sudo apt-get update
@adam-singer
adam-singer / clone_and_build_graal_truffle.sh
Created August 11, 2014 19:41
Building graal + truffle on osx 10.9.4 with xcode 5.1.1
hg clone http://hg.openjdk.java.net/graal/graal
cd graal
# http://mail.openjdk.java.net/pipermail/graal-dev/2013-December/001255.html
# uncomment if xm barks about not finding 1.7.
# export EXTRA_JAVA_HOMES=/Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home
export DEFAULT_VM=server
export COMPILER_WARNINGS_FATAL=false
export USE_CLANG=true
export LFLAGS="-Xlinker -lstdc++"
export USE_PRECOMPILED_HEADER=0
@adam-singer
adam-singer / output.sh
Created August 29, 2014 06:25
docgen crashes on mac building chrome.dart from pub.
dart --version
Dart VM version: 1.6.0-dev.9.7 (Tue Aug 26 00:14:16 2014) on "macos_x64"
mkdir -p /tmp/t
cd /tmp/t
export PUB_CACHE=/tmp/t
pub cache add chrome --version 0.6.1 --all
cd hosted/pub.dartlang.org/chrome-0.6.1/
unset PUB_CACHE
// http://en.wikipedia.org/wiki/Bridge_pattern
trait DrawingAPI {
def drawCircle(x:Double, y: Double, radius:Double)
}
class DrawingAPI1 extends DrawingAPI {
override def drawCircle(x: Double, y: Double, radius: Double) = {
printf("API1.circle at %f:%f radius %f\n", x, y, radius)
}
@adam-singer
adam-singer / cardShuffle.dart
Created January 5, 2012 07:33
A simple card shuffle in Dart
// Example borrowed from http://algs4.cs.princeton.edu/
class cardShuffle {
String _cards;
cardShuffle() {
}
void run() {
_cards = "2C 3C 4C 5C 6C 7C 8C 9C 10C JC QC KC AC " +
@adam-singer
adam-singer / ListExtension.dart
Created January 10, 2012 02:08
Example of a possible extension of List to include a indexesOf method.
class ListExtension {
/**
* Returns a [List] of indexes of the given [element], starting
* the search at index [startIndex] to [endIndex] (exclusive).
* Returns an empty [List] if [element] is not found.
*/
static List<num> indexesOf(List list, Object element, int startIndex, int endIndex) {
List<num> n = new List<num>();
if (startIndex >= list.length) {
@adam-singer
adam-singer / get_and_unpack.sh
Created January 30, 2012 05:33
Get latest bundle of Dart with Dartium for MacOSX
rm -rf dart snapshots &&
mkdir snapshots &&
cd snapshots &&
wget http://gsdview.appspot.com/dart-editor-archive-continuous/latest/dart-editor-macosx.cocoa.x86_64.zip
cd ../ &&
tar -zxvf snapshots/dart-editor-macosx.cocoa.x86_64.zip &&
cd dart &&
echo "./DartEditor.app/Contents/MacOS/DartEditor" > runDartEditor.sh &&
chmod +x runDartEditor.sh &&
cd dart-sdk &&
@adam-singer
adam-singer / Test1.dart
Created February 14, 2012 05:38
minfrog error: field cannot override anything but property
#import('dart:html');
class A {
List _l;
}
class B extends A {
List _l;
}
@adam-singer
adam-singer / DartiumBug.dart
Created February 20, 2012 21:04
Dartium Math.pow not implemented
#import('dart:html');
class DartiumBug {
DartiumBug() {
}
void run() {
num n = Math.pow(10, 4);
write("n = ${n}");