Posts

Showing posts from 2015

Ghosts of New Years Past

Image
Years ago, I was working two jobs and going to school full time.   Rarely did the two jobs overlap, but one of the few times they did was on a particular New Year’s Eve in the mid-1980s. I worked security at a shopping mall forty hours a week.   The job was good because it paid better than flipping burgers and it offered plenty of down time to study for my classes.   My second job involved playing keyboards in various bands in dives around L.A. and at weddings and bar mitzvahs.   At the mall, I met many off duty LAPD officers who moonlighted as additional security.   All of the officers and my fellow security personnel knew I was a musician, and most of them also were familiar with the places where I played. One New Year’s Eve, I had to work my regular shift at the mall before running home to change, load up my equipment, and get myself to Hollywood to play at a Filipino night club called The Bayanihan .   A friend of mine recommended me for the job.   He was the regular keyboardis

Seven Thousand Ways To Listen

Image
There are 7000 living languages on earth, says Mark Nepo in his book, Seven Thousand Ways To Listen: Staying Close To What Is Sacred (Atria Paperbacks, 2013).   He is quoting the Nigerian linguist Olasope Oyelaran.   To hear, truly to hear what is spoken in any language, with the body, with expression, involves a kenosis, an emptying of the self.   Only then, according to Nepo, can one enter into the realm of deep listening. I first encountered Nepo’s work in his The Book of Awakening (Conari Press, 2000).   He is a teacher and a survivor of cancer which led him to develop his own philosophy of being in the present, a not-unheard-of idea similar to many eastern philosophies, including Buddhism.   We must learn, he argues in his introduction, to return “quite humbly, to the simple fate of being here.”   This is where deep listening becomes sacred work. Ironically, a loss of hearing due to chemotherapy drew Nepo back to the fundamental sensory perception of listening.   It was in this

The future of bundling JavaScript modules

This blog post examines how the bundling of modules is affected by two future developments: HTTP/2 and native modules. Why we bundle modules Bundling modules means combining several files with modules into a single file. That is done for three reasons: Fewer files need to be retrieved in order to load all modules. Compressing the bundled file is slightly more efficient than compressing separate files. During bundling, unused exports can be removed, potentially resulting in significant space savings. JavaScript modules With ECMAScript 6, JavaScript finally got built-in modules (I’m calling them JavaScript modules for the remainder of this blog post). However, that feature is currently in a strange position: On one hand, ES6 fully standardized their syntax and much of their semantics. They have become a popular format for writing modules and their static structure enables the automatic omission of unused exports (also known as “tree-shaking” in the JavaScript world). On the other hand,

Time Away

Image
Christmas Eve.   Probably the best one ever.   Just the two of us.   Quiet.   Peaceful.   Cold out, enough for a fire in the fire place.   Plenty of time to rest, read and sleep. I have so much needed time away.   A moment’s pause in the rough and tumble universe.   Some days, I would step outside my office, look down the hill to the Santa Monica Bay and wish I could fly away.   Too many words, words, words.   I did not want to write or read another one. But lately, I’ve felt the call to come back to the world.   It is time to pick up pen and paper again.   It is time to sit in front of the fire and read, read, read long into the night.   Contemplate the ideas we seek, the message in a bottle that is a good book. It is natural to search for stillness in our lives, a shelter in the storm.   The holiday season can be brutal.   Car commercials interrupt my Pandora stream.   Deals and gifts and endless advertisements to change your life by buying and buying and buying.   Capitalism’s fine

Tree-shaking with webpack 2 and Babel 6

Rich Harris’ module bundler Rollup popularized an important feature in the JavaScript world: tree-shaking , excluding unused exports from bundles. Rollup depends on the static structure of ES6 modules (imports and exports can’t be changed at runtime) to detect which exports are unused. Tree-shaking for webpack is currently in beta. This blog post explains how it works. The project we are going to examine is on GitHub: tree-shaking-demo How webpack 2 eliminates unused exports webpack 2, a new version that is in beta, eliminates unused exports in two steps: First, all ES6 module files are combined into a single bundle file. In that file, exports that were not imported anywhere are not exported, anymore. Second, the bundle is minified, while eliminating dead code. Therefore, entities that are neither exported nor used inside their modules do not appear in the minified bundle. Without the first step, dead code elimination would never remove exports (registering an export keeps it alive).

Installing past or future versions of npm packages

npm lets you install versions of packages other than the current one, via: npm install «package-name»@«tag» npm install «package-name»@«version» Installing tags Tags are aliases for versions. You can look up available tags via: npm view «package-name» dist-tags Example: $ npm view webpack dist-tags { latest: '1.12.9', beta: '2.0.1-beta' } Installing versions You can look up available versions via: npm view «package-name» versions Example: $ npm view webpack versions [ '0.1.0', '0.1.1', ··· '1.12.8', '1.12.9', '2.0.0-beta', '2.0.1-beta' ]

Why is (0,obj.prop)() not a method call?

This blog post explores references , a mechanism used by the ECMAScript language specification to explain the difference between the following two expressions: obj.prop() (0, obj.prop)() Method calls versus function calls Consider the following object: var obj = { getThis: function () { "use strict"; return this; }, }; If you call obj.getThis , you have a method call ( this points to the object in which the method is stored): > obj.getThis() === obj true If you store obj.getThis in a variable and then call it, you are making a function call: > var func = obj.getThis; > func() undefined The effect is the same if you use the comma operator. Quick recap – the comma operator works like this: (expr1, expr2) === expr2 That is, both expressions are evaluated, the result of the whole expression is expr2 . If you apply the comma operator to obj.getThis before calling it, you are also making a f