Skip to content

Instantly share code, notes, and snippets.

(function() {
let action = 'barks';
let foo = function() {
console.log('foo', action);
};
})();
console.log(typeof foo);
let Foo = function() {
this._name = 'Foo';
};
Foo.prototype.bark = function() {
console.log(this._name, ' barks');
};
let foo = new Foo();
let fooBark = foo.bark;
@snowmantw
snowmantw / gist:8019280
Created December 18, 2013 08:53
Gaia logs
I/Gecko ( 5789):
I/Gecko:ProcessPriorityManager( 5789): Remove ChildID(25) from LRU pool
I/Gecko:ProcessPriorityManager( 5789): [Video, child-id=25, pid=7449] Changing priority from BACKGROUND:CPU_NORMAL to FOREGROUND:CPU_NORMAL.
I/Gonk ( 5789): Setting nice for pid 7449 to 1
I/Gonk ( 5789): Changed nice for pid 7449 from 18 to 1.
D/memalloc( 5789): /dev/pmem: Allocated buffer base:0x49700000 size:614400 offset:614400 fd:79
D/memalloc( 7449): /dev/pmem: Mapped buffer base:0x449bc000 size:1228800 offset:614400 fd:32
D/memalloc( 5789): /dev/pmem: Allocated buffer base:0x49700000 size:614400 offset:1228800 fd:104
D/memalloc( 7449): /dev/pmem: Mapped buffer base:0x44b18000 size:1843200 offset:1228800 fd:35
D/memalloc( 5789): /dev/pmem: Allocated buffer base:0x49700000 size:40960 offset:8069120 fd:130
@snowmantw
snowmantw / gist:7942210
Created December 13, 2013 10:00
Recursively write options
/**
* Overwrite settings recursively.
*
* @param {Object} |options|
* @this {LockScreenSlide}
*/
LockScreenSlidePrototype._overwriteSettings =
function(options) {
var iterate = function _iterate(opts, settings) {
for (var property in opts) {
@snowmantw
snowmantw / gist:7940606
Created December 13, 2013 06:38
draw lockscreen's reactive area.
LockScreenSlidePrototype._drawReactiveArea =
function lss_drawReactiveArea() {
// To see if the finger touch on the area of the center circle.
var center = this.center;
var boundaryR = center.x + this.handle.radius;
var boundaryL = center.x - this.handle.radius;
var ctx = this.canvas.getContext('2d');
var radius = this.handle.radius;
ctx.strokeStyle = 'red';
@snowmantw
snowmantw / gist:7653215
Created November 26, 2013 03:51
gjstlint vs. JSDoc tags (v3)
/**
* gjslint...
*
* @abstract
* @constructor
* @augments DairyProduct
* @return {boolean}
* @author Foo Bar <foobar@foo.com>
* @namespace
@snowmantw
snowmantw / gist:7651270
Created November 26, 2013 00:15
Dump Gaia build config
{ GAIA_DIR : /home/snowmantw/Project/gaia, PROFILE_DIR : /home/snowmantw/Project/gaia/profile-debug, PROFILE_FOLDER : profile-debug, GAIA_SCHEME : http://, GAIA_DOMAIN : gaiamobile.org, DEBUG : 1, LOCAL_DOMAINS : 1, DESKTOP : 1, DEVICE_DEBUG : 0, HOMESCREEN : http://system.gaiamobile.org, GAIA_PORT : :8080, GAIA_LOCALES_PATH : locales, LOCALES_FILE : shared/resources/languages.json, GAIA_KEYBOARD_LAYOUTS : en,pt-BR,es,de,fr,pl, BUILD_APP_NAME : *, PRODUCTION : 0, GAIA_OPTIMIZE : 0, GAIA_DEV_PIXELS_PER_PX : 1, DOGFOOD : 0, OFFICIAL : , GAIA_DEFAULT_LOCALE : en-US, GAIA_INLINE_LOCALES : 1, GAIA_CONCAT_LOCALES : 1, GAIA_ENGINE : xpcshell, GAIA_DISTRIBUTION_DIR : /home/snowmantw/Project/gaia/distribution, GAIA_APPDIRS : /home/snowmantw/Project/gaia/apps/sms /home/snowmantw/Project/gaia/apps/costcontrol /home/snowmantw/Project/gaia/apps/calendar /home/snowmantw/Project/gaia/apps/video /home/snowmantw/Project/gaia/apps/keyboard /home/snowmantw/Project/gaia/apps/fl /home/snowmantw/Project/gaia/apps/pdfjs /home/snowm
@snowmantw
snowmantw / gist:7413929
Created November 11, 2013 14:27
Lottery license
您使用本軟體即代表您完全同意下列事項
* 軟體使用人認知本軟體僅提供輔助閱讀各網站資料的功能。各網站之商標與資料仍為各網站所有
* 非經本軟體原始碼中,AUTHOR 檔案所列明之軟體開發者同意,您不得擅自進行任何更改與重製、分發本軟體,與其他任何除執行您手上之可執行檔以外之行為
* 此軟體開發者不擔保此軟體因瑕疵所產生的問題。亦不對因使用此軟體,造成使用者或任何第三方,包括資料來源之網站之任何故意或過失傷害、損失負責
* 前述之軟體開發者完全有權在盡到法律與契約上之通知義務後,修改本條款。修改後的條款並將於生效後立即取代既有條款
* 當您違背本協議的任何條款時,這個使用許可將自動地終止,您同時將失去使用此軟體的權利
* 其他未竟事項,由中華民國國家法律裁決
@snowmantw
snowmantw / diffcults_webpage.html
Created November 1, 2013 06:37
about web rendering
1. From component to HTML and CSS
2. HTML and CSS would leak beyond the component itself
3. Write isolating components with all necessary HTML and CSS
4. Application should interact with components with only the end most rendering like code
5. The flow from triggering event to rendering code
6. HTML zencoding
7. Should first own code handling data then the view to show them and receive feedback from the user
( it's actually a bidirectional diagram, which make things not simple as MVC frameworks thought )
( but we can enroute the user's feedback to the beginning of the graph to make things simpler )
( it would bring two different type of handling targets: the data, and the instruction from the user )
@snowmantw
snowmantw / gist:7243273
Created October 31, 2013 01:50
Custom extensions.
{
"Firebug": {
"url" : "https://addons.mozilla.org/firefox/downloads/latest/1843/addon-1843-latest.xpi"
}
}