This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
... | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
0 4 4 4 7 10000 15300 17200 | |
| 金槌 | 手機 | 吹風機 | Coach 隨手包 | ... | ... | 環保筷 | 商品抵用券 | | |
↑ ( 隨機數字 12345 ) | |
*/ | |
class GiftShuffler { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).on('mouseenter touchstart', 'a[href]:not([target])', function(){ | |
if(this.getAttribute('href').match(/^(https?:)?\/\//)){ | |
this.setAttribute('target', '_blank'); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define gcd | |
(lambda (a b) | |
(cond | |
((> b a) (gcd a (- b a))) | |
(else b) | |
) | |
) | |
) | |
(gcd 5120 65536) |