Skip to content

Instantly share code, notes, and snippets.

View MikeMKH's full-sized avatar
:shipit:
Learning about proof theory with Coq

Mike Harris MikeMKH

:shipit:
Learning about proof theory with Coq
  • Milwaukee, WI
  • 15:01 (UTC -05:00)
View GitHub Profile
@MikeMKH
MikeMKH / folding.clj
Created August 28, 2015 12:01
Folding Max and Min in clojure with clojure.test
(ns folding)
(defn folding
([] nil)
([x] x)
([f x & xs]
(reduce #(if (f %1 %2) %1 %2) x xs)))
(defn folding-min
([] nil)
@MikeMKH
MikeMKH / javascript_function_reference_characterization_spec.js
Created February 17, 2014 15:11
Characterization tests using Mocha and expect.js to understand how functional references in JavaScript work
var expect = require("expect.js");
// Characterization tests using Mocha and expect.js to understand how
// functional references in JavaScript work
// See http://comp-phil.blogspot.com/2014/02/fun-with-function-references-in.html
// examples based on https://leanpub.com/javascript-allonge/read#recursive
describe("Let's play around with function references", function(){
describe("Simple function examples", function(){
@MikeMKH
MikeMKH / javascript_bluebird_characterization_spec.js
Created February 23, 2014 20:26
Characterization tests using Mocha and expect.js to understand how underscore compose works.
var expect = require("expect.js"),
_ = require("underscore"),
increment = function(x){return ++x;};
// Characterization tests using Mocha and expect.js to understand how
// underscore compose works
// See http://comp-phil.blogspot.com/2014/02/bird-watching-with-javascript-bluebird.html
describe("Let's figure out how underscore's compose function works", function(){
describe("Simple function examples", function(){
@MikeMKH
MikeMKH / javascript_curry_examples_spec.js
Last active August 29, 2015 13:56
Simple examples of currying in JavaScript.
var expect = require("expect.js"),
allonges = require("allong.es").allong.es,
curry = allonges.curry,
map = allonges.map,
compose = allonges.compose,
identity = require('oscin.es').I;
// Example of currying in JavaScript
// See http://comp-phil.blogspot.com/2014/03/currying-in-javascript.html
@MikeMKH
MikeMKH / javascript_underscore_constant_characterization_spec.js
Created March 9, 2014 19:49
Characterization tests using Mocha and expect.js to understand how Underscore.js' constant function works
var _ = require("underscore"),
expect = require("expect.js");
// Characterization tests using Mocha and expect.js to understand how
// underscore.js' constant function works
// See http://comp-phil.blogspot.com/2014/03/bird-watching-with-javascript-kestrel.html
describe("Verify that we understand how underscore.js' constant works", function(){
it("Constat will return a function", function(){
expect(_.constant("Hello world")).to.be.a("function");
@MikeMKH
MikeMKH / javascript_underscore_tap_characterization_spec.js
Last active August 29, 2015 13:57
Characterization tests using Mocha and expect.js to understand how Underscore.js' tap function works
var _ = require("underscore"),
send = require("allong.es").allong.es.send,
expect = require("expect.js");
// Characterization tests using Mocha and expect.js to understand how
// underscore.js' tap function works
// See http://comp-phil.blogspot.com/2014/03/bird-watching-with-javascript-kestrel.html
describe("Verify that we understand how tap works", function(){
describe("Call tap with a value", function(){
@MikeMKH
MikeMKH / tsql_multiple_values_in_column.sql
Created March 19, 2014 23:26
Shows how to extract multiple values from a column in T-SQL.
;WITH cte(value, id) AS (
SELECT *
FROM (
VALUES
('HERP DREP CHS XMS', 1)
,('HELLO WORLD', 2)
) AS x(a, b)
)
SELECT
flags.flag.value('.', 'varchar(50)') AS Flag
@MikeMKH
MikeMKH / fizzbuzz_aggregate.cs
Created May 10, 2014 20:10
FizzBuzz kata in C# using LINQ and a helper class to how the translation rules.
using System;
using System.Collections.Generic;
using System.Linq;
namespace FizzBuzz
{
public class FizzBuzzer
{
public string Translate(int value)
{
@MikeMKH
MikeMKH / coin_changer_aggregate.cs
Created May 10, 2014 20:13
Coin Changer kata in C# using LINQ and helper class to make the aggregate more immutable.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CoinChanger
{
public class Changer
{
@MikeMKH
MikeMKH / FizzBuzzPropertyTests.fs
Created May 18, 2014 18:50
FizzBuzz in C# using FsCheck with XUnit to test.
namespace FizzBuzzPropertyTests
// example of FsCheck showing different ways to restricted FizzBuzz testing
open Xunit
open FsCheck
open FsCheck.Xunit
open FizzBuzz
module ``FizzBuzz Property tests`` =