Skip to content

Instantly share code, notes, and snippets.

@provideal
provideal / gist:3526438
Created August 30, 2012 11:10
deadlock. wtf.
ERROR: deadlock detected
DETAIL: Process 36166 waits for ShareLock on transaction 134511; blocked by process 36167.
Process 36167 waits for ShareLock on transaction 134512; blocked by process 36166.
Process 36166: DELETE FROM "cart_items" WHERE "cart_items"."id" = $1
Process 36167: INSERT INTO "sale_items" ("article_id", "cancelled", "created_at", "main_item_id", "properties_hstore", "quantity", "sale_id", "title", "total_price", "updated_at", "variant_id", "vat_rate") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12) RETURNING "id"
HINT: See server log for query details.
CONTEXT: SQL statement "UPDATE variants SET
"reserved" = "reserved" + delta_reserved,
"remaining" = "remaining" + delta_remaining
WHERE "id"=variant_idd"
@provideal
provideal / bash_prompt.sh
Created January 13, 2011 14:24
make a prompt for ruby/rails/git development
#!/bin/bash
function prompt_command {
local nowDate="`date "+%H:%M:%S|%a,%m-%d"`"
local rubyv=''
branch=`git branch 2> /dev/null`
if [ $? -eq 0 ]; then
local branch="`echo "$branch" | sed -n 's/^\* \(.*\)$/\1/p'`"
local temp=`ruby --version`
if [ $? -eq 0 ]; then
@provideal
provideal / print_iframe_with_jquery.js
Created February 10, 2010 08:48
Printing an iFrame with jQuery
(function($) {
$(function() {
$(".print").live('click', function(e) {
e.preventDefault();
// remove old printframe
$("#printframe").remove();
// create new printframe