Skip to content

Instantly share code, notes, and snippets.

@hartfordfive
hartfordfive / README.md
Last active January 12, 2023 12:25
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.

@jensim
jensim / add_default_reviewers.sh
Last active January 6, 2023 15:22
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 April 16, 2024 14:18
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 May 4, 2024 05:06
set -e, -u, -o, -x pipefail explanation
@ale84
ale84 / ArrowImageGenerator.swift
Last active May 15, 2020 09:00
Helper class to generate simple arrows images of desired size, colour and direction using UIKit api.
//
// ArrowImageGenerator.swift
//
// Created by Alessio Orlando on 07/10/15.
// Copyright © 2015 Alessio Orlando. All rights reserved.
//
import Foundation
import UIKit
extension UserDefaults {
subscript<T>(key: String) -> T? {
get {
return value(forKey: key) as? T
}
set {
set(newValue, forKey: key)
}
}
@bretton
bretton / lightning-maps.md
Last active December 29, 2023 02:59
Visualisers of the Lightning Network (and some other explorers)

A (mostly) visual collection of the Lightning Network

Disclaimer

Network views tend to be the view of the network from a single node, or small selection of nodes. They are not complete views of the network. This is impossible to achieve. Even if many node views were combined, it would still be incomplete.

These network views, or network maps, have been termed 'visualisers' by the LN community.

Screenshots may reflect older visual styles, and are dated accordingly.