Skip to content

Instantly share code, notes, and snippets.

View rupert-ong's full-sized avatar

Rupert Ong rupert-ong

  • Toronto, Ontario
View GitHub Profile
@rupert-ong
rupert-ong / gist:2022605
Created March 12, 2012 15:22
CSS: Image Replacement
.ir {
border:0;
font: 0/0 a;
text-shadow: none;
color: transparent;
background-color: transparent;
}
@rupert-ong
rupert-ong / gist:2022687
Created March 12, 2012 15:34
CSS: Sass Mixin - 3D Text
/**
* Design Shack 3D Text Mixin
*/
@mixin threedeetext($color) {
color: $color;
text-shadow:
0 2px 0 darken($color, 14%),
0 4px 0 darken($color, 16%),
0 6px 0 darken($color, 18%),
@rupert-ong
rupert-ong / wordpress-copyright-feed
Created April 24, 2012 14:30
Wordpress: Copyright Feed
@rupert-ong
rupert-ong / gist:2480147
Created April 24, 2012 14:36
Wordpress: "More From Author" to Feed
<?php
function authors_post_list_in_feed($content) {
if(is_feed()) {
global $post;
$author = get_the_author();
$author_id = $post->post_author;
$the_posts = get_posts('author=' . $author_id . '&numberposts=5');
$output = '<h3>More From ' . $author . '</h3>';
$output .= '<ul>';
foreach($the_posts as $post) {
@rupert-ong
rupert-ong / gist:2482114
Created April 24, 2012 18:04
Wordpress: Contact Methods to Profile
function my_user_contactmethods($user_contactmethods){
$user_contactmethods['twitter'] = 'Twitter Username';
$user_contactmethods['facebook'] = 'Facebook Username';
return $user_contactmethods;
}
add_filter('user_contactmethods', 'my_user_contactmethods');
@rupert-ong
rupert-ong / gist:2482187
Created April 24, 2012 18:09
jQuery: Fade In Object One by One
$.fn.fade1by1 = function(options) {
var opt = $.extend({
'delay': 500,
'speed': 500,
'ease': 'linear'
}, options);
var that = this;
for (var i = 0, d = 0, l = that.length; i < l; i++, d += opt.delay) {
that.eq(i).delay(d).fadeIn(opt.speed, opt.ease);
}
@rupert-ong
rupert-ong / CSS: Styled Pop Up Menu
Created April 24, 2012 18:14
jQuery: Styled Pop Up Menu
.size { position:relative }
.size .field {
width:300px; background:#EC6603; color:#fff; padding:5px; border:none; cursor:pointer;
font-family:'lucida sans unicode',sans-serif; font-size:1em;
border:solid 1px #EC6603;
-webkit-transition: all .4s ease-in-out;
transition: all .4s ease-in-out;
}
.size .field:hover {
border:solid 1px #fff;
@rupert-ong
rupert-ong / MySQL Commands
Created April 26, 2012 14:11
Wordpress: Migrate Site (MySQL + Functions.php)
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldsite.com', 'http://www.newsite.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldsite.com','http://www.newsite.com');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldsite.com', 'http://www.newsite.com');
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://www.oldsite.com', 'http://www.newsite.com');
@rupert-ong
rupert-ong / gist:2570660
Created May 1, 2012 19:20
Wordpress: Long Loop Snippet
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div class="post" id="post-">
<h2><a href="" rel="bookmark" title="Permanent Link to
<?php the_title(); ?>"><?php the_title(); ?></a></h2>
<small><?php the_time('F jS, Y') ?> <!-- by --></small>
<div class="entry">
<?php the_content('Read the rest of this entry »'); ?>
</div>
@rupert-ong
rupert-ong / gist:2570662
Created May 1, 2012 19:21
Wordpress: Short Loop
<?php
if (have_posts()) : while (have_posts()) : the_post();
the_content('Read the rest of this entry »');
?>
<?php
endwhile;
else:
echo 'Sorry, no posts were found.';
endif;
?>