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
my $ssn_regex = qr/^ | |
(\d{3}) # first three digits | |
[\s\-]* # any whitespace or hyphen | |
(\d{2}) # next two digits | |
[\s\-]* # any whitespace or hyphen | |
(\d{4}) # last four digits | |
$/msx; | |
sub normalize_ssn { | |
my ($raw_ssn) = @_; |
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
public class App { | |
public static void main(final String[] args) { | |
System.out.println("Hey, you guys!!!!"); | |
// Auto-complete here should give us a list of values in Option, but it doesn't. | |
final Option o = Option. | |
} | |
} |
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
public class App { | |
public static void main(final String[] args) { | |
System.out.println("Hey, you guys!!!!"); | |
final Signatures s = new Signatures(); | |
// Auto-complete below should provide several signatures | |
// for stuff(), but only one is given. | |
s. | |
} | |
} |
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
use strict; | |
use warnings; | |
use Data::Dumper; | |
my $things = { foo => 'bar' }; | |
foreach my $word (qw(foo baz bar quux)) { | |
my $count = grep { defined } $things->{$word}; | |
print "$count\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 pkg_resources | |
from collections import namedtuple | |
from numpy.random import RandomState | |
print pkg_resources.get_distribution("numpy").version | |
class Foo(namedtuple("Foo", "x")): | |
pass | |
items = [Foo(1), Foo(2), Foo(3)] |
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
$ sbt compile | |
Loading /usr/share/sbt/bin/sbt-launch-lib.bash | |
[info] Loading project definition from /home/stu/projects/scala-trees/project | |
[info] Set current project to PCFG parsing (in build file:/home/stu/projects/scala-trees/) | |
[info] Updating {file:/home/stu/projects/scala-trees/}scala-trees... | |
[info] Resolving org.scala-lang#scala-library;2.10.3 ... | |
[info] Resolving org.scalatest#scalatest_2.10;2.0 ... | |
[info] Resolving org.scala-lang#scala-reflect;2.10.0 ... | |
[info] Resolving org.scala-lang#scala-compiler;2.10.3 ... | |
[info] Resolving org.scala-lang#scala-reflect;2.10.3 ... |
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
public enum Item { | |
ITEM1, ITEM2, ITEM3, | |
} |
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
package mymacro.test | |
import scala.annotation.StaticAnnotation | |
import scala.language.experimental.macros | |
import scala.reflect.macros.Context | |
trait MyTypeClass[T] { | |
def something: Int | |
} |
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
package mymacro.test | |
import scala.annotation.StaticAnnotation | |
import scala.language.experimental.macros | |
import scala.reflect.macros.Context | |
trait MyTypeClass[T] { | |
def something(c: Context): c.Tree | |
} |
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
package errordemo | |
import scala.annotation.StaticAnnotation | |
import scala.reflect.macros.whitebox.Context | |
class mymacro extends StaticAnnotation { | |
def macroTransform(annottees: Any*): Any = macro MacroImpl.macroImpl | |
} | |
class MacroImpl(val c: Context) { |
OlderNewer