Skip to content

Instantly share code, notes, and snippets.

View afair's full-sized avatar

Allen Fair afair

View GitHub Profile
@afair
afair / brew-install-php53.sh
Last active January 27, 2017 12:07
Install PHP 5.3 on Apache 2.4 on OS X 10.10 Yosemite
#!/bin/sh
brew tap homebrew/dupes
brew install zlib
brew tap homebrew/php
brew install php53 --with-pgsql
# Troubleshooting...
#% php -v ~/src/guacamole
#dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.54.dylib
@afair
afair / nokogiri-freebsd-install.sh
Created December 5, 2014 16:11
Install Nokogiri on FreeBSD
#!/bin/sh
gem install nokogiri -- \
--use-system-libraries \
--with-xml2-lib=/usr/local/lib \
--with-xml2-include=/usr/local/include/libxml2/libxml \
--with-xslt-lib=/usr/local/lib \
--with-xslt-include=/usr/local/include/libxslt \
--with-iconv-lib=/usr/local/lib \
--with-iconv-include=/usr/local/include
@afair
afair / rubyref.rb
Last active August 29, 2015 14:04
Ruby Reference by Examples
module MyModule
def module_method
end
end
class RubyRef < BaseClass
include MyModule
attr_reader :a
attr_writer :b
attr_accessor :c
@afair
afair / straight-up-rspec-3.rb
Last active August 29, 2015 14:04
Notes from: Straight Up RSpec 3 - a neat Ruby BDD Tool
################################################################################
# Notes from: Straight Up RSpec 3 - a neat Ruby BDD Tool
#-------------------------------------------------------------------------------
# From: http://www.slideshare.net/gsterndale/straight-up-rspec-3
# By: Greg Sterndale
################################################################################
# .rspec
# lib/…
# spec/spec_helper.rb
@afair
afair / http-rest-api-notes.md
Created May 13, 2014 19:13
REST, HTTP, JSON-API Protocol Notes

REST, HTTP, JSON-API Protocol Notes

Resources (URL):

Collection of Data Objects

  • /dataname (logical viewname (preferred), record name, table name)
  • /parent/id/children

Data Object

Keybase proof

I hereby claim:

  • I am afair on github.
  • I am allenfair (https://keybase.io/allenfair) on keybase.
  • I have a public key whose fingerprint is F00B 3ED2 5CE8 F9AF 3D4A 55D9 1651 1D53 10AE 1388

To claim this, I am signing this object:

@afair
afair / gist:9648839
Created March 19, 2014 19:01
Factory Girl Basics
FactoryGirl.define do
factory :user do # class:User, aliases:[:name1, :name2]
name "Ruby"
date_of_birth { 21.years.ago } # Blocked called lazily at request time
association_factory_name
association :commenter, factory: :user, attrib:"value"
factory(:admin_user) do # Inheritance
admin true
end
@afair
afair / JsonMessages.js
Last active December 21, 2015 01:09
JSON Messages - From a Philly.rb lightning talk I gave on August 13, 2013.
var talk = {
title: "JSON Messaging: From REST and Beyond",
by: { name: "Allen Fair",
twitter: "@allenfair" },
event: { organization: "Philly.rb",
when: "August 12, 2013 23:00 UDT",
style: "☇ Lightning" },
@afair
afair / curl reference.md
Last active February 11, 2024 05:54
Curl command reference with most used options. No overwhelming man page.

Curl Reference

Use the curl command line tool from your terminal window to access web pages, resources, and API's. This swiss-army knife of the internet also supports many more protocols and tools.

Command format

curl [options] URL

The complete, offical reference page is here.

@afair
afair / RotateNumber.vim
Created November 26, 2012 16:52
Rotates vim line number setting from [On -> Relative -> Off], set to <Leader>n
" vimscript function to rotate line number setting from [On -> Relative -> Off], set to <Leader>n
" Author: Allen Fair, 2012
" License: Public Domain
function RotateNumber()
if &l:number
let &l:number=0
let &l:relativenumber=1
echom "Line Numbers"
elseif &l:relativenumber