Skip to content

Instantly share code, notes, and snippets.

@Mike-Dunton
Mike-Dunton / Collatz.js
Last active August 9, 2016 21:49
Collatz conjecture in js
// Return Collatz sequence in an array.
// Linear Vs Tail Recursion in Javascript
// http://jsperf.com/collatz-conjecture-linear-vs-tail
//===================================================================================================================
function collatzTail(n, accumulator){
if(n === 1) {
accumulator.push(1);
return accumulator;
} else if(isEven(n)) {
accumulator.push(n);
@tbranyen
tbranyen / git_profanity_check.js
Last active October 8, 2021 23:02
git profanity check
#!/usr/bin/env node
// Copyright 2011, Tim Branyen @tbranyen <tim@tabdeveloper.com>
// Last Updated: Oct 2021 - Supports NodeGit 0.27.0
// Dual licensed under the MIT and GPL licenses.
// Script to detect cursewords in commit messages and provide the
// offending commit sha's.
// vim: ft=javascript
const { Repository } = require('nodegit');