Skip to content

Instantly share code, notes, and snippets.

View trev-dev's full-sized avatar
:electron:
Free as in Freedom

Trev trev-dev

:electron:
Free as in Freedom
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
@trev-dev
trev-dev / app.ts
Last active October 30, 2020 11:09
A functional example of an application entrypoint
import { pipe } from '../utilities'
import { Model } from './model'
import { HyperScriptView } from './view'
import {
MessageObject, Updater, MSG, Dispatcher, dispatchList
} from './update'
import createElement from 'virtual-dom/create-element'
import { diff, patch } from 'virtual-dom'
@trev-dev
trev-dev / _contact_page.scss
Last active October 4, 2020 22:39
Rendering Wagtail's AbstractEmailForm on a field-by-field basis
#is-contact-form {
input {
@extend .input;
}
textarea {
@extend .textarea;
}
}
@trev-dev
trev-dev / dadjoke.js
Created September 15, 2020 23:46
I can haz dadjoke plz
#! /usr/bin/node
const https = require('https')
const options = {
headers: {
'Accept': 'application/json'
}
}
https.get('https://icanhazdadjoke.com', options, req => {
@trev-dev
trev-dev / schema.json
Created September 15, 2020 21:07
Intermittently Breaking Section
{
"name": "Pool Safety Covers",
"settings": [
{
"type": "paragraph",
"content": "Set up safety covers for your pool covers and steps."
}
],
"blocks": [
{
class SuggestionsData {
constructor() {
this.$CF = document.querySelector('form[data-cf-form]')
this.liquid_data = JSON.parse(
document.getElementById('dog_customer_details').innerText
)
this.storage = null
this.init_data()
}
@trev-dev
trev-dev / .babelrc
Last active May 18, 2019 18:44
ES6 friendly Vue setup. Meant to be used with gulp + babel.
{
"presets": [
"@babel/env",
"@vue/babel-preset-jsx",
[
"babel-preset-minify", {
"mangle": true
}
]
],
@trev-dev
trev-dev / gulpfile.js
Created February 12, 2019 20:02
NPM Configs for Webpack & Gulp for a (mostly) static Wagtail site.
const { task, src, dest, series, watch } = require('gulp')
const sass = require('gulp-sass')
const autoprefixer = require('gulp-autoprefixer')
const rename = require('gulp-rename')
sass.compiler = require('node-sass')
function scss() {
return src('./src/sass/main.scss')
.pipe(sass({ outputStyle: 'compressed' })
@trev-dev
trev-dev / Mailer.js
Last active February 22, 2018 23:42
Node Mailer
const mailer = require('nodemailer');
const validator = require('validator');
class Email {
constructor() {
this.config = {
host: 'host',
port: 465,
secure: true,
@trev-dev
trev-dev / Mailer.php
Last active January 27, 2018 21:16
Simple email mailer
<?php
// $mailer = new Mailer(Obj). Obj is expected to be a parsed JSON object from the front end
// Example {"email": "person@mailing.com", "name": "Person Mailing", "message": "Hello"}
// you decode_json(Obj, true); first before instantiating the mail object with it.
// Mailer will echo a JSON string of either a success message or an array of errors after attempting
// to sanitize, validate and send mail. use $mailer->send(); to run the module after instantiating it.
class Mailer {
function __construct($envelope) {