Skip to content

Instantly share code, notes, and snippets.

View keiththomps's full-sized avatar

Keith Thompson keiththomps

View GitHub Profile
@keiththomps
keiththomps / prepcode.sh
Created February 21, 2013 14:42
Getting syntax highlighted code into your keynote.
# -l for the lexer you want to use (pygments has a lot of lexers)
# -f rtf to make it usable in your keynote
pygmentize -l go -f rtf sample.go | pbcopy
@keiththomps
keiththomps / book_club.markdown
Created December 19, 2013 13:10
Book Club Guidelines (V1)

Book Club

Goal of Book Club

Broaden depth (or breadth) of knowledge as a programmer.

Meeting Place (Time ???)

Squaremouth Office. (example time: Wednesday Before/after work?)

@keiththomps
keiththomps / BookClub-Week1Notes.md
Created December 30, 2013 22:57
Notes for the first few chapters of the go book.

Points of Discussion:

  • godoc command.
  • Public/Private functions.

Keybase proof

I hereby claim:

  • I am keiththomps on github.
  • I am keiththomps (https://keybase.io/keiththomps) on keybase.
  • I have a public key whose fingerprint is AAA0 59DA E081 4E4C 8AC1 81D1 19EA EBCB B704 393F

To claim this, I am signing this object:

javascript:$('.first-name').val("Test");
$('.middle-initial').val("T");
$('.last-name').val("Testerson");
$.each( $("#traveler-details").children("table").children("tbody").children("tr"), function(index, value) { var $ageHtml, $dobHtml, year, age, ageString;
year = new Date().getFullYear();
$ageHtml = $(value).find(".age label");
$dob = $(value).find("input.dob");
age = year - $ageHtml.text();
ageString = "1/1/" + age;
$dob.val(ageString);
@keiththomps
keiththomps / example_usage.rb
Last active August 29, 2015 14:02
A way to use a style sheet for styles in an email.
sheet = ScssFile.new("sample.scss")
sheet.styles_for_class(".orange_header")
=> "color: #FF8E00; font-family: Arial, sans-serif; font-size: 24px;"
sheet.styles_for_class(".box_border_left")
=> "font-family: Arial, sans-serif; font-size: 16px; border-left: 1px solid #dddddd; padding: 10px;"
@keiththomps
keiththomps / class_methods_explained.rb
Created October 6, 2014 20:31
Explaining classes
# How class methods work in ruby
class MyClass
def self.stuff
puts "This is stuff on #{self}"
end
end
MyClass.stuff # => "This is stuff on MyClass"
@keiththomps
keiththomps / find_js_inconsistencies.sh
Last active August 29, 2015 14:16
Finding JS inconsistencies
#!/usr/bin/env zsh -i
echo "Files containing unnecessarily named functions:" $(ag "\w+\s*:\s*function\s*\w+\s*\(" app/assets/javascripts -l | wc -l)
echo "Files containing bad spaces in function expressions:" $(ag "(function \(|function(\s\w+)?\(.*\){)" app/assets/javascripts -l | wc -l)
echo "Files containing { on new line:" $(ag "^\s*\{\s*$" app/assets/javascripts -l | wc -l)
@keiththomps
keiththomps / setup_boot2docker.sh
Last active August 29, 2015 14:21
Moving to boot2docker
# Remove vagrant VM
thed && vagrant halt && vagrant destroy
# Update repos
sqm repos update
# Install, create boot2docker VM, set up direnv for docker values.
workstation && script/bootstrap
echo "Now you need to update your rails apps, and set database 'host' to match what's in the example file"