Skip to content

Instantly share code, notes, and snippets.

@kevingessner
kevingessner / gist:9509148
Last active April 27, 2023 15:45
Responsive emails that really work -- From Etsy's Code As Craft blog: http://codeascraft.com/2014/03/13/responsive-emails-that-really-work
<html>
<head>
<style type="text/css">
table table {
width: 600px !important;
}
table div + div { /* main content */
width: 65%;
float: left;
}
@kneath
kneath / growth.md
Last active November 12, 2018 06:33
Growth position

Hack on github.com with me

Thanks everyone! I've got enough leads for the time being.

@jgv
jgv / pictures.rb
Created January 25, 2013 22:03
Populate a database with data from Factory Girl.
FactoryGirl.define do
factory :picture do
image { File.open(File.join(Rails.root, 'spec', 'support', 'pictures', 'spec.png')) }
end
end
@mchail
mchail / Gemfile
Last active October 13, 2015 02:37
Zapier Webhooks in Rails with Resque
gem "resque", :require => 'resque/server'
gem 'resque-history'
@roberto
roberto / _flash_messages.html.erb
Created August 13, 2012 22:47
Rails flash messages using Twitter Bootstrap
<% flash.each do |type, message| %>
<div class="alert <%= bootstrap_class_for(type) %> fade in">
<button class="close" data-dismiss="alert">×</button>
<%= message %>
</div>
<% end %>
@peterc
peterc / dnsd.rb
Created December 2, 2011 23:47
Simple, scrappy UDP DNS server in Ruby (with protocol annotations)
# Simple, scrappy UDP DNS server in Ruby (with protocol annotations)
# By Peter Cooper
#
# MIT license
#
# * Not advised to use in your production environment! ;-)
# * Requires Ruby 1.9
# * Supports A and CNAME records
# * See http://www.ietf.org/rfc/rfc1035.txt for protocol guidance
# * All records get the same TTL
@denmarkin
denmarkin / application_helper.rb
Created October 14, 2011 08:17
Shared errors for multiple targets (when you need render errors for a form containing nested or unlinked )
def collect_shared_error_messages(target)
targets = []
error_messages = []
if target.kind_of?(Array)
target.collect {|t| targets << t}
else
targets << target
end
targets.each do |target|
target.errors.full_messages.collect {|msg| error_messages << msg} if target.errors.any?