Skip to content

Instantly share code, notes, and snippets.

@david-christiansen
david-christiansen / Test.idr
Created February 6, 2014 20:27
Statically checked embedded subset of SQL in Idris
module Test
import Provider
import Database
import Queries
%language TypeProviders
%link C "sqlite3api.o"
@begriffs
begriffs / opaleye.lhs
Created June 10, 2014 04:02
Opaleye Preview
This is a preview of Tom Ellis' database query library for Haskell.
> {-# LANGUAGE Arrows, FlexibleContexts #-}
> -- TODO: Get rid of FlexibleContexts if we ever move the definition of s
> -- elsewhere.
> {-# LANGUAGE FlexibleInstances, MultiParamTypeClasses #-}
> {-# LANGUAGE TemplateHaskell #-}
>
> module Karamaan.Opaleye.Examples where
>
@gtani7
gtani7 / gist:6b784421bb6dcda160ae
Last active August 29, 2015 14:06
haskell advocacy/marketing
http://www.jerf.org/iri/post/2908
http://mwotton.github.com/hs_gbu/
http://reddit.com/r/haskell/comments/y6i7d/do_we_have_real_world_examples_of_where_static/
http://reddit.com/r/haskell/comments/12e3a0/the_good_the_bad_and_the_ugly_haskell_in/
http://blog.codersbase.com/2010/09/composability-laziness-testing-and.html
https://www.fpcomplete.com/user/imalsogreg/functional-programming-elevator-pitch
http://evincarofautumn.blogspot.com/2012/07/so-i-write-compilers-for-living-now.html
http://www.reddit.com/r/haskell/comments/2gz7s1/please_point_me_at_an_eloquent_paper_or_post_on/
@ejucovy
ejucovy / graphael-linechart-legend.js
Created June 24, 2010 16:15
manually building a legend for a g.raphael linechart
raph = Raphael([..]);
chart = raph.g.linechart([..]);
var labels = ["first variable", "second variable", "third variable"];
chart.labels = raph.set();
var x = 15; var h = 5;
for( var i = 0; i < labels.length; ++i ) {
var clr = chart.lines[i].attr("stroke");
chart.labels.push(raph.set());
chart.labels[i].push(raph.g["disc"](x + 5, h, 5)
anonymous
anonymous / Hdfs.hs
Created March 19, 2012 17:19
A Haskell API wrapping libhdfs
module System.Hdfs where
import Data.ByteString (ByteString)
import qualified Data.ByteString as B
import Data.Int
import Data.Vector (Vector)
import Data.Word
import Foreign.Ptr
type Size = Int32
@ToddG
ToddG / TimerWebSocketServlet.java
Created July 4, 2012 15:05
AngularJS + Jetty + WebSockett Example : TimerWebSocketServlet
import org.eclipse.jetty.websocket.WebSocket;
import org.eclipse.jetty.websocket.WebSocketServlet;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.*;
@mandubian
mandubian / gist:3377514
Created August 17, 2012 09:48
Play2 new plugin: File NonBlocking/Async API - Copying a file
"copy file" in {
var i = 0
val fileGenerator = Enumerator.fromCallback( () =>
if(i<1000){ i+=1; Future.successful(Some((new java.util.Date).getTime.toString + "\n")) } else Future(None)
)
val f = FileChannel("/tmp/testwrite.txt").delete.writing.create
val f2 = FileChannel("/tmp/testwrite2.txt").delete.writing.create
fileGenerator // generates data
@benr
benr / gist:5505198
Created May 2, 2013 20:34
SmartOS Vagrant Box, first preview. Lacks VBox Extensions for disk sharing. (smartos-20130419T073558Z)
vagrant box add smartos http://cuddletech.com/tmp/smartos-latest.box
mkdir smartos && cd smartos
vagrant init smartos
vagrant up
vagrant ssh
# Licensed under CC BY 3.0 http://creativecommons.org/licenses/by/3.0/
# Derived works must attribute https://gist.github.com/4492300 at the beginning, and the date.
##########################################################
Installing and Configuring SmartOS on Hetzner (with a /29)
##########################################################
# if you find this gist useful, please star it
# thanks to: jamesog, linuxprofessor, ryancnelson for help with routing
@AlainODea
AlainODea / create_x86_64_smartmachine.sh
Last active December 26, 2015 10:18
SmartOS Haskell Platform for x86_64
# assuming you have Joyent Compute Service available
sdc-createmachine --dataset 17c98640-1fdb-11e3-bf51-3708ce78e75a --package g3-standard-1-smartos --name alain-demo-$(uuid) | json -a id