Skip to content

Instantly share code, notes, and snippets.

@jerbob92
jerbob92 / main.go
Last active June 28, 2023 19:57
go-pdfium webserver example
package main
import (
"fmt"
"mime/multipart"
"net/http"
"time"
"github.com/klippa-app/go-pdfium"
"github.com/klippa-app/go-pdfium/multi_threaded"
blueprint:
name: ZHA - Ecodim, 4 Channel remote v2
description: Control any light using the Ecodim remote on ZHA
domain: automation
input:
remote:
name: Remote controller
description: Remote to use
selector:
device:
@jerbob92
jerbob92 / drupal-PSA-003-check.sh
Last active December 14, 2021 00:42
Check whether Drupal 7.59 and 8.5.3 are released
#!/bin/sh
url="https://ftp.drupal.org/files/projects/drupal-7.59.zip";
if curl --output /dev/null --silent --head --fail "$url"; then
echo "URL exists: $url";
else
echo "URL does not exist: $url";
fi;
url="https://ftp.drupal.org/files/projects/drupal-8.5.3.zip";
@jerbob92
jerbob92 / drupal-SA-002-check.sh
Created March 28, 2018 19:04
Check whether Drupal 7.58 and 8.5.1 are released
#!/bin/sh
url="https://ftp.drupal.org/files/projects/drupal-7.58.zip";
if curl --output /dev/null --silent --head --fail "$url"; then
echo "URL exists: $url";
else
echo "URL does not exist: $url";
fi;
url="https://ftp.drupal.org/files/projects/drupal-8.5.1.zip";
@jerbob92
jerbob92 / php_mdb.rst
Created August 15, 2017 11:41 — forked from amirkdv/php_mdb.rst
How to handle MS Access MDB files in Linux with PHP5 PDO and ODBC

To be able to use PHP5 PDO with MS Access mdb files the following is required (the same applies for the PHP4 style of using odbc_X except for the obviously PDO specific requirements):

PHP ODBC module

In Linux this is achieved by intalling the php5-odbc package:

@jerbob92
jerbob92 / lookup-page-example.php
Created March 23, 2017 14:12
Creating default pages in Drupal 8
<?php
use Drupal\node\Entity\Node;
$current_language = \Drupal::languageManager()->getCurrentLanguage();
$default_pages = \Drupal::state()->get('my_module.default_pages', array());
$node_id = (isset($default_pages['front_' . $current_language->getId()]) ? $default_pages['front_' . $current_language->getId()] : NULL);
if (!$node_id) {
return NULL;
}
@jerbob92
jerbob92 / validate.php
Created August 27, 2016 11:00
Validate Entity D8
<?php
$errors = array();
$validate = $entity->validate();
$violations = $validate->getIterator();
foreach ($violations as $violation) {
$constraint = get_class($violation->getConstraint());
$type = $constraint;
$msg = $violation->getMessageTemplate();
if ($constraint == 'Drupal\Core\Validation\Plugin\Validation\Constraint\NotNullConstraint') {
@jerbob92
jerbob92 / ImageRenderExampleBlockResponsive.php
Created October 28, 2015 13:22
Render responsive image into a block Drupal 8 Example
<?php
/**
* @file
* Contains Drupal\mymodule\Plugin\Block\ImageRenderExampleBlockResponsive.
*/
namespace Drupal\mymodule\Plugin\Block;
use Drupal\Core\Block\BlockBase;
@jerbob92
jerbob92 / ImageRenderExampleBlockByURI.php
Created October 28, 2015 13:21
Render image into a block Drupal 8 Example by URI
<?php
/**
* @file
* Contains Drupal\mymodule\Plugin\Block\ImageRenderExampleBlockByURI.
*/
namespace Drupal\mymodule\Plugin\Block;
use Drupal\Core\Block\BlockBase;
@jerbob92
jerbob92 / ImageRenderExampleBlock.php
Created October 28, 2015 13:20
Render image into a block Drupal 8 Example
<?php
/**
* @file
* Contains Drupal\mymodule\Plugin\Block\ImageRenderExampleBlock.
*/
namespace Drupal\mymodule\Plugin\Block;
use Drupal\Core\Block\BlockBase;