Skip to content

Instantly share code, notes, and snippets.

@DoubleREW
DoubleREW / Cleanup Xcode outdated files.md
Created April 5, 2024 17:29
Cleanup Xcode outdated files

Cleanup Xcode outdated files

Cleanup ~/Library/Developer/CoreSimulator/Devices folder

xcrun simctl delete unavailable

Cleanup ~/Library/Developer/Xcode/UserData/Previews folder

xcrun simctl --set previews delete unavailable
@DoubleREW
DoubleREW / Localization.swift
Created February 11, 2024 14:28
Add customizable and localized phrases to a Swift Packages
//
// Localization.swift
//
//
// Created by Fausto Ristagno on 11/02/24.
//
import SwiftUI
public struct PhraseKey : Hashable, RawRepresentable, ExpressibleByStringLiteral {
@DoubleREW
DoubleREW / debounce.swift
Last active March 15, 2021 02:49
Debounce Function for Swift 3 (implemented with OperationQueue)
extension OperationQueue {
/// Creates a debounced function that delays invoking `action` until after `delay` seconds have elapsed since the last time the debounced function was invoked.
///
/// - Parameters:
/// - delay: The number of seconds to delay.
/// - underlyingQueue: An optional background queue to run the function
/// - action: The function to debounce.
/// - Returns: Returns the new debounced function.
open class func debounce(delay: TimeInterval, underlyingQueue: DispatchQueue? = nil, action: @escaping () -> Void) -> (() -> Void) {
self.tabBar.snp_makeConstraints { (make) -> () in
make.width.equalTo(68.0)
make.top.equalTo(s.snp_top)
make.bottom.equalTo(s.snp_bottom)
make.leading.equalTo(s.snp_leading)
}
self.tabView.snp_makeConstraints { (make) -> () in
make.top.equalTo(s.snp_top)
make.bottom.equalTo(s.snp_bottom)
<?php
$file = '/path/to/file.png';
$filename = basename($file);
$upload_file = wp_upload_bits($filename, null, file_get_contents($file));
if (!$upload_file['error']) {
$wp_filetype = wp_check_filetype($filename, null );
$attachment = array(
'post_mime_type' => $wp_filetype['type'],
'post_parent' => $parent_post_id,