Skip to content

Instantly share code, notes, and snippets.

View jesgundy's full-sized avatar

Jesse Gundy jesgundy

View GitHub Profile
@jesgundy
jesgundy / selection.scss
Created May 21, 2012 00:05
Text selection color
::selection {
background: #000;
}
::-moz-selection {
background: #000;
}
@jesgundy
jesgundy / alpha.scss
Created June 13, 2012 17:21
IE RGBA Filter
// Color format is #AARRGGBB where 'A' is alpha
background: rgba(0,0,0,0.3);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#44000000,endColorstr=#44000000);
@jesgundy
jesgundy / addLoadEvent.js
Created September 11, 2012 13:23
Add load event function
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
oldonload();
func();
}
}
@jesgundy
jesgundy / getHTTPObject.js
Created September 13, 2012 15:08
Vanilla JS getHTTPObject AJAX request
// Reusable x-browser XMLHttpRequest
function getHTTPObject() {
var xhr = false;
if (window.XMLHttpRequest) {
xhr = new XMLHttpRequest();
} else if (window.ActiveXObject) {
try {
xhr = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
try {
@jesgundy
jesgundy / prototype.js
Created November 27, 2012 17:48
Prototypal inheritance example
// Prototype Example
var Example = function(a, b) {
this.product = this.mult(a, b);
this.power = this.pow(a, b);
};
Example.prototype = {
mult: function(a, b) {
return a * b;
@jesgundy
jesgundy / oop.js
Created November 28, 2012 20:51
Modular OOP template
window.MyApp = (window.MyApp || {});
MyApp.MyUtils = (function() {
return {
doHandyThing1: function() {},
doHandyThing2: function() {}
};
}());
MyApp.MyModule = (function( utils ) {
@jesgundy
jesgundy / module-structure.js
Created November 29, 2012 18:53
Vanilla JS module structure
var MyModule = (function() {
var ModuleExport = function() {
// Do constructor stuff.
};
ModuleExport.prototype = {
doStuff: function( param ) {
// do stuff, then...
this.doOtherStuff();
@jesgundy
jesgundy / queries.scss
Last active October 13, 2015 12:37
Media queries for standard devices
// Media Queries for Standard Devices courtesy of Chris Coyier and CSS Tricks
// http://css-tricks.com/snippets/css/media-queries-for-standard-devices/
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
// Styles
}
@jesgundy
jesgundy / rem.scss
Last active October 13, 2015 15:38
Rem font-sizing mixin
// REM Font Size Mixin
html {
font-size: 62.5%;
}
@mixin font-size ( $size: 14 ) {
font-size: $size + px;
font-size: $size/10 + rem;
}
body {
@include font-size( 14 );
@jesgundy
jesgundy / stacks.scss
Created December 6, 2012 19:32
Curated system font stacks
// Helvetica Font Stack
font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
font-weight: 300;
// 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;