Skip to content

Instantly share code, notes, and snippets.

View rattrayalex's full-sized avatar

Alex Rattray rattrayalex

View GitHub Profile
def row(&blk)
yield
puts
end
def front_stitch
print "1"
end
def back_stitch
@rattrayalex
rattrayalex / outdated_todods.md
Created December 5, 2022 04:03
archived text from ternaries PR description

Parts I'm less sure of / things that could use help

NB: This section may be outdated, I can't remember what the current status is since I wrote this originally a long time ago.

Personally, I feel pretty good about shipping this largely as-is (modulo any bugs or code review issues) and I don't consider the below issues to be blockers – if anything, they might be best addressed in follow-on PR's. But, I raise them here since I anticipate they may garner discussion and I'm not so sure that my current answer is one that I'll like later on.

1. Whether and when to shorten to "case-style" for non-nested ternaries

As written, the PR uses "case-style" when the consequent is visually short (under ten characters long), eg:

@rattrayalex
rattrayalex / README.md
Created August 20, 2022 08:33
Demo for using github.dev for syntax highlighting in gmail

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 June 13, 2022 16:16
Bash command to nicely select a jira ticket to work on (optimized for a certain former project)
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 June 1, 2022 21:00
Fiddling with kwargs in Ruby 3 at https://try.ruby-lang.org/
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 July 16, 2023 10:15
Stylish CSS Theme for uncluttering Notion's text editor
[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 August 5, 2021 01:54
Bash function to choose an open jira ticket and create a branch and empty commit for it
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 July 30, 2021 02:19
Ripgrep ignore/exclude files that match a certain string

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 July 6, 2021 18:18
Using Fastify with TypeScript and OpenAPI for typed requests and responses on the server and client
@rattrayalex
rattrayalex / .circleci slash config.yml
Created June 28, 2021 18:55
Running different CircleCI workflows based on environment variables created in a shell script
version: 2.1
setup: true
orbs:
continuation: circleci/[email protected]
jobs:
determine-workflow:
machine: true