Skip to content

Instantly share code, notes, and snippets.

View keelii's full-sized avatar
🎯
Focusing

kily zhou keelii

🎯
Focusing
View GitHub Profile
@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;
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@keelii
keelii / position-fixed.css
Created March 30, 2012 08:55 — forked from subtleGradient/position-fixed.css
Make position:fixed work in IE6
/*Make position:fixed work in IE6!*/
.fixed-top /* position fixed Top */{position:fixed;bottom:auto;top:0;}
.fixed-bottom /* position fixed Bottom */{position:fixed;bottom:0;top:auto;}
.fixed-left /* position fixed Left */{position:fixed;right:auto;left:0;}
.fixed-right /* position fixed right */{position:fixed;right:0;left:auto;}
* html,* html body /* IE6 Fixed Position Jitter Fix */{background-image:url(about:blank);background-attachment:fixed;}
* html .fixed-top /* IE6 position fixed Top */{position:absolute;bottom:auto;top:expression(eval(document.documentElement.scrollTop));}
* html .fixed-right /* IE6 position fixed right */{position:absolute;right:auto;left:expression(eval(document.documentElement.scrollLeft+document.documentElement.clientWidth-this.offsetWidth)-(parseInt(this.currentStyle.marginLeft,10)||0)-(parseInt(this.currentStyle.marginRight,10)||0));}
@keelii
keelii / js-array-remove.js
Created April 5, 2012 07:33 — forked from danro/js-array-remove.js
JavaScript Array Remove - By John Resig
// Array Remove - By John Resig (MIT Licensed)
Array.prototype.remove = function(from, to) {
var rest = this.slice((to || from) + 1 || this.length);
this.length = from < 0 ? this.length + from : from;
return this.push.apply(this, rest);
};
@keelii
keelii / IE userData storage
Created September 12, 2012 10:11
IE userData storage solution!
var store = function(days) {
if ( typeof localStorage == 'undefined' ) {
var obj = document.createElement('q'),
days = days || 365;
obj.style.display = 'none';
obj.addBehavior('#default#userData');
var exp = new Date();
exp.setDate(exp.getDate() + days)
@keelii
keelii / jQuery Plugin Design Pattern for us
Created January 31, 2013 05:25
jQuery Plugin Design Pattern for us
(function ($) {
/**
* pluginName插件
*/
var pluginName = function (that, options, callback) {
this.opts = $.extend({
content: that.title || '',
options: 'you want to set'
@keelii
keelii / random link
Created February 25, 2013 05:36
链接添加随机数