Skip to content

Instantly share code, notes, and snippets.

View AdamBrodzinski's full-sized avatar

Adam Brodzinski AdamBrodzinski

View GitHub Profile
@AdamBrodzinski
AdamBrodzinski / chromeframe.html
Created March 8, 2012 02:38 — forked from JeffreyWay/chromeframe.html
HTML: Chrome Frame Prompt
<!-- Prompt IE6 users to install Chrome Frame -->
<!--[if lt IE 7 ]>
<script src="//ajax.googleapis.com/ajax/libs/chrome-frame/1.0.3/CFInstall.min.js"></script>
<script>window.attachEvent('onload',function(){CFInstall.check({mode:'overlay'})})</script>
<![endif]-->
@AdamBrodzinski
AdamBrodzinski / gist:2007323
Created March 9, 2012 16:18
IE: Inline Block Hack
/* Preferably in an IE style sheet */
/* Forces IE7 to display as inline-block */
.problemElement,
.problemElement2,
.problemElement3 {
zoom: 1;
*display: inline;
}
@AdamBrodzinski
AdamBrodzinski / dabblet.css
Created June 12, 2012 21:52 — forked from anonymous/dabblet.css
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
@AdamBrodzinski
AdamBrodzinski / compass-retina-sprites.scss
Created August 10, 2012 00:17 — forked from thulstrup/compass-retina-sprites.scss
Using Compass to generate normal and retina sprite maps
@import "compass/utilities/sprites"; // Include compass sprite helpers
@import "compass/css3/background-size"; // Include helper to calc background size
@mixin sprite($name, $hover: false, $active: false) {
@include retina-sprite($name, $sprites, $sprites2x, $hover, $active);
}
// The general purpose retina sprite mixin.
//
@AdamBrodzinski
AdamBrodzinski / gist:3433461
Created August 23, 2012 06:36
Gravatar Rails Helper
# returns the Gravatar for the given user.
def gravatar_for(user)
gravatar_id = Digest::MD5::hexdigest(user.email.downcase)
gravatar_url = "http://gravatar.com/avatar/#{gravatar_id}"
image_tag(gravatar_url, alt: user.name, class:"gravatar")
end
# This is a small rails helper that returns a users gravatar image
# image alt text defaults to user.name, but can easily be changed.
@AdamBrodzinski
AdamBrodzinski / gist:3956123
Created October 25, 2012 23:29
Nerf console.log
if (!window.console) window.console = { log: function() { } };
@AdamBrodzinski
AdamBrodzinski / gist:4010249
Created November 4, 2012 04:32
JavaScript replaceAt string method
// allows you to replace a strings char at a specific index
String.prototype.replaceAt=function(index, char) {return this.substr(0, index) + char + this.substr(index+char.length);}
@AdamBrodzinski
AdamBrodzinski / gist:4067593
Created November 13, 2012 18:43
Get param from URL
function getParam(name) {
var match = RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search);
return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
}
@AdamBrodzinski
AdamBrodzinski / gist:4137894
Created November 24, 2012 01:03
Backbone Template Helpers
// precompiled backbone underscore template helper
var getTemplate = function (id) {
return _.template( $('#'+ id).html() );
};
// doesn't call underscore
var uncompiledTemplate = function (id) {
return $('#'+ id).html();
};
@AdamBrodzinski
AdamBrodzinski / gist:4260906
Created December 11, 2012 18:35
Backbone like getter and setter methods
var Car = function () {
this.attributes = {
color: null,
wheels: 4,
speed: null
};
};
Car.prototype.set = function (key, value) {
this.attributes[key] = value;