Skip to content

Instantly share code, notes, and snippets.

View cmcintosh's full-sized avatar
💭
Looking For Projects

Chris McIntosh cmcintosh

💭
Looking For Projects
View GitHub Profile
[
{
"thoughts": {
"text": "Starting a discord server for the AkiraAI community named AkiraAI,",
"reasoning": "Creating a space for the community to engage and interact, promote growth and learning",
"plan": "- Create a Discord account \n- Create the AkiraAI server \n- Set up server categories and channels \n- Invite members to join server",
"criticism": "None"
},
"command": {
"name": "message_agent",
To embed a React component inside a Drupal 8 page template, you first need to create a React component and bundle it into a JavaScript file. Then, you can include the JavaScript file in your Drupal theme or module and use it in your page template.
Here’s an example of how to embed a React component inside a Drupal 8 page template:
1. Create a new React component called MyComponent in a JavaScript file, e.g. mycomponent.jsx:
import React from 'react';
class MyComponent extends React.Component {
render() {
@cmcintosh
cmcintosh / gist:0093bc282084f79f7883a53f66507584
Created April 17, 2023 08:25
Example Code for hiding products for Commerce Stock.
<?php
/**
* @file mymodule.module
* Includes drupal hooks for module.
*/
use Drupal\mymodule\PremiumContentAccessControlHandler;
/**
* Implements hook_entity_type_alter().
*/
function mymodule_entity_type_alter(array &$entity_types) {
// Available on the Unity Asset Store https://www.assetstore.unity.com/publishers/49504
// Copyright © 2020 Shamil Bikmullin
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CityGenerator : MonoBehaviour
{
@cmcintosh
cmcintosh / starbase.deltaui
Created September 5, 2021 10:59 — forked from johnpenny/starbase.deltaui
starbase.deltaui
PROJECT: DELTA UI
BY: Oo
COMPANY: io
V: 1.1
LIC: FREE if you leave in the credit
$: Any IN-GAME donations are welcome
---------------------------------------------------------------------------
#### HOW TO INSTALL
@cmcintosh
cmcintosh / composer.json
Created January 19, 2021 12:50 — forked from mpociot/composer.json
Simple ReactPHP chat server - connect to it: nc laracon.beyondco.de 8000
{
"require": {
"react/event-loop": "^1.1",
"react/stream": "^1.1",
"react/promise": "^2.8",
"react/socket": "^1.6",
"react/http": "^1.2",
"nubs/random-name-generator": "^2.2"
}
}
@cmcintosh
cmcintosh / D8 | Programmatically Create Field.md
Created October 20, 2020 20:56 — forked from jacerider/D8 | Programmatically Create Field.md
Programmatically create a field in Drupal 8.
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\field\Entity\FieldConfig;

$bundles = ['user'];

$fields['user_picture'] = [
  'type' => 'image',
  'entity_type' => 'user',
  'bundle' => 'user',
@cmcintosh
cmcintosh / import.php
Created August 6, 2020 13:20 — forked from crittermike/import.php
Importing Drupal 8 config programmatically
<?php
// Import arbitrary config from a variable.
// Assumes $data has the data you want to import for this config.
$config = \Drupal::service('config.factory')->getEditable('filter.format.basic_html');
$config->setData($data)->save();
// Or, re-import the default config for a module or profile, etc.
\Drupal::service('config.installer')->installDefaultConfig('module', 'my_custom_module');
/**
* {@inheritdoc}
*/
public function getCacheMaxAge() {
// Cache this for 1 minute.
return 60;
}
/**
* Sets expires and max-age for bubbled-up max-age values that are > 0.
*
* @param \Symfony\Component\HttpKernel\Event\FilterResponseEvent $event
* The response event.
*
* @throws \Exception
* Thrown when \DateTime() cannot create a new date object from the
* arguments passed in.
*/