Skip to content

Instantly share code, notes, and snippets.

function cleanHeatmap() {
map.removeLayer(heatmap);
}
function showHeatmap(heatdata, maxValue) {
if (heatmap === null) {
heatmap = L.heatLayer(heatdata,
{radius: 35, max: maxValue / ratio,
blur: 25,
gradient: {0.0: 'blue', 0.5: 'lime', 1: 'red'}
<?php
namespace Drupal\Tests\permissions_by_term\Kernel;
use Drupal\KernelTests\KernelTestBase;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\taxonomy\Entity\Vocabulary;
/**
* Tests the ERR composite relationship upgrade path.
@jepster
jepster / phing-target.xml
Last active July 28, 2016 18:48
Phing Target for Website Sync
<target name="syncWebsiteToLive"
description="Sync folder and files via Rsync to live server.">
<echo msg="Syncing data to live server." />
<exec command="rsync -a --progress --delete /home/peter/Websites/example.com/ --exclude=.git/ --exclude=.idea/ --exclude=sites/default/settings.php user@example.com:/var/www/example.com/"
passthru="true"
checkreturn="true" />
<echo msg="Delete old database" />
<exec command="ssh example.com 'mysql -uroot -pPASSWORD -e &quot;drop database example_com;&quot;'"
passthru="true"
checkreturn="true" />
<phpunit bootstrap="tests/bootstrap.php" colors="true"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutChangesToGlobalState="true"
checkForUnintentionallyCoveredCode="false"
printerClass="\Drupal\Tests\Listeners\HtmlOutputPrinter">
<php>
<!-- Set error reporting to E_ALL. -->
<ini name="error_reporting" value="32767"/>
<!-- Do not limit the amount of memory tests take to run. -->
# Redirect all requests to SSL and ensure www. subdomain is re-directed, too.
<VirtualHost *:80>
ServerName your-domain.com
Redirect / https://your-domain.com/
</VirtualHost>
<VirtualHost *:80>
ServerName www.your-domain.com
Redirect / https://your-domain.com/
</VirtualHost>
<?php
$dom = new \DOMDocument('1.0', 'UTF-8');
// PHP will output warnings about non-standard HTML. Suppress it by "@".
@$dom->loadHTML($source);
// Iterate over all link-elements.
foreach ($dom->getElementsByTagName('link') as $node) {
// Copy the element to be able to replace it.
$updated_element = $node;
$href_value = $updated_element->getAttribute( 'href' );
gaya.info.yml:
name: Gaia
type: theme
description: 'A starter theme which is based on the Drupal core template files.'
package: Core
version: 8.x-1.0
core: 8.x
libraries:
- gaia/global-styling
@jepster
jepster / IN-YOUR-CONTROLLER-yii-row-check.php
Created August 1, 2015 12:52
For usage in your controller.
<?php
$provider_ids = Provider::find()
->select(['id'])
->where(['parent_id' => $parent_provider_id]);
$num_providers = $provider_ids->count();
if($num_providers > 0){
$arr_provider = $provider_ids