find . -type d -name 'node_modules' | xargs rm -r
- removes allnode_modules
folders recursively.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const gulp = require('gulp'); | |
const elixir = require('laravel-elixir'); | |
elixir( (mix) => { | |
mix.browserSync({ | |
files: ['./resources/templates/**/*.twig'], | |
proxy: 'example.dev' | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Deny all access if user is not logged into WordPress | |
# | |
# | |
RewriteEngine On | |
RewriteBase / | |
RewriteCond %{REQUEST_FILENAME} ^.*$ | |
RewriteCond %{HTTP_COOKIE} !^.*wordpress_logged_in.*$ [NC] | |
RewriteRule . - [R=403,L] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* File field returning ID | |
*/ | |
if ( get_post_meta($post->ID, 'ENTER_KEY', true) ) { | |
$id = $cfs->get('ENTER_KEY'); | |
$src = wp_get_attachment_image_src($id, 'large'); | |
$alt = get_post_meta($id, '_wp_attachment_image_alt', true); | |
echo '<img src="' . esc_url($src[0]) . '" alt="' . $alt . '">'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Display all images without ALT tag | |
*/ | |
var images = jQuery('img'); | |
images.each(function(index, value) { | |
var el = jQuery(this); | |
var attr = el.attr('alt'); | |
if ( typeof attr !== typeof undefined && attr !== false ) { | |
if ( attr === '' ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Let's Encrypt | |
# Install Process | |
cd ~ | |
git clone https://github.com/letsencrypt/letsencrypt | |
cd letsencrypt | |
sudo ./letsencrypt-auto certonly --standalone --agree-tos --redirect --duplicate --text --email EMAIL@EXAMPLE.COM -d EXAMPLE.COM -d WWW.EXAMPLE.COM | |
# Nginx Configuration | |
# https://github.com/h5bp/server-configs-nginx/blob/master/h5bp/directive-only/ssl.conf | |
# Path to Certificates | |
# /etc/letsencrypt/live/EXAMPLE.COM/privkey.pem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Retrive ID from attachment URL | |
* Source http://philipnewcomer.net/2012/11/get-the-attachment-id-from-an-image-url-in-wordpress/ | |
*/ | |
function get_id_from_attachment_url($attachment_url = '') { | |
global $wpdb; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* WordPress Custom Post Type & Taxonomy rewrite notes: | |
* When creating CPT/Tax always rewrite the slug and make sure 'with_front' is set to false | |
* In the rewrite section add following | |
*/ | |
$args = array( | |
'rewrite' => array( | |
'slug' => 'SLUG', # Used as pretty permalink text (i.e. /tag/) - defaults to $taxonomy (taxonomy's name slug) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function convert( num ) { | |
var x = ''; | |
[1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1].map( | |
function( obj, i ) { | |
while ( num >= obj ) { | |
x += ['M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I'][i]; | |
num -= obj; | |
} | |
} | |
); |