Skip to content

Instantly share code, notes, and snippets.

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

Tim Lucas toolmantim

:shipit:
🎉
View GitHub Profile
class WarOccupationTypeGame
include TwitterIntegration
include GamingEngine
include HTMLisedMap
include Europe
include CollectiveConciousness
attr_accessor :player, :scoreboard, :europe, :map
def receive(tweet)
class CuratorialContentFinder
include SemiAutomated
include CuratorialContentFinderFinder
include CollectiveConsciousness
include FrontalLobe
def recommend_related_article(article)
recommendations = network.advise_recommendations(article)
frontal_lobe.analyze(recommendations).recommended_article
end
# Downloads all the photos from a flickr set
require 'open-uri'
require 'rubygems'
require 'flickr-rest' # benschwarz-flickr-rest
Flickr::Query::API_KEY = 'your key, yo.'
Flickr::Query.new('57794886@N00').

Why build a site? Why do your customers care?

The core purpose of a website is to help your customers answer the questions necessary to do business with you.

If your website is a series of answers to questions then the success of your site depends on what questions you answer--it's the questions and answers that show the customer you provide a service they're looking for, you're a good choice and that they should buy from you.

In general every customer has the following questions:

  1. Who are you?
  2. What do you offer?
# Example simple stupid in-memory cache
class HashCache
def initialize(seconds_timeout)
@seconds_timeout = seconds_timeout
@cache = {}
end
def fetch(key, &block)
if @cache[key] && fresh?(@cache[key][:set_at])
return @cache[key][:value]
else

Improving cucumber output

We want to reduce cucumber's signal to noise ratio--currently errors are hidden within pages and pages of success.

You don't care in detail about what has passed, simply that stories ran and passed. What you care about is which scenarios no longer work, have broken, need updating or aren't yet complete.

How it'll work

# Example of using Hoptoad from a Sinatra app.
#
# This uses the existing Rails plugin with a hacky workaround for RAILS_ENV
# and RAILS_ROOT - better for now than recreating a whole plugin and duplicating
# all the config, backtrace cleaning, etc. I'm hoping this provides an example
# for a future version of the notifier plugin that supports various
# frameworks.
require 'rubygems'
HoptoadNotifier.configure do |config|
config.environment = RAILS_ENV
config.application_root = RAILS_ROOT
end
class HoptoadNotifier::Rails
def self.notify(request)
# Do your thang
end
end
%a{:href => name, :class => (@category == name ? "selected" : nil)}
%span= name
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang='en-US' xml:lang='en-US' xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title>IE float bug</title>
<meta content='text/html; charset=utf-8' http-equiv='Content-Type' />
<style type='text/css'>
body {
font-family: Helvetica, sans-serif; }
#container, #left, #right1, #right2 {