Skip to content

Instantly share code, notes, and snippets.

View dalexsoto's full-sized avatar

Alex Soto dalexsoto

View GitHub Profile
using System.Drawing;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
namespace HexagonApp {
[Register ("AppDelegate")]
class AppDelegate : UIApplicationDelegate {
UIWindow window;
public override bool FinishedLaunching (UIApplication app, NSDictionary options) {
@zgramana
zgramana / gist:8362306
Created January 10, 2014 20:49
Selected MonoDevelope/Xamarin Studio ProjectTypeGuids.
<DotNetProjectSubtype
guid="{e613f3a2-fe9c-494f-b74e-f63bcb86fea6}"
type="MonoDevelop.IPhone.IPhoneProject"
migrationHandler="MonoDevelop.IPhone.IPhoneProjectMigrationHandler" />
<DotNetProjectSubtype
guid="{6bc8ed88-2882-458c-8e55-dfd12b67127b}"
type="MonoDevelop.IPhone.IPhoneProject" />
<DotNetProjectSubtype
guid="{f5b4f3bc-b597-4e2b-b552-ef5d8a32436f}"
type="MonoDevelop.IPhone.IPhoneBindingProject"
If you want to debug your Xamarin app using LLDB to get a backtrace, then do the following:
1) Clone https://github.com/zgramana/ios-deploy (or download https://www.dropbox.com/s/8fl1t1qc5fdg5tn/ios-deploy)
2) Run `make` inside that folder.
3) Run `./ios-deploy -d -b path/to/bin/iPhone/Debug/MyFoo.app`
This will install your app and start it will lldb attached.
From the lldb prompt:
@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)
@banshee
banshee / gist:7000449
Created October 15, 2013 23:46
Modify the output of swig for use with Xamarin
ARGF.each do |l|
case l
when /public delegate void Exception(Argument)?Delegate/
puts " [MonoTouch.MonoNativeFunctionWrapper]", l
when /static void SetPendingArgument(Null|OutOfRange)?Exception/
puts " [MonoTouch.MonoPInvokeCallback (typeof (ExceptionArgumentDelegate))]", l
when /static void SetPending.*Exception/
puts " [MonoTouch.MonoPInvokeCallback (typeof (ExceptionDelegate))]", l
when /static string CreateString/
puts " [MonoTouch.MonoPInvokeCallback (typeof (SWIGStringDelegate))]", l
@jstedfast
jstedfast / EmailValidator.cs
Created October 7, 2013 21:18
Email address validator
//
// EmailValidator.cs
//
// Author: Jeffrey Stedfast <jeff@xamarin.com>
//
// Copyright (c) 2013 Xamarin Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
@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()
@praeclarum
praeclarum / EasyLayout.cs
Last active April 21, 2023 10:28
**OUT OF DATE** Please use the NuGet package https://www.nuget.org/packages/EasyLayout or the code on GitHub https://github.com/praeclarum/EasyLayout. (EasyLayout makes writing auto layout code in Xamarin.iOS easier. See [the example](https://gist.github.com/praeclarum/8185036) for hints on how to use this library.)
//
// Copyright (c) 2013-2015 Frank A. Krueger
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
#!/usr/bin/env bash
#
# simple recursive search and replace string in files
# setup: alias replace='~/replace.sh'
# notes: you will need to escape special chars! eg: replace '\/dir1' '\/dir2' .
# usage: replace <oldstring> <newstring> <path> <depth>
# examples:
# replace "([^\s]+.php)" "\/\1" .
# replace "\"\/([^\/]+.php)" "\"\/dir\/\1" .
@nicwise
nicwise / gist:3656362
Created September 6, 2012 13:40
utils class
using System;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using MonoTouch.Dialog;
using System.IO;
using MonoTouch.MessageUI;
using System.Threading;
using MonoTouch.ObjCRuntime;
using System.Globalization;
using System.Xml.Linq;