Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
cd /usr/local/src
wget https://phantomjs.googlecode.com/files/phantomjs-1.9.0-linux-x86_64.tar.bz2
tar xvjpf phantomjs-1.9.0-linux-x86_64.tar.bz2
ln -s /usr/local/src/phantomjs-1.9.0-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs
git clone git://github.com/n1k0/casperjs.git
cd casperjs
git checkout tags/1.0.2
ln -sf /usr/local/src/casperjs/bin/casperjs /usr/local/bin/casperjs
@fatgy
fatgy / hh-guide.md
Last active January 2, 2016 11:09
Guideline

Avoid Correlated Subselects: A correlated subselect is a nested select that refers to a column from the outer select. Here is an example that uses product.id as a correlation column to find all products that have no sales orders:

   select product.id
     from product
    where not exists (
   select sales_order_items.id
     from sales_order_items
    where sales_order_items.prod_id = product.id )
function leo_array_diff($a, $b) {
$map = $out = array();
foreach($a as $val) $map[$val] = 1;
foreach($b as $val) unset($map[$val]);
return array_keys($map);
}
var mergeTo = [4,5,6];
var mergeFrom = [7,8,9];
Array.prototype.push.apply(mergeTo, mergeFrom);
mergeTo; // is: [4, 5, 6, 7, 8, 9]
@fatgy
fatgy / new_gist_file
Created July 26, 2013 05:24
find absolute path
$ ls -d $PWD/*
<?php
require 'google-api/apiClient.php';
require 'google-api/contrib/apiOauth2Service.php';
require 'google-api/contrib/apiDriveService.php';
$pdfFile = 'test.pdf';
// API Console: https://code.google.com/apis/console/
// Create an API project ("web applications") and put the client id and client secret in config.ini.
@fatgy
fatgy / dabblet.css
Created December 25, 2011 13:07
CSS openworlds logo http://openworlds.in.th/
/* CSS openworlds logo http://openworlds.in.th/ */
@import url(http://fonts.googleapis.com/css?family=Andika);
p {
margin: 0;
padding: 0;
font-family: 'Andika', sans-serif;
/* This is not the right font. ;P */
font-size: 52px;
line-height: 1.2;
}
@fatgy
fatgy / dabblet.css
Created December 22, 2011 08:44
Logo of some exhibition http://goo.gl/EK4Yp
/* Logo of some exhibition http://goo.gl/EK4Yp
from https://www.facebook.com/iCAREClub?ref=ts
*/
body {
font-size: 16px;
background-color: #DFE0E2;
color: #BA9254;
}
@fatgy
fatgy / dabblet.css
Created December 21, 2011 05:03
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: white;
background-image: repeating-linear-gradient(-45deg,
rgba(255, 0, 0, 1) 25%,
transparent 25%,
transparent 50%,
rgba(0, 0, 255, 1) 50%,