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
@trev-dev
trev-dev / compiled.css
Created August 3, 2017 00:13
Sass + autoprefix compiled
.wrapper {
width: 960px;
max-width: 100%;
margin: 0 auto;
}
.wrapper::after {
clear: both;
content: "";
display: block;
@trev-dev
trev-dev / precompiled.sass
Created August 3, 2017 00:16
Sassy example
.wrapper
+grid-container
width: 960px
max-width: 100%
margin: 0 auto
.form-top
+grid-column
text-align: center
@trev-dev
trev-dev / variants.js
Created October 4, 2017 03:47
Variant Breakdown
current.product.variants = [{option1: 'Normal'}, {option1: 'Foil'}]; // Original Code
// Lets make some white space to make this easier ;) - then we're going to add our missing parameters.
current.product.variants = [
{
option1: 'Normal',
inventory_quantity: 0,
inventory_management: 'shopify'
},
@trev-dev
trev-dev / app.js
Last active November 16, 2017 00:57
Image upload example
var express = require('express');
var config = require('./modules/config');
var routes = require('./modules/routes'); // Using all routes as an exported function. See routes.js.
var db = require('./modules/db.js');
var app = express();
app.set('view engine', 'pug');
app.use('/form', express.static(`${__dirname}/static`));
app.use('/form/form', express.static(`${__dirname}/static`));
@trev-dev
trev-dev / Original.css
Last active January 15, 2018 02:39
Media Query Troubles
/*
Styles only apply to 1224px wide, if we go below that, these styles stop applying.
If we fall below 1224px wide, suddenly all of our header styles disappear, which is bad news bears for us.
*/
@media only screen and (min-width : 1224px) {
h3 { margin: 50px auto; }
h3:first-child { margin-top: 0; }
header{
background-color:#f3f2f5;
@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) {
@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 / 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 / .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
}
]
],
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()
}