Skip to content

Instantly share code, notes, and snippets.

View Merovex's full-sized avatar

Ben W Merovex

  • Gainfully Employed
  • In a hidden bunker under a non-descript building
  • 00:41 (UTC -04:00)
View GitHub Profile
export default function parseToMarkdown(chunk) {
let children = !chunk.type
? chunk.text
: chunk.children.map(c => parseToMarkdown({ ...c, parentType: chunk.type })).join('');
if (children === '') return;
// formatting
if (chunk.bold) {
children = `**${children.trim()}** `;
-- Converts "* * *" Horizontal Rule to a "#" separator in Word DOCX
local hashrule = [[<w:p>
<w:pPr>
<w:pStyle w:val="HorizontalRule"/>
<w:ind w:firstLine="0"/>
<w:jc w:val="center"/>
</w:pPr>
<w:r>
<w:t>#</w:t>
</w:r>
@Merovex
Merovex / _contrast.scss
Last active December 22, 2019 19:22
Ensures color contrast for Accessibility, with decent granularity.
@function pow($base, $exponents) {
$raised: 1;
@for $i from 1 through $exponents {
$raised: $raised * $base;
}
@return $raised;
}
@function luma($color){
// Thanks voxpelli for a very concise implementation of luminance measure in sass
// Adapted from: https://gist.github.com/voxpelli/6304812
@Merovex
Merovex / Commit Formatting.md
Created July 11, 2019 21:58 — forked from brianclements/Commit Formatting.md
Angular Commit Format Reference Sheet

Git Commit Guidelines

We have very precise rules over how our git commit messages can be formatted. This leads to more readable messages that are easy to follow when looking through the project history. But also, we use the git commit messages to generate the AngularJS change log.

Commit Message Format

Each commit message consists of a header, a body and a footer. The header has a special format that includes a type, a scope and a subject:

PATH=$PATH:/usr/local/bin:/usr/local/sbin
#!/bin/bash
gitbranch=`git rev-parse --abbrev-ref HEAD`
if [ $gitbranch = "master" ]; then
date=`date +%m/%d/%Y`
datetime=`date +%r`
gitwa=`git diff HEAD^ HEAD --word-diff=porcelain | grep -e "^+[^+]" | wc -w`
gitwd=`git diff HEAD^ HEAD --word-diff=porcelain | grep -e "^-[^-]" | wc -w`
commit=`git log -1 --pretty=%B`
cnt=`expr $gitwa - $gitwd`
@Merovex
Merovex / config.yml
Created October 9, 2017 15:06 — forked from retrage/config.yml
config.yml for Latex on Circle CI 2.0
version: 2
jobs:
build:
docker:
- image: paperist/alpine-texlive-ja
steps:
- run:
name: Installing dependancies
command: |
apk add --update git patch curl
@Merovex
Merovex / auto-commit.rb
Last active April 2, 2017 13:55
Auto Commit Git repo to GitHub
#!/bin/ruby
File.read("/PATH-TO/.auto-commit").split("\n").each do |dir|
Dir.chdir(dir)
next if `find . -newer .last-mod`.split("\n").empty? # No change to file system
puts "### #{Time.new.strftime("%Y-%m-%d %H:%M:%S")} (#{dir}) ###"
`git pull origin $(git symbolic-ref HEAD | cut -d'/' -f3)`
`git add . -A`
@Merovex
Merovex / gist:16b584a1cfab090d2b81fefb14987ed7
Created December 2, 2016 02:06 — forked from kaizhu256/gist:4482069
javascript - very fast and simple uuid4 generator benchmarked on http://jsperf.com/uuid4/8
/*jslint bitwise: true, indent: 2, nomen: true, regexp: true, stupid: true*/
(function () {
'use strict';
var exports = {};
exports.uuid4 = function () {
//// return uuid of form xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx
var uuid = '', ii;
for (ii = 0; ii < 32; ii += 1) {
@Merovex
Merovex / git-wars.md
Created October 15, 2016 16:01 — forked from juderosen/git-wars.md
Git Wars: GitHub vs Bitbucket

Git Wars: GitHub vs Bitbucket

Introduction

Now, you might think the answer I'm going to give you is already obvious because I'm using GiHub right now, but it's not. Both GitHub and Bitbucket offer great Git services, but each has its own features and pricing plans. In the following... thing, I'm going to compare the two and then offer a final solution that should work for most people.

TL;DR: Both. Use GitHub for open source and public repos (you'll spend most of your time here) and Bitbucket for private repos. But, sign up for GitHub first, then import account into Bitbucket. Also, check comments for updates. P.S. I personally prefer GitHub.

Interface and Functionality

#!/path/to/bin/ruby
Encoding.default_external = Encoding::UTF_8 # Stops LaunchD from carping
Encoding.default_internal = Encoding::UTF_8 # Ditto
require 'rubygems'
require 'json'
require 'date'
require "pathname"
require "erb"
require "yaml"