Skip to content

Instantly share code, notes, and snippets.

@mcorkum
mcorkum / test.json
Last active July 13, 2023 02:32
WordPress - Overriding Gutenberg text strings with translations
{
"domain": "messages",
"locale_data": {
"messages": {
"": {
"domain": "messages"
},
"This block contains unexpected or invalid content.": [
"Poop, this block sucks now"
]
@mcorkum
mcorkum / [...nextauth].ts
Created May 5, 2023 18:19
Microsoft ADFS Provider for Resource in Next Auth with Types
// Import the required packages
import NextAuth, { NextAuthOptions } from 'next-auth';
import { JWT } from 'next-auth/jwt';
import jwt_decode from 'jwt-decode'; // Used for decoding the accessToken in account
// Define the types for the profile
interface ProfileProps {
aud: string;
iss: string;
iat: number;
# Install dependencies
FROM node:16 AS dependencies
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
# Run yarn build
FROM node:16 AS builder
WORKDIR /app
COPY --from=dependencies /app/node_modules ./node_modules
wp_register_script('name', 'path/to/script.js');
$array = array(
'poop' => 'yes, please',
'pee' => 'would prefer poop'
);
wp_localize_script('name', 'js_object_name', $array);
https://polyfill.io/v3/polyfill.js?features=Element.prototype.classList%2Cdocument.querySelector%2CNode.prototype.contains%2CElement.prototype.remove%2Cdocument%2CNumber.MAX_SAFE_INTEGER%2CNumber.MIN_SAFE_INTEGER
@mcorkum
mcorkum / give-export.php
Created November 14, 2018 18:18
Add custom meta to export
<?php
/**
* Add custom metadata to the columns for export
*
* @param array $data Current data in the export
* @param array $payment Array containing payment metadata
*
* @return array $data - Modified data
*/
function add_data_to_export( $data, $payment ) {
$secret_iv = '3434977318554001';
$iv = substr( hash( 'sha256', $secret_iv ), 0, 16 );
$file_contents = get_file_contents( 'file_to_decrypt.aes' );
$output = openssl_decrypt( base64_decode( $file_contents ), 'AES128', $key, 0, $iv);
file_put_contents( 'file_to_decrypt.pdf' );
@mcorkum
mcorkum / emit-musk.php
Last active August 10, 2016 13:34
MUSK
<?php
/*
Plugin Name: Emit Musk
Plugin URI: https://mantelope.io
Description: Adds musk to your content.
Version: 9,000,000,000.7684728 ½
Author: Industry
Author URI: https://mantelope.io
License: Yes.
*/
$(document).ready(function(){
function getRandomPosition(element) {
var x = 400;
var y = 400;
var randomX = Math.floor(Math.random()*x+50);
var randomY = Math.floor(Math.random()*y-200);
return [randomX,randomY];
}
window.onload = function() {
include("db-connect.php");
include("handle-form.php");
$errors = handleComments();