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
$('input[type=text]').each(function(i){ | |
var defaultValue = new Array(); | |
defaultValue[i] = $(this).val(); | |
$(this).click(function(){ | |
if($(this).val() == defaultValue[i]){ | |
$(this).val(''); | |
} | |
}); |
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
// Appends a div to the passed object(s) | |
function appendToObject(obj) { | |
if(typeof(obj) === 'object') { | |
for(var i = 0; i <= obj.length; i ++) { | |
$(obj[i]) | |
.append('<div class="after">.</div>'); | |
} |
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(document).ready(function($){ | |
//vars | |
var pagePanels = [], | |
panelsId = [], | |
panelsOffset = []; | |
// Stores the links to the panels | |
$('#navigation div > div.navMenuLeft a, #navigation div > div.navMenuRight a') | |
.each( function(i) { |
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{ :xmlns => "http://www.w3.org/1999/xhtml" } | |
%head | |
:plain | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
%meta{ :name => "viewport", :content => "width=device-width, initial-scale=1.0" } | |
%title | |
=stylesheet_link_tag 'site' | |
%body{ } |
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 the link being clicked is external its opened in a new window | |
// http://css-tricks.com/snippets/jquery/open-external-links-in-new-window | |
$('a') | |
.bind('click', function(event) { | |
var a = new RegExp('/' + window.location.host + '/'); | |
if(!a.test(this.href)) { | |
event.preventDefault(); | |
window.open(this.href, '_blank'); |
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 setColumnHeight(obj1, obj2) { | |
if($(obj1).height() < $(obj2).height()) { | |
$(obj1) | |
.css({ | |
'height': $(obj2).height() | |
}); | |
} else { | |
$(obj2) | |
.css({ | |
'height': $(obj1).height() |
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 the link being clicked is external the user will be prompted | |
// to confirm they wish to leave the site. Confirmation results in | |
// the external link being opened in a new window | |
$('a') | |
.bind('click', function(event) { | |
var a = new RegExp('/' + window.location.host + '/'); | |
if(!a.test(this.href)) { |
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 | |
// Checks a url string for http || https if its not there then http is applied | |
function validate_url_string( $url_string ) { | |
$pattern = '/^(http:\/\/|https:\/\/)/'; | |
preg_match( $pattern, $url_string, $matches ); | |
$url_string = count( $matches ) > 0 ? $url_string : 'http://'.$url_string; | |
return $url_string; |
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 | |
/** | |
* Truncates a string to be no more than $numwords. **Will work with html if $strip_html is true** | |
* @param string $input The string to be truncated | |
* @param int $numwords The number of words to be returned | |
* @param string $padding Ellipsis... | |
* @param boolean $strip_html Should be set to true if html is contained within $input | |
* @return string The truncated string | |
*/ |
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
// Thanks dude http://css-tricks.com/snippets/javascript/shuffle-array/ | |
function shuffle(o) { | |
for(var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x); | |
return o; | |
}; |
OlderNewer