This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "benchmark/ips" | |
puts RUBY_DESCRIPTION | |
class Inherit < Struct.new(:id, :name, :age) | |
def name_and_age | |
"#{name}, #{age}" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# christmas tree (golfed version): http://www.ruby-mine.de/2009/11/22/weihnachten | |
puts"Grösse?" | |
(Z.times{|n|0.upto(Z){puts" "*(2*Z-n)+"*%d"%(n+=1)*n} | |
$*<<"%#{2*Z+2}s"%:II} | |
puts$*)if 0<Z=gets.to_i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pws has been refactored! See https://github.com/janlelis/pws |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# hole 3 in 93 bytes (only counting newlines between method body) | |
# see http://rubysource.com/ruby-golf/ | |
def play(i) | |
s=%w[Rock Paper Scissors] | |
p=s.index i | |
s[c=rand(3)]+",#{p==c ?:Draw: p&&p==-~c%3?:Win: :Lose}" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
var pagination = function(){ | |
var hash = window.location.hash.substr(1); | |
if(hash && !document.getElementById(hash)){ | |
var per_page = {{ paginator.per_page }}; | |
var post_ids = [ | |
{% for post in site.posts %} | |
"{{ post.id | replace:'"','\"' }}", | |
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'coderay' | |
require 'set' | |
module RubyIndentation | |
VERSION = '0.2.0' | |
def self.[](buffer) | |
opening_and_modifier_tokens = %w[if unless until while].to_set | |
opening_tokens = %w[begin case class def for module do {].to_set | |
closing_tokens = %w[end }].to_set |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
invoke() | |
{ | |
echo "[$1]" | |
su - palava -c "ruby -S palava-machine-daemon $1" | |
} | |
start_multiple() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream palava_machine { | |
server 127.0.0.1:4240; | |
} | |
server { | |
listen 443 ssl; | |
server_name example.com; # TODO | |
ssl on; | |
ssl_certificate /path/to/your/ssl/cert.crt; # TODO |
OlderNewer