Skip to content

Instantly share code, notes, and snippets.

View oldtrafford91's full-sized avatar
🔍
Job Seeking

Hai Tran oldtrafford91

🔍
Job Seeking
View GitHub Profile
TAGS="TODO:|FIXME:"
echo "searching ${SRCROOT} for ${TAGS}"
find "${SRCROOT}" \( -name "*.swift" \) -print0 \
| xargs -0 egrep --with-filename --line-number --only-matching "($TAGS).*\$" \
| perl -p -e "s/($TAGS)/ warning: \$1/"
@oldtrafford91
oldtrafford91 / gist:bb9f5916c5a29d0d618c8166bede4a07
Created September 15, 2018 11:07
Change UIButton spacing between title and image with out affect intrinsicContentSize
extension UIButton {
func changeButtonTitleAndImageSpacing(spacing: CGFloat) {
let insetAmount = spacing / 2
imageEdgeInsets = UIEdgeInsets(top: 0, left: -insetAmount, bottom: 0, right: insetAmount)
titleEdgeInsets = UIEdgeInsets(top: 0, left: insetAmount, bottom: 0, right: -insetAmount)
contentEdgeInsets = UIEdgeInsets(top: 0, left: insetAmount, bottom: 0, right: insetAmount)
}
}

Videos

@oldtrafford91
oldtrafford91 / delete_chrome_history_search.js
Created October 6, 2015 23:42
Useful gist to help delete all history with certain search in Google Chrome in one click
function removeItems() {
removeButton = document.getElementById('remove-selected');
overlayWindow = document.getElementById('overlay');
//revision (07.28.15): Replaced the For Loop targeting the checkboxes, thanks to Denis Gorbachev via comments (02.19.15)
Array.prototype.forEach.call(document.querySelectorAll("input[type=checkbox]"), function(node) {node.checked = "checked"});
setTimeout(function () {
if (removeButton.getAttribute("disabled") !== null) {
removeButton.removeAttribute("disabled")
}
/* revision (08.20.14): no longer binding to that condition, button should no longer be disabled, so click! */