This file will setup Wordpress, MySQL & PHPMyAdmin with a single command. Add the code below to a file called "docker-compose.yaml" and run the command
$ docker-compose up -d
# To Tear Down
$ docker-compose down --volumes
| /** | |
| * Example to refresh tokens using https://github.com/auth0/node-jsonwebtoken | |
| * It was requested to be introduced at as part of the jsonwebtoken library, | |
| * since we feel it does not add too much value but it will add code to mantain | |
| * we won't include it. | |
| * | |
| * I create this gist just to help those who want to auto-refresh JWTs. | |
| */ | |
| const jwt = require('jsonwebtoken'); |
| import { extend } from "vee-validate"; //import extend function from vee-validate | |
| extend("password", { | |
| message: | |
| "{_field_} must be at least 8 characters, contain One Uppercase, One lowercase, One Special character i.e (! @ # $ % ^ & *), One number.", | |
| validate: value => { | |
| const strong_password = new RegExp( | |
| "^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*])(?=.{8,})" | |
| ); // regex to check our strong password |
| import * as mongoose from 'mongoose'; | |
| import {Schema} from 'mongoose'; | |
| const bcrypt = require('bcrypt-nodejs'); | |
| const userSchema = new Schema({ | |
| local: { | |
| username: String, | |
| email: {type: String, unique: true, index: true, sparse: true, lowercase: true, trim: true}, | |
| password: String, |
| # Heavily depends on: | |
| # libqrencode (fukuchi.org/works/qrencode/) | |
| # paperkey (jabberwocky.com/software/paperkey/) | |
| # zbar (zbar.sourceforge.net) | |
| # Producing the QR codes: | |
| # Split over 4 codes to ensure the data per image is not too large. | |
| gpg --export-secret-key KEYIDGOESHERE | paperkey --output-type raw | base64 > temp | |
| split temp -n 4 IMG | |
| for f in IMG*; do cat $f | qrencode -o $f.png; done |
| ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/id_rsa | |
| ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/github_rsa | |
| ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/mozilla_rsa |
| add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' ); | |
| function custom_override_checkout_fields( $fields ) { | |
| unset($fields['billing']['billing_first_name']); | |
| unset($fields['billing']['billing_last_name']); | |
| unset($fields['billing']['billing_company']); | |
| unset($fields['billing']['billing_address_1']); | |
| unset($fields['billing']['billing_address_2']); | |
| unset($fields['billing']['billing_city']); | |
| unset($fields['billing']['billing_postcode']); |
| // Generate unique IDs for use as pseudo-private/protected names. | |
| // Similar in concept to | |
| // <http://wiki.ecmascript.org/doku.php?id=strawman:names>. | |
| // | |
| // The goals of this function are twofold: | |
| // | |
| // * Provide a way to generate a string guaranteed to be unique when compared | |
| // to other strings generated by this function. | |
| // * Make the string complex enough that it is highly unlikely to be | |
| // accidentally duplicated by hand (this is key if you're using `ID` |