Skip to content

Instantly share code, notes, and snippets.

Ryan Burnette ryanburnette

  • USA
Block or report user

Report or block ryanburnette

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View php-file-get-contents-basic-auth.php
<?php
//https://stackoverflow.com/a/30630753/2535178
$url = 'https://example.com/api/endpoint';
$auth = base64_encode("username:password");
$options = array(
'http' => array(
'method' => 'POST',
View meddleware.js
module.exports = function (req, res, next) {
// you won't believe what happens
next();
};
View gist:b5b3ef5efefff99438bf9e3a3538a0c5
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 Mar 23, 2019
thoughts about integrating akismet api w/ my express-based form endpoints
View index.js
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
View boilerplate.html
<!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 Jan 22, 2019
Use the output of `git status --porcelain` as a commit message. Automatic git commit message.
View git-qcommit
#!/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 Jan 16, 2019
Moving Uber transactions from the site to console.log then to spreadsheet
View uber.js
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
View backup
#/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 Jul 9, 2019
Notes on running NodeJs as a systemd service
View node.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
You can’t perform that action at this time.