Skip to content

Instantly share code, notes, and snippets.

View sudaraka's full-sized avatar

Sudaraka Wijesinghe sudaraka

View GitHub Profile

Keybase proof

I hereby claim:

  • I am sudaraka on github.
  • I am sudaraka (https://keybase.io/sudaraka) on keybase.
  • I have a public key whose fingerprint is 6C7A AFF5 A094 0D99 4024 7706 3D3C 830F E563 ECEE

To claim this, I am signing this object:

const
R = require('ramda'),
fs = require('fs')
// == Maybe ====================================================================
const
Maybe = function(x) {
this.__value = x
}
<html>
<head>
<style>
.expandinginput {
position: relative;
border: 1px solid #888;
background-color: #fff;
}
.expandinginput textarea,
@sudaraka
sudaraka / automata.js
Last active September 17, 2016 10:51
Cellular Automata Demo - as in https://www.youtube.com/watch?v=bc-fVdbjAwk
(function() {
'use strict'
const
MEMBERS = 181,
GENERATIONS = 100,
randomState = () => Math.random() > .5,
createCell = () => {
@sudaraka
sudaraka / deep-freeze.js
Created September 18, 2016 08:07
Deep freeze an object
/**
* deep-freeze.js: Deep freeze an object
*
* Copyright 2016 Sudaraka Wijesinghe <sudaraka@sudaraka.org>
*
* This program comes with ABSOLUTELY NO WARRANTY;
* This is free software, and you are welcome to redistribute it and/or modify
* it under the terms of the BSD 2-clause License. See the LICENSE file for more
* details.
*
@sudaraka
sudaraka / compose.js
Last active September 8, 2017 19:25
General purpose JavaScript compose function
/**
* compose.js: compose function & usage
*
* Copyright 2017 Sudaraka Wijesinghe <sudaraka@sudaraka.org>
*
* This program comes with ABSOLUTELY NO WARRANTY;
* This is free software, and you are welcome to redistribute it and/or modify
* it under the terms of the BSD 2-clause License. See the LICENSE file for more
* details.
*
#!/usr/bin/env node
/**
* Following code samples and notes are from my following of Jim Weirich's
* presentation "Y Not? Adventures in Functional Programming"
*
* http://confreaks.tv/videos/rubyconf2012-y-not-adventures-in-functional-programming
* https://www.youtube.com/watch?v=FITJMJjASUs
*
* Note: presentation was done using Ruby, while my code sample are in