Skip to content

Instantly share code, notes, and snippets.

View igal's full-sized avatar

Igal Koshevoy igal

  • Pragmaticraft
  • Portland, Oregon, USA
View GitHub Profile
@igal
igal / Thunderbird 3 -- userChrome.css
Created February 7, 2010 00:14
Thunderbird 3 user interface tweaks for use on small screens
/* Thunderbird 3 user interface tweaks
* ===================================
*
* These changes improve Thunderbird's behavior on smaller screens. You should
* add these to your Thunderbird profile's "chrome/userChrome.css" file. You
* will probably need to create a directory and file.
*/
/* Show a dot for unstarred messages in the message listing so that it's easy
* to tell which messages have are starred.
@igal
igal / .vimperatorrc.local.vim
Created March 11, 2010 21:19
My Vimperator configuration
"===[ Settings ]========================================================
" Autocomplete using Firefox Awesomebar subsystem
set complete=l
" Show completions as you type? '' waits for tab, 'auto' shows them immediately
set wildoptions=''
" Select the longest autocomplete match
set wildmode='list:full'
@igal
igal / gist:53855
Created January 28, 2009 07:29
.gitrc aliases for common git commands
# Aliases for common git commands. E.g., enter "git d" for "git diff"
# These settings live in the ~/.gitconfig file.
[alias]
b = branch
ba = branch -a
ci = commit
co = checkout
d = diff
dc = diff --cached
@igal
igal / .gitconfig
Created August 28, 2012 06:51
Git configuration
#---[ Includes ]--------------------------------------------------------
[include]
# Load private information from a separate file, e.g. name, email, global
# ignores, tokens, etc.
path = ~/.gitconfig.local
#---[ Settings ]--------------------------------------------------------
[core]
@igal
igal / .bashrc_prompt.sh
Created August 28, 2012 06:59
Fancy, re-configurable prompt.
# The code below provides an elaborate system for composing custom prompts.
# Of these the `myprompt`, `devprompt` and `longprompt` are the most useful.
# Fancy, reconfigurable prompt.
multiprompt () {
parse_git_branch () {
if [[ -n $promptgit ]] && which git 2>&1 > /dev/null; then
ref=$(git symbolic-ref HEAD 2> /dev/null) || return 0
ref="${ref#refs/heads/}"
if [[ $ref != 'master' ]]; then
@igal
igal / 99.pl
Created August 10, 2012 04:17 — forked from notbenh/99.pl
ben goofs off with 99 bottles ... now with moar minimalism.
#!/usr/bin/env perl
use strict;
use warnings;
use feature qw{say};
sub bottles() { sprintf qq{%s bottle%s of beer}
, $_ || 'No'
, $_==1 ? '' : 's';
}
sub store() { $_=99; qq{Go to the store, buy some more...\n}; }
@igal
igal / gist:983749
Created May 20, 2011 20:39
Resque: possible way to add durability

Resque durability

Resque (https://github.com/defunkt/resque) is nice, but doesn't provide durability. When a worker "reserves" a job, it actually just pops it from the data store, which deletes the job. If anything happens to the worker after it pops the job, the job is lost forever. However, the author of Resque, defunkt, doesn't want reservation or retries added, and has rejected such patches in the past. Therefore, this may not be worth doing with Resque unless someone wants to maintain a fork of it forever.

Background

  1. https://github.com/defunkt/resque/issues/16 -- where defunkt writes "Resque is explicitly designed to never re-try jobs. Ever, under any circumstance." and "If you need jobs to never fail and never slip through the cracks due to failure you may want [something else]".
  2. https://github.com/defunkt/resque/issues/93 -- where defunkt write "Resque
@igal
igal / gist:944934
Created April 27, 2011 18:59
Etherpad: find the URL for a page if you can only remember some of its contents

Etherpad: find the URL for a page if you can only remember some of its contents

  1. Connect to the Etherpad database, the credentials are in a file like src/etherpad/trunk/etherpad/etc/etherpad.localdev-default.properties

  2. Execute SQL similar to that below, replacing Phantom Chicken with your search term:

     SELECT DISTINCT(m.ID) FROM `PAD_REVMETA_META` AS m LEFT JOIN
       (`PAD_REVMETA_TEXT` AS t) ON (m.NUMID = t.NUMID) WHERE t.DATA 
       LIKE '%Phantom Chicken%';
    
  3. Use the IDs shown to compose a URL, e.g. if ID is omgkittens and your Etherpad server is at etherpad.mysite.com, then your URL is http://etherpad.mysite.com/omgkittens.

@igal
igal / sunspot_eg.rb
Created March 2, 2011 02:08
Sample Sunspot full-text search code
class Post < ActiveRecord::Base
# Define index
searchable do
text :title, :body
string :author_name
integer :blog_id
integer :category_ids
float :average_rating, :using => :ratings_average
time :published_at
string :sort_title do
@igal
igal / git-meld.rb
Created August 21, 2010 07:04
git-meld
#!/usr/bin/env ruby
# FIXME provide flexible way of choosing tool
DIFF = ENV['DIFF'] || 'meld'
########################################################################################################
# Usage: #
# gitopendiff [-r<left rev>:<right-rev>] [repository] #
# #
# Example: #