Skip to content

Instantly share code, notes, and snippets.

@jakejscott
jakejscott / ConsoleSpiner.cs
Created August 1, 2012 15:09
Console spinner
public class ConsoleSpiner
{
int counter;
public ConsoleSpiner()
{
counter = 0;
}
public void Turn()
{
counter++;
@jakejscott
jakejscott / welcome.html
Created September 24, 2012 07:05
Responsive Email Template
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>ASOS Marketplace</title>
<style type="text/css">
body, p {
font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-webkit-text-size-adjust:none;
@jakejscott
jakejscott / animal.coffee
Created October 2, 2012 04:14
TypeScript vs CoffeeScript
class Animal
constructor: (@name) ->
move: (meters) ->
alert @name + " moved #{meters}m."
class Snake extends Animal
move: ->
alert "Slithering..."
super 5
@jakejscott
jakejscott / jQuery.antiforgerytoken.js
Created October 3, 2012 00:33 — forked from scottrippey/jQuery.antiforgerytoken.js
ASP.NET MVC AntiForgeryToken + AJAX = jQuery to the rescue
// Setup CSRF safety for AJAX:
$.ajaxPrefilter(function(options, originalOptions, jqXHR) {
if (options.type.toUpperCase() === "POST") {
// We need to add the verificationToken to all POSTs
var token = $("input[name^=__RequestVerificationToken]").first();
if (!token.length) return;
var tokenName = token.attr("name");
@jakejscott
jakejscott / index.html
Created October 9, 2012 00:33
This is just an experiment! There are certainly better ways to show an image of a MacBook, but none as fun as this :)
<i class="macbook"></i>
<p>Hey Jake</p>
@jakejscott
jakejscott / FeedResult.cs
Created October 11, 2012 23:22
FeedResult RSS
public class FeedResult : ActionResult
{
public Encoding ContentEncoding { get; set; }
public string ContentType { get; set; }
private readonly SyndicationFeedFormatter feed;
public SyndicationFeedFormatter Feed
{
get { return feed; }
}
@jakejscott
jakejscott / CssWatcher.cs
Created October 15, 2012 21:08
simple SignalR based css file watcher live reload thingy
using System.Collections;
using System.IO;
using System.Web;
using SignalR;
using SignalR.Hubs;
[HubName("cssWatcher")]
public class CssWatcher : Hub
{
public static void Init()
@jakejscott
jakejscott / fluid-ratio.scss
Created November 21, 2012 02:11
Fluid Ratio images
// credit Rolf Timmermans
// http://voormedia.com/blog/2012/11/responsive-background-images-with-fixed-or-fluid-aspect-ratios
/* Calculate fluid ratio based on two dimensions (width/height) */
@mixin fluid-ratio($large-size, $small-size) {
$width-large: nth($large-size, 1);
$width-small: nth($small-size, 1);
$height-large: nth($large-size, 2);
$height-small: nth($small-size, 2);
$slope: ($height-large - $height-small) / ($width-large - $width-small);
@jakejscott
jakejscott / app.js
Created November 23, 2012 02:33
jQuery Foundation Form Button Disabler 0.0.1
;(function($, window, undefined) {
'use strict';
var $doc = $(document),
Modernizr = window.Modernizr;
$(document).ready(function() {
$.fn.foundationAlerts ? $doc.foundationAlerts() : null;
$.fn.foundationButtons ? $doc.foundationButtons() : null;
$.fn.foundationAccordion ? $doc.foundationAccordion() : null;