This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If you've ever worked with file uploads in Rails, you've probably realized that Rails | |
# handles uploads with a filesize under 10K differently than files over 10K. | |
# I prefer things to be as similar as possible so I wrote this quick monkey patch. | |
# Drop it in your config/initializers directory and you're off to the races. | |
# | |
# You should also check out Paperclip, acts_as_attachment, file_column, etc. because | |
# they take care of all this business for you. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If you're doing migrations or work on large datasets, | |
# you don't want to do a Record.find(:all).each. | |
# | |
# Why you ask? Well, unless you have gobs of system memory, your system | |
# will be paging like gangbusters when it starts loading the entire db table | |
# into memory as AR objects. | |
# | |
# To use this just drop this file into the /lib dir of your Rails project and | |
# you'll be able to use it in any migration | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Adjust sessions so they work across subdomains | |
# This also will work if your app runs on different TLDs | |
# from: http://szeryf.wordpress.com/2008/01/21/cookie-handling-in-multi-domain-applications-in-ruby-on-rails/ | |
# modified to work with Rails 2.3.0 | |
module ActionControllerExtensions | |
def self.included(base) | |
base::Dispatcher.send :include, DispatcherExtensions | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Begin MailChimp Signup Form --> | |
<!--[if IE]> | |
<style type="text/css" media="screen"> | |
#mc_embed_signup fieldset { | |
position: relative; | |
} | |
#mc_embed_signup legend { | |
position: absolute; | |
top: -1em; | |
left: .2em; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a jQuery monkey-patch that changes all PUT and DELETE requests | |
// into POST requests and sets a "_method" param to the original request method. | |
// | |
// This is a workaround for the fact that some corporate networks and | |
// environments don't allow PUT and DELETE requests. | |
// | |
// This whole thing works because Rails implements the _method hack. | |
(function(){ | |
var ajaxWithoutMethodHack = jQuery.ajax; | |
jQuery.ajax = function( s ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# if this is for a Rails app, drop it in /config/initializers | |
class Module | |
if defined?(:rake_original_const_missing) | |
def const_missing(const) | |
rake_original_const_missing(const) | |
end | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Tracks a video's play progress via Vertster | |
* | |
* Usage: | |
* | |
* Vswap.trackWistiaVideo(560, 'wistia_123', 63.0); | |
* | |
* Note: This currently only works with a Wistia video embed but could be easily adapted to | |
* work with YouTube or other video players. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# Send your exact HTTP request back to you in the response body. | |
# Useful for debugging. | |
# | |
require 'proxymachine' | |
proxy do |data| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
</head> | |
<body style="padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"> | |
<div id="wistia_253852" width="438" height="320">Almost there...</div> | |
<script src="http://embed.wistia.com/embeds/v.js" charset="ISO-8859-1"></script> | |
<script> | |
Wistia.VideoEmbed('wistia_253852',438,320,{videoUrl:'http://embed.wistia.com/deliveries/f429e644d5d0f46bd36496d4caab604379382ce5.bin',stillUrl:'http://embed.wistia.com/deliveries/0a87e488223ac510058dad6ec742d9e8b4b50fe1.bin',distilleryUrl:'http://distillery.wistia.com/x',accountKey:'wistia-production_3176',mediaId:'wistia-production_253852',mediaDuration:44.78,autoPlay:true}); | |
var v = document.getElementById('wistia_253852');v.load();v.play(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--------------- the page ------------------ | |
<li class="recipe"> | |
<a href="#" class="star"/> | |
<h3><%= "Chile-Braised Pork Shoulder Tacos" %></h3> | |
<p class="details"><%= "Added by you, shared with 3 others, edited by 2 others, 5 comments" %></p> | |
<p class="source"><%= "Bon Apetit" %></li> | |
<div class="actions"> | |
<a href="#" class="share">Share</a> | |
</div> |
OlderNewer