| ⌘T | go to file |
| ⌘⌃P | go to project |
| ⌘R | go to methods |
| ⌃G | go to line |
| ⌘KB | toggle side bar |
| ⌘⇧P | command prompt |
This file contains hidden or 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
| int add_count(unsigned long delta) | |
| { | |
| int c; | |
| int cm; | |
| int old; | |
| int new; | |
| do { | |
| split_counterandmax(&counterandmax, &old, &c, &cm); | |
| if (delta > MAX_COUNTERMAX || c + delta > cm) |
This file contains hidden or 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
| /** | |
| * Syntax Analysis production | |
| * void means do not create AST | |
| * / means ordered alternative | |
| */ | |
| module Sample; | |
| header { import java.util.*;} | |
| body { public static final Set<String> |
This file contains hidden or 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 of computing attributes in Rats! | |
| AssignStmt assignStmt = l : expr COLONEQ r : expr { yyValue = new AssignStmt(l, r) } | |
| // class that represents an assignment statement node. | |
| class AssignStmt extends Stmt { | |
| Expression _lhs, _rhs; // children | |
| public AssignStmt(Expression l, Expression r) { | |
| _lhs = l; | |
| _rhs = l; | |
| } |
This file contains hidden or 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
| object Hello extends App{ | |
| println "hello" | |
| } |
This file contains hidden or 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
| Hello Gist |
This file contains hidden or 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
| def drop[T](list: List[T], n: Int): List[T] = { | |
| @tailrec | |
| def loop(l: List[T], n: Int): List[T] = l match { | |
| case Nil => l | |
| case _ if n == 0 => l | |
| case x :: xs => loop(xs, n - 1) | |
| } | |
| loop(list, n) | |
| } |
This file contains hidden or 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 scala.language.experimental.macros | |
| import scala.reflect.macros.Context | |
| /** Trying out macros in Scala 2.10 */ | |
| object Macros { | |
| def compiledTime(): String = macro compiledTime_impl | |
| def compiledTime_impl(c: Context)(): c.Expr[String] = { | |
| import c.universe._ | |
| val date = c.Expr[String](Literal(Constant(new java.util.Date().toString))) |
This file contains hidden or 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
| $ cat ~/.sbtconfig | |
| SBT_OPTS="-XX:+CMSClassUnloadingEnabled -XX:PermSize=128M -XX:MaxPermSize=256M" |
Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.
| Cmd+C | copy current line (if no selection) |
| Cmd+X | cut current line (if no selection) |
| Cmd+⇧+K | delete line |
| Cmd+↩ | insert line after |
OlderNewer