This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ignore local changes to the .gitconfig file | |
git update-index --skip-worktree .gitconfig | |
# list skipped files | |
git ls-files -v | grep ^S | |
# revert the above | |
git update-index --no-skip-worktree .gitconfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
host=$1 | |
# first remove the host's key if it exists | |
ssh-keygen -R $host | |
# then add to the known_hosts file | |
ssh-keyscan -H $host >> ~/.ssh/known_hosts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
$remote_name=$1 | |
$remote_url=$2 | |
git ls-remote --exit-code $remote_name &>/dev/null | |
if [ $? -ne 0 ]; then | |
git remote add $remote_name $remote_url | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Copied from http://whaaat.com/rename-drupal-module-cli | |
old=$1 | |
new=$2 | |
mv $old $new | |
cd $new | |
rename "s/$old/$new/g;" * | |
perl -pi -w -e "s/$old/$new/g;" * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
adduser yusuf | |
usermod -aG sudo yusuf | |
echo 'yusuf ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/custom && chmod 0440 /etc/sudoers.d/custom |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sed -i 's/archive.ubuntu.com/au.archive.ubuntu.com/g' /etc/apt/sources.list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.parent-element { | |
-webkit-transform-style: preserve-3d; | |
-moz-transform-style: preserve-3d; | |
transform-style: preserve-3d; | |
} | |
.element { | |
position: relative; | |
top: 50%; | |
transform: translateY(-50%); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# THESE COMMANDS HAVE TO BE RUN FROM INSIDE AN EXISTING DOCROOT | |
# Get docroot path | |
drush st root --no-field-labels --format=list | |
# Generate Drupal Hash - Drupal 8 | |
drush php:eval '$hash = Drupal\Component\Utility\Crypt::randomBytesBase64(55); print $hash . "\n";' | |
# Generate Drupal Hash - Drupal 7 | |
drush php:eval '$hash = drupal_random_key(); print $hash . "\n";' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a bookmark using the following command | |
hash -d -- bookmark_name=/path/to/dir | |
# Access using | |
cd ~bookmark_name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// adding a debounce function in order to prevent the resize | |
// code from being called too often. | |
// @see http://stackoverflow.com/a/9828919 | |
// @see https://davidwalsh.name/javascript-debounce-function | |
// Returns a function, that, as long as it continues to be invoked, will not | |
// be triggered. The function will be called after it stops being called for | |
// N milliseconds. If `immediate` is passed, trigger the function on the | |
// leading edge, instead of the trailing. | |
var debounce = function (func, wait, immediate) { | |
var timeout; |