This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.
To capture the video (filesize: 19MB), using the free "QuickTime Player" application:
// 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, |
.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;} |
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, |
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 "===": |
// 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フォルダにコピー |
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"}}} |
(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) { |
// 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, |
// 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']; |