Skip to content

Instantly share code, notes, and snippets.

View wonglok's full-sized avatar
🙏
Thank you Jesus for the new life

Wong Lok wonglok

🙏
Thank you Jesus for the new life
View GitHub Profile
<?php namespace Illuminate\Database\Connectors;
class MySqlConnector extends Connector implements ConnectorInterface {
/**
* Establish a database connection.
*
* @param array $options
* @return PDO
*/
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /prerender-test/
# Virtual/pushState URIs
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.html [L]
<IfModule mod_proxy_http.c>
// relies on Date.now() which has been supported everywhere modern for years.
// as Safari 6 doesn't have support for NavigationTiming, we use a Date.now() timestamp for relative values
// if you want values similar to what you'd get with real perf.now, place this towards the head of the page
// but in reality, you're just getting the delta between now() calls, so it's not terribly important where it's placed
(function(){
// prepare base perf object
@wonglok
wonglok / Promise Async Looper.js
Last active August 29, 2015 13:57
Promise Loop
"use strict";
console.log('============');
(function(){
var i = 0;
var iLast = window.performance.now();
//console.profile("Processing pixels");
function loop(){
if (i === 300){
//console.profileEnd();
@wonglok
wonglok / consoleLogo.js
Last active August 29, 2015 13:57
Console Image lgoo
function consoleLogo(width,height,url,comment){
'use strict';
//config
var lineHeight = 14;
//build string
var str = '';
@wonglok
wonglok / overloadingFunc.js
Created March 29, 2014 08:08
Overloading Closure
http://ejohn.org/apps/learn/#90
function assert(pass, msg){
var type = pass ? "PASS" : "FAIL";
jQuery("#results").append("<li class='" + type + "'><b>" + type + "</b> " + msg + "</li>");
}
function addMethod(object, name, fn){
// Save a reference to the old method
// that is a closure that has access to older func args
// This is like a recursive action....
http://glsl.heroku.com/e#12471.0
#ifdef GL_ES
precision mediump float;
#endif
//Ported by Redexe@gmail.com
uniform float time;
uniform vec2 mouse;
uniform vec2 resolution;
uniform sampler2D u_texture;
@wonglok
wonglok / beautiful glsl.txt
Last active August 29, 2015 13:57
links to beautiful glsl
background ballz
http://glsl.heroku.com/e#15514.0
background ballz2
http://glsl.heroku.com/e#15512.8
beautiful ball3 - fountain
http://glsl.heroku.com/e#15247.1
Red lazer/beam/ribbon
@wonglok
wonglok / 10.9.txt
Last active August 29, 2015 13:58
Make a 10.9 Mavericks USB Installer (Clean Install)
http://arstechnica.com/apple/2013/10/how-to-make-your-own-bootable-os-x-10-9-mavericks-usb-install-drive/
The only-slightly-less-easy way
If you don't want to use Diskmaker X for some reason, poster tywebb13 on the MacRumors forumshas your hookup. Assuming that you have the OS X Mavericks installer in your Applications folder, and you have a Mac OS X Extended (Journaled)-formatted volume named "Untitled" mounted on the system, you can create a Mavericks install drive by typing the following command into the Terminal.
sudo /Applications/Install\ OS\ X\ Mavericks.app/Contents/Resources/createinstallmedia --volume /Volumes/TARGET --applicationpath /Applications/Install\ OS\ X\ Mavericks.app --nointeraction
@wonglok
wonglok / methodkeylist.js
Last active August 29, 2015 14:00
get methods keys from obj
function getMethods(obj)
{
var bucket = [];
var key
for(key in obj) {
if(typeof obj[key] === "function") {
bucket.push(key)
}
}
return bucket;