Prep Cook Human

I was slicing the hard-boiled eggs for the salad bar and the pantry station when Gabriela stopped crumbling the cheese and turned to me. She told me she wanted me to hear the new song she wrote last night. I stopped slicing the eggs. I opened my mouth as if to speak but in that instant realized I had no words, only anticipation. She smiled as though she understood. Then she started to sing.

I can tell you how
This world made your father blind

And you can tell me how
Your father made
Your mother lose her mind

Entelechy

  • the realization of potential.
  • the supposed vital principle that guides the development and functioning of an organism or other system or organization.
  • the soul.

Destroying a Javascript API

Problem:

  • A third party JS API doesn’t have a destroy method.
  • The JS API can only be instantiated once per page view.
  • Writing a single page app by its nature requires a dynamic DOM
  • Dynamic DOM will require the JS API to be spun up and destroyed on multiple elements during the life cycle of the page view

What to do?

Answer: Destroy it yourself. By highjacking the events as they are created, you can gather a collection of all events that the JS API has created during instantiation. When it’s time to destroy the JS API, reference your collection of events to remove them from the window:


var _apiE 		= []; // Array of JS API Events.
var _scriptTag 	= null; 

var _methods: {

	initJsApi: function() {
		// Hook the native event listener to capture JS API events.
		// Preserve the original native method.
		var ogAddEventListener = window.addEventListener;

		// Override the native method.
		window.addEventListener = function() {

			// Capture JS API events.
			_apiE.push({
				type: 			arguments[0],
				listener: 		arguments[1],
				useCapture: 	arguments[2]
			});

			// Call the original native method after capturing the event 
			// so JS API and the browser do their business as usual.
			ogAddEventListener.apply(this, arguments);
		};

		// Add the <script> tag to the DOM dynamically to load the JS API.
		// jQuery will inject ?_0000 cache buster to script tag src attribute value.
		// Some sites will not allow the JS API to be requested with the querystring present.
		// Use native element to work around this.
		_scriptTag = document.createElement('script');
		_scriptTag.setAttribute('src', 		'https://js-api-cdn.com/js/third-party-api.min.js');
		_scriptTag.setAttribute('type', 	'text/javascript');
		_scriptTag.setAttribute('id', 		'js-api-script');
		$('html').append(_scriptTag);

		// Wait for the JS API to instantiate after the <script> has been attached to the DOM.
		var intvl = setInterval(function() {

			if (window.jsApi) { // The actual name of the API object would go here.

				clearInterval(intvl);

				// Instantiate the JS API.
				window.jsApi.init({ options });

				// Reset the native event listener to the original method so we stop capturing events.
				window.addEventListener = ogAddEventListener;
			}
		}, 5);
	},

	destroyJsApi: function() {

		// Remove the <script> tag and instance of the JS API.
		$('#js-api-script').remove();
		delete window.jsApi;

		// Remove the events that the JS API added.
		$.each(_apiE, function(i, e) {

			window.removeEventListener(e.type, e.listener, e.useCapture);
		});
	}
};

Danger: other events that are registered while waiting for the JS API to instantiate will also get removed.

California Stars

I’d like to dream
My troubles all away
On a bed of California stars

Jump up from my starbed
Make another day
Underneath my California stars
They hang like grapes
On vines that shine
And warm the lovers’ glass
Like friendly wine

So I’d give this world
Just to dream a dream with you
On our bed of California stars

I’d like to rest my heavy head tonight
On a bed of California stars
I’d like to lay my weary bones tonight
On a bed of California stars

I’d love to feel
Your hand touching mine
And tell me why
I must keep working on

Yes I’d give my life
To lay my head tonight on a bed
Of California stars

California Stars, Woodie Guthrie

Palms Shy Bay

Calm heights in flights,
spring rolls and soundtracks swift.
I’m mesmerized.
You chose to give me,
bravely innocent and unexpected.
I touch your face.
You requite.
This is perfect now.

Making it in the Dirty City

I’ve always thought the phrase “making it” was bewildering. Eg “I got this job in this great city; I finally made it!” “Making it” or finding success has always been an ongoing internal experience for me. All of the benefits that happen along the way are byproducts of constantly striving to “make it.” It’s not an end, it’s a process. For me, the goal of this process has always been to blow my own mind: turning ideas over and over and finding the perspectives and angles and breaking them apart to glue them back and start over and over and over until you find the part of the idea that no one else has seen. To me, that has always been “making it.” It hasn’t always turned out so well because sometimes it’s just months of madness… literally. But other times it unfolds and explodes in an unexpected moment. And sometimes when I think I found novelty, I discover it’s already been done… by everyone else who isn’t living in my sensory deprivation cave. But on the occasion that it’s passed the reality check and it’s valid and my own mind has blown, I can give it away so I can watch your face melt too. Then I know I made it.