Skip to content

Instantly share code, notes, and snippets.

View araphiel's full-sized avatar
🌟

Armon Raphiel araphiel

🌟
View GitHub Profile
@araphiel
araphiel / handleChange.js
Created July 20, 2018 19:04
React form handler
handleChange = event => {
this.setState({ [event.currentTarget.name]: event.currentTarget.value })
}
@araphiel
araphiel / index.md
Created November 2, 2018 19:45
High Res Gif
$ ffmpeg -i trim-sparkle-main.mov -filter_complex "[0:v] fps=12,scale=w=480:h=-1,split [a][b];[a] palettegen=stats_mode=single [p];[b][p] paletteuse=new=1" sparkle.gif
@araphiel
araphiel / .env
Last active January 17, 2019 19:14
Gatsby.js Docker
GATSBY_WEBPACK_PUBLICPATH=/
ENABLE_REFRESH_ENDPOINT=true
@araphiel
araphiel / package.json
Last active September 8, 2019 16:19
Example Webpack Config for Static Sites
{
"name": "static-site",
"version": "2.1.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "run-s webpack-prod hugo-prod",
"dev": "run-p webpack-dev hugo-dev",
"hugo-dev": "wait-on assets/dist && hugo server",
"hugo-prod": "hugo",
@araphiel
araphiel / webpack.config.js
Last active May 27, 2020 15:45
Basic Webpack Setup (SASS + Babel)
const path = require('path')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
const fg = require('fast-glob')
module.exports = async (env, argv) => {
const entries = await fg([
'src/js/*.js',
@araphiel
araphiel / zoomInfo.js
Last active July 30, 2021 17:19
ZoomInfo + Marketo Form - Hides form fields with ZoomInfo returned data
// ZoomInfo + Marketo Form Listener
// Created to display or hide fields that are already validated by ZoomInfo
// This script does the following:
// 1. Adds initial state to the ZoomInfo + Marketo form (to hide init values)
// 2. Prevents non-validated users from completing the form.
// @variable form expects a Marketo "form" object (standard part of Marketo form js api)
function zoomListener(form) {
if (!form) throw new Error('Marketo Form Element not supplied.')
@araphiel
araphiel / pages.data.js
Last active July 14, 2023 16:37
Page Builder Collection Example using Eleventy
const { client } = require('../helpers/contentful-client')
const groupBy = require('lodash/fp/groupBy')
async function getPageData() {
// Get all of the locales
const localeData = await client.getLocales()
const localeList = await localeData.items.map(locale => locale.code)
// Fetch collection of all page-builder pages for each locale
@araphiel
araphiel / getFormFields.js
Last active October 30, 2020 14:40
Grab fields from a form
Object.values(document.forms[0]).reduce((obj,field) => { obj[field.name] = field.value; return obj }, {})
@araphiel
araphiel / custom_brandbot_form.html
Last active March 15, 2021 04:13
Example Brand Bot Setup
<!-- Begin BrandBot Signup Form -->
<!-- <link href="https://assets.brandbot.com/forms/embed/embed.css" rel="stylesheet" type="text/css" /> -->
<div id="bb_form">
<form
method="post"
action="https://microservices.brndbot.net/forms/answers"
name="{formId}"
id="bb_form_inner"
>
<div id="alert"></div>
@araphiel
araphiel / contentful-mjml.js
Last active March 15, 2021 04:12
Basic Contentful + MJML email example
require('dotenv').config()
const { resolve } = require('path')
const { outputFile, pathExists, removeSync } = require('fs-extra')
const contentful = require('contentful')
const { CONTENTFUL_SPACE, CONTENTFUL_ACCESS_TOKEN } = process.env
const { documentToHtmlString } = require('@contentful/rich-text-html-renderer')
const { BLOCKS, INLINES } = require('@contentful/rich-text-types')