NOTE: 534 stars, 106 forks. I love you all. Please contribute tips and edits back to this cheat sheet -- email's will.sargent@gmail.com and you can treat gists like git repositories and send git diffs.
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
#!/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 |
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
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 |
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
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 |
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
// 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) | |
} |
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
// 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 " + |
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
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) { |
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
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 && |
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
#import('dart:html'); | |
class A { | |
List _l; | |
} | |
class B extends A { | |
List _l; | |
} |
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
#import('dart:html'); | |
class DartiumBug { | |
DartiumBug() { | |
} | |
void run() { | |
num n = Math.pow(10, 4); | |
write("n = ${n}"); |