Skip to content

Instantly share code, notes, and snippets.

@mxcl
mxcl / detweet.swift
Last active August 16, 2024 15:38
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"
@Bunn
Bunn / cleanup.sh
Created May 19, 2019 15:21
Cleanup space
#!/bin/bash
echo "Removing unavailable simulators..."
xcrun simctl delete unavailable
echo "Brew cleanup..."
brew cleanup
echo "Removing Xcode Caches..."
rm -rf ~/Library/Caches/com.apple.dt.Xcode
#USAGE: sh clean_unused_images.sh
project_path='/Users/../../Projects/iOS/APP_IOS/' # Change to your project's path
assets_path=$project_path"Assets.xcassets" # asset's path
assets_name="${assets_path/$project_path/$(echo '')}"
printf "\e[92mGetting first images:\e[0m\n"
images=""
# Get Images from assets root directory
@ShihabM
ShihabM / AppDelegate.gist
Created November 3, 2021 09:53
Dock Shooter - a game in your dock icon
//
// AppDelegate.swift
// Dock Shooter
//
// Created by Shihab Mehboob on 01/11/2021.
//
import Cocoa
@main
@Jomy10
Jomy10 / rust_in_swift.md
Last active September 20, 2024 07:44
Calling Rust library from Swift code (creating executable)

Calling a Rust library from Swift

This gist shows a quick overview of calling Rust in a Swift project, with Swift Package Manager configured.

Let's go ahead and create a folder containing all our sources:

mkdir swift-rs && cd $_
@insidegui
insidegui / PlatformViewRepresentable.swift
Created June 27, 2023 13:05
A protocol that abstracts UIViewRepresentable/NSViewRepresentable allowing for a single implementation for UIKit and AppKit platforms
import SwiftUI
#if !os(watchOS)
#if canImport(UIKit)
public typealias PlatformViewRepresentableType = UIViewRepresentable
#else
public typealias PlatformViewRepresentableType = NSViewRepresentable
#endif // canImport(UIKit)