Skip to content

Instantly share code, notes, and snippets.

View jgable's full-sized avatar

Jacob Gable jgable

  • Making Other People Money
  • San Carlos, CA
  • X @jacob4u2
View GitHub Profile
@jgable
jgable / dialogSnip.htm
Created May 12, 2011 18:42
Dialog Element Example
<dialog>
<dt class="chatTitle">Me</dt>
<dd class="chatMsg">
<p>yo</p>
<span>1:39 PM</span>
<div class="arrow"></div>
<div class="arrow arrowOver"></div>
</dd>
<dt class="chatTitle reply">Expert</dt>
<dd class="chatMsg reply">
@jgable
jgable / CallController.cs
Created April 24, 2011 20:30
CallController.cs - An example of a CallController for Twilio and MVC 3
using System.Web.Mvc;
using _8Ball.Common;
using TwilioSharp.MVC3.Controllers;
using TwilioSharp.Request;
public class CallController : TwiMLController
{
[HttpPost]
public ActionResult New(CallRequest request)
{
@jgable
jgable / TextController.cs
Created April 24, 2011 20:28
TextController.cs - An example SMS Responder Controller for MVC 3
using System.Web.Mvc;
using _8Ball.Common;
using TwilioSharp.MVC3.Controllers;
using TwilioSharp.Request;
public class TextController : TwiMLController
{
[HttpPost]
public ActionResult New(TextRequest request)
{
@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;
}
@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 / 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 / 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 / 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 / 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 / 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);