Skip to content

Instantly share code, notes, and snippets.

Brett Zamir brettz9

Block or report user

Report or block brettz9

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@brettz9
brettz9 / OpenInTerminalTab.sh
Last active May 12, 2019
Sourcetree Custom action to open in Terminal *tab*; need `chmod 0755 OpenInTerminalTab.sh` enable SourceTree in `System Preferences->Security & Privacy->Privacy->Accessibility`; note: implementing as an application did not seem to work from within Sourcetree
View OpenInTerminalTab.sh
#!/bin/sh
dir=$(dirname "$1")
scr=$(cat <<EOF
on run {}
set directory to "$dir"
set newTab to (application "Terminal" is running)
tell application "Terminal"
activate
View timeout.js
const timeout = (delay) => {
// eslint-disable-next-line promise/avoid-new
return new Promise((resolve) => {
setTimeout(() => {
resolve();
}, delay || 0);
});
};
@brettz9
brettz9 / sourcetree.md
Last active May 12, 2019
Sourcetree Custom Actions (right-click)
View sourcetree.md

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
View open-in-sourcetree.coffee
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 Sep 28, 2018 — forked from harto/before.js
Mocha before() & beforeEach() execution order with nested describe()
View before.js
'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 Apr 24, 2019
Gist Table of Contents (focusing for now on still useful items or at least interesting experiments); also may organize info on repos
View Table-of-Contents.md
@brettz9
brettz9 / speech.html
Last active Sep 15, 2018
SpeechRecognition
View speech.html
<!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 Jun 1, 2017
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
View fixed-table-header.css
/*
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 Mar 21, 2017
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
View console-log.html
<!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 Jan 1, 2017
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.
View openThunderbirdMail.js
/*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/
You can’t perform that action at this time.