Skip to content

Instantly share code, notes, and snippets.

View joshkraemer's full-sized avatar

Josh Kraemer joshkraemer

  • @lumerit
  • San Antonio, TX
View GitHub Profile
@DeRain
DeRain / example.sh
Created November 27, 2017 16:55
Generate .env file from AWS Parameters Store
#Add ENV strings into AWS Parameter Store (as one parameter). All strings will be separated by the newline
#We are getting ENV string separated by the newline and pub them in the dotenv
aws ssm get-parameter --name Param-with-env --region eu-west-1 --query Parameter.Value | sed -e 's/^"//' -e 's/"$//' | awk '{gsub(/\\n/,"\n")}1' >> .env
@jeffreyjurgajtis
jeffreyjurgajtis / git_workflow.md
Last active January 3, 2016 15:19
Avoid merge commits
Updating your local master with origin/master

$ git checkout master
$ git fetch --all --prune
$ git rebase origin/master

Updating your feature branch with your local master

$ git checkout my-feature-branch
$ git rebase master

@mdespuits
mdespuits / basic_postgres_setup.sh
Created May 15, 2012 16:50
mac os x postgres install (homebrew option)
# Access tty to ask for confirmation even if we're in a pipe (thanks Pow)
TTY="/dev/$( ps -p$$ -o tty | tail -1 | awk '{print$1}' )"
read -p "*** Do you want to reinstall the 'pg' gem [y/n]?" REINSTALL_PG < $TTY
if [[ $REINSTALL_PG == "y" ]]; then
gem uninstall pg
gem install pg
fi
# Ask if the user wants to setup the db with a 'root' superuser?
@gonzedge
gonzedge / application_controller.rb
Created January 5, 2012 02:34
Rails 3.1 - Adding custom 404 and 500 error pages
class ApplicationController < ActionController::Base
# ...
unless Rails.application.config.consider_all_requests_local
rescue_from Exception, with: lambda { |exception| render_error 500, exception }
rescue_from ActionController::RoutingError, ActionController::UnknownController, ::AbstractController::ActionNotFound, ActiveRecord::RecordNotFound, with: lambda { |exception| render_error 404, exception }
end
private
def render_error(status, exception)
@calebwoods
calebwoods / gist:1254706
Created September 30, 2011 19:13
MySQL Issue RVM: Run this command from terminal to fix the mysql2 issues with rvm. Assumes the gem is installed in the global gemset.
sudo install_name_tool -change libmysqlclient.18.dylib /usr/local/mysql/lib/libmysqlclient.18.dylib ~/.rvm/gems/ruby-1.9.3-p0@global/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle
@kathgironpe
kathgironpe / precompile_assets.textile
Created July 7, 2011 16:55
Rails 3.1: Precompile Assets for Cloudfront/CDN support

Naming files and using asset_path

application.scss.erb
- use <%= asset_path 'background.jpg' %>

on config/environments/production.rb

@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active March 8, 2024 02:11
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh