This file contains hidden or 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
createdb dbname | |
pg_restore -d dbname -Ocxv db.dump | |
# -c Clean, -O no owner, -v verbose, -x no privileges no acl |
This file contains hidden or 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
EXPLAIN select * from tablename where uuid LIKE 'as%'; | |
QUERY PLAN | |
----------------------------------------------------------------------------------------------------------------------- | |
Index Scan using tablename_uuid_like on tablename (cost=0.14..8.16 rows=1 width=1476) | |
Index Cond: (((uuid)::text ~>=~ 'as'::text) AND ((uuid)::text ~<~ 'at'::text)) | |
Filter: ((uuid)::text ~~ 'as%'::text) |
This file contains hidden or 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 OverloadedStrings #-} | |
import Control.Concurrent | |
import Web.Growler | |
import Web.Growler.EventSource | |
import Network.Wai.EventSource | |
main = growl id defaultConfig $ get "/" $ eventSource es |
This file contains hidden or 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
-- :set -XOverloadedStrings | |
import Web.Growler | |
import Network.Wai.Handler.Warp as Warp | |
Warp.run 3001 =<< growler id defaultConfig (get "/" $ text "Hello") |
This file contains hidden or 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 Dict exposing (Dict) | |
import Html exposing (..) | |
import Html.Attributes exposing (..) | |
import Html.Events exposing (..) | |
import String | |
import Debug exposing (log) | |
import Json.Decode as Json | |
import Signal exposing (Address) | |
import StartApp.Simple | |
import Json.Decode as Json |
This file contains hidden or 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
m = require('mongojs') | |
J = require('joi') | |
x = J.string().hex().length(24) | |
i = m.ObjectId().toString() | |
// '57a1c20202ccc41cd8d84834' | |
x.validate(i) | |
// { error: null, value: '57a1c20202ccc41cd8d84834' } |
This file contains hidden or 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
# Sexp equivalent, modulo infix arithmetic expression | |
# (defmodule M | |
# (def foo (lol) | |
# 2+lol)) | |
# Starting from the "true", most verbose form and applying syntactic rules to | |
# obtain the final form | |
# "true" expression, notice there are no vararg functions | |
defmodule(M, |
This file contains hidden or 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
HC = ghc | |
HC_OPTS = -cpp $(EXTRA_HC_OPTS) | |
SRCS = Main.lhs Foo.lhs Bar.lhs | |
OBJS = Main.o Foo.o Bar.o | |
.SUFFIXES : .o .hs .hi .lhs .hc .s | |
cool_pgm : $(OBJS) | |
rm -f $@ |
This file contains hidden or 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
(defn f | |
([xs] (if (empty? xs) () (f (first xs) (rest xs)))) | |
([x xs] | |
(cond | |
(empty? xs) (list x) | |
:else | |
(let [y (first xs)] | |
(cond | |
(= x y) |
This file contains hidden or 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
#lang pie | |
(claim > | |
(-> Nat Nat Nat)) | |
(define > | |
(lambda (n) | |
(rec-Nat n | |
(the (-> Nat Nat) (lambda (m) 0)) | |
(lambda (n-1 n-1>) | |
(lambda (m) |