This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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); | |
} |
This file contains hidden or 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(); | |
var taskCoding = geocoder.GeocodeAddressAsync(addressString); | |
taskCoding.ContinueWith((addresses) => { | |
Console.WriteLine("Continuation"); | |
foreach(var address in addresses.Result) | |
{ | |
Console.WriteLine(address); |
This file contains hidden or 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; | |
namespace SingleFileTableViewSolution | |
{ |
This file contains hidden or 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 hidden or 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; |
OlderNewer