Skip to content

Instantly share code, notes, and snippets.

I will likely never set this status again.

Cody Peterson codyjames

I will likely never set this status again.
View GitHub Profile
View GetLinkitSchema.php
// yourmodule/src/listeners/GetLinkitSchema.php
namespace modules\hshelpers\listeners;
use fruitstudios\linkit\base\Link;
use fruitstudios\linkit\models\Entry;
use markhuot\CraftQL\Types\EntryInterface;
use fruitstudios\linkit\fields\LinkitField;
use markhuot\CraftQL\Events\GetFieldSchema;
codyjames / tag_slug_classes.php
Created Jan 14, 2014
Wordpress. Add the tags of a post to post_class();
View tag_slug_classes.php
// Add tags to post classes
function tag_slug_classes($classes) {
global $post;
$tags = get_the_tags();
if ($tags) {
foreach($tags as $tag) {
$classes[] = 'tag-'.$tag->slug;
return $classes;
codyjames / hs-responsive-images
Created Nov 26, 2013
Dumb idea for responsive images. Basically you would create a super tiny version of the image that's just a solid color or something. That would make it so the dimensions of the image would be correct without having to calculate them with JS or anything.
View hs-responsive-images
@media only screen and (min-device-pixel-ratio: 2) { background-image: url('/path/to/image/high-res.jpg')}
@media screen and (max-device-pixel-ratio: 1.999) { background-image: url('/path/to/image/low-res.jpg')}
title="Image Title"
codyjames / gist:2979464
Created Jun 23, 2012
CSS3 Animation Fix Glitch in Mobile Safari
View gist:2979464
// Assuming this
.foo {
-webkit-transition: -webkit-transform 1s ease-out;
.foo:hover {
-webkit-transform: translateX(20px);
codyjames / lastfmissue
Created Nov 8, 2011 PHP cURL JSON
View lastfmissue
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 1);
$content = curl_exec($ch);
$content = json_decode($content);
$events = $content->events;