Skip to content

Instantly share code, notes, and snippets.

😎
Makin' teh codz.

Thomas Belknap holisticnetworking

😎
Makin' teh codz.
View GitHub Profile
@holisticnetworking
holisticnetworking / Makefile
Created Feb 13, 2020 — forked from pwenzel/Makefile
Wordpress Makefile Workflow
View Makefile
.PHONY: install
install: clean wordpress phpunit wp-cli
git submodule init;
@echo "\n\nNOTICE: You may need to configure a MySQL database for your Wordpress installation. Just run:"
@echo " mysql -u root -p;"
@echo " CREATE DATABASE example_site; \n"
wordpress: latest.tar.gz
tar -zxvf latest.tar.gz;
View gist:0827c2dc67d6bcaf987ce8ee9cccda0a
[opensalt@devlosiapp01 2os]$ make force-build
touch -c composer.lock
touch -c yarn.lock
bin/composer install --no-interaction
Cannot create cache directory /composer/cache/repo/https---repo.packagist.org/, or directory is not writable. Proceeding without cache
Cannot create cache directory /composer/cache/files/, or directory is not writable. Proceeding without cache
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 235 installs, 0 updates, 0 removals
- Installing ocramius/package-versions (1.5.1): Downloading (100%)
@holisticnetworking
holisticnetworking / index.html
Created Mar 25, 2019
Slick Carousel Opens Synced Bootstrap Modal
View index.html
<div class="slider-nav">
<div data-toggle="modal" data-target="#myModal"><img src="http://placehold.it/390x245&text=1" alt=""></div>
<div data-toggle="modal" data-target="#myModal"><img src="http://placehold.it/390x245&text=2" alt=""></div>
<div data-toggle="modal" data-target="#myModal"><img src="http://placehold.it/390x245&text=3" alt=""></div>
<div data-toggle="modal" data-target="#myModal"><img src="http://placehold.it/390x245&text=4" alt=""></div>
<div data-toggle="modal" data-target="#myModal"><img src="http://placehold.it/390x245&text=5" alt=""></div>
<div data-toggle="modal" data-target="#myModal"><img src="http://placehold.it/390x245&text=6" alt=""></div>
<div data-toggle="modal" data-target="#myModal"><img src="http://placehold.it/390x245&text=7" alt=""></div>
</div>
View not-so-simple-conditional.php
<?php
if ( username identified in system ) {
// Do things for an identified user
} else {
echo "Looks like you aren't logged in!";
}
View simple-condition-binary.php
<?php
if( $person is in group Van and in group Musical ) {
echo "Well, hello, Eddie!";
} else {
// This block of code could address Vans who aren't Musical,
// Musical people who aren't Vans, and all Europeans.
//
// That's a very big, not very specific list!
echo "Hello, stranger!";
}
View simple-condition.php
<?php
// Assuming the equation: 2 + 2 = $x
if( $x == 4 ) {
echo "Hurray! You win a thing!";
} else {
error_log( "Boo, dude. You screwed that up." );
}
@holisticnetworking
holisticnetworking / acf-local-json-after.php
Last active Mar 8, 2019
A successful addition to my theme to allow parent/theme failover of local JSON
View acf-local-json-after.php
<?php
// Integrating Advanced Custom Fields:
remove_filter( 'acf/settings/save_json', 'settings_save_json' );
add_filter( 'acf/settings/save_json', function() {
return get_stylesheet_directory() . '/Library/Acf-Json';
} );
remove_filter( 'acf/settings/load_json', 'settings_load_json' );
add_filter( 'acf/settings/load_json', function( $paths ) {
array_push(
$paths,
@holisticnetworking
holisticnetworking / acf-local-json-before.php
Last active Mar 8, 2019
A first attempt at applying new directories with parent failovers to ACF local JSON
View acf-local-json-before.php
<?php
// Integrating Advanced Custom Fields:
add_filter( 'acf/settings/save_json', function() {
return get_stylesheet_directory() . '/Library/Acf-Json';
} );
add_filter( 'acf/settings/load_json', function( $paths ) {
unset( $paths[0] );
$paths[] = get_template_directory() . '/Library/Acf-Json';
$paths[] = get_stylesheet_directory() . '/Library/Acf-Json';
return $paths;
View npm-error.txt
SYR-TBELKNAP-MAC18:source tbelknap$ npm install
npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
> node-sass@3.13.1 install /Applications/MAMP/htdocs/InFocusTheme/source/node_modules/node-sass
> node scripts/install.js
Downloading binary from https://github.com/sass/node-sass/releases/download/v3.13.1/darwin-x64-57_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v3.13.1/darwin-x64-57_binding.node":
HTTP error 404 Not Found
@holisticnetworking
holisticnetworking / set_default.php
Last active Jun 28, 2018
When working with the WordPress Customizer, you may want to be sure a theme mod gets set on save. Unless a setting gets changed in the Customizer, it's values do not go into the final theme_mods data. This object snippet will do just that for you. The Gist includes both the function to use and the hook to attach it to for checking on save.
View set_default.php
/**
* On Customizer save, checks for and sets a few
* default settings.
* @param \WP_Customize_Manager $wpcustomizer
*/
public function set_defaults( \WP_Customize_Manager $wpcustomizer ) {
$mod = get_theme_mod( 'my_theme_mod_name' );
if( empty( $mod ) ) {
set_theme_mod( 'my_theme_mod_name', 'x' );
}
You can’t perform that action at this time.