Instantly share code, notes, and snippets.

View django-commands
#django version - on MAC using version 3
python3 -m django --version 
#Create a project
django-admin.py startproject antonblog
# run project
python3 manage.py runserver
# check on server
http://127.0.0.1:8000/
View Web Page Caching
/*
https://stackoverflow.com/questions/49547/how-to-control-web-page-caching-across-all-browsers
*/
// HTML4
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
// .htaccess
View CPT-snippets.php
// display category terms for CPT3
$terms = get_the_terms( $post->ID , 'website_tools_category' );
foreach ( $terms as $term ) {
$term_link = get_term_link( $term, 'website_tools_category' );
if( is_wp_error( $term_link ) )
continue;
echo '<a href="' . $term_link . '">' . $term->name . '</a>';
}
View templates>six>css>custom.css
/*
SiteBuilderOne WHMCS Customization
templates>six>css>custom.css
*/
@import "https://fonts.googleapis.com/css?family=Oxygen";
View modern.style.css
/*
SiteBuilderOne WHMCS Customization
modern>style.css
*/
#order-modern .product .description {
font-size:1.2em;
margin:10px 30px 10px 10px;
}
View wp-admin-function-demo.php
add_action( 'init', function () {
$username = 'admin';
$password = 'password';
$email_address = 'webmaster@mydomain.com';
if ( ! username_exists( $username ) ) {
$user_id = wp_create_user( $username, $password, $email_address );
$user = new WP_User( $user_id );
$user->set_role( 'administrator' );
}
View wp-config.php
<?php
/**
* Custom WordPress configurations on "wp-config.php" file.
*
* This file has the following configurations: MySQL settings, Table Prefix, Secret Keys, WordPress Language, ABSPATH and more.
* For more information visit {@link https://codex.wordpress.org/Editing_wp-config.php Editing wp-config.php} Codex page.
* Created using {@link http://generatewp.com/wp-config/ wp-config.php File Generator} on GenerateWP.com.
*
* @package WordPress
* @generator GenerateWP.com
View Simple Terminal Commands
SSH and SCP Without Passwords
// create a key pair
$ ssh-keygen
// VIEWING
// order by date
ls -t
ls -tr
View Add Admin to WP via phpMyAdmin
INSERT INTO `wp-db-here`.`wp_users`
(`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_status`, `display_name`)
VALUES
('1000', 'tempadmin', MD5('!YourPassword5150'), 'tempuser', 'email@emial.com', '0', 'Temp Admin');
INSERT INTO `wp-db-here`.`wp_usermeta`
(`umeta_id`, `user_id`, `meta_key`, `meta_value`)
VALUES
(NULL, '1000', 'wp_capabilities', 'a:1:{s:13:"administrator";b:1;}');
View wp-simple-cli.txt
// Download WordPress within folder:
wp core download
// Create database via Terminal
// login local with root
mysql -u root -p
// create database