Skip to content

Instantly share code, notes, and snippets.

Nate Finch n8finch

Block or report user

Report or block n8finch

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View laravel_facades.md

Understanding Facades in Laravel

What's a Facade?

The Laravel explination, shown below is confusing.

Facades provide a "static" interface to classes that are available in the application's service container. Laravel ships with many facades which provide access to almost all of Laravel's features. Laravel facades serve as "static proxies" to underlying classes in the service container, providing the benefit of a terse, expressive syntax while maintaining more testability and flexibility than traditional static methods.

Many examples use Cache::get('key') to demonstrate how a Facade works. Comparing the following code to the utility that a Facade provides.

@exAspArk
exAspArk / curl.sh
Last active May 24, 2020
Test CORS with cURL
View curl.sh
curl -I -X OPTIONS \
-H "Origin: http://EXAMPLE.COM" \
-H 'Access-Control-Request-Method: GET' \
http://EXAMPLE.COM/SOMETHING 2>&1 | grep 'Access-Control-Allow-Origin'
@stephenharris
stephenharris / import-venues.php
Created Mar 21, 2017
A WP-CLI command to import a CSV of venues
View import-venues.php
<?php
/*
Plugin Name: Import Venues WP CLI command
Plugin URI: http://wordpress.org/plugins/hello-dolly/
Description: Adds `wp eo venue import <path-to-file>` command.
Author: Stephen Harris
Version: 0.1
*/
// Exit if accessed directly
View Create Base Site - WP-CLI Demo Script
#!/bin/bash
wp core download --version=4.5
wp core config --dbname=$1 --dbuser=root --dbhost=127.0.0.1
wp db create
wp core install --skip-email --title="$1" --admin_user="shawn" --admin_password="shawn" --admin_email=shawn@actionable.co --url=http://wcroc.dev/
wp theme install simone --activate
wp plugin delete hello
wp plugin install any-ipsum;
wp plugin install advanced-custom-fields --version=4.4.0 --activate
wp plugin install tinymce-advanced --activate
@eiskalteschatten
eiskalteschatten / update-wordpress.sh
Created Oct 2, 2016
Update WordPress with a Bash script using WP CLI
View update-wordpress.sh
#!/bin/bash
function updateWordPress {
cd $1
wp core update
wait
wp plugin update --all
wait
wp theme update --all
wait
View force-css-js-to-go-live-immediately.php
<?php
// Version CSS file in a theme
wp_enqueue_style(
'theme-styles',
get_stylesheet_directory_uri() . '/style.css',
array(),
filemtime( get_stylesheet_directory() . '/style.css' )
);
@chrissimpkins
chrissimpkins / gist:5bf5686bae86b8129bee
Last active May 23, 2020
Atom Editor Cheat Sheet: macOS
View gist:5bf5686bae86b8129bee

Use these rapid keyboard shortcuts to control the GitHub Atom text editor on macOS.

Key to the Keys

  • ⌘ : Command key
  • ⌃ : Control key
  • ⌫ : Delete key
  • ← : Left arrow key
  • → : Right arrow key
  • ↑ : Up arrow key
@ericandrewlewis
ericandrewlewis / gist:95239573dc97c0e86714
Last active Mar 11, 2020
Setting up a WordPress site on AWS
View gist:95239573dc97c0e86714

Setting up a WordPress site on AWS

This tutorial walks through setting up AWS infrastructure for WordPress, starting at creating an AWS account. We'll manually provision a single EC2 instance (i.e an AWS virtual machine) to run WordPress using Nginx, PHP-FPM, and MySQL.

This tutorial assumes you're relatively comfortable on the command line and editing system configuration files. It is intended for folks who want a high-level of control and understanding of their infrastructure. It will take about half an hour if you don't Google away at some point.

If you experience any difficulties or have any feedback, leave a comment. 🐬

Coming soon: I'll write another tutorial on a high availability setup for WordPress on AWS, including load-balancing multiple application servers in an auto-scaling group and utilizing RDS.

View admin.css
.yoast-settings {
display: none;
}
@tomazzaman
tomazzaman / README.md
Last active Mar 18, 2020
Gulp workflow for WordPress theme development
View README.md

Gulp workflow for WordPress theme development

Requirements

In order for Livereload to work, you need a Firefox or Chrome extension as Gulp doesn't inset it automatically. Alternatively, you can also manually put the livereload script in footer.php, just make sure to insert it only on development environment:

<script>document.write('<script src="http://' + (location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1"></' + 'script>')</script>
You can’t perform that action at this time.