Skip to content

Instantly share code, notes, and snippets.

View colorfield's full-sized avatar

Christophe Jossart colorfield

View GitHub Profile
@colorfield
colorfield / index.js
Last active January 16, 2018 22:05
React fetch on the route
import React from 'react';
import Layout from '../../components/Layout';
import ItineraryListPage from './ItineraryListPage';
import { JSON_API_URL } from '../../constants/env';
const title = 'Audioguide';
async function action({ locale, fetch }) {
// Use Drupal locale (e.g. convert en-US to en).
const languageId = locale.substring(0, 2);
@colorfield
colorfield / stack.yml
Created November 18, 2017 09:29
Drupal with PostgreSQL, example provided by https://hub.docker.com/_/drupal/
# Drupal with PostgreSQL
#
# Access via "http://localhost:8080"
# (or "http://$(docker-machine ip):8080" if using docker-machine)
#
# During initial Drupal setup,
# Database type: PostgreSQL
# Database name: postgres
# Database username: postgres
# Database password: example
@colorfield
colorfield / company.sql
Last active June 13, 2017 16:06
Company dummy data
CREATE TABLE `company` (
`id` mediumint(8) unsigned NOT NULL auto_increment,
`name` varchar(255),
`description` TEXT default NULL,
`phone` varchar(50) default NULL,
`email` varchar(89) default NULL,
`website` varchar(255) default "http://example.com",
PRIMARY KEY (`id`)
) AUTO_INCREMENT=1;
@colorfield
colorfield / myhost.cfg
Created June 1, 2017 09:52
Nagios host configuration template
define host {
use linux-server
host_name vpsxxx.xx.xx # replace
alias vpsxxx # replace
address 127.0.0.1 # replace
max_check_attempts 5
check_period 24x7
notification_interval 30
notification_period 24x7
}
@colorfield
colorfield / AudioContentList.js
Last active April 18, 2018 01:48
AudioGuide Demo - fetch componentDidMount
(...)
constructor() {
super();
this.state = {
audioList: { data: [] },
};
}
componentDidMount() {
@colorfield
colorfield / index.js
Last active June 13, 2017 14:27
AudioGuide demo - React audio_page route
import React from 'react';
import { REST_HOST_NAME } from '../../constants';
import Layout from '../../components/Layout';
import AudioContentPage from '../../components/AudioContentPage';
export default {
path: '/audio/:id',
async action({ params }) {
@colorfield
colorfield / audio_list.fr-CA.md
Created May 30, 2017 17:55
AudioGuide demo - React audio_list route
title component
Liste Audio
ContentPage

Nodes Drupal

@colorfield
colorfield / AudioContentPage.css
Created May 30, 2017 17:45
AudioGuide demo - AudioContentPage React component
@import '../variables.css';
@import '../Page/Page.css';
@colorfield
colorfield / AudioContentList.css
Created May 30, 2017 17:37
AudioGuide demo - AudioContentList React component
@import '../variables.css';
@import '../Page/Page.css';
ul {
list-style-type: none;
padding-left: 0;
}
li {
margin-bottom: 30px;
@colorfield
colorfield / DeleteEntitiesController.php
Created March 3, 2017 13:36
Delete all entities of a bundle type
<?php
namespace Drupal\rest_import\Controller;
use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Entity\Query\QueryFactory;
use Drupal\Core\Entity\EntityTypeManager;
/**