Skip to content

Instantly share code, notes, and snippets.

Peter Majmesku jepster

View GitHub Profile
View content.js
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'}
View SelectTermTest.php
<?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 Jul 28, 2016
Phing Target for Website Sync
View phing-target.xml
<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" />
View phpunit.xml
<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. -->
View your-domain.conf
# 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>
View gist:91114ab81b6dbbab024debdcf963afb0
<?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' );
View yml
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
View IN-YOUR-CONTROLLER-yii-row-check.php
<?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
You can’t perform that action at this time.