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',
using System;
using MonoTouch.AssetsLibrary;
using MonoTouch.Foundation;
namespace BigTed
{
public class ImageLibraryUtils
{
private ALAssetsLibrary assetsLibrary;
public ImageLibraryUtils()
@nicwise
nicwise / PDFUtils.cs
Created April 23, 2013 12:32
PDF download and viewing - Xamarin.iOS
using System;
using System.IO;
using System.Threading.Tasks;
using MonoTouch.UIKit;
using MonoTouch.QuickLook;
using System.Net;
using MonoTouch.Foundation;
using System.Security.Cryptography;
using System.Text;
@nicwise
nicwise / scale.cs
Last active November 13, 2018 08:17
Scale and Rotate an image in iOS / MonoTouch, using the EXIF data
//MIT license
public static UIImage ScaleImage(UIImage image, int maxSize)
{
UIImage res;
using (CGImage imageRef = image.CGImage)
{
CGImageAlphaInfo alphaInfo = imageRef.AlphaInfo;
public class FeedStorage
{
public FeedStorage()
{
GroupStoryChildIdList = "";
}
[PrimaryKey]
public string Id { get; set; }
public DateTime FeedItemDateTime { get; set; }
public string ItemType { get; set; }
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: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)
{
}