Skip to content

Instantly share code, notes, and snippets.

View SevanBadal's full-sized avatar
🐙

Sevan SevanBadal

🐙
View GitHub Profile
@truizlop
truizlop / Wave.swift
Created September 10, 2020 14:41
Wave animation using SwiftUI
import SwiftUI
let LINE_LENGTH: Double = 500.0
let N = 720
let LINES = 18
let WAVES: Double = 18.0
let WAVE_HEIGHT: Double = 20
let SPACING: Double = 27.0
let CURL_AMOUNT: Double = 12.0
@abritinthebay
abritinthebay / consoleColors.js
Last active April 2, 2025 07:34
The various escape codes you can use to color output to StdOut from Node JS
// Colors reference
// You can use the following as so:
// console.log(colorCode, data);
// console.log(`${colorCode}some colorful text string${resetCode} rest of string in normal color`);
//
// ... and so on.
export const reset = "\x1b[0m"
export const bright = "\x1b[1m"
export const dim = "\x1b[2m"
@davidallsopp
davidallsopp / WriterMonad.hs
Created October 24, 2014 14:52
Simple example of the Writer Monad (in Haskell), adapted from LYAH (http://learnyouahaskell.com)
module WriterMonad where
-- From http://learnyouahaskell.com/for-a-few-monads-more
-- This example no longer works without tweaking - see
-- http://stackoverflow.com/questions/11684321/how-to-play-with-control-monad-writer-in-haskell
-- just replace the data constructor "Writer" with the function "writer" in the line marked "here"
-- That changed with mtl going from major version 1.* to 2.*, shortly after LYAH and RWH were written
import Control.Monad.Writer
@akoskovacs
akoskovacs / MyList.hs
Last active September 3, 2023 09:46
A simple Haskell linked list implementation
module MyList where
data MyList a = Cons a (MyList a)
| MyNil deriving (Show, Eq)
{-
A simple linked list module
Some examples:
mylist = (Cons 10 (Cons 99 (Cons 11 (Cons 1 MyNil))))
myHead myList # => 10
myTail myList # => Cons 99 (Cons 11 (Cons 1 MyNil))