Skip to content

Instantly share code, notes, and snippets.

View SeanMcTex's full-sized avatar

Sean "Sharky" McMains SeanMcTex

View GitHub Profile
@SeanMcTex
SeanMcTex / NuclearBodhran.ino
Created April 25, 2023 14:32
Code for sound-reactive bodhran (Irish drum), as per article at http://www.mcmains.net.
/* Sound-Reactive Drums for Adafruit Gemma/Trinket and NeoPixel LEDs.
Hardware requirements:
- Adafruit Gemma, Gemma M0, or 3V Trinket microcontroller.
Do NOT use a 5V Trinket; circuit DEPENDS on the 3V regulator!
- Adafruit Electret Microphone Amplifier (product ID: 1063)
- A length of NeoPixel LEDs, such as:
o Adafruit Flora RGB Smart Pixels (ID: 1260)
o Adafruit NeoPixel Digital LED strip (ID: 1138)
o Adafruit Neopixel Ring (ID: 1463)
@SeanMcTex
SeanMcTex / lights-camera-action.sh
Last active May 6, 2022 02:45
Script to turn on/off light for videoconferencing automatically. Requires a Mac, Oversight, and Shortcuts app.
#!/bin/bash
# To use this script:
# 1. Save it on your Mac hard drive somewhere convenient.
# 2. `chmod` its permissions to make it executable. E.g. `chmod 755 handle-camera.sh`.
# 3. In the Shortcuts app, create "Start Conference" and "End Conference" shortcuts that activate lights
# and do whatever else you want to happen when conferences start and end.
# 4. Download and install Oversight to watch for camera activation/deactivation:
# https://objective-see.com/products/oversight.html
# 5. Configure Oversight's "action" panel to run this script. Turn on the option that passes arguments.

Keybase proof

I hereby claim:

  • I am seanmctex on github.
  • I am seanmctex (https://keybase.io/seanmctex) on keybase.
  • I have a public key ASDT7FKVZ32O8_2qtx6d_Yi7qB9RMudVa81HwX8lLC3QhQo

To claim this, I am signing this object:

@SeanMcTex
SeanMcTex / FilteredTextField.md
Created May 8, 2020 20:05
A pitfall to avoid when filtering SwiftUI TextFields

Today’s very hard-won lesson: be careful how you do TextField content filtering! We were filtering input to a text field (making sure the field only accepted numbers, etc.) like so:

@Binding var value: String
TextField( placeholder, text: $value )
    .onReceive( Just( value ), perform: { 
		self.value = self.contentType.filterCharacters( oldValue: $0 ) 
	})
@SeanMcTex
SeanMcTex / README-Template.md
Created March 7, 2019 15:01 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@SeanMcTex
SeanMcTex / MeshMeasure.cs
Created January 24, 2019 23:43
Unity Utility to display bounds of mesh objects in world space
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
/// <summary>
/// In order to help gauge the size of mesh objects,
/// this script displays the dimensions in world space of a selected object
/// with a MeshRenderer attached whenever it's selected.
/// </summary>
@SeanMcTex
SeanMcTex / PinToSafeArea.cs
Last active August 9, 2024 07:11
Restrict Unity UI to an iPhone X or other Mobile Device's Safe Area
using UnityEngine;
/// <summary>
/// Resizes a UI element with a RectTransform to respect the safe areas of the current device.
/// This is particularly useful on an iPhone X, where we have to avoid the notch and the screen
/// corners.
///
/// The easiest way to use it is to create a root Canvas object, attach this script to a game object called "SafeAreaContainer"
/// that is the child of the root canvas, and then layout the UI elements within the SafeAreaContainer, which
/// will adjust size appropriately for the current device./// </summary>

WWDC 2015 Wish List & Predictions, the Developer's Perspective

Mutual Mobile has been very lucky this year to have a number of our devs awarded tickets to attend WWDC. As the time grows close, speculation about what we'll be seeing this year is reaching a fever pitch. As developers, we have a lot of stake in what Apple reveals in a couple of short weeks, and we've had some great discussions about what we expect to see and what we are hoping for. Here are a number of the things we're wishing for and estimates of how likely we think it is that our dreams will come true.

New Apple TV

The last time Apple mentioned the Apple TV, they lowered the price: "starting at $69". The "starting at" makes it a near certainty that there's an updated Apple TV in the works, and rumors seem to indicate that an SDK for doing development for the updated box is a very likely as well. An SDK would allow video providers to create new apps to share video content from a variety of new sources, and to enrich that video content w

# WWDC 2015 Wish List & Predictions, the Developer's Perspective
Mutual Mobile has been very lucky this year to have a number of our devs awarded tickets to attend WWDC. As the time grows close, speculation about what we'll be seeing this year is reaching a fever pitch. As developers, we have a lot of stake in what Apple reveals in a couple of short weeks, and we've had some great discussions about what we expect to see and what we are hoping for. Here are a number of the things we're wishing for and estimates of how likely we think it is that our dreams will come true.
## New Apple TV
The last time Apple mentioned the Apple TV, they lowered the price: "starting at $69". The "starting at" makes it a near certainty that there's an updated Apple TV in the works, and rumors seem to indicate that an SDK for doing development for the updated box is a very likely as well. An SDK would allow video providers to create new apps to share video content from a variety of new sources, and to enrich that video content w
@SeanMcTex
SeanMcTex / swift-cheat-sheet.md
Created June 4, 2014 15:40
Quick Reference for the Most Commonly Needed Accessibility Functionality in Swift for iOS

Accessibility Cheat Sheet for Swift

The Basics

fireButton.accessibilityLabel = NSLocalizedString( "Fire Weapons", comment: "Fire weapons button label" )
fireButton.isAccessibilityElement = true
fireButton.accessibilityHint = "Clearly, you should push this button to shoot your weapons at the bad guys"

Notifications

UIAccessibilityPostNotification( UIAccessibilityScreenChangedNotification, self.fireButton )
UIAccessibilityPostNotification( UIAccessibilityLayoutChangedNotification, nil )