Skip to content

Instantly share code, notes, and snippets.

View userow's full-sized avatar

Pavlo Vasylenko userow

View GitHub Profile
@tibr
tibr / NSFileManager+DoNotBackup.h
Created March 8, 2012 09:42
Setting the do not backup attribute in different iOS versions
@interface NSFileManager (DoNotBackup)
- (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL;
@end
@n-b
n-b / NBResponderChainUtilities.h
Last active August 3, 2021 10:08
Chain Responder Debugging Methods
//
// NBResponderChainUtilities.h
//
// Created by Nicolas @ bou.io on 19/04/13.
//
#import <UIKit/UIKit.h>
@interface UIView (NBResponderChainUtilities)
- (UIView*) nb_firstResponder; // Recurse into subviews to find one that responds YES to -isFirstResponder
@tpitale
tpitale / README.md
Last active June 19, 2024 19:34
Sublime Text plugin to create a simple timestamp
  1. Go to Tools > New Plugin
  2. Paste timestamp.py contents and save in User as timestamp.py
  3. Open Preferences > Key Bindings - User (or Default, your call)
  4. Paste keybindings.json, or add a line to your keybindings
  5. Customize the keyboard shortcut to your liking and save
@ZevEisenberg
ZevEisenberg / resetAllSimulators.sh
Last active June 20, 2024 17:13
Reset all iOS simulators with this one weird trick
osascript -e 'tell application "iOS Simulator" to quit'
osascript -e 'tell application "Simulator" to quit'
xcrun simctl erase all
@patricklynch
patricklynch / gist:689525d466c4ada42b8e
Last active October 30, 2021 05:23
The 6 ways to unwrap optionals in Swift 2.0
// The 6 ways to uwnrap optionals in Swift 2.0
//
// Created by Patrick Lynch on 6/28/15.
// Copyright © 2015 Patrick Lynch. All rights reserved.
import Foundation
// 1. Force Unwrapping
// 2. Optional Binding
// 3. Optional Chaining
@agentcooper
agentcooper / 0.README.md
Last active April 9, 2024 19:27
Telegram chat backup/export

How to use

  1. Login to https://web.telegram.org
  2. Copy-paste contents of telegram-scripts.js into JS console
  3. Run showContacts() to get the list of contacts with ids
  4. Run saveChat(userId) where userId is the id from step 3

Process can take a while, check console for progress. Occasionall FLOOD_WAIT errors are expected. Once done, browser will download the JSON file.

Motivation

@anitaa1990
anitaa1990 / CurvedUIView.swift
Last active May 18, 2022 16:22
A Swift extension of UIView to display a curved view
import UIKit
extension UIView {
/* Usage Example
* bgView.addBottomRoundedEdge(desiredCurve: 1.5)
*/
func addBottomRoundedEdge(desiredCurve: CGFloat?) {
@vladimirgoncharov
vladimirgoncharov / Semaphore.playground
Last active March 31, 2023 07:47
Using semaphore in SWIFT
import UIKit
/// -------------------------------------------------------------------
private func example1() {
let queue = DispatchQueue.global(qos: DispatchQoS.QoSClass.default)
for i in 0..<10 {
queue.async() {
print("Start: \(i)")
sleep(3)
@rbrovko
rbrovko / NoteExtensionsTests.swift
Last active June 30, 2019 16:35
iOS Unit tests for task#2 (Test target - NoteTests.swift) or Playground
//
// NoteExtensionsTests.swift
// NoteTests
//
// Created by Roman Brovko on 6/18/19.
// Copyright © 2019 Roman Brovko. All rights reserved.
//
import XCTest
@testable import Note
@george-lim
george-lim / swiftlint.sh
Created January 20, 2020 00:58
A handy Xcode run script that applies SwiftLint only to new Swift codebase changes
#!/bin/bash
# Parameters
source="$(pwd)/$1" # Track folder source where diffs are checked
index=$2 # Track diff remote
project_root=${0%/*} # Track project root folder
swiftlint_path='Pods/SwiftLint/swiftlint' # Track SwiftLint path
# Parameter check
if [[ $# < 1 ]]; then