Skip to content

Instantly share code, notes, and snippets.

View bendman's full-sized avatar
🏠
Working from home

Ben Duncan bendman

🏠
Working from home
View GitHub Profile
@bendman
bendman / jsbin-settings.json
Last active August 29, 2015 14:01
JS Bin Settings
settings = {
jshint: true,
editor: {
theme: "monokai",
indentUnit: 4,
smartIndent: true,
lineWrapping: true,
lineNumbers: true,
matchBrackets: true
}
@bendman
bendman / gist:74f2b5ec66889c5466ce
Created June 4, 2014 15:36
Check if the current frame has access to the top frame
var crossDomain = (function(){
var top = null;
try {
top = window.top.location.host;
} catch(err) {}
return (top === null);
}());
@bendman
bendman / progress-plugin.js
Created July 20, 2015 17:51
Return a plugin which logs initial build progress in webpack with live updates.
/**
* getProgressPlugin
* Return a progress plugin instance which outputs build progress percentages in realtime
*
* @return {Object} A ProgressPlugin instance
*/
function getProgressPlugin() {
var chars = 0, lastState, lastStateTime;
return new webpack.ProgressPlugin(function(percentage, msg) {
var state = msg;
@bendman
bendman / framework.css
Created February 28, 2012 18:45
BrkKyk CSS
/**
* Blaskan Framework
*/
/** =RESET ----- */
/**
* html5doctor.com Reset Stylesheet
* v1.6.1
* Last Updated: 2010-09-17
* Author: Richard Clark - http://richclarkdesign.com
@bendman
bendman / tinyscrollbar.js
Created April 25, 2012 17:10
tinyscrollbar comparison
/*
* Scripps Tiny Scrollbar
* Modified by adding scrollSim()
* - manually trigger onscroll event during move.
* - also fixed update function to return $(element)
*/
/*!
* Tiny Scrollbar 1.66
* http://www.baijs.nl/tinyscrollbar/
@bendman
bendman / closure.js
Created July 19, 2012 13:51
JS Perf Testing
// This file was automatically generated from c_template.soy.
// Please don't edit this file by hand.
if (typeof ClosureTemplate == 'undefined') { var ClosureTemplate = {}; }
ClosureTemplate.first = function(opt_data, opt_sb) {
var output = opt_sb || new soy.StringBuilder();
output.append('\t<h3>', soy.$$escapeHtml(opt_data.lastName), ' ', soy.$$escapeHtml(opt_data.firstName), '</h3>');
var skillList8 = opt_data.skills;
@bendman
bendman / Google Closure (Soy).sublime-build
Last active October 8, 2015 19:58
Sublime Text 2 - Google Closure Template Builder
{
"cmd": ["java", "-jar", "../SoyToJsSrcCompiler.jar", "--outputPathFormat", "../${file_base_name}.js", "${file}"],
"selector": "source.soy"
}
@bendman
bendman / inherit.js
Created August 21, 2012 17:46
Inheritance Test
var Builder = function(parentObj, childObj) {
var F = function() {};
F.prototype = parentObj;
return $.extend(new F(), childObj);
};
var parent = {
Inherit: 'parent inherit',
Both: 'parent value'
};
@bendman
bendman / symlinkFixer.js
Created December 10, 2015 03:26
Fix broken symlink binaries to be relative symlinks
// Find symlinks that don't work and fix them.
//
// This is done by:
// 1. Getting a list of all file paths in a directory
// 2. Filtering for broken symlinks by reading binary content as unicode
// 5. Determining relative path between source and target
// 6. Deleting old link file
// 7. Creating new relative link file
var fs = require('fs');
@bendman
bendman / bbp.conf
Last active December 20, 2015 13:09
Nginx Config for Boston Bike Party App
server {
listen *:80;
server_name api.bostonbikeparty.com;
error_log /Users/bendman/Documents/Development/bbp/logs/error.log info;
access_log /Users/bendman/Documents/Development/bbp/logs/access.log main;
location / {
proxy_pass http://bostonbikeparty.com:3000;
proxy_set_header Host $http_host;