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
(let [revenu 50000 | |
tranches [ [0 6011 0.] [6011 11991 0.055] [11991 26631 0.14] [26631 71397 0.3] [71397 151200 0.41]]] | |
(reduce | |
(fn [total [tmin tmax coeff]] | |
(let [m-in-tranche (- (min tmax revenu) tmin)] | |
(+ total (max 0 (* m-in-tranche coeff))))) | |
0 | |
tranches)) |
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 duration-pattern #"^(?<sign>\+|-)?P(?:(?:(?:(?<years>\d+(?:[,.]\d+)?)Y)?(?:(?<months>\d+(?:[.,]\d+)?)M)?(?:(?<days>\d+(?:[.,]\d+)?)D)?(?<time>T(?:(?<hours>\d+(?:[.,]\d+)?)H)?(?:(?<minutes>\d+(?:[.,]\d+)?)M)?(?:(?<seconds>\d+(?:[.,]\d+)?)S)?)?)|(?<weeks>\d+(?:[.,]\d+)?W))$") |
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
(ns hello-world.handler | |
(:require [compojure.core :refer :all] | |
[compojure.route :as route] | |
[ring.middleware.defaults :refer [wrap-defaults site-defaults]]) | |
(:use [ring.adapter.jetty])) | |
(defroutes app-routes | |
(GET "/" [] "Salut Billy") | |
(route/not-found "Not Found")) |
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
package com.vidal.pmsi.data; | |
import java.util.HashSet; | |
import java.util.Set; | |
import org.apache.jena.riot.RDFDataMgr; | |
import org.apache.jena.riot.RDFFormat; | |
import org.junit.Test; | |
import com.hp.hpl.jena.rdf.model.Model; | |
import com.hp.hpl.jena.rdf.model.ModelFactory; | |
import com.hp.hpl.jena.rdf.model.Resource; |
OlderNewer