Skip to content

Instantly share code, notes, and snippets.

View toolmantim's full-sized avatar
:shipit:
🎉

Tim Lucas toolmantim

:shipit:
🎉
View GitHub Profile
module Haml
module Filters
module Coffeescript
include Base
def render_with_options(text, options)
<<END
<script type=#{options[:attr_wrapper]}text/coffeescript#{options[:attr_wrapper]}>
#{text.rstrip.gsub("\n", "\n ")}
</script>
END
(function () {
if (!window.fluid) return;
// Dock badge unread messages
setInterval(function() {
var m = document.title.match(/\((\d+)\)/);
window.fluid.dockBadge = m ? parseInt(m[1]) : '';
}, 1000);
So I asked about conditionals in Rake and basically everybody
told me the concept is ridiculous, but I could maybe use invoke.
I'm thinking maybe I asked the wrong question, so here's some more
detail so we can either find me a viable solution or confirm I'm crazy.
I have a rake task that combines and minifies all my CSS and JS into
one file each. I want to automate that task so that it runs before
each deploy.
Ideally, I type 'cap deploy' as per normal, it runs the minifier tasks,
> telnet 127.0.0.1 8000
Trying 127.0.0.1...
Connected to ticketsystem.local.
Escape character is '^]'.
GET / HTTP/1.1
HTTP/1.1 200 OK
Content-Type: text/event-stream
Cache-Control: no-cache
Connection: keep-alive
require 'rubygems'
require 'eventmachine'
class IChatTracker < EM::Protocols::LineAndTextProtocol
def receive_line(line)
puts line
end
end
EM.run do
# To be stuck in the top of your Sinatra app or whichever file you want to
# declare the gems.
#
# Use this to ensure you use the same local gems as you do in production.
# Check it's a file as Heroku replaces .gems with a dir full of gems
File.file?(gems_file = "#{File.dirname(__FILE__)}/.gems") && File.read(gems_file).each do |gem_decl|
gem_name, version = gem_decl[/^([^\s]+)/,1], gem_decl[/--version ([^\s]+)/,1]
version ? gem(gem_name, version) : gem(gem_name)
end
namespace :gems do
desc "Install missing gem dependencies"
task :install do
File.read("#{File.dirname(__FILE__)}/.gems").each do |gem_decl|
gem_name, version, source = gem_decl[/^([^\s]+)/,1], gem_decl[/--version ([^\s]+)/,1], gem_decl[/--source ([^\s]+)/,1]
begin
version ? gem(gem_name, version) : gem(gem_name)
rescue Gem::LoadError
puts "Installing #{gem_name} #{version}..."
cmd = "gem install #{gem_name}"
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Really annoying IE6/7 radio name bug</title>
<script type="text/javascript" charset="utf-8" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8">
$(function() {
// Adds controller methods to elements
$$ = function(elem, methods) {
if (methods) $(elem).data("controller", methods);
return $(elem).data("controller");
}
# Some fish things for @markryall