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 / asciidoctor-browser-include-spec.adoc
Last active March 15, 2018 07:41
Asciidoctor browser include spec: Specifies how Asciidoctor resolves the target of an include directive in the browser environment.

Include directive processing in the browser

This document describes how the include directive is processed in the browser environment (xmlhttprequest IO module). This handling has slightly different rules than when a file-based document. The rules are listed in the order in which they are applied.

In these definitions, there are several commonly occurring terms that pertain to the include directive:

  • target - the target of the include directive as specified in the document

  • include path - the resolved path of the include; usually an absolute path or URL

@mojavelinux
mojavelinux / echo-template-literal.js
Created January 2, 2018 03:27
A simple JavaScript template literal function that echos the string, populating all interpolated values.
/**
* Usage:
* const name = 'World'
* const place = '2018'
* console.log(echo`Hello, ${name}. Welcome to ${place}.`)
*/
function echo (literals, ...values) {
return literals.length > 1
? values.reduce((accum, value, idx) => accum + value + literals[idx + 1], literals[0])
: literals[0]
@mojavelinux
mojavelinux / twitter.css
Last active June 17, 2017 20:23
User style to make Twitter square (and less bold) again; domain: twitter.com (for use with https://chrome.google.com/webstore/detail/stylist/pabfempgigicdjjlccdgnbmeggkbjdhd)
/*.content-main {
width: 600px;
}
.dashboard {
width: 285px;
}
.DashboardProfileCard-bg {
height: 94px;
@mojavelinux
mojavelinux / jekyll-asciidoctor-diagram.adoc
Last active November 26, 2022 13:06
How to configure Asciidoctor Diagram in a Jekyll site

How to configure Asciidoctor Diagram in a Jekyll site

Generate site

$ cd /tmp
$ mkdir jekyll-site-creator
@mojavelinux
mojavelinux / gitlab-readable.css
Last active May 12, 2017 00:45
Readable user style for GitLab Issues; match: ^https://gitlab\.com/.*/issues/.*$
.md, .wiki {
font-family: "Droid Serif";
font-size: 1.2em;
line-height: 1.6;
}
ul.notes .note .note-body .note-text p, .wiki p {
margin-top: 0.75em;
}
@mojavelinux
mojavelinux / writers-write-bof-notes.adoc
Created April 28, 2017 09:32
Writers Write BOF Notes: Devoxx 2016

Writers Write BOF at Devoxx BE, 2016

Dan Allen, the lead moderator, welcomed everyone and encouraged everyone to participate We’re here to talk about writing, primarily technical documentation but beyond that too. Team organisation Technical challenges

Introductions. A broad cross-section of roles, interests, and tools:

  • Developers

@mojavelinux
mojavelinux / writers-write-bof-topics.adoc
Last active April 28, 2017 09:33
Writers Write BOF Topics

Writers Write BOF Topics

Lead Editor

Much like roommates in a shared flat, a documentation group needs to find a way to make it work by agreeing on how to routine tasks / chores. What can help with this is having a lead editor. The lead editor can ensure a consistent style.

Support Engineers

@mojavelinux
mojavelinux / string-replace.js
Last active April 7, 2017 02:17
A polyfill for the JavaScript String#replace function that uses undefined instead of empty string for non-participating groups. See http://blog.stevenlevithan.com/archives/npcg-javascript
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;
@mojavelinux
mojavelinux / Rakefile.rb
Last active April 18, 2017 22:18
Rake build tasks that use Asciidoctor APIs to produce common output formats for a book (or other type of publication) written in AsciiDoc.
=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