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
#!/bin/sh | |
# | |
# BUILD PLATFORM SPECIFIC FRAMEWORKS | |
# | |
# rember before use: chmod +x create_xcframework.sh | |
# iOS devices | |
xcodebuild archive \ | |
-scheme "MyLibrary iOS" \ |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Web; | |
using System.Collections.Specialized; | |
using System.Text; | |
// ASP.NET [C#] REDIRECT WITH POST DATA | |
public static class WebExtensions | |
{ |
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
public extension String { | |
/// Search a json key/value and return the relative full json object | |
func searchAndDecode<T: Codable>(key: String?, value: String?) -> [T]? { | |
guard let key, let value else { return nil } | |
let pattern = "\\{[^}]*?\"\(key)\".*\"\(value)\"[^}]*\\}" | |
guard let list = self.replacingOccurrences(of: "{", with: "{\n").capture(pattern: pattern), | |
let data = "[\(list.joined(separator: ","))]".data(using: .utf8), | |
let items = try? JSONDecoder().decode([T].self, from: data) | |
else { return nil } | |
return items |
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 Foundation | |
class WeakRef<T> where T: AnyObject { | |
private let queue = DispatchQueue(label: "ThreadSafeWeakRef.queue", attributes: .concurrent) | |
private(set) weak var _object: T? | |
weak var object: T? { | |
var result: 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
// recognized content-type | |
private let data_sign = [ | |
"7z¼¯'": "application/x-7z-compressed", | |
"AIFF": "audio/x-aiff", | |
"AVI": "video/x-msvideo", | |
"BM": "image/bmp", | |
"BZh": "application/x-bzip2", | |
"MSCF": "application/vnd.ms-cab-compressed", | |
"ITSF": "application/vnd.ms-htmlhelp", | |
"!<arch>": "application/x-debian-package", |
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 Decodable | |
{ | |
init(_ data: Data) throws { | |
self = try JSONDecoder().decode(Self.self, from: data) | |
} | |
} | |
extension Data | |
{ | |
func toObject<T>() throws -> 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
// NSArray+NSDictionary.m | |
#import "NSObject+NSDictionary.h" | |
@implementation NSArray (NSDictionary) | |
- (NSDictionary*)toDictionary | |
{ | |
NSMutableDictionary *dict = [NSMutableDictionary new]; | |
[self enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { |
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 ConsoleLog { | |
// to log even when a device is not connected to xcode | |
// it generates a file that you can then download from the Organizer | |
// select Devices -> select device -> select app -> Dowload container | |
// after you can able show the content of file and you navigate | |
// to Document folder for get the log file. | |
static func logToFile() { | |
#if DEBUG | |
if !self.isXcode() { |
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
// | |
// ENBaseObject.swift | |
// | |
import OHMySQL // https://github.com/oleghnidets/OHMySQL | |
import EVReflection // https://github.com/evermeer/EVReflection | |
class ENBaseObject: EVObject, OHMappingProtocol { | |
static var table: String { | |
return "\(String(describing: self).dropFirst(2))" |
NewerOlder