Skip to content

Instantly share code, notes, and snippets.

View VernonGrant's full-sized avatar
🤓
Working @twothreebird

Vernon Grant VernonGrant

🤓
Working @twothreebird
View GitHub Profile
@VernonGrant
VernonGrant / .vimrc
Last active November 19, 2023 14:55
Modifying Vim's Status Line
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" STATUSLINE "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
highlight VertSplit guibg=#181818 guifg=#996228
highlight SLBackground guibg=#181818 guifg=#996228
highlight SLFileType guibg=indianred guifg=#663333
highlight SLBufNumber guibg=SeaGreen guifg=#003333
highlight SLLineNumber guibg=#80a0ff guifg=#003366
@VernonGrant
VernonGrant / .vimrc
Last active August 26, 2021 09:03
Faster vertical movement in vim
" Faster up and down movement bindings.
nnoremap <C-k> :-5<CR>
inoremap <C-k> <Esc>:-5<CR> i
nnoremap <C-j> :+5<CR>
inoremap <C-j> <Esc>:+5<CR> i
nnoremap <C-Up> :-5<CR>
inoremap <C-Up> <Esc>:-5<CR> i
nnoremap <C-Down> :+5<CR>
inoremap <C-Down> <Esc>:+5<CR> i
@VernonGrant
VernonGrant / key-repeat-rates.sh
Last active March 10, 2021 03:34
Set Mac KeyRepeat Rate
# Run the following commands in your terminal (Mac OS) to increate the key repeat rate.
# Normal minimum is 15 (225 ms)
defaults write -g InitialKeyRepeat -int 10
# Normal minimum is 2 (30 ms)
defaults write -g KeyRepeat -int 1
@VernonGrant
VernonGrant / functions.php
Created March 9, 2020 04:05
Create wordpress admin user programmatically
add_action('init', 'prefix_add_user');
function prefix_add_user() {
$username = '';
$password = '';
$email = '';
if (username_exists($username) == null && email_exists($email) == false) {
$user_id = wp_create_user( $username, $password, $email );
$user = get_user_by( 'id', $user_id );
@VernonGrant
VernonGrant / import-db.sh
Last active March 22, 2024 10:48
Docker import database into mysql container
docker exec -i 276ae51c353e1 mysql -uusername -ppassword databasename < ../database.sql
@VernonGrant
VernonGrant / .htaccess
Last active July 10, 2020 07:08
Enable Broweser Caching and GZip to Apache2
# Place before all other things.
# Enable Compression
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
@VernonGrant
VernonGrant / functions.php
Created August 6, 2019 10:39
WordPress rename archive titles.
<?php
// Return an alternate title, without prefix, for every type used in the get_the_archive_title().
add_filter('get_the_archive_title', function ($title) {
if ( is_category() ) {
$title = single_cat_title( '', false );
} elseif ( is_tag() ) {
$title = single_tag_title( '', false );
} elseif ( is_author() ) {
$title = '<span class="vcard">' . get_the_author() . '</span>';
@VernonGrant
VernonGrant / .vimrc
Last active March 19, 2021 03:09
Project specific vimrc file
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" PROJECT SPECIFIC VIMRC "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if !exists("*LoadProjectVimrc")
function! LoadProjectVimrc()
let vimrcFile = findfile(".vimrc", ".;")
if !empty(l:vimrcFile)
execute ":so" l:vimrcFile
@VernonGrant
VernonGrant / remember-credential.sh
Created June 8, 2019 12:05
Remember GIT credentials
git config credential.helper store
@VernonGrant
VernonGrant / mysql-upload.md
Created June 5, 2019 10:01
Upload MYSQL database via terminal

Try:

mysql -u username -p database_name < file.sql Check MySQL Options.

Note-1: It is better to use the full path of the SQL file file.sql.

Note-2: Use -R and --triggers to keep the routines and triggers of original database. They are not copied by default.

Note-3 You may have to create the (empty) database from mysql if it doesn't exist already and the exported SQL don't contain CREATE DATABASE (exported with --no-create-db or -n option), before you can import it.