Skip to content

Instantly share code, notes, and snippets.

View abutler3's full-sized avatar

Andrew Butler abutler3

  • Solider of Fortune, Member of The A Team, nephew of B.A. Baracus
  • Nashville, TN
View GitHub Profile
<?php
$src = 'http://player.vimeo.com/video/1234';
preg_match('!video\/([0-9]+)!i', $src, $match);
$id = $match[1];
$apiurl = 'http://vimeo.com/api/v2/video/' . $id . '.json';
$response = file_get_contents($apiurl);
$json = json_decode($response, true);
@jackii
jackii / gist:3722043
Created September 14, 2012 13:53 — forked from mark-ellul/gist:3531320
Email Boilerplate as HAML with yield to use as layout in Rails actionmailer
!!! Strict
%html{:xmlns => "http://www.w3.org/1999/xhtml"}
%head
%meta{:content => "text/html; charset=utf-8", "http-equiv" => "Content-Type"}/
%meta{:content => "width=device-width, initial-scale=1.0", :name => "viewport"}/
%title Your Message Subject or Title
:css
/* Based on The MailChimp Reset INLINE: Yes. */
/* Client-specific Styles */
#outlook a {padding:0;} /* Force Outlook to provide a "view in browser" menu link. */
@robertjwhitney
robertjwhitney / film.rb
Created April 22, 2012 23:45
Conditionally display an image instead of the file input in an ActiveAdmin has_many association.
# active_admin and formtastic seem kinda picky about displaying both the
# image and the file input together here... in fact, it seems like this
# is the ONLY way to do this? Adding anything else after the image_tag squashes it.
ActiveAdmin.register Film do
form do |f|
f.inputs "Film" do
f.input :title
end
f.has_many :stills do |film_still_form|