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 / 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
/**
* Show background colours and borders for all elements
*/
(function () {
const Outline = {
id: 'td-outline-toggle',
getStyleElement: () => {
const styleElement = document.createElement('style');
styleElement.id = Outline.id;
@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 / tota11y bookmarklet.js
Created March 16, 2017 00:18
Add tota11y accessibility tool to the page
/**
* Adds accessibility tool tota11y to the page
*/
(function () {
var totally = document.createElement('script');
totally.src = 'https://cdn.rawgit.com/Khan/tota11y/0.1.3/build/tota11y.min.js';
document.head.appendChild(totally);
})();
@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";