Skip to content

Instantly share code, notes, and snippets.

View eralston's full-sized avatar
🏠
Working from home

Erik Ralston eralston

🏠
Working from home
View GitHub Profile
@eralston
eralston / 1kb-grid.sass
Created May 12, 2011 00:17
A paramterized SASS implementation of 1KB Grid, allowing for different parameters
//basic parameters - Change for your grid
$number_of_columns: 10
$width_of_gutters: 20px
$width_of_grid: 900px
//calculate parameters
$column_width:($width_of_grid / $number_of_columns - $width_of_gutters)
$padding: $width_of_gutters / 2
.col
@eralston
eralston / DateFormat.js
Created May 12, 2011 15:52
Date Format 1.2.3 by Steven Levithan <stevenlevithan.com> - A date formatting library for JavaScript
/*
* Date Format 1.2.3
* (c) 2007-2009 Steven Levithan <stevenlevithan.com>
* MIT license
*
* Includes enhancements by Scott Trenda <scott.trenda.net>
* and Kris Kowal <cixar.com/~kris.kowal/>
*
* Accepts a date, a mask, or a date and a mask.
* Returns a formatted version of the given date.
/*
* Cross-browser display: inline-block
*
* References:
* - http://foohack.com/2007/11/cross-browser-support-for-inline-block-styling/
* - http://www.getonthenet.eu/css-howto-cross-browser-inline-block/
*/
inline-block {
display: -moz-inline-box; /* Firefox 2 */
@eralston
eralston / trim.js
Created May 13, 2011 16:31
JavaScript snippet for trimming whitespace from strings - http://www.somacon.com/p355.php
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g,"");
}
String.prototype.ltrim = function() {
return this.replace(/^\s+/,"");
}
String.prototype.rtrim = function() {
return this.replace(/\s+$/,"");
}
<style type="text/css">
.clearfix:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
@eralston
eralston / Reset.css
Created May 19, 2011 00:39
CSS Snippet for resetting browser inconsistencies, thanks meyerweb :D
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
@eralston
eralston / DataGridAdapt.js
Created April 17, 2012 17:07
jQuery Plug-In to fix .Net DataGrid Output into Something DataTables Can Accept
//
// .Net DataGrid spits out only a tbody for the entire table, but http://datatables.net/ needs thead as well
// This yanks out the first row of the table, assumed to be the header row, then places it within a new thead
// Should be called like this: #("#dot_net_table_id").convertFirstTableRowToHeader().dataTable();
//
(function ($) {
$.fn.convertFirstTableRowToHeader = function () {
return this.each(function () {
var table = $(this);
if (!table.is("table"))
@eralston
eralston / Singleton.m
Last active October 13, 2015 23:08
A simple Singleton template in Objective-C, based on the Big Nerd Ranch snippet
///
/// A singleton class template for header (.h)
///
@interface Singleton : NSObject
+ (Singleton*)shared;
@end
///
@eralston
eralston / HtmlHelperExtensions.cs
Last active December 14, 2015 08:59
A simple static class in C# for ASP.Net MVC 4 that extends @html with a method for checking if the current build is debug or release
/// <summary>
/// Class for holding extensions for the HtmlHelper function
/// </summary>
public static class HtmlHelperExtensions
{
/// <summary>
/// Returns true if the build is DEBUG; otherwise, returns false
/// </summary>
/// <param name="htmlHelper"></param>
/// <returns></returns>
@eralston
eralston / UDK .gitignore
Last active July 26, 2019 23:38
A .gitignore for projects created using the Unreal Development Kit (UDK). This will retain your changes in custom config, code, and content, but ignore foundational components of a UDK install. This list is current as of the February 2013 Beta UDK installation. To use, simply add this content to a .gitignore file before running your initial "git…
# File Types known to be unecessary
*.swp
*.bin
*.checkpoint
*ShaderCache*
*PCTOC*
*.log
*.obj
*IphoneTOC*
*.dmp