This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{ | |
categories: | |
- blogging | |
}} | |
# Welcome! (2009/03/16) | |
Wherein our blogger sets up yet another new blogging site. | |
Well, I have a git post-commit hook that throws a http request against the server in order to sync the articles from a local git repo. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb> hashes = Hash.new { |k, v| k[v] = Digest::MD5.hexdigest(v) } | |
=> {} | |
irb> hashes['http://eigenclass.org/hiki.rb?cmd=view&p=Lexical+complexity+in+Ruby'] | |
=> "5f1c3e54e2e8809385e994aa7e3d9fba" | |
irb> hashes['http://www.randomwebsite.com/'] | |
=> "7ad5a33ea26ed12f53451c255114e870" | |
irb> hashes | |
=> {"http://eigenclass.org/hiki.rb?cmd=view&p=Lexical+complexity+in+Ruby"=>"5f1c3e54e2e8809385e994aa7e3d9fba", "http://www.randomwebsite.com/"=>"7ad5a33ea26ed12f53451c255114e870"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ENV['RACK_ENV'] ||= 'development' | |
require 'app_title' | |
namespace :db do | |
desc 'create' | |
task :create do | |
require 'db/initial' | |
ret = psql_cmd("create database app_title_#{ENV['RACK_ENV']}") | |
Initial.apply(DB, :up) unless ret == "" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
irb -r app_title |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def method_missing(method, *args) | |
if method.to_s =~ /^flash_(.*)/ | |
type = case $1 | |
when 'error' | |
:errors | |
when 'warning' | |
:warning | |
when 'notice' | |
:notices | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this is almost verbatim from AR | |
class ValidationError < StandardError | |
attr_reader :record | |
def initialize(record) | |
@record = record | |
super("Validation failed: #{@record.errors.join(' ')}") | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'digest/sha1' | |
module Validation | |
def validate_uniqueness_of(field, value) | |
if @collection.where(field => value).any? | |
self.errors << "#{field} must be unique." | |
end | |
self.instance_variable_set("@#{field}", value) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Here are lines that are either unchanged from the common | |
ancestor, or cleanly resolved because only one side changed. | |
<<<<<<< yours:sample.txt | |
Conflict resolution is hard; | |
let's go shopping. | |
||||||| | |
Conflict resolution is hard. | |
======= | |
Git makes conflict resolution easy. | |
>>>>>>> theirs:sample.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11:40 <codeape> "/Applications/Adobe Acrobat 8 Professional/Adobe Acrobat Professional.app/Contents/MacOS/mysqld: ready for connections. " | |
11:40 <codeape> what. | |
11:40 <codeape> the. | |
11:40 <codeape> FUCK? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
potential_tag = ARGV[0] | |
if potential_tag =~ /^refs\/tags\/(.*)$/ | |
tag = $1 | |
tag_data = `git describe --tags #{tag}^`.strip | |
tag_data =~ /(.*?)-([0-9]+)-([0-9a-g]{8,8})$/ | |
old_tag = $1 | |
commit_count = $2 | |
g_plus_hash = $3 | |
log = `git log --pretty=format:"<%s> by %an, committed by %cn on %ci (%h)" #{tag}~#{commit_count}^..#{tag}` |