Skip to content

Instantly share code, notes, and snippets.

View dougal's full-sized avatar

Douglas F Shearer dougal

View GitHub Profile
<!--
Written for a blog post by Douglas F Shearer
http://douglasfshearer.com/blog/clearing-a-file-input-field-using-jquery
-->
<script type="text/javascript" charset="utf-8" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js">
</script>
@dougal
dougal / README.textile
Created December 14, 2009 23:07
Transactions for blue_ridge

Instead of manually working out what to roll back in before() or after() why not reset the whole thing? Below is my outline for doing such.

This may be slightly slower. I initially thought a lot slower, but then I discovered I had changed something else in my code that caused a lot of slowdowns. On going back to the original setup it was barely any slower.

There may be downsides I haven’t thought of yet.

@dougal
dougal / Usage
Created November 30, 2009 18:34
>> config.authentication.username
=> "bob@example.com@"
>> config.authentication.password
=> "myhackproofpassword"
We couldn’t find that file to show.
#!/usr/bin/env ruby
# Copyright (c) Douglas F Shearer 2009
# http://douglasfshearer.com
# Distributed under the MIT licence.
# Converts a flickr.com user or photo URL to a flic.kr short URL.
#
### User example:
#
// The error
Namespace prefix f on title is not defined
// View
<table>
<lift:Show.posts>
<tr>
<td><f:title>Title</f:title></td>
31/03/2009 22:47:52 /System/Library/CoreServices/backupd[5985] Copied 64998 files (30.9 GB) from volume Main.
31/03/2009 22:48:40 /System/Library/CoreServices/backupd[5985] No pre-backup thinning needed: 625.7 MB requested (including padding), 5.82 GB available
31/03/2009 22:48:40 /System/Library/CoreServices/backupd[5985] Waiting for index to be ready (904 > 0)
31/03/2009 22:48:45 /System/Library/CoreServices/backupd[5985] Waiting for index to be ready (904 > 0)
31/03/2009 22:48:55 /System/Library/CoreServices/backupd[5985] Waiting for index to be ready (904 > 0)
31/03/2009 22:49:27 /System/Library/CoreServices/backupd[5985] Indexing a file failed. Returned -12 for: /opt/local/var/macports/software/scala/2.7.1_1/opt/local/share/scala/src/scala-decoder-src.jar, /Volumes/Seagate 320/Backups.backupdb/phoenix/2009-03-14-151350.inProgress/380FB8AA-3831-4E60-9D9C-8E8FB4E0523F/Main/opt/local/var/macports/software/scala/2.7.1_1/opt/local/share/scala/src/scala-decoder-src.jar
31/03/2009 22:49:27 /System/Library
phoenix:Desktop dougal$ rails foo
[...]
phoenix:Desktop dougal$ cd foo
phoenix:foo dougal$ mv config/database.yml config/database.yml.example
phoenix:foo dougal$ echo "config/database.yml" > .gitignore
phoenix:foo dougal$ git init
Initialized empty Git repository in /Users/dougal/Desktop/foo/.git/
phoenix:foo dougal$ git add .
phoenix:foo dougal$ git commit -a -m "Initial commit."
Created initial commit 07db11f: Initial commit.
require ‘cache-money’
config = YAML.load(IO.read(File.join(RAILS_ROOT, "../config/memcache.yml")))[RAILS_ENV]
$memcache = MemCache.new(config)
$memcache.servers = config['servers']
$lock = Cash::Lock.new($memcache)
$cache = Cash::Transactional.new($memcache, $lock)
class ActiveRecord::Base
is_cached :repository => $cache
Total (Desc) Climb
Pete Williams I-Cycles 24:21 (4.16) 20.05
Chris Herraghty Edinburgh Uni CC 25.30 (6.09) 19.21
Douglas Shearer Team Macchiato 26:14 (6.54) 19.20 (detour)
Roger Crawford Tomac Monkeys 26:28 (4.57) 21.31
Mark Scott 26:43 (5.12) 21.31
Stuart Gillfillan Edinburgh Uni CC 28.08 (7.22) 20.46
Allan Love Edinburgh Uni CC 28.42 (7.29) 21.19
Angus Gillies Peebles CC 33.35 (5.43) 27.52
Flora Gillies Peebles CC DNF