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
var parameters = (function (src) { | |
var params = {}, qryStr = src.split('?')[1]; | |
qryStr && $.each(qryStr.split('&'), function (i, p) { | |
ps = p.replace(/\/$/, '').split('='); | |
var k = ps[0].replace(/^\?/, ''); | |
params[k] = ps[1] || true; | |
}); | |
return params; | |
})(location.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
with(document)with(i=querySelector('img'),createElement('canvas'))width=i.width,height=i.height,getContext('2d').drawImage(i,0,0),toDataURL() |
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
// Items number | |
var items = elem.length; | |
// Any element containing data about current index | |
var current = elem.data('current'); | |
var next; | |
// Button directory | |
var direction = elem.data('dir'); | |
// Logic for calculating next items index | |
if (direction === 'next') { |
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
selector { | |
@include backface-visibility(hidden); | |
@include perspective(1000); | |
} |
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 encodeString(str) { | |
return str.replace(/\\n/g, '\n').replace(/\\'/g, '\'').replace(/\\"/g, '\"').replace(/\\\\/g, '\\'); | |
} |
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
var cells = []; | |
var header = $('table').find('tr:first').find('th'); | |
var rows = $('table').find('tr').not(':first'); | |
header.each(function(i, val){ | |
cells.push($(val).width()); | |
}); | |
rows.each(function(i, val) { | |
var _this = this; |
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
# Reindent whole file | |
gg=G |
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.changeURL = function(photo) { | |
// not HTML history API browsers | |
if ($('html').hasClass('ie8') || $('html').hasClass('ie9')) { | |
window.location = photo.url; | |
} | |
else { | |
var stateObj = { video: 'xfactor' }; | |
history.pushState(stateObj, photo.description, photo.url); | |
} | |
}; |
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
<script type="text/javascript"> | |
var fapiResponse = {{ albums[0].photos[0].images | json_encode | raw }}; | |
var renditions = []; | |
var ratios = {}; | |
for (key in fapiResponse) { | |
renditions.push(key.split('_retina')[0]); | |
} | |
renditions.map(function(rendition, i) { |
OlderNewer