Like PHP's htmlentities()/htmlspecialchars() functions, JavaScript is easy to implement it.
/**
function checkForCloseMatch(longString, shortString) { | |
// too many false positives with very short strings | |
if (shortString.length < 3) return ''; | |
// test if the shortString is in the string (so everything is fine) | |
if (longString.includes(shortString)) return ''; | |
// split the shortString string into two at each postion e.g. g|mail gm|ail gma|il gmai|l | |
for (let i = 1; i < shortString.length; i++) { | |
const firstPart = shortString.substring(0, i); |
let counter = 0; | |
let scriptMap = new Map(); | |
export const ScriptCache = (function(global) { | |
return function ScriptCache (scripts) { | |
const Cache = {}; | |
Cache._onLoad = function(key) { | |
return (cb) => { | |
let stored = scriptMap.get(key); |
# SSL self signed localhost for rails start to finish, no red warnings. | |
# 1) Create your private key (any password will do, we remove it below) | |
$ openssl genrsa -des3 -out server.orig.key 2048 | |
# 2) Remove the password | |
$ openssl rsa -in server.orig.key -out server.key |
let webpack = require('webpack'); | |
let path = require('path'); | |
module.exports = { | |
entry: { | |
app: './resources/assets/js/app.js', | |
vendor: ['vue', 'axios'] | |
}, | |
output: { |
<?php | |
/** | |
* Yii Application Config | |
* | |
* Edit this file at your own risk! | |
* | |
* The array returned by this file will get merged with | |
* vendor/craftcms/cms/src/config/app/main.php and [web|console].php, when | |
* Craft's bootstrap script is defining the configuration for the entire | |
* application. |
<div class="main-wrapper"> | |
<div class="header"><h1>Vue Shopping Cart</h1></div> | |
<div id="vue"> | |
<cart :cart="cart" :cart-sub-total="cartSubTotal" :tax="tax" :cart-total="cartTotal" :checkout-bool="checkoutBool"></cart> | |
<products :cart="cart" :cart-sub-total="cartSubTotal" :tax="tax" :cart-total="cartTotal" :products-data="productsData"></products> | |
<checkout-area v-if="checkoutBool" :cart="cart" :tax="tax" :cart-sub-total="cartSubTotal" :cart-total="cartTotal" :products-data="productsData" :total-with-tax="totalWithTax"></checkout-area> | |
</div> | |
</div> |
<template> | |
<div> | |
<vue-editor v-model="content" ref="editor" :editor-options="toolbarOptions" @text-change="updateValue" useCustomImageHandler @imageAdded="uploadImage"></vue-editor> | |
</div> | |
</template> | |
<script> | |
import Vue from "vue"; | |
import axios from 'axios' | |
let VueEditor, Quill; |
import javax.crypto.Cipher; | |
import javax.crypto.spec.IvParameterSpec; | |
import javax.crypto.spec.SecretKeySpec; | |
import java.io.UnsupportedEncodingException; | |
import java.security.MessageDigest; | |
import java.security.NoSuchAlgorithmException; | |
import java.util.Arrays; | |
import java.util.Base64; | |
import java.io.ByteArrayOutputStream; |
using System; | |
using System.Text; | |
using System.Security.Cryptography; | |
namespace AES256 | |
{ | |
class Program | |
{ | |
private string encrypt(string clearText, string secretKey, string initVector) | |
{ |
Like PHP's htmlentities()/htmlspecialchars() functions, JavaScript is easy to implement it.
/**