Skip to content

Instantly share code, notes, and snippets.

@codex73
codex73 / README.md
Created February 12, 2019 20:42 — forked from hofmannsven/README.md
My simply Git Cheatsheet
@codex73
codex73 / gist:01c53452c9bfc74b60f993bab41351c0
Created January 15, 2019 02:40
Use is_single is_page is_homepage within Plugin WordPress
class BBE_plugin {
public function __construct() {
if ( ! is_admin() ) {
add_action( 'wp_enqueue_scripts', array( &$this, 'bbe_scripts' ) );
}
if ( is_admin() ) {
add_action( 'wp_ajax_nopriv_bbe_box', array( &$this, 'bbe_box' ) );
add_action( 'wp_ajax_bbe_box', array( &$this, 'bbe_box' ) );
}
@codex73
codex73 / breadcrumbs-custom.php
Created January 8, 2019 21:02 — forked from hemusyl/breadcrumbs-custom.php
WordPress custom breadcrumbs without plugin
http://www.qualitytuts.com/wordpress-custom-breadcrumbs-without-plugin/
Step 1
Breadcrumbs are the important part of our website, in wordpress there are several plugins are available for this, but below i posted
the code for custom breadcrumbs for our wordpress site. Just add this below code in to your current wordpress theme functions.php
and call the second step.
<?php
function qt_custom_breadcrumbs() {
@codex73
codex73 / breadcrumbs-functions.php
Created January 3, 2019 21:00 — forked from tinotriste/breadcrumbs-functions.php
Wordpress: Breadcrumbs function
<?php
/*=============================================
= BREADCRUMBS =
=============================================*/
// to include in functions.php
function the_breadcrumb() {
$sep = ' > ';
@codex73
codex73 / criticalcss-bookmarklet-devtool-snippet.js
Created December 21, 2018 16:37 — forked from PaulKinlan/criticalcss-bookmarklet-devtool-snippet.js
CriticalCSS Bookmarklet and Devtool Snippet.js
(function() {
var CSSCriticalPath = function(w, d, opts) {
var opt = opts || {};
var css = {};
var pushCSS = function(r) {
if(!!css[r.selectorText] === false) css[r.selectorText] = {};
var styles = r.style.cssText.split(/;(?![A-Za-z0-9])/);
for(var i = 0; i < styles.length; i++) {
if(!!styles[i] === false) continue;
var pair = styles[i].split(": ");
@codex73
codex73 / install.sh
Created June 17, 2018 15:07
Installs LAMP with PHP 5.6 on Ubuntu 16.04
#!/bin/bash
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y apache2
sudo ufw allow in "Apache Full"
sudo apt-get install -y mysql-server
# After running this command, select (Y), option 2, then (Y) for the rest of the prompts.
sudo mysql_secure_installation
@codex73
codex73 / createChroot.sh
Created May 22, 2018 00:53 — forked from kmddevdani/createChroot.sh
Creates chrooted user with real scp and ssh access on a amazon linux ec2 instance
#!/bin/bash
#
# This script creates a chrooted user, scp enabled, on an Amazon Linux aws instance
#
# 2017-10-05
#
# change username and password here:
username="abc"
@codex73
codex73 / update.sh
Created March 27, 2018 23:57 — forked from diogoca/update.sh
How to install Apache 2.4 and PHP 5.6 on Amazon Linux
# AWS EC2
# Remove Apache and PHP old version
# Install Apache 2.4, Mod_SSL and PHP 5.6
#
sudo service httpd stop
sudo yum erase httpd httpd-tools apr apr-util
sudo yum remove php-*
sudo yum install php56
sudo yum install php56-xml php56-xmlrpc php56-soap php56-gd php56-mbstring
sudo yum install php56-mysqlnd
@codex73
codex73 / states_hash.json
Created March 5, 2018 15:44 — forked from mshafrir/states_hash.json
US states in JSON form
{
"AL": "Alabama",
"AK": "Alaska",
"AS": "American Samoa",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
"DE": "Delaware",
@codex73
codex73 / AWS-config.md
Created July 10, 2017 20:25
Fucking Yes! AWS setup for Wordpress Server

Fucking Yes! AWS setup for Awesome Fast Wordpress Server

Ramblings and notes of my experiments with AWS which I will later turn into more coherent instructions.

Sooo... I'm about to be released into the wild as a free roaming web developer. I won't have the company hosting anymore and it's damn well about time I got my own shit sorted. After a little reading I have decided to give Amazon Web Services a try. So far I am loving it.

I have oooooooodles of control. It's super nerdy and more importantly, it's super fast. Seriously - I had fun.

When I first set this up i tried following some third party tutorials to get a wordpress server setup and running on Amazon Web Services. After some trial and error I found the proper documentation and everything when much more smoothly (I know right)! The AWS docs are very detailed and easy to follow.