CLICK ME
yes, even hidden code blocks!
print("hello world!")
# ----------------------------------------------------------------------------- | |
# AI-powered Git Commit Function | |
# Copy paste this gist into your ~/.bashrc or ~/.zshrc to gain the `gcm` command. It: | |
# 1) gets the current staged changed diff | |
# 2) sends them to an LLM to write the git commit message | |
# 3) allows you to easily accept, edit, regenerate, cancel | |
# But - just read and edit the code however you like | |
# the `llm` CLI util is awesome, can get it here: https://llm.datasette.io/en/stable/ | |
gcm() { |
// | |
// UIAccessorizedTextField.swift | |
// AccessorizedTextField | |
// | |
// Created by Damien Laughton on 28/03/2018. | |
// 2018 Mobilology Limited. No rights reserved. | |
// | |
import Foundation | |
import UIKit |
extension UIView { | |
func roundCorners(_ corners: CACornerMask, radius: CGFloat) { | |
if #available(iOS 11, *) { | |
self.layer.cornerRadius = radius | |
self.layer.maskedCorners = corners | |
} else { | |
var cornerMask = UIRectCorner() | |
if(corners.contains(.layerMinXMinYCorner)){ | |
cornerMask.insert(.topLeft) |
import UIKit | |
extension UITableView { | |
func dequeueReusableCell<T: UITableViewCell>() -> T { | |
return dequeueReusableCell(withIdentifier: NSStringFromClass(T.self)) as! T | |
} | |
} | |
//using: let cell: ExampleTableViewCell = tableView.dequeueReusableCell() |
# The trick is to link the DeviceSupport folder from the beta to the stable version. | |
# sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :) | |
# Support iOS 15 devices (Xcode 13.0) with Xcode 12.5: | |
sudo ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/15.0 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport | |
# Then restart Xcode and reconnect your devices. You will need to do that for every beta of future iOS versions | |
# (A similar approach works for older versions too, just change the version number after DeviceSupport) |
[alias] | |
st = status | |
ci = commit | |
br = branch | |
co = checkout | |
df = diff | |
lg = log -p | |
branches = for-each-ref --sort='-authordate:iso8601' --format=' %(authordate:relative)%09%(refname:short)' refs/heads | |
[push] |
Although the file name for the image is set automatically by iOS to IMG_nnnn, we can use metadata to set the title that will be shown in Photos app.
For more details see http://ootips.org/yonat/how-to-set-the-image-name-when-saving-to-the-camera-roll/
// | |
// Badge.swift | |
// Extensions for Rounded UILabel and UIButton, Badged UIBarButtonItem. | |
// | |
// Usage: | |
// let label = UILabel(badgeText: "Rounded Label"); | |
// let button = UIButton(type: .System); button.rounded = true | |
// let barButton = UIBarButtonItem(badge: "42", title: "How Many Roads", target: self, action: "answer") | |
// | |
// Created by Yonat Sharon on 06.04.2015. |
#!/bin/bash | |
# Xcode: Set version and build number from Git | |
# -------------------------------------------- | |
# | |
# This script sets the version number `CFBundleShortVersionString` to one of | |
# | |
# - `1.2.3` -- for the tagged commit `v1.2.3` or a hyphen-separated prerelease, | |
# e.g. `v1.2.3-alpha`, `v1.2.3-alpha.2`, `v1.2.3-beta`, `v1.2.3-rc`. | |
# - `1.2.3-7-gabc1234` -- at commit `abc1234`, 7 commits after `v1.2.3`, | |
# - `1.2.3-7-gabc1234-dirty` -- when there are uncommitted changes, or |