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 / 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 / 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 / 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 / jQueryGems.js
Created October 18, 2011 05:32
Modern Web Development Blog Post code - jQuery Gems
var nums = [1,2,3,4,5,6,7,8,9,10];
// $.each is a simple foreach helper
$.each(nums, function() { if(this % 2 === 1) { log("Found an odd number"); });
// $.grep is a filter for a list
var odds = $.grep(nums, function() { return this % 2 === 1; });
// $.map is a projection of a list
var labels = $.map(nums, function() { return "Number " + this; });
@jgable
jgable / ModuleExport.js
Created October 18, 2011 05:33
Modern Web Development Blog Post code - Module Export Pattern
// Initialize our apps namespace; add a pages holder for later.
var MYAPP = {
pages: {}
};
// A closure to encapsulate our HomePage class.
(function($, app) {
// This little guy is private to this closure.
function bindButtons($page) {
@jgable
jgable / membershiptables.sql
Created December 23, 2011 02:43
aspnet_regsql membership scripts
/*************************************************************/
/*************************************************************/
/*************************************************************/
-- Create the temporary permission tables and stored procedures
-- TO preserve the permissions of an object.
--
-- We use this method instead of using CREATE (if the object
-- doesn't exist) and ALTER (if the object exists) because the
-- latter one either requires the use of dynamic SQL (which we want to
@jgable
jgable / NumberHelpers.cs
Created January 27, 2012 01:33
NumberHelpers - Fibonacci Sequence, Primes, IsPrime, Triangles and Pythagoreans
using System;
using System.Collections.Generic;
public static class NumberHelpers
{
/// <summary>
/// Returns a sequence of fibonacci numbers.
/// </summary>
/// <returns></returns>
public static IEnumerable<long> Fibonacci()
@jgable
jgable / AllowJsonGetAttribute.cs
Created February 10, 2012 20:12
AllowJsonGetAttribute for .Net MVC
// Originally from RealWorldWpDev.codeplex.com : @matthidinger
using System.Web.Mvc;
public class AllowJsonGetAttribute : ActionFilterAttribute
{
public override void OnResultExecuting(ResultExecutingContext filterContext)
{
var result = filterContext.Result as JsonResult;
if(result != null)
@jgable
jgable / CacheManifestResult.cs
Created February 25, 2012 14:02
MVC 3 Cache manifest result
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Mvc;
/// <summary>
/// Contains information about a cache manifest file to be generated. see http://www.html5rocks.com/en/tutorials/appcache/beginner/
/// </summary>
public class CacheManifest
{
@jgable
jgable / securing_rails_updates.md
Created March 6, 2012 04:58 — forked from peternixey/securing_rails_updates.md
How Homakov hacked GitHub and how to protect your application

##How Homakov hacked GitHub and the line of code that could have prevented it


Please note: THIS ARTICLE IS NOT WRITTEN BY THE GITHUB TEAM or in any way associated with them. It's simply hosted as a Gist because the markdown formatting is excellent and far clearer than anything I could manage on my personal Tumblr at peternixey.com.

If you'd like to follow me on twitter my handle is @peternixey