Skip to content

Instantly share code, notes, and snippets.

View rianrainey's full-sized avatar

Rian Rainey rianrainey

View GitHub Profile
rcmoret / vrc
Created September 15, 2016 22:26
Script for opening a rails console for an app within vagrant
#! /bin/bash
if [[ -z $1 ]]; then
APP_NAME=$(basename `pwd`)
echo "Opening Rails Console for $APP_NAME in vagrant..."
cd ~/vagrant && vagrant ssh -c "cd /pub/$APP_NAME/current && bundle exec rails console"
ericelliott /
Last active April 22, 2024 10:15
Essential JavaScript Links
pjrvs / newslettercookie.html
Last active November 7, 2017 09:33
a jquery cookie that shows a signup form for people that aren't signed up and an alternate message for people that came from the list or signed up.
<!DOCTYPE html>
<title>jQuery Cookie + MailChimp</title>
<meta charset="utf-8">
<form action="XXX" method="post" class="signup">
SabretWoW / rspec_model_testing_template.rb
Last active March 7, 2024 03:56
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
# @kyletcarlson
# This skeleton also assumes you're using the following gems:
mfilej / db_terminate_backend.rake
Created July 7, 2013 11:02
Rake task to terminate idle postgresql connections that prevent a database to be dropped
namespace :db do
desc "Fix 'database is being accessed by other users'"
task :terminate => :environment do
ActiveRecord::Base.connection.execute <<-SQL
wnstn / beautiful.scss
Last active December 19, 2015 06:29
I love you Sass
.feed-section-header {
margin: 0;
font-size: 1.1em;
$groups: community $community \70, teams $teams \72, college $college \71, for-you $gray \6b;
@each $group in $groups {
&.#{nth($group, 1)} {
color: #{nth($group, 2)};
.feed-icon {
dcalhoun /
Last active December 18, 2015 14:28
Centresource Pattern Library List

Centresource Pattern Library Guide

Below are elements that are expected to be in a Photoshop pattern library file.


  • Headers (h1 - h5)
  • Paragraphs
  • Lead Copy
  • Unordered List
bval / .htrouter.php
Created February 19, 2013 21:33
This is a router for Drupal and other PHP apps that rely on mod_rewrite rules for "clean URLs" so that those same apps can be run under PHP 5.4's built-in webserver which doesn't support mod_rewrite.
* @file
* The router.php for clean-urls when use PHP 5.4.0 built in webserver.
* Usage:
* php -S localhost:3000 .htrouter.php
MohamedAlaa / tmux-cheatsheet.markdown
Last active April 23, 2024 15:29
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:


start new with session name:

tmux new -s myname
nordyke / MultiSortCollection.js
Created December 27, 2011 15:38
Multi-sort on any number of Backbone Collection attributes. Sort happens from arguments[0] to arguments[n]
var MultiSortCollection = Backbone.Collection.extend({
* Sort by supplied attributes. First param is sorted first, and
* last param is final subsort
* @param {String} sortAttributes
* @example collection.sortBy("last_name","first_name")
sortBy : function(sortAttributes){
var attributes = arguments;