View Detect safari on windows
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
safari = ($.browser.webkit && !(/chrome/.test(navigator.userAgent.toLowerCase()))); | |
windows = (navigator.userAgent.indexOf("Win")!=-1); | |
if (safari && windows) { | |
alert('this is safari on windows'); | |
} |
View random video ID from a users videofeed
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 | |
// Function that returns random video ID from a users videofeed | |
function RandomYoutube($youtubefeed){ | |
$feedresult = simplexml_load_file($youtubefeed); | |
$videoids = array(); | |
foreach ($feedresult->entry as $video) { |
View ShowTweets.php
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 | |
function ShowTweets(){ | |
// Setting the name of our transient | |
$transName = 'twitter'; | |
// Time that the transient expires (in minutes) | |
$cacheTime = 10; | |
View WordpressShortContent.php
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 | |
function short_content($content,$limit) { | |
$content = strip_tags(html_entity_decode($content, ENT_QUOTES, "UTF-8")); | |
// when the content is longer then $limit, show three dots at the end | |
if(strlen($content) >= ($limit+3)) { | |
$content = substr($content, 0, $limit) . '...'; |
View ValidImg.js
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 IsValidImageUrl(url, callback) { | |
jQuery("<img>", { | |
src: url, | |
error: function() { callback(false); }, | |
load: function() { callback(true); } | |
}); |
View clickToggle.js
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($) { | |
$.fn.clickToggle = function(func1, func2) { | |
var funcs = [func1, func2]; | |
this.data('toggleclicked', 0); | |
this.click(function() { | |
var data = $(this).data(); | |
var tc = data.toggleclicked; | |
$.proxy(funcs[tc], this)(); | |
data.toggleclicked = (tc + 1) % 2; | |
}); |
View OldBrowser.js
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
// The code - first bit is all the UserAgent library. | |
(function(wndw) { | |
var Browsers, OS, Platform, Versions, browser_name, browser_version, os, platform; | |
Versions = { | |
Firefox: /firefox\/([\d\w\.\-]+)/i, | |
IE: /msie\s([\d\.]+[\d])/i, | |
Chrome: /chrome\/([\d\w\.\-]+)/i, | |
Safari: /version\/([\d\w\.\-]+)/i, | |
Ps3: /([\d\w\.\-]+)\)\s*$/i, | |
Psp: /([\d\w\.\-]+)\)?\s*$/i |
View StickyScroll.js
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
// sticky scroll function | |
function ScrollNav() { | |
if ($(document).scrollTop() > 0) { | |
} else { | |
} | |
} |
View RGBtoHEX.js
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 to convert RGB Color to hex | |
function rgbToHex(r, g, b) { | |
if (r > 255 || g > 255 || b > 255) | |
throw "Invalid color component"; | |
return ((r << 16) | (g << 8) | b).toString(16); | |
} |
OlderNewer