Webby thoughts, most about around interesting applications of ecmascript in relation to other open web standards. I live in Mountain View, California, and spend some of my spare time co-maintaining Greasemonkey together with Anthony Lieuallen.
2012-12-31
Surprise is data
2012-11-25
View rendered source bookmarklet
I haven't made a bookmarklet from scratch in a long while, but after looking at this codepen I wrote a while ago to demonstrate copying one javascript document into another, it occurred to me that it could easily become a modern "view rendered source" bookmarklet, that might even work on iOS devices and the like, where a view source feature is sorely missing.
Here is the result: view rendered source
On clicking it, you get a "view source" iframe with the source of the current document, in whichever state it was when you clicked the button, and when you click (or tap) that it goes away again.
I have yet to try it on an iDevice myself, but I have high hopes. To my surprise, manually entered bookmarklets like this one refuse to run in a modern Safari, though smaller ones that load their js payload over the wire instead seem to work, so I might make a gist of the code too, if that is what it takes.
Enjoy!
2012-10-18
Absolute url from a relative url and base_url
Today I needed a javascript url resolver to get absolute urls for urls mentioned in css files - resolved against the url of the stylesheet, not the current page. Fortunately, your browser already implements this natively, it's just not exposed in DOM APIs, so it needs a little DOM cleverness to coax out the functionality:
You can play around with it a little here, to see that your browser supports it, too. You should even be able to use a relative URL as the base_url
parameter, which should get resolved against the page url -- which here is the jsfiddle url shown, as that demo is running in an embedded iframe, rather than on this blog itself:
It of course won't work in node.js, but hopefully it'll be useful to something you or others are doing, too. Use as you like; it's all public domain / MIT licensed goodness, whichever you fancy.
2012-07-06
Facebook and the Human Mind
Facebook has created a niche where its inputs are humans (expressing human behaviour) and where its outputs are massive amounts of highly measurable data about said humans, and all the ways they affect, relate to and interconnect with each other, and other entities of the world. Both that data, and the behaviours that end up amassing the data, are highly profitable -- and exponentially more so, the larger its body of subjects. But let's look closer and deeper at the human behaviours it promotes, where it gets interesting:
I think I see the fundamental component of life itself, as it applies to behaviour: any behaviour which increases the likelihood of recreating itself, increases the rate of repeating itself, and increases the accuracy of the reproduction of itself, is (from a natural selection point of view,) more fit. Whenever this mechanism randomly shows up in nature (which only needs to happen once in a universe, as the seed mutates, and down the line reproduces the incredible wealth of complexity some unironically like to call "creation"), we call it Life. This behaviour, then, is a form of life that lives, reproduces and mutates in humans, a second order life form Richard Dawkins and others call memes. And Facebook operates as an incubation chamber for this life form and its hosts, a catalyst of the set of behaviours that drive the reaction. Facebook is an echo-chamber for memes -- creating, spreading and remixing memetic life, provisioning it with an ever increasing body of fertile human minds to live (and evolve) in.
Let me establish some vocabulary to help clarify this post: a Facebook operator, as I use the word in this post, refers neither to any Facebook employee or direct partner, but to anyone using Facebook's behaviour measurement tools monitoring what transpires in the system, what type of stimulus (under what circumstances) is how successful at driving engagement. I believe these tools are available to anyone creating or owning a Facebook Page, but otherwise for the most part invisible to everyday users of the Facebook medium itself. For reuse of already established Facebookian language, where I write "activity", you may think "meme", if you so prefer, or a Facebook Page post of some sort, be it a video, picture, link, or just a piece of text, as this is their chosen granularity of measurement / reporting.
What a Facebook operator sees is essentially how successful they are at producing and catalyzing user behaviour that spreads, as expressed by per-activity virality and reach factors, measuring reproduction rate (fecundity), number of subjects (how many humans an activity got exposed to), and on aggregate what shape those flows took; if it funneled through a few people that caused large multiplication factors, or through a large number of people that each produced a tiny multiplication factor, say.
Philosophically, I find the emerging picture telling a story of our culture's present state, and future direction, as the phenomenon seems strongly self-reinforcing. The story I see emerging behind and throughout the data is to drive humans to addictive-compulsory behaviour in general, and the dopamine cycle of attention-deficit disorder in particular. Dopamine is released in response to an action as a biochemical reward. Facebook, in a substantial way, operates like an enormous (human-focused) Skinner box, set on tightening the dopamine hit cycle, optimizing that loop to tighten it as much as possible, and delivering as successful stimulus as possible -- where the measure of success is to what extent each activity creates a dopamine blip in the body of people they get exposed to and to what extent they then choose to pass it on to their peers.
This phenomenon is not isolated to Facebook in particular, they just happen to be at its leading edge. I am sure Google Plus, Twitter and others in this field very much want to do the same, but just don't yet have (or expose) the same refined measurement tools to its operators.
We should not be surprised that Facebook, a company embracing "The Hacker Way" at its core, is first to deliver on this at scale; more than any profession I know, hackers embrace and understand the mechanics of tight cycles, and optimizing your development cycle (by adopting whatever tools, processes and mechanisms you can create, imagine, or buy for money, that shortens or streamlines it), and how massively it pays off in rate of progress. In Facebook's case, I see them doing the same to the smallest unit of activity in their Skinner box, and outsourcing the optimization to any external, willing, self-interested entity which helps them turn a profit for free. (Google is attempting to do the same to the web at large via Google Analytics, for that matter, but have a substantially lower degree of control, and higher granularity of measure.)
I am less interested in (and would kindly discourage any comments to that effect) all sorts of judgmental aspects, condemning Facebook (or any other entity) or similar for its role in this. Facebook, Twitter, Google Plus and others are, for better or worse, a replacement for the mainstream media journalism of the past, and in all the above I believe I have outlined the same mechanisms it has been rehashing over the decades it has existed, only at a much higher pace, due to the now far tighter and more highly instrumented cycle. The tabloid genes that thrived in their old, leakier Skinner box, is thriving and evolving in and to this shiny new Skinner box and shows up in all its most pre-digested forms, following laws of least-common-denominatorialist journalism, largest-emotional-impact journalism and similar -- all far more attuned to impact-on-subject than any other measurement of fitness or higher order utility such as whether the content serves its recipient in some way, informing them, making them happier, or more successful, as opposed to just more entertained and engaged with the medium.
I believe it's important to realize that it's somewhat useless to moralize over what transpires in the system or what people "ought" to be doing instead with their time, or what operators ought to be broadcasting into other people's spans of attention, as what we see emerge here is just a mirror image of what behaviours the human mind is conditioned for and dutifully reproduces, as evolution taught her, and which served her well in the few hundred thousand years to date, in the kind of circumstances she lived under throughout most of that period.
More usefully, I think, is to think of how we choose to expose ourselves to these kinds of tools, knowing that we are humans with very similar biological underlying programming, and to assess what values we derive from their use, how much and in what formats, under which circumstances and in which company (online, here) we subject ourselves to these media. Especially, you might benefit from thinking of it as you would a recreational drug, as its impact on you at a biochemical level is similar, as implemented by your biological hardware and social software.
And, much like our judgment is impaired by drugs and we do things that we at the time don't see the consequences of, down the line, our use of these online social systems, to varying (but substantial) degrees hides the future impact of our actions from us, as the visibility of our actions is multiplied million-fold from what they used to be in the pre-internet days of humanity, from which we still draw most of our genes and behaviours. Especially as this activity data trickles to places your typical drunken stupor was safely insulated from just a decade ago, and as power centers wielding all sorts of control over our lives, have started taking an interest in this data haven, and what bits of trivia about us they may draw upon to influence decisions concerning us. This is entirely invisible today, where we used to have at least the semblance of control in the age when the people we saw around us, were a decent hint to the reach of what transpired at any point in time.
Mind your step, be wary of what values you derive from what you invest your time and attention in, and maybe occasionally stop for a moment to think about how you prefer to engage your mind and connect with yourself, other humans and the world of thoughts and ideas. You get to choose all of the above, as long as you actually do choose, as opposed to following your unthinking hard-wired programming.
2012-06-24
Github TV ad
This is a transcript of the Github TV ad. If you haven't seen it, think "Apple commercial", Jonathan Ive's dreamy narrative, British accent, the whole jive, and you'll have it about right. Okay, you're set; cue soft music:
Here at Github, we like to fork the best ideas in the valley and spin them a little different. You might not have heard about our philantropic branch (because we don't like to brag), but it's actually the secret behind some of our most groundbreaking new innovations.
Github Biolabs is how Tom Preston-Werner, in late 2007 and before we were even founded, re-imagined Google's "20% time". We started Github as an incubator, here at the San Francisco asylum for mad scientists, and some of our most brilliant employees began their career doing 20% time with us, as a precursor to their first parole leave. None has left us yet.
[Cut to a person lying in the grass under a huge tree wearing a light visor, skimming through and tweaking its genome via Minority Report style gestures. Chromosomes fly by in the air above, zooming in and out, as she unfolds, marks, cuts, re-folds, pans, pulls, merges, rebases, pushes and splices sequences into the tree. She is wicked fast.]
At Github Biolabs, we have four saps on tap, an expansive green-house, and a beautiful arboretum. It is here that our scientists, using recombinant DNA splicing techniques, in this social open source setting, literally Create New Apples.
[Cut back to narrator, taking a bite out of one. Fade to white. Fade to logo:]