Skip to content

Instantly share code, notes, and snippets.

@doup
doup / 00_example.php
Last active April 30, 2017 13:54
CarbonFields Transformer to get & cast values from a container
<?php
// Define the theme container
use \Carbon_Fields\Container;
use \Carbon_Fields\Field;
$theme_container = Container::make('theme_options', 'Theme')->add_fields([
Field::make('text', 'analytics_id', 'Google Analytics tracking ID'),
Field::make('text', 'maps_api_key', 'Google Maps API Key'),
// ...
]);
@doup
doup / app.module.ts.md
Last active November 6, 2020 12:54
`ngx-translate` cache busting
+ // This value will be injected by Webpack
+ declare const I18N_HASH: string;

export function createTranslateLoader(http: HttpClient) {
- return new TranslateHttpLoader(http, './assets/i18n/', '.json');
+ return new TranslateHttpLoader(http, './assets/i18n/', '.json?v=' + I18N_HASH);
}
@doup
doup / bevy-7761.html
Created March 9, 2023 08:53
Bevy #7761 `text_wrap_debug.rs`
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Bevy #7761 example</title>
<style>
/* Reset */
* {