Skip to content

Instantly share code, notes, and snippets.

View zuhairkareem's full-sized avatar
🏠
Working from home

zuhairkareem

🏠
Working from home
View GitHub Profile
@zuhairkareem
zuhairkareem / README.md
Created September 26, 2016 05:40 — forked from Greg-Boggs/README.md
Drupal Site Building Best Practices

Better Drupal Building

  • Custom glue should be accomplished with configuration first and PHP code second.

Configuration Management and Dependencies

  • Use Composer (or Drush Make) to build your project and it's depencies.
  • Store your work in files.
  • Set your config directory above the webroot.
  • Sync UUIDs across all developers.

Theming

@zuhairkareem
zuhairkareem / create_file.php
Created August 7, 2016 10:00 — forked from liberatr/create_file.php
Programmatically save a file to Drupal from your local file system.
/**
* Saves a file on your local file system you want to copy to Drupal default files directory.
* This assumes you have bootstrapped Drupal.
* Originally written to be invoked within a Behat context.
*/
use Drupal\file\Entity\File;
$file = new File(array(), 'file');
$file->setFilename("image-fact.jpg");
$file->setPermanent();
@zuhairkareem
zuhairkareem / 0_reuse_code.js
Created July 13, 2016 12:09
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console