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 'mysql' | |
class Mysql::Result | |
def encode(value, encoding = "utf-8") | |
String === value ? value.force_encoding(encoding) : value | |
end | |
def each_utf8(&block) | |
each_orig do |row| | |
yield row.map {|col| encode(col) } |
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 | |
/* | |
Description: Adds a taxonomy filter in the admin list page for a custom post type. | |
Written for: http://wordpress.stackexchange.com/posts/582/ | |
By: Mike Schinkel - http://mikeschinkel.com/custom-workpress-plugins | |
Instructions: Put this code in your theme's functions.php file or inside your own plugin. Edit to suite your post types and taxonomies. Hope this helps... | |
*/ | |
add_filter('manage_listing_posts_columns', 'add_businesses_column_to_listing_list'); | |
function add_businesses_column_to_listing_list( $posts_columns ) { | |
if (!isset($posts_columns['author'])) { |
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 templates use constructs like: | |
{{if condition}} print something{{/if}} | |
This, of course, completely screws up Django templates, | |
because Django thinks {{ and }} mean something. | |
Wrap {% verbatim %} and {% endverbatim %} around those | |
blocks of jQuery templates and this will try its best |
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
@mixin fancy-hover($sprite_dir, $off_state, $hover_state, $speed: 0.3s) | |
$sprites: sprite-map("#{$sprite_dir}/*.png") | |
$width: image-width(sprite_file($sprites, $off_state)) | |
$height: image-height(sprite_file($sprites, $off_state)) | |
@include hide-text | |
width: $width | |
height: $height | |
background: sprite($sprites, $off_state) no-repeat | |
display: block | |
position: relative |
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
// $('img.photo',this).imagesLoaded(myFunction) | |
// execute a callback when all images have loaded. | |
// needed because .load() doesn't work on cached images | |
// Modified with a two-pass approach to changing image | |
// src. First, the proxy imagedata is set, which leads | |
// to the first callback being triggered, which resets | |
// imagedata to the original src, which fires the final, | |
// user defined callback. |
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
''' | |
@author Josh Bjornson | |
This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. | |
To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ | |
or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA. | |
''' | |
# Plugin to provide access to the history of accessed files: | |
# https://gist.github.com/1133602 | |
# |
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 | |
add_filter( 'cmspo_post_types', 'be_sort_rotator' ); | |
/** | |
* CMS Page Order for Rotator post type | |
* @author Bill Erickson | |
* @link http://www.billerickson.net/code/change-post-types-cms-page-order/ | |
* | |
* @param array $post_types (default is array( 'page' ) ) | |
* @return array $post_types modified |
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
/** | |
* PE to use SVG as CSS background image with fallback for IE8/7/6 | |
* | |
* Using SVG as CSS background image to display | |
* resolution-independent logos or icons is pretty | |
* awesome but does completely fail on IE8/7/6 | |
* | |
* The trick: | |
* All three IE versions don't support rgba color values. | |
* By defining a rgba background color together with the |
OlderNewer