Skip to content

Instantly share code, notes, and snippets.

View balinterdi's full-sized avatar
👌
Enjoying life, including work.

Balint Erdi balinterdi

👌
Enjoying life, including work.
View GitHub Profile
### parse_modified_files_from_git.rb
#!/usr/bin/env ruby -wn
modified_file_pattern = /^#\s+(?:modified|new file):\s+(.*)$/
puts $1 if modified_file_pattern =~ $_
### rm_trailing_whitespace.rb
#!/usr/bin/env ruby -wn
class TaskListPanelSweeper < ActionController::Caching::Sweeper
observe Task, TaskList, Comment
def after_save(record)
if expire_cache?(record)
expire_task_list_panel(record)
end
end
private
#!/usr/bin/env ruby
#
# Update iChat/Adium/Skype status
#
# USAGE: imstatus <online|available|offline|away|dnd|invisible> [message]
# (supports partial status identifiers like 'on' or 'aw')
#
# László Bácsi <lackac@icanscale.com>
# http://github.com/lackac
# put this in your ~/.bash_login and then call it like "open_bundler_gem paperclip"
# opens the designated gem in the bundler directory of your Rails app
open_bundler_gem () {
matched_dirs=`find vendor/bundler_gems -name "*$1*" -type d`;
matched_dirs=`echo $matched_dirs`;
gem_dir_pos=`expr "$matched_dirs" : '[^ ]*'`;
mate ${matched_dirs:0:$gem_dir_pos};
}
require "user_creation_service"
require "spec"
require "rr"
Spec::Runner.configure do |config|
config.mock_with RR::Adapters::Rspec
end
describe UserCreationService do
before do
class HomeApp
def call(env)
[200, {"Content-Type" => "text/plain"}, ["Hello World!"]]
end
end
Marketinsushi::Application.routes.draw do |map|
# match "/home" => HomeApp
mount HelloWorld.new => "/home"
match '/' => "static#welcome"
@balinterdi
balinterdi / top_us_cities.html
Created September 2, 2010 15:09
Extract top US cities
<!-- taken from http://en.wikipedia.org/wiki/List_of_United_States_cities_by_population -->
<tr>
<td align="center">1</td>
<td><a href="/wiki/New_York_City" title="New York City">New York City</a></td>
<td><a href="/wiki/New_York" title="New York">New York</a></td>
<td align="right"><span style="display:none">&amp;0000000008391881.000000</span>8,391,881</td>
</tr>
<tr>
<td align="center">2</td>
<td><a href="/wiki/Los_Angeles" title="Los Angeles">Los Angeles</a></td>
describe "Man" do
let(:the_sunshine_in) { }
subject { anybody }
it { should be_happy }
end
CODE = [112,117,116,115,32,34,67,79,68,69,32,61,32,35,123,67,79,68,69,46,105,110,115,112,101,99,27,99,116,125,34, 10,67,79,68,69,46,101,97,99,104,32,123,124,99,124,32,112,114,105,110,116,32,99,46,99,104,114,32,125,10]
puts "CODE = #{CODE.inspect}"
CODE.each { |c| print c.chr }
We couldn’t find that file to show.