Skip to content

Instantly share code, notes, and snippets.

@kentliau
kentliau / Gruntfile.js
Created February 4, 2014 03:25 — forked from markgoodyear/01-gulpfile.js
Gulpfile and Gruntfile sample
/*!
* Grunt
* $ npm install grunt-contrib-uglify grunt-autoprefixer grunt-contrib-cssmin grunt-contrib-imagemin grunt-contrib-sass grunt-contrib-watch grunt-contrib-concat grunt-contrib-clean grunt-contrib-jshint grunt-notify --save-dev
*/
module.exports = function(grunt) {
grunt.initConfig({
// Sass
@kentliau
kentliau / .jshintrc.js
Created February 4, 2014 04:20 — forked from connor/.jshintrc.js
jshintrc file example
// NOTE: I added the .js extension to this gist so it would have syntax highlighting. This file should have NO file extension
{
// Settings
"passfail" : false, // Stop on first error.
"maxerr" : 100, // Maximum error before stopping.
// Predefined globals whom JSHint will ignore.
"browser" : true, // Standard browser globals e.g. `window`, `document`.
@kentliau
kentliau / disable_console.js
Created February 17, 2014 13:21
Disable webkit browser execute script in console
(function(){
var css = "text-shadow: -1px -1px hsl(0,100%,50%), 1px 1px hsl(5.4, 100%, 50%), 3px 2px hsl(10.8, 100%, 50%), 5px 3px hsl(16.2, 100%, 50%), 7px 4px hsl(21.6, 100%, 50%), 9px 5px hsl(27, 100%, 50%), 11px 6px hsl(32.4, 100%, 50%), 13px 7px hsl(37.8, 100%, 50%), 14px 8px hsl(43.2, 100%, 50%), 16px 9px hsl(48.6, 100%, 50%), 18px 10px hsl(54, 100%, 50%), 20px 11px hsl(59.4, 100%, 50%), 22px 12px hsl(64.8, 100%, 50%), 23px 13px hsl(70.2, 100%, 50%), 25px 14px hsl(75.6, 100%, 50%), 27px 15px hsl(81, 100%, 50%), 28px 16px hsl(86.4, 100%, 50%), 30px 17px hsl(91.8, 100%, 50%), 32px 18px hsl(97.2, 100%, 50%), 33px 19px hsl(102.6, 100%, 50%), 35px 20px hsl(108, 100%, 50%), 36px 21px hsl(113.4, 100%, 50%), 38px 22px hsl(118.8, 100%, 50%), 39px 23px hsl(124.2, 100%, 50%), 41px 24px hsl(129.6, 100%, 50%), 42px 25px hsl(135, 100%, 50%), 43px 26px hsl(140.4, 100%, 50%), 45px 27px hsl(145.8, 100%, 50%), 46px 28px hsl(151.2, 100%, 50%), 47px 29px hsl(156.6, 100%, 50%), 48px 30px hsl(162, 100%, 50%), 49px 31px h
@kentliau
kentliau / colors.less
Created February 22, 2014 07:49
Flat UI Colors Less Snippet
//teal
@turquoise: #1abc9c;
@green-sea: #16a085;
//green
@emerald: #2ecc71;
@nephritis: #27ae60;
//blue
@peter-river: #3498db;
@kentliau
kentliau / jquery.selectText.js
Last active August 29, 2015 14:01
Select text with Vanilla and jQuery
// jQuery highlight text plugins
// It will select the text of first occurence
// of jQuery collection of element
jQuery.fn.selectText = function(){
var doc = document
, element = this[0]
, range, selection
;
if (doc.body.createTextRange) {
range = document.body.createTextRange();
@kentliau
kentliau / map.geojson
Last active August 29, 2015 14:02 — forked from arfon/map.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
extension Array {
func first() -> Element? {
if isEmpty {
return nil
}
return self[0]
}
func last() -> Element? {
@kentliau
kentliau / download_all_chrome.sh
Created May 4, 2015 09:08
Download all Chrome, Canary, Chromium using wget
#!/bin/sh
wget -O chrome-mac.zip "https://download-chromium.appspot.com/dl/Mac" && wget "https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg" && wget "https://storage.googleapis.com/chrome-canary/GoogleChromeCanary.dmg"
@kentliau
kentliau / .bash_profile
Last active August 29, 2015 14:23
Multiple Java version switching
# List all available Java version and currect set Java version
/usr/libexec/java_home -verbose
# Switch to the Java version you want temporarily
export JAVA_HOME="`/usr/libexec/java_home -v '1.6*'`"
# Run your desire Java application (.jar) in your desire version
java -jar application.jar