Skip to content

Instantly share code, notes, and snippets.

@janlelis
janlelis / rdoc2md
Last active August 29, 2015 14:17 — forked from teeparham/rdoc2md.rb
#!/usr/bin/env ruby
require 'rdoc'
puts RDoc::Markup::ToMarkdown.new.convert File.read(ARGV[0] || 'README.rdoc')
# ./rdoc2md > README.md
# ./rdoc2md ABC.rdoc > abc.md
@janlelis
janlelis / goto.patch
Created April 28, 2015 16:55
rvm install 2.2.2 -n goto --patch http://git.io/vfxF2
From 4787399d0ffc0c8e01747713e8da91de2257bcf5 Mon Sep 17 00:00:00 2001
From: Jan Lelis <mail@janlelis.de>
Date: Tue, 28 Apr 2015 18:52:53 +0200
Subject: [PATCH] activate goto in ruby
---
vm_opts.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/vm_opts.h b/vm_opts.h
require "benchmark/ips"
puts RUBY_DESCRIPTION
class Inherit < Struct.new(:id, :name, :age)
def name_and_age
"#{name}, #{age}"
end
end
module Rack
# Renders a valid robots.txt according to http://www.robotstxt.org
# This is an example of over-engineering. But it's simple example of
# how you might test your middleware.
class RobotsTxt
def initialize(app)
@app = app
end
def call(env)
@janlelis
janlelis / pws.rb
Created November 1, 2010 16:58
Build your own PasswordSafe with Ruby
# pws has been refactored! See https://github.com/janlelis/pws
#! /usr/bin/env ruby
status = DATA.flock(File::LOCK_EX | File::LOCK_NB)
if status == 0
puts "we have the lock..."
sleep
else
@thammi
thammi / alarm.py
Created January 6, 2011 11:01
Pizza alarm clock written waiting for a pizza
#!/usr/bin/env python
##############################################################################
##
## Copyright (C) 2010 Thammi
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
@rkh
rkh / verb_tester.rb
Created March 20, 2011 14:49
Sinatra app to test what verbs your browser supports for forms, it's probably just POST and GET, though... :(
require 'sinatra'
require 'coffee-script'
require 'slim'
require 'sass'
enable :sessions
helpers do
def verbs(&block)
verbs.each(&block) if block
@cldwalker
cldwalker / .riplrc
Created April 24, 2011 20:22
ripl multi-line history plugin - two ways to easily access last edited code block
# Add to ~/.riplrc
module Ripl::MultiLineHistory
attr_reader :last_buffer
# hacks multi-line's loop_once
def loop_once
@igrigorik
igrigorik / Gemfile
Created August 26, 2011 06:33
HTML5 SSE / EventSource demo with Goliath
source :gemcutter
gem 'goliath', :git => 'git://github.com/postrank-labs/goliath.git'
gem 'em-synchrony', :git => 'git://github.com/igrigorik/em-synchrony.git'