Skip to content

Instantly share code, notes, and snippets.

View Clancey's full-sized avatar

James Clancey Clancey

View GitHub Profile
@Clancey
Clancey / gist:7610128
Last active December 29, 2015 03:49
Background Downloader. Has the same API as WebClient but uses the underlying NSUrlRequest to download in the background.
public class BackgroundDownload
{
public BackgroundDownload ()
{
}
NSUrlSessionDownloadTask downloadTask;
static NSUrlSession session;
public async Task DownloadFileAsync(Uri url, string destination)
{
if (downloadTask != null)
@Clancey
Clancey / BrightlyBlurredUIView
Last active December 24, 2015 14:59
A brightly colored iOS 7 UIBlurView
using System;
using MonoTouch.UIKit;
using MonoTouch.CoreAnimation;
public class BrightlyBlurredUIView: UIView
{
CALayer blurLayer,accentLayer;
UIView accentView;
UIToolbar toolbar;
public BrightlyBlurredUIView()
@Clancey
Clancey / Layout.cs
Last active December 24, 2015 08:39 — forked from praeclarum/Layout.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using MonoTouch.UIKit;
namespace MonoTouch.UIKit
{
public static class Layout
{
@Clancey
Clancey / gist:6709329
Last active December 23, 2015 23:19
Extension method to add motion to your views. in iOS 7
using System;
using MonoTouch.Foundation;
namespace MonoTouch.UIKit
{
public static class ViewExtensions
{
public static void AddMotion(this UIView view, float min, float max)
{
view.AddMotionEffect ( new UIInterpolatingMotionEffect ("center.x", UIInterpolatingMotionEffectType.TiltAlongHorizontalAxis) {
public static void EnsureInvokedOnMainThread (Action action)
{
if ( NSThread.Current.IsMainThread) {
action ();
return;
}
if (Invoker == null)
Invoker = new NSObject ();
Invoker.BeginInvokeOnMainThread (() =>
action ()
var np = MPNowPlayingInfoCenter.DefaultCenter.NowPlaying;
np.Artist = "WHY YOU NO WORK!";
MPNowPlayingInfoCenter.DefaultCenter.NowPlaying = np;
[{"id":0,"title":"Simple, Fast, Elastic NoSQL with Couchbase Server and Mono","abstract":"Couchbase Server is a simple, fast, and elastic documented-oriented database. It is simple in its document-oriented approach to data modeling, where domain objects may be naturally mapped to their persistence layer. It is simple to monitor and manage in production, elastically allowing administrators to add and remove nodes to a cluster at any time, without downtime. Couchbase Server is fast thanks to its actively managed cache, compatible with (and built upon) memcached. Indexing, analytics and other advanced ways of managing data in a Couchbase cluster are easily available through the definition of incremental Map/Reduce views.","speakers":[{"id":9,"name":"John Zablocki","twitterHandle":"codevoyeur","bio":"John Zablocki is a Developer Advocate at Couchbase, where he is responsible for developing the Couchbase Client Library for .NET. He is the organizer of Beantown ALT.NET , a former adjunct at Fairfield University, an
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -Wl,-no_pie -miphoneos-version-min=3.2 -gdwarf-2 -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk /var/folders/8f/tp4hgv994f1g8lxg263npqyr0000gn/T/tmpadc7035.tmp/MonkeyBox.exe.armv7.o /var/folders/8f/tp4hgv994f1g8lxg263npqyr0000gn/T/tmpadc7035.tmp/System.dll.armv7.o /var/folders/8f/tp4hgv994f1g8lxg263npqyr0000gn/T/tmpadc7035.tmp/System.Core.dll.armv7.o /var/folders/8f/tp4hgv994f1g8lxg263npqyr0000gn/T/tmpadc7035.tmp/DropBoxSync.iOS.dll.armv7.o /var/folders/8f/tp4hgv994f1g8lxg263npqyr0000gn/T/tmpadc7035.tmp/monotouch.dll.armv7.o /var/folders/8f/tp4hgv994f1g8lxg263npqyr0000gn/T/tmpadc7035.tmp/mscorlib.dll.armv7.o /Users/Clancey/Projects/MonkeyBox/MonkeyBox/obj/iPhone/Debug/mtouch-cache/main.armv7.cache.M4Tbubd0PLhjLjnMDe7sZokp2CY=.o /Users/Clancey/Projects/MonkeyBox/MonkeyBox/obj/iPhone/Debug/mtouch-cache/registrar.armv7.cache.CCTp41xiJQ8ForIg
string content = "fdfsdfs";
var renderer = new ZXing.Rendering.BitmapRenderer ();
var writer = new ZXing.QrCode.QRCodeWriter ();
var matrix = writer.encode (content,ZXing.BarcodeFormat.QR_CODE, (int)view.Width, (int)view.Height);
var image = renderer.Render (matrix, ZXing.BarcodeFormat.QR_CODE, content);
@Clancey
Clancey / ParseHelper
Last active December 18, 2015 04:08
Parse helper class
/* Sample object
public class EventModel
{
[DataMember(Name = "description")]
public string Description {get;set;}
[DataMember(Name = "endTime")]
public DateTime EndTime {get;set;}