This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
syntax enable | |
set tabstop=4 | |
set shiftwidth=4 | |
set expandtab | |
set number | |
filetype indent on | |
set autoindent | |
colorscheme monokai # See https://github.com/ku1ik/vim-monokai |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
system_profiler SPPowerDataType |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// A. The old way using node_load | |
$nodes = node_load_multiple(NULL, array('type' => 'example_content_type')); | |
// B. The new way using entity queries. | |
// The point of entity queries is you can add field filters here before the | |
// node has to be actually loaded, making your code execution a load lighter. | |
// Get a list of nids for nodes that match our request |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Basicly taken from: | |
# https://github.com/docker-library/drupal/issues/3#issuecomment-153775540 | |
# | |
# Volume containers are the way to go. | |
version: '2' | |
services: | |
drupal: | |
image: drupal:8 | |
links: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setfacl -R -m o:rwx files-development/ | |
setfacl -dR -m o:rwx files-development/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function formatBytes($bytes, $precision = 2) { | |
$units = array('B', 'KB', 'MB', 'GB', 'TB'); | |
$bytes = max($bytes, 0); | |
$pow = floor(($bytes ? log($bytes) : 0) / log(1024)); | |
$pow = min($pow, count($units) - 1); | |
$bytes /= pow(1024, $pow); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('FEATURE_SITE_LINK_FIELD', 'link_field'); | |
/** | |
* Implements hook_field_formatter_info_alter(). | |
*/ | |
function feature_site_field_formatter_info_alter(&$info){ | |
$info['image']['settings'] += array('image_link_field' => ''); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add context 'custom' to your translation strings. | |
* | |
* @param $string | |
* A string containing the English string to translate. | |
* @param $args | |
* An associative array of replacements to make after translation. Based | |
* on the first character of the key, the value is escaped and/or themed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_node_view(). | |
*/ | |
function foo_node_view($node, $view_mode, $langcode) { | |
if ($node->type == 'product_display') { | |
$product_id = $node->field_product[LANGUAGE_NONE][0]['product_id']; | |
$product = commerce_product_load($product_id); | |
dpm ($node, 'node'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
module_load_include('inc', 'media_youtube', 'includes/MediaInternetYouTubeHandler.inc'); | |
$obj = new MediaInternetYouTubeHandler($url); | |
$file = $obj->getFileObject(); | |
$file->display = 1; | |
file_save($file); | |
$product->field_product_video[LANGUAGE_NONE][] = (array) $file; |
NewerOlder