Skip to content

Instantly share code, notes, and snippets.

View rianrainey's full-sized avatar

Rian Rainey rianrainey

View GitHub Profile
@rcmoret
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`)
else
APP_NAME=$1
fi
echo "Opening Rails Console for $APP_NAME in vagrant..."
cd ~/vagrant && vagrant ssh -c "cd /pub/$APP_NAME/current && bundle exec rails console"
@ericelliott
ericelliott / essential-javascript-links.md
Last active November 8, 2024 17:29
Essential JavaScript Links
@pjrvs
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>
<html>
<head>
<title>jQuery Cookie + MailChimp</title>
<meta charset="utf-8">
</head>
<body>
<form action="XXX" method="post" class="signup">
@SabretWoW
SabretWoW / rspec_model_testing_template.rb
Last active September 23, 2024 03:01
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
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
# http://stackoverflow.com/questions/5108876/kill-a-postgresql-session-connection
namespace :db do
desc "Fix 'database is being accessed by other users'"
task :terminate => :environment do
ActiveRecord::Base.connection.execute <<-SQL
SELECT
pg_terminate_backend(pid)
FROM
pg_stat_activity
WHERE
@wnstn
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
dcalhoun / cs-pattern-library.md
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.

Typography

  • Headers (h1 - h5)
  • Paragraphs
  • Lead Copy
  • Unordered List
@bval
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.
<?php
/**
* @file
* The router.php for clean-urls when use PHP 5.4.0 built in webserver.
*
* Usage:
*
* php -S localhost:3000 .htrouter.php
*
*/
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active November 17, 2024 01:28
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@nordyke
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;