This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"512": "TX", | |
"513": "OH", | |
"515": "IA", | |
"516": "NY", | |
"517": "MI", | |
"518": "NY", | |
"520": "AZ", | |
"530": "CA", | |
"531": "NE", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"AL": [205, 251, 256, 334, 938], | |
"AK": 907, | |
"AZ": [480, 520, 602, 623, 928], | |
"AR": [479, 501, 870], | |
"CA": [209, 213, 310, 323, 408, 415, 424, 442, 510, 530, 559, 562, 619, 626, 628, 650, 657, 661, 669, 707, 714, 747, 760, 805, 818, 831, 858, 909, 916, 925, 949, 951], | |
"CO": [303, 719, 720, 970], | |
"CT": [203, 475, 860, 959], | |
"DE": 302, | |
"FL": [239, 305, 321, 352, 386, 407, 561, 727, 754, 772, 786, 813, 850, 863, 904, 941, 954], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node | |
WORKDIR /app | |
ENV PATH /app/node_modules/.bin:$PATH | |
COPY package.json /app/package.json | |
RUN npm i | |
RUN npm i -g @angular/cli --unsafe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// require('koa') or require('express') whatever fits your fancy | |
const { Connection } = require('./db'); | |
Connection.connectToMongo().then(() => { | |
// initialize your app and register routes | |
router.get('whatever', async(ctx) => { | |
const result = await Connection.db.collectionName.find({ id: ctx.params.id }); | |
ctx.res.body = result; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"headers": "Received: by mx0047p1mdw1.sendgrid.net with SMTP id 6WCVv7KAWn Wed, 27 Jul 2016 20:53:06 +0000 (UTC) | |
Received: from mail-io0-f169.google.com (mail-io0-f169.google.com [209.85.223.169]) by mx0047p1mdw1.sendgrid.net (Postfix) with ESMTPS id AA9FFA817F2 for <example@example.comom>; Wed, 27 Jul 2016 20:53:06 +0000 (UTC) | |
Received: by mail-io0-f169.google.com with SMTP id b62so81593819iod.3 for <example@example.comom>; Wed, 27 Jul 2016 13:53:06 -0700 (PDT) | |
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sendgrid.com; s=ga1; h=mime-version:from:date:message-id:subject:to; bh=DpB1CYYeumytcPF3q0Upvx3Sq/oF4ZblEwnuVzFwqGI=; b=GH5YTxjt6r4HoTa+94w6ZGQszFQSgegF+Jlv69YV76OLycJI4Gxdwfh6Wlqfez5yID 5dsWuqaVJZQyMq/Dy/c2gHSqVo60BKG56YrynYeSrMPy8abE/6/muPilYxDoPoEyIr/c UXH5rhOKjmJ7nICKu1o99Tfl0cXyCskE7ERW0= | |
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:sub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ruby:2.6-slim | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
build-essential \ | |
curl \ | |
gnupg \ | |
git \ | |
# substitute 12.x with whichever Node version you require: | |
&& curl -sL https://deb.nodesource.com/setup_12.x | bash - \ | |
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ChangeCollationDbWide < ActiveRecord::Migration[5.2] | |
def change | |
db = ActiveRecord::Base.connection | |
tables = ActiveRecord::Base.connection.tables.map { |t| t.to_sym } | |
tables.each do |t| | |
Lhm.change_table(t) do |table| | |
table.ddl "ALTER TABLE `#{table.name}` DEFAULT CHARACTER SET utf8mb4, DEFAULT COLLATE utf8mb4_unicode_ci" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Make sure to: | |
# 1) Name this file `backup.sh` and place it in /home/ubuntu | |
# 2) Run sudo apt-get install awscli to install the AWSCLI | |
# 3) Run aws configure (enter s3-authorized IAM user and specify region) | |
# 4) Fill in DB host + name | |
# 5) Create S3 bucket for the backups and fill it in below (set a lifecycle rule to expire files older than X days in the bucket) | |
# 6) Run chmod +x backup.sh | |
# 7) Test it out via ./backup.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create the searchable checks index | |
db.collection("checks") | |
.createIndex({ shopName: 1, firstName: "text", lastName: "text" }) | |
.then((res) => { | |
console.log("checks text index created"); | |
}) | |
.catch((err) => console.log("checks text index creation failed", err)); | |
const checks = await db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let formData = new FormData(); | |
formData.append("upload_preset", "<your preset from Cloudinary Dashboard here> * Required"); | |
formData.append("file", <instance of a File here>); | |
axios | |
.post( | |
"https://api.cloudinary.com/v1_1/<your Cloudinary cloud name here>/image/upload", | |
formData, | |
{ |