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 / 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 / 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 / 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 / Enum_RadioButtonList.cshtml
Created May 15, 2011 20:02
A helper for showing a RadioButton List in .Net MVC 3
@model Enum
@{
// Looks for a [Display(Name="Some Name")] Attribute on your enum
Func<Enum, string> getDescription = en =>
{
Type type = en.GetType();
System.Reflection.MemberInfo[] memInfo = type.GetMember(en.ToString());
if (memInfo != null && memInfo.Length > 0)
@jgable
jgable / jQueryPlugin.js
Created May 24, 2011 15:46
jQuery Plugin Template
//You need an anonymous function to wrap around your function to avoid conflict
(function($){
//Attach this new method to jQuery
$.fn.extend({
//This is where you write your plugin's name
pluginName: function(options) {
var defaults = {
@jgable
jgable / TransitionPageContent.html
Created June 21, 2011 22:14
Transition Page Content example
<body>
<div id="container">
<header>
<h1>Best Site Evar</h1>
<nav>
<ul>
<li class="first selected"><a href="index.html" transition-link="" transition-name="slide">Home</a></li>
<li><a href="about.html" transition-link="" transition-name="slide">About</a></li>
<li><a href="contact.html" transition-link="" transition-name="slide">Contact</a></li>
@jgable
jgable / TransitionPageClickHandler.js
Created June 21, 2011 22:24
Page Transition Click Handler Example
// Get our transition links in the nav
opts.$navLinks = $('nav a[transition-link]');
// Attach click handlers for all links with our special transition attribute.
opts.$navLinks.click(function(e) {
// Prevent navigation...
e.preventDefault();
opts.toggleLoading(true);
@jgable
jgable / TransitionPageAnimater.js
Created June 21, 2011 22:33
Page Transition Content Animation Example
opts.transitionHandler = function(name, $to, $from, cb) {
$from.hide(name, {direction: 'left', easing: 'easeOutQuad'}, 350, function() {
// Transition in the to element
opts.getContentHolder().append($to);
$to.show(name, {direction: 'right', easing: 'easeOutQuad'}, 350, function() {
// Remove the from element
$from.detach();
if($.isFunction(cb)) { cb(); }
});
});
@jgable
jgable / KeywordGrabber.cs
Created September 15, 2011 17:43
KeywordGrabber
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
// http://bingsharp.codeplex.com/
using Bing;
// http://nuget.org/List/Packages/HtmlAgilityPack
using HtmlAgilityPack;
@jgable
jgable / ready.core.js
Created September 27, 2011 22:07
document.ready alternatives for jQuery Mobile - core.js
// Create our namespace object, use one that already exists if it's available, fall back to new object "{}".
var MYAPP = MYAPP || {};
(function($, ns) {
// .. This is a closure, so we don't muddy up our global namespace.
// .. $ = jQuery, ns = MYAPP (For those playing along at home)
// Extend our namespace with some stuff we're going to add later.
ns = $.extend(ns, {