Skip to content

Instantly share code, notes, and snippets.

View juampynr's full-sized avatar

Juampy NR juampynr

View GitHub Profile
@juampynr
juampynr / municipales.md
Last active August 29, 2015 14:18
Elecciones municipales españolas 2015 - Voto por correo
  1. Acudir a cualquier oficina de correos solicitando el impreso.
  2. Se reciben dos impresos y un sobre. Uno es para Correos y el otro es para el Censo Electoral. En el segundo podemos especificar a qué dirección queremos que se nos envíe la documentación para votar.
  3. La documentación llegará al domicilio no más tarde del 4 de mayo.
  4. El voto deberá enviarse no más tarde del 19 de mayo.

Información adicional del Ministerio de Exteriores.

@juampynr
juampynr / automatic.md
Created May 21, 2015 10:07
Patching workflows in Drupal projects

Patching

Patches are managed through the Drush patch command. Existing patches can be found at patches.make.

Usage examples

Apply patch URL to multifield module

$ cd docroot
$ drush pa multifield https://www.drupal.org/files/issues/multifield-features_integration-2102265-29.patch
Patch https://www.drupal.org/files/issues/multifield-features_integration-2102265-29.patch applied to                                      [ok]
@juampynr
juampynr / cool.md
Created June 10, 2015 22:21
Supercool

👍 :bowtie::neckbeard:🌟💩👍💃👯🙇😺👀🐰🐥💐🌸🌷🍁:squirrel:💝🎉💰🎸🎺🎷🎨🎩🍺🍹🍷🍣🍰🍪🚤🚀🏁🗿

" Extra bundles.
Bundle 'joonty/vdebug.git'
" Editor overrides.
set shiftwidth=2 " Use indents of 4 spaces
set expandtab " Tabs are spaces, not tabs
set tabstop=2 " An indentation every four columns
set softtabstop=2 " Let backspace delete indent
" associate *.install and *.module files with with php filetype
@juampynr
juampynr / mymodule.module
Last active August 29, 2015 14:24
Load a field for a set of nids
<?php
/**
* Fetches a field for an array of nids of a given type.
*
* Usage example: $nodes = mymodule_field_load_multiple('page', 'field_image', array(1, 2, 3));
*
* @param string $content_type
* The node's content type machine name.
* @param string $field
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';
@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';
@juampynr
juampynr / README.md
Last active September 3, 2015 16:03
Custom Apache Solr Query

The following script is an example on how to build a custom query with Drupal's Apache Solr Search module.

In order to test it, you can copy the file to the root of your Drupal site, set the nid at the top, adjust the query and run it with the following Drush command:

drush scr custom_solr_query.php

You can find further details about it at this article from the Lullabot Blog.

@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
@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({