Skip to content

Instantly share code, notes, and snippets.

View keelii's full-sized avatar
🎯
Focusing

kily zhou keelii

🎯
Focusing
View GitHub Profile
/**
* 获取字符串的哈希值
* @param {String} str
* @param {Boolean} caseSensitive
* @return {Number} hashCode
*/
getHashCode:function(str,caseSensitive){
if(!caseSensitive){
str = str.toLowerCase();
}
<!DOCTYPE html> <!-- HTML5 doctype 不区分大小写 -->
<html lang="zh-cmn-Hans-CN"> <!-- 更加标准的 lang 属性写法 http://zhi.hu/XyIa -->
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <!-- 优先使用IE最新版本和 Chrome -->
<!-- width=device-width 会导致 iPhone 5 添加到主屏后以 WebAPP 全屏模式打开页面时出现黑边 http://bigc.at/ios-webapp-viewport-meta.orz -->
<meta name ="viewport" content ="initial-scale=1.0, maximum-scale=3, minimum-scale=1, user-scalable=no">
@keelii
keelii / mac app
Last active August 31, 2016 03:37
我的 Mac 必装软件
1. xcode
安装好 commend line tools 方便开发使用命令行
2. iTerm2 + zsh
mac 上最好用的终端,全屏透明什么的用起来很不错
3. Alfred
启动器,和spotlight一样,不过更强大,alt+space让你启动任何东西
/* by @keelii */
html, body, div, p,
h1, h2, h3, h4, h5, h6,
code, pre,
ul, ol, li
blockquote {
margin:0;
padding:0;
font-family:inherit;
}
@keelii
keelii / SassMeister-input.scss
Created July 8, 2014 00:50
Generated by SassMeister.com.
// ----
// Sass (v3.3.9)
// Compass (v1.0.0.alpha.20)
// ----
/* 学习 Sass */
/* 变量 */
$font-yahei: "microsoft yahei";
$main-color: #333;
@keelii
keelii / isCurrentWeek
Created December 31, 2014 04:53
Javascript check if sometime is current week
function isCurrentWeek(ts) {
var now = new Date();
now.setHours(0);
now.setMinutes(0);
now.setSeconds(0);
var nowTS = now.getTime();
var nowDay = getWeekNum(now.getDay());
function getWeekNum(week) {
return week === 0 ? 7 : week;
@keelii
keelii / nWeekFromNow
Last active August 29, 2015 14:12
how many weeks from now to sometime
function nWeekFromNow(ts) {
var now = new Date();
now.setHours(0);
now.setMinutes(0);
now.setSeconds(0);
now.setMilliseconds(0);
var nowTS = now.getTime();
var nowDay = now.getDay() || 7;
var startTS = nowTS - (nowDay - 1) * 24 * 60 * 60 * 1000;
@keelii
keelii / inSomeWeek
Created January 1, 2015 08:36
some in which week, last N week
function inSomeWeek(ts, n) {
var now = new Date();
now.setHours(0);
now.setMinutes(0);
now.setSeconds(0);
var nowTS = now.getTime();
var nowDay = getWeekNum(now.getDay());
function getWeekNum(week) {
return week === 0 ? 7 : week;
var page = require('webpage').create();
var system = require('system');
page.settings.userAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36";
page.viewportSize = { width: 1280, height: 800};
if (system.args.length === 1) {
console.log('Usage: browser_screenshots.js <some URL>');
phantom.exit(1);
} else {
var gulp = require('gulp');
var spritesmith = require('gulp.spritesmith');
var imageminPngquant = require('imagemin-pngquant');
var buffer = require('vinyl-buffer');
var rename = require("gulp-rename");
module.exports = function (config) {
var sprite = config.sprite;
return function (cb) {