Skip to content

Instantly share code, notes, and snippets.

@willurd
willurd / web-servers.md
Last active April 26, 2024 12:46
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
@arangamani
arangamani / jsonlint
Last active January 7, 2016 02:45
A JSON lint tool using Ruby and "json" Rubygem
#!/usr/bin/env ruby
require "rubygems"
require "json"
if ARGV.size < 1
puts "Please provide a JSON file"
exit 1
end
@alexbevi
alexbevi / pre-commit.sh
Created August 23, 2012 12:05
Git pre-commit hook that checks ruby source files for Pry breakpoints
# 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/
@happy15
happy15 / gist:2179728
Created March 24, 2012 07:40
wired benchmark: cuba vs sinatra
simple.rb
=========
require 'sinatra'
use Rack::CommonLogger
get '/' do
'hello'
end
@hotchpotch
hotchpotch / .pryrc
Created March 5, 2012 13:26
pry clipboard copy utility
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|
@johnthethird
johnthethird / cap_notify.rb
Created May 4, 2011 20:02 — forked from rtekie/cap_notify.rb
Capistrano deployment email notifier for Rails 3
=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)