Skip to content

Instantly share code, notes, and snippets.

View gasolin's full-sized avatar

gasolin gasolin

View GitHub Profile
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;
@gasolin
gasolin / iife.js
Created May 12, 2014 02:06
immediately-invoked func­tion expres­sions(IIFE) http://tech.myemma.com/iifes-javascript-control-variable-scope/
// Take con­trol of your globals
//basic
(function () {
// your code here
})();
// pass param in
(function ($) {
$(document).ready(function () {
console.log(JSON.stringify(obj, null, 4));
@gasolin
gasolin / git_stash.sh
Created July 9, 2014 07:29
git stash
# temp save git change
git stash
# list stashed items
git stash list
# get back
git stash pop
# get specify version back
git stash apply stash@{1}
@gasolin
gasolin / push_try
Created August 15, 2014 07:08
How to push to try server
Prepare
edit ~/.hgrc like this:
[ui]
username=Name <your@email>
[extensions]
hgext.mq =
[diff]
@gasolin
gasolin / todo_gaia.js
Created October 13, 2014 13:45
SPA todo app
/**
* Main entry point.
*
* the DOM has been localized and the user sees it in their language.
*
* @class Main
*/
(function() {
'use strict';