Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

曾浩 think2011

🏠
Working from home
View GitHub Profile
@zmmbreeze
zmmbreeze / analytics.js
Last active Aug 5, 2021
GA的源码 analytics.js
View analytics.js
(function() {
/**
* 记录方法使用情况的类
* @param {Array.<boolean>} umMap 初始的使用情况
*/
var UsageManager = function(umMap) {
this.umMap = umMap || [];
};
/**
* 记录新的使用情况
@osteenbergen
osteenbergen / example.js
Created Apr 23, 2015
Laterjs Timezone support with MomentJS Timezone library
View example.js
// 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";
@edouard-lopez
edouard-lopez / gulpfile.js
Created May 5, 2014
Gulp copy font-awesome files to dist/ directory
View gulpfile.js
'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')();
@pjschreifels
pjschreifels / margins-padding
Created Jan 9, 2014
#sass #css-layout — Margin and Padding loop for SASS.
View margins-padding
// 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; }
@andjosh
andjosh / animatedScrollTo.js
Created Sep 30, 2013
ScrollTo animation using pure javascript and no jquery
View animatedScrollTo.js
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;
@patocallaghan
patocallaghan / css-triangle.scss
Created Jun 21, 2012
CSS Triangles SCSS Mixin #css #scss #triangle #mixin
View css-triangle.scss
//==== 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)};
}