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
/** | |
* Decodes a JSON string. | |
* @param string | |
* @param boolean | |
* @param integer | |
* @return mixed | |
*/ | |
public static function decode($json, $assoc = FALSE, $depth = 512) | |
{ | |
$json = (string) $json; |
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
scalaVersion := "2.9.0-1" | |
libraryDependencies += "commons-codec" % "commons-codec" % "1.4" | |
libraryDependencies += "oauth.signpost" % "signpost-core" % "1.2.1.1" | |
libraryDependencies += "org.jdom" % "jdom" % "1.1" | |
libraryDependencies += "rome" % "rome" % "0.9" |
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
def fib[A](n: Int, k: Int => A): A = { | |
if (n < 2) k(1) | |
else fib(n-1, (x: Int) => | |
fib(n-2, (y: Int) => | |
k(x+y))) | |
} | |
fib(10, 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
import java.io.{File, FileWriter} | |
/* | |
usage: | |
===== | |
:power // switch power mode on | |
:load repl.scala // load this file | |
ReplHistory.save // save history | |
*/ |
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
trait F[T] extends Function1[T, Boolean] { | |
def apply(t: T): Boolean | |
def &&(g: T => Boolean) = (a: T) => apply(a) && g(a) | |
def ||(g: T => Boolean) = (a: T) => apply(a) || g(a) | |
def ^ (g: T => Boolean) = (a: T) => apply(a) ^ g(a) | |
def unary_! = (a: T) => !apply(a) | |
} | |
implicit def toF[T](a: T => Boolean) = new F[T] { def apply(x: T) = a(x) } |
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
<?php | |
// for i in $(seq 1 200000); do wget -nv -O "$i.html" "http://linkuj.cz/?id=show&viewnr=4&typ=0&par=$i"; done; | |
error_reporting(E_ALL); | |
$fs = glob("*.html"); | |
//$fs = array_slice($fs, 0, 1000); | |
function xpath($dom, $path) { |
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
val letters = Map( | |
'a' -> 1, 'é' -> 3, 'k' -> 1, 'r' -> 1, 'ů' -> 4, | |
'á' -> 2, 'ě' -> 3, 'l' -> 1, 'ř' -> 4, 'v' -> 1, | |
'b' -> 3, 'f' -> 5, 'm' -> 2, 's' -> 1, 'x' -> 10, | |
'c' -> 2, 'g' -> 5, 'n' -> 1, 'š' -> 4, 'y' -> 2, | |
'č' -> 4, 'h' -> 2, 'ň' -> 6, 't' -> 1, 'ý' -> 4, | |
'd' -> 1, 'i' -> 1, 'o' -> 1, 'ť' -> 7, 'z' -> 2, | |
'ď' -> 8, 'í' -> 2, 'ó' -> 7, 'u' -> 2, 'ž' -> 4, | |
'e' -> 1, 'j' -> 2, 'p' -> 1, 'ú' -> 5) withDefaultValue 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
<?php | |
$letters = array( | |
'a' => 1, 'é' => 3, 'k' => 1, 'r' => 1, 'ů' => 4, | |
'á' => 2, 'ě' => 3, 'l' => 1, 'ř' => 4, 'v' => 1, | |
'b' => 3, 'f' => 5, 'm' => 2, 's' => 1, 'x' => 10, | |
'c' => 2, 'g' => 5, 'n' => 1, 'š' => 4, 'y' => 2, | |
'č' => 4, 'h' => 2, 'ň' => 6, 't' => 1, 'ý' => 4, | |
'd' => 1, 'i' => 1, 'o' => 1, 'ť' => 7, 'z' => 2, | |
'ď' => 8, 'í' => 2, 'ó' => 7, 'u' => 2, 'ž' => 4, |
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
<?php | |
$users = array(); | |
foreach (range(1, 897) as $page) { | |
$dom = new DOMDocument(); | |
@$dom->loadHtmlFile("http://www.czechiatwitter.com/?page=$page"); | |
$xpath = new DOMXPath($dom); | |
$res = $xpath->query('//strong/a'); | |
foreach ($res as $r) { $users[] = $r->nodeValue; } |
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
(def letters { | |
\a 1 \é 3 \k 1 \r 1 \ů 4 | |
\á 2 \ě 3 \l 1 \ř 4 \v 1 | |
\b 3 \f 5 \m 2 \s 1 \x 10 | |
\c 2 \g 5 \n 1 \š 4 \y 2 | |
\č 4 \h 2 \ň 6 \t 1 \ý 4 | |
\d 1 \i 1 \o 1 \ť 7 \z 2 | |
\ď 8 \í 2 \ó 7 \u 2 \ž 4 | |
\e 1 \j 2 \p 1 \ú 5 | |
}) |
OlderNewer