Skip to content

Instantly share code, notes, and snippets.

View keithpitt's full-sized avatar
🍔
This is not a burger

Keith Pitt keithpitt

🍔
This is not a burger
View GitHub Profile
### Keybase proof
I hereby claim:
* I am keithpitt on github.
* I am keithpitt (https://keybase.io/keithpitt) on keybase.
* I have a public key whose fingerprint is 287D 82C1 F448 4545 23E6 AE11 2E32 9798 2C44 10DA
To claim this, I am signing this object:
#!/bin/sh
BACKUP_DIR='/var/lib/pgsql/backups/'
FINAL_FILE='backup.gz'
TMP_FILE='tmp.gz'
BACKUP_TMP_FILE="$BACKUP_DIR$TMP_FILE"
#! /bin/sh
#
# chkconfig: - 55 45
# description: The memcached daemon is a network memory cache service.
# processname: memcached
# config: /etc/sysconfig/memcached
# Standard LSB functions
#. /lib/lsb/init-functions
global.TestHelper = {
loadFixtures: function(db) {
var file = fs.readFileSync("fixtures.yml").toString();
var fixtures = yaml.eval(file);
for(var table in fixtures) {
db.collection(table, function(err, collection) {
collection.remove();
member = Member.create(:username => "keith")
Relationship.exists?( :member1_id => member ) # Fails
Relationship.exists?( :member1_id => member.id ) # Works
def merge_suppliers
@supplier_from = Supplier.find(params[:id])
begin
@supplier_to = Supplier.find(params[:supplier_id])
rescue ActiveRecord::RecordNotFound
flash[:error] = "#{t('object.supplier')} #{t('messages.not_found')}"
return redirect_to(manage_supplier_path(@supplier_from.id))
end
@keithpitt
keithpitt / paginate.rb
Created May 23, 2011 09:20
Locomotive params extra support
+++ b/lib/locomotive/liquid/tags/paginate.rb
@@ -42,7 +42,7 @@ module Locomotive
page_count, current_page = pagination['total_pages'], pagination['current_page']
- path = context.registers[:page].fullpath
+ path = context.registers[:controller].request.fullpath
pagination['previous'] = link(I18n.t('pagination.previous'), current_page - 1, path) if pagination['previous_page']
pagination['next'] = link(I18n.t('pagination.next'), current_page + 1, path) if pagination['next_page']
export RELEASE_NOTES = `git log --format=oneline | grep "$GIT_COMMIT" | sed -e 's/'${GIT_COMMIT}'//'`
@keithpitt
keithpitt / 01-package.json
Created December 5, 2011 06:56 — forked from SlexAxton/01-package.json
Compiling Sproutcore Handlebars Templates on the Server
{ "description" : "Sproutcore Handlebars Precompiler"
, "version" : "0.1.0"
, "author" : "Alex Sexton <Alex.Sexton@bazaarvoice.com>"
, "engines" : ["node >=0.4.7"]
, "main" : "./lib/main"
, "dependencies": {
"handlebars": "1.0.x"
}
}
@keithpitt
keithpitt / gist:61acb5700f75b078f199
Last active October 1, 2015 23:27
Installing the Buildkite Agent on FreeBSD
# Install bash
$ sudo pkg install bash
$ sudo sh -c 'echo "fdesc /dev/fd fdescfs rw 0 0" >> /etc/fstab'
$ sudo mount -a
$ bash
# To change your default shell to bash, you can type:
$ sudo chsh -s /usr/local/bin/bash freebsd
# This bit isn't great, but the agent requires the bash executable to be at /bin/bash