Skip to content

Instantly share code, notes, and snippets.

View rxnlabs's full-sized avatar

De'Yonte W. rxnlabs

View GitHub Profile
@stephenfeather
stephenfeather / image-organize.sh
Last active December 10, 2023 21:14
Creates a subdirecty tree based upon a file name to work around the 999 object list issues on S3
#!/bin/bash
#
# Designed to organize files into
# sub folders to a depth of X based
# upon the first X letters of the file name
# Currently --depth does not work
@banagale
banagale / build.js
Last active May 21, 2024 16:06
An example javascript api-based `esbuild` build script with a watch and automatic post-build bash script execution.
// As discussed in https://github.com/evanw/esbuild/issues/1688
require('esbuild').build({
entryPoints: ['./briefings/frontend/src/briefings.ts'],
outfile: './briefings/frontend/build/briefings-fe.js',
bundle: true,
minify: true,
target: 'es2017',
color: true,
watch: {
@MrYakobo
MrYakobo / info.md
Created August 24, 2020 17:40
List of all shortcodes in Visual Composer

these are from js_composer

Anyhow, this comphrenhensive list was ungooglable for me. Googling "List of Visual Composer Shortcodes" gives nothing at all. I guess that's how it goes with most of Wordpress things; references are sparse and examples are numerous. Reminds me of Classic ASP, where W3Schools literally is your best reference. Because Microsoft don't document shit.

Anyhow, hope this is useful to someone

@rxnlabs
rxnlabs / add-blog-to-wordpress-posts-only.md
Last active August 31, 2023 13:41
WordPress - WP: Add /blog to your Post post type only and remove it from your other custom post types and taxonomies after adding /blog

Add a /blog to your WordPress blog posts only and remove it from the other post types

This is useful if you want to know when a user is viewing a blog post in Google Analytics vs a page. Or if you want to just have an easy way to distinguish your blog content from your other content using the URL.

There may be an easier way to do this but all of my Googling didn't turn up any answers that let you modify the post URLs only.

  1. Add the code from remove-blog-front-from-custom-post-types.php to your theme's functions.php or to a custom plugin or some file where it will get loaded. This code prevents the new blog base from being applied to the URLs of Custom POst types and taxonomy archives.
  2. Log into your WordPress admin
  3. Go to Settings -> Permalinks
  4. Select the Custom Structure field and add /blog to the Permalink structure (add this before the /%postname% part of the URL
@lgersman
lgersman / rollup.config.js
Created October 16, 2019 10:27
rollup config for a wordpress plugin including scss/es2018 support
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
//import strip from 'rollup-plugin-strip';
import scss from 'rollup-plugin-scss';
import packageJson from './package.json';
import babel from 'rollup-plugin-babel';
import { terser } from 'rollup-plugin-terser';
const createBrowserConfig = (customizeConfig = () => {}) => {
const config =
@marcelkornblum
marcelkornblum / bulk-transfer-repos.py
Last active March 10, 2024 16:14
Simple Python script to rip everything from BitBucket across to Github with minimal interaction
# heavily inspired by https://gist.github.com/rbellamy/3c5033ba605a090824e8
# gets everything from bitbucket and brings it across to GH, adding LFS where necessary for file size
# then archives everything brought over
#
# runs on Python 3; does clone --mirror and push --mirror, cleaning up after itself
#
# you need git-lfs installed on the local system
# also make sure you've got git credential caching set up https://help.github.com/articles/caching-your-github-password-in-git/
import json
@cawa-93
cawa-93 / sideloader.function.php
Last active October 14, 2024 14:31 — forked from kellenmace/class-download-remote-image.php
Download and Insert a Remote Image File into the WordPress Media Library
<?php
namespace Plugin\Sideloader;
/**
* Function handles downloading a remote file and inserting it
* into the WP Media Library.
* @param string $url HTTP URL address of a remote file
* @param int $post_id The post ID the media is associated with
* @param string $desc Description of the side-loaded file
* @param string $post_data Post data to override
@jscher2000
jscher2000 / showAsPrint.js
Last active March 26, 2024 10:50
Emulate print media in Firefox 62 (userscript work in progress)
// For Firefox's Web Console, creates the functions showAsPrint() and undoShowAsPrint()
// to roughly emulate print media and revert
function showAsPrint(){
var docSS = document.styleSheets, ss, oldMedia, newMedia, rules;
var p2s = function(media){
if (media.indexOf('all') > -1) return media; //no need to change
if (media == 'print') return 'all, wasprint'; //show on screen, too
if (media.indexOf('print') > -1 && media.indexOf('screen') > -1) return media; //no need to change
if (media == 'screen') return 'wasscreen'; //hide these rules
if (media.indexOf('screen') > -1) return media.replace('screen', 'wasscreen'); //hide these rules
var amazon_assoc_ir_f_call_associates_ads = function(d) {
var b = "", c, a;
if (typeof JSON !== "undefined") {
a = JSON.stringify(d);
} else {
if (typeof amzn_assoc_utils !== "undefined") {
a = amzn_assoc_utils.stringify(d);
} else {
return;
}
@RadGH
RadGH / rs_upload_from_url.php
Last active October 1, 2024 08:07
Upload a file from a URL to the WordPress media gallery. Supports images, PDFs, and other file types.
<?php
/**
* This function uploads a file from a URL to the media library, designed to be placed in your own theme or plugin.
* Metadata will be generated and images will generate thumbnails automatically.
*
* HOW TO USE:
* 1. Add the function below to your theme or plugin
* 2. Call the function and provide the URL to an image or other file.
* 3. If successful, the attachment ID will be returned.