Skip to content

Instantly share code, notes, and snippets.

@andershaig
andershaig / debug.css
Created February 28, 2012 01:33
View CSS Structure
* { outline: 2px dotted red }
* * { outline: 2px dotted green }
* * * { outline: 2px dotted orange }
* * * * { outline: 2px dotted blue }
* * * * * { outline: 1px solid red }
* * * * * * { outline: 1px solid green }
* * * * * * * { outline: 1px solid orange }
* * * * * * * * { outline: 1px solid blue }
@andershaig
andershaig / hex.html
Created February 26, 2012 13:57
Hex Color from CSS Output
<div id="color"></div>
<script type="text/javascript">
var css_color = '{% style color my_color %}';
var re = /#?([a-f]|[A-F]|[0-9]){3}(([a-f]|[A-F]|[0-9]){3})?\b/ig;
var hex = re.exec(css_color);
// Print the hex to our div so we can see it working
$('#color').html(hex[0]);
@andershaig
andershaig / dabblet.css
Created February 21, 2012 21:08
Alert Styles
/**
* Alert Styles
*/
.alert {
padding: 7px 14px;
margin-bottom: 5px;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
background-color: #FCF8E3;
border: 1px solid #FBEED5;
@andershaig
andershaig / fan_check.js
Created February 1, 2012 18:43
Request Fan Status
window.checkDoesLike = function() {
FB.api({ method: 'pages.isFan', page_id: '184484190795' }, function(resp) {
if (resp) {
Log.info('You like the Application.');
} else {
Log.error("You don't like the Application.");
}
});
};
@andershaig
andershaig / dabblet.css
Created December 22, 2011 01:13
Image Thumbnail w/ Bevel
/**
* Image Thumbnail w/ Bevel
*/
#bevel {
width:384px;
height:284px;
border:8px solid;
border-color:rgba(213,213,213,0.35) rgba(75,75,75,0.35) rgba(48,48,48,0.35) rgba(202,202,202,0.35);
-webkit-box-shadow:inset 1px 1px 0 0 rgba(255,255,255,0.35), inset -1px -1px 0 0 rgba(255,255,255,0.20);
@andershaig
andershaig / make_thumbs.js
Created December 20, 2011 22:26
Image Thumbnails using JavaScript
// Example: all images with a class of .img get sized to 150px.
makeThumbs({
selector: '.img',
size: 150
});
function makeThumbs() {
var selector = args.selector;
var thumb_size = args.size;
@andershaig
andershaig / boxes.css
Created December 20, 2011 19:42
CSS3 Box Styles
.all_boxes {
display:block;
height:125px;
margin:0 0 50px;
}
.all_boxes h3 {
text-align:center;
line-height:125px;
color:#222;
@andershaig
andershaig / buttons.css
Created December 19, 2011 16:34
CSS3 Buttons
/* Red + Glossy */
.red_delcious {
padding:6px 12px;
border:1px solid #ED161B;
background: #FACAD0;
background: -moz-linear-gradient(top, #FACAD0 0%, #CA2437 50%, #BE0016 51%, #7C000E 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#FACAD0), color-stop(50%,#CA2437), color-stop(51%,#BE0016), color-stop(100%,#7C000E));
background: -webkit-linear-gradient(top, #FACAD0 0%,#CA2437 50%,#BE0016 51%,#7C000E 100%);
background: -o-linear-gradient(top, #FACAD0 0%,#CA2437 50%,#BE0016 51%,#7C000E 100%);
background: -ms-linear-gradient(top, #FACAD0 0%,#CA2437 50%,#BE0016 51%,#7C000E 100%);
@andershaig
andershaig / trim.js
Created December 14, 2011 00:38
Add Trim Function
if(typeof String.prototype.trim !== 'function') {
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, '');
}
}
@andershaig
andershaig / twitter.js
Created December 5, 2011 15:55
Add Target="_top" to Twitter Links after Page Load
$(window).load( function () {
$('.tweet a').each( function () {
$(this).attr('target', '_top');
}
});