Skip to content

Instantly share code, notes, and snippets.

View codingedgar's full-sized avatar
👨‍🔬

Edgar Rodriguez codingedgar

👨‍🔬
View GitHub Profile
@isaacs
isaacs / comma-first-var.js
Created April 6, 2010 19:24
A better coding convention for lists and object literals in JavaScript
// See comments below.
// This code sample and justification brought to you by
// Isaac Z. Schlueter, aka isaacs
// standard style
var a = "ape",
b = "bat",
c = "cat",
d = "dog",
@asierba
asierba / unittestconsole.cs
Last active January 19, 2024 11:12
How to mock console in unit tests
class Program
{
public static void Main(string[] args)
{
Console.WriteLine("What's your name?");
var name = Console.ReadLine();
Console.WriteLine(string.Format("Hello {0}!!", name));
}
[Test]
@geoder101
geoder101 / .gitignore
Last active September 2, 2021 13:00
gitignore for F# projects
# Originally created by https://www.gitignore.io/api/windows,linux,visualstudio,visualstudiocode,osx,xamarinstudio,f#,monodevelop,vim,emacs,node,bower on 2016-03-19
# Last updated: 2016-03-20
### Windows ###
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
@Savelenko
Savelenko / GADTMotivation.fs
Last active June 4, 2024 14:40
Motivated simulation of GADTs in F#, quite motivational
module GADTMotivation
(*
Here is a simple motivational example for GADTs and their usefulness for library design and domain modeling. Suppose we
need to work with settings which can be displayed and adjusted in a GUI. The set of possible setting "types" is fixed
and known in advance: integers, strings and booleans (check-boxes).
The GUI should show an example value for each possible setting type, e.g. 1337 for an integer setting and "Hello" for a
string setting. How can we model this small domain of setting types and computing example values?
*)