This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.
Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).
| <script> | |
| import MY_JSON from './json/data.json'; | |
| export default{ | |
| // custom option named myJson | |
| myJson: MY_JSON | |
| } | |
| </script> | |
| <template> | |
| <div> |
| <template> | |
| <code v-if="active" :class="`code-box${codeBoxVariationClass}`">{{ object | prettyjson }}</code> | |
| </template> | |
| <script> | |
| const defaultObject = [ | |
| { id: 1, title: 'Test', content: 'Sie haben kein Objekt übergeben. Bitte benutzen sie das Attribut :object um Ihr Objekt an die Komponente zu übergeben.' }, | |
| ]; | |
| export default { |
| if(!!window.React || | |
| !!document.querySelector('[data-reactroot], [data-reactid]')) | |
| console.log('React.js'); | |
| if(!!window.angular || | |
| !!document.querySelector('.ng-binding, [ng-app], [data-ng-app], [ng-controller], [data-ng-controller], [ng-repeat], [data-ng-repeat]') || | |
| !!document.querySelector('script[src*="angular.js"], script[src*="angular.min.js"]')) | |
| console.log('Angular.js'); |
| Vue.filter('getContrastColor', function (backgroundHexColor) { | |
| if (!backgroundHexColor) return ''; | |
| const hexcolor = backgroundHexColor.replace("#", ""); | |
| const r = parseInt(hexcolor.substr(0, 2), 16); | |
| const g = parseInt(hexcolor.substr(2, 2), 16); | |
| const b = parseInt(hexcolor.substr(4, 2), 16); | |
| var yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000; | |
| return (yiq >= 128) ? '#000000' : '#ffffff'; | |
| }) |
| # config.js | |
| const config = { | |
| ..., | |
| features: { | |
| ... | |
| }. | |
| ... | |
| } | |
| function calculateGoldenRatio(length) { | |
| const phi = 1.6180339887498948; | |
| const a = Math.round(length / phi) | |
| const b = length - a; | |
| return { a: a, b: b }; | |
| } |
This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.
Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).
| <?php | |
| /** | |
| * Plugin Name: Front-end Media Example | |
| * Plugin URI: http://derekspringer.wordpress.com | |
| * Description: An example of adding the media loader on the front-end. | |
| * Version: 0.1 | |
| * Author: Derek Springer | |
| * Author URI: http://derekspringer.wordpress.com | |
| * License: GPL-2.0+ |
| <?php | |
| class Some_WP_Plugin { | |
| /** | |
| * Init everything here | |
| */ | |
| public function __construct() { | |
| add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); | |
| add_filter( 'ajax_query_attachments_args', array( $this, 'filter_media' ) ); |
| const poll = async ({ fn, validate, interval, maxAttempts }) => { | |
| let attempts = 0; | |
| const executePoll = async (resolve, reject) => { | |
| const result = await fn(); | |
| attempts++; | |
| if (validate(result)) { | |
| return resolve(result); | |
| } else if (maxAttempts && attempts === maxAttempts) { |