View margins-padding
This file contains 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
// Margins and Padding | |
// ------------------------- | |
$i: 0; | |
@while $i <= 50 { | |
.mt#{$i} { margin-top: 1px * $i; } | |
.mb#{$i} { margin-bottom: 1px * $i; } | |
.ml#{$i} { margin-left: 1px * $i; } | |
.mr#{$i} { margin-right: 1px * $i; } | |
.pt#{$i} { padding-top: 1px * $i; } |
View example.js
This file contains 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
// Timezone library | |
var moment = require("moment-timezone"); | |
// Later | |
var later = require("later"); | |
// The schedule we would like to support: | |
var sched = later.parse.text("at 17:00"); | |
// In March CET switches to CEST (daylight saving) so this is a nice example | |
var timezone = "Europe/Amsterdam"; |
View css-triangle.scss
This file contains 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
//==== Simple SCSS mixin to create CSS triangles | |
//==== Example: @include css-triangle ("up", 10px, #fff); | |
@mixin css-triangle ($direction: "down", $size: 20px, $color: #000) { | |
width: 0; | |
height: 0; | |
border-left: $size solid #{setTriangleColor($direction, "left", $color)}; | |
border-right: $size solid #{setTriangleColor($direction, "right", $color)}; | |
border-bottom: $size solid #{setTriangleColor($direction, "bottom", $color)}; | |
border-top: $size solid #{setTriangleColor($direction, "top", $color)}; | |
} |
View gulpfile.js
This file contains 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'; | |
// Generated on 2014-04-14 using generator-leaflet 0.0.14 | |
var gulp = require('gulp'); | |
var open = require('open'); | |
var wiredep = require('wiredep').stream; | |
// Load plugins | |
var $ = require('gulp-load-plugins')(); |
View analytics.js
This file contains 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() { | |
/** | |
* 记录方法使用情况的类 | |
* @param {Array.<boolean>} umMap 初始的使用情况 | |
*/ | |
var UsageManager = function(umMap) { | |
this.umMap = umMap || []; | |
}; | |
/** | |
* 记录新的使用情况 |
View animatedScrollTo.js
This file contains 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.getElementsByTagName('button')[0].onclick = function () { | |
scrollTo(document.body, 0, 1250); | |
} | |
function scrollTo(element, to, duration) { | |
var start = element.scrollTop, | |
change = to - start, | |
currentTime = 0, | |
increment = 20; | |