Skip to content

Instantly share code, notes, and snippets.

View allgood2386's full-sized avatar

Richard Allen allgood2386

  • Bixal
  • Northern Virgina
View GitHub Profile
source:
plugin: url
data_fetcher_plugin: http
data_parser_plugin: json
urls: http://sourcesite.com/jsonapi/node/article
ids:
nid:
type: integer
item_selector: data/
fields:
# Create database user with name 'bob' and previously hashed mysql native password '*EE0D72C1085C46C5278932678FBE2C6A782821B4' with all database privileges
- mysql_user:
name: bob
password: '*EE0D72C1085C46C5278932678FBE2C6A782821B4'
encrypted: yes
priv: '*.*:ALL'
state: present
$node = ['119' => '119];
$node = $this->entityTypeManager->getStorage('node')->load(array_shift($nodes));
vs
$node = $this->entityTypeManager->getStorage('node')->loadMultiple($nodes);
process:
type:
plugin: default_value
default_value: article
title: post_title
nid: ID
uid:
plugin: default_value
default_value: 1
sticky:
<?php
$entity_wrapper->field_date_project_posted->set(array(
'value' => $dt->format('Y-m-d'),
'value2' => $dt2->format('Y-m-d'),
));
<?php
$node = entity_meta_datawrapper('node', $nid');
$node->field_something[] = $someValue;
$node = $node->save();
if ($node->nid) {
//sucess
}
l(t('Link name you want the user to see'), 'sites/default/files/docs/docname.pdf'); or if the file is an entity (ignore this part if you are confused now) l(t('Link name you want the user to see'), drupal_get_path_alias( 'sites/default/files/docs/docname.pdf'));
@allgood2386
allgood2386 / l
Last active December 10, 2015 19:14
<?php
l(t('%fieldvaluehere rest of my string', array('%fieldvaluehere' =>$field_result[0]['value']));
#!/bin/sh
echo "Installing homebrew..."
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Update homebrew recipes
brew update
#taps
@allgood2386
allgood2386 / gist:566daf7ea0c8d86d4dda
Last active December 3, 2015 13:02
bitly url shornter ultility
#!/usr/bin/env python
#
# Copyright 2009 Empeeric LTD. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#