Skip to content

Instantly share code, notes, and snippets.

View shadowfacts's full-sized avatar
🖕
stop turning github into a social network, micro$oft

Shadowfacts shadowfacts

🖕
stop turning github into a social network, micro$oft
View GitHub Profile
@schmich
schmich / ducky.md
Last active April 5, 2024 14:20
Programming media keys on the Ducky One 2 Skyline

Programming Media Keys on the Ducky One 2 Skyline

To use media keys on the Ducky One 2 Skyline, you must record a macro to bind the media function to a hotkey combination, i.e. Fn plus some key.

Example

Important: In the instructions below, "Press X+Y+Z" means press and hold key X, press and hold key Y, press and hold key Z in that order, and then release all three.

As an example, to bind Fn+PgUp to the play/pause media function:

@nikhiljha
nikhiljha / README.md
Last active February 10, 2024 22:34
Apple Silicon (M1) + MultiMC + Minecraft 1.18 + Native LWJGL

Apple Silicon (M1) + MultiMC + Minecraft 1.18 + Native LWJGL

Up to Minecraft 1.17.X I used yusefnapora/m1-multimc-hack, but this stopped working for me starting in Minecraft 1.18. Grabbing random jarfiles from a git repository is a little suspicious, so let's do it safely by getting the libraries from the official LWJGL website!

Installing Java

If you don't have Homebrew installed already, install Homebrew by following the instructions at brew.sh. Then, just open a Terminal and type...

brew install java
@smileyborg
smileyborg / SelfSizingTableHeaderAndTableFooterViews.swift
Last active February 9, 2024 09:53
How to manually self-size UITableView tableHeaderView/tableFooterView in iOS 11
// For the best results, your tableHeaderView/tableFooterView should be a UITableViewHeaderFooterView with your content inside the contentView.
let tableHeaderView = UITableViewHeaderFooterView()
let fittingSize = CGSize(width: tableView.bounds.width - (tableView.safeAreaInsets.left + tableView.safeAreaInsets.right), height: 0)
let size = tableHeaderView.systemLayoutSizeFitting(fittingSize, withHorizontalFittingPriority: .required, verticalFittingPriority: .fittingSizeLevel)
tableHeaderView.frame = CGRect(origin: .zero, size: size)
tableView.tableHeaderView = tableHeaderView
// When you set this view to the tableHeaderView/tableFooterView on the table view, the table view will preserve the existing size of its frame.
// If you need to change the size, remove the tableHeaderView/tableFooterView, set a new frame on it, then re-set it on the table view again.
@rauchg
rauchg / README.md
Last active January 6, 2024 07:19
require-from-twitter
@timonus
timonus / programmatic-dynamic-images.m
Last active January 1, 2024 12:08
Programmatically create iOS 13 dynamic images
- (UIImage *)dynamicImage
{
UITraitCollection *const baseTraitCollection = /* an existing trait collection */;
UITraitCollection *const lightTraitCollection = [UITraitCollection traitCollectionWithTraitsFromCollections:@[baseTraitCollection, [UITraitCollection traitCollectionWithUserInterfaceStyle:UIUserInterfaceStyleLight]]];
UITraitCollection *const purelyDarkTraitCollection = [UITraitCollection traitCollectionWithUserInterfaceStyle:UIUserInterfaceStyleDark];
UITraitCollection *const darkTraitCollection = [UITraitCollection traitCollectionWithTraitsFromCollections:@[baseTraitCollection, purelyDarkTraitCollection]];
__block UIImage *lightImage;
[lightTraitCollection performAsCurrentTraitCollection:^{
lightImage = /* draw image */;
@douglashill
douglashill / KeyboardTableView.swift
Last active March 30, 2023 22:01
A UITableView that allows navigation and selection using a hardware keyboard.
// Douglas Hill, December 2018
// Made for https://douglashill.co/reading-app/
// Find the latest version of this file at https://github.com/douglashill/KeyboardKit
import UIKit
/// A table view that allows navigation and selection using a hardware keyboard.
/// Only supports a single section.
class KeyboardTableView: UITableView {
// These properties may be set or overridden to provide discoverability titles for key commands.
@smileyborg
smileyborg / InteractiveTransitionCollectionViewDeselection.m
Last active January 15, 2023 13:03
Animate table & collection view deselection alongside interactive transition (for iOS 11 and later)
// UICollectionView Objective-C example
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
NSIndexPath *selectedIndexPath = [[self.collectionView indexPathsForSelectedItems] firstObject];
if (selectedIndexPath != nil) {
id<UIViewControllerTransitionCoordinator> coordinator = self.transitionCoordinator;
if (coordinator != nil) {
[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) {
@matthewprenger
matthewprenger / build.gradle
Last active June 18, 2022 18:01
CoFH CurseForge Dependencies
// The URL for each mod often changes based on the version you want.
// To find the correct URL, download the (DEOBFUSCATED!) mod from CurseForge,
// and look in your browser's download history to find the URL it came from.
// Use the numbers from that in place of the ones below
repositories {
ivy {
name "CoFHLib"
artifactPattern "http://addons-origin.cursecdn.com/files/2229/525/[module]-[revision].[ext]"
}
@matthewprenger
matthewprenger / changelog-auth.gradle
Last active July 5, 2016 11:12
Jenkins Gradle Changelog Init Script, place this in ~/.gradle/init.d/changelog.gradle on your Jenkins server. Projects can simply call 'project.changelog' to get the changes for the current build.
def buildUrl = System.getenv().BUILD_URL
if (buildUrl != null) {
def auth = "<USER>:<APITOKEN>".getBytes().encodeBase64().toString()
def url = new URL("$buildUrl/api/xml?depth=20").openConnection()
url.setRequestProperty("Authorization", "Basic " + auth)
String data = url.getInputStream().text
def changelog = ""
@hilburn
hilburn / General topics
Last active January 6, 2016 05:20
Modding Tutorial Series
1. Setting up the environment - git, Gradle and base mod file.
2. My first things - an exploration of Items, Blocks, ItemBlocks (mebbe), and recipes
3. More interesting blocks - blocks that do things - redstone interactions, crops, maybe a simple fluid/block, things like that.
4. Witchcraft - advanced items - looking at the different ways to get items to do stuff, maybe make some tools and weapons? custom food?
5. Intro to Events - what can they do for me?
6. Configs - letting users have their way with your precious creation
7. Inventories and basic tile entities
8. Packets and preventing sync issues
9. Guis and Containers - when, how and why to use them.
10. Custom recipes (both crafting and machine) and NEI integration