Skip to content

Instantly share code, notes, and snippets.

@michaelgwelch
michaelgwelch / EnumerableExtensions.cs
Created July 7, 2011 14:47
C# Iterator interface
using System.Collections.Generic;
namespace CollectionsExtensions
{
public static class EnumerableExtensions
{
/// <summary>
/// Provides an extension method that gets an iterator for
/// IEnumerables. This makes it as easy to get an iterator as it
/// is to get an enumerator.
@michaelgwelch
michaelgwelch / main.hs
Created March 10, 2012 19:47
Easy way to generate a random number in ghci
let rand = randomRIO (0,100);
-- or just type "randomRIO (lo, hi)"
@michaelgwelch
michaelgwelch / link_story2.user.js
Created March 24, 2012 16:13
A greasemonkey script that creates a link from commit to story on pivotal tracker
@michaelgwelch
michaelgwelch / Predicate.swift
Created June 5, 2014 20:28
Swift Programming Language (Apple) Predicate<T>
class Predicate<T> {
let pred:(T) -> Bool
init(pred:(T) -> Bool) {
self.pred = pred
}
subscript(input:T) -> Bool {
get {
return pred(input)
}
}
@michaelgwelch
michaelgwelch / combinations.swift
Last active August 29, 2015 14:08
Producing Combinations in Swift based on Eric Lippert's post
// Producing combinations
// Porting Eric Lippert's code to Swift
// http://ericlippert.com/2014/10/13/producing-combinations-part-one/
import Cocoa
public class ImmutableStack<T> {
public func push(t:T) -> ImmutableStack<T> {
return NonEmptyStack(top: t, tail: self)
@michaelgwelch
michaelgwelch / .gitattributes
Created December 1, 2020 23:32
Git attributes with lfs tracking turned off
# all lfs tracking turned off
# Documents
*.bibtex text diff=bibtex
*.md text
*.tex text diff=tex
*.adoc text
*.textile text
*.mustache text
*.csv text
@michaelgwelch
michaelgwelch / docs.md
Last active July 16, 2021 17:46
powershell syntax highlighting?

This is a test to see if powershell has syntax highlighting

$update = @{
item = @{
description = "hello"
}
}
{
"items": {
"defaultAttribute": "attributeEnumSet.presentValue"
},
"schema": {
"type": "object",
"$schema": "http://json-schema.org/draft-07/schema#",
"language": "en-US",
"title": "JCI BV",
"version": "1.0",
@michaelgwelch
michaelgwelch / Group1-Op1.js
Created July 29, 2021 19:25
Multi-file tests for one group
function tests() {
describe('Op1', function () {
it('tests op1', function () {});
});
}
module.exports = tests;
@michaelgwelch
michaelgwelch / yaml-primer.md
Created February 28, 2024 18:43
Quick Primer on YAML for JSON users

Quick YAML Primer for JSON Users

You can think of YAML as a superset of JSON. Any JSON document can be easily converted to YAML.

The JSON types are

  • null
  • boolean
  • number