Skip to content

Instantly share code, notes, and snippets.

View ralgh's full-sized avatar

Ralph Hansell ralgh

  • Acxiom
  • Portsmouth, NH
View GitHub Profile
@ralgh
ralgh / dabblet.css
Created February 4, 2013 23:23
CSS image crop. Forces image to 4:3 aspect ratio cropping at the middle.
/**
* CSS image crop. Forces image to 4:3 aspect ratio cropping at the middle.
*/
.img-crop{
background-color: #ededed;
overflow: hidden;
width: 100%;
}
.img-crop img{
@ralgh
ralgh / dabblet.css
Last active March 27, 2016 16:23
CSS image crop. Forces image to 4:3 aspect ratio cropping at the middle. http://dabblet.com/gist/4711695
/**
* CSS image crop. Forces image to 4:3 aspect ratio cropping at the middle.
* http://dabblet.com/gist/4711695
*/
.img-crop,
.img-crop img{
width: 100%; /* gotta be responsive these days */
}
.img-crop{
background-color: #ededed; /* some background color for short images */
@ralgh
ralgh / RPS.js
Last active December 22, 2015 00:59 — forked from joehinkle/RPS.js
var
choices = ['rock','paper','scissors'], // Classic version
// choices = ['cockroach','foot','nuke'], // Foot crushes cockroach, nuke blows up foot, cockroach survives nuke.
// choices = ['rock','paper','scissors','spock','lizard'], // Rock-Paper-Scissor-Spock-Lizard version
choicesCount = choices.length,
promptString = (function(choices){
var string = '',
c = choicesCount - 1;
for (var i = 0; i <= c; i++) {
string += (i === 0) ? capitalize(choices[i]) : choices[i];