Skip to content

Instantly share code, notes, and snippets.

View lackneets's full-sized avatar
🤗
Sorry I am super busy. I may respond in weeks or months

Lackneets Chang (小耀博士) lackneets

🤗
Sorry I am super busy. I may respond in weeks or months
  • TAROBO Investment Advisors Ltd.
  • Taipei, Taiwan
View GitHub Profile
@lackneets
lackneets / _list_toolbar.htm
Last active April 13, 2016 04:42
Pagination of October CMS Backend List
<div data-control="toolbar">
<div class="form-group span-left">
<select class="form-control custom-select pagination-select" style="width:200px">
<option selected="selected" value="1">第 1 頁</option>
</select>
</div>
</div>
<script>
$(function(){
@lackneets
lackneets / common.sh
Last active August 30, 2016 04:14
Remember some useful command
# Install imagemagick
sudo apt-get install imagemagick
# Resize jpeg images under subdirectories
find . -name "*.jpg" -exec mogrify -resize 1600x1600\> -quality 75% -verbose -format jpg {} +
# Resize jpeg images only if > 1MB
# http://superuser.com/questions/204564/how-can-i-find-files-that-are-bigger-smaller-than-x-bytes
find . -name "*.jpg" -size +1M -exec mogrify -resize 1600x1600\> -quality 75% -verbose -format jpg {} +
@lackneets
lackneets / inner.html
Last active February 18, 2016 03:58
iframe cross-domain auto height
<!-- Send Height to Parent -->
<script type="text/javascript">
function sendHeight(){
if(parent.postMessage){
parent.postMessage({
height: document.body.offsetHeight,
location: window.location.toString()
}, '*');
}
}
@lackneets
lackneets / cleanup.php
Created February 16, 2016 14:27
Wordpress Backdoor Cleanup
<?php
/*
Wordpress Backdoor Cleanup
Put this under upload folder
*/
ini_set('display_errors', true);
function clenup($path) {
$dir = new DirectoryIterator($path);
@lackneets
lackneets / bookmarklet.txt
Created February 9, 2016 09:43
Chinese Friendly (No more 14px chinese font)
javascript: (function(){
"use strict";
var regexCJ = /[\u4e00-\u9fa5]+|[\u0800-\u4e00]+/;
function getTextContainerNodes(){
var nodes = Array.from(document.body.getElementsByTagName("*"));
var leafNodes = nodes.filter(function(elem) {
return elem.hasChildNodes() && Array.from(elem.childNodes).filter(function(node){
return node.nodeType === 3;
}).length > 0
@lackneets
lackneets / cleanup.bat
Created February 9, 2016 04:31
Cleanup garbage files generated from Mac and Win
@echo off
set /p dirs="Where to cleanup? : "
echo %dirs%
del /s /f /a %dirs%\*.DS_STORE
del /s /f /a %dirs%\*._.*
del /s /f /a %dirs%\*Thumbs.db
(define gcd
(lambda (a b)
(cond
((> b a) (gcd a (- b a)))
(else b)
)
)
)
(gcd 5120 65536)
@lackneets
lackneets / inheritance.js
Created January 26, 2016 09:42
ECMA5 Class inheritance inspired by Babel
"use strict";
function classDefine(subClass, prototype, staticMembers){
return classInherit(Object, subClass, prototype, staticMembers);
}
function classInherit(superClass, subClass, prototype, staticMembers){
subClass.prototype = Object.create(superClass.prototype, {
super: {value: superClass, enumerable: false, writable: false, configurable: true },
constructor: {value: subClass, enumerable: false, writable: false, configurable: true },
}); // Extend the prototype from super class
@lackneets
lackneets / jquery.externals.js
Last active February 19, 2016 18:48
Auto make external links open in new tab
$(document).on('mouseenter touchstart', 'a[href]:not([target])', function(){
if(this.getAttribute('href').match(/^(https?:)?\/\//)){
this.setAttribute('target', '_blank');
}
});
@lackneets
lackneets / common.less
Last active June 23, 2016 04:17
Guideline for HTML5
/* Common Behaviors */
.noselect {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}