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
Any of these should be runnable at the command line by `ruby <filename>`. |
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
Any of these should be runnable at the command line by `ruby <filename>` |
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 lang="en-US"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> | |
<title>Ampersand Test</title> | |
</head> | |
<body> | |
<h1>Stuff & Things</h1> | |
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue.</p> | |
<h1>Stuff & Things</h1> | |
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue.</p> |
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 lang="en-US"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> | |
<title>Untitled Document</title> | |
<style type="text/css"> | |
@page { size: A4; } | |
@page cover { size: A6 portrait; background-color: rgb(243,241,224); } | |
#cover { page: cover; } | |
</style> | |
</head> |
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 function is based on code found: | |
// http://www.filamentgroup.com/lab/jquery_plugin_for_requesting_ajax_like_file_downloads/ | |
// to easily make a form and POST it | |
var download = function(url, data, method){ | |
//url and data options required | |
if( url && data ){ | |
jQuery('<form style="display: none" id="dr_submission" action="' + url | |
+ '" method="' + (method||'post') + '">' | |
+ '</form>').appendTo('body'); | |
//credentials |
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
class Array | |
alias :orig_uniq__ :uniq | |
def uniq(attr = nil) | |
return orig_uniq__ if attr.nil? | |
[].tap do |c| | |
found = [] | |
self.each_with_index do |el, i| | |
val = el.send(attr) | |
unless found.include? val | |
found << val |
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 simple sinatra feedburner proxy. This technique can be used for getting around firewalls and things of that nature. | |
To use it, you can just `ruby feedburner_proxy.rb` at the cli and then navigate to `http://localhost:4567/FEED_URL`. | |
e.g. `http://localhost:4567/expectedbehavior` or `http://localhost:4567/jqr`, which will then pull down | |
'http://feeds2.feedburner.com/expectedbehavior' and 'http://feeds2.feedburner.com/jqr', respectively. | |
You can check it out at: http://high-spring-46.heroku.com |
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
# Code review | |
# | |
# This seems really verbose...seems that there should be a simpler way to conditionally set | |
# the value of a variable. I would like to write something like: | |
# body = post.get_formatted_body || "" | |
# | |
# That fails when the post is nil. This helper has to deal with a nil post object being passed in | |
# so I added the .nil? check. This is a contrived version of the situation I have, so don't | |
# nitpick the details. | |
# |
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
# -*- coding: utf-8 -*- | |
module Color | |
COLORS = { :clear => 0, :red => 31, :green => 32, :yellow => 33, :magenta => 35 } | |
end | |
class Test::Unit::Slow | |
alias :old_long_display :long_display | |
def long_display | |
time_index = /\d+\.\d+s$/ =~ old_long_display | |
time = old_long_display[time_index..-1] if index |
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
module ActiveSupport | |
module Testing | |
module Declarative | |
alias :tu_test_original :test | |
# test "verify something", [:slow, :wip] do | |
# ... | |
# end | |
def test(name, tags = nil, &block) |