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
$('ul').find('ul').each(function(idx){ | |
$(this).attr('data-index', idx); | |
}); |
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
$(".someSpinnerImage").show(); | |
$.getJSON('file.php', function(json) { | |
$.each(json, function() { | |
// Retrieving data from json... | |
}); | |
$(".someSpinnerImage").hide(); | |
}); |
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
$('pre code').on('mouseup', function() { | |
var sel, range; | |
var el = $(this)[0]; | |
if (window.getSelection && document.createRange) { //Browser compatibility | |
sel = window.getSelection(); | |
if(sel.toString() == ''){ //no text selection | |
window.setTimeout(function(){ | |
range = document.createRange(); //range object | |
range.selectNodeContents(el); //sets Range | |
sel.removeAllRanges(); //remove all ranges from selection |
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
# Place this line of code anywhere in your .htaccess file | |
AddType application/x-httpd-php .html .htm | |
# This doesn't work for all servers and so if this doesn't | |
# work for yours, delete the code above and use the code | |
# below. If you use the code below, don't forget to remove | |
# the hash character '#' | |
# AddHandler application/x-httpd-php .html .htm |
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
Header set Vary "Accept-Encoding" |
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
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule ^([^.]+?)/?$ /$1.html [L,R=301] |
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 str = "Hello,\nMy name is, Bob!\n"; | |
str.replace(/(\r\n|\n|\r)/gm,""); |
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
$('#menu').on('DOMMouseScroll mousewheel', function(ev) { | |
var $this = $(this), | |
scrollTop = this.scrollTop, | |
scrollHeight = this.scrollHeight, | |
height = $this.height(), | |
delta = (ev.type == 'DOMMouseScroll' ? | |
ev.originalEvent.detail * -40 : | |
ev.originalEvent.wheelDelta), | |
up = delta > 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
/** | |
* We figured out part of the answer to our question. | |
* So now we'd just like to know if we're on the right track. | |
*/ | |
public void insert(int index, E data) | |
{ | |
ensureCapacity(indexCounter + 1); | |
for (int i = elementData.length; i > index; i--) |
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*="#"]') | |
// Remove links that don't actually link to anything | |
.not('[href="#"]') | |
.not('[href="#0"]') | |
.click(function(event) { | |
// On-page links | |
if ( | |
location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') | |
&& | |
location.hostname == this.hostname |