Skip to content

Instantly share code, notes, and snippets.

import pandas as pd
import pytz
from datetime import datetime
from pytz.exceptions import AmbiguousTimeError
from tqdm import tqdm
# Read the CSV file - Replace fluviusdata with filename
df = pd.read_csv('fluviusdata.csv', delimiter=';')
# Replace commas with periods in the 'Volume' column
@balsama
balsama / ama-manual-cloud-deploy.md
Last active June 11, 2020 03:59
Instructions to manually deploy Migrate Assistant to an Acquia Cloud environment

Manually deploy a newly created migrate project to Acquia Cloud

Prerequisites

  1. Admin access to an Acquia Cloud hosting environment.
  2. A Drupal 7 site running locally
  3. SSH keys on Cloud for your local machine

Instructions

  1. Generate a new migrate project. Use the migrate-quickstart command to generate a new Drupal 9 project per the instructions in the Quick Start section of AMA’s README. You should also run the commands that are echoed at the end of following those instructions.
@tclavier
tclavier / find-oldest-line
Created July 24, 2017 07:27
Find oldest line in git repo
#!/bin/bash
for file in $(find . -type f);
do
git blame --date=format:%Y%m%d $file
done | sed -e 's/.*\s\([0-9]\{8\}\)\s.*/\1/' | sort -r | tail
if (!"ggplot2" %in% rownames(installed.packages())) {
install.packages("ggplot2")
}
library("ggplot2")
args <- commandArgs(trailingOnly = TRUE)
before_file <- args[1]
after_file <- args[2]
<?php
class BigPipeResponse extends StreamedResponse {
public function __construct(Response $response) {
$this->mainResponse = $response;
$this->setStatusCode($response->statusCode());
$this->headers->set($response->headers->all());
$this->mainBody = $response->getContent();
}
<?php
/**
* Minifies and removes unneeded cache tags.
*
* @param array $cache_tags
* List of cache tags.
*
* @return array
* Shortened and cleaned up cache tag list.
@LionsAd
LionsAd / smartcache-plus-poc.diff
Created February 18, 2015 13:20
SmartCache++
diff --git a/core/lib/Drupal/Core/Render/Renderer.php b/core/lib/Drupal/Core/Render/Renderer.php
index 69e99a0..8bdf86a 100644
--- a/core/lib/Drupal/Core/Render/Renderer.php
+++ b/core/lib/Drupal/Core/Render/Renderer.php
@@ -184,6 +184,11 @@ protected function doRender(&$elements, $is_root_call = FALSE) {
$this->bubbleStack();
return $elements['#markup'];
}
+
+ // Store the cache ID for later comparison.
@timplunkett
timplunkett / setupd8
Last active January 7, 2019 21:02
Reinstall D8
#!/bin/bash
PROFILE="standard"
DB="d8"
UI=false
NO_DEV=false
OPTS=`getopt -o h --longoptions db:,profile:,ui,no-dev -- "$@"`
eval set -- "$OPTS"
while true; do
@Berdir
Berdir / TagDeletionListener.php
Last active July 21, 2021 23:11
Varnish cache tag purger
<?php
/**
* @file
* Contains \Drupal\varnish_cache_tag_purger\TagDeletionListener.
*/
namespace Drupal\varnish_cache_tag_purger;
use Drupal\Core\Cache\NullBackend;
@markhalliwell
markhalliwell / stark2.theme.php
Created July 8, 2014 15:45
Adding external/inline resources via #attached in a Drupal 8 theme
<?php
/**
* @file
* Example of how to attach external and inline resources for a theme via the
* #attached render array method in 8.x.
*/
/**
* Helper function for attaching resources to a render array.
*/