sudo ifconfig lo0 alias 10.254.254.254
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
#!/bin/bash | |
SIMULATOR_IDENTIFIER="SIMULATOR_ID" #Get it from Xcode's Organizer | |
BUNDLE_IDENTIFIER="com.application.bundleId" | |
APNS_PAYLOAD=' | |
{ | |
"Simulator Target Bundle": "${BUNDLE_IDENTIFIER}", | |
"aps" : { | |
"alert" : { |
#!/bin/bash | |
# This script is based on Apple Official Documentation : | |
# https://developer.apple.com/documentation/usernotifications/sending-push-notifications-using-command-line-tools#Send-a-device-push-notification-using-a-JWT | |
# Replace these values with your own | |
TEAM_ID="XXXXXXXXX" # the Apple Team Id | |
AUTH_KEY_ID="XXXXXXXXX" # Name of the P8 key, as it appears on the developer portal | |
TOKEN_KEY_FILE_NAME="/path/to/key.p8" # Path to the local P8 file generated on the developer portal | |
DEVICE_TOKEN="device-token" # the APNS token retrieved from didRegisterForRemoteNotificationsWithDeviceToken callback |
# replace "Hello, World!" with appropriate string to search for | |
# replace `post_title` with appropriate column to search for | |
wp site list --fields=url,blog_id | while IFS= read -r line; do | |
url=$(echo "$line" | awk -F'\t' '{print $1}') | |
blog_id=$(echo "$line" | awk -F'\t' '{print $2}') | |
wp post list --field=url --ignore_sticky_posts=1 --orderby=date --order=DESC --post__in=$(wp db query "SELECT ID FROM wp_${blog_id}_posts WHERE post_title LIKE '%Hello, World!%' AND post_status='publish' AND post_type='post'" --skip-column-names --url=${url} | paste -s -d ',' -) --url=${url} | |
done >> log.txt |
func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) { | |
// Page width used for estimating and calculating paging. | |
let pageWidth = (self.frame.width) - interIntemMargin | |
// Make an estimation of the current page position. | |
let approximatePage = scrollView.contentOffset.x/pageWidth | |
// Determine the current page based on velocity. | |
let currentPage = (velocity.x < 0.0) ? floor(approximatePage) : ceil(approximatePage) |
import UIKit | |
class LeftAlignedCollectionViewFlowLayout: UICollectionViewFlowLayout { | |
override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? { | |
guard let superArray = super.layoutAttributesForElements(in: rect), | |
let attributes = NSArray(array: superArray, copyItems: true) as? [UICollectionViewLayoutAttributes] else { return nil } | |
var leftMargin = sectionInset.left | |
var maxY: CGFloat = -1.0 |
import Foundation | |
import RxSwift | |
enum Either<T> { | |
case success(T) | |
case error(Swift.Error) | |
var successResult: T? { | |
switch self { | |
case .success(let result): |
import Foundation | |
enum Either<T> { | |
case success(T) | |
case error(Swift.Error) | |
var successResult: T? { | |
switch self { | |
case .success(let result): | |
return result | |
case .error(_): |
#Reduce App Size