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.
$ python -m SimpleHTTPServer 8000Each 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.
$ python -m SimpleHTTPServer 8000| #!/usr/bin/env ruby | |
| require "rubygems" | |
| require "json" | |
| if ARGV.size < 1 | |
| puts "Please provide a JSON file" | |
| exit 1 | |
| end |
| # Git pre-commit hook to check all staged Ruby (*.rb/haml/coffee) files | |
| # for Pry binding references | |
| # | |
| # Installation | |
| # | |
| # ln -s /path/to/pre-commit.sh /path/to/project/.git/hooks/pre-commit | |
| # | |
| # Based on | |
| # | |
| # http://codeinthehole.com/writing/tips-for-using-a-git-pre-commit-hook/ |
| simple.rb | |
| ========= | |
| require 'sinatra' | |
| use Rack::CommonLogger | |
| get '/' do | |
| 'hello' | |
| end |
| def pbcopy(str) | |
| IO.popen('pbcopy', 'r+') {|io| io.puts str } | |
| output.puts "-- Copy to clipboard --\n#{str}" | |
| end | |
| Pry.config.commands.command "hiscopy", "History copy to clipboard" do |n| | |
| pbcopy _pry_.input_array[n ? n.to_i : -1] | |
| end | |
| Pry.config.commands.command "copy", "Copy to clipboard" do |str| |
| =begin | |
| Capistrano deployment email notifier for Rails 3 | |
| Do you need to send email notifications after application deployments? | |
| Christopher Sexton developed a Simple Capistrano email notifier for rails. You can find details at http://www.codeography.com/2010/03/24/simple-capistrano-email-notifier-for-rails.html. | |
| Here is Rails 3 port of the notifier. | |
| The notifier sends an email after application deployment has been completed. |
| # a Rack middleware component that enables ActiveRecord query caching | |
| # To use, put "use QueryCaching" in your Sinatra app. | |
| class QueryCaching | |
| def initialize(app) | |
| @app = app | |
| end | |
| def call(env) | |
| if is_static_file?(env) |