Skip to content

Instantly share code, notes, and snippets.

@aryelgois
aryelgois / stack_trace.php
Last active March 12, 2018 17:36
Wraps the PHP Stack trace of a wab page you are developing for better visualization
#!/usr/bin/env php
<?php
/**
* Wraps the PHP Stack trace of a wab page you are developing for better
* visualization
*
* Recomended usage:
*
* 1. Open your terminal and run
*
@aryelgois
aryelgois / git-ignore-line.sh
Last active March 26, 2024 16:16
Git filter to ignore lines in your files
#!/bin/sh
# Git filter to ignore lines in your files.
#
# Copyright (c) 2017-2019,2023 Aryel Mota Góis <aryel.gois@gmail.com>
#
# MIT License
#
#
# SETUP:
#
@aryelgois
aryelgois / git-recommit.sh
Last active January 1, 2020 02:00
Amend the last commit overriding the committer and author info
#!/bin/sh
# Amend the last commit overriding the committer and author info.
#
# The committer info is forced to be the same as the author's.
#
# Options:
# $1 Overrides date
# $2 Overrides name
# $3 Overrides email
#
@aryelgois
aryelgois / git-colored.sh
Last active March 12, 2018 17:31
Fix git colors for watch(1)
#!/usr/bin/env bash
# Fix git colors, userful for watch(1)
#
# @usage watch -c 'git colored <git command>'
# @see https://askubuntu.com/questions/967503 for an example of the problem and explanation
# run git command and replace all foreground colors to include '0'
exec git -c color.ui=always "$@" | sed -r $'s/\033\[([[:digit:]][[:digit:]])m/\033\[0;\\1m/g; s/\033\[m/\033\[0m/g'
@aryelgois
aryelgois / HttpResponse.php
Created February 20, 2018 01:44 — forked from ewwink/http_response_code.php
PHP Class for HTTP Response Status Codes
<?php
/**
* This Software is provided "as is" under the terms of the MIT license.
*
* @link https://opensource.org/licenses/MIT
*/
/**
* Provides named constants for HTTP protocol status codes and their messages
*
@aryelgois
aryelgois / git-watchless.sh
Last active January 1, 2020 01:54
Watch your commit history in the terminal
#!/bin/sh
# Watch your commit history in the terminal.
#
# The log is scrollable.
#
# To refresh, you have to press 'q'. To exit, press <Ctrl-c> then press 'q'.
#
# See git-log-fullest at https://gist.github.com/aryelgois/bcba085572e2786a579d82354ad540f6
while git log-fullest; do :; done
@aryelgois
aryelgois / git-log-fullest.sh
Last active January 1, 2020 01:54
A complete commit log tree for git
#!/bin/sh
# A complete commit log tree for git.
p=$(git config --get core.pager) || p=${PAGER:-less}
(
git log --color=always --format=fuller -1 2>&1 &&
echo &&
git log --color=always --all --date-order --decorate --graph --oneline
) | $p
@aryelgois
aryelgois / icomoon-extract.php
Created May 23, 2018 19:42
Automated process to extract SVG Icomoon icons
#!/usr/bin/env php
<?php
/**
* Automated process to extract SVG Icomoon icons
*
* Usage: php icomoon-extract.php path/to/icomoon.svg [path/to/destiny/]
*
* It takes each non-empty <glyph> and outputs into a svg file with one <path>.
* It also adds a matrix to resize to 48x48 px, some rectangles to help
* positioning, and includes some guides and grid.
@aryelgois
aryelgois / git-sync.sh
Last active November 18, 2021 11:52
Synchronize local branches with remotes (remove gone branches and fast-forward the others)
#!/usr/bin/env bash
# Synchronize local branches with remotes.
#
# It removes gone branches and fast-forward the others.
echo 'Fetching remotes...'
git fetch --prune
echo
BRANCHES=$(git for-each-ref refs/heads/ --format='%(upstream:short):%(refname:short)~%(upstream:track)')
@aryelgois
aryelgois / release.sh
Last active February 15, 2019 23:56
Automated creation of major and minor releases
#!/usr/bin/env bash
#
# Automated creation of major and minor releases
#
# Usage: release VERSION
#
# VERSION should be a semver for the next release
#
# For patch releases (i.e. hotfixes) you need to
# do manually