- Install Xcode (Avaliable on the Mac App Store)
- Install Xcode Command Line Tools (Preferences > Downloads)
- Install depot_tools
$ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git$ nano ~/.zshrc- Add
path=('/path/to/depot_tools' $path)
| // === Arrays | |
| var [a, b] = [1, 2]; | |
| console.log(a, b); | |
| //=> 1 2 | |
| // Use from functions, only select from pattern | |
| var foo = () => [1, 2, 3]; |
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";
}| 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 |
| (function(){ | |
| "use strict"; | |
| Array.prototype.clean = function() { | |
| for (var i = 0; i < this.length; i++) { | |
| if (this[i] == null) { | |
| this.splice(i, 1); | |
| i--; | |
| } | |
| } |
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/.
- Distributed database with content-addressable values
- Node types are blobs and trees.
- Hashes use a secure hash (not sha1) since distributed p2p systems contain many untrusted nodes. (Or we could let security be a concern of a higher-level and just use this for the hard network scale problem)
- The actual named refs can still be in a central server with user authorization. Making that secure in a distributed system is considerably harder.
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
So we got nexe to compile nodejs projects to an executable binary:
- it downloads the nodejs source
- it creates a single file nodejs source (using sardines )
- it monkey patches the nodejs code to include this single file in the binary (adding it to the lib/nexe.js)
$ nexe -i myproject.js -o myproject.bin -r 0.10.3
Caveats:
- I had an issue with unicode chars that got converted: it uses uglify.js and this needs to be configured to leave them alone
| // 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'), |