Skip to content

Instantly share code, notes, and snippets.

View jgable's full-sized avatar

Jacob Gable jgable

  • Making Other People Money
  • Redwood City, CA
  • X @jacob4u2
View GitHub Profile
@jgable
jgable / TeamController.cs
Created March 23, 2011 23:51
TeamController - Hackatopia Team Demo Controller
using System;
using System.Linq;
using System.Web.Mvc;
using JSONPhoneApp1.Web.Models;
public class TeamController : Controller
{
// Our Team data; fake data is loaded in the constructor.
private static TeamRepository _teams = new TeamRepository();
@jgable
jgable / Gist4u2.ps1
Created March 24, 2011 00:10
Gist4u2 - A set of powershell CmdLet's for adding in-line gists; intended for the NuGet Package Manager
# Serializer loader
$extAssembly = [Reflection.Assembly]::LoadWithPartialName("System.Web.Extensions")
$serializer = New-Object System.Web.Script.Serialization.JavaScriptSerializer
# Url's formatted
$gistUserListUrlForm = "http://gist.github.com/api/v1/json/gists/{0}";
$gistInfoUrlForm = "http://gist.github.com/api/v1/json/{0}";
$gistContentsUrlForm = "http://gist.github.com/raw/{0}/{1}";
# Json downloader
@jgable
jgable / TeamResponses.cs
Created March 24, 2011 14:42
TeamResponses - For the Team Demo at Hackatopia
using System;
using System.Collections.Generic;
/// <summary>
/// Our Hello response object; /Index action
/// </summary>
public class HelloWorldResponse
{
public bool Success { get; set; }
public DateTime Time { get; set; }
@jgable
jgable / TeamServices.cs
Created March 24, 2011 14:42
TeamServices - Team Services for the Team Hackatopia demo
using System;
using System.Collections.Generic;
public class HelloWorldService : JsonService<HelloWorldResponse>
{
private static string Url = "http://localhost:59527/Team";
public void GetHello(Action<HelloWorldResponse> onResult, Action<Exception> onError)
{
StartServiceCall(Url, onResult, onError);
@jgable
jgable / HackatopiaAll.cs
Created March 24, 2011 22:10
HackatopiaALL - All TeamServices and VM's for pivot win phone 7 app
using System;
using System.Windows;
using System.Windows.Input;
using System.Collections.ObjectModel;
using System.Collections.Generic;
#region TeamServices
/// <summary>
/// Our Hello response object; /Index action
@jgable
jgable / DontDropDBJustCreateTables.cs
Created March 31, 2011 02:37
DontDropDBJustCreateTables Entity Framework code first helper for AppHarbor by Joachim Lykke Andersen
// Original code by Joachim Lykke Andersen; http://devtalk.dk/2011/02/16/Workaround+EF+Code+First+On+AppHabour.aspx
using System.Data.Entity;
using System.Data.Entity.Database;
using System.Data.Entity.Design;
using System.Data.Entity.Infrastructure;
using System.Data.Metadata.Edm;
using System.Data.Objects;
using System.Globalization;
using System.Linq;
@jgable
jgable / ChatController.cs
Created April 12, 2011 21:56
ChatController.cs - An Async Chat Controller for MVC 3
using System.Web.MVC
public class ChatController : AsyncController
{
[AsyncTimeout(ChatServer.MaxWaitSeconds * 1002)]
public void IndexAsync()
{
AsyncManager.OutstandingOperations.Increment();
ChatServer.CheckForMessagesAsync(msgs =>
@jgable
jgable / ChatServer.cs
Created April 12, 2011 21:59
ChatServer.cs - A Chat Server using Observables.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
public class ChatResponse
{
public List<MessageInfo> messages { get; set; }
}
@jgable
jgable / ChatView.cshtml
Created April 12, 2011 22:14
ChatView.cshtml - A Razor View file for our Chat Server Example
@model MotherEffinChatSite.Models.HomeVM
@{
Page.Title = "MVC Chat Example";
}
@section ScriptSection {
<!-- The new message template... TODO: make it sexy -->
<script id="msgTmpl" type="text/x-jquery-tmpl">
<li><p style="margin-bottom:-2px; color: black;"><strong>${user.name}</strong></p><p>${message}</p></li>
@jgable
jgable / jQuery-linqHelpers.js
Created April 20, 2011 14:06
jQuery-linqHelpers - Helper functions from linq.
/* Author:
Jacob Gable, http://jacob4u2.posterous.com
License:
MS-PL
*/
jQuery.any = function (collection, compareFunc) {
if (!$.isArray(collection) || !$.isFunction(compareFunc)) {
return false;
}