Skip to content

Instantly share code, notes, and snippets.

View pravnkay's full-sized avatar
Learning a lot

Praveen K pravnkay

Learning a lot
View GitHub Profile
@pravnkay
pravnkay / Readme.md
Created December 16, 2019 14:50
SweetAlert2 for VueJS

SweetAlert2 integration to VueJS

There are too many wrappers for sweetalert2 for vuejs and most of them does the same thing with less functionality.

Here is how to integrate the default SweetAlert package into VueJS

Step 1

Install SweetAlert2

@pravnkay
pravnkay / Readme.md
Last active March 14, 2020 16:12
Custom theme support for Bootstrap-Vue

Custom theme support for Bootstrap-Vue

Versions used

@vue/cli 4.1.1

Using below commands to install bootstrap-vue, adds the plugin file and pre-fills the statements. Just have alook at them and edit them

vue create my-app
cd my-app

vue add bootstrap-vue

@pravnkay
pravnkay / Readme.md
Last active November 22, 2024 03:31
Nprogress - Loading bar for VueJS Router

Installation of Nprogress for VueJS

Install nprogress.

npm install nprogress --save


Add its CSS

@pravnkay
pravnkay / functions.php
Created December 13, 2019 09:10
Allow CORS for WP API - Along with sending Status 200 for OPTIONS request
add_action( 'init', 'handle_preflight' );
function handle_preflight() {
$origin = get_http_origin();
if ( $origin == 'http://localhost:8080' || $origin == 'https://yourapp.firebaseapp.com') {
header("Access-Control-Allow-Origin: " . $origin);
header("Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE");
As I figured out, this question is really only related to beginners in PWA, which don't know that you can (and need) to configure PWA for achieving this. If you feel addressed now (and using VueJS) remember:
To automatically download the new content, you need to configure PWA. In my case (VueJS) this is done by creating a file vue.config.js in the root directory of my project (On the same level as package.json).
Inside this file you need this:
module.exports = {
pwa: {
@pravnkay
pravnkay / AppServiceProvider.php
Created July 27, 2018 13:42
Laravel String Length Error Fix
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**