Skip to content

Instantly share code, notes, and snippets.

View radianttap's full-sized avatar
🤔
· · ·

Aleksandar Vacić radianttap

🤔
· · ·
View GitHub Profile
@radianttap
radianttap / TaskQueue.swift
Created November 7, 2024 09:00
TaskQueue
import Foundation
public actor TaskQueue {
private let maxConcurrentTasks: Int
private var runningTasks = 0
private var queue: [CheckedContinuation<Void, Never>] = []
public init(maxConcurrentTasks: Int) {
self.maxConcurrentTasks = maxConcurrentTasks
}
@radianttap
radianttap / wwdc22.sh
Last active June 7, 2022 18:29
Download WWDC 22 HD videos and PDFs
#!/bin/bash
#Setup the environment
mkdir tmp_download
cd tmp_download
#Extract IDs
echo "Downloading the index"
wget -q https://developer.apple.com/videos/wwdc2022/ -O index.html
cat index.html | sed -n '/data-released=\"true\"/,/class=\"video-image-link\"/p' | grep videos/play/wwdc2022 | sed -e 's/.*wwdc2022\///' -e 's/\/\"\ .*//' | sed '$!N; /^\(.*\)\n\1$/!P; D' > ../downloadData
@radianttap
radianttap / wwdc20.sh
Created June 23, 2020 17:21
Script to download all WWDC 2020 videos, HD video files.
#!/bin/bash
#Setup the environment
mkdir tmp_download
cd tmp_download
#Extract IDs
echo "Downloading the index"
wget -q https://developer.apple.com/videos/wwdc2020/ -O index.html
# find parts of the document where data-released=true, all the way to the first H4 header where title of that talk is
@radianttap
radianttap / wwdc19.sh
Created June 6, 2019 11:23
Fetch all WWDC 2019 session videos and PDFs
#!/bin/bash
#Setup the environment
mkdir tmp_download
cd tmp_download
#Extract IDs
echo "Downloading the index"
wget -q https://developer.apple.com/videos/wwdc2019/ -O index.html
# find parts of the document where data-released=true, all the way to the first H4 header where title of that talk is
@radianttap
radianttap / Dictionary-mapKeys.swift
Created April 12, 2019 14:12
Dictionary, mapKeys (counterpart to mapValues)
public extension Dictionary {
func mapKeys<T>(_ transform: (Key) throws -> T) rethrows -> [T : Value] where T: Hashable {
var dict: [T: Value] = [:]
for (key, value) in self {
let newKey = try transform(key)
dict[newKey] = value
}
return dict
}
}
@radianttap
radianttap / wwdc18.sh
Created June 5, 2018 07:51
WWDC 2018 PDF / HD video downloading script
#!/bin/bash
#Setup the environnement
mkdir wwdc2018
cd wwdc2018
mkdir tmp_download
cd tmp_download
#Extract IDs
echo "Downloading the index"
@radianttap
radianttap / dummy.swift
Created February 19, 2018 20:30
Why the hell this crashes in UICollectionView?
let expandedSections = [0, 3, 8]
let indexSet = IndexSet(expandedSections)
collectionView?.performBatchUpdates(
{
[unowned self] in
if isInserted {
self.collectionView?.insertItems(at: indexPaths)
} else {
self.collectionView?.deleteItems(at: indexPaths)
@radianttap
radianttap / automatedBuildAndUploadToTestflight.sh
Created November 1, 2017 14:10 — forked from djacobs/automatedBuildAndUploadToTestflight.sh
Automated Xcode build and upload to TestFlight.
#!/bin/sh
# Current as working as of 2012/4/17
# Xcode 4.3.2
PROJECT_ROOT="$HOME/SomeDirWhereYourProjectLives/XXXXXXXX"
WORKSPACE="$PROJECT_ROOT/XXXXXXXX.xcodeproj/project.xcworkspace"
CONFIG="AdHoc"
SCHEME="XXXXXXXX"
(lldb) po ticketManager.isBuildingTicket
error: warning: <EXPR>:12:9: warning: initialization of variable '$__lldb_error_result' was never used; consider replacing with assignment to '_' or removing it
var $__lldb_error_result = __lldb_tmp_error
~~~~^~~~~~~~~~~~~~~~~~~~
_
error: <EXPR>:18:5: error: value of type 'TicketController' has no member '$__lldb_wrapped_expr_0'
$__lldb_injected_self.$__lldb_wrapped_expr_0(
^~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~
@radianttap
radianttap / TableHeaderFooterView.bgcolor
Created October 11, 2017 10:57
I would love to know the reasons for this. Must be quite a big technical debt for the hard-coded behavior since iPhone OS 2.
[TableView]
Setting the background color on UITableViewHeaderFooterView has been deprecated.
Please set a custom UIView with your desired background color to the backgroundView property instead.