Skip to content

Instantly share code, notes, and snippets.

View maxim's full-sized avatar
🛠️

Max Chernyak maxim

🛠️
View GitHub Profile
@apeiros
apeiros / irb_drop.rb
Created April 24, 2010 16:58
Drop into irb from anywhere within your code
module Kernel
# usage:
# require 'irb_drop'
# ...do some stuff...
# irb_drop(binding) # irb will open here with the current local variables
# ...continue doing stuff...
def irb_drop(context=nil, *argv)
require 'irb'
require 'pp'
require 'yaml'
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
passenger nginx rails bundler status error
2.2.5 0.8.22 2.3.5 no OK
2.2.5 0.8.22 2.3.9 yes FAIL passenger not finding gems
2.2.5 0.8.50 2.3.9 yes FAIL couldn't compile
2.2.12 0.8.50 2.3.9 yes FAIL passenger not finding gems
2.2.13 0.8.50 2.3.9 yes FAIL PassengerHelper not starting
2.2.15 0.7.67 2.3.9 yes FAIL PassengerHelper not starting
2.2.15 0.8.50 2.3.9 yes FAIL PassengerHelper not starting
3.0.0.pre3 0.8.50 2.3.9 yes OK (requires libcurl4-openssl-dev)
@maxim
maxim / next_episodes
Created September 27, 2010 05:14
Outputs sorted times of upcoming episodes of shows fetched from IMDB.
#!/usr/bin/env ruby
require 'rubygems'
require 'open-uri'
require 'nokogiri'
require 'time'
# USAGE:
# Put ids of IMDB shows here:
movie_ids = %w(tt0773262 tt0121955 tt0182576 tt0460649 tt0903747 tt0412142)
@lukaszkorecki
lukaszkorecki / autotest-growl.markdown
Created September 28, 2010 09:41
autotest-growl icon set

World famous FFFFFFFFUUUUUUUUU autotest-growl icon set

fucons

  1. download
  2. Edit your .autotest and add this line: Autotest::Growl::image_dir = File.expand_path("~")+'/Dropbox/Public/fu' (or wherever you unpacked fu.zip)
  3. ???????
  4. Profit!
anonymous
anonymous / gist:610665
Created October 4, 2010 23:41
be careful with method empty?
class Cart < ActiveRecord::Base
has_many :line_items
delegate :empty?, :to => :line_items
end
class User < ActiveRecord::Base
has_one :cart
end
@user = User.new
@apeiros
apeiros / gist:634082
Created October 19, 2010 12:01
Terminate current process the hard way (kill -9)
module Kernel
# Terminate the current process - the hard way
def t!
`kill -9 #{$$}`
end
module_function :t!
end
@miku
miku / mysqldump2sqlite3.sh
Created December 14, 2010 20:28
Convert a mysql database dump into something sqlite3 understands.
#!/bin/sh
# ================================================================
#
# Convert a mysql database dump into something sqlite3 understands.
#
# Adapted from
# http://stackoverflow.com/questions/489277/script-to-convert-mysql-dump-sql-file-into-format-that-can-be-imported-into-sqlit
#
# (c) 2010 Martin Czygan <martin.czygan@gmail.com>
@igrigorik
igrigorik / ruby-1.9-tips.rb
Created February 3, 2011 17:19
Ruby 1.9 features, tips & tricks you may not know about...
def tip(msg); puts; puts msg; puts "-"*100; end
#
# 30 Ruby 1.9 Tips, Tricks & Features:
# http://www.igvita.com/2011/02/03/new-ruby-19-features-tips-tricks/
#
tip "Upgrading to Ruby 1.9 is simple: rvm install 1.9.2 && rvm --default 1.9.2"
tip "Ruby 1.9 supports named captures in regular expressions!"
@jehiah
jehiah / simple_args_parsing.sh
Created March 4, 2011 16:56
a simple way to parse shell script arguments
#!/bin/sh
#
# a simple way to parse shell script arguments
#
# please edit and use to your hearts content
#
ENVIRONMENT="dev"