Skip to content

Instantly share code, notes, and snippets.

@jakejscott
jakejscott / blog-post.tmpl
Last active December 29, 2015 12:09
martini form and render example
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<h1>Title: {{.Title}}</h1>
<p>Content: {{.Content}}</p>
@jakejscott
jakejscott / clear.bat
Created October 11, 2013 02:00
Get rid or those pesky bin/debug and bin/release folders
FOR /F "tokens=*" %%G IN ('DIR /B /AD /S Release') DO RMDIR /S /Q "%%G" FOR /F "tokens=*" %%G IN ('DIR /B /AD /S Debug') DO RMDIR /S /Q "%%G"
@jakejscott
jakejscott / Macros.exs
Last active December 23, 2015 10:29
Playing around with Elixir macros
defmodule My do
defmacro if(condition, clauses) do
do_clause = Keyword.get(clauses, :do, nil)
else_clause = Keyword.get(clauses, :else, nil)
quote do
case unquote(condition) do
_ in [false, nil] -> unquote(else_clause)
_ -> unquote(do_clause)
@jakejscott
jakejscott / Xamarin.Android
Created July 4, 2013 07:08
Xamarin async
using System;
using System.Net.Http;
using System.Threading.Tasks;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
@jakejscott
jakejscott / worker.js
Created March 5, 2013 22:23
IronWorker node.js script to download data from http://sidebar.io/api and import into Parse.com rest api
var _ = require('underscore');
var request = require('request');
var async = require('async');
var Parse = require('kaiseki');
var settings = require('./settings.json');
var parse = new Parse(settings.parseAppId, settings.parseRestApiKey);
request('http://sidebar.io/api', function (error, response, body) {
if (error) {
@jakejscott
jakejscott / HudView.m
Last active December 12, 2015 08:29
Simple HUD View for iOS
#import "HudView.h"
@implementation HudView {
}
+ (HudView *)hudInView:(UIView *)view animated:(BOOL)animated {
HudView *hudView = [[HudView alloc] initWithFrame:view.bounds];
hudView.opaque = NO;
@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;
@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 / 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 / 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; }
}