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 / .htaccess
Created January 15, 2016 03:25
Redirect to minified version images
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# %{ENV:BASE} is current url path
# See http://stackoverflow.com/questions/21062290/set-rewritebase-to-the-current-folder-path-dynamically
RewriteCond %{REQUEST_URI}::$1 ^(.*?/)(.*)::\2$
RewriteRule ^(.*)$ - [E=BASE:%1]
@lackneets
lackneets / GiftShuffer.php
Created January 11, 2016 03:42
公平的資料庫獎項抽獎
<?php
/*
0 4 4 4 7 10000 15300 17200
| 金槌 | 手機 | 吹風機 | Coach 隨手包 | ... | ... | 環保筷 | 商品抵用券 |
↑ ( 隨機數字 12345 )
*/
class GiftShuffler {
@lackneets
lackneets / bindMethods.js
Last active December 22, 2015 11:44
Bind all instance methods
function MyController(){
// Bind all
for (var method in this.constructor.prototype) {
this[method] = this[method].bind(this);
}
/* Equals to
this.render = this.render.bind(this);
this.filter = this.filter.bind(this);
...
*/
@lackneets
lackneets / backup.php
Last active December 17, 2015 14:52 — forked from menzerath/backup.php
PHP: Recursively Backup Files & Folders to ZIP-File
<?php
/*
* PHP: Recursively Backup Files & Folders to ZIP-File
* (c) 2012-2014: Marvin Menzerath - http://menzerath.eu
*/
// Make sure the script can handle large folders/files
ini_set('max_execution_time', 600);
ini_set('memory_limit','1024M');
@lackneets
lackneets / .htaccess
Created October 16, 2015 23:08
Hide html extension .htaccess
RewriteEngine On
# To externally redirect /dir/foo.html to /dir/foo
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.html [NC]
RewriteRule ^ %1 [R,L,NC]
## To internally redirect /dir/foo to /dir/foo.html
RewriteCond %{REQUEST_FILENAME}.html -f [NC]
RewriteRule ^ %{REQUEST_URI}.html [L]
@lackneets
lackneets / by-receiver-bookmarklet.js
Last active August 29, 2015 14:24
Download Gmail in Group save by Receiver
javascript: function gmailRawURL(t){return"//mail.google.com/mail/"+String(location).match(/(u\/\d*\/)/)+"?ik="+GLOBALS[9]+"&view=om&th="+t}function downloadURL(t,a){var o=document.createElement("a");o.setAttribute("href",a),o.setAttribute("download",t),o.click(),console.log("Download",a,"as",t)}function download(t,a){var o=document.createElement("a");o.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(a)),o.setAttribute("download",t),o.click()}Array.prototype.forEach.call($$(".kQ"),function(t){t.click()}),Array.prototype.forEach.call($$(".kv .adf"),function(t){t.click()}),Array.prototype.forEach.call($$(".h7 .hb .g2.ac2"),function(t){console.log(t.getAttribute("email"))});var mails=$$(".adP.adO"),recieverEmails=Array.prototype.map.call($$(".h7 .hb .g2.ac2"),function(t){return t.getAttribute("email")}),mailUrls=[];for(var i in mails)id=String(mails[i].className).match(/m([\d\w]+)/),id&&mailUrls.push(gmailRawURL(id[1]));mailUrls.forEach(function(t,a){downloadURL(recieverEmails[a]+".eml",t
@lackneets
lackneets / bootstrap.wrap.css
Last active August 29, 2015 14:20
Bootstrap Wrapped Version
html.bs-wrap {
font-family: sans-serif;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
body.bs-wrap {
margin: 0;
}
.bs-wrap article,
.bs-wrap aside,
@lackneets
lackneets / mrt-taipei.json
Created October 21, 2014 08:35
台北捷運站點.JSON
[
{
"id": "030",
"name": "南港軟體園區",
"line": "文山內湖線",
"address": "115台灣台北市南港區捷運南港軟體園區站",
"latitude": 25.059904,
"longitude": 121.615952
},
{
@lackneets
lackneets / regexCJ.js
Last active February 6, 2017 02:18
Match Chinese and Japanese Characters
var regexCJ = /[\u4e00-\u9fa5]+|[\u0800-\u4e00]+/
!!'안녕하세요'.match(regexCJ) // false
!!'Hi There'.match(regexCJ) // false
!!'おはよう'.match(regexCJ) // true
!!'ㄤㄤ'.match(regexCJ) // true
!!'你好'.match(regexCJ) // true
!!'中国共产党万岁'.match(regexCJ) // true
@lackneets
lackneets / sansSerif.less
Last active August 29, 2015 14:05
Sans-Serif fonts for Mac and Windows
@sansSerifBold: Helvetica, Arial, "LiHei Pro", "AdobeFanHeitiStd-Bold","Microsoft JhengHei", "新細明體"; // 適合粗體標題使用
@sansSerif: Helvetica, Arial, "LiHei Pro", "Microsoft JhengHei", "新細明體"; // 一般內文適用
body, input, select, button {
font-family: @sansSerif !important;
}
h1,h2,h3,h4,h5,h6{
font-family: @sansSerifBold;
}