Skip to content

Instantly share code, notes, and snippets.

View shanecelis's full-sized avatar

Shane Celis shanecelis

View GitHub Profile
@shanecelis
shanecelis / CLILikeParser.cs
Last active January 6, 2018 13:14
A little parser that handles escaping, single-, and double-quotes.
/* Original code Copyright (c) 2018 Shane Celis[1]
Licensed under the MIT License[2]
Original code posted here[3].
This comment generated by code-cite[4].
[1]: https://github.com/shanecelis
[2]: https://opensource.org/licenses/MIT
[3]: https://gist.github.com/shanecelis/55d2d888cf57ab8ef0a3432456953281
@shanecelis
shanecelis / version-substitute
Last active January 5, 2018 15:18
Substitute tags generated from git for versioning purposes
#!/bin/bash
# Original code Copyright (c) 2018 Shane Celis[1]
# Licensed under the MIT License[2]
#
# Original code posted here[3].
#
# This comment generated by code-cite[4].
#
# [1]: https://github.com/shanecelis
# [2]: https://opensource.org/licenses/MIT
@shanecelis
shanecelis / QueueProxy.cs
Last active November 25, 2017 20:36
Substitute a function deep in the belly of the beast for this proxy when you need to.
/* Original code Copyright (c) 2017 Shane Celis[1]
Licensed under the MIT License[2]
Original code posted here[3].
This comment generated by code-cite[4].
[1]: https://github.com/shanecelis
[2]: https://opensource.org/licenses/MIT
[3]: https://gist.github.com/shanecelis/e5d76ead850df257f11a679920a5d851
@shanecelis
shanecelis / SimpleGA.cs
Created November 17, 2017 14:27
Playing around with some genetic algorithms.
/*
Copyright (c) 2017 Shane Celis
Just playing around with some genetic algorithms.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
@shanecelis
shanecelis / crop-component.rb
Last active August 20, 2017 10:47
Takes a screenshot of a inspector window from Unity and crops out the largest component. Useful for generating images for documentation. Like so: https://twitter.com/shanecelis/status/899218702805209088
#!/opt/local/bin/ruby1.8
#
# crop-component
#
# Takes a screenshot of a inspector window from Unity and crops out the largest
# component. Useful for generating documentation.
#
# Original code Copyright (c) 2017 Shane Celis[1]
# Licensed under the MIT License[2]
Will be here soon.
@shanecelis
shanecelis / Resize Unity Window.scpt
Last active April 12, 2017 23:24
Resize Unity game window to specified size modulo its header
-- Resize Unity Game Window to specified size modulo its header
--
-- Modified by Shane Celis @shanecelis based off Paul Calnan's script:
-- http://www.paulcalnan.com/archives/2014/10/quicktime-screen-recording-of-a-single-window.html
-- clickdrag gist at https://gist.github.com/shanecelis/f0754fbd7d9126b18f83966cd538567b
-- XXX Set Unity's desired size here:
set desiredSize to {300, 300}
set theProcessName to "Unity"
@shanecelis
shanecelis / GetMethodGeneric.cs
Created February 21, 2017 21:58
Search for a method based on generic arguments in addition to name and parameters.
/**
Search for a method based on generic arguments in addition to name and
parameters. Most useful for disambiguating methods with the same name.
If the elements of genericArgs are not null, it will return the specialized
generic method. Otherwise it will return the generic method definition.
Finally, if genericArgs has no elements, it will return a non-generic
method. If no method is found, it will return null.
e.g. Suppose I had the following methods in a class Minibuffer:
@shanecelis
shanecelis / is-prime.shen
Last active February 16, 2017 05:07 — forked from deech/is-prime.shen
(datatype is-prime
if (is-prime? N)
N : number;
==============
N : prime;)
(define is-prime?
2 -> true
X -> (prime* X (/ X 2) 2) where (number? X)
_ -> false)
#!/usr/bin/env xcrun swift
// ~/bin/clickdrag -x 10 -y 20 -dx 200 -dy 100
// http://www.paulcalnan.com/archives/2014/10/quicktime-screen-recording-of-a-single-window.html
import Foundation
let kDelayUSec : useconds_t = 500_000
func DragMouse(from p0: CGPoint, to p1: CGPoint) {
let mouseDown = CGEvent.init(mouseEventSource:nil,
mouseType:.leftMouseDown,