Skip to content

Instantly share code, notes, and snippets.

View tbranyen's full-sized avatar

Tim Branyen tbranyen

View GitHub Profile
@tbranyen
tbranyen / jscs.json
Created February 10, 2014 19:43
My JSCS style configuration.
{
"maximumLineLength": 80,
"validateJSDoc": {
"checkParamNames": true,
"checkRedundantParams": true,
"requireParamTypes": true
},
all: synchronizer
#
synchronizer:
synchronizer lib/index.js > dist/out.js
@@make test
# R.js includes the `baseUrl` in the module normalization which incorrectly
# contextualizes it to the wrong location.
#
define(function(require, exports, module) {
"use strict";
var specialCharsExp = /[\^$\\\/.*+?()\[\]{}|]/g;
/**
* Escape special characters that may interfere with RegExp building.
*
* @param {String} value to escape.
* @return {String} safe value for RegExp building.
[Thu, 20 Feb 2014 01:29:54 GMT] [error] [<0.629.0>] OS Process died with status: 137
[Thu, 20 Feb 2014 01:29:54 GMT] [error] [<0.440.0>] OS Process died with status: 137
[Thu, 20 Feb 2014 01:29:54 GMT] [error] [<0.613.0>] OS Process died with status: 137
[Thu, 20 Feb 2014 01:29:57 GMT] [error] [<0.629.0>] ** Generic server <0.629.0> terminating
** Last message in was {#Port<0.3794>,{exit_status,137}}
** When Server state == {os_proc,"/usr/bin/couchjs /usr/share/couchdb/server/main.js",
#Port<0.3794>,
#Fun<couch_os_process.2.14837184>,
#Fun<couch_os_process.3.14837184>,5000}
** Reason for termination ==
// Use an AMD package here to gain access to nested internal modules.
require.config({
packages: [{
name: "jquery",
location: "vendor/jquery/src",
main: "index.js"
}]
});
// If we are using AMD, we don't care about core.
@tbranyen
tbranyen / 01.usage.sh
Last active August 29, 2015 13:56
Release Script
./release.sh 0.1.0
@tbranyen
tbranyen / register-parallel-tasks.js
Created March 6, 2014 21:29
Grunt: Register Parallel Tasks
var grunt = require("grunt");
grunt.registerParallelTasks = function(name, tasks) {
function runParallelTasks(tasks) {
tasks.forEach(function(name) {
var task = grunt.util.spawn({ args: [name], grunt: true });
task.stdout.pipe(process.stdout);
task.stderr.pipe(process.stderr);
});
@tbranyen
tbranyen / es6.js
Created March 9, 2014 03:54
Why ES6 has to be like this?
import modB from "./modB";
System.register("./modB", [], function() {
return { default: modB };
});
console.log(System.get('./modB').default);
@tbranyen
tbranyen / exports.js
Created March 13, 2014 18:36
CommonJS permutations.
// Literal value given to the module.
module.exports = {};
// Selective values being assigned.
exports.property = "value";
@tbranyen
tbranyen / 01.description.md
Last active August 29, 2015 13:57
AMD Feature

AMD Feature is a plugin that makes it easier to substitute modules based on a feature test. The easiest way to explain is through an example. Lets say you have a full featured plugin that is designed for a desktop browser, but when on a mobile device you want to load a similar plugin that is much lighter. AMD Feature allows you to describe the runtime conditions that determine which plugin would be loaded from a single call. Another use case could be something like jQuery/Zepto based on browser environment.

Inspired by: https://github.com/jensarps/AMD-feature