Skip to content

Instantly share code, notes, and snippets.

[23:01:04] phlipper@roadie [~]$ whois google.com
Whois Server Version 2.0
Domain names in the .com and .net domains can now be registered
with many different competing registrars. Go to http://www.internic.net
for detailed information.
GOOGLE.COM.ZZZZZ.GET.LAID.AT.WWW.SWINGINGCOMMUNITY.COM
GOOGLE.COM.ZZZZZ.DOWNLOAD.MOVIE.ONLINE.ZML2.COM
<!-- _product.html.erb -->
<% div_for(product) do %>
<p id="<%= dom_id(product, "price") %>"><%=h product.price %></p>
<!-- periodic update ... -->
<%= image_tag(product.photo.url(:thumb), :id => dom_id(product, "photo")) %>
<% end %>
<%= link_to "Contact Us", page_url("contact"), :class => current_page?(page_url("contact")) ? "active" : "" %>
function rgbToHex(r, g, b) {
return toHex(r) + toHex(g) + toHex(b);
}
function toHex(n) {
if (n == null) { return '00'; }
n = parseInt(n);
if (n == 0 || isNaN(n)) { return '00'; }
n = Math.max(0, n); n = Math.min(n, 255); n = Math.round(n);
chars = '0123456789ABCDEF';
#
# pman -- create, print, save, view PDF man pages
#
# Author: ntk
# License: The MIT License, Copyright (c) 2007 ntk
# Description: (batch) convert man pages into PDF documents and save them to a specified directory; (batch) print or view PDF man pages from the command line
# Platform: Mac OS X 10.4.10; man bash
# Installation: put pman() into ~/.bash_login (or alternatives)
#
# Usage:
[22:05:59] phlipper@Trimaxion [~/Projects/shasta]$ ./script/console
Loading development environment (Rails 2.3.10)
** Erubis 2.6.6
rails_xss requires Rails 2.3.8 or later. Please upgrade to enable automatic HTML safety.
** Erubis 2.6.6
>> Rails.version
=> "2.3.10"
>> Rails.version <= "2.3.1"
=> false
>> Rails.version <= "2.3.2"
class Timer
attr_accessor :seconds
def initialize(value = 0)
@seconds = value
end
def to_s
time_left = @seconds
@phlipper
phlipper / gist:867845
Created March 13, 2011 03:49
normalize filenames for use with s3 authenticated urls
Paperclip.interpolates :normalized_basename do |attachment, style|
filename = attachment.instance.data_file_name
basename = File.basename(filename, File.extname(filename))
basename.gsub(/[^\w\d_-]/i, " ").gsub(/\s+/, "-")
end
[10:08:24] phlipper@Trimaxion [~/Projects/kidsruby]$ bundle
Fetching source index for http://rubygems.org/
Installing rake (0.8.7)
Installing htmlentities (4.2.3)
Installing mocha (0.9.10)
Installing qtbindings (4.6.3.2) with native extensions /Users/phlipper/.rvm/gems/macruby-0.9@kidsruby/gems/bundler-1.0.10/lib/bundler/source.rb:96:in `install:': ERROR: Failed to build gem native extension.
/Library/Frameworks/MacRuby.framework/Versions/0.9/usr/bin/macruby extconf.rb
make
@phlipper
phlipper / best_practice_version.html.erb
Created June 5, 2011 19:54
A few versions of Pete's zombie name script
<% zombie = Zombie.first %>
<p>
<%= link_to zombie.name, zombie %>
</p>