Skip to content

Instantly share code, notes, and snippets.

Avatar

Igal Koshevoy igal

  • Pragmaticraft
  • Portland, Oregon, USA
View GitHub Profile
@igal
igal / gist:53855
Created Jan 28, 2009
.gitrc aliases for common git commands
View gist:53855
# 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 / .vimperatorrc.local.vim
Created Mar 11, 2010
My Vimperator configuration
View .vimperatorrc.local.vim
"===[ 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 / Thunderbird 3 -- userChrome.css
Created Feb 7, 2010
Thunderbird 3 user interface tweaks for use on small screens
View Thunderbird 3 -- userChrome.css
/* 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 / .gitconfig
Created Aug 28, 2012
Git configuration
View .gitconfig
#---[ 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 Aug 28, 2012
Fancy, re-configurable prompt.
View .bashrc_prompt.sh
# 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 Aug 10, 2012 — forked from notbenh/99.pl
ben goofs off with 99 bottles ... now with moar minimalism.
View 99.pl
#!/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
Resque: possible way to add durability
View gist:983749

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 Apr 27, 2011
Etherpad: find the URL for a page if you can only remember some of its contents
View gist:944934

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 Mar 2, 2011
Sample Sunspot full-text search code
View sunspot_eg.rb
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
View git-meld.rb
#!/usr/bin/env ruby
# FIXME provide flexible way of choosing tool
DIFF = ENV['DIFF'] || 'meld'
########################################################################################################
# Usage: #
# gitopendiff [-r<left rev>:<right-rev>] [repository] #
# #
# Example: #