Skip to content

Instantly share code, notes, and snippets.

View brybrophy's full-sized avatar

Bryan Brophy brybrophy

  • Outreach
  • Tacoma, WA, USA
View GitHub Profile
[user]
name = Bryan Brophy
email = brybrophy@gmail.com
[alias]
c = commit -m
st = status --short --branch
ca = commit --amend --reuse-message=HEAD
ce = commit --allow-empty -m
co = checkout
br = branch
@brybrophy
brybrophy / Tomorrow Night Eighties.terminal
Created December 9, 2021 23:12
Tomorrow Night Eighties Terminal Theme
<?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>ANSIBlackColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS
AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NPECQw
LjUwMTk2MDgxNCAwLjUwMTk2MDgxNCAwLjUwMTk2MDgxNAAQAYAC0hAREhNaJGNsYXNz
bmFtZVgkY2xhc3Nlc1dOU0NvbG9yohIUWE5TT2JqZWN0XxAPTlNLZXllZEFyY2hpdmVy
@brybrophy
brybrophy / Notes
Last active January 11, 2023 20:13
This zsh theme is based on Ryan Sobol's fish shell theme.
To make this work like Ryan's original fish shell, install the following ZSH plugins and use the sobol.zsh-theme.
https://github.com/zsh-users/zsh-autosuggestions
https://github.com/zsh-users/zsh-syntax-highlighting
Add this command to your zshrc file.
alias gbra="git branch | grep -v "master" | grep -v "main" | xargs git branch -D"
@brybrophy
brybrophy / CountryCode.enum.ts
Last active October 13, 2021 03:49
Typescript enum of 2 letter country codes.
/*
For an enum of country codes to countries,
See https://gist.github.com/evolkmann/740d24889c509c08484a8ff72af5dd64
*/
/*
For an enum of countries to country codes,
See https://gist.github.com/kyranjamie/646386d5edc174e8b549111572897f81
*/
@brybrophy
brybrophy / closureLogger.js
Created September 30, 2018 22:40
A demonstration of how to use JavaScript closures to create a logged function. The inner function creates a closure containing a function that is passed into the outer function. Each time the inner function is called, it logs that name, arguments, and UTC time that the function in the closure was called.
function createLoggedFunction(fn) {
function loggedFunction(...args) {
const nowUtc = new Date().getTime();
console.log('----Start----');
console.log(`Function ${fn.name} was called with ${args} at ${nowUtc}`);
console.log('-----End-----');
return fn(...args);
};
@brybrophy
brybrophy / palindromeRearranging.js
Created September 25, 2018 19:44
My Code Signal Palindrome Rearranging Solution.
function palindromeRearranging(inputString) {
const charCounts = [...inputString].reduce((counts, char) => {
counts[char] = counts[char] ? counts[char] + 1 : 1;
return counts;
}, {});
return Object.values(charCounts).filter(count => count % 2 !== 0).length <= 1;
}
// First get the character count for each character in the string and store it in an object.
@brybrophy
brybrophy / isCryptSolution.js
Created September 16, 2018 18:04
JS solution to CodeSignal isCryptSolution exercise.
function isCryptSolution(crypt, solution) {
let hasLeadingZeros = false;
const decrypted = crypt.map(word => {
const number = word.split('').map(letter => {
return solution.find(key => key[0] === letter)[1];
}).join('');
if (number.startsWith('0') && number.length > 1) {
hasLeadingZeros = true;
}
@brybrophy
brybrophy / sudoku2.js
Last active August 28, 2018 19:53
CodeSignal sudoku2 Solution
function sudoku2(grid) {
return (
validateRows(grid) &&
validateRows(rotateGrid(grid)) &&
validateSubGrids(grid)
);
}
// Validate each row.
function validateRows(grid) {
import React, { Component } from 'react';
import SmartComponent from './SmartComponent';
export default class App extends Component {
render() {
return <SmartComponent name="World" />;
}
}
import React, { Component } from 'react';
import { action, observable } from 'mobx';
import { observer } from 'mobx-react';
@observer
export default class User extends Component {
@observable user = {
firstName: 'john',
lastName: 'lennon',
status: 'alive'