Feel free to contact me at [email protected] or tweet at me @statisticsftw
This is a rough outline of how we utilize next.js and S3/Cloudfront. Hope it helps!
It assumes some knowledge of AWS.
Feel free to contact me at [email protected] or tweet at me @statisticsftw
This is a rough outline of how we utilize next.js and S3/Cloudfront. Hope it helps!
It assumes some knowledge of AWS.
// tools | |
import React from "react" | |
import styled from "styled-components" | |
// styles | |
const Dots = styled.span` | |
&::after { | |
display: inline-block; | |
animation: ellipsis 1.25s infinite; | |
content: "."; |
const puppeteer = require('puppeteer'); | |
const cheerio = require('cheerio'); | |
async function run() { | |
const browser = await puppeteer.launch(); | |
const page = await browser.newPage(); | |
await page.goto('https://news.ycombinator.com'); | |
let content = await page.content(); | |
var $ = cheerio.load(content); |
/* | |
* Handling Errors using async/await | |
* Has to be used inside an async function | |
*/ | |
try { | |
const response = await axios.get('https://your.site/api/v1/bla/ble/bli'); | |
// Success 🎉 | |
console.log(response); | |
} catch (error) { | |
// Error 😨 |
<?php | |
/** | |
* Hide the "In stock" message on product page. | |
* | |
* @param string $html | |
* @param string $text | |
* @param WC_Product $product | |
* @return string | |
*/ | |
function my_wc_hide_in_stock_message( $html, $text, $product ) { |
function getOrderDetails(orderID,cb) { | |
db.find( "orders", orderID, function(err,order){ | |
if (!err) { | |
db.find( | |
"customers", | |
order.customerID, | |
function(err,customer){ | |
if (!err) { | |
order.customer = customer; | |
cb( null, order ); |
<Ratio width={Ratio.OPTIONS.FLUID} x={3} y={4}> | |
{(width, height) => ( | |
<Chart id={this.props.id} width={width} height={height} /> | |
)} | |
</Ratio> |
# Backup | |
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
# Restore | |
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |
#!/bin/bash | |
set -e | |
show_help() { | |
cat << EOF | |
Usage: ${0##*/} [-u USER] [-p PASS] [-P PORT] [-H HOST] [DATABASE] | |
${0##*/} -h | |
Open a standard connection in Sequel PRO. |
/** | |
* This code is licensed under the terms of the MIT license | |
* | |
* Deep diff between two object, using lodash | |
* @param {Object} object Object compared | |
* @param {Object} base Object to compare with | |
* @return {Object} Return a new object who represent the diff | |
*/ | |
function difference(object, base) { | |
function changes(object, base) { |