Skip to content

Instantly share code, notes, and snippets.

View dwi2's full-sized avatar

Tzu-Lin Huang dwi2

  • Fukuoka, Japan
  • 04:28 (UTC +09:00)
View GitHub Profile
@dwi2
dwi2 / gist:8300942
Created January 7, 2014 15:25
shell script to call Firefox nightly in terminal (Mac OSX)
#!/bin/sh
/Applications/FirefoxNightly.app/Contents/MacOS/firefox $*
@dwi2
dwi2 / gist:9066569
Last active August 29, 2015 13:56
function and variable in prototype
var RandomObject = function(id) {
this.id = id;
};
(function(window){
var singleton = undefined;
var Launcher = function() {
this.scotch = undefined;
this.many = undefined;
};
@dwi2
dwi2 / CaseTransformer
Created June 4, 2014 06:13
CaseTransformer, transform between CapitalCameCase and dash-splitted-case
var CaseTransformer = {
_isValidCharacter: function(ch) {
if (ch)
return !!ch.match(/[a-zA-Z0-9]/);
return false;
},
_isCapitalCase: function(ch) {
if (ch)
return !!ch.match(/[A-Z]/);
return false;
@dwi2
dwi2 / Gaia UI test memo
Last active August 29, 2015 14:05
Gaia UI test memo - How to run Gaia UI test on b2g desktop
## Document ##
* Marionette Client document
http://marionette-client.readthedocs.org/en/latest/#
* Gaia UI Tests doc lists
https://developer.mozilla.org/en-US/Firefox_OS/Platform/Automated_testing/gaia-ui-tests
@dwi2
dwi2 / learnyounode-9
Created October 13, 2014 13:46
learnyounode no.9, not a good solution
var http = require('http');
var urls = [];
var chunkHelpers = [];
var endNumber = 0;
var endCallback = function() {
endNumber += 1;
if (endNumber > 2) {
chunkHelpers.forEach(function(chunkHelper) {
chunkHelper.writeChunk();
@dwi2
dwi2 / Presentation.webidl
Created March 5, 2015 03:15
Presentation.webidl
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* http://w3c.github.io/presentation-api/
*
* Copyright © 2014 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved.
* W3C liability, trademark and document use rules apply.
@dwi2
dwi2 / PresentationDeviceInfoManager.webidl
Created March 5, 2015 03:17
PresentationDeviceInfoManager.webidl
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
dictionary PresentationDeviceInfo {
DOMString id;
DOMString name;
DOMString type;
@dwi2
dwi2 / PresentationMessageEvent.webidl
Created March 5, 2015 03:18
PresentationMessageEvent.webidl
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
[Constructor(DOMString typeArg,
optional PresentationMessageEventInit eventInitDict),
Pref="dom.presentation.enabled",
AvailableIn="PrivilegedApps"]
@dwi2
dwi2 / PresentationSession.webidl
Created March 5, 2015 03:19
PresentationSession.webidl
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* http://w3c.github.io/presentation-api/
*
* Copyright © 2014 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved.
* W3C liability, trademark and document use rules apply.
@dwi2
dwi2 / PresentationSessionStateEvent.webidl
Created March 5, 2015 03:19
PresentationSessionStateEvent.webidl
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
enum PresentationSessionState
{
"connected",
"disconnected",