Skip to content

Instantly share code, notes, and snippets.

@ntamvl
ntamvl / create-ruby-gem-that-adds-rake-tasks.md
Last active March 9, 2025 00:04
How to create a Ruby gem that adds Rake tasks

How to create a Ruby gem that adds Rake tasks

Create a gem

One way to do this is to use bundler to scaffold our gem:

bundler gem my_gem

Add rake tasks to our gem

I prefer to put tasks meant to manage the gem itself in lib/tasks, and tasks the gem is meant to provide to gem users in lib/my_gem/tasks.

@willurd
willurd / web-servers.md
Last active June 20, 2025 13:17
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@happyrobots
happyrobots / gist:1862963
Created February 19, 2012 10:17
Copy to Clipboard Using Ruby
# Mac
IO.popen('pbcopy', 'r+') { |clipboard| clipboard.puts html_out }
# Linux
IO.popen(’xsel –clipboard –input’, ‘r+) { |clipboard| clipboard.puts html_out }