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
;(function($){ | |
$.fn.scrollToTop = function(){ | |
var $this = $(this), | |
initialY = $this.scrollTop(), | |
start = +new Date, | |
speed = Math.min(750, Math.min(1500, initialY)), | |
now, | |
t, y | |
if (initialY == 0) return |
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
Using worker: worker-linux-6-2.bb.travis-ci.org:travis-linux-1 | |
git.1 | |
$ git clone --depth=50 --branch=master git://github.com/madrobby/zaru.git madrobby/zaru | |
Cloning into 'madrobby/zaru'... | |
remote: Counting objects: 94, done. | |
remote: Compressing objects: 100% (48/48), done. | |
remote: Total 94 (delta 46), reused 80 (delta 32) | |
Receiving objects: 100% (94/94), 10.89 KiB, done. | |
Resolving deltas: 100% (46/46), done. | |
$ cd madrobby/zaru |
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
URLcrypt.key = '...' | |
URLcrypt.encrypt('chunky bacon!') | |
# => "sgmt40kbmnh1663nvwknxk5l0mZ6Av2ndhgw80rkypnp17xmmg5hy" | |
URLcrypt.decrypt('sgmt40kbmnh1663nvwknxk5l0mZ6Av2ndhgw80rkypnp17xmmg5hy') | |
# => "chunky bacon!" |
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
Zaru.sanitize! " what\ēver//wëird:user:înput:" | |
# => "whatēverwëirduserînput" |
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
Ponymizer.new.gimmie_a_pony! | |
# => "Sunshine Splash" |
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
Project names and sort order: | |
aawkward | |
åberaber | |
Abernein | |
Internally, they should be sorted with lower-case, normalized, accent-free versions: | |
aawkward | |
aberaber | |
abernein |
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
$(window).on('online', online) | |
$(window).on('offline', offline) |
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
// iOS 7-like panel animation using Zepto | |
// this is a bit simplified, but it's a good start | |
var PANEL_SPEED = 650, | |
PANEL_EASING = 'cubic-bezier(0.23,1,0.32,1)' | |
$('#panel_to_slide_out').animate({ | |
translateX: '-50%', opacity: 1 }, PANEL_SPEED, PANEL_EASING) | |
$('#panel_to_slide_in').animate({ | |
translateX: '0%', opacity: 1 }, PANEL_SPEED, PANEL_EASING) |
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
data URL with svg+xml: | |
data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='1' height='1'><rect fill='#ff0000' x='0' y='0' width='1' height='0.5'/></svg> | |
data URL with svg+json: | |
data:image/svg+json;utf8,{"width":1,"height":1,"svg":[{"rect":{"fill":"#ff0000","x":0,"y":0,"width":1,"height":0.5}}]} |