Skip to content

Instantly share code, notes, and snippets.

View J-Swift's full-sized avatar

Jimmy Reichley J-Swift

  • Rockledge, FL
View GitHub Profile
@J-Swift
J-Swift / MainActivity.kt
Last active August 3, 2022 13:15
(Almost) fully programmatic creation of Jetpack Navigation graph
package com.example.myapplication
import android.os.Bundle
import android.util.Log
import android.view.Menu
import com.google.android.material.bottomnavigation.BottomNavigationView
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentContainerView
import androidx.navigation.NavGraph
@J-Swift
J-Swift / update_deployment.ps1
Created July 8, 2022 13:55
Capistrano-style IIS deployment helper
param(
[switch] $Rollback
)
################################################################################
# Config
################################################################################
$WebsiteName = "FIXME: IIS WEBSITE NAME"
$WaitForWebsiteTimeoutSeconds = 60
@J-Swift
J-Swift / ns.sh
Last active June 23, 2022 02:45
Function for quick nix shells
function ns() {
local pkgs=""
for arg in "$@"; do
local pkgs="nixpkgs#${arg} ${pkgs}"
done
echo "nix shell ${pkgs}"
nix shell $pkgs
}
@J-Swift
J-Swift / home.nix
Created April 19, 2022 15:31
Basic example of installing a binary through nix home manager
{ config, lib, pkgs, options, ... }:
let
carthage = pkgs.stdenv.mkDerivation rec {
pname = "carthage";
version = "0.38.0";
src = pkgs.fetchurl {
url = "https://github.com/Carthage/Carthage/releases/download/${version}/Carthage.pkg";
sha256 = "1d5s160vbd3c3fvx93zq7aw0qgp1l95ri3ayskjg7cc8c2qk1s0f";
};
@J-Swift
J-Swift / run-ios.sh
Last active February 14, 2022 14:47
Run MAUI app on a specific iOS simulator with auto-detection
#!/usr/bin/env bash
set -euo pipefail
# NOTE(jpr): this is adapted from the following comments
# https://github.com/dotnet/xamarin/issues/26#issuecomment-757981580
# https://github.com/dotnet/maui/discussions/2364#discussioncomment-1286275
readonly _mode="${1:-}"
readonly _provided_udid="${2:-}"
@J-Swift
J-Swift / console_script.js
Last active August 4, 2021 03:08
Download all photos from facebook album
function delay(delayInms) {
return new Promise(resolve => {
setTimeout(() => {
resolve();
}, delayInms);
});
}
function save(filename, data) {
const blob = new Blob([data], {type: 'text/csv'});
@J-Swift
J-Swift / read_defaults.sh
Created July 16, 2021 00:58
Helper for comparing what macOS user defaults change between 2 points in time
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p bash
set -euo pipefail
readonly _mode="${1:-}"
case "$_mode" in
'pre' | 'post' | 'compare')
readonly mode="${_mode}"
;;
@J-Swift
J-Swift / git-rm-merged.ps1
Created August 19, 2020 15:45
Delete merged git feature branches in powershell
git branch --merged | Select-String -Pattern 'feature' | %{ git branch -d $_.Line.Trim() }
@J-Swift
J-Swift / .editorconfig
Last active August 10, 2020 17:09
C# monorepo style example
# NOTE(jpr): adapted from https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2019
root = true
#### Core EditorConfig Options ####
[*]
indent_size = 4
indent_style = space
trim_trailing_whitespace = true
@J-Swift
J-Swift / BindableProperty.snippet
Created May 14, 2020 19:19
Xamarin.Forms BindableProperty Property
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<shortcut>bp</shortcut>
<Title>Bindable Property</Title>
<Author>Jimmy Reichley</Author>
<Description>Inserts boilerplate for BindableProperty property</Description>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>