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($) { | |
var methods = { | |
init: function() { | |
var $ul = $("<ul/>").insertAfter(this); | |
var baseId = "_" + $(this).attr("id"); | |
$(this).children("option").each(function(index) { | |
var $option = $(this); | |
var id = baseId + index; | |
var $li = $("<li/>").appendTo($ul); |
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
<IfModule mod_expires.c> | |
ExpiresActive On | |
ExpiresDefault "access plus 1 seconds" | |
ExpiresByType text/html "access plus 600 seconds" | |
ExpiresByType text/css "access plus 604800 seconds" | |
ExpiresByType text/javascript "access plus 216000 seconds" | |
ExpiresByType application/xhtml+xml "access plus 600 seconds" | |
ExpiresByType image/jpeg "access plus 2592000 seconds" | |
ExpiresByType image/png "access plus 2592000 seconds" | |
ExpiresByType etc, etc. |
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
/** | |
* When browser supports inline pdfs | |
* There is no need to append a large jquery plugin that displays them inline. | |
* | |
* You can actually use an iframe (and style it appropriately) | |
* or a link whenever inline PDF viewing is not supported | |
* | |
* This function is fairly simple and it's only for demo purposes | |
*/ | |
function appendPdf(id, url) { |
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 | |
// Inject data from your component into the right module position | |
JFactory::getDocument()->setBuffer($data, 'modules', 'right'); | |
// Note: Data will not be shown unless there are "real" modules present in position right |
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
Removes all | |
<!--.*?--> | |
Leaves conditional comments, i.e. <!--[if IE]> | |
<!--(?!\[).*?(?!<\])--> |
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
<!-- Put this before </body> tag --> | |
<script type="text/javascript"> | |
function downloadJSAtOnload() { | |
var element = document.createElement("script"); | |
element.src = "defer.js"; | |
document.body.appendChild(element); | |
} | |
if (window.addEventListener) | |
window.addEventListener("load", downloadJSAtOnload, 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
//useful for jsfiddle | |
$('head').append('<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=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
<?php | |
$count = 1; | |
$values = array("1","2","3"); | |
echo "<ul>"; | |
foreach($values as $value){ | |
echo "<li data-id=\"id-".$count."\" data-type=\"".$value['class']."\">test</li>\n"; | |
$count++; | |
} | |
echo "</ul>"; |
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 | |
//Some times you need to accept some url as input but users seldom add | |
// http:// to it, this code will add http:// to the URL if it’s not there. | |
if (!preg_match("/^(http|ftp):/", $_POST['url'])) { | |
$_POST['url'] = 'http://'.$_POST['url']; | |
} |
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 | |
// This function converts URLs and e-mail addresses within a string into clickable hyperlinks. | |
function makeClickableLinks($text) { | |
$text = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_+.~#?&//=]+)', | |
'<a href="\1">\1</a>', $text); | |
$text = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_+.~#?&//=]+)', | |
'\1<a href="http://\2">\2</a>', $text); | |
$text = eregi_replace('([_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,3})', |
OlderNewer