Skip to content

Instantly share code, notes, and snippets.

View oneblackcrayon's full-sized avatar

Frederick Polk oneblackcrayon

View GitHub Profile
@teamco
teamco / webpack.dev.config.js
Created December 17, 2019 20:31
webpack.dev.config.js
const path = require('path');
const webpack = require('webpack');
const {CleanWebpackPlugin} = require('clean-webpack-plugin');
const HtmlWebPackPlugin = require('html-webpack-plugin');
const StartServerPlugin = require('start-server-webpack-plugin');
const NodemonPlugin = require('nodemon-webpack-plugin');
const SimpleProgressWebpackPlugin = require('simple-progress-webpack-plugin');
const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin');
const config = {
@nottux
nottux / opencl-amd_aur_ubuntu.bash
Last active October 19, 2023 20:23
bash implementation of opencl-amd AUR package, Install opencl amdgpu amdgpu-pro opencl only. Supports ubuntu and others with standard prefix
#!/bin/bash
# DO NOT run the line 167 standalone. It will remove the necessary files besides the junk!
if echo $@|grep -q "\-\-help\|\-help\|\-h\|help\|\-\-h\|\-\-no\-deb\|\-\-no\-install\|\-\-no\-cleaning\|\-\-assume\-debian"
then :
else echo wrong entry\(ies\) !
help=yes
fi
if echo $@|grep -q "\-\-help\|\-help\|\-h\|help\|\-\-h" || [ "$help" = yes ]
<?php
/*
Plugin Name: Google Analytics Tracking Code MU-Plugin
Description: A must-use plugin that adds immutable Google Analytics tracking code.
*/
/* This plugin is used to ensure that Google Analytics is always present on the site (thus the use of a mu-plugin)
and to maintain the relationship between WordPress themes (design) and WordPress plugins (functionality) by keeping this
code out of the theme and in a plugin. */
@silverfoxy
silverfoxy / user.php
Created October 24, 2019 22:32
WordPress custom login page that logs wrong passwords (wp-includes/user.php)
<?php
/**
* Core User API
*
* @package WordPress
* @subpackage Users
*/
/**
* Authenticates and logs a user in with 'remember' capability.
@itsHall
itsHall / functions.php
Last active November 2, 2021 21:33
Use CDN jQuery | WP
<?php
//----------------------------------------//
// Making jQuery load from Google Library //
//----------------------------------------//
add_filter( 'init', 'replace_default_jquery_with_fallback');
function replace_default_jquery_with_fallback() {
if (is_admin()) {
return;
@thetwopct
thetwopct / wp-cli-cheat-sheet.sh
Last active November 7, 2023 03:38
WordPress WP-CLI cheat sheet
# WordPress WP-CLI cheat sheet
# Reset everything in case of bugs
wp transient delete --all && wp rewrite flush && wp cache flush
# or in Lando
lando wp transient delete --all && lando wp rewrite flush && lando wp cache flush
# reset a new install
wp plugin delete $(wp plugin list --status=inactive --field=name)
wp theme delete $(wp theme list --status=inactive --field=name)
@0xemc
0xemc / fluid-type.scss
Last active November 30, 2022 03:58
Fluid Typography Mixin (SCSS)
// This mixin can be used to provide Fluid Type behaviour accross your entire web page
// or to a single css selector
//
// Full credit goes to Geoff Graham @ https://css-tricks.com/snippets/css/fluid-typography/
//
// To apply globally:
//
// 1. Define your minimum and maximum screen widths
// 2. Define your min and max font size for H1 element in px
// 3. Apply fluid-type mixin to root element eg.
@thetwopct
thetwopct / image-handling-wordpress.php
Last active March 27, 2023 13:04
WordPress image handling (ACF / Background Images / Inline / srcset /
//
<?php
if ( has_post_thumbnail() ) {
echo wp_get_attachment_image(get_post_thumbnail_id($post->ID), '', false, array('class' => 'featured-image'));
} else {
echo '<img src="' . get_bloginfo( 'stylesheet_directory' )
. '/library/images/thumbnail-default.jpg" alt="default thumb" class="featured-image"/>';
}
?>
@bkmacdaddy
bkmacdaddy / digico-custom.js
Last active February 1, 2021 22:52
Advanced Custom Fields: Repeater with Google Map with markers
// ACF Google Maps Rendering
(function ($) {
/*
* new_map
*
* This function will render a Google Map onto the selected jQuery element
*
* @type function
* @date 8/11/2013
@gzuzkstro
gzuzkstro / shortcode-example.php
Last active August 27, 2023 04:51
#WordPress shortcode example that loops through a post type
<?php
function loop_shortcode($atts) {
//Query the posts, the parameters can be edited
$queried_posts = new WP_Query(array(
'post_type' => 'post-type',
'posts_per_page' => -1,
'order' => 'ASC'
));