Skip to content

Instantly share code, notes, and snippets.

View noxecane's full-sized avatar
:shipit:
let's find out

Kunle Arewa noxecane

:shipit:
let's find out
View GitHub Profile
@noxecane
noxecane / TinyServant.hs
Created June 25, 2021 19:38
Small Implementation of servant haskell library
{-# LANGUAGE DataKinds, PolyKinds, TypeOperators #-}
{-# LANGUAGE TypeFamilies, FlexibleInstances, ScopedTypeVariables #-}
{-# LANGUAGE InstanceSigs #-}
module TinyServant where
import Control.Applicative
import GHC.TypeLits
import Text.Read
import Data.Time
@noxecane
noxecane / sql_types.go
Created September 20, 2020 16:35
Postgres SQL type for postgis
package gis
import (
"bytes"
"database/sql/driver"
"encoding/binary"
"encoding/hex"
"fmt"
)
@noxecane
noxecane / settings
Created September 2, 2019 14:38
VS Code Settings
Sometingh
@noxecane
noxecane / app.conf
Created June 24, 2019 21:08
Proxy to a service
server {
listen [::]:443 ssl http2; # and this
listen 443 ssl http2; # change this
# The host name to respond to
server_name localhost;
location /api/v1/account/ {
proxy_pass http://localhost:3008;
proxy_set_header Host $http_host;
@noxecane
noxecane / OpaleyeExt.hs
Last active June 9, 2019 21:30
Simplify your life with Opaleye
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
module OpaleyeExt
( MonadDB(..)
, ConstraintError(..)
, safeInsertOne
, safeInsertOneReturningId
, safeInsertOneReturningId'
, select_

I was trying to build haddock using stack so I can generate docs for hoogle.

$ stack haddock --haddock-deps

# fails with

2018-05-23 09:50:28.287257: [debug] Run process within /tmp/stack32381/haskell-src-exts-1.20.2/: /home/tester/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_mPHDZzAJ_2.2.0.1_ghc-8.4.2 --builddir=.stack-work/dist/x86_64-linux/Cabal-2.2.0.1 haddock --html --hoogle --html-location=../$pkg-$version/ --haddock-option=--hyperlinked-source
@(src/Stack/Build/Execute.hs:1133:29)
Progress 1/2
@noxecane
noxecane / term
Created August 31, 2018 18:38
Get haskell-src-exts to fail
```bash
$ mv a.js b.js
```
@noxecane
noxecane / combine.js
Last active October 7, 2017 20:40
Code I can't do without on JS
var argsToArr = function (args) {
return Array.prototype.slice.call(args, 0);
};
var argFn = function (fn) {
return function () {
return fn(argsToArr(arguments));
};
};
@noxecane
noxecane / events.clj
Last active January 17, 2017 04:54
Using core.async for pub-sub in where the subscriber defines what he wants
(ns tools.events
(:require [clojure.core.async :as a]))
(defn new-emitter
"Creates a map to hold configuration of an emitter"
([]
(new-emitter 10))
([buff]
(let [in (a/chan 10)
@noxecane
noxecane / funk.es6
Created January 25, 2016 21:06
Some functions I use daily for functional programming.(most of them from Javascript Allonge)
'use strict';
export const isNothing = x => x === null || x === undefined;
// iterations
export const repeat = (num, fn) => (num > 0) ?
(repeat(num - 1, fn), fn(num - 1)) :
(void 0);
// Decorators