Skip to content

Instantly share code, notes, and snippets.

View jazz-mobility's full-sized avatar
:octocat:

Jasveer Singh jazz-mobility

:octocat:
View GitHub Profile
@jazz-mobility
jazz-mobility / genstringsforsettingsbundle.swift
Created February 26, 2024 11:55 — forked from mmysliwiec/genstringsforsettingsbundle.swift
Swift script for generating .strings file based on settings bundle .plist file.
#!/usr/bin/env swift
// This is a script for extracting all localizable strings from the Root.plist (Settings.bundle)
//
import Foundation
typealias Plist = [String: Any]
var currentGroup: String?
// Parameters
@jazz-mobility
jazz-mobility / macos-jdk-install.md
Created August 27, 2023 17:31 — forked from tinkerware/macos-jdk-install.md
Maintaining Java Installs on macOS Using Homebrew Cask

Maintaining Java Installs on macOS Using Homebrew Cask

Recently, I upgraded my MacBook Pro from a old, trusty Yosemite to Sierra, and reluctantly had to clean out the old JDK versions I had accumulated over a few years. I also wanted to have a Java 9 JDK to play around with the new module system and API’s.

Good news is that, for a while now, you have been able to install and upgrade multiple versions of JDK using only your shell, without having to deal with Oracle’s graphical installers.

To install Java from scratch, install Homebrew Cask cask-update (you need to have Homebrew already installed) first, then install Java using Cask:

brew tap buo/cask-upgrade & brew tap caskroom/versions
brew cask install java8
@jazz-mobility
jazz-mobility / URL+UTM.swift
Created May 8, 2023 09:14
Parse UTM parameters from urls in Swift
extension URL {
var utmParameters: [String: String]? {
guard let queryItems = URLComponents(url: self, resolvingAgainstBaseURL: true)?.queryItems else {
return nil
}
var utmParams: [String: String] = [:]
for queryItem in queryItems {
if queryItem.name.hasPrefix("utm_") {
utmParams[queryItem.name] = queryItem.value
@jazz-mobility
jazz-mobility / flutter_bootstrap.sh
Created April 18, 2023 20:36
Install all flutter Dependencies on MacOS.
#!/bin/bash
# Check if Homebrew is installed
if ! which -s brew; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
else
echo "Homebrew is already installed."
fi
# Install required dependencies
@jazz-mobility
jazz-mobility / XcodeBuildSettingsReference.md
Created November 26, 2021 11:30 — forked from NSExceptional/XcodeBuildSettingsReference.md
The Xcode Build Settings Reference in a searchable document, as of Xcode 8.3.2

Build settings reference

Active Build Action (ACTION)

A string identifying the build system action being performed.

Additional SDKs (ADDITIONAL_SDKS)

The locations of any sparse SDKs that should be layered on top of the one specified by Base SDK (SDKROOT). If more than one SDK is listed, the first one has highest precedence. Every SDK specified in this setting should be a "sparse" SDK, for example, not an SDK for an entire macOS release.

Alternate Install Group (ALTERNATE_GROUP)

@jazz-mobility
jazz-mobility / PowerlineForTerminal.md
Created September 26, 2021 23:38 — forked from DucNgn/PowerlineForTerminal.md
Powerline style for terminal OSX

Installing and configuring Powerline-style command line tools for developers (OSX)

Intro:

For every developer, terminal is their weapon, so why don't you customize it to become a powerful, and a beautiful weapon?

Powerline style refers to a terminal style that helps developer to keep track of their workflow easily, allows them to have perfect visual on current directories and new changes. It is also git recognizable, and failure detector that will help your development process becomes more interact and much faster.

In this guideline, I will introduce you with 2 smart shells: Zsh and Fishshell. Both are perfect for the development jobs due to its rich of resources, and user-friendly.

Note:

@jazz-mobility
jazz-mobility / README.md
Created September 26, 2021 20:45 — forked from fnichol/README.md
A Common .ruby-version File For Ruby Projects

A Common .ruby-version File For Ruby Projects

Background

I've been using this technique in most of my Ruby projects lately where Ruby versions are required:

  • Create .rbenv-version containing the target Ruby using a definition name defined in ruby-build (example below). These strings are a proper subset of RVM Ruby string names so far...
  • Create .rvmrc (with rvm --create --rvmrc "1.9.3@myapp") and edit the environment_id= line to fetch the Ruby version from .rbenv-version (example below).

Today I learned about another Ruby manager, rbfu, where the author is using a similar technique with .rbfu-version.

@jazz-mobility
jazz-mobility / syscall.swift
Created July 19, 2021 23:07 — forked from Azoy/syscall.swift
Raw system calls in Swift
// macOS x86_64 syscall works as follows:
// Syscall id is moved into rax
// 1st argument is moved into rdi
// 2nd argument is moved into rsi
// 3rd argument is moved into rdx
// ... plus some more
// Return value is stored in rax (where we put syscall value)
// Mac syscall enum that contains the value to correctly call it
enum Syscall: Int {
@jazz-mobility
jazz-mobility / libdispatch-efficiency-tips.md
Created January 11, 2021 23:53 — forked from tclementdev/libdispatch-efficiency-tips.md
Making efficient use of the libdispatch (GCD)

libdispatch efficiency tips

The libdispatch is one of the most misused API due to the way it was presented to us when it was introduced and for many years after that, and due to the confusing documentation and API. This page is a compilation of important things to know if you're going to use this library. Many references are available at the end of this document pointing to comments from Apple's very own libdispatch maintainer (Pierre Habouzit).

My take-aways are:

  • You should create very few, long-lived, well-defined queues. These queues should be seen as execution contexts in your program (gui, background work, ...) that benefit from executing in parallel. An important thing to note is that if these queues are all active at once, you will get as many threads running. In most apps, you probably do not need to create more than 3 or 4 queues.

  • Go serial first, and as you find performance bottle necks, measure why, and if concurrency helps, apply with care, always validating under system pressure. Reuse