Skip to content

Instantly share code, notes, and snippets.

View OriginalEXE's full-sized avatar
🐱
Happily roaming

Ante Sepic OriginalEXE

🐱
Happily roaming
View GitHub Profile
@OriginalEXE
OriginalEXE / rename-page-content-type-for-compose.ts
Created May 5, 2021 12:17
Contentful Compose: Renaming existing page content type to make way for Compose page content type
// Example of a migration script for renaming an existing "page" content type to "legacyPage"
// to make room for Contentful Compose "page" content type
// The following example is written in TypeScript
import { MigrationFunction } from "contentful-migration";
import murmurhash from "murmurhash";
const migrate: MigrationFunction = (migration) => {
// Create a duplicate of the clashing page content type
const pageCopy = migration
.createContentType("legacyPage")
@OriginalEXE
OriginalEXE / ActivityBasedTimer.js
Last active May 16, 2022 12:42
An interface that handles timers based on the user activity
const ActivityBasedTimer = () => {
let globalTimerId = 0;
const timers = new Map();
const maybeExecuteTimerCallback = ({ timerId, forced = false }) => {
const timer = timers.get(timerId);
if (timer === undefined) {
return;
}
@OriginalEXE
OriginalEXE / pe-customize-controls.css
Last active June 26, 2023 05:07
Extending WordPress Customizer Panels and Sections to allow nesting
.in-sub-panel #customize-theme-controls .customize-pane-child.current-panel-parent,
#customize-theme-controls .customize-pane-child.current-section-parent {
-webkit-transform: translateX(-100%);
-ms-transform: translateX(-100%);
transform: translateX(-100%);
}
@OriginalEXE
OriginalEXE / gist:9051666
Last active August 29, 2015 13:56
Retrieve all instances of the specified shortcode (WordPress)
/**
* Retrieve all instances of the specified shortcode
*
* @since Never
*
* @global array $shortcode_tags
* @param string $tag
* @return boolean/array
*/
function oe_filter_shortcodes( $content, $tag, $result = array() ) {