Skip to content

Instantly share code, notes, and snippets.

@Boztown
Boztown / source.js
Created March 14, 2012 17:56
Javascript: jQuery Document Ready
$(function() {
});
@Boztown
Boztown / html_template.html
Last active October 1, 2015 18:38
HTML: HTML5 Template
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.js"></script>
<script type="text/javascript">
</script>
<style text="text/css">
@Boztown
Boztown / clearfix.css
Created March 14, 2012 19:16
CSS: clearfix
/* For modern browsers */
.clearfix:before,
.clearfix:after {
content:"";
display:table;
}
.clearfix:after { clear:both; }
/* For IE 6/7 (trigger hasLayout) */
.clearfix { zoom:1; }
@Boztown
Boztown / date.sql
Created March 14, 2012 19:31
SQL: Date within 1 month
SELECT * FROM purchases WHERE company_id = 17 AND DATE_SUB(CURDATE(),INTERVAL 1 MONTH) <= created_at;
@Boztown
Boztown / box_shadow.css
Created April 18, 2012 21:41
CSS: Box-shadow (LESS class)
.shadow {
-moz-box-shadow: 3px 3px 5px 6px #ccc;
-webkit-box-shadow: 3px 3px 5px 6px #ccc;
box-shadow: 3px 3px 5px 6px #ccc;
}
@Boztown
Boztown / box_shadow_inset.css
Created April 18, 2012 21:41
CSS: Box-shadow Inset (LESS class)
.shadow {
-moz-box-shadow: inset 0 0 10px #000000;
-webkit-box-shadow: inset 0 0 10px #000000;
box-shadow: inset 0 0 10px #000000;
}
@Boztown
Boztown / gist:2493171
Created April 25, 2012 20:39
C#: NewIfNull
// NewIfNull
public T NewIfNull<T>(T obj) where T:new()
{
if (obj == null) { obj = new T(); }
return obj;
}
@Boztown
Boztown / gist:2570569
Created May 1, 2012 19:08
Javascript: Array Contains
/**
* Array.prototype.[method name] allows you to define/overwrite an objects method
* needle is the item you are searching for
* this is a special variable that refers to "this" instance of an Array.
* returns true if needle is in the array, and false otherwise
*/
Array.prototype.contains = function ( needle ) {
for (i in this) {
if (this[i] == needle) return true;
}
@Boztown
Boztown / gist:2570637
Created May 1, 2012 19:15
Javascript: Trim First/Last Characters in String
// Remove last four characters
var myString = "abcdefg";
var newString = myString.substr(0, myString.length-4);
// Remove first two characters
var myString = "abcdefg";
var newString = myString_2.substr(2);
@Boztown
Boztown / gist:2570642
Created May 1, 2012 19:17
CSS: Font Stacks
/* Times New Roman-based stack */
font-family: Cambria, "Hoefler Text", Utopia, "Liberation Serif", "Nimbus Roman No9 L Regular", Times, "Times New Roman", serif;
/* Modern Georgia-based serif stack */
font-family: Constantia, "Lucida Bright", Lucidabright, "Lucida Serif", Lucida, "DejaVu Serif", "Bitstream Vera Serif", "Liberation Serif", Georgia, serif;
/* Traditional Garamond-based serif stack */
font-family: "Palatino Linotype", Palatino, Palladio, "URW Palladio L", "Book Antiqua", Baskerville, "Bookman Old Style", "Bitstream Charter", "Nimbus Roman No9 L", Garamond, "Apple Garamond", "ITC Garamond Narrow", "New Century Schoolbook", "Century Schoolbook", "Century Schoolbook L", Georgia, serif;
/* Helvetica/Arial-based sans serif stack */