Skip to content

Instantly share code, notes, and snippets.

View bbrown's full-sized avatar

Bill Brown bbrown

View GitHub Profile
@bbrown
bbrown / Preferences.sublime-settings
Created August 5, 2021 16:57
Current Sublime Text 3 settings
{
"auto_complete_triggers":
[
{
"characters": "<",
"selector": "text.html",
},
{
"characters": ".",
"selector": "source.js",
@bbrown
bbrown / query-favorites
Created April 8, 2021 00:14
Exported Sequel Pro Query Favorites
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>encrypted</key>
<false/>
<key>format</key>
<string>query favorites</string>
<key>queryFavorites</key>
<array>
@bbrown
bbrown / semver-version.md
Last active April 17, 2018 21:57
Ways to specify versions in npm dependencies
  • version Must match version exactly
  • >version Must be greater than version
  • >=version etc
  • <version
  • <=version
  • ~version "Approximately equivalent to version"
  • ^version "Compatible with version"
  • 1.2.x 1.2.0, 1.2.1, etc., but not 1.3.0
  • http://... See 'URLs as Dependencies' below
  • * Matches any version
@bbrown
bbrown / my.cnf
Created September 14, 2017 13:51
Local Mac OS X MySQL configuration, designed to get around "File Descriptor 2040 exceeded FD_SETSIZE=1024" errors
# Default Homebrew MySQL server config
[mysqld]
#interactive_timeout = 300
#wait_timeout = 300
max_allowed_packet=256M
table_open_cache=250
# Only allow connections from localhost
bind-address = *
#skip-networking
@bbrown
bbrown / regex-title_case.md
Created August 4, 2017 23:17
Regular expression to title case a word (doesn't handle words separated spaces)

Find: ([A-Z])([a-zA-Z]*)

Replace: $1\L$2

@bbrown
bbrown / karabiner.json
Created July 25, 2017 20:39
My current Karabiner Elements configuration
{
"global": {
"check_for_updates_on_startup": true,
"show_in_menu_bar": false,
"show_profile_name_in_menu_bar": false
},
"profiles": [
{
"complex_modifications": {
"parameters": {
@bbrown
bbrown / jira-versions-count.js
Created May 15, 2017 22:58
Use JIRA's list of versions to get some quick and dirty date-based release counts
var versions = "Array from https://jira/rest/api/2/project/projectKey/versions";
var dateRegex = /([0-9]{4})([0-9]{2})([0-9]{2})[0-9]{4}/;
var counts = {};
versions.forEach(function(version)
{
if (dateRegex.test(version.name))
{
var dateParts = dateRegex.exec(version.name);
var yearKey = "" + dateParts[1];
@bbrown
bbrown / tsql-list-locks.sql
Created March 29, 2016 15:57
SQL query to list all locks in a database
-- via https://gallery.technet.microsoft.com/scriptcenter/List-all-Locks-of-the-2a751879
SELECT TL.resource_type AS ResType
,TL.resource_description AS ResDescr
,TL.request_mode AS ReqMode
,TL.request_type AS ReqType
,TL.request_status AS ReqStatus
,TL.request_owner_type AS ReqOwnerType
,TAT.[name] AS TransName
,TAT.transaction_begin_time AS TransBegin
,DATEDIFF(ss, TAT.transaction_begin_time, GETDATE()) AS TransDura
@bbrown
bbrown / setPrintToLandscape.js
Last active March 2, 2016 21:30
Angular directive that sets the page's orientation to landscape for printing
angular.module("app").directive("setPrintToLandscape", function($document)
{
return {
restrict: "AE",
link: function link(scope)
{
// Currently only supported in Chrome.
// FF - https://bugzilla.mozilla.org/show_bug.cgi?id=851441
// Safari - https://bugs.webkit.org/show_bug.cgi?id=63575
var newSheet = angular.element("<style/>").attr({ "type":"text/css", "media":"print" });
@bbrown
bbrown / clickToEdit.js
Last active March 2, 2016 21:08
Angular directive to navigate around table cells and edit them
angular.module("app").directive("clickToEdit", function()
{
return {
restrict: "A",
link: function link(scope, element)
{
var LEFT = 37, UP = 38, RIGHT = 39, DOWN = 40, ENTER = 13;
var navKeys = [ LEFT, UP, RIGHT, DOWN, ENTER ];
element.attr("contenteditable", true);
element.on("focus", function(e)