Skip to content

Instantly share code, notes, and snippets.

View tinacious's full-sized avatar
👩‍💻

Tina Holly tinacious

👩‍💻
View GitHub Profile
@tinacious
tinacious / gitcleanup.sh
Created May 5, 2023 19:51
Bash function to add to your .bash_profile or .zshrc that collects git branches to be deleted via standard in
gitcleanup() {
echo 'Paste git branches to be deleted below then press enter...\n'
while read line
do
if [ -n "$line" ]; then
echo "\n"
git branch -D $line
echo "\n"
fi
done < "${1:-/dev/stdin}"
@tinacious
tinacious / health_controller.rb
Created February 18, 2022 23:07
A simple Ruby on Rails health check endpoint
# ./app/controllers/health_controller.rb
class HealthController < ApplicationController
skip_before_action :authenticate!
def index
current_time_str = ActiveRecord::Base.connection.execute("SELECT CURRENT_TIME;").first["current_time"]
current_time = current_time_str.to_datetime
render json: {
@tinacious
tinacious / Contents.swift
Created August 16, 2021 20:23
Making network requests in iOS with URLSession.
// Create a playground called NetworkingPlayground, e.g.
// ./NetworkingPlayground.playground/Contents.swift
import UIKit
/*
{
"id": 1,
"title": "Vinyl gloves",
"merchant": "Shoppers Drug Mart",
@tinacious
tinacious / add_openapi_docs_branding.rb
Created April 25, 2021 00:52
Adds branding to Swagger/Open API docs
#!/usr/local/bin/ruby
require 'json'
docs = File.read('spec/api_doc/v1/schemas/docs.json')
docs_json = JSON.parse(docs)
docs_json['info']['x-logo'] = {
"url": "https://example.com/logo.png",
"backgroundColor": "#ff3399"
}
@tinacious
tinacious / .rubocop.yml
Last active March 7, 2021 02:10
Ruby linter configuration
AllCops:
NewCops: enable
Exclude:
- 'db/**/*'
- 'vendor/**/*'
Layout/LineLength:
Max: 150
IgnoredPatterns: ['\#']
Exclude:
@tinacious
tinacious / android-permissions.ts
Last active December 27, 2020 05:06
Verify Android read/write permissions in React Native
import { PermissionsAndroid } from 'react-native';
import DeviceInfo from 'react-native-device-info';
/**
* Depending on the version of Android, we need to check different permissions
* to enable this functionality.
* Android Q and above only require read permission.
* Older versions require both read and write.
*
* Also make sure you have the following permissions in your manifest.
@tinacious
tinacious / __install_things.sh
Last active December 17, 2020 03:52
Some helpful tools to install
# Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew cask
brew install wget
# Node.js development
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
echo "nvm: Go here and add to your bash profile: https://github.com/nvm-sh/nvm";
@tinacious
tinacious / install_vscode_extensions.sh
Created December 17, 2020 02:07
A list of my installed Visual Studio Code extensions
code --install-extension aeschli.vscode-css-formatter
code --install-extension annsk.alignment
code --install-extension bierner.markdown-preview-github-styles
code --install-extension christian-kohler.npm-intellisense
code --install-extension christian-kohler.path-intellisense
code --install-extension dbaeumer.vscode-eslint
code --install-extension EditorConfig.EditorConfig
code --install-extension eg2.vscode-npm-script
code --install-extension fcrespo82.markdown-table-formatter
code --install-extension HookyQR.beautify
@tinacious
tinacious / get_public_github_repos.sh
Last active September 2, 2022 00:35
Get all of the public repositories by name for a Github user
# Replace "octocat" with you, or the user you're creeping.
export GIST_GITHUB_USERNAME="octocat";
export GIST_GITHUB_PAGE="1";
curl https://api.github.com/users/$GIST_GITHUB_USERNAME/repos\?sort\=created\&direction\=desc\&page\=$GIST_GITHUB_PAGE | jq '.[].html_url'
# Other properties of relevance:
# html_url description license.url
# Given username = tinacious
# curl https://api.github.com/users/tinacious/repos | jq .[].full_name
{
"env": {
"node": true,
"es2020": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",