System directories
| Method | Result |
|---|---|
| Environment.getDataDirectory() | /data |
| Environment.getDownloadCacheDirectory() | /cache |
| Environment.getRootDirectory() | /system |
External storage directories
| function bytesToSize(bytes) { | |
| const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'] | |
| if (bytes === 0) return 'n/a' | |
| const i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)), 10) | |
| if (i === 0) return `${bytes} ${sizes[i]})` | |
| return `${(bytes / (1024 ** i)).toFixed(1)} ${sizes[i]}` | |
| } |
| var maxSize = 10485760; | |
| request({ | |
| url: url, | |
| method: "HEAD" | |
| }, function(err, headRes) { | |
| var size = headRes.headers['content-length']; | |
| if (size > maxSize) { | |
| console.log('Resource size exceeds limit (' + size + ')'); | |
| } else { |
| # first: | |
| lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done | |
| sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.* | |
| # To recap, the best way (I've found) to completely uninstall node + npm is to do the following: | |
| # go to /usr/local/lib and delete any node and node_modules | |
| cd /usr/local/lib | |
| sudo rm -rf node* |
| /* | |
| INIT: ensure Babel/Eslint/Flow is configured for ES Class Fields & Static Properties | |
| JSX USAGE: <Iframe src='http://web.site' onLoad={myOnloadFunction}/> | |
| */ | |
| import React, { Component, PropTypes } from 'react' | |
| import ReactDOM from 'react-dom' | |
| class Iframe extends Component { | |
| static propTypes: Object = { |
| db.Collection.find({ | |
| created_at : { | |
| '$gte': new Timestamp(new Date(2012, 0, 21), 0), | |
| '$lte': new Timestamp(new Date(2012, 0, 22), 0) | |
| }) |
System directories
| Method | Result |
|---|---|
| Environment.getDataDirectory() | /data |
| Environment.getDownloadCacheDirectory() | /cache |
| Environment.getRootDirectory() | /system |
External storage directories
| function Foo(who) { | |
| this.me = who; | |
| } | |
| Foo.prototype.identify = function() { | |
| return "I am " + this.me; | |
| }; | |
| function Bar(who) { | |
| Foo.call(this,"Bar:" + who); |
| // This is from my comment here: http://wolfram.kriesing.de/blog/index.php/2008/javascript-remove-element-from-array/comment-page-2#comment-466561 | |
| /* | |
| * How to delete items from an Array in JavaScript, an exhaustive guide | |
| */ | |
| // DON'T use the delete operator, it leaves a hole in the array: | |
| var arr = [4, 5, 6]; | |
| delete arr[1]; // arr now: [4, undefined, 6] |
| var Transform = require('famous/core/Transform'); | |
| function ShowModifier(options) { | |
| this.visible = !!options.visible; | |
| this._output = { | |
| transform: Transform.identity, | |
| opacity: 1, | |
| origin: null, | |
| align: null, | |
| size: null, |