Skip to content

Instantly share code, notes, and snippets.

View hughrawlinson's full-sized avatar

Hugh Rawlinson hughrawlinson

View GitHub Profile
//setup
var i = 0;
function log(a){
console.log(a);
}
// read string literals as "string", and = and === as "is"
//haiku starts here
while(i<3){
s = "i like javascript ";if(i===1)s+=" a lot";
log(s);i++;
@hughrawlinson
hughrawlinson / summary.md
Last active February 11, 2016 11:39
A Brief Summary of Haskell

A Brief Summary of Haskell

Haskell is a functional programming language, in the ML family of languages, inheriting many of it’s properties from Lambda calculus. The label ‘functional’ refers to the fact that in functional languages, functions are treated as higher order objects. This means that they may be assigned to variables in the functional languages that have a concept of ‘variables’ in the traditional sense, and are otherwise treated as values. Both Haskell and Javascript are ‘functional’ languages in this capacity, however, they differ in many other ways. Javascript is a loosely typed language, meaning that it’s values, expressions, and functions do not have a specific type. One function could return values of different types depending on the arguments it receives, external state, or potentially other factors like internal calls to type unsafe APIs or underlying libraries. Javascript also features type coercion, where the interpreter will automatically convert variables of certain types into other t

@hughrawlinson
hughrawlinson / wat.js
Last active August 29, 2015 14:19
Function or variable, literally do not care.
// Is this a thing that people do? If so, what is it called? If not, why is it a bad idea? Answers on a tweet please. @hughrawlinson
var π = function(f,obj){
try{
f(obj());
}
catch(e){
f(obj);
}
};
@hughrawlinson
hughrawlinson / wac1_notes.md
Last active February 26, 2018 19:30
Web Audio Conference Presentation Resources

Monday morning, January 26, 2015

9.15 Keynote #1 Audio and the Web - Chris Wilson

Tools & Components

###Session Moderator: Raphaël Troncy 10.30 Building a Collaborative Digital Audio Workstation Based on the Web Audio API - Jan Monschke

@hughrawlinson
hughrawlinson / js_poem.js
Last active February 11, 2016 11:40
An ode to Javascript
var JavascriptIs = ["wonderful","frustrating","charming","delightful"];
console.log("I love javascript");
// sometimes it does stupid shit
['10','10','10'].map(parseInt);
console.log("but all the time it's:");
setInterval(function(){
console.log(JavascriptIs[Math.round(Math.random()*JavascriptIs.length)]);
},1000);
@hughrawlinson
hughrawlinson / binarycount.ino
Last active February 11, 2016 11:42
Binary Counting LEDs
int analogInput = 0;
int rate = 0;
int val = 0;
int count = 0;
void setup()
{
pinMode(analogInput, INPUT);
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
@hughrawlinson
hughrawlinson / heartbt.ck
Last active February 11, 2016 11:43
Synthesises an approximation of the sound of a hearbeat
int bpm;
// set the beats per minute here
60 => bpm;
// this signal flow approximates the timbre shown at:
// http://www.bsignetics.com/cases/ASD.ht65.gif
Noise n => HPF h => LPF l => ADSR e => dac;
int third;
int twothird;
60000/bpm/3 => third;
@hughrawlinson
hughrawlinson / keybase.md
Last active February 11, 2016 11:44
Keybase Proof

Keybase proof

I hereby claim:

  • I am hughrawlinson on github.
  • I am hugh (https://keybase.io/hugh) on keybase.
  • I have a public key whose fingerprint is 9DF4 5AF7 0122 2683 1AC2 5128 9C1A C9F8 BCFC 89C9

To claim this, I am signing this object:

@hughrawlinson
hughrawlinson / fuzzylogic.c
Last active November 11, 2021 10:21
A small operation of basic fuzzy logic functions in C++
/**
@file fuzzylogic.c
@ingroup mc2liveAlg
hugh rawlinson - [email protected]
**/
#include <stdio.h>
double fuzzyOR(double a, double b){
@hughrawlinson
hughrawlinson / private_functions.js
Last active February 11, 2016 11:43
Private functions in ES5
module.exports = function(){
var self = {};
//constructor stuff here
var private = 1;
self.public = 2;
var privateFunction = function(){
console.log('this is a private function');