Skip to content

Instantly share code, notes, and snippets.

View Natshah's full-sized avatar
💻
Automating the Automated

Rajab Natshah Natshah

💻
Automating the Automated
View GitHub Profile
#!/bin/sh
#
# This hook prevents you from committing any file containing the
# words "alert|die|print_r".
#
# The idea is that I can add a comment to prevent myself from
# committing a change related to debugging or hacking.
#
# To enable this hook, rename this file to ".git/hooks/pre-commit".
@omerida
omerida / om_exporter.drush.inc
Last active October 14, 2015 16:49
Export Drupal Nodes to CSV with EntityFieldQuery and PHP 5
<?php
function om_exporter_drush_command() {
$items['export-newest'] = array(
'description' => 'Export Newest Content to CSV',
'aliases' => ['ex-new'],
'callback' => 'om_export_newest',
'arguments' => [
'date' => '',
]
@jonathanfranks
jonathanfranks / FormContext.php
Created August 12, 2015 15:05
Behat CKEditor
/**
* @Then /^I fill in wysiwyg field "([^"]*)" with "([^"]*)"$/
*/
public function iFillInWysiwygOnFieldWith($locator, $value) {
$el = $this->getSession()->getPage()->findField($locator);
$fieldId = $el->getAttribute('id');
if (empty($fieldId)) {
throw new Exception('Could not find an id for field with locator: ' . $locator);
}
<?php
/**
* @file
* Contains \Drupal\example_migrate\Plugin\migrate\source\ExampleContent.
*/
namespace Drupal\example_migrate\Plugin\migrate\source;
use Drupal\migrate\Plugin\migrate\source\SqlBase;
id: example_content
label: Example content
migration_group: example
source:
plugin: example_content
target: db_migration
destination:
plugin: entity:node
process:
type:
{
"name": "mynamespace/myproject",
"description": "Example composer file with provides",
"repositories": [
{
"type": "composer",
"url": "http://drupal-packagist.webflo.io/"
},
{
"type": "package",
@salsalabs
salsalabs / embed_signup.html
Last active November 11, 2016 16:22
Signup form in your web page
<form action="https://API_HOST/save" method="POST">
<input type="hidden" name="organization_KEY" value="5881"/>
<input type="hidden" name="chapter_KEY" value="887"/>
<input type="hidden" name="email_trigger_KEYS" value="12644,12656"/>
<input type="hidden" name="object" value="supporter"/>
<input type="hidden" name="Receive_Email" value="1"/>
<label for="first_name">First Name:</label><input type="text" id="first_name" name="First_Name"/><br/>
<label for="last_name">Last Name:</label><input type="text" id="last_name" name="Last_Name"/><br/>
<label for="email">Email:</label><input type="text" id="email" name="Email"/><br/>
<style>.memberCode{display:none;}</style>
@wizonesolutions
wizonesolutions / README.md
Last active April 10, 2017 15:26
Drupal script to fix field collection items associated with multiple entities due to Content Translation/Node Clone bug.

Explanation

Drupal script to fix field collection items associated with multiple entities due to Content Translation/Node Clone bug.

**NOTE: This update hook gives every field collection item found to be associated with more than one node a new item_id. I haven't experienced any problems with doing this, but if you are doing anything special in your use case with the item_ids or revision_ids of field collection items, you should test thoroughly after running this update.

You should test thoroughly anyway, really.

TAKE A BACKUP.

How to use

{
"name": "mynamespace/myproject",
"description": "Composer file example",
"repositories": [
{
"type": "composer",
"url": "http://drupal-packagist.webflo.io/"
},
{
"type": "package",
@scmx
scmx / upgrade-install-ruby-2-1-2-ubuntu-12-04.md
Last active November 6, 2019 15:31
Upgrade/Install ruby 2.1.2 #ubuntu #12.04 #14.04

Upgrade/Install ruby 2.1.2

ubuntu 12.04 14.04

Reference http://stackoverflow.com/a/18490935/2037928

Login as root

Install needed packages

apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev