Skip to content

Instantly share code, notes, and snippets.

@jonshipman
jonshipman / styles.csv
Created May 5, 2023 20:03
Stable Diffusion Artist Styles
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 5 columns, instead of 3. in line 1.
____Artists____,,,,
Aaron Horkey,"style of Aaron Horkey",""
Abbott Handerson Thayer,"style of Abbott Handerson Thayer",""
Abigail Larson,"style of Abigail Larson",""
Adam Hughes,"style of Adam Hughes",""
Adrian Ghenie,"style of Adrian Ghenie",""
Adrian Tomine,"style of Adrian Tomine",""
Adrianus Eversen,"style of Adrianus Eversen",""
Agnes Cecile,"style of Agnes Cecile",""
Agostino Arrivabene,"style of Agostino Arrivabene",""

Dropsolid Personalisation 1 on 1

Required

`php working

Installation

Install drupal

mkdir drupal && cd drupal && curl -sSL https://www.drupal.org/download-latest/tar.gz | tar -xz --strip-components=1

installing compser

@signalpoint
signalpoint / example.php
Last active July 16, 2022 23:41
Drupal 8 Set Message Example
<?php
// The drupal_set_message() function is being deprecated!
// @see https://api.drupal.org/api/drupal/core%21includes%21bootstrap.inc/function/drupal_set_message/8.5.x
// > Deprecated in Drupal 8.5.0 and will be removed before Drupal 9.0.0.
// > Use \Drupal\Core\Messenger\MessengerInterface::addMessage() instead.
// In some custom code.
\Drupal::messenger()->addMessage('Say something else');
# SPECIFIC: Block #submit #validate #process #pre_render #post_render #element_validate #after_build #value_callback parameters
SecRule REQUEST_FILENAME "(index\.php|\/$)" "chain,id:003294,t:lowercase,t:none,t:utf8toUnicode,t:urlDecodeUni,t:urldecode,block"
SecRule REQUEST_METHOD "^(GET|POST|HEAD)$" chain
SecRule ARGS_NAMES|REQUEST_COOKIES_NAMES "^\#(submit|validate|pre_render|post_render|element_validate|after_build|value_callback|process)$|\[(?:\'|\")?#(submit|validate|pre_render|post_render|element_validate|after_build|value_callback|process)"
# GENERIC: Block all parameters starting with #
SecRule REQUEST_FILENAME "(index\.php|\/$)" "chain,id:003309,t:lowercase,t:none,t:utf8toUnicode,t:urlDecodeUni,t:urldecode,block"
SecRule REQUEST_METHOD "^(GET|POST|HEAD)$" chain
@ummdorian
ummdorian / index.php
Created March 28, 2018 14:57
Drupal 8 Query Alter Group By (views)
<?php
function module_query_views_events_alter(Drupal\Core\Database\Query\AlterableInterface $query){
// If this the right query
if(
$query->getMetaData('view') != ''
&& $query->getMetaData('view')->getDisplay()->display['id'] == 'block_3'
){
@dinarcon
dinarcon / nicaragua.module
Created November 7, 2017 14:20
Conditional fields in Paragraphs using the Javascript States API for Drupal 8
/**
* @file
* Example code from http://agaric.com/blogs/conditional-fields-paragraphs-using-javascript-states-api-drupal-8.
*/
/**
* Implements hook_field_widget_WIDGET_TYPE_form_alter().
*
* Example of conditional fields in paragraphs for Drupal 8.
*/
@Timi7007
Timi7007 / README.md
Last active December 20, 2022 15:09
Collection on all things HTTPS. Includes settings for TLS on nginx (which desperately need an update!).

Why HTTPS?

Collection on all things HTTPS. Includes settings for TLS on nginx (which desperately need an update!).


Until I update this, I'd recommend you take a look at https://github.com/jukbot/setup-nginx-webserver

My current settings for TLS on nginx/1.10.3 on Ubuntu Server 16.04 LTS

See https://www.nginx.com/resources/wiki/start/topics/tutorials/install/#official-debian-ubuntu-packages on how to install the lastest version of nginx.

Most settings are sourced from https://bettercrypto.org/static/applied-crypto-hardening.pdf#subsection.2.1.3, https://danpalmer.me/blog/ssl-labs-grade-a, https://gist.github.com/plentz/6737338 and https://scotthelme.co.uk/

@slivorezka
slivorezka / get_image_path_with_image_style.php
Created November 8, 2016 10:40
Drupal 8: Get Image URL / URI with Image Style
<?php
use Drupal\file\Entity\File;
use Drupal\image\Entity\ImageStyle;
// File ID.
$fid = 123;
// Load file.
$file = File::load($fid);
// Get origin image URI.
$image_uri = $file->getFileUri();
// Load image style "thumbnail".
@crittermike
crittermike / get_node_by_path.php
Created September 16, 2016 15:15 — forked from thagler/get_node_by_path.php
Drupal 8 Get node ID by path alias
<?php
$path = \Drupal::service('path.alias_manager')->getPathByAlias('/this-is-the-alias');
if(preg_match('/node\/(\d+)/', $path, $matches)) {
$node = \Drupal\node\Entity\Node::load($matches[1]);
}
@woombo
woombo / hook_inline_entity_form_table_fields_alter.module
Last active February 11, 2016 18:12
hook_inline_entity_form_table_fields_alter()
/**
* Implements hook_inline_entity_form_table_fields_alter().
*/
function MODULE_inline_entity_form_table_fields_alter(&$fields, $context) {
if ($context['parent_bundle'] === 'MODULE' &&
$context['entity_type'] === 'MODULE_text_asset') {
// Remove Title.
unset($fields['id']);