Skip to content

Instantly share code, notes, and snippets.

View GHvW's full-sized avatar
🌳
coffee

Garrett van Wageningen GHvW

🌳
coffee
View GitHub Profile
@GHvW
GHvW / Either.cs
Last active April 19, 2020 18:10
C# Either Prototype
// ************************************* Types ********************************************************
public interface IEither<A, B>
where A : notnull
where B : notnull {
public IEither<A, Result> Map<Result>(Func<B, Result> transform) where Result : notnull;
public B UnwrapOr(B b);
public B GetOrHandle(Func<A, B> handler);
open System
let getDie =
let rand = new Random()
fun() -> rand.Next(1, 7)
let myDice numDice = [for i in 1 .. numDice do yield getDie()]
//Only single ones and fives are scored
@GHvW
GHvW / PreExtraCreditGreedy.fsx
Created February 24, 2018 02:21
Greedy Dojo before attempting extra credit in F#
open System
let getDie =
let rand = new Random()
fun() -> rand.Next(1, 7)
let myDice numDice = [for i in 1 .. numDice do yield getDie()]
@GHvW
GHvW / for-fun.go
Last active December 1, 2017 05:05
Messing around to see what it might take to add a Map and Filter method if I really wanted them for []int arrays in Go.
package main
import "fmt"
func main() {
fmt.Println("Hello Go!")
testArr := arrayWrapper{array: []int{1, 2, 3, 4, 5}}
randomArr := testArr.Map(func(x int) int { return x * 2 })
fn main() {
let map1 = "abcdefghijklmnopqrstuvwxyz";
let map2 = "cbaefdihglkmpjonsrqvutkwzy";
let cipher = Cipher::new(map1, map2);
let encoded = cipher.encode("I'm coding right now");
println!("{}", encoded);
@GHvW
GHvW / prototype-seat-sort.js
Created June 6, 2017 00:46
Brute force attempt at seat sort
//students array
var students = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25];
//size of group
var sizeOfGroup = 4;
//concept for filtering sutdents
var gradeSort = [];
//determine number of groups
function findNumGroups(studentsArr, groupSize) {
@GHvW
GHvW / achievement-equation.js
Created June 3, 2017 02:45
Grit achievement equation
function achievementScore(talent, effort) {
var skill = talent * effort;
var achievement = skill * effort;
console.log(achievement);
}