Skip to content

Instantly share code, notes, and snippets.


Dan Allen mojavelinux

View GitHub Profile
mojavelinux / app.rb
Created Mar 4, 2022
Ruby program to print Hello, World!
View app.rb
puts 'Hello, World!'
mojavelinux / module-lookup-paths.js
Created Sep 17, 2021
Shows where Node.js is looking to find a module
View module-lookup-paths.js
const Module = require('module')
Module._resolveLookupPaths = new Proxy(Module._resolveLookupPaths, {
apply(target, self, args) {
return target.apply(self, args)
View graceful-vfs-src-with-gs-and-pipeline.js
const fs = require('fs')
const gs = require('glob-stream')
const File = require('vinyl')
const { Transform } = require('stream')
const map = (transform) => new Transform({ objectMode: true, transform })
const ospath = require('path')
//const isUTF8 = require('is-utf8')
const { pipeline } = require('stream')
function smartStat (path_, callback) {
mojavelinux / actual.png
Last active Dec 7, 2020
Flexbox alignment challenge: How do we get the green boxes to be flush with the right margin while keeping the wrap behavior the same?
mojavelinux / jruby-thread-safety-test.rb
Created Apr 7, 2020
JRuby thread safety test with Asciidoctor PDF and Rouge
View jruby-thread-safety-test.rb
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 / file.rb
Last active Jan 23, 2020
View file.rb
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?
mojavelinux /
Created Jan 19, 2020
Script to cut Asciidoctor EPUB3 release
# GEM_VERSION=1.5.0.alpha.10 ./ -p
while getopts "p" option; do
case $option in
p) PUSH=true ;;
mojavelinux / syntax-highlighter-rouge.rb
Last active Mar 22, 2019
Prototype of the Rouge syntax highighter integration for Asciidoctor. Now bundled with Asciidoctor. See
View syntax-highlighter-rouge.rb
class RougeSyntaxHighlighter < Asciidoctor::SyntaxHighlighter::Base
register_for 'rouge'
def initialize *args
@requires_stylesheet = nil
@style = nil
def highlight?
mojavelinux / syntax-highlighter-prism.rb
Last active Oct 19, 2020
Prototype of the Prism syntax highighter integration for Asciidoctor
View syntax-highlighter-prism.rb
class PrismSyntaxHighlighter < Asciidoctor::SyntaxHighlighter::Base
register_for 'prism'
def format node, lang, opts
opts[:transform] = proc do |pre, code|
if node.attr? 'linenums', nil, false
pre['class'] += ' line-numbers'
if (start = node.attr 'start', nil, false)
pre['data-start'] = start