View res.py
import os, glob, sys | |
from string import Template | |
import datetime | |
template = """ | |
<DOCTYPE html> | |
<html> | |
<body> | |
$table | |
</body> |
View gaia_team_meeting_lottery
from random import shuffle | |
print 'gaia lottery!' | |
gaia_members = ['Yuren','Arthur','Dominic', | |
'Rex','Steve','Rudy','Alive', | |
'Evan','Mark','John','Fred','George','Ian','Greg','Jason'] | |
shuffle(gaia_members) | |
print gaia_members |
View gaia_lottery_js
//shuffles list in-place | |
//credit http://dtm.livejournal.com/38725.html | |
function shuffle(list) { | |
var i, j, t; | |
for (i = 1; i < list.length; i++) { | |
j = Math.floor(Math.random()*(1+i)); // choose j in [0..i] | |
if (j != i) { | |
t = list[i]; // swap list[i] and list[j] | |
list[i] = list[j]; | |
list[j] = t; |
View Script DOM element
var dom = document.createElement('script'); | |
dom.src = "http://xxx/a.js"; | |
document.head.appendChild(dom); |
View gist:6578631
function trim(text) { | |
text.replace(/^\s+/, "");//.replace(/\s+$/, ""); | |
for (var i = text.length - 1; i >= 0; i--) { | |
if (/\s/.test(text.charAt(i))) { | |
text = text.substring(0, i + 1); | |
break; | |
} | |
} | |
return text; | |
} |
View relayout.py
# put this file in gaia main folder and run | |
# python relayout.py | |
# 768 -> 600 | |
originWidth = 768 | |
targetWidth = 600 | |
# find and replace string | |
import os, fnmatch | |
def findReplace(directory, find, replace, filePattern): |
View pushtry.sh
# https://wiki.mozilla.org/ReleaseEngineering/TryServer#Using_a_custom_Gaia | |
# https://wiki.mozilla.org/Gaia/Team/Taipei/BubbleTea#How_to_push_bubble-tea_to_try | |
hg qref -m "try: -b o -p emulator,emulator-jb,emulator-kk,linux_gecko,linux64_gecko,macosx64_gecko,win32_gecko -u gaia-unit,gaia-ui-test,gaia-integration -t none" | |
hg push -f try |
View action_cmd.js
function action_cmd(cmd) { | |
var sys = require('sys') | |
var exec = require('child_process').exec; | |
function puts(error, stdout, stderr) {sys.puts(stdout)} | |
exec(cmd, puts); | |
} |
View probe.js
var start = new Date().getTime(); | |
for (var n = 0; n < maxCount; n++) { | |
/* perform the operation to be measured *// | |
} | |
var elapsed = new Date().getTime() - start; | |
console.log('Measured time: ' + elapsed); |
View axe1.js
var http = require("http"); | |
var cheerio = require("cheerio"); | |
/** | |
* Utility function that downloads a URL and invokes | |
* callback with the data. | |
*/ | |
function download(url, callback) { | |
http.get(url, function(res) { | |
var data = ""; |
OlderNewer