Skip to content

Instantly share code, notes, and snippets.

View mojavelinux's full-sized avatar

Dan Allen mojavelinux

View GitHub Profile
@mojavelinux
mojavelinux / examples.md
Last active September 3, 2020 17:04
Menu and key macros for AsciiDoc

Examples of custom macros for AsciiDoc

Path

path:/home/dallen/[]
path:/etc/my.cnf[]

Key

key:Enter[]

@mojavelinux
mojavelinux / gfm-vs-asciidoc.asciidoc
Created June 26, 2013 18:57
A comparison of GitHub-flavored Markdown syntax versus AsciiDoc syntax, based on examples in the GitHub-flavored Markdown reference. Note that this gist requires Asciidoctor >= 0.1.3 to render properly.
@mojavelinux
mojavelinux / StartupBean.java
Created October 20, 2010 03:41
A sample CDI extension for eagerly instantiating @ApplicationScoped beans annotated @startup
@ApplicationScoped
@Startup
public class StartupBean
{
@PostConstruct
public void onStartup()
{
System.out.println("Application starting up.");
}
}
@mojavelinux
mojavelinux / jruby-thread-safety-test.rb
Created April 7, 2020 10:34
JRuby thread safety test with Asciidoctor PDF and Rouge
require 'asciidoctor-pdf'
require 'java'
java_import 'java.util.concurrent.Callable'
java_import 'java.util.concurrent.FutureTask'
java_import 'java.util.concurrent.LinkedBlockingQueue'
java_import 'java.util.concurrent.ThreadPoolExecutor'
java_import 'java.util.concurrent.TimeUnit'
class App
include Callable
@mojavelinux
mojavelinux / test.asciidoc
Last active February 24, 2020 00:10
A sample AsciiDoc file for testing Asciidoctor.

Asciidoctor Demo

@mojavelinux
mojavelinux / file.rb
Last active January 23, 2020 08:36
File.absolute_path?
class File
class << self
def absolute_path? path
(path.start_with? '/') || (ALT_SEPARATOR && (path.start_with? (absolute_path path).slice 0, 3))
end unless method_defined? :absolute_path?
end
end
@mojavelinux
mojavelinux / cut-release.sh
Created January 19, 2020 00:04
Script to cut Asciidoctor EPUB3 release
#!/usr/bin/bash
# GEM_VERSION=1.5.0.alpha.10 NEXT_GEM_VERSION=1.5.0.alpha.11.dev ./cut-release.sh -p
PUSH=false
while getopts "p" option; do
case $option in
p) PUSH=true ;;
esac
done
@mojavelinux
mojavelinux / textile2asciidoc.rb
Last active September 13, 2019 12:43
A crude script to convert Textile documents to AsciiDoc. Some of the replacements are specific to markup that I use, but hopefully still useful.
#!/usr/bin/env ruby
if ARGV[0].nil?
$stderr.puts 'Must specify an input file'
exit 1
end
source = IO.read(ARGV[0])
title = nil
@mojavelinux
mojavelinux / tutorial.asciidoc
Created January 19, 2012 03:10
JBoss Java EE workshop

JBoss Java EE 6 Workshop

@mojavelinux
mojavelinux / multipage-html5-converter.rb
Created November 3, 2014 06:02
Multipage HTML5 converter for Asciidoctor
require 'asciidoctor'
class MultipageHtml5Converter
include Asciidoctor::Converter
include Asciidoctor::Writer
register_for 'multipage_html5'
EOL = "\n"
def initialize backend, opts