Skip to content

Instantly share code, notes, and snippets.

View ecaepsey's full-sized avatar
🏠
Working from home

Damir Aushenov ecaepsey

🏠
Working from home
  • Keremet Bank
  • Kyrgyzstan
View GitHub Profile
@dakeshi
dakeshi / Clean web data in WKWebView
Created June 10, 2016 06:17
Use an default WKWebView save all caches, cookies data in the app. So it make very critical issue such as infinite increase app size.
/// In AppDelegate.swift
/// Execute remove webdata method when the app receives the memory warning.
///
/// We can not avoid the infinitely get increased the app size issue
/// when users keep the web searching using the WKWebView.
/// So, you would get iOS full storage message.
///
/// Set WKWebsiteDataStore.nonPersistentDataStore in the configuration
/// can make lightweight WKWebView. But it can not apply every web site.
/// Imagine the web sites used the localStorage, IndexedDB features.
@DavidNix
DavidNix / SlideRevealTransitioner.swift
Last active October 19, 2023 11:04
iOS example of using UIViewControllerTransitioningDelegate to create a slide to reveal effect.
// A common effect when you press a hamburger button.
public class SlideRevealTransitioner: NSObject {
private let percentage: CGFloat
public init(percentage: CGFloat) {
self.percentage = percentage
}
@smokyonion
smokyonion / GenericDelegate.swift
Created August 26, 2016 17:03
Generic Delegate Pattern in Swift 3
public protocol DataSource: class {
associatedtype AbstractType
func source() -> AbstractType
}
class ViewController<T: DataSource>: UIViewController {
weak var dataSouce: T?
typealias AbstractType = T.AbstractType
@jbelke
jbelke / Mac OSX Setup - Brew
Last active May 2, 2024 05:45
Mac OSX Setup - Brew and Cask
# Get Sudo.
if [ $EUID != 0 ]; then
sudo "$0" "$@"
exit $?
fi
# Install Xcode first - https://itunes.apple.com/us/app/xcode/id497799835?ls=1&mt=12
# Install Xcode command line tools.
xcode-select --install
@eMdOS
eMdOS / NibLoadableView.swift
Last active October 15, 2021 12:29
Reusable views and cell registration and dequeuing (for table views and collection views)
protocol NibLoadableView: class {
static var nibName: String { get }
}
extension NibLoadableView where Self: UIView {
static var nibName: String {
return String(describing: self)
}
}
@heron2014
heron2014 / react-native-maps-enable-google-maps-instructions.md
Last active May 21, 2024 07:25
Visual instructions how to enable Google Maps on IOS using react-native-maps

Visual instructions how to enable Google Maps on IOS using react-native-maps

UPDATE: Following instructions are now a year old. I have recently managed to upgrade react-native-maps from 0.17 to the latest version 0.21 with react-native 0.51 - if you want to follow my instruction scroll down to the end this doc! Hope that will work for you too!

This is for my personal use, things might not be correctly explained here. For the official docs please check https://github.com/airbnb/react-native-maps

Steps from scratch:

1.react-native init GoogleMapPlayground

@perlguy99
perlguy99 / Alamofire.request.error.handling.swift
Last active January 16, 2023 19:52
Alamofire Request Error Handling - From their documentation
Alamofire.request(urlString).responseJSON { response in
guard case let .failure(error) = response.result else { return }
if let error = error as? AFError {
switch error {
case .invalidURL(let url):
print("Invalid URL: \(url) - \(error.localizedDescription)")
case .parameterEncodingFailed(let reason):
print("Parameter encoding failed: \(error.localizedDescription)")
print("Failure Reason: \(reason)")
@ORESoftware
ORESoftware / resize-base64.js
Last active May 15, 2024 18:20
resizing an image on the front-end before sending to a server
// Using this code, we can retrieve an image from a user's filesystem, resize the image, and then upload the image
// to a server using AJAX. Because we use base64 encoding, we can just include the image data as just another string value
// in a JSON payload.
// So we can use AJAX to send the file to a server, which is convenient.
// We have one line of relevant html
// get file in the first place => <input type="file" custom-on-change="onAcqImageFileChange" class="form-control">
//
// PaginationNetworkLogic.swift
//
// Created by Daniel Tartaglia on 4/9/17.
// Copyright © 2019 Daniel Tartaglia. MIT License
//
import RxSwift
struct PaginationUISource {
@enqtran
enqtran / [React native] Custom back Buton in react-native-router-flux
Last active May 11, 2022 19:00
Custom back button in react-native-router-flux
.....
const renderBackButton = () => (
<TouchableOpacity
onPress={() => Actions.pop()}
>
<View style={{ alignItems: 'center' }}>
<Image
source={require('./components/images/icon_back.png')}
style={{ width: 30, height: 20 }}