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
@(msg:String,params:Object *)@play.i18n.Messages.get(msg,params.toArray : _*) | |
//for example @i18n("index.hello","Marmite") in any play scala template |
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 XhtmlTransformer { | |
import xml.transform.RuleTransformer | |
/ | |
val className = MonocleReader.className | |
object XhtmlRewriter extends RewriteRule { | |
/** |
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 MyXML extends XMLLoader[Elem] { | |
override def parser: SAXParser = { | |
val f = javax.xml.parsers.SAXParserFactory.newInstance() | |
f.setNamespaceAware(false) | |
f.setValidating(false) | |
f.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); | |
f.setFeature("http://apache.org/xml/features/validation/schema", false); | |
f.newSAXParser() | |
} | |
} |
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 static String removeNonNumerics(String text) { | |
//remove everything except + - and digits | |
String num = text.replaceAll("[^-+\\.\\d]", ""); | |
if (num.length() > 0) { | |
//remove + and - in middle of the string | |
num = num.charAt(0) + num.substring(1).replaceAll("[-+]", ""); | |
//remove extra . (keep the first) |
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
Novels to read : | |
boris Vian - Et on tuera tous les affreux | |
akutagawa |
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
http://www.opensourcery.co.za/2009/04/19/to-amqp-or-to-xmpp-that-is-the-question/ |
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
var myNamespace = (function () { | |
var myPrivateVar, myPrivateMethod; | |
// A private counter variable | |
myPrivateVar = 0; | |
// A private function which logs any arguments | |
myPrivateMethod = function( foo ) { | |
console.log( foo ); |
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 fr.pmu.commons.spring.SpringBuilder; | |
import org.junit.*; | |
import org.junit.Test; | |
import org.springframework.beans.factory.config.AutowireCapableBeanFactory; | |
import org.springframework.context.annotation.AnnotationConfigApplicationContext; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.scheduling.annotation.Async; | |
import org.springframework.scheduling.annotation.EnableAsync; | |
import org.springframework.scheduling.annotation.EnableScheduling; | |
import org.springframework.stereotype.Service; |
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
;; Anything you type in here will be executed | |
;; immediately with the results shown on the | |
;; right. | |
(use 'clojure.test) | |
(with-test | |
(defn extract-scheme | |
"extract scheme from url" |
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
(defn minus [v1 v2] | |
"substract 2 vectors, v2 must be a subset of v1" | |
(reduce (fn [acc v] | |
(let [index (.indexOf acc v)] | |
(into (subvec acc 0 index) (subvec acc (inc index))))) v1 v2)) | |
(minus [:c :a :b :b :a :a :b] [:a :a :b :a]) ; [:c :b :b] |
OlderNewer