This file contains hidden or 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
// requires: https://github.com/douglascrockford/JSON-js/raw/master/json2.js | |
{ | |
saveJson: function(key, json) { | |
localStorage[key] = JSON.stringify(json); | |
}, | |
loadJson: function(key) { | |
var value = localStorage[key]; | |
if (value === undefined || value === null) | |
return null; |
This file contains hidden or 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
for IE: | |
function disableSelection(target){ | |
if (typeof target.onselectstart!="undefined") //IE route | |
target.onselectstart=function(){return false} | |
else if (typeof target.style.MozUserSelect!="undefined") //Firefox route | |
target.style.MozUserSelect="none" | |
else //All other route (ie: Opera) |
This file contains hidden or 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
/* From http://perishablepress.com/press/2007/01/16/maximum-and-minimum-height-and-width-in-internet-explorer/ */ | |
* html div#division { | |
width: expression( document.body.clientWidth > 776 ? "777px" : "auto" ); /* sets max-width for IE */ | |
} | |
div#division { | |
max-width: 777px; /* this sets the max-width value for all standards-compliant browsers */ | |
} |
This file contains hidden or 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
$container.scrollTop($container[0].scrollHeight); |
This file contains hidden or 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
// from: http://stackoverflow.com/questions/37684/replace-url-with-html-links-javascript | |
function replaceURLWithHTMLLinks(text) { | |
var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig; | |
return text.replace(exp,"<a href='$1'>$1</a>"); | |
} |
This file contains hidden or 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
import java.util.Random; | |
import java.util.Scanner; | |
public class GuessNumber { | |
public static void main(String[] args) { | |
Random generator = new Random(); | |
int toGuess = generator.nextInt(10) + 1; | |
int guess; | |
Scanner scanner = new Scanner(System.in); | |
try { |
This file contains hidden or 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
gem 'unicorn' |
This file contains hidden or 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
$.url().param('search'); |
This file contains hidden or 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
arr.slice() |
OlderNewer