View string-replace.js
if ('a'.replace(/(z)|./, function(match, g1) { return typeof g1; }) !== 'undefined') {
String.prototype.replace = (function (native_method) {
return function (pattern, callback) {
if (pattern.constructor.name !== 'RegExp' || typeof callback !== 'function') {
return native_method.call(this, pattern, callback);
}
var result = '', source = String(this), length = source.length, lastIndex = 0, index, match;
pattern.lastIndex = 0;
while ((match = pattern.exec(source))) {
index = match.index;
View Rakefile.rb
=begin
To use this build script, first install the bundler gem:
$ gem install bundler
Then use the `bundle` command to install the dependencies into the project:
$ rm -rf Gemfile.lock .bundle
bundle config --local git.allow_insecure true
bundle config --local build.nokogiri --use-system-libraries
View asciimath.adoc
\$sum_(i=1)^n i^3=((n(n+1))/2)^2\$
AsciiDoc source
:stem: asciimath
View table.adoc
Column A Column B Column C

A1

B1

C1

A2

B2

C2

View angular-localizer-treeprocessor.rb
#!/usr/bin/env ruby
require 'asciidoctor/extensions'
class AngularLocalizerTreeprocessor < Asciidoctor::Extensions::Treeprocessor
def process document
document.blocks? ? (localize_blocks document) : nil
end
def localize_blocks node
View apache-tomee-datanucleus.adoc

Using DataNucleus as the JPA provider in Apache TomEE

DataNucleus can be used as an alternate JPA provider in TomEE. This document describes how to make this switch. These instructions assume you are using container-managed JPA.

View build.gradle
buildscript {
dependencies {
classpath 'org.asciidoctor:asciidoctorj:1.5.4.1'
}
}
plugins {
id 'org.asciidoctor.convert' version '1.5.3'
id 'com.github.jruby-gradle.base' version '1.3.3'
}
View jdk-install-path.sh
#!/bin/sh
jrunscript -e 'print(java.lang.System.getProperty("java.home").replaceAll("\\"+java.io.File.separator+"jre$",""))'
View slide-transformer.rb
require 'asciidoctor/extensions'
# Reconfigure AST to convert all blocks with the role SLIDE into
# sections and transferring the content to the new sections.
Asciidoctor::Extensions.register do
treeprocessor do
process do |doc|
doc.blocks.replace (doc.find_by role: 'SLIDE').map {|slide|
slide.parent.blocks.delete slide
sect = Asciidoctor::Section.new doc, 1, false
View asciidoctor-pdf-stack-traces.adoc

First stack

NormalCachingCallSite(CachingCallSite).callBlock(ThreadContext, IRubyObject, IRubyObject, Block) line: 143
NormalCachingCallSite(CachingCallSite).callIter(ThreadContext, IRubyObject, IRubyObject, Block) line: 154