Skip to content

Instantly share code, notes, and snippets.

Marcel Morgan mcmorgan

Block or report user

Report or block mcmorgan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View prepare-commit-msg
#!/usr/bin/env ruby
# place in .git/hooks/prepare-commit-msg
branch_name = `git rev-parse --abbrev-ref HEAD`
commit_file = ARGV.first
first_line =, &:readline)
if first_line.strip.empty? && (match = branch_name.match(/(^.*\d+)/i))
mcmorgan / player_connection.rb
Created Apr 22, 2015
Handling WebSocket connections with Rack
View player_connection.rb
require 'pusher'
class PlayerConnection
attr_reader :player, :username, :web_socket, :broadcast_id
def initialize(player:, web_socket:)
@player = player
@web_socket = web_socket
mcmorgan /
Created Dec 5, 2014
Oracle Mac OS X Installer (sqlplus + SDK)
set -e
echo "Extracting..."
View gist:f092ca254fc2d1ec4e13

For a tmux status line as seen in the example image for the wemux project: wemux

The session on the left in the example screen shot uses a patched font from the vim-powerline project. Inconsolata-dz, you beautiful creature.

To duplicate the left status line add the following lines to your ~/tmux.conf

set -g status-left-length 32
set -g status-right-length 150
mcmorgan / force-ar-stdout.rb
Created Sep 19, 2014
Force Queries to be Logged to Standard Out
View force-ar-stdout.rb
ActiveRecord::Base.logger =$stdout)
mcmorgan /
Last active Aug 29, 2015
Fruit Cake Recipe

#Fruit Cake Recipe


  • 1lb Dark Sugar
  • 1lb Anchor Butter
  • 1lb Flour
  • ¼ lb Bread Crumbs
  • 2 grated Nutmeg
  • 2 teaspoon baking powder
View array_of_constants.rb
# Lets say we need to have a list of all our states
# we could do it like this
ON = 'on'
OFF = 'off'
CLOSED = 'closed'
# but adding a new state means adding it in 2 places
# specs and cukes results are stored in JUnit format under test-reports
if (grep 'failures="[^0]"' test-reports/* || grep 'errors="[^0]"' test-reports/*); then
curl -H "Authorization: token MY_TOKEN" --request POST --data '{"state": "failure", "description": "Failed!", "target_url": "${bamboo.buildResultsUrl}"}'${bamboo.repository.revision.number} > /dev/null
curl -H "Authorization: token MY_TOKEN" --request POST --data '{"state": "success", "description": "Success!", "target_url": "${bamboo.buildResultsUrl}"}'${bamboo.repository.revision.number} > /dev/null
mcmorgan / Gemfile
Created Nov 27, 2013 — forked from pcreux/Gemfile
Heroku App Tunning
View Gemfile
group :production do
gem 'unicorn'
# Enable gzip compression on heroku, but don't compress images.
gem 'heroku-deflater'
# Heroku injects it if it's not in there already
gem 'rails_12factor'
View gist:4622372
#!/usr/bin/env bash
# kill all connections to the postgres server
if [ -n "$1" ] ; then
where="where pg_stat_activity.datname = '$1'"
echo "killing all connections to database '$1'"
echo "killing all connections to database"
cat <<-EOF | psql -U postgres -d postgres
You can’t perform that action at this time.