Skip to content

Instantly share code, notes, and snippets.

View revans's full-sized avatar
🤠
Building Empires

Robert Evans revans

🤠
Building Empires
View GitHub Profile
module AppSettings
class Railtie < Rails::Railtie
config.settings = ::ActiveSupport::OrderedOptions.new
end
end
module TestMethodAlternatives
def testing(description, &block)
formatted_desc = description.gsub(/\s+/, '_').gsub(/\W+/, '')
define_method("test_#{formatted_desc}") do
if block_given?
instance_eval(&block)
else
instance_eval do
skip("test_#{formatted_desc}")
@revans
revans / git-merge-since.sh
Created February 12, 2014 20:25
Search the git log from a specific point in time for merge commits from one specific branch into another.
#!/bin/bash
#
# by: Robert Evans
#
# Git Merge Since Search
#
# I needed to be able to search git history looking for all merge commits from
# a specific repo, into another specific repo, starting at a given point in time.
#
# Example:
root(appname) do
mkdir "config"
mkdir "log"
mkdir "test"
touch "Readme.mkd"
template "config.ru", file_or_string
template "config/application.rb", file_or_string
cp "test/test_helper.rb", file_or_string
template "bin/script", file_or_string
@revans
revans / user_script.sh
Last active October 27, 2020 18:16
AWS User Script for getting a server ready for Ruby, Rails, Sinatra, or Rack apps.
#!/usr/bin/env bash
#
# Author: Robert R Evans
#
# Description: AWS Ubuntu 13 Ruby Setup Script
#
# This script will setup a ubuntu box for Ruby, Rails, Sinatra, and/or Rack
# development/staging/production usage. It also installs Nodejs, Nginx, Git,
# Rbenv, and PostgreSQL adapters for using RDMS PostgreSQL. It assumes that
# git-deploy will be used, in place of the traditional capistrano deployments.
module ObjectDiagnostics
extend self
#This is handy when you want to determine what types of objects are contributing to memory bloat
#returns the change in object counts since the last time this method was called
def change_in_object_counts
#this will start all counts at 0 for the initial run
@previous_counts ||= Hash.new(0)
@revans
revans / github_releases.rb
Created November 1, 2013 18:07
Get the latest releae
require 'net/https'
require 'json'
require 'uri'
module MightyOctocat
class Releases
attr_reader :owner, :repo
# ==== Arguments
#
@revans
revans / git-pr
Last active December 26, 2015 03:39
Git Extension for easily pulling down specific Pull Requests from github or setting your local repository to access all Pull Requests
#!/bin/bash
set -e
arg=$1
function specific_pull_request() {
echo "Fetching Pull Request '${arg}' from Github..."
git fetch origin pull/$arg/head:pr-$arg
}
# /etc/init/project-web-reload.conf
pre-start script
initctl restart project-web
sleep 15
end script
exec /usr/local/rvm/bin/default_bluepill restart
/****************************/
If coming from the list page
<div class="list-breadcrumb">
Breadcrumb code
</div>
If coming from the spot page