Skip to content

Instantly share code, notes, and snippets.

View ccheney's full-sized avatar
🌎
💥🚀

Chris Cheney ccheney

🌎
💥🚀
  • @Collaboration.AI
  • mpls
View GitHub Profile
@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');
}
@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: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: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:4389114
Created December 27, 2012 15:38
jQuery: Convert HTML Table to JSON
(function($){
var convertTableToJson = function()
{
var rows = [];
$('table tr').each(function(i, n){
var $row = $(n);
rows.push({
display_name: $row.find('td:eq(0)').text(),
first_name: $row.find('td:eq(1)').text(),
last_name: $row.find('td:eq(2)').text(),
@ccheney
ccheney / gist:6223061
Last active December 21, 2015 00:49
Sublime Pref
{
"caret_style": "phase",
"detect_slow_plugins": false,
"font_face": "Ubuntu Mono",
"font_options": [
"subpixel_antialias"
],
"font_size": 12,
"highlight_line": true,
"highlight_modified_tabs": true,
@ccheney
ccheney / css-comb-sort-order
Created December 6, 2013 21:34
Property sorting order for CSS Comb
$default_sort_order = '[
"display",
"overflow",
"-ms-overflow-x",
"-ms-overflow-y",
"overflow-x",
"overflow-y",
"visibility",
"width",
"min-width",
@ccheney
ccheney / config.cson
Last active August 29, 2015 13:57
Atom Config
'editor':
'fontSize': 14
'fontFamily': 'Ubuntu Mono'
'lineHeight': 1.5
'showIndentGuide': true
'tabLength': 4
'hideIgnoredNames': true
'core':
'themes': [
'atom-dark-ui'
/**
* A bind polyfill for browsers that don't support the bind method.
*/
if (!Function.prototype.bind) {
Function.prototype.bind = function (oThis) {
if (typeof this !== 'function') {
// closest thing possible to the ECMAScript 5 internal IsCallable function
throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable');
}
var aArgs = Array.prototype.slice.call(arguments, 1), fToBind = this, fNOP = function () {
We couldn’t find that file to show.