Skip to content

Instantly share code, notes, and snippets.

View kamwing's full-sized avatar
🥑
Work smarter not harder

Ngai Kam Wing kamwing

🥑
Work smarter not harder
View GitHub Profile
@kamwing
kamwing / jquery-animate-enhanced-demo.js
Created November 19, 2011 10:25 — forked from benbarnett/jquery-animate-enhanced-demo.js
demo code on jquery anim enhanced plugin home
$('button#start').click(function() {
var results = $('p#results').html("Animating..."),
button = $(this).attr('disabled', 'disabled');
// CSS3 Container
$('.target-css').animate({left: "+=200px", width:320 }, 1500, function() {
results.html('first callback() fired, reversing...');
$(this).animate({left: "-=200px", width:280 }, 1500, function() {
results.html("second callback() fired");
button.removeAttr('disabled');
@kamwing
kamwing / jquery.fullscreenr.js
Created February 21, 2012 08:21 — forked from chrisvanpatten/jquery.fullscreenr.js
jQuery Fullscreenr
/**
* Fullscreenr - lightweight full screen background jquery plugin
* By Jan Schneiders
* www.nanotux.com
*
* Modifications by Chris Van Patten
* http://www.vanpattenmedia.com
* Version 1.5
**/
if (typeof (AC) === "undefined") {
AC = {}
}
AC.ImageReplacer = Class.create({
_defaultOptions: {
listenToSwapView: true,
filenameRegex: /(.*)(\.[a-z]{3}($|#.*|\?.*))/i,
filenameInsert: "_☃x",
ignoreCheck: /(^http:\/\/movies\.apple\.com\/|\/105\/|\/global\/elements\/quicktime\/|_(([2-9]|[1-9][0-9]+)x|nohires)(\.[a-z]{3})($|#.*|\?.*))/i,
attribute: "data-hires",
@kamwing
kamwing / browserdetect.js
Created May 4, 2012 15:35 — forked from grigs/browserdetect.js
Apple's Browser Detection Script - prettified from http://images.apple.com/global/scripts/browserdetect.js
if (typeof (AC) === "undefined") {
AC = {}
}
AC.Detector = {
getAgent: function () {
return navigator.userAgent.toLowerCase()
},
isMac: function (c) {
var d = c || this.getAgent();
return !!d.match(/mac/i)
if (typeof AC == "undefined") {
AC = {}
}
if (typeof iScroll !== "undefined") {
AC.iScroll = window.iScroll;
AC.iScroll.prototype = Object.extend(Object.clone(window.iScroll.prototype), {
isTouch: function () {
return (AC.Detector.isMobile() || AC.Detector.isiPad())
},
touchStart: function (c) {
@kamwing
kamwing / zsh.md
Created October 27, 2012 03:42 — forked from wenzowski/zsh.md
Oh my zsh in Ubuntu 12.04

Getting zsh to work in ubuntu:

Install zsh

sudo apt-get install zsh

nb. on a Vagrant VM, the default user (vagrant) has password vagrant.

Install oh-my-zsh

@kamwing
kamwing / symphony_meet_resources.md
Created November 5, 2012 10:22 — forked from vlad-ghita/symphony_meet_resources.md
Symphony, meet Resources!

1 Intro

[Symphony][1] is great. Let's make it better.

This article is about the process of building your website's frontend, keeping templates DRY, relating Datasources, Events and other Resources to your Pages, code structure and much more. The following haven arisen, in time, from finding myself repeating the same things over and over again.

I assume you know what [master.xsl][2] is and you are using it. If you don't know, check the [default Symphony workspace][3].

2 It all starts with a requirement

server {
listen 80;
root /var/www/craft.dev/public;
index index.php index.html index.htm;
server_name craft.dev;
location / {
try_files $uri $uri/ @rewrites;
@kamwing
kamwing / gist:07e0cb988db9edc44832
Created March 28, 2016 12:54 — forked from doofusdavid/gist:6072257
quick and dirty wordpress slug generator in excel for data import from an existing database.
=LOWER(CLEAN(SUBSTITUTE(TRIM(C2)," ","-")))
@kamwing
kamwing / MySQL_macOS_Sierra.md
Created March 19, 2017 01:03 — forked from nrollr/MySQL_macOS_Sierra.md
Install MySQL on Sierra using Homebrew

Install MySQL on macOS Sierra

This procedure explains how to install MySQL using Homebrew on macOS Sierra 10.12

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.

Install MySQL

At this time of writing, Homebrew has MySQL version 5.7.15 as default formulae in its main repository :