Skip to content

Instantly share code, notes, and snippets.

View benschwarz's full-sized avatar
🏁
Making the web fast

Ben Schwarz benschwarz

🏁
Making the web fast
View GitHub Profile
@benschwarz
benschwarz / dabblet.css
Created June 29, 2012 06:48 — forked from anonymous/dabblet.css
Untitled
body { padding: 10em; }
textarea { min-width: 40em; }
div {
padding: 2em;
border-left: 5px solid #c1c2c4;
border-right: 5px solid #c1c2c4;
position: relative;
}
body {
margin: 0 auto;
margin-top: 5em;
width: 760px;
}
.pulse {
width: 50px;
height: 50px;
border-radius: 50%;
Git is a tool that can confuse. Some feel intimidated by it, which is a shame, because git's design is stunningly simple: basic building blocks, and very consistent behaviour. It's a design you can always reason about to work things through, once you get the starting point.
We'll cover the theory, to nail those first principles -- important stuff, and interesting too, but we won't get bogged down in it. After all, the aim is a new tool in your toolbox.
We'll concentrate instead on what makes that stuff important: it's the bread and butter of day-to-day git. Trees, refs, rebasing, branches & tags, and more.
If you've ever thought "what the hell did git just do?" or "Oh dear, this repo is really broken now", then this workshop is for you.
This is a hands-on workshop. Bring your laptop to follow along.
http://ujihisa.blogspot.com/2009/06/rubygems-best-practice.html
A few things left to do:
* Ability to add default options for each PDF, rather than having to pass it to each generate_* method call
* Doesn't check if the pdf already exists. By default, which should it do?
- Overwrite the existing file. Let your users decide what they'd like to do here.
* Consider the inclusion of css, or even generated css templates using pre existing libraries (lesscss or yerk – sass.)
Anything else?
@benschwarz
benschwarz / stats.rb
Created September 16, 2009 04:14 — forked from mojombo/stats.rb
# Run the given block +num+ times and then print out the mean, median, min,
# max, and stddev of the run. For example:
#
# irb> stats(10) { sleep(rand / 100) }
# mean: 5.99ms
# median: 6.76ms
# min: 1.49ms
# max: 9.28ms
# stddev: 2.54ms
def stats(num)
@benschwarz
benschwarz / stats.rb
Created September 16, 2009 01:30 — forked from mojombo/stats.rb
# Run the given block +num+ times and then print out the mean, median, min,
# max, and stddev of the run. For example:
#
# irb> stats(10) { sleep(rand / 100) }
# mean: 5.99ms
# median: 6.76ms
# min: 1.49ms
# max: 9.28ms
# stddev: 2.54ms
def stats(num)

Poor Man's Deploy

  • Start a Sinatra server on port 4000
  • GET / to that server triggers a git pull and mod_rails restart
  • Hit port 4000 locally after pushing

Why?

module Locality::Search
def self.included(base)
base.class_eval do
class << self
def search(criteria)
logger.debug("search")
results = find_all_by_name(criteria)
if results.empty?