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 8000
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 8000
cribbed from http://pastebin.com/xgzeAmBn
Templates to remind you of the options and formatting for the different types of objects you might want to document using YARD.
Open3.pipeline_r( | |
%W[xmllint --xinclude --xmlout #{spine_file}], | |
# In order to clean up extraneous namespace declarations we need a second | |
# xmllint process | |
%W[xmllint --format --nsclean --xmlout -]) do |output, wait_thr| | |
open(codex_file, 'w') do |f| | |
IO.copy_stream(output, f) | |
end | |
end |
#!/usr/bin/env ruby | |
# A pre-commit hook script to ensure that no local gem dependencies (gem 'asdf', path: '~/local') | |
# exist in your Gemfile before commiting.` | |
# Allows gems to be loaded from source within the current project, but not from outside. | |
puts 'Checking for local dependencies in your Gemfile.' | |
ROOT_PATH = File.expand_path('../../..', __FILE__) | |
begin | |
require 'rubygems' | |
gemfile = ENV['BUNDLE_GEMFILE'] || File.join(ROOT_PATH, 'Gemfile') | |
require 'bundler/setup' if File.exists?(gemfile) |
#!/usr/bin/env ruby | |
require 'logger' | |
# rotatelogs required... | |
# http://httpd.apache.org/docs/2.2/programs/rotatelogs.html | |
logger = Logger.new("|rotatelogs ./foo.log.%Y-%m-%d-%H 3600", 0, 0) | |
10.times do | |
logger.error "testing..." |
# For context, this was inspired by the RubyRogues podcast #79 where they talked about | |
# documentation in Ruby, and specifically grumbled quite a bit about the failings of RDoc. | |
# | |
# http://rubyrogues.com/079-rr-documenting-code/ | |
# | |
# As someone who's spent a lot of time using an IDE for programming C# and Java, I think | |
# Ruby could do a lot better at putting documentation at our fingertips as we program. | |
# | |
# Maybe making the documentation part of the structure of the code would facilitate this? | |
# |
## | |
# Make Rack look like node. | |
# | |
# http://youtu.be/Zp91yUH-zAw | |
require 'node_adapter' | |
use Rack::Chunked | |
run createServer { |req, res| |
require "thread" | |
class Future | |
attr_reader :exception, :cancelled | |
def initialize(&block) | |
@thread = Thread.new(&block) | |
@thread.abort_on_exception = false | |
@exception = nil | |
@cancelled = false |
#!/usr/bin/ruby1.9 | |
require 'fiber' | |
require 'benchmark' | |
class Ring | |
attr_reader :id | |
attr_accessor :attach | |
def initialize(id) |