Skip to content

Instantly share code, notes, and snippets.

Avatar

Matthew McFarling mtmcfarl

View GitHub Profile
@mtmcfarl
mtmcfarl / rbenv-ruby187-highsierra.sh
Created Jun 21, 2018 — forked from yatsu/rbenv-ruby187-macos.sh
Install ruby-1.8.7 with rbenv on macOS High Sierra (10.13)
View rbenv-ruby187-highsierra.sh
#!/bin/sh
# 1) Install HomeBrew
# 2) brew install openssl gcc@4.9 rbenv
# 3) Setup rbenv
CC=gcc-4.9 \
CFLAGS="-O2 -fno-tree-dce -fno-optimize-sibling-calls -I$(brew --prefix openssl)/include" \
LDFLAGS="-L$(brew --prefix openssl)/lib" \
rbenv install 1.8.7-p375
@mtmcfarl
mtmcfarl / clean-up-boot-partition-ubuntu.md
Created Apr 27, 2018 — forked from ipbastola/clean-up-boot-partition-ubuntu.md
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64
View clean-up-boot-partition-ubuntu.md

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r 
@mtmcfarl
mtmcfarl / unicorn.conf
Created Oct 17, 2015 — forked from witscher/unicorn.conf
Upstart script for unicorn, bundler and a user contained rvm installation
View unicorn.conf
description "Unicorn"
# starting unicorn with bundler, and a user contained rvm:
start on filesystem or runlevel [2345]
stop on runlevel [!2345]
chdir /path/to/current
@mtmcfarl
mtmcfarl / hookable.rb
Last active Aug 29, 2015
Example of a web hook
View hookable.rb
module Hookable
extend ActiveSupport::Concern
def perform_post
end
end
View gist:7165145
<div class="row">
<%= form_tag("/contact", method: "post") do %>
<label class="control-label">First Name</label>
<input type="text" name="contact[first_name]" />
<label class="control-label">Last Name</label>
<input type="text" name="contact[last_name]" />
<label class="control-label">Company Name</label>
View gist:7165099
Contact Request
===============
Here's what they had to say:
Name: <%= @contact[:first_name] %> <%= @contact[:last_name]%>
Company: <%= @contact[:company] %>
Email: <%= @contact[:email] %>
Phone: <%= @contact[:phone] %>
View gist:7165087
class ContactFormMailer < ActionMailer::Base
def contact_request(contact)
@contact = contact
from_addr = "#{@contact[:first_name]} #{@contact[:last_name]} <#{@contact[:email]}>"
mail(to: "your-email-address@your-domain.com", from: from_addr, subject: 'Contact Form Request')
end
end
View gist:7165077
class ContactsController < ApplicationController
def create
ContactFormMailer.contact_request(contact_params).deliver
render action: :thanks
end
protected
def contact_params
params[:contact].permit!
View gist:6879800
0 INFO [main] utilities.LoggingSetup - {java.runtime.name=Java(TM) SE Runtime Environment, sun.boot.library.path=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Libraries, java.vm.version=20.51-b01-457, awt.nativeDoubleBuffering=true, gopherProxySet=false, mrj.build=11M4509, java.vm.vendor=Apple Inc., java.vendor.url=http://www.apple.com/, path.separator=:, java.vm.name=Java HotSpot(TM) 64-Bit Server VM, file.encoding.pkg=sun.io, sun.java.launcher=SUN_STANDARD, user.country=US, sun.os.patch.level=unknown, java.vm.specification.name=Java Virtual Machine Specification, user.dir=/Volumes, java.runtime.version=1.6.0_51-b11-457-11M4509, java.awt.graphicsenv=apple.awt.CGraphicsEnvironment, java.endorsed.dirs=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/endorsed, os.arch=x86_64, java.io.tmpdir=/var/folders/34/qn5pdvbj5m39fwr_tj11ptkm0000gn/T/, line.separator=
, java.vm.specification.vendor=Sun Microsystems Inc., os.name=Mac OS X, sun.jnu.encoding=MacRoman, java.library.path=.
View vendor_contact_presenter.rb
class VendorContactPresenter < BasePresenter
def initialize(contact)
@contact = contact
end
def full_name
"#{@contact.first_name} #{@contact.last_name}"
end
def email