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
| { | |
| "rewrites": [ | |
| { | |
| "source": "/ingest/:path*", | |
| "destination": "https://app.posthog.com/:path*" | |
| }, | |
| { | |
| "source": "/decide/:path*", | |
| "destination": "https://app.posthog.com/decide/:path*" | |
| }, |
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
| add_filter( 'the_content', 'so_9405896_the_content_filter', 20, 1 ); | |
| function so_9405896_the_content_filter( $content ) | |
| { | |
| if( is_admin() || !current_user_can( 'administrator' ) ) | |
| return $content; | |
| global $template; | |
| $the_templ = '<strong style="background-color: #CCC;padding:10px">TEMPLATE = ' | |
| . basename( $template ) . '</strong><br />'; |
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 python3 | |
| """ | |
| replace.py — Replace a domain in a large SQL file safely and efficiently. | |
| ------------------------------------------------------------ | |
| USAGE: | |
| python replace.py <path_to_file.sql> <old_domain> <new_domain> | |
| EXAMPLE: | |
| python replace.py ./dump.sql old-domain.com newdomain.com |
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
| add_action( 'template_redirect', function () { | |
| ob_start( function ( $output ) { | |
| $nonces = []; | |
| $output = preg_replace_callback( '#<script.*?\>#', function ( $matches ) use ( &$nonces ) { | |
| $nonce = wp_create_nonce( $matches[0] ); | |
| $nonces[] = $nonce; |
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
| <section class="bg-gray-001"> | |
| <div class="w-10/12 mx-auto grid gap-5 py-8"> | |
| <div class="hs-search"> | |
| <h2 class="mb-2 text-xl font-normal">Explore More</h2> | |
| <div class="hs-search-field"> | |
| <div class="hs-search-field__bar"> | |
| <form id="hs-search-blog" action="/{{ site_settings.content_search_results_page_path }}" class="flex flex-col sm:flex-row"> | |
| <input type="text" class="hs-search-field__input p-4 sm:p-2 mb-2 sm:mb-0" name="term" autocomplete="off" aria-label="{{ "Search" }}" placeholder="{{ "Type to search" }}"> | |
| <input type="hidden" class="lg:pr-1" name="type" value="BLOG_POST"> | |
| <input type="hidden" name="pathPrefix" value="info"> |
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
| {% if contents.total_page_count > 1 %} | |
| <div class="blog-pagination clearfix flex items-center space-x-1"> | |
| {% set page_list = [-2, -1, 0, 1, 2] %} | |
| {% if contents.total_page_count - current_page_num == 1 %}{% set offset = -1 %} | |
| {% elif contents.total_page_count - current_page_num == 0 %}{% set offset = -2 %} | |
| {% elif current_page_num == 2 %}{% set offset = 1 %} | |
| {% elif current_page_num == 1 %}{% set offset = 2 %} | |
| {% else %}{% set offset = 0 %}{% endif %} | |
| {% if last_page_num %} |
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
| {% if contents.total_page_count > 1 %} | |
| <div class="blog-pagination"> | |
| {% set page_list = [-2, -1, 0, 1, 2] %} | |
| {% if contents.total_page_count - current_page_num == 1 %}{% set offset = -1 %} | |
| {% elif contents.total_page_count - current_page_num == 0 %}{% set offset = -2 %} | |
| {% elif current_page_num == 2 %}{% set offset = 1 %} | |
| {% elif current_page_num == 1 %}{% set offset = 2 %} | |
| {% else %}{% set offset = 0 %}{% endif %} | |
| <div class="blog-pagination-left"> |
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
| /* ------------------------------------------------------------------------------- */ | |
| /* Add media data (width and height) to SVG upload | |
| /* https://wordpress.stackexchange.com/a/256701/164915 | |
| /* Alternative: https://wordpress.org/plugins/enable-svg-uploads/ | |
| /* ------------------------------------------------------------------------------- */ | |
| function svg_meta_data($data, $id){ | |
| $attachment = get_post($id); // Filter makes sure that the post is an attachment | |
| $mime_type = $attachment->post_mime_type; // The attachment mime_type |
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 | |
| $image_sizes = wp_get_additional_image_sizes(); | |
| foreach ( $image_sizes as $key => $image_size ) { | |
| echo "{$key} ({$image_size['width']} x {$image_size['height']})"; | |
| } | |
| ?> |
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
| void main() { | |
| runApp(_SwitchingThemeApp()); | |
| } | |
| /// Properties that help me keep track of the example being run. | |
| bool _useMaterial = false; | |
| class _SwitchingThemeApp extends StatefulWidget { | |
| @override | |
| _SwitchingThemeAppState createState() => _SwitchingThemeAppState(); |
NewerOlder