Skip to content

Instantly share code, notes, and snippets.

View craigmartin's full-sized avatar

Craig Martin craigmartin

  • Glee Machine, LLC.
  • Portland OR
View GitHub Profile
@craigmartin
craigmartin / keybase.md
Created May 25, 2017 21:10
keybase proof

Keybase proof

I hereby claim:

  • I am craigmartin on github.
  • I am craigmartin (https://keybase.io/craigmartin) on keybase.
  • I have a public key ASAdinWSTtGU3CfTn3yrihtJuu-pc_wPjWWM_0Rgerlgigo

To claim this, I am signing this object:

# Find the IAM username belonging to the TARGET_ACCESS_KEY
# Useful for finding IAM user corresponding to a compromised AWS credential
# Requirements:
#
# Environmental variables:
# AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
# python:
# boto
@craigmartin
craigmartin / gist:5015607
Last active December 14, 2015 02:39
a general default shell script to start a play app
#!/bin/sh
#
### BEGIN INIT INFO
# Provides: play app
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: play web application
# Description: Controls web application written with Play! framework
@craigmartin
craigmartin / Rails 2.3 to 3.2 upgrade
Created August 15, 2012 00:05
My notes on Rails 2.3 to 3.2 upgrades - with client specific notes
List of steps I take to upgrade an app from Rails 2.3 to 3.2 (generically speaking with many assumptions)
Step 1 - Add Bundler and a Gemfile to existing Rails 2.3 application.
- by-product = clean up gems being used.
Step 2 -
@craigmartin
craigmartin / about.md
Created January 11, 2012 23:08 — forked from blaix/about.md
Programming Achievements: How to Level Up as a Developer

Programming Achievements: How to Level Up as a Developer

  1. Select a particular experience to pursue.
  2. Pursue that experience to completion. (Achievement unlocked!)
  3. Reflect on that experience. Really soak it in. Maybe a blog post would be in order?
  4. Return to Step 1, this time selecting a new experience.

This gist is a fork of the gist from this blog post.

@craigmartin
craigmartin / validateLinks.html
Created August 9, 2011 10:17
HTML file for the jQuery plugin for Question #6
@craigmartin
craigmartin / example_monsoc.rb
Created August 5, 2011 23:02
example sinatra app building web services for social networking services to connect to several other apps - this is the base app, I have been refactoring it, so it may be broken.
require 'rubygems'
gem 'rest-client', '=1.6.1'
%w(./config haml sinatra digest/md5 rack-flash json rest-client ./models).each { |lib| require lib}
set :sessions, true
set :show_exceptions, false
set :environment, :development
use Rack::Flash
get "/" do
if session[:userid].nil? then
@craigmartin
craigmartin / example_model.rb
Created August 5, 2011 22:59
this is an example model I was working on using DataMapper -- needs a serious refactor and is probably broken in spots. connects to monsoc.rb
%w(dm-core dm-timestamps dm-validations dm-aggregates).each {|lib| gem lib, '=1.0.2'}
%w(dm-core dm-timestamps dm-validations dm-aggregates dm-migrate RMagick aws config).each { |lib| require lib}
include Magick
DataMapper.setup(:default, ENV['DATABASE_URL'] || 'mysql://root:fa1556cm@localhost/monsoc')
S3 = Aws::S3Interface.new(S3_CONFIG['AWS_ACCESS_KEY'], S3_CONFIG['AWS_SECRET_KEY'], {:multi_thread => true, :protocol => 'http', :port => 80} )
module Commentable
def people_who_likes
self.likes.collect { |l| "<a href='/user/#{l.user.nickname}'>#{l.user.formatted_name}</a>" }
@craigmartin
craigmartin / validateLinks.js
Created August 2, 2011 19:42
jQuery plugin for #6
@craigmartin
craigmartin / answer #4
Created August 2, 2011 19:26
Controller before_filter
class HomeController < ApplicationController
# use code block as filter
before_filter do |controller|
controller.send(:intruder?) # call intruder? method in the controller
# ...
end
def intruder?
# ...
end