Skip to content

Instantly share code, notes, and snippets.

View chrisyco's full-sized avatar

Chris Wong chrisyco

View GitHub Profile
@chrisyco
chrisyco / FizzBuzz.hs
Created February 22, 2012 03:38
FizzBuzz variations
-- | FizzBuzz: an example program, similar in purpose to the infamous
-- Hello World, that serves to demonstrate the features and syntax of
-- the language in which it is written.
--
-- The rules of the game are as follows:
--
-- 1. If the number is divisible by 3, return \"Fizz\";
--
-- 2. If the number is divisible by 5, return \"Buzz\";
--
@chrisyco
chrisyco / OldExp.hs
Created March 25, 2012 20:47
Initial attempt at lambda expression data structure
-- |
-- Module : Saliva.Model.OldExp
-- Copyright : GPLv3
--
-- Maintainer : chrisyco@gmail.com
-- Portability : portable
--
-- The 'Exp' data type, for representing lambda expressions.
module Saliva.Model.OldExp
@chrisyco
chrisyco / leak.c
Created April 8, 2012 06:46
Memory leak in 10 lines of code
#include <stdlib.h>
#include <unistd.h>
int main() {
size_t sz = sysconf(_SC_PAGESIZE);
for (;;) {
char *leak = malloc(sz);
leak[0] = 'a';
}