Skip to content

Instantly share code, notes, and snippets.

View sethkrasnianski's full-sized avatar
:shipit:
Building software.

Seth Krasnianski sethkrasnianski

:shipit:
Building software.
View GitHub Profile
@sethkrasnianski
sethkrasnianski / next12.md
Last active March 8, 2022 18:59
Angi next-app Next12 upgrade instructions

Overview

1. Package.json changes

  • Upgrade Next.js to ^12.1.0
  • Upgrade next-transpile-modules to ^9.0.0
  • Install the NewRelic Next.js agent "@newrelic/next": "0.1.0",
  • Change the dev command to next dev
  • Change the start command to NODE_OPTIONS='-r @newrelic/next' next start
  • Change the build command to next build only (dropping && tsc --project tsconfig.server.json) and delete tsconfig.server.json file
  • Remove nodemon dependency and delete nodemon.json file
@sethkrasnianski
sethkrasnianski / examplify.md
Last active May 23, 2019 20:59
Examplify - The Amplify Example

AWS Amplify

Example repo

Working with amplify has allowed me to develop some opinions about it. As with any opinions, these are absolutely correct :)

Introduction

Amplify is an opinionated, category-based client framework for building scalable mobile and web apps. Think of it like a devops-as-code tool to manage all aspects of a traditional application's infrastructure. Under the hood Amplify generates CloudFormation templates which are used to then provision your applications resources. These templates are generated as a result of guided configuration wizards that the Amplify CLI provides for you.

Pros & Cons

@sethkrasnianski
sethkrasnianski / batched-transactions.js
Created March 14, 2019 20:04
Batched DynamoDB Transactions - WIP
const seedTransaction = async (tableMap, data) => {
// Each key in data contains its type in parenthesis
// We must remove them before we can properly map over them
const formattedData = data.map(d => {
const keys = Object.keys(d).map(k => k.substring(0, k.indexOf(' ')));
const values = Object.values(d);
return keys.reduce((acc, k, i) => {
acc[k] = values[i];
return acc;
}, {});

Better Component Testing

*In a Redux/React App

Things we know

  • Redux manages state
  • React manages presentation logic
  • Mixing the two together is not cool for testing
  • We can reduce cognitive overhead by decoupling redux logic and react components
/**
* jQuery 2.1.3's parseHTML (without scripts options).
* Unlike jQuery, this returns a DocumentFragment, which is more convenient to insert into DOM.
* MIT license.
*
* If you only support Edge 13+ then try this:
function parseHTML(html, context) {
var t = (context || document).createElement('template');
t.innerHTML = html;
return t.content.cloneNode(true);
@sethkrasnianski
sethkrasnianski / update.sh
Created February 27, 2018 18:54 — forked from odlp/update.sh
Rbenv update Rubygems
#!/usr/bin/env sh
# Multiple vulnerabilities have been disclosed in RubyGems:
# https://www.ruby-lang.org/en/news/2018/02/17/multiple-vulnerabilities-in-rubygems/
#
# If you're an Rbenv user, here's any easy one-liner to upgrade to a
# safe version of Rubygems (2.7.6 or later) for each installed Ruby version:
for i in $( rbenv versions --bare ); do RBENV_VERSION=$i gem update --system && echo "\n$(ruby -v) using rubygems $(gem --version)\n"; done
@sethkrasnianski
sethkrasnianski / README.md
Created September 21, 2017 03:26 — forked from acrookston/README.md
Xcode pre-action to build custom Info.plist

Automatic build versions from git in Xcode (and other goodies)

Installation procedure for pre-build actions to automatically populate Xcode Info.plist with dynamic data.

1. Xcode Scheme pre-action

Edit Xcode Scheme and add a pre-action script. Copy the contents of preaction.sh into the pre-action script box.

@sethkrasnianski
sethkrasnianski / Heroku DB Migration.mdown
Created August 7, 2017 21:02 — forked from rtwomey/Heroku DB Migration.mdown
How to migrate a DB on heroku to another plan

Recently, I had a staging database on Heroku that was running on the Ronin database (which was originally the lowest-sized DB you could get at Heroku). Since they added two new options, Crane and Kappa, we wanted to take advantage of the cost savings. Here's how you can migrate your Ronin DB to Crane (or any other plan).

The old database was named BROWN while the new one is CRIMSON. You can determine this by running:

heroku pg:info --app myapp-staging
  1. Add Crane database

     heroku addons:add heroku-postgresql:crane --app myapp-staging
    

heroku pg:wait --app myapp-staging

@sethkrasnianski
sethkrasnianski / svg-convert.sh
Created July 12, 2017 07:22 — forked from lopis/svg-convert.sh
SVG to PNG convert and resize
#!/bin/bash
# I made this script to convert SVG icons for an iOS app into PNG.
# The script will create icons in 3 sizes for different screen DPIs.
find . -type f -name "*.svg" | while read f
do
FILENAME="${f%.*}"
echo '---'
inkscape -W "$FILENAME.svg"
@sethkrasnianski
sethkrasnianski / blockbuster.md
Last active April 6, 2017 04:27
Blockbuster Locations