Skip to content

Instantly share code, notes, and snippets.

View jessegavin's full-sized avatar

Jesse Gavin jessegavin

View GitHub Profile
@jessegavin
jessegavin / README.md
Created May 28, 2014 01:06
PHP Next Generation ReadMe file

Try using something other than PHP for crying out cornflakes!

@jessegavin
jessegavin / Instructions.md
Created June 6, 2014 17:28
How to make Github diffs take advantage of screen width.
@jessegavin
jessegavin / european.js
Created October 29, 2014 15:33
An attempt at a European version of jQuery Chord Transposer
/*!
* jQuery Chord Transposer plugin v1.0
* http://codegavin.com/projects/transposer
*
* Copyright 2010, Jesse Gavin
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://codegavin.com/license
*
* Date: Sat Jun 26 21:27:00 2010 -0600
*/
@jessegavin
jessegavin / parseHoursAndMinutes.js
Last active August 29, 2015 14:26
Time Parsing
function parseHoursAndMinutes(input) {
if (typeof input !== "string") {
throw "Time must be a string";
}
input = input.toLowerCase().trim();
if (input.length === 0) {
throw "Time must not be empty";
@jessegavin
jessegavin / gist:847637
Created February 28, 2011 17:08
Spacecrafting slideshow usage
var ss = $("#slideshow-display").slideshow({
urls: ['image.jpg', 'image2.jpg'], // This is the only required setting
photoBaseUrl: "http://photos.screenfeed.com/',
interval: 3000, // Number of milliseconds each photo should be shown
transitionDuration: 300, // Time it takes for fade animation to complete
preloadBuffer: 3, // Number of images to preload before slideshow starts
onImageChanging: null, // If specified, this is fired right before the image is swapped
onImageLoading: null, // If specified, this is fired when an image is requested.
@jessegavin
jessegavin / SO #5462820
Created March 28, 2011 18:38
Answer to StackOverflow Question #5462820
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Google Maps JavaScript API v3 Example: Geocoding Simple</title>
<link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
var geoResults = {};
POST http://preprod-services.stupeflix.com/stupeflix-1.0/screenfeed/c30e406f/?Date=1306188442&AccessKey=ZvlQcWYSJ13iJFjbPo82&Signature=aa327acf9a0d0defad49d0be23debe476a0f3b0f HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Content-MD5: PtwIhXcJHapJ1NoJRN+pRw==
Host: preprod-services.stupeflix.com
Content-Length: 226
Expect: 100-continue
ProfilesXML=%3cprofiles%3e%3cprofile+name%3d%22ntsc-wide-wmv%22%3e%3cs3+bucket%3d%22screenfeed%22+resourcePrefix%3d%22c30e406f%22%3e%3cmeta%3e%3cacl%3epublic%3c%2facl%3e%3c%2fmeta%3e%3c%2fs3%3e%3c%2fprofile%3e%3c%2fprofiles%3e
private void SendHttpRequest(string httpMethod, string mimeType, string requestBody, string uri)
{
byte[] xmlBytes = Encoding.UTF8.GetBytes(requestBody);
var md5Base64 = Hasher.Md5Hash(xmlBytes).ToBase64();
var dateString = GetDateString();
var stringToSign = GetStringToSign(httpMethod, md5Base64, mimeType, uri, dateString, null);
var signature = Hasher.GetSignature(SecretKey, stringToSign);
Console.Write(DebugMessage("String To Sign", stringToSign));
@jessegavin
jessegavin / gist:1153155
Created August 18, 2011 02:31
Code example for StackOverflow question #7087312
// ----------------------------------------------------------------
// This example shows my solution for the question I posted here:
// http://stackoverflow.com/questions/7087312
// ----------------------------------------------------------------
public class Person {
public string First { get; set; }
public string Last { get; set; }
public string Twitter { get; set; }
}
Server Error in '/' Application.
The property MvcApp.Models.ISpy.Name could not be found.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: The property MvcApp.Models.ISpy.Name could not be found.
Source Error: