Skip to content

Instantly share code, notes, and snippets.

@ethicka
ethicka / head.js.chrome-ios.js
Created November 10, 2013 18:17
Add Chrome iOS class using head.js
head.ready(function() {
if(navigator.userAgent.match('CriOS')) head.feature("chrome-ios", true);
else head.feature("chrome-ios", false);
});
@ethicka
ethicka / localhost-ssl.md
Last active April 12, 2024 12:26 — forked from jonathantneal/README.md
Local virtualhost SSL websites on Mac OS Sierra

Local virtualhost SSL websites on Mac OS Sierra

These instructions will guide you through the process of setting up a wildcard SSL for your local virtualhosts for offline development. Most importantly, this configuration will give you the happy, green lock in Chrome.

These instructions have only been tested on Mac OS Sierra using the pre-installed Apache and PHP versions. These instructions also assume you have virtualhosts set up locally already.


Configuring SSL

@ethicka
ethicka / redirect-to-homepage
Last active March 21, 2018 14:02
.htaccess redirect to homepage
# Redirect to homepage
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .? http://example.com/ [R=301,L]
@ethicka
ethicka / hardening-wp.md
Last active September 18, 2016 22:52
Hardening WordPress

Hardening WordPress

Change file permissions

Run the following commands:

find /path/to/your/wordpress/install/ -type d -exec chmod 755 {} \;

find /path/to/your/wordpress/install/ -type f -exec chmod 644 {} \;

@ethicka
ethicka / wp-start.sh
Last active December 27, 2023 07:10
WordPress Installation with the Roots/Sage Framework and VirtualHost Creation
#!/bin/bash -e
##
# WordPress Installation and VirtualHost Creation
#
# Description: Installs a WordPress website in the ~/Sites folder, creates a homepage,
# cleans up the WP install a bit, deletes the akismet and hello dolly plugins, creates the permalinks,
# clones the roots/sage theme framework to the theme folder, deletes all the other WP default themes,
# installs/runs npm and bower and runs gulp to create the initial assets, adds a custom gitignore file
# to /wp-content, installs the roots/soil plugin, creates a git repo in wp-content, saves the WordPress

Common Commands

Apache (Ubuntu)

apache2ctl configtest - Configtest before restarting Apache.

service apache restart - Restart Apache.

service apache restart - Restart MySQL.

@ethicka
ethicka / acf-validate-facebook-url-field.php
Last active July 3, 2017 15:38
ACF Validate Facebook Field
<?php
/*
* Validate Facebook URL field
* URL field must be named "facebook_video_url" or you can change is in the filter below.
* Source: https://www.advancedcustomfields.com/resources/acf-validate_value/
*/
function acf_validate_facebook_url( $valid, $value, $field, $input ){
// If already not valid, then exit
if( !$valid ) {
return $valid;
@ethicka
ethicka / wrap-link-if-url-passed.php
Created July 5, 2017 17:50
Wrap Link if URL is Passed
@ethicka
ethicka / localhost-ssl-certificate.md
Last active February 18, 2024 16:29
Localhost SSL Certificate on Mac OS

🚨 2020 Update: I recommend using mkcert to generate local certificates. You can do everything below by just running the commands brew install mkcert and mkcert -install. Keep it simple!


This gives you that beautiful green lock in Chrome. I'm assuming you're putting your SSL documents in /etc/ssl, but you can put them anywhere and replace the references in the following commands. Tested successfully on Mac OS Sierra and High Sierra.

Set up localhost.conf

sudo nano /etc/ssl/localhost/localhost.conf

@ethicka
ethicka / sage9-deploybot.md
Last active May 4, 2020 07:24
How to build and deploy a Roots / Sage 9 WordPress theme on Deploybot

Deploying Roots Sage 9 via Deploybot

Sage 9 is the latest and greatest from Roots, but the build process is much more complicated than Sage 8 (i.e. gulp --production and profit). The following took me quite a bit of time to figure out, but is probably not comprehensive. Please comment if you need clarity. I hope it saves you some time!

Build the Container

Deploybot allows you to create your own containers. Go to Settings > Containers > Create a container. Based off the Ubuntu 16.04 container add the following build commands and save as Sage 9: