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
/* | |
<div id="slider"> | |
<div>1</div> | |
<div>2</div> | |
<div>3</div> | |
</div> | |
*/ | |
!(function CSS3Slider() { | |
var slider = document.querySelector('#slider') |
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
// **Compares to waterfall** | |
// waterfall usage | |
async.waterfall([ | |
function(callback){ | |
callback(null, 'one', 'two'); | |
}, | |
function(arg1, arg2, callback){ | |
callback(null, 'three'); | |
}, | |
function(arg1, callback){ |
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 () { | |
if ('ontouchstart' in document) { | |
var touched, startX, startY | |
$(document) | |
.on('touchstart', function (evt) { | |
touched = evt.target | |
var touch = evt.originalEvent.touches[0] | |
startX = touch.clientX | |
startY = touch.clientY |
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
{{ $page := 10 }} | |
{{ $count := 20 }} | |
{{ $url := "/users?page=%v" }} | |
<ul class="pagination" role="navigation" aria-label="Pagination"> | |
{{ if gt $page 1 }} | |
<li class="pagination-previous"><a href="{{ printf $url 1 }}" aria-label="Previous page"></a></li> | |
{{ else }} | |
<li class="pagination-previous disabled"></li> | |
{{ end }} |
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
.headroom { | |
position: fixed; | |
top: 0; | |
-webkit-transition: top 0.15s; | |
transition: top 0.15s; | |
} | |
.headroom-hidden { | |
top: -60px; | |
} |
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
// parse magnet | |
var magnetUri = require('magnet-uri') | |
var readTorrent = require('read-torrent') | |
var humanForamt = require('human-format') | |
app.get('/magnet', function (req, res) { | |
var uri = req.param('u') | |
var info = magnetUri(uri) | |
readTorrent('http://torrage.com/torrent/' + info.infoHash.toUpperCase() + '.torrent', function(err, torrent) { | |
if (err) return res.jsonp(500, { error: err }) |
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
Selectize.prototype.search = function (query) { | |
return { | |
query: query, | |
tokens: [], // disable highlight | |
items: $.map(this.options, function (item, key) { | |
return {id: key} | |
}) | |
} | |
} |
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
// need jquery.mousewheel | |
// TODO disable fullpage scroll while scrolled to no sections | |
var $sections = $('.section') | |
var $window = $(window) | |
var deltaY = 0 | |
$window.on('mousewheel', function (evt) { | |
evt.preventDefault() | |
deltaY += evt.deltaY |
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
// paste to chrome console | |
;(async (count=2000 /*current 1200+ games*/) => { | |
const links = [] | |
let start = 0 | |
while (start < count) { | |
const size = Math.min(90, count - start) // max 99/req | |
start += size |
OlderNewer