Skip to content

Instantly share code, notes, and snippets.

@eolant
eolant / Confirm.vue
Last active March 23, 2024 08:48
Vuetify Confirm Dialog component that can be used locally or globally
<template>
<v-dialog v-model="dialog" :max-width="options.width" :style="{ zIndex: options.zIndex }" @keydown.esc="cancel">
<v-card>
<v-toolbar dark :color="options.color" dense flat>
<v-toolbar-title class="white--text">{{ title }}</v-toolbar-title>
</v-toolbar>
<v-card-text v-show="!!message" class="pa-4">{{ message }}</v-card-text>
<v-card-actions class="pt-0">
<v-spacer></v-spacer>
<v-btn color="primary darken-1" text @click.native="agree">Yes</v-btn>
@eolant
eolant / filters.php
Last active March 24, 2021 10:46
Contact form 7 Bootstrap 4 custom radio and checkbox buttons filter to remove spans and change HTML structure
/**
* Adjust contact form 7 radios and checkboxes to match bootstrap 4 custom radio structure.
*/
add_filter('wpcf7_form_elements', function ($content) {
$content = preg_replace('/<label><input type="(checkbox|radio)" name="(.*?)" value="(.*?)" \/><span class="wpcf7-list-item-label">/i', '<label class="custom-control custom-\1"><input type="\1" name="\2" value="\3" class="custom-control-input"><span class="wpcf7-list-item-label custom-control-label">', $content);
return $content;
});
@eolant
eolant / KeyboardInput.vue
Created June 6, 2018 04:17
Vue Component with Twitter Bootstrap styles for custom Mottie/Keyboard (Virtual Keyboard) input or textarea
<template>
<input
:type="type"
:placeholder="placeholder"
:name="name"
class="form-control"
autocomplete="off"
v-model="value"
>
</template>
@eolant
eolant / TitleCase.js
Created February 9, 2018 01:11
Title case utf8 string javascript function
function toTitleCase(str) {
return str.replace(/[\u00C0-\u1FFF\u2C00-\uD7FF\w]+\s*/g, function (txt) {
return txt.charAt(0).toUpperCase() + txt.substr(1);
});
}