Skip to content

Instantly share code, notes, and snippets.

View kianryan's full-sized avatar

Kian Ryan kianryan

View GitHub Profile
@kianryan
kianryan / geocoding.cs
Last active December 22, 2015 21:59
Google Geocoding Example API v3
public void GoogleGeoCode(string address, out double lat, out double lon)
{
string url = "http://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=" + address;
var req = (HttpWebRequest)WebRequest.Create(url);
var reader = new StreamReader(req.GetResponse().GetResponseStream());
var body = reader.ReadToEnd();
lat = double.Parse(Regex.Match(body, @"""lat\"" : ([\d\.]+)").Groups[1].Value);
@kianryan
kianryan / headerfooter.html
Created August 21, 2013 17:05
CSS/HTML Header Footer Demo
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Test2</title>
<style type="text/css" media="all">
div.page {
@kianryan
kianryan / soapclient_debug
Created July 15, 2013 13:55
SOAPClient Debug
echo "====== REQUEST HEADERS =====" . PHP_EOL;
var_dump($client->__getLastRequestHeaders());
echo "========= REQUEST ==========" . PHP_EOL;
var_dump($client->__getLastRequest());
echo "========= RESPONSE =========" . PHP_EOL;
var_dump($response);
@kianryan
kianryan / gist:3424744
Created August 22, 2012 11:43
WTF Twitter
C:\Users\kian>tracert www.twitter.com
Tracing route to twitter.com [199.59.148.10]
over a maximum of 30 hops:
1 <1 ms <1 ms <1 ms 172.16.155.2
2 * * * Request timed out.
3 * * * Request timed out.
4 * ^C
@kianryan
kianryan / gist:2695573
Created May 14, 2012 18:38
Replacing MBUnit tests with XUnit tests - some regexs.
Assert.Equal\({.+}, {.+}, .+\);
Assert.Equal(\1, \2);
Assert.NotNull\({.+}, .+\);
Assert.NotNull(\1);
Assert.GreaterThan\({.+}, {.+}\);
Assert.True(\1 > \2);
--
@kianryan
kianryan / gist:2157669
Created March 22, 2012 10:56
Attempting to circumvent the 4ms setTimeout restriction
var ts = new Date();
var diff = 0;
var count = 0;
var callMe = function() {
var localTs = new Date();
diff = localTs.getTime() - ts.getTime();
ts = localTs;
console.log('Diff:' + diff);