Skip to content

Instantly share code, notes, and snippets.

@dullbananas
dullbananas / index.js
Created January 16, 2022 21:04
minimal deta micro example
const app = function(request, response) {
response.writeHead(200, {
"Content-Type": "text/html",
});
response.end("Hello world");
};
module.exports = app;
@dullbananas
dullbananas / Main.elm
Created February 28, 2021 20:35
Impure function in Elm
random : Value -> Float
random =
decodeValue (field "random" float)
@dullbananas
dullbananas / EA.elm
Created June 9, 2020 19:24
EA Ports. It's in the game.
module EA exposing (..)
port ea0 : Int -> Cmd msg
port ea1 : Int -> Cmd msg
port ea2 : Int -> Cmd msg
port ea3 : Int -> Cmd msg
port ea4 : Int -> Cmd msg
port ea5 : Int -> Cmd msg
@dullbananas
dullbananas / basics.ts
Last active May 13, 2020 19:56
EditSC extension API concept
declare const editsc; // Tells TypeScript that this variable is defined elsewhere
editsc.init({
useVersion: "1.0", // The version of the extension API to use
name: "Basics",
});
// Defines an action allowing the user to select a
// block and replace it with a different block
editsc.action({
@dullbananas
dullbananas / Main.love
Last active April 26, 2020 17:08
love - programming language
module Main exporting
- main
procedure main =
file : Io.stream <- loop getFilename:
case do Util.promptFileName:
Ok stream ->
Loop.exit getFilename stream
@dullbananas
dullbananas / Csv.Decode.elm
Last active April 21, 2020 22:32
elm type safe csv parser
type Decoder a
= Decoder ( String -> Maybe a )
type Error
= InvalidHeaders
| NoRows
int : Decoder Int
@dullbananas
dullbananas / Thing.elm
Created April 17, 2020 20:22
elm importer concept
module Thing exposing ( add4 )
add4 : Int -> Int
add4 =
(+) 4
@dullbananas
dullbananas / ImperativeShell.elm
Last active April 17, 2020 04:28
elm concept: writing a shell with elm
-- if elm was imperative
import Console
import Proc
type alias Model =
{ prompt : String
}
@dullbananas
dullbananas / Fraction.elm
Last active April 11, 2020 18:51
Elm extending `number` and `comparable` concept
module Fraction exposing (Fraction, create, toFloat_)
-- See https://discourse.elm-lang.org/t/proposal-extending-built-in-typeclasses/5510/2
type Fraction [ number, comparable ]
= Fraction Int Int
@dullbananas
dullbananas / NeverGonna.elm
Created March 24, 2020 02:35
Totally normal program
module NeverGonna exposing (main)
import Html exposing (..)
main : Html Never -- gonna give you up
main =
let
neverGonna : List String
neverGonna =