Skip to content

Instantly share code, notes, and snippets.

module.exports = function (req, res, next) {
// you won't believe what happens
next();
};
@ryanburnette
ryanburnette / gist:b5b3ef5efefff99438bf9e3a3538a0c5
Last active March 25, 2019 15:12
javascript arrow functions
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions
https://medium.com/tfogo/advantages-and-pitfalls-of-arrow-functions-a16f0835799e
My personal rule... only use arrow functions when you need the benefit of what they do. A
lot of folks default to them and I think this is a bad practice.
@ryanburnette
ryanburnette / index.js
Last active March 23, 2019 18:14
thoughts about integrating akismet api w/ my express-based form endpoints
var akismet = require('akismet-api');
var client = akismet.client({
key: process.env.AKISMET_API_KEY,
blog: process.env.AKISMET_BLOG_URL
});
module.exports = client;
// verify akismet api key
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
<link rel="preload" href="/css/app.bundle.css" as="style">
<link rel="preload" href="/js/app.bundle.js" as="script">
<link rel="stylesheet" href="/css/app.bundle.css">
<!--[if IE]>
We couldn’t find that file to show.
@ryanburnette
ryanburnette / git-qcommit
Created January 22, 2019 16:43
Use the output of `git status --porcelain` as a commit message. Automatic git commit message.
#!/usr/bin/env node
var childProcess = require('child_process');
var spawn = childProcess.spawn;
function getStatusMessage() {
var bash = spawn('bash');
bash.stdin.end('git status --porcelain');
return new Promise(function (resolve) {
bash.stdout.on('data',function (data) {
@ryanburnette
ryanburnette / uber.js
Created January 16, 2019 21:15
Moving Uber transactions from the site to console.log then to spreadsheet
document.querySelectorAll('.b1').forEach(function (el) {
if (!el.querySelectorAll('.an > div:nth-child(1)').length) {
return false
}
var date = el.querySelectorAll('.an > div:nth-child(1)')[0].innerText
date = date.split(',')[0]
date = date.replace(/ /g,'-')
var amnt = el.querySelectorAll('.bb.cb')[0].innerText
#/usr/bin/env bash
export AWS_CONFIG_FILE="/home/user/.aws/config"
export AWS_ACCESS_KEY_ID=XXXXXXXXXXXXXXXXXHRQ
export AWS_SECRET_ACCESS_KEY=XXXXXXXfHyR
/path/to/aws s3 sync /path/to/uploads/ s3://mybucket/uploads/
@ryanburnette
ryanburnette / node.service
Last active July 9, 2019 03:27
Notes on running NodeJs as a systemd service
[Unit]
Description=service
After=network.target
[Service]
Type=simple
User=ubuntu
WorkingDirectory=/opt/service
ExecStart=/bin/bash -c 'exec bin/node app.js 2>&1 >> logs/console.log'
Restart=always
@ryanburnette
ryanburnette / wp-set-password.sql
Last active October 13, 2018 19:59
Reset WordPress password with a MySQL query.
UPDATE `wp_users` SET `user_pass`= MD5('password') WHERE `user_login`='ryan';