Skip to content

Instantly share code, notes, and snippets.

View mrmrs's full-sized avatar

Adam Morse mrmrs

View GitHub Profile
body, button, input, select, textarea { margin: 0; }
@mrmrs
mrmrs / random-data.js
Last active January 3, 2016 04:39
Generate random data in js
// Create empty array to house data
var singleDimensionArray = [];
// for 1 < 25, 25 is equal to the length of the generated array
for (var i = 0; i < 25; i ++) {
var newNumber = Math.round(Math.random() * 30); // Create a random number between 0 - 30.
singleDimensionArray.push(newNumber); // Adds random number to the array
}
@mrmrs
mrmrs / html5-element-list.txt
Created November 25, 2013 22:43
List of all html 5 elements, in alphabetical order.
a
abbr
address
area
article
aside
audio
b
bdi
bdo
@mrmrs
mrmrs / _debug_layout.css
Created September 17, 2013 20:22
Since outline doesn't change an elements width - it can be very useful in illustrating what is happening with your layout. Basically it is magic.
/*
Drop this in your css file to get insight into how elements are rendering.
Useful for debugging layout issues.
*/
a { outline: 1px solid crimson;}
abbr { outline: 1px solid aqua;}
address { outline: 1px solid aquamarine;}
article { outline: 1px solid blueviolet;}
blockquote { outline: 1px solid cadetblue;}
@mrmrs
mrmrs / _debug_layout.scss
Created September 17, 2013 20:03
Outline is neat because it doesn't change the element width. This is useful for debugging layout issues.
$layout-debug: true; // Put this in your variables file...if you have one.
@if $layout-debug == true {
a { outline: 1px solid crimson;}
abbr { outline: 1px solid aqua;}
address { outline: 1px solid aquamarine;}
article { outline: 1px solid blueviolet;}
blockquote { outline: 1px solid cadetblue;}
caption { outline: 1px solid cornflowerblue;}
@mrmrs
mrmrs / count-declarations.sh
Created September 9, 2013 21:02
Find count of a given css declaration.
# where sass is the directory you want to search and 'float: left' is the declaration you want to search for.
find sass -print0 | xargs -0 grep -ir 'float: left' ./ | wc -l
@mrmrs
mrmrs / color_variable_naming.scss
Created September 9, 2013 20:04
Model for handling color variables.
// Single color variable named after content
$red: #ff0000;
// Multiple variables mapped to this variable.
$font-color: $red;
$secondary-bg: $red;
@mrmrs
mrmrs / sass-variables-from-string.vim
Created August 25, 2013 17:08
Will reformat the string HotPink FF 69 B4 255 105 180 to $HotPink: #FF69B4; Then it will jump to the next line
I$^[/\ ^Mi: #^[lx/\ ^Mxnxnr;lD^[j0
@mrmrs
mrmrs / gist:6315378
Created August 23, 2013 03:51
Run csslint on every file in a directory. Output results to lint_$filename.
for file in *; do csslint $file > lint_$file;
@mrmrs
mrmrs / count-all-elements.js
Created August 23, 2013 00:24
List all elements on a page. Using this a lot for css performance testing sites I don't have source for locally.
document.getElementsByTagName("*").length