Skip to content

Instantly share code, notes, and snippets.

View juampynr's full-sized avatar

Juampy NR juampynr

View GitHub Profile
- Eval of: '$replacements'
▾ $replacements = (array [12])
\
▾ $replacements['[node:field_sample_boolean]'] = (Drupal\Core\Render\Markup [1])
\
⬦ $replacements['[node:field_sample_boolean]']->string = (string [3]) `Off`
/
⬦ $replacements['[node:field_sample_comments]'] = (string [0]) ``
|
@juampynr
juampynr / ctools_error.log
Created December 25, 2015 22:26
Ctools error when running Pathauto tests
juampy@Juampy/var/www/drupal8(8.0.x)$ php core/scripts/run-tests.sh --class 'Drupal\pathauto\Tests\PathautoUnitTest::testPatternLoadByEntity'
Drupal test run
---------------
Tests to be run:
- Drupal\pathauto\Tests\PathautoUnitTest::testPatternLoadByEntity
Test run started:
Friday, December 25, 2015 - 22:26
@juampynr
juampynr / extract-view-data.php
Last active December 26, 2015 13:42
Drupal 8: Extract the data of the content view
<?php
/**
* Extracts the data stored in the database for the Content view.
*
* Usage: place this file at the root of a Drupal 8 project and then execute
* the following command:
*
* drush scr extract-view-data
*
* After running it, /tmp/view_data.txt will contain the data of the view.
@juampynr
juampynr / MetatagDefaults.php
Created December 16, 2015 19:11
Metatag Defaults
<?php
/**
* @file
* Contains \Drupal\metatag\Entity\MetatagDefaults.
*/
namespace Drupal\metatag\Entity;
use Drupal\Core\Config\Entity\ConfigEntityBase;
@juampynr
juampynr / README.md
Last active August 6, 2019 08:46
Sample Guzzle 6 request to Drupal 8 using OAuth 1

This script helps you to test OAuth-signed requests against Drupal 8.

First, make sure that Drupal has been configured by following the steps at https://www.drupal.org/node/2110825. Then install this script with these steps:

  1. Clone this gist.
  2. Run composer.install.
  3. Open oauth_request.php and fill out your consumer_key and consumer_secret. Then Adjust base_uri.
  4. Execute the script with php oauth_request.php.
@juampynr
juampynr / README.md
Last active September 22, 2015 18:02
Drupal query template for Apache Solr

The following is a template for you to write custom queries against Apache Solr. It is documented in a way that resembles as much as possible how to write a SQL query.

Once you have set up Apache Solr Search module and connected a Solr server to Drupal, you can download the following file to the root of your Drupal site, adjust the query, and execute it with the following Drush command:

drush scr custom_solr_query.php
Back in the day we would cut out the top of a lemon and stick saladitos in the middle.
You would squeeze the lemon and then suck out all the juice.
We had cracked lips from the desert heat.
The lepon would sting like a salty tattoo on the mouth.
Back then the only thing better than saladitos and lemon were my lips on Dona Orteguez.
She was a grade above me; was the hottest thing at school; at least I thought so.
She pretty much taught me how to kiss; and her mouth always tasted like Jolly Rangers candy.
I would watch her as she would walk through the halls at school.
Her always had this lazy rythm to it; it was totally cool.
@juampynr
juampynr / comments.jsx
Created September 15, 2015 12:03
Render Disqus comments in React
/**
* Comments component.
*
* Displays comments from Disqus for the current URL.
*/
'use strict';
var React = require('react');
var Settings = require('somepath/settings');
var Comments = React.createClass({
@juampynr
juampynr / contact-form.js
Created August 1, 2015 16:33
Snippet to fill out the form at https://react-form.herokuapp.com
document.getElementsByName('name')[0].value = 'name';
document.getElementsByName('email')[0].value = 'test@example.com';
document.getElementsByName('company')[0].value = 'company';
document.getElementsByName('phone')[0].value = '1234';
document.getElementsByName('website')[0].value = 'https://www.lullabot.com';
document.getElementsByName('areas')[2].checked = 'checked';
document.getElementsByName('areas')[0].checked = 'checked';
document.getElementsByName('when')[4].checked = 'checked';
document.getElementsByName('budget')[0].value = 'budget';
document.getElementsByName('project')[0].innerHTML = 'project';
document.getElementsByName('name')[0].value = 'name';
document.getElementsByName('email')[0].value = 'test@example.com';
document.getElementsByName('company')[0].value = 'company';
document.getElementsByName('phone')[0].value = '1234';
document.getElementsByName('website')[0].value = 'https://www.lullabot.com';
document.getElementsByName('areas')[4].checked = 'checked';
document.getElementsByName('areas')[3].checked = 'checked';
document.getElementsByName('when')[4].checked = 'checked';
document.getElementsByName('budget')[0].value = 'budget';
document.getElementsByName('project')[0].innerHTML = 'project';