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
// ==UserScript== | |
// @name PARTAKE_TWITTER_LINK | |
// @namespace partake | |
// @include http://partake.in/events/* | |
// @version 1 | |
// ==/UserScript== | |
(function(){ | |
function makeFunc(twid){return function(){ | |
// window.location.target = "_blank"; |
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 com.qtamaki.tryrhino | |
import org.mozilla.javascript.Context | |
import com.qtamaki.tryparser.ExpressionGenerator | |
import com.qtamaki.tryparser.Arith | |
object RhinoApp { | |
def main(args: Array[String]): Unit = { | |
val cx = Context.enter() |
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 com.qtamaki.tryparser | |
import scala.util.Random | |
class ExpressionGenerator { | |
val r = new Random() | |
def gen(facts: Int):String = rands.take(facts).toList match { | |
case x :: xs => xs.foldLeft[String](x.toString)(ope) | |
case Nil => "" |
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 com.qtamaki.tryparser | |
import scala.util.parsing.combinator._ | |
class Arith extends JavaTokenParsers { | |
def expr: Parser[Double] = { | |
term~rep( | |
"+"~>term ^^ { | |
case d:Double => d.+(_:Double) | |
} |
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
val lib = Project("lib", file("lib")) | |
val libTest = Project("lib", file("libTest"), settings = Seq(dxInputs in Android <<= (dxInputs in Android, classDirectory in Compile in lib, unmanagedBase) map { (dxInputs, classDirectory, unmanagedBase) => | |
dxInputs :+ classDirectory :+ unmanagedBase | |
}) |
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 factors(n:Int):List[Int] = for(x <- List.range(1,n+1); if n % x == 0) yield x | |
def prime(n:Int):Boolean = (factors(n) == List(1,n)) | |
def seq(n:Int,m:Int):Stream[Int] = n #:: seq(n+m,m) | |
//for(x <- seq(10000,1);if prime(x)) print(x + ",") | |
def next_prime(n:Int):Int = if(prime(n)) n else next_prime(n+1) | |
def primes(n:Int):Stream[Int] = { | |
val m = next_prime(n) | |
m #:: primes(m+1) |
NewerOlder