This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class ViewController: UIViewController { | |
@IBOutlet weak var mySrchBar: UISearchBar! | |
private var lastSearchTxt = "" | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@propertyWrapper | |
struct Logging<T> { | |
var value: T | |
init(wrappedValue value: T) { | |
self.value = value | |
} | |
var wrappedValue: T { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/swift | |
// DISCLAIMER | |
// This script modifies an unencrypted file associated with the trial version of Final Cut Pro. | |
// Under the DMCA (17 U.S.C. § 1201), this modification does not qualify as circumvention of a technological | |
// protection measure (TPM), as it does not involve bypassing encryption, authentication, or similar protections. | |
// Distributing this code is therefore legal under the DMCA. | |
// This script is intended for educational and research purposes, such as exploring trial-related file structures, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Custom Date Decoding | |
jsonDecoder.dateDecodingStrategy = .custom({ (decoder) -> Date in | |
let data = try decoder.singleValueContainer().decode(String.self) | |
//perform your operation on obtained string | |
let disturbance = "01-07-1977" | |
let formatter = DateFormatter() | |
formatter.dateFormat = "dd-MM-yyyy" | |
if data == "First disturbance in force" { | |
return formatter.date(from: disturbance) ?? Date() | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let queue = DispatchQueue(label: "queue", attributes: .concurrent) | |
let workItem = DispatchWorkItem { | |
print("done") | |
} | |
DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(1)) { | |
queue.async(execute: workItem) // not work | |
} | |
workItem.cancel() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# after appcleaner does his magic, do this | |
sudo rm -rf "/Library/Application Support/Paragon Software/" | |
sudo rm /Library/LaunchDaemons/com.paragon-software.installer.plist | |
sudo rm /Library/LaunchDaemons/com.paragon-software.ntfs.loader.plist | |
sudo rm /Library/LaunchDaemons/com.paragon-software.ntfsd.plist | |
sudo rm /Library/LaunchAgents/com.paragon-software.ntfs.notification-agent.plist | |
sudo rm -rf /Library/Filesystems/ufsd_NTFS.fs/ | |
sudo rm -rf /Library/PrivilegedHelperTools/com.paragon-software.installer | |
sudo rm -rf /Library/Extensions/ufsd_NTFS.kext/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// debounce-throttle.swift | |
// | |
// Created by Simon Ljungberg on 19/12/16. | |
// License: MIT | |
// | |
import Foundation | |
extension TimeInterval { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AppRestService : IAppRestService { | |
override fun getAppRestService(): IRestService { | |
val httpClient = OkHttpClient().newBuilder() | |
val interceptor = Interceptor { chain -> | |
val request = chain?.request()?.newBuilder()?.addHeader("SomeHeader", "SomeHeaderProperty")?.build(); | |
chain?.proceed(request) | |
} | |
httpClient.networkInterceptors().add(interceptor) | |
val customGson = GsonBuilder().registerTypeAdapter(MyClassCloud::class.java, MyClassCloudDeserializer("1")).create() | |
val retrofit = Retrofit.Builder().baseUrl(IRestService.URL_BASE).addConverterFactory(GsonConverterFactory.create(customGson)).client(httpClient.build()).build() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension Array { | |
func after(item: T) -> T? { | |
if let index = find(self, item) where index + 1 < count { | |
return self[index + 1] | |
} | |
return nil | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mediaJSON = { "categories" : [ { "name" : "Movies", | |
"videos" : [ | |
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org", | |
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ], | |
"subtitle" : "By Blender Foundation", | |
"thumb" : "images/BigBuckBunny.jpg", | |
"title" : "Big Buck Bunny" | |
}, | |
{ "description" : "The first Blender Open Movie from 2006", | |
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ], |
NewerOlder