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
.highlight{background:#ffffff;} | |
.highlight .c{color:#999988;} | |
.highlight .err{color:#a61717;background-color:#e3d2d2;} | |
.highlight .k{font-weight:bold;} | |
.highlight .o{font-weight:bold;} | |
.highlight .cm{color:#999988;} | |
.highlight .cp{color:#999999;font-weight:bold;} | |
.highlight .c1{color:#999988;} | |
.highlight .cs{color:#999999;font-weight:bold;} | |
.highlight .gd{color:#000000;background-color:#ffdddd;} |
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 parseURL(url) { | |
var a = document.createElement('a'); | |
//创建一个链接 | |
a.href = url; | |
return { | |
source: url, | |
protocol: a.protocol.replace(':',''), | |
host: a.hostname, | |
port: a.port, | |
query: a.search, |
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
Handlebars.registerHelper("ifCond",function(v1,operator,v2,options) { | |
switch (operator) | |
{ | |
case "==": | |
return (v1==v2)?options.fn(this):options.inverse(this); | |
case "!=": | |
return (v1!=v2)?options.fn(this):options.inverse(this); | |
case "===": |
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
// gulpやプラグインをインポート | |
var gulp = require('gulp') | |
, compass = require('gulp-compass') | |
, concat = require('gulp-concat') | |
, uglify = require('gulp-uglify') | |
, minifyCSS = require('gulp-minify-css') | |
, path = require('path') | |
; | |
//JSファイルを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
// See this awesome blog post: http://www.jeffreyharrell.com/blog/2010/11/creating-a-shake-event-in-mobile-safari/ | |
if (typeof window.DeviceMotionEvent != 'undefined') { | |
// Shake sensitivity (a lower number is more) | |
var sensitivity = 20; | |
// Position variables | |
var x1 = 0, y1 = 0, z1 = 0, x2 = 0, y2 = 0, z2 = 0; |
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
Handlebars.registerHelper('script', function (src){ | |
var s = '<script src="' + src + '" type="text/javascript"><' + '/script>'; | |
return new Handlebars.SafeString(s); | |
}); | |
// usage: {{{script "https://gist.github.com/4332573.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 () { | |
var disqus_shortname = 'evanyoublog', | |
el = document.getElementById('disqus_thread') | |
window.addEventListener('scroll', checkPosition) | |
window.addEventListener('load', checkPosition) | |
function checkPosition () { | |
var rect = el.getBoundingClientRect() | |
if (rect.top < window.innerHeight) { |
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
// Usage: $(element).scrollToTop([position]) | |
;(function($){ | |
// only allow one scroll to top operation to be in progress at a time, | |
// which is probably what you want | |
var scrollToTopInProgress = false | |
$.fn.scrollToTop = function(position){ | |
var $this = this, | |
targetY = position || 0, |
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
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/ | |
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating | |
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel | |
// MIT license | |
(function() { | |
var lastTime = 0; | |
var vendors = ['ms', 'moz', 'webkit', 'o']; |
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
<a href="javascript:void(window.open('https://www.sfbuy.com/account/register'));">test</a> |