Skip to content

Instantly share code, notes, and snippets.

Aaron Vail availit

View GitHub Profile
View CreateNewUser.js
const transporter = nodemailer.createTransport({
service: 'SendinBlue', // no need to set host or port etc.
auth: {
user: 'YOUR EMAIL',
pass: 'API KEY'
}
});
// Read more on the usage of Nodemailer package here: https://nodemailer.com/usage/
View cosmic.js
const Cosmic = require('cosmicjs')();
const database = Cosmic.bucket({
slug: 'YOUR BUCKET SLUG',
write_key: 'YOUR BUCKET WRITE KEY',
read_key: 'YOUR BUCKET READ KEY'
})
export default database
@availit
availit / cloudflare-worker-force-lowercase.js
Created Oct 29, 2018
Cloudflare worker script to rewrite requests to lowercase, to prevent duplicate page URLs
View cloudflare-worker-force-lowercase.js
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
/**
* Fetch and log a request
* @param {Request} request
*/
async function handleRequest(request) {
let url = request.url
@availit
availit / gist:fe868ee679653cf93b03ed0a7b2a143e
Last active Oct 23, 2018 — forked from ayamflow/gist:b602ab436ac9f05660d9c15190f4fd7b
Safari border-radius + overflow: hidden + CSS transform fix
View gist:fe868ee679653cf93b03ed0a7b2a143e
// Add on element with overflow
-webkit-mask-image: -webkit-radial-gradient(white, black);
// or translate3d
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-webkit-transform: translate3d(0, 0, 0);
-moz-transform: translate3d(0, 0, 0);
@availit
availit / jQueryLightboxDemo.html
Created Aug 6, 2018
Demo for a jQuery plugin for creating responsive and touch enabled image galleries
View jQueryLightboxDemo.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Lightbox Plugin Demo</title>
<!-- LINK TO REQUIRED PLUGIN CSS FILE -->
<link href='https://www.jqueryscript.net/demo/Responsive-Touch-enabled-jQuery-Image-Lightbox-Plugin/dist/simplelightbox.min.css' rel='stylesheet' type='text/css'>
<!-- LINK TO CUSTOM CSS -->
<link href='https://www.jqueryscript.net/demo/Responsive-Touch-enabled-jQuery-Image-Lightbox-Plugin/demo.css' rel='stylesheet' type='text/css'>
</head>
View epoch-trigger.js
// set trigger time using https://www.epochconverter.com/ (know the trigger time in GMT)
triggerTime(1496300400000);
function run_script (){
// put your logic here
}
// No need to alter any of this.
function triggerTime(trigger) {
var now = new Date().getTime();
@availit
availit / epoch-trigger.js
Created Oct 11, 2017
jQuery Epoch Timestamp Trigger
View epoch-trigger.js
// set trigger time using https://www.epochconverter.com/ (know the trigger time in GMT)
triggerTime(1496300400000);
function run_script (){
// put your logic here
}
// No need to alter any of this.
function triggerTime(trigger) {
var now = new Date().getTime();
You can’t perform that action at this time.