Skip to content

Instantly share code, notes, and snippets.

View manhpham90vn's full-sized avatar
😍

Manh Pham Van (Opn VN - Dev Manager) manhpham90vn

😍
View GitHub Profile
@eneko
eneko / dealloc-breakpoint.md
Last active March 18, 2025 22:10
Xcode UIViewController dealloc breakpoint

Xcode deinit breakpoint for UIViewController

This breakpoint provides an easy way to track view controller deinitialization (deallocation) in UIKit-based applications. This can help finding memory leaks caused by retain cycles preventing view controllers from being deinitialized when dismissed or popped.

From Cédric Luthi's tweet in 2017:

Useful Xcode breakpoint. When you dismiss a controller and you don’t hear the pop sound (or see the log), you probably have a retain cycle.

@IsaacXen
IsaacXen / README.md
Last active April 12, 2025 01:49
(Almost) Every WWDC videos download links for aria2c.
@11808s8
11808s8 / configure-ec2-wordpress-nginx-php-mariadb.sh
Last active October 28, 2023 17:43
Script for setting up an AWS EC2 instance with LEMP + Wordpress. Can be run on the User Data setting while launching an instance.
#!/usr/bin/env bash
# Author: @11808s8 - Adriano
# Email: [email protected]
# Version: 1.1.0 - 07/04/2020
#
# @TODO: Refactor this, breaking parts into modules
# and include more comments/User feedbacks
#
# @TODO: Remove hardcoded credentials
@ahmedk92
ahmedk92 / PageViewController.swift
Created July 18, 2019 16:10
UIPageViewController setViewControllers not calling dataSource methods fix
class PageViewController: UIPageViewController {
override func setViewControllers(_ viewControllers: [UIViewController]?, direction: UIPageViewController.NavigationDirection, animated: Bool, completion: ((Bool) -> Void)? = nil) {
super.setViewControllers(viewControllers, direction: direction, animated: animated) { (isFinished) in
if isFinished && animated {
DispatchQueue.main.async {
super.setViewControllers(viewControllers, direction: direction, animated: false, completion: nil)
}
}
completion?(isFinished)
@AmatsuZero
AmatsuZero / UICollectionViewLeftAlignedLayout.swift
Created June 18, 2019 09:30
UICollectionView 固定行距列表左排: 来一个自定制 Layout
// based on http://stackoverflow.com/questions/13017257/how-do-you-determine-spacing-between-cells-in-uicollectionview-flowlayout https://github.com/mokagio/UICollectionViewLeftAlignedLayout
import UIKit
extension UICollectionViewLayoutAttributes {
func leftAlignFrame(with sectionInset:UIEdgeInsets){
var tempFrame = frame
tempFrame.origin.x = sectionInset.left
frame = tempFrame
}
}
@nafferro
nafferro / UserDefaults.swift
Created February 11, 2019 14:45
For getting all keys & values from UserDefaults
for (key, value) in UserDefaults.standard.dictionaryRepresentation() {
print("\(key) = \(value) \n")
}
@fahimshahrierrasel
fahimshahrierrasel / Laravel PHP7.2 LEMP AWS.md
Last active July 26, 2019 13:51 — forked from santoshachari/Laravel PHP7 LEMP AWS.md
Laravel 5.x on Ubuntu 16.x, PHP 7.x, Nginx 1.x

#Steps to install latest Laravel, LEMP on AWS Ubuntu 16.4 version. This tutorial is the improvised verision of this tutorial on Digitalocean based on my experience.

Install PHP 7.2 on Ubuntu

Run the following commands in sequence.

sudo apt-get install -y language-pack-en-base
sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install zip unzip
@Godofbrowser
Godofbrowser / axios.refresh_token.1.js
Last active November 18, 2024 04:31 — forked from culttm/axios.refresh_token.js
Axios interceptor for refresh token when you have multiple parallel requests. Demo implementation: https://github.com/Godofbrowser/axios-refresh-multiple-request
// for multiple requests
let isRefreshing = false;
let failedQueue = [];
const processQueue = (error, token = null) => {
failedQueue.forEach(prom => {
if (error) {
prom.reject(error);
} else {
prom.resolve(token);
@JoseAlcerreca
JoseAlcerreca / Event.kt
Created April 26, 2018 10:25
An event wrapper for data that is exposed via a LiveData that represents an event.
/**
* Used as a wrapper for data that is exposed via a LiveData that represents an event.
*/
open class Event<out T>(private val content: T) {
var hasBeenHandled = false
private set // Allow external read but not write
/**
* Returns the content and prevents its use again.