Skip to content

Instantly share code, notes, and snippets.

View jessesquires's full-sized avatar
🏴
free labor

Jesse Squires jessesquires

🏴
free labor
View GitHub Profile
@sowenjub
sowenjub / Font+Fraction.swift
Created January 24, 2023 09:33
An extension to display fractions in SwiftUI. This is the answer I posted on https://stackoverflow.com/questions/71359423/how-can-i-show-a-fraction-with-swiftui/75219519#75219519
import SwiftUI
extension UIFont {
static func fractionFont(ofSize pointSize: CGFloat) -> UIFont {
let systemFontDesc = UIFont.systemFont(ofSize: pointSize).fontDescriptor
let featureSettings: [UIFontDescriptor.FeatureKey: Int] = [
.type: kFractionsType,
.selector: kDiagonalFractionsSelector,
]
let attributes = [
@IanColdwater
IanColdwater / twittermute.txt
Last active April 3, 2024 19:43
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
//
// ContentView.swift
// AnimationTimingCurve
//
// Created by Chris Eidhof on 25.09.19.
// Copyright © 2019 Chris Eidhof. All rights reserved.
//
import SwiftUI
@aymericbeaumet
aymericbeaumet / delete-likes-from-twitter.md
Last active April 14, 2024 07:47
[Recipe] Delete all your likes/favorites from Twitter

Ever wanted to delete all your likes/favorites from Twitter but only found broken/expensive tools? You are in the right place.

  1. Go to: https://twitter.com/{username}/likes
  2. Open the console and run the following JavaScript code:
setInterval(() => {
  for (const d of document.querySelectorAll('div[data-testid="unlike"]')) {
    d.click()
 }
@mxcl
mxcl / detweet.swift
Last active December 23, 2023 23:22
Delete all tweets and favorites older than two months ago. Instructions in comment.
#!/usr/bin/swift sh
import Foundation
import PromiseKit // @mxcl ~> 6.5
import Swifter // @mattdonnelly == b27a89
let swifter = Swifter(
consumerKey: "FILL",
consumerSecret: "ME",
oauthToken: "IN",
oauthTokenSecret: "https://developer.twitter.com/en/docs/basics/apps/overview.html"
@tclementdev
tclementdev / libdispatch-efficiency-tips.md
Last active April 16, 2024 01:02
Making efficient use of the libdispatch (GCD)

libdispatch efficiency tips

The libdispatch is one of the most misused API due to the way it was presented to us when it was introduced and for many years after that, and due to the confusing documentation and API. This page is a compilation of important things to know if you're going to use this library. Many references are available at the end of this document pointing to comments from Apple's very own libdispatch maintainer (Pierre Habouzit).

My take-aways are:

  • You should create very few, long-lived, well-defined queues. These queues should be seen as execution contexts in your program (gui, background work, ...) that benefit from executing in parallel. An important thing to note is that if these queues are all active at once, you will get as many threads running. In most apps, you probably do not need to create more than 3 or 4 queues.

  • Go serial first, and as you find performance bottle necks, measure why, and if concurrency helps, apply with care, always validating under system pressure. Reuse

@lsavino
lsavino / compilation-optimization.md
Last active July 27, 2022 17:44
Compiler Optimizations, Compiling Optimally, and Whole Modules

DEPRECATED for Xcode 10 🎈

(check out What's New in Swift at 11:40, slide 42)

Whole Module Compilation Optimizations: Why these terms are sometimes misleading

When you look up how to compile swift faster for debug builds, people very earnestly give advice that seems contradictory: you should "try using the whole module optimization flag," and also "never use whole module optimization for debugging". [^1]

This is confusing because some of us are using these two general words:

compilation: "turning text into an executable program"

@JaimieMurdock
JaimieMurdock / README.md
Last active January 31, 2018 20:24
Starting Python Resources

Intro to Python

Assumes a start with Python 3.6. Python 2.7 is end of life in 2020, so new projects should avoid it.

Important PEPs

PEPs (Python Enhancement Proposals) are how new features are added to the language and are very useful for learning why things are the way they are.

Some also offer style guidance.

@lattner
lattner / TaskConcurrencyManifesto.md
Last active April 18, 2024 09:44
Swift Concurrency Manifesto
@jessesquires
jessesquires / gitsl.sh
Last active December 3, 2023 07:08
git "smartlog" / "pretty log"
# blog post
#
# https://www.jessesquires.com/blog/customizing-git-log/
git log --graph --pretty=format:'commit: %C(bold red)%h%Creset %C(red)<%H>%Creset %C(bold magenta)%d %Creset%ndate: %C(bold yellow)%cd %Creset%C(yellow)%cr%Creset%nauthor: %C(bold blue)%an%Creset %C(blue)<%ae>%Creset%n%C(cyan)%s%n%Creset'