Skip to content

Instantly share code, notes, and snippets.

View mattbrictson's full-sized avatar

Matt Brictson mattbrictson

View GitHub Profile
@mattbrictson
mattbrictson / Gemfile
Created August 21, 2011 17:53
Configuring rails 3.1 and dragonfly to use Herkou and Amazon CloudFront
gem 'dragonfly', '~>0.9.4'
group :production do
gem 'fog' # for Amazon S3
end
@mattbrictson
mattbrictson / Gemfile
Created August 21, 2011 18:35
Setting up clearance gem to use bcrypt on a new project
gem 'bcrypt-ruby', '~> 3.0.0'
gem 'clearance'
@mattbrictson
mattbrictson / 01-first_cut.html
Last active June 17, 2018 23:04
How to Implement Radio Buttons in Wicket
<input type="radio" name="ticker" value="AAPL"/>Apple<br/>
<input type="radio" name="ticker" value="GOOG"/>Google<br/>
<input type="radio" name="ticker" value="MSFT"/>Microsoft<br/>
@mattbrictson
mattbrictson / 01-headers
Created October 29, 2011 00:08
How to Defeat the Browser Back Button Cache
Cache-Control: no-cache, max-age=0, must-revalidate, no-store
@mattbrictson
mattbrictson / 1.9.2-p180
Created December 6, 2011 21:54
Recipe for ruby-build and patch file needed for building ruby-1.9.2-p180 on Ubuntu 11.10
OPENSSL_PATCH=$( cat <<EOF
--- ruby-1.9.2-p180/ext/openssl/ossl_ssl.c 2010-12-23 22:24:00.000000000 -0500
+++ ruby-1.9.2-p180/ext/openssl/ossl_ssl_fixed.c 2011-10-28 11:39:30.265970001 -0400
@@ -107,9 +107,9 @@
OSSL_SSL_METHOD_ENTRY(TLSv1),
OSSL_SSL_METHOD_ENTRY(TLSv1_server),
OSSL_SSL_METHOD_ENTRY(TLSv1_client),
- OSSL_SSL_METHOD_ENTRY(SSLv2),
- OSSL_SSL_METHOD_ENTRY(SSLv2_server),
- OSSL_SSL_METHOD_ENTRY(SSLv2_client),
@mattbrictson
mattbrictson / .bashrc
Last active October 26, 2015 07:28
"r" shortcut in bash for "rails" and "rake"
# Shortcut for `bundle exec rails` and `bundle exec rake`.
# If bin/rails and bin/rake are available, use them instead as they are much
# faster to execute than `bundle exec`.
function r() {
if [[ "g|generate|c|console|s|server|db|dbconsole|r|runner|new" =~ $1 ]]; then
if [ -x bin/rails ]; then
bin/rails "$@"
elif [ -x script/rails ]; then
script/rails "$@"
else
@mattbrictson
mattbrictson / gist:1566248
Created January 5, 2012 17:27
Vendorfile for fetching all jQuery UI components
# Vendorfile for use with vendorer command. https://github.com/grosser/vendorer
# Run `vendorer` to install jQuery and jQuery UI dependencies into vendor/assets/javascripts.
JQUERY_VER = "1.7.1"
JQUERY_UI_VER = "1.8.16"
# Helper methods to extend vendorer functionality #
###################################################
@mattbrictson
mattbrictson / connection.rb
Created January 24, 2012 22:59
Ruby 1.9.2 vs 1.9.3, gotcha with Struct.new and constant scope
# Define a simple class with a DEBUG constant
#
Connection = Struct.new(:name, :state) do
DEBUG = false
def self.debug?
DEBUG
end
end
# A quick sanity check
@mattbrictson
mattbrictson / gist:1679652
Created January 25, 2012 23:28
SimpleCDN installation
public class MyApplication extends WebApplication
{
@Override
protected void init()
{
super.init();
// Enable CDN when in deployment mode
if(usesDeploymentConfig())
{
new SimpleCDN("//age39p8hg23.cloudfront.net").install(this);
@mattbrictson
mattbrictson / Gemfile
Created January 26, 2012 23:02
Install Compass in Rails 3.1/3.2
group :assets do
gem 'compass-rails','~> 1.0.0.rc.2'
gem 'compass-colors'
gem 'sassy-buttons'
gem 'sass-rails', '~> 3.2.3'
# non-compass gems omitted for brevity
end