Skip to content

Instantly share code, notes, and snippets.

Avatar
🙀
Screaming At Clouds

Nic Wise nicwise

🙀
Screaming At Clouds
View GitHub Profile
View edgerouter-l2tp-vpn
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 Mar 18, 2014
Expandable Date Element for MT.D
View gist:9629210
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 Oct 17, 2013
using async/await and a task completion source to work with NavigationController etc.
View gist:7026601
//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 Oct 16, 2013
Cell which has the image view moved to the top.
View topimagetableviewcell.cs
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
View gist:6617756
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);
View btentryelement.cs
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 Jul 26, 2013
Crashes the Mono 3.2.0 compiler
View crash compiler
public class MainThing
{
public static void Main(string[] args)
{
var foo = new Foo();
foo.Die();
}
}
public class Foo
View gist:6053850
@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 Dec 18, 2015
Getting the UDID even tho Xamarin removed it
View gist:5772980
var foo = UIDevice.CurrentDevice.UniqueIdentifier;
var bar = UDID ();
Console.WriteLine (foo + "////" + bar);
return true;
}
public string UDID()
View dbserialisation.cs
public class FeedStorage
{
public FeedStorage()
{
GroupStoryChildIdList = "";
}
[PrimaryKey]
public string Id { get; set; }
public DateTime FeedItemDateTime { get; set; }
public string ItemType { get; set; }