Skip to content

Instantly share code, notes, and snippets.

// 終點座標
let targetCoordinate = self.targetLocation.coordinate
// 初始化 MKPlacemark
let targetPlacemark = MKPlacemark(coordinate: targetCoordinate)
// 透過 targetPlacemark 初始化一個 MKMapItem
let targetItem = MKMapItem(placemark: targetPlacemark)
// 使用當前使用者當前座標初始化 MKMapItem
let userMapItem = MKMapItem.forCurrentLocation()
// 建立導航路線的起點及終點 MKMapItem
let routes = [userMapItem,targetItem]
@kevenbauke
kevenbauke / wkwebview_links_externally.swift
Last active June 21, 2022 17:13
WKWebView open links in Safari
@robhrt7
robhrt7 / MySQL_5-7_macOS.md
Last active October 5, 2025 11:57 — forked from nrollr/MySQL_macOS_Sierra.md
Install MySQL 5.7 on macOS using Homebrew

This is a fork of original gist https://gist.github.com/nrollr/3f57fc15ded7dddddcc4e82fe137b58e, with slight changes on pointing to 5.7 version branch, instead of 8 (latest default of MySQL in Hombrew).

Install MySQL 5.7 on macOS

This procedure explains how to install MySQL using Homebrew on macOS (Sierra 10.12 and up)

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.
@LOG-TAG
LOG-TAG / VolleyOkHttp3StackInterceptors.java
Last active December 30, 2022 16:53
CREDITS: <1>https://gist.github.com/alashow/c96c09320899e4caa06b <2>https://gist.github.com/intari/e57a945eed9c2ee0f9eb9082469698f3 <3>https://gist.github.com/alirezaafkar/a62d6a9a7e582322ca1a764bad116a70 Reason: for making the Volley use latest okhttpstack work for latest version Volley 1.1.0 by removing all deprecated org.apache dependencies!
/**
* Created by @subrahmanya on 2/3/18.
* CREDITS:
*<1>https://gist.github.com/alashow/c96c09320899e4caa06b
*<2>https://gist.github.com/intari/e57a945eed9c2ee0f9eb9082469698f3
*<3>https://gist.github.com/alirezaafkar/a62d6a9a7e582322ca1a764bad116a70
*
*
* Reason: for making the Volley use latest okhttpstack work for latest version Volley 1.1.0 by removing all deprecated org.apache dependencies!
*/
@litoarias
litoarias / CustomWKWebView.swift
Last active June 20, 2024 20:19
Custom class of WKWebView implementing SSL Pinning
import WebKit
public class CustomWebView: WKWebView {
// var javascript: Javascript!
public override init(frame: CGRect, configuration: WKWebViewConfiguration = WKWebViewConfiguration()) {
super.init(frame: frame, configuration: configuration)
doInit()
@xujiaao
xujiaao / android-studio-disable-test-only-mode.md
Last active May 16, 2024 16:16
Disable 'testOnly' mode for Android Studio 3.0
tags
Android
Android Studio

Disable 'testOnly' mode for Android Studio 3.0

@grimzy
grimzy / git-pull-all
Created September 15, 2017 02:15
Git pull all remote branches
#!/usr/bin/env bash
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git fetch --all
git pull --all
@nmcc
nmcc / CONSOLAS.md
Last active June 30, 2025 13:05
Install Consolas font on Mac

Download and install the font

  1. Download the Consolas font from http://www.fontpalace.com/font-details/Consolas/
  2. Open Finder and navigate to Downloads directory
  3. Double click the Consolas.ttf file
  4. A dialog box appears displaying the details about the font
  5. Click Install font button

Using Consolas font on IntelliJ IDEA:

  1. Open IDEA Preferences Window (Press Command + ,)
  2. Editor > Colors & Fonts > Font
@yoni-g
yoni-g / closeAppElegantly.swift
Last active October 1, 2025 17:21
How to exit an iOS app without it looking like a crash? - Swift
func showMessageResetApp(){
let exitAppAlert = UIAlertController(title: "Restart is needed",
message: "We need to restart the app on your first login to the app.\n Please reopen the app after this.",
preferredStyle: .alert)
let resetApp = UIAlertAction(title: "Close Now", style: .destructive) {
(alert) -> Void in
// home button pressed programmatically - to thorw app to background
UIControl().sendAction(#selector(URLSessionTask.suspend), to: UIApplication.shared, for: nil)
// terminaing app in background
@Yousha
Yousha / .gitignore
Last active August 17, 2025 12:00
.gitignore for PHP developers.
##### Windows
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump