Skip to content

Instantly share code, notes, and snippets.

@cameroooon
cameroooon / application-html-haml
Created November 13, 2012 03:07
Simple application boilerplate using HAML
!!!
/[if lt IE 7]
%html{:class => "no-js lt-ie9 lt-ie8 lt-ie7"}
/[if IE 7]
%html{:class => "no-js lt-ie9 lt-ie8"}
/[if IE 8]
%html{:class => "no-js lt-ie9"}
\<!--[if gt IE 8]><!-->
%html{:class => "no-js"}
@cameroooon
cameroooon / rh-cpc-remap.xml
Last active October 11, 2015 14:57
Right-hand Copy, Paste & Cut for KeyRemap4MacBook App
<?xml version="1.0"?>
<root>
<item>
<name>Right-Hand Copy for Left-Handed Mouse Users</name>
<appendix>Fn+Control_R to Command_L+C</appendix>
<identifier>remap.right_hand_copy_keytokey</identifier>
<autogen>--KeyToKey-- KeyCode::FN, ModifierFlag::CONTROL_R, KeyCode::C, ModifierFlag::COMMAND_L</autogen>
</item>
@cameroooon
cameroooon / svg2png-polyfill.coffee
Last active October 9, 2015 12:37
CoffeeScript SVG to PNG Polyfill
# SVG polyfill (requires modernizr - http://modernizr.com)
unless Modernizr.svg
$('img[src *= ".svg"]').each( ->
nurl = $(this).attr('src').replace(/\.svg$/, '.png')
$(this).attr src: nurl
)
@cameroooon
cameroooon / parse-qstring.js
Created July 2, 2012 02:44
Parse a query string and return a specific parameter value
/* QUERY STRINGS ---- */
// name = parameter in qstring to return, qstr = string to search, which defaults to the current URL if not present
function getParameterByName(name, qstr) {
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regexS = "[\\?&]" + name + "=([^&#]*)";
var regex = new RegExp(regexS);
var results = (qstr) ? regex.exec(qstr) : regex.exec(window.location.search);
if(results == null)
return "";
else
@cameroooon
cameroooon / boilerplate.css
Created June 21, 2012 04:43
A CSS boilerplate
/*
=============================================================================
NORMALIZE (using HTML5 Boilerplate)
=============================================================================
*/
/* HTML5 element display
========================================================================== */
article, aside, details, figcaption, figure, footer, header, hgroup, nav, section { display: block; }
audio[controls], canvas, video { display: inline-block; *display: inline; *zoom: 1; }
@cameroooon
cameroooon / lib.less
Created June 21, 2012 04:18
A library of LESS CSS mixins and functions
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// LESS CSS Styles
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Vendor Prefix Groups
// ---------------------------------------------------
.border-radius (@radius) {
-moz-border-radius:@radius;
-webkit-border-radius:@radius;
-o-border-radius:@radius;
@cameroooon
cameroooon / add-commas
Created May 30, 2012 01:55
Add Commas - adds commas to long numbers for easy reading
function addCommas(nStr) {
nStr += '';
x = nStr.split('.');
x1 = x[0];
x2 = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1)) {
x1 = x1.replace(rgx, '$1' + ',' + '$2');
}
return x1 + x2;
@cameroooon
cameroooon / flickr-list-json
Created May 29, 2012 03:35
Pull thumbnail data from Flickr using JSON and write them out as a list
function writeFlickrPics() {
var $flickrContainer = $(".flickr ul");
$.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?id=52617155@N08&format=json&jsoncallback=?", function(data) {
var listItems = [];
$.each(data.items, function(i, item) {
var sqr = (item.media.m).replace("_m.jpg", "_s.jpg");
listItems.push("<li><a href='" + item.link + "'><img src='" + sqr + "' /></a></li>");
});
$flickrContainer.append(listItems.join(''));
});