Skip to content

Instantly share code, notes, and snippets.

View theory's full-sized avatar
💭
🥃

David E. Wheeler theory

💭
🥃
View GitHub Profile
# See a list of the changes between master and a branch, excluding merges. Veryhandy.
git log --name-status --decorate --no-merges origin/master..origin/some_branch

No, I can't just let this go with just the boilerplate letter text. So I just read it, and, frankly, it's as strongly worded as I could hope for. The climate disaster is going to make the financial disaster look like a trip to Disneyland. And I hold you responsible if nothing is done about it.

I am extremely disappointed in the lack of leadership.

(add-to-list 'load-path "/usr/local/share/emacs/site-lisp")
;(defconst mEV (emacs-version)
; "Keep the Emacs version string,
; that is needed a few times.")
;; make backup files in ~/.emacs-backups/ rather than scattered around all
;; over the filesystem.
(defun make-backup-file-name (file-name)
"Create the non-numeric backup file name for `file-name'."
(require 'dired)

The Lone Ranger says, “Tanto, we're surrounded by Indians!”

Tanto says, “What to you mean ‘we,’ white man?”

::

The white Christians say, “Jewish junior partner sidekicks, we’re surrounded by semites!”

The Jewish sidekicks say, “What do you mean ‘we,’ gentiles?”

use Router::Resource;
use My::Controller;
use Plack::Builder;
my $router = router {
resource '/' => sub {
GET { My::Controller->root(@_) };
};
resource '/blog/{year}/{month}' => sub {
@theory
theory / gist:627229
Created October 14, 2010 22:41
Router::Resource::Match
package Router::Resource::Match;
my $def = __PACKAGE__->new(sub { [405], [], ['Method not allowed' ] });
sub not_allowed { $def }
sub new {
my ($class, $code) = @_;
bless $code => $class;
}
if (my $method = $router->match($env)) {
return $method->();
} else {
return [$router->code, [], ['not found']];
}
sub {
my $env = shift;
if (my $method = $router->match($env)) {
return $method->();
} else {
return [$router->code, $router->headers, [$router->message]];
}
};
@theory
theory / MySQL Question
Created October 25, 2010 20:11
How to suppress query output?
I'm a developer who's currently enjoying unit testing mysql stored procedures using mytap.
However, I realized that when I run select queries in my testfile in order to check if some values
are in the right place, I also get the output of these queries which interferes with the test output.
I was hoping that there would be kind of an exec() function to run my queries.
I'm basically doing stuff like SELECT @email:=email FROM ..... and then use the @email within the
tap.eq() function
Any ideas?
@theory
theory / eav.sql
Created November 20, 2010 05:28
An example of the perils of EAV (entity-attribute-value)
BEGIN;
CREATE TABLE thing (
id serial primary key,
name text
);
CREATE TABLE stuff (
id serial primary key,
key text,