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
data Lista = Megtobb Int Lista | Vege | |
uresLista :: Lista | |
uresLista = Vege | |
egyKetHa :: Lista | |
egyKetHa = Megtobb 1 (Megtobb 2 (Megtobb 3 Vege)) | |
hossz :: Lista -> Int | |
hossz Vege = 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
{- | |
Copyright 2016 Google Inc. | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software |
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
#!/bin/bash | |
INPDF=$1 | |
OUTDIR=$2 | |
ROT=$3 | |
CONVOPTS=$4 | |
INBASE=$(basename ${INPDF} .pdf) | |
TMP=$(mktemp -d) | |
pdfimages -j ${INPDF} ${TMP}/${INBASE} # emits ppm,pbm or jpg | |
for i in $(ls ${TMP}/${INBASE}-*.*) | |
do |
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
{-# LANGUAGE BangPatterns, OverloadedStrings #-} | |
import qualified Data.ByteString.Lazy as BL | |
import Data.Csv | |
import Data.Char (ord) | |
import Data.Monoid | |
import Data.Vector (Vector) | |
import qualified Data.Vector as V | |
import Data.Foldable (foldMap) | |
import qualified Data.Text.Lazy as T | |
import qualified Data.Text.Lazy.Encoding as T |
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
function initGL() { | |
var canvas = document.getElementById("canvas"); | |
canvas.width = 320; | |
canvas.height = 480; | |
gl = canvas.getContext('experimental-webgl'); | |
gl.disable(gl.DEPTH_TEST); | |
gl.clearColor(0.5, 0.5, 0.5, 1.0); | |
var vs = "attribute vec2 a_position;"; | |
vs += "uniform vec2 u_resolution;"; |
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
isBlank x = ' ' == x | |
f (lastBlank, res) ch = | |
if isBlank ch | |
then (True, if lastBlank then res else ' ':res) | |
else (False, ch:res) | |
g s = reverse $ snd $ foldl f (False, []) s | |
main = print $ g "x y zzz ff dd e" |
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
module Main where | |
import System.FilePath | |
import System.Directory | |
main = firstWhereM check ["a", "x", "b"] >>= print | |
where check = doesFileExist . (</>"z"</>"y") | |
firstWhereM :: (Monad m) => (a -> m Bool) -> [a] -> m (Maybe a) | |
firstWhereM pred ins = case ins of |
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 Network | |
import System.IO | |
import Data.Char (chr, ord) | |
import Control.Exception (IOException) | |
import Control.Concurrent (forkIO, threadDelay, killThread) | |
import Control.Concurrent.MVar | |
import Control.Monad.IO.Class (MonadIO, liftIO) | |
import Control.Monad.Trans.Class (lift) | |
import Control.Monad.Trans.Either | |
import Control.Monad (liftM) |
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
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE RebindableSyntax #-} | |
{-# LANGUAGE CPP #-} | |
module Main where | |
import Prelude | |
#ifndef FAY | |
-- Fake stuff for RebindableSyntax |
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
{-# LANGUAGE ExistentialQuantification, Rank2Types #-} | |
import Control.Monad.Identity | |
import qualified Control.Monad.State as S | |
-- with guidance from http://hackage.haskell.org/package/lens "Minimizing dependencies" | |
type Lens c d a b = forall f . (Functor f) => (a -> f b) -> c -> f d | |
get :: c -> Lens c d a () -> a |