Skip to content

Instantly share code, notes, and snippets.

@rluvaton
rluvaton / README.md
Last active September 17, 2024 11:27
Bundle install for mac that temporarly disable IPv6 for network interface while downloading

Fixed bundle install for MacOS

This is a zx script that fix bundle install

How to run:

The bundle-install file should be without extension (but not required) added the extension to make GitHub syntax highlighting work

So from now we just gonna use bundle-install instead of bundle-install.mjs

@hartfordfive
hartfordfive / README.md
Last active September 12, 2024 14:33
Git pre-commit hook to verify committer email

Description

The goal of this hook is to allow you catch when you're committing with an email you shouldn't on a public repositories. In some cases, certain companies need to seperate their internal coporate email accounts from those that might be used for committing to public repositories.

Setting up.

The UNWANTED_EMAIL_SUFFIX should be the suffix (after the @ sign) of the email address you do not want to appear in the git logs. The DESIRED_AUTHOR_EMAIL and DESIRED_AUTHOR_NAME are the respective email and name you want to show up in the git logs.

@yoxisem544
yoxisem544 / KeychainStorage.swift
Created November 5, 2020 03:26
Property wrapper of keychain store
import Foundation
import KeychainAccess
//https://www.swiftbysundell.com/articles/property-wrappers-in-swift/
public protocol AnyOptional {
var isNil: Bool { get }
}
extension Optional: AnyOptional {
public var isNil: Bool { self == nil }
@jensim
jensim / add_default_reviewers.sh
Last active June 6, 2024 21:44
Add default reviewers to bitbucket-server pull requests where there are currently 0 reviewers
#!/bin/bash
#set -x
set -e
host='https://my-code.local'
if ! which jq ; then
echo 'jq not installed.' >&2
exit 1
@bryanbraun
bryanbraun / git-branching-diagram.md
Last active September 17, 2024 11:19
Example Git Branching Diagram

Example Git Branching Diagram

You can use this diagram as a template to create your own git branching diagrams. Here's how:

  1. Create a new diagram with diagrams.net (formerly draw.io)
  2. Go to File > Open From > URL
  3. Insert this url (it points to the xml data below): https://gist.githubusercontent.com/bryanbraun/8c93e154a93a08794291df1fcdce6918/raw/bf563eb36c3623bb9e7e1faae349c5da802f9fed/template-data.xml
  4. Customize as needed for your team.

@emctague
emctague / TupleToArray.swift
Created January 29, 2020 00:24
Tuple to Array Conversion for Swift
/**
# Tuple-to-array for Swift
By Ethan McTague - January 28, 2020
This source code is in the public domain.
## Example
To convert a tuple of Ints into an array of ints:
@cyrilchandelier
cyrilchandelier / MinimumTouchAreaButton.swift
Created September 23, 2019 07:30
A Swift UIButton extension to ensure the hit-zone is at least 44x44
import UIKit
class MinimumTouchAreaButton: UIButton {
override func hitTest(_ point: CGPoint, with _: UIEvent?) -> UIView? {
guard !isHidden, isUserInteractionEnabled, alpha > 0 else {
return nil
}
let expandedBounds = bounds.insetBy(dx: min(bounds.width - 44.0, 0), dy: min(bounds.height - 44.0, 0))
return expandedBounds.contains(point) ? self : nil
}
@blochberger
blochberger / Info.plist
Last active January 14, 2024 14:12
macOS/iOS TLS 1.3 Support
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>www.howsmyssl.com</key>
<dict>
@mohanpedala
mohanpedala / bash_strict_mode.md
Last active September 20, 2024 16:38
set -e, -u, -o, -x pipefail explanation
@enomoto
enomoto / LocaleExtension.swift
Last active August 12, 2024 07:03
Change locale in XCTestCase
private extension MyTests {
private func setLocaleAsJP() {
let original = class_getClassMethod(NSLocale.self, #selector(getter: NSLocale.current))!
let swizzled = class_getClassMethod(NSLocale.self, #selector(NSLocale.myCurrentLocale))!
method_exchangeImplementations(original, swizzled)
}
}
// https://stackoverflow.com/questions/31065859/how-can-i-change-the-locale-on-the-xcode-playground
fileprivate extension NSLocale {