Skip to content

Instantly share code, notes, and snippets.

View repeatingbeats's full-sized avatar

Steve Lloyd repeatingbeats

  • western hemisphere
View GitHub Profile
@repeatingbeats
repeatingbeats / README.md
Last active December 20, 2015 12:08
Let's try to make a bl.ock

A bl.ock

That does nothing.

@repeatingbeats
repeatingbeats / pretty_examples.md
Last active December 14, 2015 11:39
Vim + UltiSnips + UMD

Pretty Examples


Keystrokes:

umdp<Tab>foo

Output:

(function (root, factory) {                                                      
@repeatingbeats
repeatingbeats / heroku-ssl-dns.md
Created November 30, 2012 23:34
Heroku SSL/DNS setup

SSL/DNS Setup on Heroku

  1. Add SSL addon

     heroku addons:add ssl --app APP_NAME
    
  2. Add SSL cert (in this case, *.sherpa.io wildcard) and note the herokussl.com subdomain

     heroku certs:add certs/STAR_sherpa_io-bundle.pem sherpa.io.key --app APP_NAME
    
@repeatingbeats
repeatingbeats / rootExportsTerse.js
Created August 29, 2012 23:59
Terse version of UMD rootExports.js
// Terse implementations of the returnExports UMD wrapper (https://github.com/umdjs/umd/blob/master/returnExports.js)
// No dependencies
(function (root, factory) {
if (typeof exports === 'object') module.exports = factory();
else if (typeof define === 'function' && define.amd) define(factory);
else root.moduleName = factory();
}(this, function () {
// Return a module definition
return {};
@repeatingbeats
repeatingbeats / requirejs.md
Created April 25, 2012 05:32
Initial thoughts on requirejs

Earlier today, I tweeted 'requirejs, why so complicated?' [1]

To add some context, I'm working on a project that involves relatively complex pipelining of static assets, and I'm investigating use of the RequireJS optimizer programmatically [2] to handle the part of the process that bundles related JS modules into bundled scripts to be passed down the pipeline for minification, fingerprinting, and deployment.

In retrospect, the answer to my flippant tweet is "because the tool solves a lot of complicated problems", but it took a while to back out from a long description of the various configuration options [3] to the options that were relevant to my problem. In particular, I felt it would have been helpful to have required options called out first, as I spent a while with a baseUrl assuming that all the js files in that dir would be optimized into the output. Instead, I got a cryptic Cannot read property '0' of undefined error.

I eventually realized that I needed to provide at least one module to optim

@repeatingbeats
repeatingbeats / asynchronicity.js
Created March 8, 2011 06:25
Some asynchronous patterns
/**
* asynchronicity.js
*
* Steve Lloyd <steve@repeatingbeats.com>
*
* Exploratory script covering various issues that arise working with
* asychronous javascript functions. This script is intended to be run from
* the command line with node, i.e.:
* $ node asynchronicity.js
*
@repeatingbeats
repeatingbeats / nodeunit_example.js
Created January 27, 2011 20:07
Example structure for nodeunit tests with nested groups and setUp/tearDown functions
/**
* Example structure for nodeunit tests with nested groups and setup/teardown
* functions. Run | nodeunit nodeunit_example.js | to see a printout of
* function names in the order that they are called. There aren't any actual
* tests here.
*/
process.env.NODE_ENV = 'test';
var testCase = require('nodeunit').testCase;
@repeatingbeats
repeatingbeats / sbGetPlaydar.js
Created January 18, 2011 00:05
get the playdar service
var playdar = Cc['@repeatingbeats.com/playdar/playdar-service;1']
.getService(Ci.sbIPlaydarService);