Skip to content

Instantly share code, notes, and snippets.

View brendanzagaeski's full-sized avatar

Brendan Zagaeski brendanzagaeski

  • Microsoft
  • Boston, MA, United States
View GitHub Profile
@brendanzagaeski
brendanzagaeski / CustomRootElement.cs
Created August 8, 2013 03:00
A custom RootElement subclass to detect when the TableView has scrolled past "maxRows", and so should load more rows
using System;
using MonoTouch.Dialog;
using MonoTouch.UIKit;
using MonoTouch.Foundation;
namespace MTDialogViewControllerTest
{
public class CustomRootElement : RootElement
{
public CustomRootElement (string caption, Group group) : base (caption, group)
@brendanzagaeski
brendanzagaeski / gist:6237091
Created August 15, 2013 00:12
Some command line piping using `monodis` to find files that reference outdated, unsigned `monotouch` assemblies.
find . -iname '*.dll' | while read FILE; do monodis --assemblyref "$FILE" | sed -n '/monotouch/ { N; N; p; }' | grep -iq 'Zero sized public key' && echo "$FILE"; done
@brendanzagaeski
brendanzagaeski / gist:6547582
Created September 13, 2013 07:16
Work-around for incorrectly generated abstract Next() method
using System;
using Android.Runtime;
namespace Com.Nostra13.Universalimageloader.Core.Assist.Deque
{
public partial class LinkedBlockingDeque
{
public partial class DescendingItr
{
static IntPtr id_next;
@brendanzagaeski
brendanzagaeski / desc.xml
Created September 18, 2013 15:26
XML descriptor file to preserve MonoTouch.GLKit.GLKView
<linker>
<assembly fullname="monotouch">
<type fullname="MonoTouch.GLKit.GLKView" />
</assembly>
</linker>
@brendanzagaeski
brendanzagaeski / desc.xml
Created October 14, 2013 18:25
Preserve WebConfigurationHost constructors during linking
<linker>
<assembly fullname="System.Web">
<type fullname="System.Web.Configuration.WebConfigurationHost">
<method name=".ctor" />
</type>
</assembly>
</linker>
@brendanzagaeski
brendanzagaeski / System.Runtime.Serialization.patch
Created October 23, 2013 19:17
Proposed fixes for bugs in System.Runtime.Serialization
diff --git a/System.Runtime.Serialization/System.Runtime.Serialization/DataContractSerializer.cs b/System.Runtime.Serialization/System.Runtime.Serialization/DataContractSerializer.cs
index f3c707e..8e713d7 100755
--- a/System.Runtime.Serialization/System.Runtime.Serialization/DataContractSerializer.cs
+++ b/System.Runtime.Serialization/System.Runtime.Serialization/DataContractSerializer.cs
@@ -248,8 +248,10 @@ namespace System.Runtime.Serialization
return;
Type elementType = type;
- if (type.HasElementType)
+ if (type.HasElementType) {
@brendanzagaeski
brendanzagaeski / TableHeaderViewTest.cs
Created October 24, 2013 23:36
TableHeaderView example for MonoTouch.Dialog
public partial class AppDelegate : UIApplicationDelegate
{
public override UIWindow Window {
get;
set;
}
RootElement MyRootElement;
UIViewController RootViewController;
UINavigationController NavigationController;
@brendanzagaeski
brendanzagaeski / JSCoreiOSViewController.cs
Created October 25, 2013 19:17
Use P/Invoke to call JavaScriptCore's C API functions in iOS.
using System;
using MonoTouch.UIKit;
using MonoTouch;
using System.Runtime.InteropServices;
namespace JintiOS
{
unsafe public partial class JintiOSViewController : UIViewController
{
JSContextRef* context;
@brendanzagaeski
brendanzagaeski / Android.Webkit.WebViewClientClassicExt.cs
Created November 9, 2013 01:04
Simplified WebViewClientExt class
using System;
using Android.Runtime;
namespace Android.Webkit {
[global::Android.Runtime.Register ("android/webkit/WebViewClientClassicExt", DoNotGenerateAcw=false)]
public class WebViewClientClassicExt : Android.Webkit.WebViewClient {
public WebViewClientClassicExt () {}
protected WebViewClientClassicExt (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {}
}
}
@brendanzagaeski
brendanzagaeski / Main.cs
Created November 11, 2013 21:09
Subclassing NSMutableAttributedString causes an error "[CustomNSAttributedString initWithAttributedString:]: unrecognized selector sent to instance 0x4418b0"
using System;
using MonoMac.Foundation;
using MonoMac.CoreText;
using MonoMac.AppKit;
namespace SubclassingTest
{
public class Program
{
static void Main (string[] args)