Skip to content

Instantly share code, notes, and snippets.

@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@jamiew
jamiew / Procfile
Last active October 4, 2015 12:28
Using unicorn on Heroku
web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb
@johntyree
johntyree / getBlockLists.sh
Last active March 9, 2024 12:32
Make one large blocklist from the bluetack lists on iblocklist.com
#!/usr/bin/env sh
# Download lists, unpack and filter, write to stdout
curl -s https://www.iblocklist.com/lists.php \
| sed -n "s/.*value='\(http:.*=bt_.*\)'.*/\1/p" \
| xargs wget -O - \
| gunzip \
| egrep -v '^#'
@marcedwards
marcedwards / high-dpi-media.css
Last active November 19, 2023 12:56
A CSS media query that captures almost all high DPI aware devices.
/* ---------------------------------------------------------- */
/* */
/* A media query that captures: */
/* */
/* - Retina iOS devices */
/* - Retina Macs running Safari */
/* - High DPI Windows PCs running IE 8 and above */
/* - Low DPI Windows PCs running IE, zoomed in */
/* - Low DPI Windows PCs and Macs running Firefox, zoomed in */
/* - Android hdpi devices and above */
@ryansobol
ryansobol / gist:5252653
Last active November 22, 2023 11:53
15 Questions to Ask During a Ruby Interview

Originally published in June 2008

When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for me at first. In 30 minutes or less, it's difficult to get a solid read on a candidate's skill set without looking at code they've previously written. And in the corporate/enterprise world, I often don't have access to their previous work.

To ensure we hired competent ruby developers at my last job, I created a list of 15 ruby questions -- a ruby measuring stick if you will -- to select the cream of the crop that walked through our doors.

What to expect

Candidates will typically give you a range of responses based on their experience and personality. So it's up to you to decide the correctness of their answer.

@RyanMcG
RyanMcG / rails-pre-commit
Last active August 1, 2018 17:05
A pre-commit hook for rails projects that scans for 'binding.pry', 'debugger' and diff artifacts and stops the commit if it finds any.
#!/bin/sh
COMMAND='git grep -n --cached'
ARGS='-e debugger -e "binding\.pry" -- app config db spec vendor script lib Rakefile Guardfile Capfile'
if eval "$COMMAND -q $ARGS" ; then
echo "You have a binding.pry or a debugger in a bad place.\n"
eval "$COMMAND $ARGS"
exit 1
fi
@wannabefro
wannabefro / sublimetips.md
Created November 12, 2013 22:00
sublime stuff

Sublime Text Tips & Tricks

Command P || Command T

Press Command + T or Command + P, type in the name of the file you wish to access (fuzzy finder), and, without even pressing Enter, you’ll instantly be transported to that file.

Shift Command P

We can use Sublime’s command palette by accessing the Tools menu, or by pressing Shift + Command + P, on the Mac.

Whether you need to visit a Preferences page, or paste in a snippet, all of that can be accomplished here.

@pdarden
pdarden / SeeingIsBelievingInstruction.md
Last active March 21, 2016 02:23
How to setup SeeingIsBelieving Plugin for Sublime Text/RVM/OS X

Integration of seeing_is_believing to sublime text 2/3 as a plugin with RVM on OS X.

In Terminal

  1. $ rvm 2.0.0@sublime-text-2 --create or for ST-3 $ rvm 2.0.0@sublime-text-3 --create
  2. $ gem install seeing_is_believing
  3. $ cd ~/Library/Application\ Support/Sublime\ Text\ 2/Packages or for ST-3 $ cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages
  4. git clone git://github.com/JoshCheek/sublime-text-2-seeing-is-believing.git SeeingIsBelieving
  5. $ rvm wrapper 2.0.0@sublime-text-2 sublime or for ST-3 $ rvm wrapper 2.0.0@sublime-text-3 sublime
require 'json'
require 'pry'
require 'csv'
require 'open-uri'
def parse_movie_data(data)
JSON.parse(data)
end
def populate_csv(movies, filename)

Inquiries Walkthrough

We're asked to build an application that allows a user to submit inquiries. The user stories come in two parts. In the first part, we create a simple form with text inputs to capture an inquiry. In the second part, we're asked to categorize the inquiries that are submitted.

We will build to the first story and then turn our attention to the second once our tests are passing.

User Stories

Submit an inquiry