Skip to content

Instantly share code, notes, and snippets.

Avatar

Vitaly Kasymov eolant

View GitHub Profile
@eolant
eolant / filters.php
Last active May 11, 2020
Contact form 7 Bootstrap 4 custom radio and checkbox buttons filter to remove spans and change HTML structure
View filters.php
/**
* 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 Jun 6, 2018
Vue Component with Twitter Bootstrap styles for custom Mottie/Keyboard (Virtual Keyboard) input or textarea
View KeyboardInput.vue
<template>
<input
:type="type"
:placeholder="placeholder"
:name="name"
class="form-control"
autocomplete="off"
v-model="value"
>
</template>
@eolant
eolant / TitleCase.js
Created Feb 9, 2018
Title case utf8 string javascript function
View TitleCase.js
function toTitleCase(str) {
return str.replace(/[\u00C0-\u1FFF\u2C00-\uD7FF\w]+\s*/g, function (txt) {
return txt.charAt(0).toUpperCase() + txt.substr(1);
});
}
@eolant
eolant / Confirm.vue
Last active Aug 6, 2020
Vuetify Confirm Dialog component that can be used locally or globally
View Confirm.vue
<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>
You can’t perform that action at this time.