Skip to content

Instantly share code, notes, and snippets.

View mtmcfarl's full-sized avatar

Matthew McFarling mtmcfarl

View GitHub Profile
@mtmcfarl
mtmcfarl / rbenv-ruby187-highsierra.sh
Created June 21, 2018 19:31 — forked from yatsu/rbenv-ruby187-macos.sh
Install ruby-1.8.7 with rbenv on macOS High Sierra (10.13)
#!/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 April 27, 2018 14:55 — forked from ipbastola/clean-up-boot-partition-ubuntu.md
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64

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 October 17, 2015 12:38 — forked from witscher/unicorn.conf
Upstart script for unicorn, bundler and a user contained rvm installation
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 August 29, 2015 13:56
Example of a web hook
module Hookable
extend ActiveSupport::Concern
def perform_post
end
end
<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>
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] %>
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
class ContactsController < ApplicationController
def create
ContactFormMailer.contact_request(contact_params).deliver
render action: :thanks
end
protected
def contact_params
params[:contact].permit!
@mtmcfarl
mtmcfarl / gist:6879800
Created October 8, 2013 05:15
appbuilder.log
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=.
class VendorContactPresenter < BasePresenter
def initialize(contact)
@contact = contact
end
def full_name
"#{@contact.first_name} #{@contact.last_name}"
end
def email