Skip to content

Instantly share code, notes, and snippets.

View gshackles's full-sized avatar

Greg Shackles gshackles

View GitHub Profile
@gshackles
gshackles / CreditCardNumberValueConverter.cs
Created November 19, 2013 03:59
Fun with value converters
public class CreditCardNumberValueConverter : MvxValueConverter
{
public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var builder = new StringBuilder(Regex.Replace(value.ToString(), @"\D", ""));
foreach (var i in Enumerable.Range(0, builder.Length / 4).Reverse())
builder.Insert(4*i + 4, " ");
return builder.ToString().Trim();
Package Manager Console Host Version 2.7.41101.299
Type 'get-help NuGet' to see all available NuGet commands.
PM> install-package Microsoft.AspNet.SignalR.Client
Attempting to resolve dependency 'Newtonsoft.Json (≥ 5.0.0)'.
Attempting to resolve dependency 'Microsoft.Net.Http (≥ 2.1.10)'.
Attempting to resolve dependency 'Microsoft.Bcl (≥ 1.0.19)'.
Attempting to resolve dependency 'Microsoft.Bcl.Build (≥ 1.0.4)'.
Installing 'Newtonsoft.Json 5.0.8'.
@gshackles
gshackles / gist:8428032
Created January 14, 2014 23:29
Hacktastic detection of full screen video playing
/*
* surely there must be a better way?
*
* PresentedViewController.ToString() == "UIViewController"
* PresentedViewController.GetType() == typeof(UIViewController)
* new MonoTouch.ObjCRuntime.Class(PresentedViewController.GetType()).Name == "UIViewController"
*/
public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations(UIApplication application, UIWindow forWindow)
{
bool isFullScreenVideoPlaying = forWindow != null && forWindow.RootViewController != null
@gshackles
gshackles / caviar.js
Created August 30, 2015 19:33
Caviar's Courier Tracking Snippet
var delivery_point = new google.maps.LatLng(redacted, redacted);
var mapOptions = {
auto_zoom: true,
zoom: 13,
center: delivery_point
};
var map = new google.maps.Map(document.getElementById("map"), mapOptions);
var out_for_delivery = false;
var street_address_text = "redacted";
var courier_lat = redacted;
@gshackles
gshackles / parser.js
Last active October 14, 2017 12:35
Code Camp NYC 2017 - Schedule
const schedule = [...document.querySelectorAll("#tablepress-6 tbody tr")]
.map(row => ({
room: row.children[0].innerHTML,
time: row.children[1].innerHTML,
speaker: row.children[2].innerHTML,
title: row.children[3].innerHTML,
level: row.children[4].innerHTML,
abstract: row.children[5].innerHTML
}))
.reduce((slots, session) => Object.assign({}, slots, {

Keybase proof

I hereby claim:

  • I am gshackles on github.
  • I am gshackles (https://keybase.io/gshackles) on keybase.
  • I have a public key ASDl3C0qD3vgysJeXJu2bnPaId9CJt6VUYcABeN9nntibgo

To claim this, I am signing this object:

@gshackles
gshackles / gist:cf7bfba5259c82a80e909e5e0e1aa956
Created August 12, 2017 18:05
Visual Studio version information
=== Visual Studio Enterprise 2017 for Mac (Preview) ===
Version 7.1 Preview (7.1 build 1267)
Installation UUID: 1a760703-fc1a-4e89-af74-74f7b2a746c4
Runtime:
Mono 5.2.0.196 (2017-04/478c04a) (64-bit)
GTK+ 2.24.23 (Raleigh theme)
Package version: 502000196