Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am zaphar on github.
  • I am zaphar (https://keybase.io/zaphar) on keybase.
  • I have a public key whose fingerprint is D1BF 2567 A7BD 9D4F DC42 7098 CF12 F443 24EC CE86

To claim this, I am signing this object:

++ showbadcode
|= [code=tape]
=+ ^= result
(mule |.((slap !>(.) (ream (crip code)))))
?: ?=(%.y -.result)
=+ good=p.result :: successful!
;code
;pre: {code}
;pre: product => {<good>}
;pre: result => {~(ram re (sell good))}
@zaphar
zaphar / gist:1adc8d461097c52ff32f
Created June 9, 2015 02:18
Hoon type fail example
|%
++ showcode :: This works as expected.
|= [code=tape]
;code
;pre: {code}
;pre: {<.*(~ (make (crip code)))>}
==
++ newline :: This works as expected.
|* [a=tape b=tape]
;: welp
@zaphar
zaphar / gist:331a9e8d47e08b12a1b5
Last active August 29, 2015 14:22
Tutorial on Hoon subject modification.
::
:: Hoon Tutorial 1
::
:: {<(func arg1 arg2)>} forces the result inta a hoon representation.
:: {(func arg1 arg2)} Does no casting just interpolates the value in.
:: {value} when you aren't calling a function then don't use the parens.
::
::::::
::
::
::
:: Sail Tricks
::::::
::
::
/? 310
::
|%
++ newlines
|* [a=tape b=tape]
@zaphar
zaphar / flags.cs
Created November 17, 2014 20:11
C# command line parsing library that doesn't suck.
// Heavily inspired by golang's flags library https://golang.org/pkg/flag/
using System;
using System.Linq;
using System.Collections.Generic;
namespace mzhs.flags
{
/// <summary>
/// The interface a CommandLine Flag must support to be used by the command line parser.
/// </summary>
@zaphar
zaphar / requirejs-shim-polymer-element
Last active December 23, 2015 02:09
A polymer custom element that can load requirejs modules. You may have to modify the paths to suite your setup.
<polymer-element name="require-js" attributes="libnames event">
<script>
(function() {
// Helper function to add a script.
var addScript = function(src) {
var script = document.createElement('script');
script.src = src;
var s = document.querySelector('script');
s.parentNode.insertBefore(script, s);
return script;
@zaphar
zaphar / graph.clj
Created January 16, 2012 21:44 — forked from artdent/graph.clj
Ways by node
(defn collect-ways-by-node [ways]
(reduce (fn [m m2] (merge-with #(concat %1 %2) m1 m2))
(for [way ways]
(for [id (:nodes way)]
(hash-map (:id way) [id])))))
/*
go-tap is a simple Test Anything Protocol unittest framework for Golang.
package main
import "tap"
type MyTest struct {}
func (t *MyTest)Tests() [] []func(*tap.Recorder) {
@zaphar
zaphar / videocopy.hs
Created May 18, 2011 05:28
A simple haskell script to copy movie files from a directory to a storage area
#!/usr/bin/env runhaskell
import System.Directory
import Data.Char
import Data.Monoid
import Data.Maybe
import System.IO
import System (getArgs)
import Text.Printf