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
public class MagicalLand { | |
public static void main(String[] args) { | |
for (int i = 0; i < (Math.random() * 500) + 2; i++) { | |
if (Unicorn.pat()) { | |
System.out.println("UNICORN #1: PAT THIS UNICORN ONCE"); | |
} | |
} | |
for (int i = 0; i < (Math.random() * 500) + 2; i++) { | |
if (Unicorn.pat()) { |
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 Digito(String partes) { | |
shared String parte(Integer idx) { | |
if (exists p=partes[idx]) { | |
if (p==`_`) { | |
return " _ "; | |
} else if (p==` `) { | |
return " "; | |
} else { | |
return "| "; | |
} |
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
object D extends App { | |
implicit def =====(x:Int)={ | |
print(x) | |
print("=====D") | |
D | |
} | |
def apply(f1: => Unit)(f2: => Unit)={ | |
f1 | |
f2 | |
println() |
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
apply plugin:'scala' | |
repositories { | |
mavenLocal() | |
mavenCentral() | |
//This repo is for the Finagle jars | |
mavenRepo urls:'http://maven.twttr.com' | |
} | |
dependencies { |
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
<bean class="com.solab.alarms.channels.CommandLineChannel"> | |
<property name="commandWithArgs"><list> | |
<value>/usr/local/bin/growlnotify</value> | |
<value>-m</value> | |
<value>${alarm}</value> | |
<value>Alarma del motor</value> | |
</list></property> | |
<property name="minResendInterval" value="5000" /> | |
</bean> |
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 java.lang.reflect.*; | |
public class Skip { | |
public final String s; | |
public Skip(String s) { | |
this.s=s; | |
} | |
public static void main(String... args) throws Exception { | |
Skip me = new Skip("Initial"); |
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 Toy(shared String name, shared Integer time) { | |
string="``name`` (takes ``time``m)"; | |
} | |
Comparison sortFast(Toy a, Toy b) | |
=> a.time<=>b.time; | |
Toy[2] fastestPair([Toy*] gang) { | |
assert(nonempty g=gang.sort(sortFast), | |
nonempty r=g.rest); |
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
shared class Permutator<out Element>({Element*} source) satisfies Iterable<{Element*}> { | |
shared actual Iterator<{Element*}> iterator() { | |
value elems = source.sequence(); | |
if (elems.size>1) { | |
value arr = Array(source); | |
value idxs = Array(0..arr.size); | |
void swap(Integer i, Integer j) { | |
if (exists ei=arr[i], exists ej=arr[j]) { | |
arr.set(i,ej); |
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
task watchConcurrently { | |
new Thread({ | |
tasks.watch.execute() | |
} as Runnable).start() | |
} | |
run.dependsOn watchConcurrently |
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 ceylon.time { | |
today, date | |
} | |
import ceylon.time.base { | |
monthOf, Month, sunday, saturday | |
} | |
shared void run() { | |
value hoy = today(); | |
value quarters = [ for (m in (1..12).partition(3)) m.collect(monthOf) ]; |