Skip to content

Instantly share code, notes, and snippets.

@stevenhaddox
stevenhaddox / cacert.md
Created April 3, 2014 04:52
cacert.org setup of root certificate chain for custom OpenSSL source install

Looks like the OpenSSL conf (~/opt/stow/openssl-1.0.1c/ssl/openssl.cnf) has a setting for:

certs		= $dir/cacert.pem	# Certificate chain to include in reply
					# (optional)

As a result:

@stevenhaddox
stevenhaddox / README.md
Created November 4, 2014 15:48
bl.ocks.org test

bl.ocks.org Fun

Woot!

@stevenhaddox
stevenhaddox / Capfile
Last active August 29, 2015 14:11 — forked from davidlfox/Capfile
require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/rvm'
require 'capistrano/rails'
require "capistrano-resque"
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }
@stevenhaddox
stevenhaddox / Image.rb
Created May 29, 2009 19:47
Paperclip Polymorphism Issue
class Image < ActiveRecord::Base
# associations
belongs_to :image_attachment, :polymorphic => true
# virtual attributes
attr_accessor :image_styles
def after_initialize
self.image_styles=(set_image_styles)
# set an obvious fake to test param passing works
# File permissions
run "chmod 755 ."
%w(public log tmp).each do |dir|
run "chmod -R 755 #{dir}"
end
# Remove unnecessary files
%w(README public/index.html public/favicon.ico public/robots.txt).each do |file|
run "rm #{file}"
module Notable
def self.included(base)
base.has_many :notes, :as => :notable
base.accepts_nested_attributes_for :notes
end
end
class User < ActiveRecord::Base
include Notable
end
export RUBY_HEAP_MIN_SLOTS=1000000
export RUBY_HEAP_SLOTS_INCREMENT=250000
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
export RUBY_GC_MALLOC_LIMIT=100000000
export RUBY_HEAP_FREE_MIN=1000000
require "rubygems"
require 'directory_watcher'
commands = [
{ :tell => "Firefox", :to => "activate" },
{ :tell => "System Events", :to => "keystroke \"1\" using command down" },
{ :tell => "System Events", :to => "keystroke \"r\" using command down" },
{ :tell => "TextMate", :to => "activate" }
]
This is an example of using RVM's Project .rvmrc file
to have it automatically bootstrap your environment, including bundler.
This could be further expanded to do anything you require :)
The important thing to remember is that the purpose of these files is
to allow you to very easily have your 'project context' (aka 'environment')
loaded automatically for you when you enter the project in the shell (cd).
def _authenticate_oauth_echo
require 'httparty'
# header auth only for now; also lock down the auth provider endpoint so we can't spoof
if(request.env["HTTP_X_AUTH_SERVICE_PROVIDER"] != 'https://api.twitter.com/1/account/verify_credentials.json' || request.env["HTTP_X_AUTH_SERVICE_PROVIDER"].blank?)
return false
else
auth_service_provider = request.env["HTTP_X_AUTH_SERVICE_PROVIDER"]
verify_credentials_authorization = request.env["HTTP_X_VERIFY_CREDENTIALS_AUTHORIZATION"]
end