Skip to content

Instantly share code, notes, and snippets.

Avatar
🐌
Happily roaming

Ante Sepic OriginalEXE

🐌
Happily roaming
View GitHub Profile
@OriginalEXE
OriginalEXE / rename-page-content-type-for-compose.ts
Created May 5, 2021
Contentful Compose: Renaming existing page content type to make way for Compose page content type
View rename-page-content-type-for-compose.ts
// 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 Mar 29, 2021
An interface that handles timers based on the user activity
View ActivityBasedTimer.js
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 Jan 11, 2021
Extending WordPress Customizer Panels and Sections to allow nesting
View pe-customize-controls.css
.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 Aug 29, 2015
Retrieve all instances of the specified shortcode (WordPress)
View gist:9051666
/**
* 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() ) {