Skip to content

Instantly share code, notes, and snippets.

{#
/**
* @file
* Theme override for the basic structure of a single Drupal page.
*
* Variables:
* - logged_in: A flag indicating if user is logged in.
* - root_path: The root path of the current page (e.g., node, admin, user).
* - node_type: The content type for the current node, if the page is a node.
* - head_title: List of text elements that make up the head_title variable.
@guylyons
guylyons / ldap.php
Created November 11, 2021 20:02 — forked from heiglandreas/ldap.php
Disable Certificate-check for LDAPS/ldap_tls
<?php
$con = ldap_connect('ldaps://ldap.example.com');
ldap_set_option($con, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($con, LDAP_OPT_X_TLS_REQUIRE_CERT, LDAP_OPT_X_TLS_NEVER);
/*
Possible values:
LDAP_OPT_X_TLS_NEVER
This is the default. slapd will not ask the client for a certificate.
@guylyons
guylyons / custom-ds-field.php
Created September 30, 2020 15:50
Chris's example of adding custom Display Suite Fields
<?php
namespace Drupal\ds_fields\Plugin\DsField;
use Drupal\ds\Plugin\DsField\DsFieldBase;
/**
* @DsField(
* id = "guy_lyons",
* title = @Translation("Guy Lyons"),
* entity_type = "node",
* provider = "ds_fields",
* ui_limit = {"profile|*"}
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9000,
"pathMappings": {
"/var/www/html": "${workspaceRoot}"
@guylyons
guylyons / combining-git-repositories.md
Created March 5, 2019 17:25 — forked from msrose/combining-git-repositories.md
How to combine two git repositories.

Combining two git repositories

Use case: You have repository A with remote location rA, and repository B (which may or may not have remote location rB). You want to do one of two things:

  • preserve all commits of both repositories, but replace everything from A with the contents of B, and use rA as your remote location
  • actually combine the two repositories, as if they are two branches that you want to merge, using rA as the remote location

NB: Check out git subtree/git submodule and this Stack Overflow question before going through the steps below. This gist is just a record of how I solved this problem on my own one day.

Before starting, make sure your local and remote repositories are up-to-date with all changes you need. The following steps use the general idea of changing the remote origin and renaming the local master branch of one of the repos in order to combine the two master branches.

Keybase proof

I hereby claim:

  • I am guylyons on github.
  • I am yug (https://keybase.io/yug) on keybase.
  • I have a public key ASDVro_-8zZC-dFds31pcUROCUV_DR1ZRqeD2ZzIFMpoWQo

To claim this, I am signing this object:

$custom_query->query('showposts=8&post_type=custom_post_type_here'.'&paged='.$paged);
# http://www.rinconstrategies.io/get-post-excerpt-by-id-wordpress.html
$excerpt = apply_filters('the_excerpt', get_post_field('post_excerpt', get_the_ID()));