Skip to content

Instantly share code, notes, and snippets.

View dleavitt's full-sized avatar

Daniel Leavitt dleavitt

  • Allumia
  • Seattle, WA
View GitHub Profile
@dleavitt
dleavitt / image_processors.rb
Created June 4, 2013 01:01
Additional image processors for carrierwave+minimagick
module CarrierWave
module MiniMagick
module ImageProcessors
def store_dimensions(property_name)
# TODO: deal with default version
image = ::MiniMagick::Image.open(current_path)
model.send("#{property_name}=", {}) unless model.send(property_name)
ver = (version_name || "original").to_s
model.send(property_name)[ver] = image["dimensions"]
end
@dleavitt
dleavitt / changelog.rake
Created May 4, 2013 20:38
Rake task for generating a change log based on git tags
desc "Outputs a change log based on git tags"
task :changelog do
tags = Dir['.git/refs/tags/*'].each.with_object({}) do |path, hsh|
hsh[File.basename(path)] = File.read(path).chomp
end
tag_outputs = []
tags.reduce(nil) do |(_, commit1), (name, commit2)|
tag_date = `git log -1 --format="%ci" #{commit2}`.chomp
lines = [ "## #{name} - #{tag_date}\n" ]
<style type="text/css" media="screen">
.field_with_errors + .label_text {
color: red;
}
</style>
<div>
<%= f.label :terms_levis do %>
<%= f.check_box :terms_levis, :class => "checkbox" %>
<span class="label_text">I accept <a href="#" target="_blank">the terms for Levi's Fantasy Election Weekly Challenge Sweepstakes</a>.</span>
<% end %>
#!/bin/bash
export PATH=/usr/local/bin:$PATH
linear-gradient(
80 bottom,
rgb(31,79,87) 2%,
rgb(47,89,101) 20%,
rgb(101,147,150) 100%,
rgb(47,89,101) 100%
)
@dleavitt
dleavitt / MCBMD_fonts
Created June 10, 2012 21:16 — forked from jbartine/MCBMD_fonts
MC Benson MD - Fonts, colors, and sizes
GLOBAL
nav - SMG regular; 27, 89, 101; 11 pt
nav header - SMG regular; 255, 255, 255; 16 pt
page heading - SMG regular, 48, 121, 128; 22 pt
paragraph heading - SMG regular, 48, 121, 128; 18 pt
HOME PAGE
→ rvm get head
BASH 3.2.48 required (you have 3.2.48(1)-release)
Could not update RVM, get some help at #rvm IRC channel at freenode servers.
<div class="row clearfix">
<div class="field_with_errors">
<input class="input_text" data-validate="true" id="stream_search_query" name="stream_search[query]" size="30" type="text" value="crucible">
<label for="stream_search_query" class="message">can't be blank</label>
</div>
</div>
@dleavitt
dleavitt / open.xml
Created January 19, 2012 22:32
Open Crossdomain
<cross-domain-policy>
<site-control permitted-cross-domain-policies='master-only'/>
<allow-access-from domain='*'/>
</cross-domain-policy>
@dleavitt
dleavitt / API crossdomain.xml
Created January 19, 2012 22:30
Crossdomain Best Practices
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<!-- at /api/crossdomain.xml -->
<cross-domain-policy>
<allow-access-from domain="*"/>
</cross-domain-policy>