Skip to content

Instantly share code, notes, and snippets.

@pphetra
pphetra / FopUtil.groovy
Last active July 25, 2017 07:53
เราใช้ Fop ในการ format pdf (http://w3schools.sinsixx.com/xslfo/xslfo_intro.asp.htm)
class FopUtil {
static Object layoutMasterSet(builder) {
builder.'layout-master-set' {
'simple-page-master'(
'master-name':'first',
'page-height':'29.7cm',
'page-width':'21cm',
'margin-top':'1cm',
'margin-bottom':'2cm',
package main
import (
"log"
"net/http"
"golang.org/x/net/context"
"google.golang.org/grpc"
"github.com/gin-gonic/gin"
sample n = stampSet
where stampSet = difference allNumber allStamp
allNumber = fromList [1..n]
allStamp = fromList (threeStamp ++ fiveStamp ++ combineStamp)
combineStamp = [a + b | a <- threeStamp, b <- fiveStamp]
threeStamp = [x * 3 | x <- [1..n]]
fiveStamp = [x * 5 | x <- [1..n]]
(ns captcha)
(defrecord Captcha [left op right])
(defn render-in-text [value]
(nth ["zero" "one" "two" "three" "four" "five" "six" "seven" "eight" "nine"] value))
(defn render-captcha [captcha pattern]
(let [l (.left captcha)
r (.right captcha)]
{
"eventName": "musical festival",
"appName": "musicalFestApp",
"appCity": "Rio de Janeiro",
"appState": "Rio de Janeiro",
"appCountry": "BR",
"organization": "Epihack",
"organizerName": "Epi Hack",
"start": "2015-07-01",
"finish": "2015-07-12",
import Data.List
import Data.Maybe
import Data.HashMap.Strict
-- version แรก ต้องระวังเรื่อง lookup เจอตัวเอง code ก็เลยมี if เข้ามา ทำให้ code อ่านยาก่
solvev1 n s = case lookup' of
Just a -> let b = n - a in if a /= b then Just (a, b) else Nothing
_ -> Nothing
where table = Data.HashMap.Strict.fromList [(x,x) | x <- s]
lookup' = find (\x -> isJust $ Data.HashMap.Strict.lookup (n - x) table) s
{
"success": true,
"data": {
"CompanyId": "1001",
"Symbol": "MX",
"Title": "",
"FirstName": "MicroX"
}
}
{
"data": [
{
"CompanyId": 0,
"Symbol": 98217,
"Title": "Lacey",
"FirstName": "Bowers Munoz"
},
{
"CompanyId": 1,
{
"data": [
{
"SeqNo": 0,
"NewBAYCode": 56937,
"NewBAYName": "Dorothy",
"ShortName": "Kristy Rivers"
},
{
"SeqNo": 1,
{
"success": true,
"data": {
"firstName": "pok" ,
"lastName": "bunny",
"birthDate": "Thu Sep 11 1969 00:00:00 GMT+0700 (ICT)"
}
}