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
// Create AxiosInterceptor component & axiosInstance. | |
import { useEffect, useState } from "react"; | |
import { useGlobalContext } from "../utils/hooks"; | |
import { useNavigate } from "react-router-dom"; | |
import axios from "axios"; | |
import * as Helpers from "../utils/Helpers"; | |
import constants from "../utils/constants"; | |
import AuthAPI from "./AuthAPI"; | |
const axiosInstance = axios.create({ |
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
// Create AxiosInterceptor component & axiosInstance. | |
import { useEffect, useState } from "react"; | |
import { useGlobalContext } from "../utils/hooks"; | |
import { useNavigate } from "react-router-dom"; | |
import axios from "axios"; | |
import * as Helpers from "../utils/Helpers"; | |
import constants from "../utils/constants"; | |
import AuthAPI from "./AuthAPI"; | |
const axiosInstance = axios.create({ |
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 | |
import StoreKit | |
//MARK: SKProductsRequestDelegate | |
extension IAPHelpers : SKProductsRequestDelegate | |
{ | |
func productsRequest(request: SKProductsRequest, didReceiveResponse response: SKProductsResponse) | |
{ |
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" ], |
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 monitor = NWPathMonitor() | |
/* closure called when path changes */ | |
let pathUpdateHandler = {(path:NWPath) in | |
let availableInterfaces = path.availableInterfaces | |
if !availableInterfaces.isEmpty { | |
//e.g. [ipsec4, en0, pdp_ip0] | |
let list = availableInterfaces.map { $0.debugDescription }.joined(separator: "\n") | |
} |
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 | |
extension JSONEncoder { | |
func encodeJSONObject<T: Encodable>(_ value: T, options opt: JSONSerialization.ReadingOptions = []) throws -> Any { | |
let data = try encode(value) | |
return try JSONSerialization.jsonObject(with: data, options: opt) | |
} | |
} | |
extension JSONDecoder { |
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 state = [ "AK - Alaska", | |
"AL - Alabama", | |
"AR - Arkansas", | |
"AS - American Samoa", | |
"AZ - Arizona", | |
"CA - California", | |
"CO - Colorado", | |
"CT - Connecticut", | |
"DC - District of Columbia", | |
"DE - Delaware", |
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
- (void)viewDidLoad { | |
//find the UITextField view within searchBar (outlet to UISearchBar) | |
//and assign self as delegate | |
for (UIView *view in searchBar.subviews){ | |
if ([view isKindOfClass: [UITextField class]]) { | |
UITextField *tf = (UITextField *)view; | |
tf.delegate = self; | |
break; | |
} | |
} |
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
- (BOOL) startCapture: (NSError**)outError { | |
if (!_session) { | |
_session = [[AVCaptureSession alloc] init]; | |
AVCaptureDevice* video = [AVCaptureDevice defaultDeviceWithMediaType: AVMediaTypeVideo]; | |
if (!video) | |
return [self failWithMessage: @"No video camera available" error: outError]; | |
AVCaptureDeviceInput* input = [AVCaptureDeviceInput deviceInputWithDevice: video | |
error: outError]; | |
if (!input) | |
return [self failWithMessage: @"Couldn't acquire input device" error: outError]; |
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
// | |
// UIDevice+XMUtils.h | |
// AwesomeTips | |
// | |
// Created by kangzubin on 2018/9/20. | |
// Copyright © 2018 KANGZUBIN. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> |
NewerOlder