Skip to content

Instantly share code, notes, and snippets.

@djmarland
djmarland / AppContainer.jsx
Created May 21, 2020 18:03
How to do HOCs in NextJS?
export const AppContainer = (Page: any) => {
return class extends Component {
public static async getInitialProps(context) {
let initialProps = {
appData: getAppData,
pageData: {},
}
if (Page.getInitialProps) {
initialProps.pageData = await Page.getInitialProps(context);
}
var p1 = new Promise((resolve, reject) => {
setTimeout(resolve, 1000, 'p1_delayed_resolvement');
});
var p2 = new Promise((resolve, reject) => {
reject(new Error('p2_immediate_rejection'));
});
Promise.all([
p1.catch(error => { return error }),
@djmarland
djmarland / update.sh
Created June 25, 2017 17:22
Handy script to run when logging into Bash on Windows and seeing "packages can be updated"
sudo apt-get dist-upgrade -y
sudo apt-get update -y
sudo apt-get upgrade -y
sudo apt autoremove -y
"ResponseParameters": {
"method.response.header.Content-Type": "integration.response.header.Content-Type",
"method": {
"response": {
"header": {
"Content-Type": "integration.response.header.Content-Type"
}
}
}
}
@djmarland
djmarland / index.html
Created February 12, 2017 16:28
First version of static homepage for tubealert.co.uk
<!DOCTYPE html>
<html>
<head>
<title>TubeAlert</title>
<style>
body { margin: 0; font-family: sans-serif; }
.lines { list-style: none; margin: 0; padding: 0; }
.line { display: block; padding: 16px; background: black; color: white; }
.line__name { font-size: 1.2rem; }
.line--bakerloo-line { background: #AE6118; }
<?php
namespace ConsoleBundle\Command;
use DateTime;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use TubeService\Domain\Entity\Line;
mc-s095629:amen marlad01$ history | grep brew
341 brew install php5-intl
344 brew install php53-intl
345 brew update
346 brew search icu
347 brew install icu4c
348 brew install icu4c
359 brew update
362 brew remove php54
363 brew install php54