Skip to content

Instantly share code, notes, and snippets.

View 599316527's full-sized avatar

Kyle He 599316527

View GitHub Profile
@599316527
599316527 / formatDate.js
Created August 24, 2014 10:20
Smart Date Formater
/**
* Format Date smartly
* @param {stirng} pubdate General date
* @return {string}
*/
function formatDate(pubdate) {
var pd = new Date(pubdate);
var td = new Date();
var diff = (td.getTime() - pd.getTime()) / 1000;
if (diff / 3600 / 24 > 99) {
@599316527
599316527 / isMobile.js
Created August 24, 2014 10:24
Detect Mobile Devices
/**
* Detect whether the device is mobile device
* @type {Boolean}
*/
function detectMobileDevice() {
return (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));
}
window['isMobileDevice'] = detectMobileDevice();
@599316527
599316527 / shark_rotate.css
Created August 24, 2014 10:27
Shark Icons
@-webkit-keyframes _shark_rotate {
0% { -webkit-transform: translate(0, 0) rotate(0); }
12.5% { -webkit-transform: translate(-1px, -1px); }
25% { -webkit-transform: translate(-2px, 0) rotate(.8deg); }
37.5% { -webkit-transform: translate(-1px, 1px); }
50% { -webkit-transform: translate(0, 0) rotate(0); }
62.5% { -webkit-transform: translate(1px, -1px); }
75% { -webkit-transform: translate(2px, 0) rotate(-.8deg); }
87.5% { -webkit-transform: translate(1px, 1px); }
100% { -webkit-transform: translate(0, 0) rotate(0); }
@599316527
599316527 / cache.php
Created August 24, 2014 10:29
PHP Cache Class
<?php
/**
* 缓存类
*/
class Cache {
private $filename;
/**
* __construct
<?php
/**
* GET请求
* @param String $url 请求的网址
* @return String 返回的内容
*/
function cURL($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
@599316527
599316527 / SublimeText-玩家指南.md
Created August 29, 2014 09:22
SublimeText-玩家指南

建议安装的插件

  • Emmet - 神器不解释,不了解的建议去官网学习一下文档,熟练以后绝对大大加快 HTML/CSS 的书写。
  • LESS - Less 高亮插件。

建议配置

Preferences > Settings – User 中添加配置:

{
@599316527
599316527 / Image.class.php
Created October 10, 2014 15:23
Image Capatcha
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2009 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <[email protected]>
// +----------------------------------------------------------------------
@599316527
599316527 / 1414663161.txt
Last active August 29, 2015 14:08
1414663161
陶陶说,女人真看不懂,经常讲反话,比如喜欢一个男人,就到处讲这个男人不好,其实心里,
早就有想法了,已经喜欢了,对不对。沪生转身说,以后再讲吧。陶陶拉紧沪生说,最近有了重
大新闻,群众新闻,要听吧。沪生说,我现在忙,再会。陶陶说,相当轰动。沪生说,陶陶讲的轰
动,就是某某人搞腐化,女老师欢喜男家长,4号里的十三点,偷邻居胸罩。陶陶说,绝对有意
思,我讲了。沪生说,我现在忙,有空再讲。陶陶拉紧沪生说,我简单讲,也就是马路小菜场,
一男一女两个摊位。沪生说,放手好吧。陶陶松手说,当中是小马路,男的摆蛋摊,马路对面的
女人,年长几岁,摆鱼摊。沪生说,简单点。陶陶说,马路上人多,两个人互相看不见,接近收
摊阶段,人少了,两个人就互相看。沪生说,啥意思。陶陶说,鸡蛋卖剩了半箱,鱼摊完全出
货,自来水一冲,离下班还有三刻钟,男女两人,日长事久,眉来眼去,隔了马路,四只眼睛碰
火星,结果呢。沪生说,互相送鸡蛋,送小黄鱼。陶陶说,错,鸡蛋黄鱼,有啥意思,到这种阶
@599316527
599316527 / AddWebPageToSafariReadingListFromChrome.scpt
Created January 10, 2015 19:30
Add web page to safari reading list from chrome
tell application "Google Chrome"
set pageUrl to get URL of active tab of first window
end tell
tell application "Safari" to add reading list item pageUrl
display notification pageUrl with title "Added to Reading List"
@599316527
599316527 / check-global-variables.js
Created March 22, 2015 06:07
JS檢測全局變量
(function(topWindow, document){
var iframeWindow;
var whiteList = [/*'jQuery', '$', ...*/];
var ret = [];
function checkGlobalVar() {
var iframe = document.createElement('iframe'), i, originValue;
document.body.appendChild(iframe);
iframeWindow = iframe.contentWindow;
for(i in topWindow) {
if(!(i in iframeWindow) && !~whiteList.indexOf(i)) {