Skip to content

Instantly share code, notes, and snippets.

View yemi's full-sized avatar

Fabian yemi

View GitHub Profile
@mindlapse
mindlapse / guide.md
Last active September 7, 2021 15:05
A guide on how to use PaymentIntents with tipsi-stripe

Introduction

Card payments with Stripe should be performed with PaymentIntents.

This API was created to handle modern payments, where the cardholder's bank may require the user to authenticate themselves with the bank before a payment can be authorized.

Authentication requirements first started to appear with European banks regulated by PSD2 which introduced [Strong Customer Authentication

@robkuz
robkuz / error-handling-refactoring.purs
Created May 25, 2016 12:12
refactoring some convoluted error handling code
initial code with some really convoluted error handling.
The problem on this is that it must check for 2 different error cases and also return a different result in those error cases
dot :: Matrix -> Matrix -> Either MatrixError Number
dot (Matrix a sa) (Matrix b sb) = if areSimilarVectors sa sb then Right $ dot' a b else failed sa sb
where
areSimilarVectors s1 s2 = isVector s1 s2 && isSameSize s1 s2
dot' a b = _dot (join a) (join b)
isVector sa sb = fst sa == 1 && fst sb == 1
isSameSize sa sb = snd sa == snd sb
@rehno-lindeque
rehno-lindeque / NixSetup.md
Last active April 2, 2024 20:18
NixOS Setup (Virtualized + Haskell + Gnome3 + XMonad)

Setup NixOS (Virtualized + Haskell + Gnome3 + XMonad)

Before you get started

This is pretty out of date now... you may want to look elsewhere

Newer guides than mine (mine is a bit dated and has a lot of rough edges):

Have you looked at these?

@npryce
npryce / Makefile
Last active August 29, 2015 14:22
Makefile to bootstrap and build a Purescript project
npm_bin:=$(shell npm bin)
psc=$(npm_bin)/psc
bower=$(npm_bin)/bower
outdir=target
all: $(outdir)/js/HelloWorld.js
$(outdir)/js/HelloWorld.js: src/HelloWorld.purs
@rehno-lindeque
rehno-lindeque / elm-tuple-proposal.md
Last active May 25, 2016 19:14
Elm tuple proposal

Overview

Lately I've been annoyed that Haskell has tuples with more than 2 elements. It seems to me like a great deal of boilerplate in Haskell comes from writing code like Data.Profunctor.Product. One can find many, many more examples like this in Haskell libraries.

That is to say, suppose you could define types like this:

type alias A = (x,(x,x))
@aaronlevin
aaronlevin / reasonable.hs
Last active June 8, 2017 14:55
Reasonably Priced Monads in Haskell
-- | simple/basic Scala -> Haskell translation of Runar's presentation
-- | (https://dl.dropboxusercontent.com/u/4588997/ReasonablyPriced.pdf)
-- | trying to use minimal extensions and magic.
-- | (earlier I had a version using MultiParamTypeClasses for Runar's
-- | Inject class, but scraped it opting for simplicity)
-- | my question: what do we lose by moving towards simplicity?
-- | Future work: use DataKinds, TypeOperators, and potentially TypeFamilies
-- | to maintain and automate the folding of types in Coproduct.
{-# LANGUAGE Rank2Types, DeriveFunctor #-}
@john2x
john2x / 00_destructuring.md
Last active July 9, 2024 01:38
Clojure Destructuring Tutorial and Cheat Sheet

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.

Vectors and Sequences