Skip to content

Instantly share code, notes, and snippets.

View maxbeatty's full-sized avatar

Max Beatty maxbeatty

View GitHub Profile
@maxbeatty
maxbeatty / node-encrypt-decrypt.js
Created November 5, 2014 03:22
Encrypt and decrypt a string with Node.js
crypto = require('crypto');
exampleClientId = 'my_client_id'
mySharedKey = 'shared_key'
cipher = crypto.createCipher('aes256', mySharedKey)
cipherText = cipher.update(exampleClientId, 'utf8', 'base64')
cipherText += cipher.final('base64')
decipher = crypto.createDecipher('aes256', mySharedKey)
@maxbeatty
maxbeatty / gist:96350e9adc423c6c752a
Created December 26, 2014 19:05
Recruiter tries to program
Subject: If employment = false....
var money = a lot;
var opportunity = amazing;
var technology = cutting edge;
var people = cool;
var awesomejob = money + opportunity + technology + people;
if (awesomejob = false && employment = available) alert('We have a great opportunity for you here at [redacted]!')
@maxbeatty
maxbeatty / bdc.js
Last active August 29, 2015 14:12 — forked from bendc/functional-inheritance.js
Constructor comparisons in performance and memory usage
function car() {
return {
start: function() {
return "Engine on."
},
accelerate: function() {
return "Let's go!"
}
}
}
@maxbeatty
maxbeatty / class.coffee
Created March 9, 2015 23:56
CoffeeScript Class Constructor Names
class Animal
constructor: ->
@noise = "BOOM"
speak: -> console.log @noise
class Dog extends Animal
constructor: ->
@noise = "BARK"
assert = require('assert');
require('dotenv').config({path: 'production.env'});
assert.equal(process.env.DB_USER, 'root')
assert.equal(process.env.PORT, 80)
{
"extends": "future/react"
}

Keybase proof

I hereby claim:

  • I am maxbeatty on github.
  • I am maxbeatty (https://keybase.io/maxbeatty) on keybase.
  • I have a public key ASAj0U1E22K3wIaNOVtmMEMpV-5pX4F7hcPUOjCl58mg7Qo

To claim this, I am signing this object:

@maxbeatty
maxbeatty / example.md
Created February 1, 2017 18:55
example diff block in markdown

use diff to get fun red and green lines

- old
+ new
@maxbeatty
maxbeatty / b.js
Created March 5, 2017 18:47
AWS Lambda module caching anti-pattern
var first = true;
module.exports = function () {
console.log(`first: ${first}`);
if (first) {
first = false;
}
};
@maxbeatty
maxbeatty / index.js
Created July 18, 2017 21:01
zeit/micro w/ sequelize
const Sequelize = require("sequelize");
const sequelize = new Sequelize(
process.env.DB_NAME,
process.env.DB_USER,
process.env.DB_PASS,
{
host: process.env.DB_HOST,
dialect: "mysql"
}