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 / pdxruby_location_survey.csv
Created June 23, 2009 19:09
pdxruby location survey data
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 8.
Timestamp,I will regularly attend meetings within 2 miles (3.2 kilometers) of these locations:,I have attended this many Portland Ruby Brigade meetings or events during the last 12 months:
6/10/2009 18:16:21,"Downtown Portland and nearby (e.g., PSU, AboutUs, NedSpace, Souk, etc), SE Portland near Mt. Tabor, Beaverton near MAX station",8/12/2009
6/10/2009 18:26:27,"Downtown Portland and nearby (e.g., PSU, AboutUs, NedSpace, Souk, etc), SE Portland near Mt. Tabor, Belgium",8/12/2009
6/10/2009 18:26:52,"Downtown Portland and nearby (e.g., PSU, AboutUs, NedSpace, Souk, etc)",4/7/2009
6/10/2009 18:31:18,"Downtown Portland and nearby (e.g., PSU, AboutUs, NedSpace, Souk, etc), SE Portland near Mt. Tabor",1/3/2009
6/10/2009 18:31:31,"Downtown Portland and nearby (e.g., PSU, AboutUs, NedSpace, Souk, etc)",4/7/2009
6/10/2009 18:37:32,"Downtown Portland and nearby (e.g., PSU, AboutUs, NedSpace, Souk, etc), SE Portland near Mt. Tabor",4/7/2009
6/10/2009 18:38:42,"Downtown Portland and nearby (e.g., PSU, AboutUs, NedSpace
Is the ExtUtils::Installed in Perl 5.10 broken?
I need to be able to query an installed CPAN package and find out what files it
contains. I had code that worked fine with Perl 5.8, but it doesn't work with
5.10. Any ideas? Is there another way that I should be doing this?
# From shell, install a silly package:
cpan Acme::please
# From Perl, get the lists of file in this package:
@igal
igal / stop_spam_broadcasts_on_google_groups.txt
Created August 25, 2009 21:05
Stop spammers from broadcasting to your Google Groups
Stop spammers from broadcasting to your Google Groups
=====================================================
Is your Google Groups mailing list broadcasting messages from spammers?
If so, it makes your group look bad, annoys subscribers, pollutes the
archives, and hurts your community.
Thankfully, you can easily stop these spam broadcasts. By changing your
group settings, administrators will be able to see the first posts made
by new members and decide whether to allow them before they're broadcast
@igal
igal / menu_items_and_activation_patterns.js
Created February 14, 2010 14:26
JavaScript URL-based menu activation code
// USAGE: This code parses the browser's URL and displays either the matching menu section or an error if one couldn't be found.
// Associative array of menu items to activate and the regular expression
// fragments that activate them:
var menu_items_and_activation_patterns = {
"about": "about",
"attend": "(attend|register)",
"blog": "(blog|archive)",
"schedule": "events/.+?/schedule",
"sessions": "events/.+?/sessions",
@igal
igal / vimiumrc.txt
Created March 11, 2010 21:12
My Vimium key mappings
"Vimium" adds vi-like key mappings to Google Chrome browser: http://bit.ly/9K14IQ
You can change your mappings in Extensions > Vimium > Advanced Options > Key mappings.
Here are key mappings that I find useful:
map b scrollFullPageUp
map m previousTab
map , nextTab
# Tell controller not to check for authenticity token:
Rails.configuration.action_controller.allow_forgery_protection = false
# Create a session:
app = ActionController::Integration::Session.new
# Setup parameters from log:
params = {"start_date"=>"2010-04-15", "end_date"=>"2010-04-15", "commit"=>"Create", "event"=>{"title"=>"Brain Silo Hackfest/Open House", "url"=>"http://brainsilo.org", "venue_id"=>"202392003", "description"=>"The silo is open to any interested parties who want to hack or just check out the space during the welcome meeting. <b>This is an Open House meeting</b>\r\n\r\nNOTE: The entrance for the space is on the backside of the building in the alley -- NOT at the mailing address. See this satellite view for clarification: http://bit.ly/8Arvpt\r\n\r\nThe outside door is at the top of a set of stairs. The space is marked with a small sticker that is labeled \"BrainSilo\"\r\n", "tag_list"=>"brainsilo, hackfest"}, "venue_name"=>"bRainSilo", "trap_field"=>"", "start_time"=>"07:00 PM", "end_time"=
# This gist describe's the OpenConferenceWare data structures
# related to user favorites.
#
# The hope is that this will help with creating an algorithm that
# can schedule sessions in an optimal way based on:
#
# * User favorites: Don't schedule talks at same time if many
# users favorite them together.
# * Tracks: Balance out tracks so that there aren't, for example,
# only "cooking" track talks happening at the same time.
@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: #
@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 / 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.