Skip to content

Instantly share code, notes, and snippets.

View ccheney's full-sized avatar
🌎
💥🚀

Chris Cheney ccheney

🌎
💥🚀
View GitHub Profile
@ccheney
ccheney / gist:4230486
Created December 7, 2012 03:19
CSS: Retina
@media (min--moz-device-pixel-ratio: 1.5),
(-o-min-device-pixel-ratio: 3/2),
(-webkit-min-device-pixel-ratio: 1.5),
(min-device-pixel-ratio: 1.5),
(min-resolution: 144dpi),
(min-resolution: 1.5dppx) {
/* http://mir.aculo.us */
}
@ccheney
ccheney / gist:4076997
Created November 15, 2012 06:29
PHP: detect IE
// detects ie and serves an ie specific page
if (isset($_SERVER['HTTP_USER_AGENT']) &&
(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) {
include "ie/index.html";
return;
@ccheney
ccheney / gist:3958350
Created October 26, 2012 11:51
PHP mongodb - list all keys in a collection
$cursor = $collection->find();
$array = iterator_to_array($cursor);
$keys = array();
foreach ($array as $k => $v) {
foreach ($v as $a => $b) {
$keys[] = $a;
}
}
$keys = array_values(array_unique($keys));
// assuming first key is MongoID so skipping it
@ccheney
ccheney / gist:3875832
Created October 11, 2012 22:10
jQuery: if href is blank remove the a tag
$(function(){
$("#buttons a").each(function() {
var href = $(this).attr("href");
if(href == '') {
var imgSRC = $("img", this).attr("src");
var imgSPL = imgSRC.split('.');
var imgCOM = imgSPL[0] +'-g.'+ imgSPL[1];
$("img", this).attr("src", imgCOM);
$(this).removeAttr('href');
}