Skip to content

Instantly share code, notes, and snippets.

import Data.Vect
import Data.Fin
-- Start by representing our universe as a product type.
data Ty = TyInt | TyBool | TyFun Ty Ty
interpret : Ty -> Type
interpret TyInt = Int
interpret TyBool = Bool
interpret (TyFun A T) = interpret A -> interpret T
@jeremy-w
jeremy-w / RSLRandomValueObject.h
Created April 3, 2015 15:34
AppCode can generate all you need for a value object. Wow.
#import <Foundation/Foundation.h>
@interface RSLRandomValueObject : NSObject<NSCopying, NSCoding>
/* The @property bits are the only code I wrote. */
@property(copy) NSString *name;
@property NSNumber *someNumber;
@property BOOL supYo;
/* Everything else in here and the implementation file
* was generate by AppCode, either by the New File
@jeremy-w
jeremy-w / Notes on Higbee's Your Memory.md
Created March 29, 2015 23:47
Notes on Higbee's *Your Memory*.

Your Memory

Paragon House 1/e 1993 hardcover

by Higbee

Notes by Jeremy W. Sherman, March 2011.

set-option -g prefix C-e
unbind-key C-e
bind-key C-e send-prefix
set-window-option -g mode-keys vi
# Fix weirdness with OS X bootstrap namespaces and daemon.
# See https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard for details.
set-option -g default-command "reattach-to-user-namespace -l zsh"

Keybase proof

I hereby claim:

  • I am jeremy-w on github.
  • I am jws (https://keybase.io/jws) on keybase.
  • I have a public key whose fingerprint is D160 F4D7 9492 A094 48ED F227 DF87 8DEB 3A74 C49F

To claim this, I am signing this object:

@jeremy-w
jeremy-w / rot13.swift
Created August 4, 2014 21:36
Demonstrates rot13 in Swift with non-[A-Z][a-z] pass-through.
import Cocoa
var input = "This is a test"
var expected = "Guvf vf n grfg"
/// Advances `i` by `by` through `string`, wrapping to start on hitting
/// end.
/// NOTE: `by` must be non-negative.
func wrappingAdvance(string: String, i: String.Index, by: Int)
-> String.Index {
@jeremy-w
jeremy-w / bitmask.m
Last active August 29, 2015 13:57
Beware truncation when testing option bits or other bitmasks. Also: Why _Bool is better than BOOL.
//cc -Weverything -fobjc-arc -framework Foundation bitmask.m -o bitmask
/** @file bitmask.m
* @author Jeremy W. Sherman (@jeremy-w on Github)
* @license ISC (http://opensource.org/licenses/isc-license.txt)
*
* Provides an example where assignment of the result of a naive bitmask check
* to BOOL fails.
*
* Demonstrates 2 ways to avoid this issue.
*

What Are OKRs?

Jeremy W. Sherman. January 2013.

OKR = Objectives & Key Results

  • 3-5 objectives, or high-level, measurable goals
  • 2-3 key results per objective, plus one "stretch" result.
  • Should not be able to achieve ALL goals/results; you need to stretch yourself.

7Geese

@jeremy-w
jeremy-w / demo.hs
Created February 10, 2014 01:18
Euterpea demo. Use this to verify your install is working. To install Euterpea under OS X, see: https://jeremywsherman.com/blog/2014/02/09/installing-and-using-euterpea-under-os-x-10-dot-9/
import Euterpea.Music.Note.Music
import Euterpea.IO.MIDI.ToMidi
-- Writes |test.mid| in the current directory.
main = test chord
where chord = foldl1 (:=:) $ map (note 1.0) pitches
pitches = [(Fs, o), (As, o), (Cs, o + 1), (Fs, o + 1)]
o = 6::Int
@jeremy-w
jeremy-w / markdownify-alpha.js
Last active January 3, 2016 07:19
User script to Markdownify text in ADN Alpha. Oddly, I seem to have to launch it and hit Run to have it actually run on the page just now. :\
// ==UserScript==
// @id com.jeremywsherman.adn-alpha-markdown
// @name Styled Markdown Text for ADN Alpha
// @version 1.0
// @namespace com.jeremywsherman
// @author Jeremy W. Sherman
// @description Recognizes and fontifies **bold**, *italics*, and `code` in ADN posts.
// @include https://alpha.app.net/
// @run-at document-end
// @grant GM_xpath