Skip to content

Instantly share code, notes, and snippets.

Daniel Bachler danyx23

Block or report user

Report or block danyx23

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View toxplanet-openapi.json
{
"openapi": "3.0.1",
"info": {
"title": "ToxPlanet Search Service",
"version": "3.0.0"
},
"servers": [
{
"url": "https://search-service.toxplanetdev.com",
"description": "Development server"
@danyx23
danyx23 / simpleMazeSolver.fs
Created Oct 2, 2019
Simple Maze Solver in F#
View simpleMazeSolver.fs
let labyrinthString = """xxxxxxx
x x
x x x x
x x x
x xxx x
x x
xxxxxxx"""
let labyrinth =
labyrinthString.Split("\n")
@danyx23
danyx23 / mazes.txt
Created Oct 2, 2019
Simple mazes for the friendly functional meetup
View mazes.txt
xxxxxxx
x x
x x
x
x x
x x
xxxxxxx
xxxxxxx
x x
@danyx23
danyx23 / Main.hs
Last active Nov 7, 2018
An exmple of a simple Haskell that has a small bug
View Main.hs
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DeriveGeneric #-}
-- This file will not compile - there is a small error you need to fix.
-- Follow the guidelines about how to set up a new stack project and copy
-- this file, then run stack build to try and compile.
-- To have the dependencies available you have to add this fragment to the package.yaml of
-- your stack project:
-- - aeson
@danyx23
danyx23 / pragmatic.hs
Last active Sep 7, 2018
Demonstrate use of typeclasses and simple monad transformer stacks to structure haskell apps
View pragmatic.hs
-- This is a small example for structuring Haskell programs so that
-- you neither have to 1) define half your program to live in IO or
-- 2) build complex Monad transformer stacks where you have to lift
-- several times to be able to do the correct operations.
-- Instead, this approach (shown to me by @am_i_tom at BusConf 2018)
-- uses type classes that define a set of operations and then define
-- a type `App a` that is a small Monad transformer stack of EitherT,
-- ReaderT and IO that implement these type classes. This allows
-- you to write functions that declare (via these type classes) which
-- capabilities they need to run. You can also easily write a different
@danyx23
danyx23 / ResultErrorListApplicative.fs
Created Feb 14, 2018
F# Result applicative accumulating errors in a list
View ResultErrorListApplicative.fs
type Test =
{ A : string
B : int
C : float
}
let buildTest a b c =
{ A = a
B = b
C = c
@danyx23
danyx23 / SwaggerMinimal.elm
Created Nov 18, 2016
Recursive Elm Json decoder crashes in Elm 0.18
View SwaggerMinimal.elm
module SwaggerMinimal exposing (..)
import Json.Decode
exposing
( int
, string
, float
, Decoder
, map
, oneOf
@danyx23
danyx23 / SwaggerApiUpdates.sh
Created Oct 12, 2016
Simple recipe for how to regenerate swagger based apis without overwriting implementation
View SwaggerApiUpdates.sh
java -jar swagger-codegen-cli.jar generate -l python-flask -i SWAGGER-YAML-FILE -o api
git add api
git commit ...
# this is just a convienience for the first time you change your api
git tag -a initial-api-scaffold -m "Initial swagger scaffold. Base point for future api changes"
# work on implementation, then:
git add, commit
View GetImagesForInchisInGoogleDocs.js
// This script will insert images for all the inchis it finds
// in a google document
//How to use this scipt:
// Go to a google document where you want this script to work
// Choose from the Menu: Tools -> Script editor
// Delete everything in the editor that opens
// Paste in this entire script
// Save it and close the window
//
View decodeBinaryFormat.elm
-- This is a naive brainstorm draft for a binary parser for an imaginary binary image format.
-- The image format is assumed to be:
-- Little endian
-- 4 bytes: magic identifier 0x23 0x23 0x23 0x23
-- 2 bytes: width of image in pixels
-- 2 bytes: height of image in pixels
-- (width * height * 3) bytes: R G B values stored for each pixel (unsigned int)
import Binary.DataView.UInt8 exposing (uint8ViewLittleEndian, getBytes, getUInt16)
You can’t perform that action at this time.