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 replaceHtml(el, html) { | |
var oldEl = typeof el === "string" ? document.getElementById(el) : el; | |
/* @cc_on // Pure innerHTML is slightly faster in IE | |
oldEl.innerHTML = html; | |
return oldEl; | |
@*/ | |
var newEl = oldEl.cloneNode(false); | |
newEl.innerHTML = html; | |
oldEl.parentNode.replaceChild(newEl, oldEl); | |
// Since we just removed the old element from the DOM, return a reference |
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
google.maps.event.addListener(map, 'click', function(event) { | |
console.log(event.latLng); | |
}); |
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 getCoords() { | |
var latlng_str = marker.getPosition().toString(); | |
document.getElementById("coords").textContent = latlng_str; | |
}; |
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" | |
"http://www.w3.org/TR/html4/loose.dtd"> | |
<html> | |
<head> | |
<title>Jasmine Test Runner</title> | |
<link rel="stylesheet" type="text/css" href="lib/jasmine-1.0.2/jasmine.css"> | |
<script type="text/javascript" src="lib/jasmine-1.0.2/jasmine.js"></script> | |
<script type="text/javascript" src="lib/jasmine-1.0.2/jasmine-html.js"></script> | |
<script src="lib/jquery-1.6.1.min.js" type="text/javascript" charset="utf-8"></script> | |
<script src="lib/jasmine-jquery-1.2.0.js" type="text/javascript" charset="utf-8"></script> |
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
// If you don't use underscore.js, use it (http://documentcloud.github.com/underscore/) | |
// Then, use underscore's mixin method to extend it with all your other utility methods | |
// like so: | |
_.mixin({ | |
escapeHtml: function () { | |
return this.replace(/&/g,'&') | |
.replace(/>/g,'>') | |
.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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
<title></title> | |
<!-- CSS --> | |
<style type="text/css"> |
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
/* Simple JavaScript Inheritance | |
* By John Resig http://ejohn.org/ | |
* MIT Licensed. | |
*/ | |
// Inspired by base2 and Prototype | |
(function(){ | |
var initializing = false, fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/; | |
// The base Class implementation (does nothing) | |
this.Class = function(){}; | |
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
<% for asset in @post.assets %> | |
<li><%= link_to image_tag(asset.asset.url(:thumb)), asset.asset.url(:original) %></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
$(document).keydown(function(e) { | |
if(typeof e != 'undefined'){ | |
if(e.altKey && e.keyCode == 115){ | |
e.keyCode = 0; | |
alert("Alt + F4"); | |
return false; | |
} | |
} | |
}); |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<title>untitled</title> | |
<!-- Date: 2011-10-25 --> | |
</head> | |
<body> | |
<button id="load-application">Load Application</button> |
OlderNewer