Skip to content

Instantly share code, notes, and snippets.

@mm53bar
mm53bar / image_caption.css
Created August 13, 2009 22:02
Could be the beginnings of a nice image plugin for wordpress that makes it easy to add images with nice CC refs.
/* from http://s3.wordpress.com/wp-content/themes/pub/depo-masthead/style.css */
.wp-caption {
border: 1px solid #ddd;
text-align: center;
background-color: #f3f3f3;
padding-top: 4px;
-moz-border-radius: 3px;
-khtml-border-radius: 3px;
-webkit-border-radius: 3px;
@mm53bar
mm53bar / _form.html.erb
Created October 22, 2009 19:56
A Contact has many Positions, each Position has a Company. When adding a Contact, I want to allow the user to enter a Position#title and Company#name. The Company#name should come from the list of Companies that the User has already set up. I'm using P
<% form_for setup_contact(@contact), :html => { :multipart => true } do |contact_form| -%>
<p>
<%= contact_form.label :first_name %><br />
<%= contact_form.text_field :first_name %>
</p>
<p>
<%= contact_form.label :last_name %><br />
<%= contact_form.text_field :last_name %>
</p>
.DS_Store
*.csv
*.pdf
@mm53bar
mm53bar / application_controller.rb
Created December 23, 2010 20:31
Code to roll your own authentication!
class ApplicationController < ActionController::Base
include AuthenticateUser
before_filter :authenticate_user!
end
@mm53bar
mm53bar / application.css.scss
Created August 25, 2011 01:11
My rails 3.1 application.css file with references to bourbon and flutie
$gw-column: 58px; // Column Width
$gw-gutter: 24px; // Gutter Width
@import 'bourbon';
@import 'flutie';
@import 'theme';
@import 'layout';
@import 'extensions/compass';
@mm53bar
mm53bar / nginx.erb
Created October 1, 2011 17:45
nginx vhost file that I use in sprinkles recipe
upstream app_server {
server unix:/var/applications/<%= APP_NAME %>/current/tmp/sockets/unicorn.sock fail_timeout=0;
}
server {
listen 80;
server_name www.<%= HOST %>;
rewrite ^/(.*) http://<%= HOST %>/$1 permanent;
}
@mm53bar
mm53bar / deploy.rb
Created October 7, 2011 21:05
My capistrano deployment
require File.join(File.dirname(__FILE__), 'deploy/nginx')
require File.join(File.dirname(__FILE__), 'deploy/log')
default_run_options[:pty] = true
set :ssh_options, { :forward_agent => true }
set :application, "appname"
set :repository, "git@giturl"
set :scm, :git
@mm53bar
mm53bar / routes.rb
Created October 9, 2011 21:29
Voting code from filter
match "/upvote/:posting_id/:candidate_id" => "votes#upvote", :as => :upvotes
@mm53bar
mm53bar / nginx_rails_3_1
Created October 16, 2011 16:10 — forked from shapeshed/nginx_rails_3_1
Nginx Config for Rails 3.1 with Unicorn and Asset Pipeline
upstream app {
server unix:/srv/app/current/tmp/sockets/unicorn.sock fail_timeout=0;
}
server {
listen 80;
server_name www.app.com;
rewrite ^/(.*) http://app.com/$1 permanent;
}
server {
@mm53bar
mm53bar / molly.sh
Last active September 27, 2015 19:38
Molly - a quick little bash script to clean out your downloads and trash occasionally.
#!/bin/bash
# Installation:
#
# Clone Molly & add her to your crontab
#
# mkdir -p $HOME/bin && cd $HOME/bin && git clone git://gist.github.com/1321407.git molly
# cat <(crontab -l) <(echo "0 * * * * $HOME/bin/molly/molly.sh >/dev/null 2>&1") | crontab -
#
# Note: the /dev/null piece in the crontab just ensures that crontab won't send an email.