This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Tiny debounce | |
interface DebounceFunction { | |
(callback: (...args: any[]) => void, frequency?: number, timer?: number | null): (...args: any[]) => void; | |
} | |
export const debounce: DebounceFunction = (callback, frequency = 250, timer: number | null = null) => { | |
return (...args: any[]) => ( | |
clearTimeout(timer!), (timer = setTimeout(function () { | |
callback(); | |
}, frequency, ...args)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env php | |
<?php | |
/* | |
* This script compiles a set of MCP template files into a JSON object for export. | |
* It reads the content of each file and adds it to the JSON object. | |
* The output is printed to the console, you can pipe it to pbcopy then paste it | |
* into the MCP template editor | |
* | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script runat="server"> | |
Platform.Load("core","1"); | |
HTTPHeader.SetValue("Access-Control-Allow-Origin","*"); | |
HTTPHeader.SetValue("Content-Type","application/json"); | |
</script>%%[ | |
VAR @email, @rowCount | |
/* Capture email & competition from URL if passed */ | |
SET @email = RequestParameter("email") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'wp_get_attachment_image_src', function ($image, $attachment_id, $size, $icon) { | |
if (is_array($image) && preg_match('/\.svg$/i', $image[0]) && $image[1] <= 1) { | |
if(is_array($size)) { | |
$image[1] = $size[0]; | |
$image[2] = $size[1]; | |
} elseif(($xml = simplexml_load_file($image[0])) !== false) { | |
$attr = $xml->attributes(); | |
$viewbox = explode(' ', $attr->viewBox); |
OlderNewer