Skip to content

Instantly share code, notes, and snippets.

View seandelaney's full-sized avatar
🏠
Working from home

Sean Delaney seandelaney

🏠
Working from home
View GitHub Profile
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);
@aganglada
aganglada / script-cache.js
Created February 24, 2017 11:00
Script Cache Promise based
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);
@oslego
oslego / gist:f13e136ffeaa6174289a
Last active January 3, 2019 14:24 — forked from sl4m/gist:5091803
create self-signed certificate for localhost
# 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: {
@mmikkel
mmikkel / app.php
Created August 19, 2018 13:23
Craft 3 multi-env email settings
<?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.
@sahuguet
sahuguet / index.html
Created October 5, 2018 21:44
Vue.js Shopping Cart
<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>
@izzygld
izzygld / Wysiwyg.vue
Created January 9, 2019 14:06
Adding a “show html” button in Quill (Wysiwyg).
<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;
@siddharth
siddharth / ChecksumGen.java
Last active March 16, 2022 13:54
Replicating / Implementing Java's AES/CBC/PKCS5Padding encryption in PHP
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;
@jiavictor
jiavictor / AES256.cs
Last active March 16, 2022 13:59
Simple AES-256-CBC Test
using System;
using System.Text;
using System.Security.Cryptography;
namespace AES256
{
class Program
{
private string encrypt(string clearText, string secretKey, string initVector)
{
@yidas
yidas / js-encode-decode.md
Last active April 6, 2022 15:26
JavaScript HTML Entities Encode & Decode