Skip to content

Instantly share code, notes, and snippets.

View awbauer's full-sized avatar

Andrew Bauer awbauer

View GitHub Profile
@awbauer
awbauer / whoshere.js
Last active December 20, 2015 07:59
NEXIS "Who's here" script. Shows photos of foursquare users currently at a venue & new check-ins in realtime. Powered by foursquare & SocketIO.
/***
* NEXIS 'Who's here' script
* Author: Andrew Bauer
* Dependencies: jQuery, socketIO
* Requires socketIO server @ http://tospace.starshipnexis.com:8000
***/
var socket = io.connect('http://tospace.starshipnexis.com:8000'),
whoshere = [],
refreshInt,
@awbauer
awbauer / app.js
Last active December 21, 2015 18:39
function getHours(e, t) {
var n = new Date;
var r = n.getDate();
var i = n.getMonth() + 1;
var s = n.getHours();
var o = n.getMinutes();
r = r.toString();
i = i.toString();
s = s.toString();
o = o.toString();
@awbauer
awbauer / gist:8427056
Last active October 3, 2018 18:11
Track downloads with Google Analytics & BU GA tracker
(function ($) {
var filter_from_url = window.location.protocol + "//" + window.location.host,
tracked_types_formatted = '',
trackedTypes = ['pdf'];
trackedTypes.forEach(function(t){
tracked_types_formatted = tracked_types_formatted + "a[href$='."+t+"'],";
});
tracked_types_formatted = tracked_types_formatted.slice(0,-1);
@awbauer
awbauer / gist:8511730
Created January 19, 2014 22:20
Handle accessibility links & smooth scroll for in-page anchors. Supports in-page anchors with fixed headers.
if ($('#content').length) {
$('#content').attr('tabindex', '-1').addClass('focusable');
}
if ($('#incident-alerts').length) {
$('#incident-alerts').attr('tabindex', '-1').addClass('focusable');
}
if (document.location.hash) {
var anchorUponArrival = document.location.hash,
@awbauer
awbauer / gist:9600507
Last active August 29, 2015 13:57
Closure build in Sublime3

Closure Compiler as a Sublime3 Build System

  1. Install the Java SDK -- http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
  2. Download the Closure application -- http://dl.google.com/closure-compiler/compiler-latest.zip
  3. Copy the JAR to a convenient location (e.g. ~/compiler.jar)
  4. Create new build system in Sublime -- Tools > Build System > New Build System...
  5. Paste the following into the file: (compiles *.dev.js -> *.js)
    {
    

"shell_cmd": "java -jar ~/compiler.jar --js_output_file ${file_base_name/.dev/''/g}.js ${file_name}",

// via http://blog.jyst.us/javascript-flickr-badge
var jsfbcb=0;
function jsFlickrBadge(t,f){var b,k;b=encodeURIComponent(f.flickrId);var h=f.size,z=f.rows,n=f.columns,r=f.animation,w=1E3*f.animationSpeed,u=1E3*f.animationPause,s=function(a,M){var b=Math.floor(Math.random()*a);return 1<a&&b==M?s(a,M):b},x=function(a,b){var f,h;for(f in a)if(a.hasOwnProperty(f)&&(h=b(a[f],f),void 0!==h))break;return h},I=function(a){var b=a?a.split("px"):[];return 1<b.length?Number(b[0]):a},p=function(a){return!a||isNaN(a)?0:Number(a)},B=function(a){return a&&"[object Array]"==Object.prototype.toString.apply(a)},
U=function(a){var b=0,f=a.length;return function(){var h=a[b];b=(b+1)%f;return h}},m=function(a){var b=document.documentElement;return B(a)?x(a,function(a){return b.style.hasOwnProperty(a)?a:void 0}):m(["-webkit-"+a,"-moz-"+a,"-o-"+a,a])},C=m("transition"),V=m("perspective"),N=m("backface-visibility"),D=m("transform"),O=m("transform-style"),E=m("box-shadow");"random"==r&&(r=["shuffle","zoom","vscroll","flipX","flipY"]
@awbauer
awbauer / gist:83567e4a6bd253f054d3
Created October 1, 2014 20:05
Flexi additions for Media Player
#content .mejs-overlay-button {
position: absolute;
top: 50%;
left: 50%;
width: 100px;
height: 100px;
margin: -50px 0 0 -50px;
background: url(bigplay.svg) no-repeat;
}
#content .no-svg .mejs-overlay-button {
@awbauer
awbauer / gist:70cdaaf1445ae82664a4
Created November 18, 2014 17:13
SVN ==> GIT Migration

This document details the procedure for a permanent migration from SVN to Git.

Overview

  1. Create authors file to map usernames to authors
  2. Clone SVN repository to Git using git svn
  3. Severe connection to SVN remote
  4. Convert tag branches to Git tags
  5. Set up Github remote as origin and push
@awbauer
awbauer / gist:89e952290aac281740c2
Last active August 29, 2015 14:10
VCO API Requests
<form id="form">
Endpoint: <input type="text" id="endpoint" value="/workflows/" /> <input type="submit" />
</form>
<script>
(function(){
var form = document.getElementsByTagName('form');
form[0].addEventListener('submit', doSubmit);
function doSubmit(e){
e.preventDefault();
(function ($) {
function trackBoxClick(link, box) {
var args;
try {
args = {
category: "CAS homepage",
action: "box click: "+box,
label: link
};
bu_ga_track_event(args);