Skip to content

Instantly share code, notes, and snippets.

View shanemcd's full-sized avatar

Shane McDonald shanemcd

  • (Ansible (Red Hat (IBM)))
  • Jersey City
View GitHub Profile
@shanemcd
shanemcd / gist:5535944
Last active December 17, 2015 02:29
Best Clearfix
.clearfix {
zoom: 1;
clear: both;
}
.clearfix:before, .clearfix:after {
content: "\0020";
display: block;
height: 0;
overflow: hidden;
function pkill() {
for X in `ps acx | grep -i $1 | awk {'print $1'}`; do
kill $X;
done
}
@shanemcd
shanemcd / gist:4718496
Created February 5, 2013 22:59
Prevent scrolling
body{
overflow: hidden;
}
@shanemcd
shanemcd / gist:4717435
Created February 5, 2013 20:36
loop through a hash and apply different tooltips to multiple elements
icons =
preview: "Print Preview"
edit: "Edit Question"
comment: "Comment"
trash: "Delete"
for icon, text of icons
$(this.el).find(".#{icon}-image").tooltip
title: text
for f in *.yaml; do mv $f `basename $f .yaml`.yml; done;
class Instruments2.Views.FilterQuestionSets extends Backbone.View
template: JST['folders/filter']
id: "filter-question-sets"
className: "clearfix"
events:
"keyup input[type=text]": "filter"
@shanemcd
shanemcd / gist:4269738
Created December 12, 2012 17:21
Require all (most) fields in Rails model
validates_presence_of(self.column_names - ["id", "created_at", "updated_at"])
@shanemcd
shanemcd / gist:4259171
Created December 11, 2012 15:03
modules
module Foobar
def self.foo
puts 'foo'
end
end
module Foobar
def self.bar
puts 'bar'
end
@shanemcd
shanemcd / gist:4217247
Created December 5, 2012 16:41
Clean up $PATH - removes duplicate directories
echo "$PATH" | /usr/bin/awk -v RS=':' -v ORS=":" '!a[$1]++'
@shanemcd
shanemcd / gist:4177528
Created November 30, 2012 18:20
FizzBuzz
(1..100).to_a.map { |i|
if (i % 3 == 0 ) && (i % 5 == 0)
i = "fizzbuzz"
elsif i % 3 == 0
i = "fizz"
elsif i % 5 == 0
i = "buzz"
else
i = i
end