Install homebrew/services, this will be helpful, you'll see later. :D
$ brew tap homebrew/services
const getRawBody = require("raw-body"); | |
const { updateUserByCustomerId } = require("./_db.js"); | |
const stripe = require("stripe")(process.env.STRIPE_SECRET_KEY, { | |
apiVersion: process.env.STRIPE_API_VERSION, | |
}); | |
// Disable next.js body parsing (stripe needs the raw body to validate the event) | |
export const config = { | |
api: { |
/* | |
* Extract multiple screenshots/frames from a video URL | |
* Params | |
* - vidURL : video URL | |
* - frOffsets : array of timestamps | |
* - frameWidth : screenshot width (default: video width) | |
* Returns | |
* - frames: object with offset => {imgUrl, blob} | |
* | |
* An multiple-frame extension of http://cwestblog.com/2017/05/03/javascript-snippet-get-video-frame-as-an-image/ |
// There's two ways to use Tachyons together with styled-components | |
// Both are valid, which one you use depends if you want to always apply a tachyons class when a certain component | |
// is rendered or if you want to apply it for specific instances. | |
// 1. Use .attrs to define classNames that should always be applied to a styled component | |
// Whenever you use <Component /> now it'll have both the styled-components as well as the Tachyons class | |
// See the docs for more info: https://www.styled-components.com/docs/basics#attaching-additional-props | |
const Component = styled.div.attrs({ | |
className: 'bw0-l', | |
})` |
100+ different js counter apps... |
'use strict'; | |
var express = require("express"); | |
var multer = require('multer'); | |
var app = express(); | |
var options = require('./config/config') | |
var mongoose = require('mongoose'); | |
/* photo manenos */ | |
var cloudinary = require('cloudinary'); |
We dropped Lerna from our monorepo architecture in PouchDB 6.0.0. I got a question about this from @reconbot, so I thought I'd explain our reasoning.
First off, I don't want this post to be read as "Lerna sucks, don't use Lerna." We started out using Lerna, but eventually outgrew it because we wrote our own custom thing. Lerna is still a great idea if you're getting started with monorepos (monorepi?).
Backstory:
# This is inspired by the fantastic guide https://github.com/saiprashanths/dl-setup | |
# I have just updated the python-related commands so that everything works in Python 3. | |
# Tested on Xubuntu 16.04. | |
# First of all let's update the repos: | |
sudo apt-get update | |
# Only if you have a CUDA-compatible Nvidia card, install CUDA. | |
# Check on the Nvidia website what is the latest driver version which supports your card. | |
# At the time of this writing it was 367. |
sudo apt-get update | |
sudo apt-get install -y libevent-dev libncurses-dev make | |
wget https://github.com/tmux/tmux/releases/download/2.2/tmux-2.2.tar.gz | |
tar xvzf tmux-2.2.tar.gz | |
cd tmux-2.2/ | |
./configure && make | |
sudo make install |
Whenever we change our templates we still have to use our build script and this can get annoying. Thankfully with webpack-dev-server
and BrowserSync we can fix this:
npm i -D browser-sync browser-sync-webpack-plugin webpack-dev-server
BrowserSync will act like a proxy, waiting for webpack to do its thing and then reloading the browser for us.