Skip to content

Instantly share code, notes, and snippets.

@kozak
kozak / country-bounding-boxes.py
Created December 5, 2023 09:38 — forked from graydon/country-bounding-boxes.py
country bounding boxes
# extracted from http//www.naturalearthdata.com/download/110m/cultural/ne_110m_admin_0_countries.zip
# under public domain terms
country_bounding_boxes = {
'AF': ('Afghanistan', (60.5284298033, 29.318572496, 75.1580277851, 38.4862816432)),
'AO': ('Angola', (11.6400960629, -17.9306364885, 24.0799052263, -4.43802336998)),
'AL': ('Albania', (19.3044861183, 39.624997667, 21.0200403175, 42.6882473822)),
'AE': ('United Arab Emirates', (51.5795186705, 22.4969475367, 56.3968473651, 26.055464179)),
'AR': ('Argentina', (-73.4154357571, -55.25, -53.628348965, -21.8323104794)),
'AM': ('Armenia', (43.5827458026, 38.7412014837, 46.5057198423, 41.2481285671)),
@kozak
kozak / decode_session_cookie.rb
Created October 4, 2018 10:50 — forked from profh/decode_session_cookie.rb
A simple script to decode Rails 4 session cookies
@kozak
kozak / convert.purs
Last active May 6, 2017 11:57
Trying to encode Beam Columnar type family with fundeps
module Main where
import Prelude
import Data.Foldable (fold)
import TryPureScript
import Unsafe.Coerce (unsafeCoerce)
undefined :: ∀ a. a
undefined = unsafeCoerce unit
@kozak
kozak / partial.purs
Created May 6, 2017 11:51
Partial type application?
module Main where
import Prelude
import Data.Foldable (fold)
import TryPureScript
newtype Name = Name String
derive newtype instance showName :: Show Name
@kozak
kozak / dict.purs
Created May 6, 2017 11:50
Explicit dictionary passing
module Main where
import Prelude
import Data.Foldable (fold)
import TryPureScript
import Unsafe.Coerce (unsafeCoerce)
undefined :: ∀ a. a
undefined = unsafeCoerce unit
@kozak
kozak / app_interperter.rb
Last active May 9, 2017 22:14
Dispatch interpreter
def interpret(ast)
interpreter = DispatchInterpreter.new([
[DnsDSL, DnsInterpreter.new],
[JobDSL, DelayedJobInterpreter.new],
[CrudDSL, CrudActiveRecordInterpreter.new],
[SystemCommandDSL, SystemCommandInterpreter.new],
[FirstOrderDiscountDSL, FirstOrderDiscountInterpreter.new],
[ExceptionNotifierDSL, ExceptionNotifierInterpreter.new],
[InvoiceDSL, InfaktInvoiceInterpreter.new],
[CreditCardPaymentDSL, PayLane::Interpreter.new],
@kozak
kozak / Validation.purs
Created February 15, 2017 15:57
Different behaviour of maybe, either and V for validation
module Main where
import Prelude
import Data.Foldable (fold)
import TryPureScript
import Data.Maybe
import Data.Either
import Data.String (length)
import Control.Alt ((<|>))
@kozak
kozak / ListT.purs
Created January 15, 2017 00:39 — forked from paf31/ListT.purs
Stack-safe ListT in PureScript using FreeT (updated)
module ListT where
import Prelude
import Data.List
import Data.Either
import Data.Identity
import Control.Apply
import Control.Bind
@kozak
kozak / Main.purs
Last active December 14, 2017 10:29
Free coproduct error handling ?
module Main where
import Prelude
import Data.Functor.Coproduct
import Data.Foldable (fold)
import TryPureScript
import Data.Either
import Control.Monad.Free
type File = { name :: String, path :: String, fileData :: String }
@kozak
kozak / rpn.purs
Created December 3, 2016 19:16
RPN
module Main where
import Prelude
import Data.Maybe
import Data.Traversable
import Data.Foldable (foldl, fold)
import Data.String (split, Pattern (..) )
import Data.Int (fromString)
import Data.List
import Control.Alt