Skip to content

Instantly share code, notes, and snippets.

View nicwise's full-sized avatar
🙀
Screaming At Clouds

Nic Wise nicwise

🙀
Screaming At Clouds
View GitHub Profile
import honeycomb from 'honeycomb-beeline';
import {config} from '../config';
if (config.enableHoneycomb && !config.isServerlessOffline) {
honeycomb({
writeKey: config.honeycombWriteKey,
dataset: config.honeycombDataset,
serviceName: config.honeycombServiceName,
transmission: 'stdout',
set vpn l2tp remote-access authentication mode local
set vpn l2tp remote-access authentication local-users username <username> password <password>
set vpn l2tp remote-access client-ip-pool start 10.0.3.10
set vpn l2tp remote-access client-ip-pool stop 10.0.3.20
set vpn l2tp remote-access dns-servers server-1 10.0.0.1
set vpn l2tp remote-access ipsec-settings authentication mode pre-shared-secret
set vpn l2tp remote-access ipsec-settings authentication pre-shared-secret <secret>
set vpn l2tp remote-access ipsec-settings ike-lifetime 3600
@nicwise
nicwise / gist:9629210
Created March 18, 2014 20:46
Expandable Date Element for MT.D
using System;
using MonoTouch.Dialog;
using MonoTouch.UIKit;
using System.Drawing;
using MonoTouch.Foundation;
using System.Collections.Generic;
using System.Globalization;
namespace TravelBudget
{
@nicwise
nicwise / gist:7026601
Created October 17, 2013 15:07
using async/await and a task completion source to work with NavigationController etc.
//start with DoAdd, which comes off a button push.
// it does pop up one screen, then another one, which is not ideal,
// but it wouldn't be hard to adapt.
async void DoAdd ()
{
var camera = await PickCameraForLoad ();
if (camera != null)
{
@nicwise
nicwise / topimagetableviewcell.cs
Created October 16, 2013 23:26
Cell which has the image view moved to the top.
using System;
using MonoTouch.Dialog;
using MonoTouch.UIKit;
using MonoTouch.Foundation;
using MonoTouch.CoreFoundation;
using MicroAgent.Common;
using System.Drawing;
namespace MicroAgent.Library
{
public class BTMultilineDeadlineElement : ImageStringElement, IElementSizing
public static UIColor ToUIColor(this string hexString)
{
if (hexString.Contains("#")) hexString = hexString.Replace("#", "");
if (hexString.Length != 6) return UIColor.Red;
int red = Int32.Parse(hexString.Substring(0,2), System.Globalization.NumberStyles.AllowHexSpecifier);
int green = Int32.Parse(hexString.Substring(2,2), System.Globalization.NumberStyles.AllowHexSpecifier);
int blue = Int32.Parse(hexString.Substring(4,2), System.Globalization.NumberStyles.AllowHexSpecifier);
public class BTEntryElement : EntryElement, IFocusable
{
public static string key = "BTEntryElement";
public event EventHandler Changed;
public BTEntryElement (string caption, string placeholder, string @value) : base (caption, placeholder, @value)
{
}
@nicwise
nicwise / crash compiler
Created July 26, 2013 16:55
Crashes the Mono 3.2.0 compiler
public class MainThing
{
public static void Main(string[] args)
{
var foo = new Foo();
foo.Die();
}
}
public class Foo
@laumania
I'm having a bit of trouble following the thread (might be to do with it being 36deg outside and I've just done a Bikram Yoga class in a 41deg + humid room, so my body is a bit in shock!)
In general, you can't (or shouldn't) have a UITabBarController inside... well, anything. It needs to be the top, so:
UITabBarController
+ UINavigationController
@nicwise
nicwise / gist:5772980
Last active December 18, 2015 11:08
Getting the UDID even tho Xamarin removed it
var foo = UIDevice.CurrentDevice.UniqueIdentifier;
var bar = UDID ();
Console.WriteLine (foo + "////" + bar);
return true;
}
public string UDID()