Skip to content

Instantly share code, notes, and snippets.

View davebeach's full-sized avatar

David Beach davebeach

View GitHub Profile
@davebeach
davebeach / drupal-svg-inline-example.md
Last active September 10, 2016 04:36
svg for drupal 8 logo with png fallback.

##svg for drupal 8 logo with png fallback.

Recommendations found at [Blog](http://thoughtfulweb.com/thoughts/on/the-best-way-to-add-an-svg-image-to-your-website/ title="SVG INLINE METHOD") [^2]

  1. Must be set up as in-line SVG. In adobe illustrator this is an option when exporting to svg.
  2. You need to maniupulate the SVG code, to the the following tags.
  3. It is important that you declare xmlns:xlink="http://www.w3.org/1999/xlink" in the svg tag.
  4. You can add a CSS class and attempt to style it, note however that I have not been able for this to be adopted by most browsers (more future functionality).
@davebeach
davebeach / picture-element.md
Last active September 4, 2016 23:21
picture element

Use cases of picture element

##The device-pixel-ratio Use Case

<img srcset="normal.jpg 1x, retina.jpg 2x"
   src="normal.jpg"
   alt="device-pixel-ratio use case" />
@davebeach
davebeach / block--header-branding.html.twig
Created September 5, 2016 07:34
Drupal 8 SVG Logo TWIG Branding Block
{# The easiest way to add link to home page and SVG logo is to put the SVG into the active theme directory root named logo.svg. To have default for browsers that cannot display SVG, see GIST https://gist.github.com/davebeach/064996d9b234c742642f8ca45585139a - then in the twig block just add the anchor and image elements. There is a lot of complex settings, by passing the block further down to another content file, but this makes no sense. The most difficult part is the anchor link, which just set it to /, don't try and is_front until the bugs are worked out with that functionality. #}
{% block content %}
<div class="container-content region-fixed-content">
<a class="logo" href="{{ '/' | page }}">
<img src="{{ logo }}" alt="{{ 'Home'|t }}"/>
</a>
</div>
@davebeach
davebeach / drupal8-settings-reinstall.md
Last active October 14, 2016 02:33
Create settings.php and the files directory Drupal 8 - To Reinstall Site

Drupal Important Permission Settings Pre-Install and Post-Install.

Pre-Install or Already Installed but Dumping Database to Reinstall

Create settings.php and the files directory for install.

chmod 644 sites/default/settings.php
chmod -r 755 sites/default

GULP Workflow

Steps to set up project.

  1. Create project folder. mkdir projectName
  2. Initialize npm project. npm init
  3. Setup project gulpfile.js:
{
@davebeach
davebeach / terminal.md
Last active April 13, 2019 12:51
Mac OS X Useful Terminal Commands

File Management

  • Show or hide hidden files AppleShowAllFiles YES. Don't forget to refresh finder. Option+Finder Icon

  • To remove the quarantine status of a new file on mac (as it causes problems with keys etc) xattr -d com.apple.quarantine filename.pem FILE

  • to remove from all computers quarenteen files (warning as may be too large to attempt if you download a lot, and or recently) find . | xargs xattr -d com.apple.quarantine

  • to clear att xattr:

@davebeach
davebeach / unixpermissions.md
Last active September 14, 2016 00:29
Unix Permissions

##Key Permissions

*OWNER:READ GROUP:READ USER:READ chmod 0444

*OWNER:READ WRITE GROUP:READ USER:NONE chmod 0640

*OWNER:READ-WRITE-EXECUTE GROUP:READ-WRITE-EXECUTE USER:READ-EXECUTE chmod 0775

@davebeach
davebeach / bitnami.md
Last active May 26, 2020 17:10
Bitnami Applications Useful LINUX Commands

User Management

  • First on debian 8 system (bitnami) sudo apt-get update

  • Next install ZSH with SUDO sudo apt-get install zsh

  • You will get the message about file size, select Y: After this operation 13.2 MB of additional disk space will be used.

@davebeach
davebeach / SSHcommands.md
Last active November 20, 2016 21:24
SSH Commands

Misc Commands

  • To remove a entry from Known_hosts in .ssh directory
ssh-keygen -R hostname
ssh-keygen -F myhost         # shows myhosts's line in the known_hosts file
ssh-keygen -l -F myhost # additionally shows myhost's fingerprint
@davebeach
davebeach / drupal-8-security-permissions.md
Last active March 24, 2021 17:25
Drupal 8.0 Security Settings

Drupal 8 Securing Production Environment

Permissions

sudo chown -R MYUSER:www-data *
sudo find . -type d -exec chmod 755 {} \;
sudo find . -type f -exec chmod 640 {} \;
sudo find sites/default/files/config* -type f -exec chmod 664 {} \;