Skip to content

Instantly share code, notes, and snippets.

View praeclarum's full-sized avatar

Frank A. Krueger praeclarum

View GitHub Profile
@praeclarum
praeclarum / ObservableTableView
Created January 3, 2011 15:36
This class knows how to listen to INotifyCollectionChanged to populate and keep a UITableView in sync with a data source.
using System;
using MonoTouch.UIKit;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using MonoTouch.Foundation;
using System.Collections;
namespace ObservableTableView
{
public class RowSelectedEventArgs : EventArgs {
@praeclarum
praeclarum / gist:870347
Created March 15, 2011 05:22
Multi file project operations for IPhone and MonoMac
diff --git a/extras/MonoDevelop.IPhone/MonoDevelop.IPhone/IPhoneProject.cs b/extras/MonoDevelop.IPhone/MonoDevelop.IPhone/IPhoneProject.cs
index c0010f1..a591e12 100644
--- a/extras/MonoDevelop.IPhone/MonoDevelop.IPhone/IPhoneProject.cs
+++ b/extras/MonoDevelop.IPhone/MonoDevelop.IPhone/IPhoneProject.cs
@@ -516,13 +516,18 @@ namespace MonoDevelop.IPhone
return;
}
- if (String.IsNullOrEmpty (MainNibFile) && Path.GetFileName (e.ProjectFile.FilePath) == "MainWindow.xib") {
- MainNibFile = e.ProjectFile.FilePath;
@praeclarum
praeclarum / Dropbox.cs
Created June 19, 2011 17:56
Initial implementation of the Dropbox API
public class DropboxCredentials {
public string Email { get; set; }
public string Token { get; set; }
public string TokenSecret { get; set; }
public string DisplayName { get; set; }
public string Uid { get; set; }
public string LastDirectory { get; set; }
public DropboxCredentials() {
Email = "";
@praeclarum
praeclarum / Identifier.cs
Created June 19, 2011 22:41
Separates an identifier into its constituent parts
using System;
using System.Collections.Generic;
using NUnit.Framework;
namespace DevSearchTest
{
class Identifier
{
public static string[] Separate(string rawId)
{
@praeclarum
praeclarum / DrawingScrollView.cs
Created June 24, 2011 00:37
A UIScrollView that draws sharp dynamic graphics at any zoom scale
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using MonoTouch.CoreAnimation;
using MonoTouch.CoreGraphics;
using MonoTouch.UIKit;
namespace ScrollViewExperiments
{
@praeclarum
praeclarum / Database.cs
Created July 1, 2011 18:12
A very simple wrapper over MySqlConnection to simplify querying
using System;
using System.Collections.Generic;
using System.Data;
using System.Reflection;
using System.Text;
using System.ComponentModel.DataAnnotations;
using System.Linq;
namespace CircuitGallery
{
@praeclarum
praeclarum / Data.cs
Created July 1, 2011 18:15
A version of sqlite-net that also supports MySql
//
// Copyright (c) 2009-2010 Krueger Systems, 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
// 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:
//
@praeclarum
praeclarum / CirSim.js
Created July 19, 2011 17:48
The core of iCircuit when compiled with Microsoft's Project Volta
var CurrentAssembly = Assemblies["CircuitWebLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"];CurrentAssembly.TypeDefs["Circuit.CirSim"] = (function(){
var Ret = {};var Assembly = CurrentAssembly;var oA = Assembly.References.cA();var kA = GetTypeDef(oA, "System.Double");var kB = GetInstanceDef(oA, "System.Nullable`1", [kA]);var kC = GetTypeDef(Prelude, "Microsoft.LiveLabs.Volta.Prelude.RuntimeHelpers");var kD = GetTypeDef(Assembly, "System.Drawing.Size");var kE = GetTypeDef(Assembly, "System.Drawing.Rectangle");var kF = GetTypeDef(Assembly, "System.Drawing.PointF");var kG = GetTypeDef(oA, "System.Object");var kH = GetTypeDef(oA, "System.Object");var kI = GetTypeDef(oA, "System.DateTime");var lA = GetTypeRef(oA, "System.Action");var lB = GetTypeRef(oA, "System.Void");var lC = GetInstanceRef(GetTypeRef(oA, "System.Action`1"), [lA]);var lD = GetTypeRef(oA, "System.Boolean");var lE = GetTypeRef(oA, "System.Int32");var lF = GetTypeRef(oA, "System.Double");var lG = GetTypeRef(oA, "System.Int64");var lH =
@praeclarum
praeclarum / NSRunLoopScheduler.cs
Created July 22, 2011 22:40
A TaskScheduler for MonoTouch to sync with the UI thread
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
namespace System.Threading.Tasks
{
public class UIKitScheduler : NSRunLoopScheduler
{
protected override void QueueAction (NSAction action)
@praeclarum
praeclarum / extract.js
Created October 26, 2011 23:27
Parses V8 source code to look for JavaScript globals
console.log("<!DOCTYPE html>");
console.log("<html>");
console.log("<head>");
console.log("<title>JavaScript Reference</title>");
console.log("</head>");
console.log("<body>");
var fs = require("fs");
var FILES = ["apinatives.js",