Skip to content

Instantly share code, notes, and snippets.

View adamhill's full-sized avatar

Adam Hill adamhill

View GitHub Profile
@gus
gus / index.txt
Created November 30, 2009 21:55 — forked from toothrot/index.txt
Ruby/Clojure analogs
For each Ruby module/class, we have Ruby methods on the left and the equivalent
Clojure functions and/or relevant notes are on the right.
For clojure functions, symbols indicate existing method definitions, in the
clojure namespace if none is explicitly given. clojure.contrib.*/* functions can
be obtained from http://github.com/kevinoneill/clojure-contrib/tree/master,
ruby-to-clojure.*/* functions can be obtained from the source files in this
gist.
If no method symbol is given, we use the following notation:
public class ImageElement : Element {
// The original ImageElement didn't scale the picture that was displayed as the thumbnail properly
// this code probably needs lots of refactoring but I needed a quick solution.
public UIImage Value;
static RectangleF rect = new RectangleF (0, 0, dimx, dimy);
static NSString ikey = new NSString ("ikey");
UIImage scaled;
// Apple leaks this one, so share across all.
private IObservable<string[]> DictionaryLookup(string key)
{
...
}
private string FormatAsHtml(string[] results)
{
...
}
load_assembly 'System.Core'
load_assembly 'System.CoreEx, Version=1.0.2521.104, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
load_assembly 'System.Reactive, Version=1.0.2521.104, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
using_clr_extensions System
using_clr_extensions System::Linq
include System
include System::Linq
load_assembly 'System.Core'
load_assembly 'WindowsBase'
load_assembly 'PresentationCore'
load_assembly 'PresentationFramework'
load_assembly 'System.Xaml'
load_assembly 'System.CoreEx'
load_assembly 'System.Reactive'
include System
include System::Linq
@bamboo
bamboo / DeepProfilingAttribute.boo
Created January 19, 2011 20:12
Wraps every method with Profiler.BeginSample/Profiler.EndSample calls.
import Boo.Lang.Compiler
import Boo.Lang.Compiler.Ast
class DeepProfilingAttribute(AbstractAstAttribute):
"""
Wraps every method with Profiler.BeginSample/Profiler.EndSample calls.
Save it to the Plugins folder of your Unity project and enable it on a per script basis using:
@script DeepProfiling()
@grumpydev
grumpydev / RxAsyncTesting.cs
Created January 28, 2011 13:26
Using Rx to help Async testing
// The class under test (a "device") has one background thread which monitors the (fake) serial port for incoming
// data and places it on a queue for a second background thread to pickup, process and respond to.
//
// Normally I'd have to test this with Thread.Sleep, which is not only ugly, but also slows down every test as the
// sleep time would have to be long enough so machines under heavy load didn't fail.
//
// With Rx I can setup an observable on my fake serial port "Data Written" event and tell it to wait up to 5 seconds
// to receive and event of the correct type. Then I can simply pull those chunks of data out of the enumerable
// it produces and assert on them as normal.
//
@mminer
mminer / Console.cs
Last active March 28, 2024 22:23
Unity script to display in-game debug console. Actively maintained version: https://github.com/mminer/consolation
// NOTE: For an actively-maintained version of this script, see https://github.com/mminer/consolation.
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// A console to display Unity's debug logs in-game.
/// </summary>
public class Console : MonoBehaviour
{
@mattflo
mattflo / MapKata.txt
Created June 28, 2011 18:08
Map Kata
Map Kata
========
* Given a simple grid, e.g. 10x10
* Given a game piece is placed somewhere on the grid, e.g. 5,5
* Given the piece canNOT be moved diagonally, e.g. one up, one left...
* Find all available squares to which the piece can move
** 1 move
** 2 moves
** etc...
** until you are thrilled with your solution or ready for something new
@damionjunk
damionjunk / gist:1500336
Created December 20, 2011 05:02
Binaural Beats with Overtone and Clojure
(ns overtone-clj-toys.binaural
(:use [overtone.live]))
;;
;; Binaural Beat Synthesis:
;; Generates binaural beats given the provided carrier and desired
;; frequency. Brown noise is used to soften the background and
;; block out outside noise.
;; freq effect