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
| //Swift 2.0 | |
| import UIKit | |
| protocol SomethingDelegate { | |
| func didUpdateSomething(SomethingHelper:SomethingHelper) | |
| } | |
| class SomethingHelper { | |
| private var timer : dispatch_source_t! = nil | |
| private var currentIntervalInSec = 0; | |
| var delegate: SomethingDelegate? |
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
| import UIKit | |
| protocol SomethingDelegate { | |
| func didUpdateSomething(SomethingHelper:SomethingHelper) | |
| } | |
| // Use CADisplayLink for more "averaged" timer interval | |
| class SomethingHelper : NSObject{ | |
| private var timer : CADisplayLink! | |
| private var currentIntervalInSec = 0; | |
| var delegate: SomethingDelegate? |
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 NetTopologySuite.Geometries; | |
| using GeoAPI.Geometries; | |
| // Not sure SRID is respected or not. because their doc says obsolete | |
| namespace NetTopologySuiteTest { | |
| class MainClass { | |
| public static void Main (string[] args) { | |
| // Check Intersection of Brooklyn Street or not |
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 NetTopologySuite.Geometries; | |
| using GeoAPI.Geometries; | |
| /* | |
| this looks wrong. SRID is not used? | |
| Edge (West-East) of Central Park: 0.00906435667878181 | |
| Margin Distance of Central Park: 0.0983743244869002 | |
| Central Park Area: 0.000354214827500022 | |
| */ | |
| namespace NetTopologySuiteTest { |
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 System.Text; | |
| using System.Threading.Tasks; | |
| using System.Device.Location; // Add Reference | |
| namespace DistanceAreaDemo | |
| { | |
| class Program { |
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; | |
| namespace DistanceAreaCalc { | |
| class GeoCoordinate{ | |
| public double Longitude; | |
| public double Latitude; | |
| public GeoCoordinate(double lat, double lng) { | |
| this.Latitude = lat; | |
| this.Longitude = lng; | |
| } |
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
| // Converted from http://tubalmartin.github.io/spherical-geometry-php/ | |
| // Test results look same but doesn't look like what google map does. | |
| // Don't assume it's perfect. | |
| /* | |
| var poly = new List<LatLng> { | |
| new LatLng(47.9899216674142,61.171875), | |
| new LatLng(50.2893392532918,68.90625), | |
| new LatLng(52.9089020477703,78.046875), | |
| new LatLng(56.5594824837622,95.625), | |
| new LatLng(45.5832897560063,93.515625), |
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
| <%@ Import Namespace="System"%> | |
| <%@ Import Namespace="System.IO"%> | |
| <%@ Import Namespace="System.Net"%> | |
| <%@ Import NameSpace="System.Web"%> | |
| <Script language="C#" runat=server> | |
| /* | |
| //Test code | |
| byte[] responseArray = myWebClient.UploadFile(uriString,fileName); | |
| Console.WriteLine("{0}",System.Text.Encoding.ASCII.GetString(responseArray)); | |
| // ... or simple curl |
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 Windows.UI; | |
| using System.Reflection; | |
| //... | |
| foreach (var propertyInfo in typeof(Windows.UI.Colors).GetProperties()) { | |
| //propertyInfo.Name | |
| Color col = (Windows.UI.Color)propertyInfo.GetValue(this, null); | |
| } |
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 Windows.UI | |
| class ColorUtil { | |
| // ColorUtil.FromHex("#FFAABBCC") | |
| public static Color FromHex(string hexStr) { | |
| hexStr = hexStr.Replace("#", ""); | |
| return Color.FromArgb( | |
| (byte)Convert.ToInt32(hexStr.Substring(0, 2), 16), | |
| (byte)Convert.ToInt32(hexStr.Substring(2, 2), 16), | |
| (byte)Convert.ToInt32(hexStr.Substring(4, 2), 16), | |
| (byte)Convert.ToInt32(hexStr.Substring(6, 2), 16)); |