Skip to content

Instantly share code, notes, and snippets.

View alobaili's full-sized avatar
💭
Always learning

Abdulaziz Alobaili alobaili

💭
Always learning
View GitHub Profile
@alobaili
alobaili / open-terminal-at-project-directory.md
Last active March 28, 2020 16:42
Open a terminal window at Xcode project directory

You can make Xcode automatically open a terminal at the current directory using a shortcut you specify. Here are the steps:

  1. create an empty shell scrip file with the name open_terminal.sh and paste the following content in it:
#!/bin/bash

# I mainly use this as a behavior in Xcode to open
# Terminal at the project's working directory.
@alobaili
alobaili / String+CNPostalAddressFormatter.swift
Last active November 30, 2020 17:01
Correct the locale of numeric digits of an address string generated from CNPostalAddressFormatter
import Foundation
extension String {
/// Corrects the numeric digits of user-facing strings so that
/// they appear in the correct locale of the device.
///
/// For example, `CNPostalAddressFormatter` does not take into consideration the locale when
/// converting numerics digits. An address `"1234 King Fahd Rd."` in "en_US" locale gets
/// converted to `"1234 طريق الملك فهد"` in "ar_SA" while it should be `"١٢٣٤ طريق الملك فهد"`.
@alobaili
alobaili / YouTubePauseOverlayRemover.css
Last active October 27, 2021 15:04
Remove the pause overlay in embedded YouTube players
/* This is a simple style sheet that removes the
pause overlay that shows on embedded YouTube
players. I add this file as a global style sheet in
Safari from Preferences > Advanced > Style sheet
Alternatively, in Chrome, this can be done using
a Chrome Extension called Stylus.
*/
.ytp-pause-overlay {
display: none;
@alobaili
alobaili / DropAcceptingView.swift
Created December 18, 2021 18:55
Simple example of using onDrop(of:delegate:)
import SwiftUI
struct DropAcceptingView: View {
@State private var selectedImage: Image?
var body: some View {
ZStack {
Rectangle()
.fill(.secondary)