Skip to content

Instantly share code, notes, and snippets.

Logger.Info("Sending analytics request to Segment.io ..", props);
var start = DateTime.Now;
HttpResponseMessage response = null;
try {
//breakpoint hit
response = _client.SendAsync(request).Result;
@anujb
anujb / Some Gist Goodness
Created April 19, 2011 04:48
Some Gist Goodness
System.ArgumentNullException: Argument cannot be null.
Parameter name: key
at System.Collections.Generic.Dictionary`2[System.String,MonoDevelop.Projects.Dom.ICompilationUnit].ContainsKey (System.String key) [0x00000] in <filename unknown>:0
at MonoDevelop.Projects.Dom.Parser.ProjectDom.MergeTypeWithTemporary (IType type) [0x00000] in <filename unknown>:0
$ git pull --rebase https://github.com/RobertKozak/MonoMobile.MVVM master
From https://github.com/RobertKozak/MonoMobile.MVVM
* branch master -> FETCH_HEAD
It seems that I cannot create a rebase-apply directory, and
I wonder if you are in the middle of patch application or another
rebase. If that is not the case, please
rm -fr /Users/abhatia/projects/monotouch/github/MonoMobile.MVVM/.git/rebase-apply
and run me again. I am stopping in case you still have something
valuable there.
$ git pull --rebase https://github.com/RobertKozak/MonoMobile.MVVM master
From https://github.com/RobertKozak/MonoMobile.MVVM
* branch master -> FETCH_HEAD
It seems that I cannot create a rebase-apply directory, and
I wonder if you are in the middle of patch application or another
rebase. If that is not the case, please
rm -fr /Users/foo/projects/monotouch/github/MonoMobile.MVVM/.git/rebase-apply
and run me again. I am stopping in case you still have something
valuable there.
public class Recognizer<T> : NSObject where T : UIGestureRecognizer, new()
{
T fRecognizer;
public T Instance {
get { return fRecognizer; }
}
Selector fSelector = new Selector("MyKit.Selector");
public Recognizer()
[JsonObject("user")]
public class User
{
[JsonProperty("id")]
public string id { get; set; }
[JsonProperty("type")]
public string Type { get; set; }
}
{
@anujb
anujb / DapperRepository.cs
Created July 30, 2011 04:59
DapperRepository
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Linq.Expressions;
using Dapper;
using Dapper.Contrib.Extensions;
namespace Devnos.Core.DataAccess.Repository
@anujb
anujb / gist:1115225
Created July 30, 2011 05:20
ORM Example
using (var session = SessionFactory.OpenSession)
{
Names = session.QueryOver<Foo>()
.WhereRestrictionOn(f => f.Id)
.IsBetween(2).And(8)
.Select(f => f.Name)
.OrderBy(f => f.Name).Asc
.List<string>();
}
@anujb
anujb / SqlMapper.cs
Created July 30, 2011 04:45
MonoTouch compatible version of Dapper
#define CSHARP30
/*
License: http://www.apache.org/licenses/LICENSE-2.0
Home page: http://code.google.com/p/dapper-dot-net/
Note: to build on C# 3.0 + .NET 3.5, include the CSHARP30 compiler symbol (and yes,
I know the difference between language and runtime versions; this is a compromise).
*/
using System;
using System.Collections;
@anujb
anujb / gist:1115212
Created July 30, 2011 04:51
Vici MonoTouch Example
[MapTo("customer")]
public class Customer : CSObject<Customer,int>
{
public int CustomerID { get { return (int)GetField("CustomerID"); } }
public string Name { get { return (string)GetField("Name"); } set { SetField("Name",value); } }
public string City { get { return (string)GetField("City"); } set { SetField("City",value); } }
}