Skip to content

Instantly share code, notes, and snippets.

@kylewlacy
kylewlacy / LICENSE.txt
Last active August 29, 2015 14:13
MinTest - A bare-bones testing "library" for C (based on MinUnit)
Copyright (c) 2015 Kyle Lacy
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
@kylewlacy
kylewlacy / mvim.patch
Created July 10, 2012 02:39
mvim - Better Clientserver Management
--- src/MacVim/mvim 2012-07-09 19:52:34.000000000 -0700
+++ /usr/local/bin/mvim 2012-07-11 04:12:00.000000000 -0700
@@ -61,7 +61,30 @@
# The program should fork by default when started in GUI mode, but it does
# not; we work around this when this script is invoked as "gvim" or "rgview"
# etc., but not when it is invoked as "vim -g".
-if [ "$gui" ]; then
+
+# When we launch mvim with --remote-tab-silent, it won't work if
+# no file is provided. This is a workaround to that.
@kylewlacy
kylewlacy / ponysay.terminal
Created September 3, 2012 04:18
Pony Time! Use with OS X Terminal and Ponysay 2.5.1
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BackgroundBlur</key>
<real>1</real>
<key>BackgroundColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS
AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NGMCAw
@kylewlacy
kylewlacy / micro.js
Created September 29, 2012 19:13
micro.js — A micro Javascript toolkit, for use when you miss the comfort of jQuery in vanilla JS
Element.prototype.$ = function(query) { return this.querySelectorAll(query); };
Window.prototype.$ = function(query) { return document.querySelectorAll(query); };
Element.prototype.attr = function(attribute, value) {
if(value != undefined) { this.setAttribute(attribute, value); }
else { return this.getAttribute(attribute); }
};
Element.prototype.indexWithin = function() {
var nodes = this.parentNode.childNodes;
@kylewlacy
kylewlacy / TwilightSparkle.mdpolicy
Created March 16, 2013 20:39
Good code formatting for Xamarin Studio (which is secretly just MonoDevelop in disguise)
<?xml version="1.0" encoding="utf-8"?>
<PolicySet name="TwilightSparkle.mdpolicy">
<TextStylePolicy inheritsSet="null" scope="text/x-csharp" />
<CSharpFormattingPolicy inheritsSet="Mono" inheritsScope="text/x-csharp" scope="text/x-csharp">
<AlignEmbeddedUsingStatements>False</AlignEmbeddedUsingStatements>
<AlignEmbeddedIfStatements>False</AlignEmbeddedIfStatements>
<NamespaceBraceStyle>EndOfLine</NamespaceBraceStyle>
<ClassBraceStyle>EndOfLine</ClassBraceStyle>
<InterfaceBraceStyle>EndOfLine</InterfaceBraceStyle>
<StructBraceStyle>EndOfLine</StructBraceStyle>
@kylewlacy
kylewlacy / Block.cs
Last active December 15, 2015 04:20
A `Block` class for use with MonoGame/XNA. Provides the verticies and indicies for drawing a BoundingBox using `GraphicsDevice.DrawIndexedPrimitives()`
using System;
using System.Linq;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Graphics;
public class Block {
public BoundingBox Box;
public Color Color;
@kylewlacy
kylewlacy / fizzbuzz
Created June 28, 2013 06:20
Fizzbuzz in FALSE
[$2ø\]d:
[[d;!>][d;!-@%\]#d;!=[%0\]?%]m:
0[1+$101\>][$15m;!0=$["FizzBuzz "]?~[$5m;!0=$["Buzz "]?~[$3m;!0=$["Fizz "]?~[$ . " "]?]?]?]#
@kylewlacy
kylewlacy / subshell.fish
Created June 5, 2016 08:48
fish subshell substitution
# bash:
# # <(some_command) returns a file (technically a named pipe) for the result of some_command
# $ echo <(echo "hi")
# /dev/fd63
# $ cat <(echo "hi")
# hi
#
# fish:
# # (some_command | psub) returns a file for the result of some_command
# $ echo (echo "hi" | psub)
@kylewlacy
kylewlacy / ab.rb
Created November 10, 2012 22:14
Apache Bench Homebrew Formula
# Based on https://github.com/simonair/homebrew-dupes
# That repo seems to be dead, and I don't really feel like making a pull request.
require 'formula'
class Ab < Formula
homepage 'http://httpd.apache.org/docs/trunk/programs/ab.html'
url 'http://www.apache.org/dist/httpd/httpd-2.4.3.tar.bz2'
sha1 '0ef1281bb758add937efe61c345287be2f27f662'
depends_on 'libtool' => :build
@kylewlacy
kylewlacy / README.md
Created October 7, 2012 22:45
Mirroring an SVN Repo to GitHub

Certainly everyone has run into countless projects featured a source code repo that you wanted to clone (to build from source, for example). And certainly some of those repos were SVN-based. Now, if you're like me, you prefer the almighty git to this archaic and decrepit format that coding dinosaurs eons ago once used. So, what do you do? Go to GitHub, search for <project name>, and clone that. But wait, what if you run into a repo that doesn't have a GitHub mirror? What to do? Well, my friend, have you come to the right place:

The De-Facto SVN Mirroring Guide

I'm gonna go out on a limb and assume that you are UNIX-y, so if you am Windows, go here immediately to remedy that. Now then, fire up your terminal emulator, and follow along:

1.) Clone the repo with git as follows: git svn clone <repo url> -T trunk -t tags -b branches <project name> 2.) Add a GitHub repo for the project ('cuz, you know, sharing and whatnot) 3.) cd an