Instantly share code, notes, and snippets.

James Burke jrburke

View GitHub Profile
View styles.less
Choose Atom, Stylesheet... menu to add these to your local style overrides.
These styles only work on the .left and .bottom toggle buttons, but should
be straightforward to copy the .left selectors and adjust for other edges.
.atom-dock-toggle-button:not(.atom-dock-toggle-button-visible) .icon {
opacity: 1;
transition: unset;
View gist:9101268

I have a node project. I want to use npm once to fetch a dependency, but from then on, do not depend on the npm registry. The packages installed may need to be compiled/built on different operating systems, not all the packages are pure JS.

I do not want an npm mirror, as I do not need all of npm. I just need the specific versions of the packages I need in my project. I would always set dependency versions to exact version numbers, and would explicitly do version upgrades when I needed. My ideal work flow:

mkdir project-node_modules
cd project-node_modules
mkdir node_modules

# install a bunch of packages, but only in source form, no building
View gist:7896791
// For any third party dependencies, like jQuery, place them in the lib folder.
// Configure loading modules from the lib directory,
// except for 'app' ones, which are in a sibling
// directory.
baseUrl: 'lib',
paths: {
app: '../app'
View gist:7455354

Design forces:

  • ECMAScript (ES) Module Loader API is coming. The ES module ID syntax are strings that are just treated as string IDs and not paths.
  • Existing JS module experience in CommonJS/Node/AMD worlds of using module IDs that are resolved to a URL/path for fetching.
  • Better package managers are coming for front end web apps. These package managers install assets by IDs not by paths.
  • For front end code, baseURL + moduleID + '.js' is likely the default ID-to-URL resolution, but other declarative config could be possible for browser-based ES Module Loaders. Examples of useful declarative config in this area are the problems solved via common AMD loader config

So it will be common in JS code to use string IDs, and not URLs to refer to dependency resources.

With the coming of web components and custom elements, it will be possible for a custom element to depend on other custom e

View clock.patch
diff --git a/apps/clock/Makefile b/apps/clock/Makefile
index e17f42e..78e8465 100644
--- a/apps/clock/Makefile
+++ b/apps/clock/Makefile
@@ -1,9 +1,16 @@
-# We can't figure out XULRUNNERSDK on our own; it's complex and some builders
-# may want to override our find logic (ex: TBPL), so let's just leave it up to
-# the root Makefile. If you know what you're doing, you can manually define
-# XULRUNNERSDK and XPCSHELLSDK on the command line.
View gist:6585693
// When doing a regular imap sync (this one is set to 20 seconds):
I/GeckoDump( 473): LOG: cronsync-main: wake locks acquired: [object MozWakeLock] for account IDs: 0
I/Gecko ( 473): WLOG: cronsync: received an alarm via a message handler
I/Gecko ( 473):
I/Gecko ( 473): WLOG: cronsync: ensureSync called
I/Gecko ( 473):
I/GeckoDump( 473): LOG: email oncronsyncstart: 0
I/Gecko ( 473): WLOG: syncDateRange: 1379030400000 null
I/Gecko ( 473): WLOG: Skewed DB lookup. Start: 1379055600000 Fri, 13 Sep 2013 07:00:00 GMT End: null null
View build.js
//run in node to do the build
var requirejs = require('requirejs'),
fs = require('fs'),
depsRegExp = /\/\*DEPENDENCIES\*\//,
globalMapRegExp = /\/\*GLOBALMAP\*\//,
shimmer = fs.readFileSync('shimmer.js', 'utf8'),
wrapStart = fs.readFileSync('wrap.start', 'utf8');
// You could generate these with code if you want a dynamic build script
View gist:6457819
_waitForTransitionEnd: function(cardId) {
var client = this.client;
client.waitFor(function() {
var condition = false;
function() {
var Cards = window.wrappedJSObject.require('mail_common').Cards,
card = Cards._cardStack[Cards.activeCardIndex],
cardNode = card && card.domNode;
View gist:6444081
// Optionally log all calls done to prototype methods. Uncomment this
// section to get traces when trying to debug where flow gets stuck.
Object.keys(Email.prototype).forEach(function(key) {
var desc = Object.getOwnPropertyDescriptor(Email.prototype, key);
if (!desc.get && !desc.set && typeof Email.prototype[key] === 'function') {
var oldMethod = Email.prototype[key];
Email.prototype[key] = function() {
var args =, 0).map(function(arg) {
return String(arg);
View gist:6374043
type: 'cronsync',
uid: undefined,
cmd: 'alarm',
args: ['accountidhere', intervaltime]
//example call