This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
// to capture ALL events use: | |
Ext.util.Observable.prototype.fireEvent = Ext.Function.createInterceptor(Ext.util.Observable.prototype.fireEvent, function(evt) { | |
var a=arguments; | |
console.log(this,' fired event ',evt,' with args ',Array.prototype.slice.call(a,1,a.length)); | |
return true; | |
}); | |
// to capture events for a particular component: | |
Ext.util.Observable.capture( | |
Ext.getCmp('my-comp'), |
So we got nexe to compile nodejs projects to an executable binary:
$ nexe -i myproject.js -o myproject.bin -r 0.10.3
Caveats:
For example, suppose I wanted to download the package foo
at the version ~0.2.3
. My package client would go to the central ref server and query the tags of foo
. It would then see that foo
has versions 0.2.3
, 0.2.4
, and 0.3.0
. It would decide that 0.2.4
is the desired version based on the original range query. Along with the refs the central server also told it the hashes of the root tree node for these package versions. It now knows which hash contains the desired package.
Now to get the package, we need to query the distributed network for t
Update: my blog post The lie of the API details the issues with current APIs.
Background: I'm a researcher in semantic hypermedia, at the moment comparing different APIs for accessing metadata for human and machine consumption.
Story: I am browsing a cultural website and want to retrieve the metadata of the object I'm looking at in a machine-readable format. The steps below are the actual steps that I've undertaken on different sites.
I'm looking at the object http://collection.cooperhewitt.org/objects/35460799/.
(function(){ | |
"use strict"; | |
Array.prototype.clean = function() { | |
for (var i = 0; i < this.length; i++) { | |
if (this[i] == null) { | |
this.splice(i, 1); | |
i--; | |
} | |
} |
title: Clock | |
DomImage(dom/image),DomQuerySelector(dom/querySelector),DomSetHtml(dom/setHtml),CanvasGetContext(canvas/getContext),CanvasDrawImage(canvas/drawImage),DomQuerySelector2(dom/querySelector),MathDegreesToRadians(math/degreesToRadians),DateCreate(date/create),DateGetSeconds(date/getSeconds),CanvasBeginPath(canvas/beginPath),CanvasMoveTo(canvas/moveTo),CanvasLineTo(canvas/lineTo),CanvasLineTo2(canvas/lineTo),CanvasLineTo3(canvas/lineTo),CanvasLineTo4(canvas/lineTo),CanvasStroke(canvas/stroke),MathMultiply(math/multiply),CanvasRotate(canvas/rotate),CanvasSetAttributes(canvas/setAttributes),CanvasFill(canvas/fill),CanvasTranslate(canvas/translate),UtilWait(util/wait),ConsoleLog(console/log),CanvasStrokeText(canvas/strokeText),CanvasSave(canvas/save),ConsoleLog2(console/log),DomAddMouseEvent(dom/addMouseEvent),DomAlert(dom/alert),DateCreate2(date/create),CanvasRestore(canvas/restore),CanvasSetAttributes2(canvas/setAttributes),SoundAlert(sound/alert) | |
"http://www.dhtmlgoodies.com/tutorials/canvas-clock/i |
I was tired of Chrome eating all my laptop resources so I decided to put some limit to it with cgroup.
As I was using Ubuntu 12.04 with support for cgroup, I installed the package cgroup-bin
and add the following group to the file /etc/cgconfig.conf
:
group browsers {
cpu {
# Set the relative share of CPU resources equal to 25%
cpu.shares = "256";
}
// === Arrays | |
var [a, b] = [1, 2]; | |
console.log(a, b); | |
//=> 1 2 | |
// Use from functions, only select from pattern | |
var foo = () => [1, 2, 3]; |