This file contains hidden or 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
#!/usr/bin/env python | |
# | |
# import modules used here -- sys is a very standard one | |
import sys, argparse, logging | |
# Gather our code in a main() function | |
def main(args, loglevel): | |
logging.basicConfig(format="%(levelname)s: %(message)s", level=loglevel) | |
This file contains hidden or 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
<?php | |
try { | |
$response = \Drupal::httpClient()->get($_SERVER['HTTP_HOST'] . '/jsonapi/node/xxx'); | |
$data = (string) $response->getBody(); | |
if (empty($data)) { | |
return FALSE; | |
} | |
} | |
catch (RequestException $e) { |
This file contains hidden or 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
<?php | |
namespace Drupal\content_helper\Controller; | |
use Drupal\Core\Controller\ControllerBase; | |
use Symfony\Component\DependencyInjection\ContainerInterface; | |
use Symfony\Component\HttpKernel\HttpKernelInterface; | |
use Symfony\Component\HttpFoundation\Request; | |
/** |
This file contains hidden or 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/bash | |
# Should be in Format: Wed, 21 Oct 2015 07:28:00 GMT | |
expire_date=$(date +"%a, %d %b %Y 16:00:00 GMT" -d '+ 1 month') | |
# Sync Assets, max-age = 1 month, expires header set now + 1 month | |
aws s3 sync ./.. s3://<bucket> --exclude '*' --include 'favicon.ico' --include 'dist/*' --include 'index.html' --cache-control 'public, max-age=2592000' --expires "$expire_date" --delete | |
# Cloudfront Cache Invalidation | |
aws cloudfront create-invalidation --distribution-id <ID> --paths '/*' |