View Makefile
install: | |
gcc helloWorld.c -o ./opt |
View reset-docker.sh
# Remove all containers | |
docker rm $(docker ps -aq) | |
# Remove all images | |
docker rmi $(docker images -q) | |
# Remove the following: | |
# - all stopped containers | |
# - all volumes not used by at least one container | |
# - all networks not used by at least one container |
View fix-permissions.sh
# Laravel Envoyer - Fix Log Permissions: | |
# --- | |
# Sets up access control restrictions, so both the deployment user 'forge' | |
# and the web-server's user 'www-data' can access generated log files. | |
PROJECT_DIRS="storage" | |
RELEASE_DIRS="bootstrap/cache" | |
cd {{ project }} | |
View .bash_profile
# Silence bash deprecation warning (MacOS) | |
export BASH_SILENCE_DEPRECATION_WARNING=1 |
View .bash_profile
# Add yarn to global path | |
export="${PATH}:$(yarn global bin)" |
View unique-array.js
/* | |
* Returns an array of unique values from the provided array. | |
* | |
* @param input {array} Array of values | |
* @returns {array} Array of unique values | |
*/ | |
const unique = (input) => [...new Set(input)]; | |
unique([1, 1, 2, 2, 3, 4]); // => [1, 2, 3, 4] |
View .bash_profile
# Opens the provided directory in PHPStorm. If PHPStorm is not currently running | |
# the application will be opened. If PHPStorm is already running, the provided | |
# directory will be opened in a new project window. | |
# | |
# Examples: | |
# Relative path: pstorm . | |
# Absolute path: pstorm ~/Projects/my-project | |
function pstorm () { | |
open -a PhpStorm $1 |
View nullable_foreach.php
<?php | |
// Initialize variable to null | |
$empty = null; | |
foreach ($empty ?? [] as $item) { | |
// Line never executed | |
} | |
// No error encountered |
View .bash_profile
# Adds git branch to PS1 output | |
git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
export PS1="\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\$ " |
View .bash_profile
# Frees up the provided port by killing whatever process is blocking it. | |
# | |
# Example: | |
# freeport 8080 | |
function freeport () { | |
local result=$(lsof -i :$1 | grep node | awk '{print $2}') | |
if [[ ! -z $result ]]; then | |
kill $result |