This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os, glob, sys | |
| from string import Template | |
| import datetime | |
| template = """ | |
| <DOCTYPE html> | |
| <html> | |
| <body> | |
| $table | |
| </body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var dom = document.createElement('script'); | |
| dom.src = "http://xxx/a.js"; | |
| document.head.appendChild(dom); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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