This file contains hidden or 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
4 4 M | |
1 1 1 | |
1 2 2 | |
3 2 4 | |
3 4 5 | |
0 0 0 |
This file contains hidden or 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 'gollum-lib' | |
require 'benchmark' | |
def do_benchmark(*args) | |
Benchmark.bm(10) do |x| | |
x.report { 5.times do | |
send(*args) | |
end } | |
end | |
end |
This file contains hidden or 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 'open3' | |
require 'docker' | |
require 'stringio' | |
content = <<EOF | |
```{r first_r_chunk} | |
vec <- c(1, 2, 3) | |
cat(readLines("/etc/passwd"), sep="\n") | |
print(vec) |
This file contains hidden or 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 | |
#coding:utf-8 | |
require 'optparse' | |
require 'pathname' | |
require 'rubygems' | |
REPO = ARGV[0] || Dir.pwd | |
wiki_options = {} |
This file contains hidden or 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
query = '+"XYZ" foo -"bar" "hobbit fan"' | |
search_terms = [] | |
absent = [] | |
present = [] | |
query.scan(/([-+])?"([^"]+)"|(\S+)/) do | |
term = Regexp.last_match[2] || Regexp.last_match[3] | |
term = Regexp.escape(term) |
This file contains hidden or 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
# Loads sub pages. Sub page names (footers, headers, sidebars) are prefixed with | |
# an underscore to distinguish them from other Pages. If there is not one within | |
# the current directory, starts walking up the directory tree to try and find one | |
# within parent directories. | |
def find_sub_pages(subpagenames = SUBPAGENAMES, map = nil) | |
puts "FINDING SUB PAGES" | |
subpagenames.each{|subpagename| instance_variable_set("@#{subpagename}", nil)} | |
return nil if self.filename =~ /^_/ || ! self.version | |
valid_names = %r{^_#{subpagenames.map(&:capitalize).join("|")}} |
This file contains hidden or 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
get '/' | |
get '/*' | |
get %r{/(.+?)/([0-9a-f]{40})} # Specific version of a page or file | |
namespace '/gollum' do | |
get '/last-commit-info' | |
get '/emoji/:name' | |
get '/data/*' # Maybe rename to 'raw'? | |
get '/edit/*' | |
get '/history/*' |
This file contains hidden or 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
# Parse elements from the Elements Reference into a ruby array (to construct a `Sanitize` gem hash for `gollum`): | |
# https://developer.mozilla.org/en-US/docs/Web/MathML/Element | |
# See https://github.com/gollum/gollum-lib/pull/266 | |
# Step 1: copy the *source* of https://developer.mozilla.org/en-US/docs/Web/MathML/Element (hit the 'Edit' button), at least of the part of the page containing the alphabetical element list. | |
# Step 2: save this as `mathml_elements.txt` | |
# Step 3: | |
grep MathMLElement mathml_elements.txt | awk -F'"' '{print $2}' > mathml_elements | |
# Step 4: | |
for line in `cat mathml_elements`; do echo "'$line',"; done | |
# Step 5 copy/paste result into ruby array (be sure to remove the comma after the last element): |
This file contains hidden or 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
# This file is used by Rack-based servers to start the application. | |
require 'sinatra' | |
require ::File.expand_path('../config/environment', __FILE__) | |
JAVA_FIRST_RUN = java.lang.System.getProperty('setup_db') | |
map '/' do | |
if JAVA_FIRST_RUN | |
run RepotagConfig | |
else |
This file contains hidden or 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
<p><a href="Home">» JRuby Project Wiki Home Page</a> | |
<h1>Embedding JRuby</h1> | |
Using Java from Ruby is JRuby's best-known feature---but you can also go in the other direction, and use Ruby from Java. There are several different ways to do this. You can execute entire Ruby scripts, call individual Ruby methods, or even implement a Java interface in Ruby (thus allowing you to treat Ruby objects like Java ones). We refer to all these techniques generically as "embedding." This section will explain how to embed JRuby in your Java project. | |
</p> | |
<p><table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Table of Contents</h2></div><ul></li><li><a href="<a class="tweet-url hashtag" href="https://twitter.com/#!/search?q=%23Red_Bridge_JRuby_Embed" rel="nofollow" title="#Red_Bridge_JRuby_Embed">#Red_Bridge_JRuby_Embed</a>">Red Bridge (JRuby Embed)</a><ul><li><a href="<a class="tweet-url hashtag" href="https://twitter.com/#!/search?q=%23Features_of_Red_Bridge" rel="nofollow" title="#Feature |
NewerOlder