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
<?php | |
$items = array( | |
"100 apples", "5 apples", "110 apples", "55 apples" | |
); | |
// normal sorting: | |
sort($items); | |
print_r($items); | |
# Outputs: | |
# 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
<?php | |
foreach (glob("*.php") as $file) | |
echo "$file\n"; | |
?> |
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
#gtalk.py | |
import xmpp | |
# Google Talk constants | |
FROM_GMAIL_ID = "[email protected]" | |
GMAIL_PASS = "secret passwd" | |
GTALK_SERVER = "gmail.com" | |
jid=xmpp.protocol.JID(FROM_GMAIL_ID) |
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
require 'net/http' | |
require 'uri' | |
# /api/v1/:format/new | |
# /api/v1/:format/gists/:user | |
# /api/v1/:format/:gist_id | |
res = Net::HTTP.post_form(URI.parse('http://gist.github.com/api/v1/xml/new'), | |
{ 'files[file1.ab]' => 'CONTNETS', | |
'files[file2.ab]' => 'contents' }) |
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[@rel$='external']').click(function(){ | |
this.target = "_blank"; | |
}); | |
/* | |
Usage: | |
<a href="http://www.lepinskidesign.com.br/" rel="external">lepinskidesign.com.br</a> | |
*/ |
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
$('element').size(); |
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
jQuery.preloadImages = function() | |
{ | |
for(var i = 0; i").attr("src", arguments[i]); | |
} | |
}; | |
// Usage | |
$.preloadImages("image1.gif", "/path/to/image2.png", "some/image3.jpg"); |
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. Target Safari | |
if( $.browser.safari ) $("#menu li a").css("padding", "1em 1.2em" ); | |
//B. Target anything above IE6 | |
if ($.browser.msie && $.browser.version > 6 ) $("#menu li a").css("padding", "1em 1.8em" ); | |
//C. Target IE6 and below | |
if ($.browser.msie && $.browser.version <= 6 ) $("#menu li a").css("padding", "1em 1.8em" ); | |
//D. Target Firefox 2 and above |
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 el = $('#id'); | |
el.html(el.html().replace(/word/ig, "")); |
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 equalHeight(group) { | |
tallest = 0; | |
group.each(function() { | |
thisHeight = $(this).height(); | |
if(thisHeight > tallest) { | |
tallest = thisHeight; | |
} | |
}); | |
group.height(tallest); | |
} |
OlderNewer