Skip to content

Instantly share code, notes, and snippets.

View jneira's full-sized avatar
:octocat:

Javier Neira jneira

:octocat:
View GitHub Profile
// Filter
select ?X ?name ?poblacion
where {
?X dbp:officialName ?name .
?X rdf:type dbo:Place .
?X dbo:populationTotal ?poblacion
filter (?poblacion > 10000000)
}
LIMIT 100
import org.kordamp.json.JSONObject;
import org.kordamp.json.JsonConfig;
import org.kordamp.json.processors.JsonBeanProcessor;
public class JsonLibTest {
private final String prop1,prop2;
public JsonLibTest(String prop1,String prop2) {
this.prop1=prop1;
/*
Si en spring tambien se cambiaron (o añadieron) la configuracion mediante convencion (que tiene sus propios problemas)
o con anotaciones o mezclando todo por que la genta acabo harta de xmls y demas.
No se como es en .net pero si yo tengo un objetos del tipo
*/
class Bean<T> {
T getValue() {
// ...
}
}
{-# LANGUAGE RecordWildCards #-}
module Bloomberg where
import Data.Time
import Text.Format
data Issue = Issue {
title :: String,
price :: Double,
pages :: Int,
public final class Correct<T> implements Result<T> {
private static final long serialVersionUID = 1L;
public final T value;
public Correct(T value) {
super();
this.value = value;
}
type WithST h r = Eff (st:: ST h | r)
add :: forall h r. STRef h String -> String -> WithST h r String
add ref str = modifySTRef ref (++ str)
renderST :: Element -> String
renderST = pureST <<< renderElemST
renderElemST :: forall h r. Element -> WithST h r String
renderElemST e = do
-- Purescript tutorial 12.4 Exercise 4
module Spider where
import Files
import Data.Foreign
import Data.Foreign.Index
import Data.Either
import Data.Array
import Data.Traversable
import Data.Foldable
import Control.Monad.Eff
foreign import data Timeout :: !
type Milliseconds = Number
type WithTimeout eff = Eff (t :: Timeout | eff)
type ContTimeout eff = ContT Unit (WithTimeout eff)
setTimeoutCont :: forall eff. Milliseconds -> ContTimeout eff Unit
setTimeoutCont = ContT <<< setTimeout
a057531=[e | e<-[0..], (sum $ digits e) == (length $ divisors e)]
where divisors n=n:[i|i <- [1..n `div` 2], n `mod` i==0]
digits 0=[]
digits n=mod n 10: digits (div n 10)
*Exercitium> last $ takeWhile (<2015) a057531
2006
*Exercitium> head $ dropWhile (<=2015) a057531
2101
*Exercitium> length $ takeWhile (<=2015) a057531
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Control.Monad.Trans (lift)
import Control.Parallel (par, pseq)
import Data.Text.Lazy (pack)
import System.Random (StdGen, newStdGen, random)
import Web.Scotty (get, scotty, text)