Skip to content

Instantly share code, notes, and snippets.

View ethanliew's full-sized avatar

Ethanz Liew ethanliew

View GitHub Profile
@ethanliew
ethanliew / osx-10-10-virtualbox.md
Created August 11, 2017 03:34 — forked from frdmn/osx-10-10-virtualbox.md
Install OS X 10.10 Yosemite in VirtualBox
@ethanliew
ethanliew / mysql_pivot.sql
Created July 11, 2017 03:51 — forked from chappy84/mysql_pivot.sql
MySQL Pivot Stored Procedure
DROP PROCEDURE IF EXISTS pivot_user_preferences;
DELIMITER $$
CREATE PROCEDURE pivot_user_preferences(IN user_id INT)
BEGIN
DECLARE done INT DEFAULT FALSE;
DECLARE definition_label CHAR(255);
DECLARE label_cursor CURSOR FOR SELECT DISTINCT label FROM example_db.user_preferences;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
@echo off
@rem ==================
@rem Source:
@rem https://gist.github.com/jcppkkk/8330314
@rem Description:
@rem Install context menu to allow user opens file with Sublime Text as User or Admin, or Open Folder with Sublime Text.
@rem Usage:
@rem Download this .bat file to in Sublime Text's installation folder.
@rem Execute this batch file. It will download elevate codes and setup context menu.
@rem ==================
/*
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp
server, but for some reason omit a client connecting to it. I added an
example at the bottom.
Save the following server in example.js:
*/
var net = require('net');
var LINE = require('./line.js');
var line = new LINE();
var email = 'your email';
var password = 'your password';
line.login(email, password, function(error, result) {
if (error) {
return;
}
var isPortTaken = function(PORT, callback) {
var net = require('net')
var tester = net.createServer()
tester.once('error', function (err) {
if (err.code == 'EADDRINUSE') {
callback(null, true)
} else {
callback(err)
}
})
/**
* Provides requestAnimationFrame in a cross browser way.
* @author paulirish / http://paulirish.com/
*/
if ( !window.requestAnimationFrame ) {
window.requestAnimationFrame = ( function() {
return window.webkitRequestAnimationFrame ||