Skip to content

Instantly share code, notes, and snippets.

@dullbananas
dullbananas / demo.py
Created December 3, 2019 01:52
Dish Interactive Demo
import os
os.system('pip3 install --user dish')
from dish import Dish
dish = Dish()
dish.run()
@dullbananas
dullbananas / sad.py
Created February 1, 2020 21:23
Very accurate AI that tells if a girl likes me
def girl_likes_me():
return False
@dullbananas
dullbananas / hi.cpp
Created March 14, 2020 01:54
Ugly C++ Hello World
#include <iostream>
using namespace std
; int main ( )
{ cout << "Hello worl"
; return 0
;
}
@dullbananas
dullbananas / chunks32h.ksy
Created March 22, 2020 21:18
Chunks32h.dat Kaitai Struct representation
meta:
id: chunks32h
endian: le
seq:
- id: directory_entries
type: directory_entry
repeat: expr
repeat-expr: 65536
- id: guard_entry
type: directory_entry
@dullbananas
dullbananas / PortTypes.elm
Last active March 24, 2020 01:48
How to make Elm ports slightly more simple
-- Normal ports
port outgoingString : String -> Cmd msg
port incomingString : (String -> msg) -> Sub msg
-- Ports with type aliases
type alias OutgoingPort a =
a -> Cmd msg
@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 =
@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 / 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 / Thing.elm
Created April 17, 2020 20:22
elm importer concept
module Thing exposing ( add4 )
add4 : Int -> Int
add4 =
(+) 4
@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