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 / HTML5-SemanticPage.html
Created October 18, 2011 05:10
Modern Web Development Blog Post code
<body>
<header>
<img src="logo.png" title="Best Site Evar" alt="Best Site Evar" />
<h1>Best Site Evar!!!!11!</h1>
</header>
<section>
<h2>Welcome</h2>
<p>d00d, this is the best site evar.</p>
</section>
<footer>
@jgable
jgable / WinJS.Class.js
Created October 13, 2011 19:13
WinJS.Class from base.js in the Metro Web App Template
/*
© Microsoft. All rights reserved.
*/
(function (global, undefined) {
function initializeProperties(target, members) {
var keys = Object.keys(members);
var properties;
var i, len;
@jgable
jgable / Class.define.js
Created October 13, 2011 19:13
n00b 2 Ninja: Object Oriented Javascript Examples
// Declare our Pet with the WinJS.Class method.
var Pet = WinJS.Class.define(
// The constructor for the Pet class
function(name) {
this.name = name;
}, {
// The speak public method.
speak: function(message) {
$("#result").html(message);
@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, {
@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 / 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 / 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 / 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 / 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 / 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)