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 abstract class Hole | |
{ | |
public static readonly float LineWidth = 2f; | |
protected Hole(int radius) | |
{ | |
Radius = radius; | |
} | |
public PointF Point { get; set; } |
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
using System; | |
enum Direction { N, S, E, W} | |
static class X { | |
public static double NominalDirectionInRadians(this Direction d) | |
{ | |
var idx = (int)d; | |
var directionCount = Enum.GetNames (typeof(Direction)).Length; | |
var pct = (double) idx / directionCount; |
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
### Keybase proof | |
I hereby claim: | |
* I am lobrien on github. | |
* I am lobrien (https://keybase.io/lobrien) on keybase. | |
* I have a public key whose fingerprint is E928 7FF1 AD56 4639 010F 50D2 A95D 15EA EBBE D5BD | |
To claim this, I am signing this object: |
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
string output = ""; | |
bool reset = false; | |
int input = 15; | |
public override void ViewDidLoad () | |
{ | |
base.ViewDidLoad (); | |
// Perform any additional setup after loading the view, typically from a nib. | |
/* |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using MonoTouch.Foundation; | |
using MonoTouch.UIKit; | |
using System.Drawing; | |
using MonoTouch.CoreGraphics; | |
using MonoTouch.CoreAnimation; | |
using MonoTouch.AVFoundation; |
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 static double[,] ToRangePlusOrMinusOne(this byte[,] self) | |
{ | |
var ySize = self.GetLength(1); | |
var xSize = self.GetLength(0); | |
var dArr = new double[ySize, xSize]; | |
for(var y = 0; y < ySize; y++) | |
{ | |
for(var x = 0; x < xSize; x++) | |
{ |
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
var map = new MKMapView(); | |
var ctr = new CLLocationCoordinate2D(37.8, -122.4); | |
map.SetCenterCoordinate(ctr, false); | |
map.SetRegion(new MKCoordinateRegion(ctr, new MKCoordinateSpan(0.025, 0.025)), false); | |
Console.WriteLine("Center coordinate is still NaN: " + map.CenterCoordinate.Latitude.ToString()); | |
/* | |
Error: NaN Lat & Long var | |
circle = MKCircle.Circle(map.CenterCoordinate, 100); |
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
var ss = new AVSpeechSynthesizer(); | |
foreach(var voice in AVSpeechSynthesisVoice.GetSpeechVoices()) | |
{ | |
var su = new AVSpeechUtterance("Microphone check. One, two, one two.") { | |
Rate = AVSpeechUtterance.DefaultSpeechRate, | |
Voice = voice | |
}; | |
ss.SpeakUtterance(su); | |
} |
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
let GetAsync(url : string, i : int) = | |
async { | |
let req = WebRequest.Create(url) | |
let! rsp = req.AsyncGetResponse() | |
use stream = (rsp :?> HttpWebResponse).GetResponseStream() | |
use zip = new GZipStream(stream, CompressionMode.Decompress) | |
use reader = new StreamReader(zip) | |
Console.WriteLine("Received page " + i.ToString()) | |
return reader.ReadToEnd() | |
} |
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 override void TouchesBegan(NSSet touches, UIEvent evt) | |
{ | |
var addressString = "2 Park Plaza, Boston, MA, USA 02116"; | |
var geocoder = new CLGeocoder(); | |
geocoder.GeocodeAddress(addressString, (addresses, error) => { | |
foreach(var address in addresses) | |
{ | |
Console.WriteLine(address); | |
} |
OlderNewer