Skip to content

Instantly share code, notes, and snippets.

View evanxd's full-sized avatar

Evan Tseng evanxd

View GitHub Profile
@evanxd
evanxd / fill-data-time-input
Last active August 29, 2015 13:59
Fill the startDate, startTime, endDate, and endTime inputs at modify event view in Calendar app.
[
{ selector: 'input[name="startDate"]', value: '2014-04-16' },
{ selector: 'input[name="startTime"]', value: '23:20' },
{ selector: 'input[name="endDate"]', value: '2014-04-17' },
{ selector: 'input[name="endTime"]', value: '01:20' }
].forEach(function(item) {
var hackElement = document.querySelector(item.selector);
hackElement.value = item.value;
hackElement.dispatchEvent(new Event('input', {
'view': window,
@evanxd
evanxd / today_test.json
Created April 29, 2014 09:44
Write marionette tests with JSON.
{
"testcase": "should be show in header, highlighted day after tap today",
"app": "app://calendar.gaiamobile.org",
"operations": [
{
"target": "#today-css-selector",
"condition": "document.querySelector('#today-css-selector').innerHTML === new Date().getDate()",
"action": "tap"
}
],
( function( window, undefined ) {
'use strict';
// helper function
function capitalize( str ) {
return str.charAt(0).toUpperCase() + str.slice(1);
}
// ========================= getStyleProperty by kangax ===============================
@evanxd
evanxd / bug-1068950-regression-window.md
Last active August 29, 2015 14:06
The regression window of Bug 1068950.

Regression Window of http://bugzil.la/1068950.

Gecko

  • work-: 120cc2db6c66f25f9a7d029854c0b53140cc2077
  • work-: 32cfea205ccde2a85f17500e1b0975778c85c7fb
  • work-: 41f59db250ab7456d000f9066c0a918d44137196
  • work+: 41eb41171a5fc624ade25323fa7629a4c0d68553
  • work+: 8446acda8132157d72378f71cfc1431bf9d15fc5
  • work+: 7644bb7745e60242fbd937bef358bd7dc72a4392
  • work?: 711fc57fe52705dae8ac423c997308d32be90118
@evanxd
evanxd / gaia-master-try-push.sh
Created October 31, 2014 02:24
Push a try for Gaia master
cd /path/to/gaia
git checkout master
git pull mozilla master
git checkout test-tbpl
git rebase master
git push -f origin test-tbpl
@evanxd
evanxd / proposal-of-audio-channel-managerment-api.md
Last active August 29, 2015 14:09
Proposal of Audio Channel Management API

Proposal of Audio Channel Management API v0.0.6

mozBrowser[1] API

Properties

  • mozBrowser.allowedAudioChannels: List of audio channels allowed to play. Implement this like DOMTokenList { 0: "class1", 1: "class2", 2: "class3", length: 3, add: function, remove: function, toggle: function, contains: function }[2].
  • mozBrowser.audioChannels['channelName'].volume: 0 to 1, set/get volumes of all allowed audio channels.
  • mozBrowser.audioChannels['channelName'].paused: boolean, true means pause the playing, false means allow the playing.
  • mozBrowser.activeAudioChannels: List of active audio channels.
@evanxd
evanxd / audio-channel-manager.js
Last active August 29, 2015 14:09
Audio Channel Manager
/**
* Use audio channel manager in System app[1].
*
* AppWindowManager.prototype.handleEvent = function(evt) {
* switch (evt.type) {
* case 'appcreated':
* var app = evt.detail;
* this._apps[evt.detail.instanceID] = app;
* audioChannelManager.register(app.browser.element);
* break;
@evanxd
evanxd / audio-channel-competing.json
Last active August 29, 2015 14:12
Audio Channel Competing
# Audio Channel Name
# 1. Normal
# 2. Foreground Content
# 3. Background Content
# 4. Alarm
# 5. System
# 6. Ringer
# 7. Telphony
# 8. Notification
# 9. Public Notification
#!/bin/bash
# setup your mozilla-central REPO and github REMOTE.
# path to mozilla-central
REPO="mozilla-central"
# regualr expression for gaia github repo url
REMOTE="https:\/\/github\.com\/RickyChien\/gaia"
@evanxd
evanxd / audio_channel_controller.js
Created March 16, 2015 08:05
Audio Channel Controller
/* global BaseUI */
'use strict';
(function(exports) {
var AudioChannelController = function(app) {
this.app = app;
this.appId = app.instanceID;
this._audioChannels = new Map();
app.browser.element.allowedAudioChannels.forEach((channel) => {
channel.addEventListener('activestatechanged', this);