Skip to content

Instantly share code, notes, and snippets.

View aramboyajyan's full-sized avatar

Aram Boyajyan aramboyajyan

View GitHub Profile
@aramboyajyan
aramboyajyan / .gitignore
Last active March 22, 2024 09:22
.gitignore for WordPress
# Configuration.
/.htaccess
/.htaccess_lscachebak_*
/wp-config.php
/sitemap.xml
/sitemap.xml.gz
# Files in the root.
*.pdf
*.jpg
@aramboyajyan
aramboyajyan / web.config
Created August 24, 2013 07:20
web.config redirect only requests from the root
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Root Hit Redirect" stopProcessing="true">
<match url="^$" />
<action type="Redirect" url="/redirect-for-root" />
</rule>
</rules>
@aramboyajyan
aramboyajyan / .gitignore
Last active September 23, 2022 09:47
.gitignore for Drupal 8 / 9 / 10
# Ignore directories generated by Composer
/drush/contrib/
/vendor/
/web/core/
/web/modules/contrib/
/web/themes/contrib/
/web/profiles/contrib/
/web/libraries/
# Ignore sensitive information
@aramboyajyan
aramboyajyan / states
Created July 27, 2013 07:17
Drupal list of US states
AL|Alabama
AK|Alaska
AZ|Arizona
AR|Arkansas
CA|California
CO|Colorado
CT|Connecticut
DE|Delaware
DC|District Of Columbia
FL|Florida
@aramboyajyan
aramboyajyan / dir-exists.go
Created January 12, 2021 07:14
Golang check if target directory exists
func DirExists(path string) (bool, error) {
_, err := os.Stat(path)
if err == nil {
return true, nil
} else if os.IsNotExist(err) {
return false, nil
}
return false, err
}
# Create a new note.
new_daily_note() {
cd ~/Documents/DailyNotes
currentDate=$(date '+%Y-%m-%d')
currentTime=$(date '+%H:%M')
fileName="${currentDate}.todo"
if [ -f "$fileName" ]; then
echo "Daily note file ($fileName) already exists."
else
cp _new.todo $fileName
@aramboyajyan
aramboyajyan / .gitignore
Last active June 27, 2020 15:20
.gitignore for Drupal 7
# Ignore custom settings.
sites/default/settings.local.php
# phpStorm settings.
/.idea/
# Ignore paths that contain user-generated content.
/sites/*/files
/sites/*/private
/files/*
@aramboyajyan
aramboyajyan / .bash_profile
Created October 31, 2019 00:28
Bash profile
# Run the updates.
alias update="sudo -- sh -c 'apt-get update; apt-get upgrade -y --allow-unauthenticated; apt-get dist-upgrade -y --allow-unauthenticated; apt-get autoremov$
# Colors!
if [ "$TERM" != "dumb" ]; then
[ -e "$HOME/.dir_colors" ] &&
DIR_COLORS="$HOME/.dir_colors" [ -e "$DIR_COLORS" ] ||
DIR_COLORS=""
eval "`dircolors -b $DIR_COLORS`"
alias ls='ls --color=auto'
@aramboyajyan
aramboyajyan / .htaccess
Last active April 30, 2019 20:24
.htaccess block wordpress directories (for use in Drupal websites)
# Non-existing URLs that are usually visited by bots. We will issue a server
# redirect to 404.html to avoid any overhead caused by bots trying to break into
# the site.
#
# WordPress folders.
RedirectMatch 301 /wp-admin /404.html
RedirectMatch 301 /wp-content /404.html
RedirectMatch 301 /wp-includes /404.html
# WordPress files.
RedirectMatch 301 /wp-cron.php /404.html
@aramboyajyan
aramboyajyan / snippet.php
Created February 7, 2016 09:54
Drupal 7 Commerce empty user shopping cart programmatically
global $user;
$order = commerce_cart_order_load($user->uid);
commerce_cart_order_empty($order);