Skip to content

Instantly share code, notes, and snippets.

Chris Eidhof chriseidhof

Block or report user

Report or block chriseidhof

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Example.lhs
> {-# LANGUAGE GADTs #-}
> module Example where
> import qualified Data.Map as M
Let's assume that requests are simple |String|s.
> type Request = String
When running a web continuation, either the computation is completely finished,
View ArcChallenge.lhs
In this gist we will first show that we can beat the arc challenge
(http://www.paulgraham.com/arcchallenge.html), and then build the library that
shows how we did it. This gist is Literate Haskell and is of course executable. The packages needed are happstack-server and applicative-extras, installable using cabal.
Let's start with some imports (for now, you can ignore these)
> {-# LANGUAGE GADTs, TypeSynonymInstances #-}
> module ArcChallenge where
>
> import Control.Applicative
View Routing.lhs
This is a literate Haskell file that describes the sketch of a type-safe URL
handling system. It is not done (or anything near it), but is intended as
inspiration for a complete system.
First we will show some examples, and later we will implement the library. The
library uses the |regular| package for generic programming (cabal install regular).
> {-# LANGUAGE TemplateHaskell, TypeFamilies, EmptyDataDecls,
> TypeSynonymInstances, TypeOperators, ScopedTypeVariables #-}
>
View Routing2.lhs
> {-# LANGUAGE GADTs, TypeOperators, TupleSections #-}
> module Routing2 where
> import Control.Applicative hiding (many, (<|>))
> import Text.ParserCombinators.Parsec.Prim
> import Text.ParserCombinators.Parsec.Error
> import Text.ParserCombinators.Parsec.Char
> import Text.ParserCombinators.Parsec.Combinator
> import Data.List (intercalate)
View gist:593219
{-# LANGUAGE OverloadedStrings, TemplateHaskell, EmptyDataDecls, TypeFamilies #-}
module Main where
import Debug.Trace (trace)
import Happstack.Server
import Web.Routes.Site
import Web.Routes.PathInfo (PathInfo (..), parseSegments)
import Web.Routes.Happstack
View README.lhs
Digestive functors
==================
CE: Misschien iets over HTML forms genereren? Dit is wellicht iets te abstract. Ook dat je controle hebt over error-correction en dat het composable is? Misschien uitleggen dat het een alternatief voor formlets is dat strikt beter is?
Digestive functors is a library that provides an abstract interface towards
input consumption. The interface is based on applicative functors.
> {-# LANGUAGE OverloadedStrings #-}
> import Text.Digestive
View TilingView.h
#import <UIKit/UIKit.h>
typedef UIImage*(^getTile)(CGFloat scale, int row, int col);
@interface TilingView : UIView {
getTile getTile;
}
- (id)initWithSize:(CGSize)size levelsOfDetail:(NSInteger)levelsOfDetail tileSize:(CGSize)tileSize;
@property (nonatomic,copy) getTile getTile;
@chriseidhof
chriseidhof / nsincrementalstore.markdown
Created Feb 18, 2012
Accessing an API using CoreData's NSIncrementalStore
View nsincrementalstore.markdown

Accessing an API using CoreData's NSIncrementalStore

Note: the original location of this article is on my blog, however, it is posted here too for better readability.

In this article, we will see how to use Core Data for accessing your API. We will use the Bandcamp API as our running example. I've only been experimenting with this code for a few days, so there might be mistakes in there.

View gist:5555071
<a href="https://developer.apple.com/devcenter/ios/index.action">iOS Dev Center</a>
<a href="https://developer.apple.com/ios/manage/overview/index.action">iTunes Provisioning Portal</a>
<a href="https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa">iTunes Connect</a>
<a href="http://joris.kluivers.nl/">Joris Kluivers</a>
<a href="http://nshipster.com/">NSHipster</a>
<a href="http://objvimmer.com/">objvimmer.com</a>
<a href="http://oleb.net/">oleb.net</a>
<a href="http://sealedabstract.com/">sealedabstract.com</a>
<a href="http://petersteinberger.com/">petersteinberger.com</a>
<a href="http://ashfurrow.com/">ashfurrow.com/</a>
You can’t perform that action at this time.