Skip to content

Instantly share code, notes, and snippets.

View alexandermckay's full-sized avatar

Alex McKay alexandermckay

View GitHub Profile
const {autoUpdater} = require('electron-updater')
let mainWindow
const checkingForUpdates = () => console.log('checking for updates')
const createWindow = () => {
setTimeout(checkingForUpdates, 3000)
// ...
}
{
"build": {
"win": {
"certificateFile": "config/slack.p12",
"certificatePassword": ""
}
}
}
{
"build": {
"win": {
"certificateFile": "config/slack.p12",
"certificatePassword": "",
"verifyUpdateCodeSignature": false,
"publisherName": "slack",
"artifactName": "${productName}.${ext}"
}
}
{
"build": {
"win": {
"certificateFile": "config/slack.p12",
"certificatePassword": "",
"verifyUpdateCodeSignature": false,
"artifactName": "${productName}.${ext}"
}
}
}
{
// ...other fields
"scripts": {
"build:all": "electron-builder -wml"
"build:win": "electron-builder -w"
"build:mac": "electron-builder -m"
"build:lnx: "electron-builder -l"
}
// ...other fields
}
{
// ...other fields
"name": "slack",
"publicName": "Slack"
"author": "Slack Inc."
"build": {
"appId": "com.slack.desktop",
"copyright": "Copyright 2020 Slack"
}
// ...other fields
@alexandermckay
alexandermckay / eifp-for-each.js
Last active February 7, 2020 00:41
EiFP - For Each
const a = [1, 2, 4]
forEach(console.log, a)
// [1, 2, 4]
@alexandermckay
alexandermckay / cors.js
Created October 19, 2019 10:05
cors.js
const cors = require('cors');
const corsHandler = cors({ origin: true });
/* Your other code */
const handleEmail = (req, res) => {
corsHandler(req, res, () => {
transporter.sendMail(mailOptions(req.query), transport);
});
@alexandermckay
alexandermckay / react-app.js
Created October 19, 2019 09:59
react-app.js
import Axios from 'axios';
import React, { useState } from 'react';
const sendEmailURL = '<YOUR_FUNCTION_URL>';
function App() {
const [state, setState] = useState({
message: '',
name: '',
subject: '',
@alexandermckay
alexandermckay / dynamic-content.js
Created October 19, 2019 09:46
dynamic-content.js
const mailOptions = ({ subject, name, message }) => {
const text = `
Name: ${name}
Message: ${message}
`;
const html = `
<h1>Name: ${name}</h1>
<p>Message: ${message}</p>
`;