James Burke jrburke

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
1 2 3 4 5 6 7 8 9 10
// 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.
requirejs.config({
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
1 2 3 4 5 6 7 8 9 10
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.
-ifndef XPCSHELLSDK
View gist:6585693
1 2 3 4 5 6 7 8 9 10
// 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
1 2 3 4 5 6 7 8 9 10
//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
1 2 3 4 5 6 7 8 9
_waitForTransitionEnd: function(cardId) {
var client = this.client;
client.waitFor(function() {
var condition = false;
client.executeScript(
function() {
var Cards = window.wrappedJSObject.require('mail_common').Cards,
card = Cards._cardStack[Cards.activeCardIndex],
cardNode = card && card.domNode;
View gist:6444081
1 2 3 4 5 6 7 8 9 10
// 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 = Array.prototype.slice.call(arguments, 0).map(function(arg) {
return String(arg);
View gist:6374043
1 2 3 4 5 6 7 8 9 10
worker.postMessage({
type: 'cronsync',
uid: undefined,
cmd: 'alarm',
args: ['accountidhere', intervaltime]
});
 
//example call
 
worker.postMessage({
View dmseg.txt
1 2 3 4 5 6 7 8 9 10
<6>[ 0.000000] Booting Linux on physical CPU 0
<6>[ 0.000000] Initializing cgroup subsys cpu
<5>[ 0.000000] Linux version 3.0.21-perf-ga969f85-00004-gda485a1 (android-bld@aclgcl-ubnt72) (gcc version 4.4.3 (GCC) ) #1 SMP PREEMPT Thu Jun 27 22:09:07 CST 2013
<4>[ 0.000000] CPU: ARMv7 Processor [410fc051] revision 1 (ARMv7), cr=10c5387d
<4>[ 0.000000] CPU: VIPT nonaliasing data cache, VIPT aliasing instruction cache
<4>[ 0.000000] Machine: QCT MSM7x27a FFA
<6>[ 0.000000] Partition (from atag) boot -- Offset:28f Size:30
<6>[ 0.000000] Partition (from atag) system -- Offset:2bf Size:640
<6>[ 0.000000] Partition (from atag) cache -- Offset:8ff Size:140
<6>[ 0.000000] Partition (from atag) misc -- Offset:a3f Size:20
Something went wrong with that request. Please try again.