Skip to content

Instantly share code, notes, and snippets.

View ahcode0919's full-sized avatar
🏠
Working from home

A. Hinton ahcode0919

🏠
Working from home
  • Worldwide
View GitHub Profile
@ahcode0919
ahcode0919 / Simctl.md
Last active June 8, 2024 11:49
Apple Simctl commands

Simctl

An Xcode/CoreSimulator command line utility to control iOS Simulators on MacOS

Command Usage

simctl [--set <path>] [--profiles <path>] <subcommand> ... simctl help [subcommand]

Documented Commands

@ahcode0919
ahcode0919 / es6_import_export.md
Last active September 11, 2019 23:21
ES6 Import Export

ES6 Import / Export

Named Exports / Imports

Exports

// source.js
export function add(a, b) { return a + b; }
export function subtract(a, b) { return a - b; }
@ahcode0919
ahcode0919 / git-author.sh
Last active August 30, 2019 00:06
Rewrite Email / Name for commits (Doesn't change dates)
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="email
CORRECT_NAME="name"
CORRECT_EMAIL="email"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
@ahcode0919
ahcode0919 / ruby-cli-gem.md
Last active August 15, 2019 03:42
How-to Create a Ruby CLI Gem

How-to Create a Ruby CLI Gem

Pre-Setup

  1. Create a RubyGems Account
  2. Install RVM (Ruby Version Manager) : RVM
  3. Install Bundler: gem install bundler

Project Creation

@ahcode0919
ahcode0919 / git-cheatsheet.md
Last active May 14, 2020 07:14
Common Git Commands

Git Cheatsheet

Global

  • Create origin branch when creating branch git config --global branch.autosetupmerge always
  • Add ssh key to keychain to eliminate retyping in password ssh-add -K ~/.ssh/id_rsa

Add files

  • Add All Files - git add .
@ahcode0919
ahcode0919 / compile-files.py
Created June 21, 2018 23:17
Check all python file in current directory tree for compilation
import compileall
import os
import sys
# Get path of this file's directory
directory = os.path.dirname(os.path.realpath(__file__))
# Check that files are compileable
success = compileall.compile_dir(dir=directory, maxlevels=20, force=True)
@ahcode0919
ahcode0919 / git-author-rewrite.sh
Last active May 7, 2018 01:41 — forked from octocat/git-author-rewrite.sh
Simple script for updating the commit author in a repository across all branches
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="OLD EMAIL ADDRESS"
CORRECT_NAME="NEW NAME"
CORRECT_EMAIL="NEW EMAIL"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
@ahcode0919
ahcode0919 / findFileAndPerformCommand.sh
Created March 2, 2018 23:24
Find file and perform command script
find "{directory}" -name "{filename}" -print0 | xargs -0 "{command}"
# Example find "./" -name "*.txt" -print0 | xargs -0 echo
@ahcode0919
ahcode0919 / simulator.sh
Last active June 14, 2017 17:25
Get current iOS Simulator version from command line
read SIMVERSION <<< $(xcrun simctl list | awk '/^iOS[[:space:]][0-9\.]+/ { print $2 }')
#echo $SIMVERSION
#Output: 10.3
@ahcode0919
ahcode0919 / swift-custom-encode-decode.swift
Last active July 16, 2022 22:25
Custom JSON encoding / decoding in Swift 4
import UIKit
//Abbreviated OpenAPI product response for example purposes
let jsonData = """
{
"paging": {
"total": 8,
"offset": 0,
"limit": 40,
"returned": 8