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
<input | |
type="file" onChange={(e) => { | |
const file = e.target.files[0]; | |
const metadata = { | |
contentType: 'image/jpeg', | |
}; | |
const imageRef = storageRef.child(`images/${file.name}`); | |
const uploadTask = imageRef.put(file, metadata); |
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
/* globals localStorage */ | |
import { onSnapshot, applySnapshot } from 'mobx-state-tree'; | |
import Storage from './storage'; | |
export const persist = (name, store, options, schema = {}) => { | |
let hydrated = false; | |
let storage = options.storage; | |
if (typeof localStorage !== 'undefined' && localStorage === storage) { |
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
import Route from 'route-parser'; | |
import {extendObservable, computed} from 'mobx'; | |
class Router { | |
constructor(routes, notFound) { | |
extendObservable(this, { | |
routes: [], | |
currentPath: window.location.pathname, | |
notFound: null, | |
current: computed(() => this.computeCurrent()), |
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
const { send, text } = require('micro') | |
const post = require('micro-post') | |
const redirect = require('micro-redirect') | |
const qs = require('qs'); | |
const mailgun = require('mailgun.js'); | |
const fetch = require('node-fetch'); | |
const cheerio = require('cheerio'); | |
const domain = process.env.MAILGUN_DOMAIN; | |
const sender = process.env.MAILGUN_SENDER; |
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
import React from 'react'; | |
import Site from './models/Site'; | |
export const Context = React.createContext(); | |
export function useSite() { | |
return React.useContext(Context); | |
} | |
export function SiteWrapper(props) { |
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
import { Route } from 'vue-router' | |
import store from '@vue-storefront/core/store' | |
import { isServer } from '@vue-storefront/core/helpers' | |
import { storeCodeFromRoute, localizedRoute } from '@vue-storefront/core/lib/multistore' | |
import Vue from 'vue' | |
export function beforeEach(to: Route, from: Route, next) { | |
if (isServer) { | |
const { storeViews } = store.state.config | |
const storeCode = storeCodeFromRoute(to) |
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
# Orders, Invoices, Shipments | |
DELETE FROM sales_order; | |
DELETE FROM sales_creditmemo_comment; | |
DELETE FROM sales_creditmemo_item; | |
DELETE FROM sales_creditmemo; | |
DELETE FROM sales_creditmemo_grid; | |
DELETE FROM sales_invoice_comment; | |
DELETE FROM sales_invoice_item; | |
DELETE FROM sales_invoice; | |
DELETE FROM sales_invoice_grid; |
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 mhart/alpine-node:12 | |
EXPOSE 3000 | |
ENV VS_ENV prod | |
WORKDIR /var/www | |
RUN apk add --no-cache make gcc g++ python links bash | |
COPY . . | |
RUN yarn install --no-cache |
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
import * as pulumi from '@pulumi/pulumi'; | |
import * as awsx from '@pulumi/awsx'; | |
import * as k8s from '@pulumi/kubernetes'; | |
import * as docker from '@pulumi/docker'; | |
// Get kubeconfig from main repository | |
const env = pulumi.getStack(); | |
const cluster = new pulumi.StackReference(`user/infrastructure/${env}`); | |
const kubeconfig = cluster.getOutput('kubeconfig'); | |
const baseDomain = cluster.getOutput('baseDomain'); |
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
function Post({id}) { | |
const [post, setPost] = useState(null) | |
const [hasLiked, setHasLiked] = useState(false) | |
useEffect(() => { | |
const unsubscribe = db.collection('posts').doc(id).onSnapshot((doc) => { | |
const data = doc.data(); | |
setPost(data); | |
setHasLiked(data.likedBy[myUserID] === true) | |
}); | |
return () => unsubscribe() |