Skip to content

Instantly share code, notes, and snippets.

@brettz9
brettz9 / sourcetree.md
Last active May 12, 2019 00:18
Sourcetree Custom Actions (right-click)

ATOM:

  • Menu Caption: Open in Atom
  • Script to run: /usr/local/bin/atom
  • Parameters: -n false -a $REPO

Terminal:

  • Menu Caption: Open in Terminal Tab
  • Script to run: /Applications/TerminalTab.sh
  • Parameters: Parameters: $REPO/$FILE
fs = require('fs')
path = require('path')
{CompositeDisposable} = require 'atom'
ProjectPathListView = require './project-path-list-view'
getActiveFilePath = () ->
document.querySelector('.tree-view .selected')?.getPath?() ||
atom.workspace.getActivePaneItem()?.buffer?.file?.path
@brettz9
brettz9 / before.js
Created September 28, 2018 13:58 — forked from harto/before.js
Mocha before() & beforeEach() execution order with nested describe()
'use strict';
describe('mocha before hooks', function () {
before(() => console.log('*** top-level before()'));
beforeEach(() => console.log('*** top-level beforeEach()'));
describe('nesting', function () {
before(() => console.log('*** nested before()'));
beforeEach(() => console.log('*** nested beforeEach()'));
it('is a nested spec', () => true);
});
@brettz9
brettz9 / Table-of-Contents.md
Last active August 7, 2026 08:49
Gist Table of Contents (focusing for now on still useful items or at least interesting experiments); also may organize info on repos
@brettz9
brettz9 / speech.html
Last active September 15, 2018 17:08
SpeechRecognition
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<title>Speech transcription</title>
<style>
#transcriptionResults {
width: 100%;
height: 500px;
}
@brettz9
brettz9 / fixed-table-header.css
Last active June 1, 2017 07:27
Boiled down, heavily annotated demo from https://jsfiddle.net/dPixie/byB9d/3/light/ on (relatively) fixed table headers (and footers added); JSFiddle at https://jsfiddle.net/2319nrfp/8/ . See also http://salzerdesign.com/test/fixedTable.html and http://salzerdesign.com/blog/?p=191
/*
Originally from: https://jsfiddle.net/dPixie/byB9d/3/light/
See also http://salzerdesign.com/test/fixedTable.html and http://salzerdesign.com/blog/?p=191
*/
html, body {
height: 100%; /* Needed to ensure descendent heights retain 100%; could be avoided if didn't want percent on table height */
}
@brettz9
brettz9 / console-log.html
Last active March 21, 2017 02:53
Override console methods to include file/line number (and potentially full stack). TODO: Pass suspected suspect line and whole stack with modified content to callback. For background, see http://stackoverflow.com/questions/13815640/a-proper-wrapper-for-console-log-with-correct-line-number/42860910#42860910
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<script src="console-log.js"></script>
</head>
<body>
<script>
function a () {
console.log('xyz'); // xyz (console-log.html:10)
@brettz9
brettz9 / openThunderbirdMail.js
Last active January 1, 2017 01:49
Snippet for use with [Custom Buttons](https://addons.mozilla.org/en-US/thunderbird/addon/custom-buttons/) to open a specific email in Thunderbird from a custom toolbar button.
/*CODE*/
/*
See:
- https://dxr.mozilla.org/comm-central/source/mail/base/modules/
- https://dxr.mozilla.org/comm-central/source/mailnews/base/public/nsIMsgHdr.idl
- https://searchcode.com/codesearch/view/21378574/ (Gloda)
- https://searchcode.com/codesearch/view/21377672/ (datamodel.js)
- https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIMsgDBHdr
- eMarks souce! https://addons.mozilla.org/en-US/thunderbird/addon/emarks/
@brettz9
brettz9 / colors.js
Last active December 29, 2016 23:44
A close substitute for [colors.js](https://github.com/Marak/colors.js) in the browser. See https://jsfiddle.net/fbe4s9ry/ . Plan to move to https://github.com/brettz9/styled-log
const colors = new Proxy({
setTheme: function (theme) {
this._theme = theme;
},
log: function (msgColor) {
console.log(...msgColor);
}
}, {
get: function (target, name) {
if (['setTheme', 'log', '_theme'].includes(name)) {
// ID_Start (includes Other_ID_Start)
shimIndexedDB.__setConfig(
'UnicodeIDStart'
'(?:[$A-Z_a-z\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B4\\u08B6-\\u08BD\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0