Skip to content

Instantly share code, notes, and snippets.

View mike-north's full-sized avatar
Wish I had more time to work on OSS

Mike North mike-north

Wish I had more time to work on OSS
View GitHub Profile
@mike-north
mike-north / heroku_status_check.js
Created June 15, 2012 16:18
Check heroku platform status, and respond accordingly
/**
* A function to check heroku status, and return results to a callback
*/
function heroku_status(callback) {
//YQL is necessary becasue heroku status JSON data is not padded
$.getJSON("http://query.yahooapis.com/v1/public/yql",
{
q:"select * from json where url=" +
"\"https://status.heroku.com/api/v3/current-status.json\"",
@mike-north
mike-north / bootstrap_button_columns.css
Created July 15, 2012 19:08
Button columns for Twitter Bootstrap
.button-column {
width: 100%;
}
.button-column button.btn, .button-column a.btn {
width: 100%;
border-radius: 0px;
border-top-width: 0px;
}
.button-column button.btn:first-child, .button-column a.btn:first-child {
border-top-width: 0px;
@mike-north
mike-north / array_promises_in_sequence.js
Created October 26, 2014 04:49
Run a promise-based operation on each item in an array, in sequence
// An array of data to operate on
var dat = ['a', 'b', 'c', 'd', null, 'e'];
/**
* A long running task to run for each element of the array.
* It must return a promise
*/
function doThing(arg) {
return new Promise(
function (resolve, reject) {
@mike-north
mike-north / Adding-a-template-to-the-DOM.markdown
Created March 11, 2015 07:48
Adding a template to the DOM
@mike-north
mike-north / .travis.yml
Created April 14, 2015 09:27
PhantomJS 2.0 for travis-ci
---
language: node_js
node_js:
- "0.12"
- "iojs"
sudo: false
cache:
directories:
@mike-north
mike-north / runWhenArrived.js
Last active August 29, 2015 14:19
Run code upon arrival of DOM elements, when you have no event to listen for
/**
* Poll for presence of DOM elements until they
* are found (or until timeout is reached), and then
* call a function as soon as a non-empty result is found
*
* @param {string} selector CSS selector to check for
* @param {Function} fn callback function(jqSelector, elapsedTimeInMs) {}
* @param {int} timeout timeout in ms (optional)
* @param {int} interval polling interval in ms (optional)
*/
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<!-- jQuery 1.11.1 -->
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<!-- Latest compiled and minified CSS -->
@mike-north
mike-north / gist:1aeca68459c375175769
Created May 22, 2015 02:09
Ember.js version string parsing
var emberParsingRegex = /^([0-9]+)\.([0-9]+)\.([0-9]+)(?:(?:\-(alpha|beta)\.([0-9]+)(?:\.([0-9]+))?)?)?(?:\+(canary))?(?:\.([0-9abcdef]+))?$/;
@mike-north
mike-north / GithuOrgPages_NavigationWorkaround.md
Created June 2, 2015 19:12
Github Org and User Pages - Hash navigation workaround

Github Org and User Pages URL Redirect

If you are using "hash" navigation for a single page app on Github Org or User Pages, you may run into a URL problem.

The Problem

Users who visit a url like

http://myorg.github.io/upcoming-events