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
@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! */

Videos

@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)
}
}
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 / .gitignore
Created October 26, 2018 19:22 — forked from pepasflo/.gitignore
Scripts for encrypting / decrypting secrets (to prevent them from being accidentally checked into git)
secrets/
@oldtrafford91
oldtrafford91 / DIVI API Key
Last active March 20, 2021 19:11
DIVI API Key
User: cabhal
API: ea3688a183314df46706ab1f87d457d61acc8d54
@oldtrafford91
oldtrafford91 / Kill process by `lsof` command
Last active November 18, 2018 06:37
Bash command to free the port using by another process. Change PORT by port number need to free.
kill -kill $(lsof -t -i : PORT)
<script src="//static.tumblr.com/fpifyru/VCxlv9xwi/writecapture.js"></script>
<script type="text/javascript">
$(function() {
$("a[href]").each(
function(index, element) {
if ( $(element).text().indexOf('gist.github.com') > 0 ) {
var divElement = $('<div></div>');
$(element).after(divElement);
writeCapture.html(divElement, '<script src="'+$(element).text()+'.js"></'+'script>');
$(element).remove();
https://www.ashamaluevmusic.com
@oldtrafford91
oldtrafford91 / StackViewController.swift
Last active August 28, 2019 00:36
Base containment view controller with UIStackView embedded in UIScrollView to manage dynamic child view controller
import UIKit
class StackViewController: UIViewController {
private let scrollView = UIScrollView()
private let stackView = UIStackView()
override func viewDidLoad() {
super.viewDidLoad()
view.addSubview(scrollView)
scrollView.addSubview(stackView)