Skip to content

Instantly share code, notes, and snippets.

Avatar

Alex Rattray rattrayalex

View GitHub Profile
@rattrayalex
rattrayalex / README.md
Created Aug 20, 2022
Demo for using github.dev for syntax highlighting in gmail
View README.md

Hello world

This is some text. It has inline code and links.

  • hello world.
  • lists work
    1. Nested numbered.
    2. Go deep.
      1. Numbers in numbers.
  1. Hooray.
@rattrayalex
rattrayalex / jira-branch.bash
Created Jun 13, 2022
Bash command to nicely select a jira ticket to work on (optimized for a certain former project)
View jira-branch.bash
jira-branch() (
set -eo pipefail
local jira_instance jq_template query username api_key ticket_id jira_title commit_title
username="$JIRA_USERNAME"
api_key="$JIRA_API_KEY"
jira_instance="$JIRA_INSTANCE"
query="project=MAIN AND statusCategory!=Done AND assignee=currentUser()"
@rattrayalex
rattrayalex / input.rb
Created Jun 1, 2022
Fiddling with kwargs in Ruby 3 at https://try.ruby-lang.org/
View input.rb
puts RUBY_VERSION
def foo(params={}, x: nil, **kwargs)
puts({params: params, x: x, kwargs: kwargs})
end
foo(a: 1)
foo(a: 1, x: 2)
foo(x: 1)
foo({a: 1})
@rattrayalex
rattrayalex / uncluttered_notion.css
Last active Mar 6, 2022
Stylish CSS Theme for uncluttering Notion's text editor
View uncluttered_notion.css
[contenteditable][placeholder="Type '/' for commands"]:empty:after,
[contenteditable][placeholder="List"]:empty:after {
content: ' ' !important;
}
.notion-focusable[role="button"] > svg.plus {
display: none !important;
}
.notion-focusable[role="button"]:hover > svg.plus {
display: block !important;
@rattrayalex
rattrayalex / .bash_profile
Last active Aug 5, 2021
Bash function to choose an open jira ticket and create a branch and empty commit for it
View .bash_profile
source "$HOME/.env"
jira-branch() (
set -eo pipefail
local jira_instance jq_template query username api_key ticket_id jira_title commit_title
username="$JIRA_USERNAME"
api_key="$JIRA_API_KEY"
jira_instance="$JIRA_INSTANCE"
@rattrayalex
rattrayalex / readme.md
Created Jul 30, 2021
Ripgrep ignore/exclude files that match a certain string
View readme.md

Say you want to search for a certain string, but exclude files which match another pattern.

PATTERN_TO_EXCLUDE="bad.+words"
DIR_TO_SEARCH=foo/bar
PATTERN_TO_FIND="good.+good"

rg $PATTERN_TO_FIND --stats $(rg $PATTERN_TO_EXCLUDE --files-without-match $DIR_TO_SEARCH)
@rattrayalex
rattrayalex / README.md
Last active Jul 6, 2021
Using Fastify with TypeScript and OpenAPI for typed requests and responses on the server and client
@rattrayalex
rattrayalex / .circleci slash config.yml
Created Jun 28, 2021
Running different CircleCI workflows based on environment variables created in a shell script
View .circleci slash config.yml
version: 2.1
setup: true
orbs:
continuation: circleci/continuation@0.1.2
jobs:
determine-workflow:
machine: true
@rattrayalex
rattrayalex / b2-archive-files.bash
Last active Jun 15, 2021
Upload a list of files and directories to b2 backblaze, and then delete them, with a single bash command
View b2-archive-files.bash
# usage:
#
# export BUCKET='my-bucket-name'
# b2-archive-files myfile mydirectory myotherfile
#
# You can find large files in a directory with "du -ahx . | sort -h".
archive() (
set -eo pipefail
View Musings on revisiting ternaries formatting 2022-01-15.jsx
const Musings = () => {
return (
<div>
In general, I'm definitely thinking of removing parens around broken terminal alternates,
for example instead of this:
{component ?
<div>{React.createElement(component, props)}</div>
: render ?
<div>{render(props)}</div>