Skip to content

Instantly share code, notes, and snippets.

View shanemcd's full-sized avatar

Shane McDonald shanemcd

View GitHub Profile
@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
@shanemcd
shanemcd / gist:4718496
Created February 5, 2013 22:59
Prevent scrolling
body{
overflow: hidden;
}
function pkill() {
for X in `ps acx | grep -i $1 | awk {'print $1'}`; do
kill $X;
done
}
@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;
@mixin background-image-retina($file, $type, $width, $background-repeat: no-repeat) {
background-image: image-url($file + '.' + $type);
width: $width;
background-repeat: $background-repeat;
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 144dpi) {
& {
background-image: image-url($file + '@2x.' + $type);
background-size: $width;
}
# routes.rb
get '/:campaign' => 'campaigns#show', constraints: CampaignConstraint.new
# lib/campaign_constraint.rb
class CampaignConstraint
def matches?(request)
Campaign.exists?(name: request.params[:campaign])
end
end
require 'rubygems'
require 'doc_raptor'
TEN_SECONDS = 10
FIVE_MINUTES = 300
DocRaptor.api_key "YOUR_API_KEY_HERE"
pdf_html = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html lang="en"><body><a href="http://google.com">google</a></body></html>'

Keybase proof

I hereby claim:

  • I am shanemcd on github.
  • I am shanemcd (https://keybase.io/shanemcd) on keybase.
  • I have a public key whose fingerprint is C0D6 7E46 E506 8B11 6212 1457 5DF2 ED93 B72A C963

To claim this, I am signing this object:

@shanemcd
shanemcd / etc.fstab
Last active December 4, 2016 18:40 — forked from vadviktor/etc.fstab
Ubuntu guest VMware shared folders using open-vm-tools package and vmhgfs-fuse
.host: /mnt fuse.vmhgfs-fuse allow_other,uid=1000,gid=1000,auto_unmount,defaults 0 0
Mock Version: 1.3.4
ENTER ['do'](['bash', '--login', '-c', '/usr/bin/rpmbuild -bs --target x86_64 --nodeps /builddir/build/SPECS/erlang.spec'], shell=FalseprintOutput=FalsechrootPath='/var/lib/mock/epel-7-x86_64-mockbuilder-6128/root'nspawn_args=[]uid=1001gid=135timeout=0logger=<mockbuild.trace_decorator.getLog object at 0x7f2b6df2d828>user='mockbuild'env={'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'PS1': '<mock-chroot> \\s-\\v\\$ ', 'SHELL': '/bin/bash', 'PROMPT_COMMAND': 'printf "\\033]0;<mock-chroot>\\007"', 'TERM': 'vt100', 'LANG': 'en_US.UTF-8', 'HOME': '/builddir', 'HOSTNAME': 'mock'})
Executing command: ['bash', '--login', '-c', '/usr/bin/rpmbuild -bs --target x86_64 --nodeps /builddir/build/SPECS/erlang.spec'] with env {'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'PS1': '<mock-chroot> \\s-\\v\\$ ', 'SHELL': '/bin/bash', 'PROMPT_COMMAND': 'printf "\\033]0;<mock-chroot>\\007"', 'TERM': 'vt100', 'LANG': 'en_US.UTF-8', 'HOME': '/builddir', 'HOSTNAME': 'mock'} and shell False
warning: bogus date in %changelog: