Skip to content

Instantly share code, notes, and snippets.

View chriscoyier's full-sized avatar

Chris Coyier chriscoyier

View GitHub Profile
$(".accordion").accordion({
openCallback: myCustomOpenCallback,
closeCallback: myCustomCloseCallback
})
$allVideos.each(function(){
var $this = $(this);
if (this.tagName == 'embed' && $this.parent('object').length) { return; }
var height = this.tagName == 'OBJECT' ? $this.attr('height') : $this.height(),
aspectRatio = height / $this.width();
$this.wrap('<div class="fluid-width-video-wrapper" />').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+"%");
$this.removeAttr('height').removeAttr('width');
});
@chriscoyier
chriscoyier / rss.php
Created November 24, 2011 19:21
iTunes Formatted Page Template for RSS
<?php
/*
Template Name: RSS Videos
*/
$posts = query_posts('showposts=-1&post_type=page&post_status=publish&post_parent=1283');
header('Content-Type: '.feed_content_type('rss-http').'; charset='.get_option('blog_charset'), true);
echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>';
?>
add_action( 'init', 'create_post_type' );
function create_post_type() {
register_post_type( 'screenshot',
array(
'labels' => array(
'name' => __( 'Screenshots' ),
'singular_name' => __( 'Screenshot' ),
'add_new' => __( 'Add Screenshot' ),
'add_new_item' => __( 'Add New Screenshot' ),
'edit_item' => __( 'Edit Screenshot' ),
From: Google Checkout <noreply@checkout.google.com>
To: chriscoyier@gmail.com
Message-ID: <1322809231824.decbabd0-c157-4e85-8a86-10c29a647323@checkout.google.com>
Subject: Rate your shopping experience with GatewayCDI using Google Checkout
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_Part_8012_10578721.1322809232534"
------=_Part_8012_10578721.1322809232534
Content-Type: text/plain; charset=UTF-8
<?php if ($_SERVER['something'] == mx) { ?>
<div class="no-translate">
<?php echo get_post_meta($post->ID, 'translate-mx', true) ?>
</div>
<?php } else { ?>
<?php the_content(); ?>
<?php } ?>
@chriscoyier
chriscoyier / dabblet.css
Created December 16, 2011 00:06
Shit Donkey
/*
Shit Donkey
*/
body { background: red; }
@chriscoyier
chriscoyier / dabblet.css
Created December 19, 2011 22:43
Transitions
/* Transitions */
div {
background: black;
width: 200px;
padding: 10px;
margin: 20px 0;
color: white
}
div:hover {
@chriscoyier
chriscoyier / dabblet.css
Created December 21, 2011 16:00
Checkbox Hack
/* Checkbox Hack */
input[type=checkbox] {
position: absolute;
top: -9999px;
left: -9999px;
}
label {
-webkit-appearance: push-button;
-moz-appearance: button;
/* F.A.Q */
input[type=checkbox] {
position: absolute;
top: -9999px;
left: -9999px;
}
h2 {
font-size: 30px;
font-weight: 400;