Skip to content

Instantly share code, notes, and snippets.

@thanhluand
thanhluand / create-fat-framework.sh
Created May 10, 2021 09:58 — forked from sundeepgupta/create-fat-framework.sh
Script to create a universal or "fat" binary for an iOS framework.
#!/bin/bash
# Adapted from http://stackoverflow.com/questions/24039470/xcode-6-ios-creating-a-cocoa-touch-framework-architectures-issues/26691080#26691080
# and https://gist.github.com/cromandini/1a9c4aeab27ca84f5d79
# Create a new aggregate target.
# For the automatically generated scheme, change its build config to "release".
# Ensure this target's "product name" build setting matches the framework's.
# Add a run script with `source "${PROJECT_DIR}/path_to_this_script`
@thanhluand
thanhluand / beacon, location always
Last active June 8, 2022 18:04
Beacon, request location always on IOS > 14
import Foundation
import CoreLocation
import os
class BeaconService: NSObject {
static let shared = BeaconService()
private var locationManager: CLLocationManager = CLLocationManager()
var callback: ((_ beacons: [CLBeacon])->())?
private var requestLocationAuthorizationCallback: ((CLAuthorizationStatus) -> Void)?
override init() {
@thanhluand
thanhluand / gist:2d8f7157c17299a61d26301527f63773
Created January 28, 2020 05:30 — forked from mikeyk/gist:1329319
Testing storage of millions of keys in Redis
#! /usr/bin/env python
import redis
import random
import pylibmc
import sys
r = redis.Redis(host = 'localhost', port = 6389)
mc = pylibmc.Client(['localhost:11222'])
@thanhluand
thanhluand / Reachability.swift
Created January 27, 2020 10:27 — forked from saeed-rz/Reachability.swift
Network Reachability class in swift 4
import Foundation
import SystemConfiguration
class Reachability
{
var hostname: String?
var isRunning = false
var isReachableOnWWAN: Bool
var reachability: SCNetworkReachability?
var reachabilityFlags = SCNetworkReachabilityFlags()
@thanhluand
thanhluand / swift
Last active September 6, 2019 08:42
Handle call class in storyboard easy
import UIKit
extension UIViewController
{
class func instantiateFromStoryboard(_ name: String = "Main") -> Self
{
return instantiateFromStoryboardHelper(name)
}