This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private IObservable<string[]> DictionaryLookup(string key) | |
{ | |
... | |
} | |
private string FormatAsHtml(string[] results) | |
{ | |
... | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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. | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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 |
OlderNewer