Skip to content

Instantly share code, notes, and snippets.

View Janiczek's full-sized avatar

Martin Janiczek Janiczek

View GitHub Profile
@cgsdev0
cgsdev0 / house_builder.sh
Created February 3, 2024 16:07
house builder pattern in bash
#!/usr/bin/env bash
function house_builder() {
# floors,rooms,has_garage
echo "0,0,0"
}
function set_field() {
local f r g
IFS=, read f r g
@charbelrami
charbelrami / elm-grammar.ebnf
Created January 26, 2024 13:41
Elm EBNF grammar
program = [ comment ], [ "port" ], "module", module_name, "exposing", "(", exposed_list, ")", { import_statement }, { declaration }, { comment };
module_name = identifier, { ".", identifier }, [ comment ];
exposed_list = identifier | "(", identifier, { ",", identifier }, ")", [ comment ] | "..";
import_statement = "import", module_name, [ import_alias ], [ "exposing", "(", exposed_list, ")" ], [ comment ];
import_alias = "as", identifier, [ comment ];
declaration = type_declaration
| type_alias_declaration
@developedby
developedby / ttt.hvm
Created November 3, 2022 13:50
CLI Tictactoe for HVM
// Piece.equal (a: (Piece)) (b: (Piece)) : (Bool)
(Piece.equal (Piece.o) (Piece.o)) = (Bool.true)
(Piece.equal (Piece.x) (Piece.x)) = (Bool.true)
(Piece.equal (Piece.o) (Piece.x)) = (Bool.false)
(Piece.equal (Piece.x) (Piece.o)) = (Bool.false)
// Piece.show (piece: (Piece)) : (String)
(Piece.show (Piece.o)) = "O"
(Piece.show (Piece.x)) = "X"
@4z3
4z3 / elm-format-wrapper.nix
Created March 24, 2021 00:12
elm-format-wrapper that allows to ignore blocks of code
{ pkgs }:
pkgs.symlinkJoin {
name = "elm-format-wrapper";
paths = [
(pkgs.writers.writeDashBin "elm-format" ''
# elm-format-wrapper 1.0.0
#
# Usage:
# elm-format [--help] [--action=ACTION] PATH...
@JoelQ
JoelQ / elm-types-glossary.md
Last active February 14, 2024 14:29
Elm Type Glossary

Elm Types Glossary

There's a lot of type terminology and jargon going around when discussing types in Elm. This glossary attempts to list some of the most common type terms along with synonyms, terms from other language communities, examples, and links to more detailed articles on each topic.

@munificent
munificent / generate.c
Last active March 18, 2024 08:31
A random dungeon generator that fits on a business card
#include <time.h> // Robert Nystrom
#include <stdio.h> // @munificentbob
#include <stdlib.h> // for Ginny
#define r return // 2008-2019
#define l(a, b, c, d) for (i y=a;y\
<b; y++) for (int x = c; x < d; x++)
typedef int i;const i H=40;const i W
=80;i m[40][80];i g(i x){r rand()%x;
}void cave(i s){i w=g(10)+5;i h=g(6)
+3;i t=g(W-w-2)+1;i u=g(H-h-2)+1;l(u

Lightning Talk proposal for ReactiveConf 2017 http://www.reactiveconf.com #ReactiveConf

Porting Prezi to Elm in 99 lines of code

Elm is a statically-typed functional programming language. Its compiler produces safe JavaScript which is guaranteed to be free of runtime exceptions. Moreover Elm is packed with a bunch of powerful abstractions which let us build visual and reactive Web applications in a few lines of code.

As an example, I show the implementation of a simple framework for building Prezi-like presentations. It's just 99 lines of code!

@klaftertief
klaftertief / reactiveconf-2016-lightning-talk.md
Last active April 2, 2024 20:17
An API search engine in Elm for Elm, proposal for a Lightning Talk at ReactiveConf 2016

An API search engine in Elm for Elm

Elm is a statically typed functional language that compiles to JavaScript. It's well-known for its developer experience: the compiler provides nice error messages, the package system enforces semantic versioning for all published packages and makes sure every exposed value or type has some documentation and type annotations.

@raganwald
raganwald / any-partial-application.js
Created April 1, 2015 15:02
anyPartialApplication
const div = (verbed, numerator, denominator) =>
`${numerator} ${verbed} ${denominator} is ${numerator/denominator}`
div('divided by', 1, 3)
//=> 1 divided by 3 is 0.3333333333333333
const anyPartialApplication = (() => {
const placeholder = {},
anyPartialApplication = (fn, ...template) => {
let remainingArgIndex = 0;
@killercup
killercup / pandoc.css
Created July 3, 2013 11:31
Add this to your Pandoc HTML documents using `--css pandoc.css` to make them look more awesome. (Tested with Markdown and LaTeX.)
/*
* I add this to html files generated with pandoc.
*/
html {
font-size: 100%;
overflow-y: scroll;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}