Skip to content

Instantly share code, notes, and snippets.

View gasolin's full-sized avatar

gasolin gasolin

View GitHub Profile
@gasolin
gasolin / pushtry.sh
Created March 21, 2014 03:36
script helper to push gaia branch to try server
# 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
@gasolin
gasolin / action_cmd.js
Last active August 29, 2015 13:57
run system execution via nodejs
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);
}
@gasolin
gasolin / probe.js
Last active August 29, 2015 14:00
collecting js function performance
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);
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 = "";
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 = "";
var request = require("request");
var cheerio = require("cheerio");
var jar = request.jar();
var request = request.defaults({
jar: jar,
followRedirect: true,
maxRedirects: 10
});
var request = require("request");
var cheerio = require("cheerio");
var jar = request.jar();
var headers = {
"user-agent": "Mozilla/5.0 (Mobile; rv:26.0) Gecko/26.0 Firefox/26.0"
};
var options = {
jar: jar,
@gasolin
gasolin / build.js
Created April 30, 2014 02:15
BB headers build script
var provecss = require('provecss');
var fs = require('fs');
// read file
var input = fs.readFileSync('headers.css', 'utf8');
var output = provecss(input, {path:'headers.css'});
// write file
fs.writeFileSync('headers.out.css', output);
/* -----------------------------------------------------------------
HEADERS: layout
This is our base CSS file.
Should not be defined here form factor or skin
dependent styles.
----------------------------------------------------------------- */
section[role="region"] > header:first-child {
position: relative;
z-index: 10;
console.log(JSON.stringify(obj, null, 4));