Skip to content

Instantly share code, notes, and snippets.

View mojavelinux's full-sized avatar

Dan Allen mojavelinux

View GitHub Profile
@mojavelinux
mojavelinux / nodegit-private-clone-test.js
Created May 21, 2018 08:45
Clone a private repository using nodegit
const git = require('nodegit')
const fs = require('fs-extra')
const { URL } = require('url')
const REPO_URL = 'git@github.com:org/path.git'
const CLONE_DIR = '/tmp/private-repo-clone-test'
;(async () => {
await fs.emptyDir(CLONE_DIR)
let authAttempted = false
await git.Clone.clone(REPO_URL, CLONE_DIR, {
@mojavelinux
mojavelinux / module-lookup-paths.js
Created September 17, 2021 06:37
Shows where Node.js is looking to find a module
const Module = require('module')
Module._resolveLookupPaths = new Proxy(Module._resolveLookupPaths, {
apply(target, self, args) {
console.dir(args[1].paths)
return target.apply(self, args)
}
})
require('name-of-module')
@mojavelinux
mojavelinux / gs-messaging-jms.adoc
Last active September 6, 2021 03:37
Spring Guides: Messaging with JMS

Messaging with JMS

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
mojavelinux / Writing Tools Writeup.markdown
Created January 30, 2012 18:56 — forked from matthewmccullough/Writing Tools Writeup.md
How To Write A Technical Book (One Man's Modest Suggestions)
@mojavelinux
mojavelinux / .vimrc
Created December 5, 2012 08:43
AsciiDoc insert-mode mapping helpers for VIM
let mapleader=";"
inoremap <Leader><Leader> <Leader>
if has("autocmd")
au BufRead,BufNewFile *.asciidoc
\ imap <buffer> <C-]> <C-o>B<C-o>E<Right><Space>|
\ imap <buffer> <C-i> <C-o>$<CR><CR>|
\ imap <buffer> <C-j> <Down><C-o>o<CR>|
\ imap <buffer> <Leader>h1 = |
\ imap <buffer> <Leader>h2 == |
@mojavelinux
mojavelinux / transcript.adoc
Created September 23, 2015 05:22
Write in AsciiDoc, Publish Everywhere: Transcript

Write in AsciiDoc, Publish Everywhere: Transcript

!

Bonjour et bienvenue à Mix-IT. Merci d’être présent à ma conférence. Je suis Dan Allen, le créateur du project Asciidoctor. Aujourd’hui, je vais vous expliquer les bonnes pratiques pour écrire en AsciiDoc…​ Alors, I’ve been spending too much time practicing my French.

@mojavelinux
mojavelinux / actual.png
Last active December 7, 2020 10:41
Flexbox alignment challenge: How do we get the green boxes to be flush with the right margin while keeping the wrap behavior the same?
actual.png
@mojavelinux
mojavelinux / generate-cjk-font.pe
Created December 31, 2014 09:53
Distill the NotoSansCJK otf fonts into something we can use in Asciidoctor PDF (and Asciidoctor EPUB3)
#!/usr/bin/env fontforge
# * 0x90 - Neither OpenType or Apple
# * 0x800 - Generate old-style 'kern' table
# * 0x08 - Exclude TrueType instructions
# For PDF
genflags = 0x90 + 0x08 + 0x800
# For EPUB3
@mojavelinux
mojavelinux / syntax-highlighter-prism.rb
Last active October 19, 2020 02:41
Prototype of the Prism syntax highighter integration for Asciidoctor
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
end