Skip to content

Instantly share code, notes, and snippets.

View zsol's full-sized avatar

Zsolt Dollenstein zsol

View GitHub Profile
require 'formula'
class GtkMacIntegration < Formula
homepage 'https://live.gnome.org/GTK+/OSX'
url 'ftp://ftp.gnome.org/pub/gnome/sources/gtk-mac-integration/2.0/gtk-mac-integration-2.0.1.tar.xz'
version '2.0.1'
sha1 '9d939a2e4fb6c0ab4fe3d544ac712a152451249a'
head 'git://git.gnome.org/gtk-mac-integration'
depends_on 'pkg-config' => :build
{-# LANGUAGE GeneralizedNewtypeDeriving, GADTs, StandaloneDeriving #-}
import Control.Monad.Identity
import Control.Monad.Reader
import Control.Monad.Writer
import Control.Monad.Error
import Control.Applicative
import Data.Map
import Prelude hiding (lookup, log)
type Name = String
@zsol
zsol / Sum.hs
Last active December 12, 2015 08:08
Sums its arguments and also prints them in order
#!/usr/bin/env runghc
import System.Environment
import Control.Monad.Writer
import Control.Applicative
mySum :: (Num a, Show a) => [a] -> Writer [String] a
mySum [] = return 0
mySum (x:xs) = censor ((show x):) ((x+) <$> mySum xs)
main = do
@zsol
zsol / Memo.hs
Created February 14, 2013 08:20
{-
you need the memoize cabal package to use this.
http://hackage.haskell.org/package/memoize-0.3
-}
import System.IO.Unsafe
import System.Posix.Files
import System.Posix.Types
import Data.Function.Memoize
import Debug.Trace
@zsol
zsol / fcat.hs
Last active December 21, 2015 13:28
{-# LANGUAGE OverloadedStrings #-}
import qualified Data.Text as T
import qualified Data.Text.IO as T
import Data.Time
import System.Exit
import System.IO.Error
import System.Locale
format :: String
format = "%Y-%m-%d %H:%M:%S,%q"
@zsol
zsol / Abesto.hs
Last active December 22, 2015 13:29
Generating function to parse plain data constructors without arguments. Useful for @abesto and the SDL types
{-# LANGUAGE TemplateHaskell #-}
module Abesto(mkRead) where
import Language.Haskell.TH
import Data.Maybe
constructors :: Info -> Maybe [Name]
constructors (TyConI (DataD _cxt _name _bnds cons _names)) = Just $ catMaybes $ map getName cons
where getName (NormalC name _types) = Just name
@zsol
zsol / blurb.md
Last active December 23, 2015 09:19
Budapest New Tech Meetup Haskell blurb

Why Haskell Matters to You

Why are we at Prezi pushing Haskell adoption internally? Why bother having the fourth production application written in a lazy, statically typed, purely functional language? What are the good parts and more interestingly, what have been the painful points so far? Be prepared for some production code examples.

Prezi.com

Prezi is a virtual whiteboard that transforms presentations from monologues into conversations: enabling people to see, understand, and remember ideas. I'm Zsolt, a tech lead at Prezi: https://prezi.com/about/zsolt-dollenstein/

@zsol
zsol / Card.hs
Created September 20, 2013 13:12
credit card validation
module Card where
import Data.Char
produceDigits :: Integer -> [Int]
produceDigits n = [(ord i) - 48| i <- (show n)]
doubleEveryOther :: [Int] -> [Int]
doubleEveryOther l = case (length l) `mod` 2 of
0 -> helper0 l
@zsol
zsol / install_haskell_platform.sh
Created January 15, 2014 13:26
Install haskell platform on mavericks
#!/bin/bash
set -e
tmp=$(mktemp -d)
trap "rm -rf $tmp" EXIT
cd $tmp
curl -O http://www.haskell.org/platform/download/2013.2.0.0/Haskell%20Platform%202013.2.0.0%2064bit.pkg

Keybase proof

I hereby claim:

  • I am zsol on github.
  • I am zsol (https://keybase.io/zsol) on keybase.
  • I have a public key whose fingerprint is 21EE A6A4 EF06 1CB2 0082 F208 0EA6 EB87 C124 0D6F

To claim this, I am signing this object: