This is a simple SASS file that provides a number of useful mixins to achieve CSS3 effects cross-browser. For each rule, the styles are implemented for as many browsers as possible.
This file contains hidden or 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 | |
// | |
// Put this in your templates' functions.php for a cleaner header: | |
// | |
function remove_x_pingback($headers) { | |
unset($headers['X-Pingback']); | |
return $headers; | |
} |
This file contains hidden or 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
<script type="text/javascript" src="http://code.jquery.com/jquery.js"></script> | |
<script type="text/javascript"> | |
// Call the Twitter API after blurring the input field where a user entered his Twitter handle | |
// Get the avatar and append as picture in the HTML | |
$('#twittername').blur(function() { | |
console.log('Twitter call'); | |
var tweeter = $('#twittername').val(); | |
$.ajax({ | |
type: 'GET', | |
processData: true, |
This file contains hidden or 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
/* | |
How to print a string in both (or more) languages when using qTranslate on Wordpress | |
qTranslate provides Wordpress with multilanguage support and automates this in a pleasant way. | |
However you might want to print a specific string in a specific language, somewhere in your | |
theme or module. | |
Use this function to extract the content from the qTranslate quicktags, and retrieve the | |
title directly from the database using this query. |
This file contains hidden or 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 get content in a particular language when dependant on qTranslate | |
// qTranslate plugin for Wordpress: http://www.qianqin.de/qtranslate/ | |
// Inspired by http://stackoverflow.com/questions/1853406/simple-regular-expression-to-return-text-from-wordpress-title-qtranslate-plugin | |
function ynbs_translatethis($content) { | |
$regexp = '/<\!--:(\w+?)-->([^<]+?)<\!--:-->/i'; | |
if(preg_match_all($regexp, $content, $matches)) { | |
$output = array(); | |
$count = count($matches[0]); | |
for($i = 0; $i < $count; $i++) { |
This file contains hidden or 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
// How to switch Useragent in Google Chrome on Mac: | |
In bash run: | |
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome -psn_0_159783 -user-agent="Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_1_3 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7E18 Safari/528.16" | |
This file contains hidden or 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 | |
// A function to check the permissions of a folder using PHP | |
// @path = path to the folder you want to check | |
// @perm = permissions you want to check on the folder (0755) | |
function ynbs_check_permissions($path, $perm) { | |
clearstatcache(); | |
$configmod = @substr(sprintf(".%o", fileperms($path)), -4); | |
if ($configmod != $perm) { |
This file contains hidden or 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 | |
// Queries the TweetMeme API to check for tweets about this url | |
// If no results, TweetMeme will create a story for this link | |
// Uses the get_url function: http://gist.github.com/370985 | |
// Make sure you set the right permissions for you cache directory! | |
function tweetMeme($bloglink) { | |
// Set some vars: | |
$tweetmemeAPI = 'http://api.tweetmeme.com/url_info?url='; |
This file contains hidden or 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 | |
// Don't like fopen(), use curl to get contents | |
function get_url($url) { | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $url); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); | |
$content = curl_exec($ch); | |
curl_close($ch); |
This file contains hidden or 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 | |
// Fixes a (long) link description to fit your shortened printed string | |
// uses WordCut: http://gist.github.com/370982 | |
// @var = your full text string (function will cut this) | |
function linkfix($var) { | |
$pattern = '%(<a href=")([-/_+0-9a-z]{3,})(">)(.*?)(</a>)%i'; | |
preg_match($pattern, $var, $matches); | |
$newtext = wordCut($matches[4], 20, '...'); |