Skip to content

Instantly share code, notes, and snippets.

Chris Coyier chriscoyier

Block or report user

Report or block chriscoyier

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:daf08a8b18a55ac4ce2af0d78dcff5c6
"remove-empty-rulesets": true,
"always-semicolon": true,
"color-case": "lower",
"block-indent": " ",
"color-shorthand": true,
"element-case": "lower",
"eof-newline": true,
"leading-zero": true,
"quotes": "double",
View resize.js
// Fires when __CodePenIFrameAddedToPage() fires.
makeCodePenEmbedsResizeable: function() {
if (window.innerWidth > 625) {
var maxWidth = 1000; // calculated below
var minWidth = 320;
var minHeight = 150;
$(".cp_embed_wrapper").each(function() {
var $wrapper = $(this);
View comment_callback.php
// Custom Comments
function csstricks_comment($comment, $args, $depth) {
$GLOBALS['comment'] = $comment; ?>
<li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
<div class="grid group comment-wrap" id="comment-<?php comment_ID(); ?>">
<div class="comment-avatar grid-1-5">
chriscoyier / instrument.js
Last active May 3, 2019
The JS Instrumenting we do at CodePen
View instrument.js
var esprima = require('esprima');
function instrument(code) {
var LOOP_CHECK = 'if (window.CP.shouldStopExecution(%d)){break;}';
var LOOP_EXIT = "\nwindow.CP.exitedLoop(%d);\n";
var loopId = 1;
var patches = [];
esprima.parse(code, {
View example-post.html
<p>It may be news to you, but there is a nifty resource called <a href="">Quotes on Design</a> that serves up interesting quotes <em>about design</em>, curated by our very own <a href="">Chris Coyier</a>.</p>
<p>Up to this point, Quotes on Design (QoD) used a bit of custom code to query the WordPress database and serve up quotes. This was used for the site itself, and for its <a href="">API</a> to allow use on external sites. With the excitement surrounding the upcoming <a href="">WordPress JSON REST API</a>, we thought it would be fun to rebuild the site to use the WP API instead of our own custom code.</p>
<p><span id="more-200657"></span></p>
<figure id='post-201770' class='align-right media-201770'><img src='//' alt='' /></figure>
<p>Here's what we'll cover:</p>
<li>Setting up the API</li>
<li>Querying the API to grab a random quote</li>
<li>Doing somet
View gist:1a6d10b6155ff4a5d838
<figure id='post-201853' class='align-right media-201853'><img src='//' alt='' /></figure>
View wp_css_tricks_images_responsive.php
// I could use some help with this.
// It looks SUPER close to working, but at the final moment, it doesn't.
// Example post HTML
You can’t perform that action at this time.