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
<html> | |
<h1 class=title id=head>Quack-Quack!</h1> | |
<p> | |
Quack | |
<span>quack</span> | |
quack! | |
</p> | |
</html> | |
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 foo = function(bar) { | |
console.log("foo"); | |
return bar; | |
} | |
(function(){ | |
console.log("bar") | |
})(); | |
// 'foo bar' |
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 request = new XMLHttpRequest; | |
request.open('POST', 'http://twitter.com/statuses/update.json', false, 'username','password'); | |
request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); | |
request.send('status=Quack-quack!'); |
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
curl -u username:password -d status="Quack-quack!" http://twitter.com/statuses/update.json |
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=['first', 'last']; | |
a[-1] == null; | |
a[-1] = a[a.length-1]; | |
a[-1] == 'last' |
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
result = re.search(r"#[a-f0-9]{3}", 'Roses are #f00') | |
result.group(0) == '#f00' # True | |
result[0] # Damn! TypeError: '_sre.SRE_Match' object is unsubscriptable | |
# Why result cannot be accessed like array? |
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.addEventListener('load', function(){ | |
//Works in Opera | |
//Doesnt' work in Greasemonkey | |
alert('window') | |
}, false) | |
window.wrappedJSObject.addEventListener('load', function(){ | |
//Doesn't work in Opera | |
//Works in Greasemonkey. See http://wiki.greasespot.net/UnsafeWindow | |
alert('wrappedJSObject') |
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
// this gist is response to http://dmitry.baranovskiy.com/post/201475166 | |
// Code by Dmitry Baranovskiy | |
var w=window,e=w.addEventListener,v=w.attachEvent;e&&e("load",a,!1);v&&v("onload",a);google.timers.load.t.prt=+new Date; | |
// Mine optimization. 4 characters less! | |
window[/*@cc_on'attachEvent'||@*/'addEventListener'](/*@cc_on'on'+@*/'load',a,0);google.timers.load.t.prt=+new Date; | |
// I found /*@cc_on @*/ trick at http://lusever.livejournal.com/43326.html |
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
/** | |
* 'Hello world'.insert(6, 'happy ') == 'Hello happy world' | |
* 'Hello world'.insert(-1, '!!!') == 'Hello world!!!' | |
* @param at {Number} index | |
* @param text {String} | |
* @see http://ruby-doc.org/core/classes/String.html#M000773 | |
*/ | |
String.prototype.insert = function (at, text) { | |
if (at < 0) { | |
at += this.length + 1; |
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
DirectoryIndex index.html index.htm index.xhtml index.xml index.php | |
AddType message/rfc822 mht | |
AddType application/octet-stream safariextz | |
AddType application/atom+xml atom | |
AddType application/msword doc | |
AddType application/opensearchdescription+xml osd | |
AddType application/pdf pdf | |
AddType application/rdf+xml rdf | |
AddType application/rss+xml rss |
OlderNewer