Skip to content

Instantly share code, notes, and snippets.

View chriscoyier's full-sized avatar

Chris Coyier chriscoyier

View GitHub Profile
var instanse = false;
var state;
var mes;
var file;
function Chat () {
this.update = updateChat;
this.send = sendChat;
this.getState = getStateOfChat;
}
@chriscoyier
chriscoyier / gist:1027728
Created June 15, 2011 18:21
doctypeandhtml.html
<!doctype html>
<!--[if lt IE 7 ]> <html class="no-js ie6 ie" lang="en"> <![endif]-->
<!--[if IE 7 ]> <html class="no-js ie7 ie" lang="en"> <![endif]-->
<!--[if IE 8 ]> <html class="no-js ie8 ie" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<ul>
<li>
<a href="#">Do a thing</a>
<summary>
?
<details>
Bunch of HTML in here.
<details>
</summary>
</li>
.fluid-width-video-wrapper {
width: 100%;
position: relative;
padding: SET-BY-JAVASCRIPT% 0 0 0;
}
.fluid-width-video-wrapper iframe,
.fluid-width-video-wrapper object,
.fluid-width-video-wrapper embed {
position: absolute;
(function() {
var fluidParent = $("#juice > .inside > article"),
newWidth, newHeight;
function resizeVideo() {
newWidth = fluidParent.width();
sublimevideo.resize('the-video', newWidth, newWidth/1.78125);
};
$(".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' ),
<?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 } ?>