Skip to content

Instantly share code, notes, and snippets.

View johnmeehan's full-sized avatar
:octocat:

John Meehan johnmeehan

:octocat:
  • Meetyl
  • Ireland
View GitHub Profile
@johnmeehan
johnmeehan / tmux_setup.sh
Created January 30, 2014 20:01
Tmux - Rails - MongoDB set up shell script
#!/bin/sh
# John Meehan 2013
#
# DESCRIPTION:
# Setups up tmux, Rails server and MongoDB
# USEAGE:
# Put this script within the main directory of a Rails App
# Call ./tmux_setup.sh to run
@johnmeehan
johnmeehan / irb Rake Task
Created November 17, 2014 22:18
Rake task to open an irb console for a gem you are developing
# John Meehan
# Rake Task for gem dev
# handy for opening a irb console for debugging Ruby Gems in development.
# just put this rake task into your rake file
#
desc "Open an irb console with this gems library"
task :console do
sh "irb -rubygems -I lib -r MyGemNameHere.rb"
end
@johnmeehan
johnmeehan / tail_and_grep
Created November 20, 2014 22:29
Tail a file and grep for specific word/pattern
tail -f file.log | grep "foobar"
@johnmeehan
johnmeehan / basic_rails_template.rb
Last active August 29, 2015 14:11
A basic Rails Application Template- Haml-Rspec-Capybara-Guard-Livereload-Bootstrap-FactoryGirl
# require 'pry'; binding.pry
# Rails Project Template
# Run with:
# rails new MyApp -T -m http://.............
# John Meehan 2015
# Set the ruby version to that of the RVM
insert_into_file('Gemfile', "ruby '#{RUBY_VERSION}'\n", :before => /^ *gem 'rails'/, :force => false)
# Set the Gemset name based on the Rails app name
insert_into_file('Gemfile', "#ruby-gemset=#{@app_name}\n", :before => /^ *gem 'rails'/, :force => false)
@johnmeehan
johnmeehan / sublimetext3_terminal_link.sh
Last active August 29, 2015 14:11
Open Sublime Text 3 from Terminal in OSX Yosemite
@johnmeehan
johnmeehan / fresh_ubuntu_setup.sh
Last active August 29, 2015 14:11
Sets up: Ubuntu, RVM, VIM, Rails, Nodejs, jslint, GIT, Chrome, Heroku
#!/bin/bash
# This script is designed for Ubuntu 12.04
# Should mostly work on 11.10 except Heroku install but not tested
# run with . <filename>.sh
# Get password to be used with sudo commands
# Script still requires password entry during rvm and heroku installs
echo -n "Enter password to be used for sudo commands:"
read -s password
HTTP_STATUS_CODES = {
100 => 'Continue',
101 => 'Switching Protocols',
102 => 'Processing',
200 => 'OK',
201 => 'Created',
202 => 'Accepted',
203 => 'Non-Authoritative Information',
204 => 'No Content',
205 => 'Reset Content',
@johnmeehan
johnmeehan / copy_ssh_public_key.sh
Created December 22, 2014 23:48
Copy ssh key to clipboard from command line
#!/bin/bash
cat ~/.ssh/id_rsa.pub | pbcopy
@johnmeehan
johnmeehan / Image_downloader.rb
Created March 9, 2015 16:50
Save 100 simularly named images stored remotely
require 'nokogiri'
require 'open-uri'
require 'net/http'
require 'uri'
###
# Purpose:
# Needed to save 100 simularly named images stored remotely
# Result: Saves 100 png to the local ./icons/ folder
###
@johnmeehan
johnmeehan / basic_rails_setup.rb
Last active May 1, 2018 21:49
Basic Rails Setup (template)
# Rails Project Template
# Run with:
# rails new MyApp -T -m http://.............
# John Meehan 2016,2018
# Set the ruby version to that of the RVM
def set_ruby_version
insert_into_file('Gemfile', "ruby '#{RUBY_VERSION}'\n", :before => /^ *gem 'rails'/, :force => false)
# Set the Gemset name based on the Rails app name
insert_into_file('Gemfile', "#ruby-gemset=#{@app_name}\n", :before => /^ *gem 'rails'/, :force => false)