Skip to content

Instantly share code, notes, and snippets.

View angusdev's full-sized avatar

Angus angusdev

View GitHub Profile
-- You know how accurate it is
SELECT *
FROM ADDRESS_TABLE
WHERE ( ADDRESS LIKE '%北京%'
OR ADDRESS LIKE '%湖南%'
OR ADDRESS LIKE '%長沙%'
OR ADDRESS LIKE '%天津%'
OR ADDRESS LIKE '%廣東%'
OR ADDRESS LIKE '%廣州%'
OR ADDRESS LIKE '%河北%'
@angusdev
angusdev / top-history.sh
Created June 28, 2013 14:58
Top 10 shell commands you currently use https://coderwall.com/p/o5qijw
history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head
@angusdev
angusdev / select2text.bookmarklet.js
Created July 2, 2013 05:10
A bookmarklet to show all items of a drop down list. Click bookmarklet to activate then click on the drop down list will create a textarea to display all items. Click bookmarklet again to deactivate. Tested in Chrome/Firefox, doesn't work on IE6.
javascript:(function(){if(window._bak_md){document.onmousedown=window._bak_md;window._bak_md=null;}else{window._bak_md=document.onmousedown||function(){};document.onmousedown=function(e){e=e||window.event;t=e.target;if(t.tagName=='SELECT'){x=document.createElement('textarea');for(i=0;i<t.options.length;i++)x.value+=((i>0?'\n':'')+t.options[i].textContent);t.parentNode.insertBefore(x,t);e.preventDefault();e.stopPropagation();}};}})();
@angusdev
angusdev / chinaid-dob-18.sql
Last active December 19, 2015 06:59
Compare the date of birth in China ID number with the DOB in DB, show the discrepancy
SELECT CUSTOMER_ID "Customer ID",
ID_TEXT "ID Text",
SUBSTR (ID_TEXT, 7, 8) "Birthday in ID",
TO_CHAR (DATE_OF_BIRTH, 'DD-MON-YYYY') "Birthday in DB",
CASE
WHEN SUBSTR (ID_TEXT, 7, 6) = TO_CHAR (DATE_OF_BIRTH, 'YYYYMM')
THEN
'Incorrect day, year and month correct'
WHEN SUBSTR (ID_TEXT, 11, 4) = TO_CHAR (DATE_OF_BIRTH, 'MMDD')
THEN
@angusdev
angusdev / golden-keepblocking.css
Created July 11, 2013 16:16
Stylish or Chrome extension for using adblocker in hkgolden.com
.myTestAd {height: 1px;}
rundll32.exe user32.dll,LockWorkStation
@angusdev
angusdev / iframe-custom-event.js
Created November 20, 2013 15:05
How to trigger a custom event to a child iframe
// Parent Window
$('button').click(function(e) {
// This doesn't work
$('#container iframe').contents().find('body').trigger('myevent');
// This works
$('#container iframe').each(function(){
this.contentWindow.$('body').trigger('myevent');
});
});
@angusdev
angusdev / jekyll-less-nodejs.rb
Created May 28, 2014 14:40
Jekyll plugin to convert Less files to CSS using node.js
# jekyll-less-nodejs.rb
#
# Jekyll plugin to convert Less files to CSS using node.js
# Modified from jekyll-less (https://github.com/zroger/jekyll-less, version 85d6e73dc7)
#
# Twitter: @angusdev
# Released under APL 2.0
#
#
# In windows, there is not easy (or no solution) to install therubyracer, which is a dependency
@angusdev
angusdev / bootstrap-callout.css
Created May 31, 2014 02:05
The callout CSS from Bootstrap doc page
.bs-callout {
border-left: 3px solid #eee;
margin: 20px 0;
padding: 20px;
}
.bs-callout h4 {
margin-bottom: 5px;
margin-top: 0;
}
.bs-callout p:last-child {