Skip to content

Instantly share code, notes, and snippets.

@pcambra
pcambra / multiple-deploy-keys-multiple-private-repos-github-ssh-config.md How to configure multiple deploy keys for different private github repositories on the same computer
View multiple-deploy-keys-multiple-private-repos-github-ssh-config.md

This is probably a common issue for people who wants to deploy serveral repository on one VPS or VM.

This is not going to be rocket science.

The first step is to generate your first ssh key, for this type the following command line in your terminal: ssh-keygen -t rsa -b 4096 -C "your@email.com" When the command CLI is asking you if you want to use a passphrase you might want to press ENTER in order to don't have to type it everytime you will want to pull your repository.

Now copy the content of your public key and add it to Github in your first repository (Settings > Deploy keys). For example on debian it might be:

View FieldViewsLabel.php
<?php
namespace Drupal\log\Plugin\views\field;
use Drupal\Core\Entity\EntityMalformedException;
use Drupal\Core\Entity\Exception\UndefinedLinkTemplateException;
use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Plugin\views\field\FieldPluginBase;
use Drupal\views\ResultRow;
@pcambra
pcambra / queue.php
Created October 18, 2018 09:41
Drupal 8: Process a queue programmatically
View queue.php
$queue_factory = \Drupal::service('queue');
$queue_manager = \Drupal::service('plugin.manager.queue_worker');
$queue_worker = $queue_manager->createInstance('queue_name');
$queue = $queue_factory->get('queue_name');
$item = $queue->claimItem();
$queue_worker->processItem($item->data);
@pcambra
pcambra / gist:fefed7ebfa14c0a2602bc4cd7688928c
Created October 18, 2018 07:19
Reinstal module configuration for Drupal 8
View gist:fefed7ebfa14c0a2602bc4cd7688928c
drush php-eval "\Drupal::service('config.installer')->installDefaultConfig('module', 'module_name');"
View Restart dnsmasq
sudo launchctl unload /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
dscacheutil -flushcache
brew services restart dnsmasq
@pcambra
pcambra / custom_pane_panelizer.php
Created May 10, 2018 00:43
How to add a pane to a node with panelizer programmatically
View custom_pane_panelizer.php
<?php
// This code can be used in a hook_update_n to add a custom pane to an existing display in panelizer.
// Example variables used in the code below.
$nid = 1;
$pane_machine_name = 'my_example_custom_pane';
$region = 'content';
$position = 0;
View gist:aad1f1af0a889d21cc3255d41dbde8bf
const { String: { underscore } } = Ember;
export default JSONAPISerializer.extend({
// Keep Drupal underscored keys.
keyForRelationship(key) {
return underscore(key);
},
keyForAttribute(key) {
return underscore(key);
},
View npm shrink
npm install
npm prune
npm dedupe
npm install
npm shrinkwrap --dev
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});