Skip to content

Instantly share code, notes, and snippets.

View wheeyls's full-sized avatar

Michael Wheeler wheeyls

View GitHub Profile
return "<script type=\"text/javascript\" src=\"/bmfsweb/"+lower(_system_company_name)+"/image/Directory/FILENAME.js\"></script>";
return "<script type=\"text/javascript\" src=\"/bmfsweb/"+lower(_system_company_name)+"/image/Directory/FILENAME.js\"></script>";
@wheeyls
wheeyls / repeat_until.js
Created December 6, 2011 03:47
Repeat until - a simple polling function
/**
* Poll until a test passes.
* When the test returns something, (not false) pass its value to and_then
*
* Example:
* repeat_until(function() {
* return "some value";
* }).and_then(function(result) {
* console.log(result); // "some value"
* }).timeout(function() {
@wheeyls
wheeyls / asyncStack.js
Created February 29, 2012 05:23
Stream fiddling - concatenate arrays into functional list, async processing
function keyValuePairs(callback) {
[1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6].forEach(function (i) {
callback(i);
});
}
function numbers(callback) {
for(var i = 0; i < 3; i++) {
callback([1,2,3]);
}
@wheeyls
wheeyls / main.js
Created March 5, 2012 21:22
resize
// Google analytics for screen dimensions, resizing
// http://code.google.com/apis/analytics/docs/tracking/eventTrackerGuide.html
(function () {
var w, h, str, log;
if(typeof _gaq === "object" && _gaq.push) {
w = $(window).width();
h = $(window).height();
str = w + "x" + h;
log = function (action, label, value) {
@wheeyls
wheeyls / about.md
Last active October 8, 2015 09:09
SSH Config file to setup some simple tunnels between myself and a coworker

Usage:

First, setup the tunnels.

Mike runs: ssh mikes_tunnels

Mark runs: ssh marks_tunnels

@wheeyls
wheeyls / doc_instance.rb
Created August 14, 2012 00:56
Document/Paragraph Data Model
def process_paragraphs(paragraphs_attrs)
paragraphs_attrs.select do |key, value|
# make changes and filter out existing attributes
end
end
def assign_attributes(attr, options = {})
paragraphs_attrs = attr.delete :paragraphs_attributes
# manually update any existing paragraphs here
paragraphs_attrs = process_paragraphs(paragraphs_attrs)
@wheeyls
wheeyls / floaters.html
Created August 17, 2012 05:35
A bare bones Tumblr Template.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
{block:Description}<meta name="description" content="{MetaDescription}" />{/block:Description}
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' />
<title>{Title}</title>
<link rel="shortcut icon" href="{Favicon}" />
<link rel="apple-touch-icon" href="{PortraitURL-128}"/>
category.posts
#=> [] # list of all posts
posts.categories
#=> [] # list of all categories
@wheeyls
wheeyls / tween.js
Last active October 10, 2015 05:08
function tween(start, end, fn) {
var duration = end - start
;
fn = fn || function (v) { return v; };
return function (continuation, now) {
var relativeNow = now - start
, normalNow
, res