Skip to content

Instantly share code, notes, and snippets.

A First Level Header

A Second Level Header

Now is the time for all good men to come to the aid of their country. This is just a regular paragraph.

A First Level Header

A Second Level Header

Now is the time for all good men to come to the aid of their country. This is just a regular paragraph.

@benaston
benaston / gist:3196531
Created July 29, 2012 07:37 — forked from danparsons/gist:3195652
How to stream the London 2012 Olympics

How to stream the London 2012 Olympics

There have been several HOWTOs posted regarding streaming the 2012 Olympics using HTTP / SOCKS proxies via SSH and other similar methods. None of these actually work using the latest Flash on Mountain Lion (with Firefox, Chrome or Safari). Additionally, the third-party streaming sites don't provide BBC's amazing interface, which lets you quickly skip to individual competitors and events. However, setting up an OpenVPN server does work, with some tweaks. You'll get the exact same UX that people in England receive.

@benaston
benaston / youtube
Created October 17, 2012 17:25 — forked from anonymous/youtube
Shivas Code
(function( $ ){
$.fn.youtubeGallery = function( options ) {
var html = '';
var playListBaseURL = 'http://gdata.youtube.com/feeds/api/playlists/';
var videoBaseURL = 'http://www.youtube.com/watch?v=';
var youtubeBaseURL = 'http://www.youtube.com/';
var that = this;
@benaston
benaston / judy
Last active December 19, 2015 16:18
Judy Git Stuff
#Branching
Show All Branches: `git branch`
Switch to branch: `git checkout <branch name>`
New branch: `git checkout -b <branch name>`
Delete branch: `git checkout -D <branch name>`
@benaston
benaston / foo
Created March 6, 2014 09:51
Random JavaScript
var countries = [ "A", "B", "C", "D", "E", "F", "G", "H", "I" ]
var grouped = [];
var count = countries.length;
var columns = 4;
var rows = Math.floor(count/columns);
countries.map(function(c,i,a){
return { key: i%rows, value: c };
}).forEach(function(kvp) {
///<summary>
/// Returns a dictionary of lists keyed by row index.
/// Each list in the dictionary corresponds to a row of values.
/// "kvp" stands for "key-value pair".
///</summary>
public class ListHelper
{
public static Dictionary<int, List<T>> ToVertical<T>(IEnumerable<T> list, int maxColumns) {
if(list == null) {
throw new ArgumentNullException("list");
@benaston
benaston / gist:9840598
Created March 28, 2014 19:06
map reduce
return _bookmarks.map(function (a) {
return _.any(a, function (i) {
return i === id;
});
}).reduce(function (prev, curr) {
return prev || curr;
});
@benaston
benaston / variable-scoping.js
Created June 11, 2014 15:11
Variable scoping
'use strict';
var x;
function Func() {
x = "foo";
var y = "bar";
}
Func();
<!DOCTYPE HTML>
<html>
<head>
<style>
a {
line-height: 2rem;
}
</style>
</head>