Skip to content

Instantly share code, notes, and snippets.

foo = () ->
a = 17
40
foo()
<table class="table table-striped table-bordered">
<col class="span2"></col>
<col class="span8"></col>
<col class="span2"></col>
<thead>
<tr>
<th>From</th>
<th>Subject</th>
<th>Date</th>
</tr>
/^(?:Expenses:(Cable|Utils))/
* $account -0.5
* Assets:Receivable:GF 0.5
= /^Expenses:Rent$/
* $account -0.2968
* Assets:Receivable:GF 0.2968
@peterkeen
peterkeen / ward.txt
Created November 29, 2012 16:50
Ward Cunningham on Pair Programming to the pdxruby mailing list
Subject: Re: [pdxruby] Re: Complex return value anti-pattern?
From: Ward Cunningham <ward.cunningham@gmail.com>
Date: Thu, 29 Nov 2012 08:23:26 -0800
Pair programming is often misunderstood.
To understand pairing one must examine the world views of programmers. For
many (perhaps all programmers historically) programming is difficult and re
quires skill and concentration to be successful. For others, and here we fi
nd roots in dynamic languages, programming is easy but requires imagination
#!/bin/bash
# This depends on a file named `/root/backup_dirs` containing a list of directories to backup
# one per line. All directories in that file, plus a database dump, will be archived together.
#
# Further, if you have a gitolite installationn, this will backup every repo in an individual archive.
set -e
set -x
set -o pipefail
@peterkeen
peterkeen / 20121108220000_add_budget_tables.rb
Created January 8, 2013 05:44
This is how I implement budgets for ledger web
Sequel.migration do
up do
create_table(:budget_periods) do
String :account
BigDecimal :amount
Date :from_date
Date :to_date
end
create_or_replace_view :budget_months, "select xtn_month, account, amount from (select distinct xtn_month from accounts_months) x cross join budget_periods where xtn_month between budget_periods.from_date and (coalesce(budget_periods.to_date, now()::date))"
@peterkeen
peterkeen / Dockerfile
Created June 27, 2013 05:43
My very first Dockerfile! It installs Ruby 2.0 from scratch, installs bundler, and then vendors in my app and installs dependencies.
MAINTAINER Pete Keen "pete@petekeen.com"
# Use Ubuntu 12.04 as the base image
FROM ubuntu:precise
# Install a bunch of prerequisites
RUN apt-get update
RUN apt-get install -y git-core curl wget libssl1.0.0 python-yaml build-essential libssl-dev
# Install ruby-build
@peterkeen
peterkeen / gist:6017752
Last active December 19, 2015 21:08 — forked from idan/gist:3135754

Hello there! This is a sample post for gist.io, a super-lightweight writing soapbox for hackers.

Now look up. Further. Above the post title. See that grey text with the gist ID?

Now back to me. That grey text is a link! Open that sucker in a new tab to see the source for this post. Also, I'm on a horse.

This is a SUPER major heading

If you peek at it with a web inspector, you'll see that it is a second-level heading. You can use first level headings, but they'll look just like the second level ones, and the gods of the HTML5 outlining algorithm will frown upon you.

@peterkeen
peterkeen / gist:7591428
Created November 21, 2013 23:02
microsoft.com is down
$ dig microsoft.com @4.2.2.2
; <<>> DiG 9.7.6-P1 <<>> microsoft.com @4.2.2.2
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 15309
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
task :run_gist => :environment do
url = ENV['url']
raise "usage: rake run_gist url=https://gist.github.com/asdfasdfasdfasdf" unless url.present?
dir = Dir.mktmpdir
system("git clone #{url} #{dir}")
Dir.chdir(dir) do
raise "Gist does not have a script.rb file to execute" unless File.exists?('script.rb')