Enable Clean Url in Drupal 8 Ubuntu

Enable mod_rewrite for Apache

a2enmod rewrite

Now edit the 000-default.conf located at /etc/apache2/sites-available/

Sudo gedit /etc/apache2/sites-available/000-default.conf

Add the below mentioned lines just under DocumentRoot /var/www/html

    DocumentRoot /var/www/html
    <Directory /var/www/html>
        AllowOverride All
        Order Allow,Deny
        Allow from all

This will add AllowOverride within the default website configuration

Make sure .htaccess is in the default web directory!

ls /var/www/html/.htaccess

Tips for Magento site speed up

Tips for Magento site speed up Summary:

  • Enable all Magento caching layers.
  • Configure your web server to enable Connection Keep-Alive, enable mod_expire, gzip compression.
  • Enable MySQL Query caching.
  • Install APC or XCache to cache PHP opcode.
  • Install Memcache and configure Magento to store session and cache to memory.
  • Install third-party Full Page Cache Magento extension.
  • Install Varnish cache server for full page caching on system layer.

Roles and permissions system for Nodejs

ACL / Roles + Permissions

https://github.com/djvirgen/virgen-acl Simple and elegant, create your own checks. No middleware?

https://github.com/OptimalBits/node_acl Use as middleware, create your own roles and access. Great choice.

https://github.com/tschaub/authorized Similar to connect roles… but a bit more robust? you can create roles and action, and associate many roles with that action

https://github.com/scottkf/ability-js Like canCan for rails. This is a traditional controller / function type permission system. May be too abstract.

https://github.com/dresende/node-roles More traditional setRole() hasRole() based checking. Last activity 2 years ago.

https://github.com/carlos8f/node-relations Natural language style roles. Looks very promising and is in active development

https://github.com/ForbesLindesay/connect-roles Simple and closer to action / natural language based. Requires writing your own checks for each.

https://github.com/ajlopez/SimplePermissions Maybe too simple? Makes sense for assigning roles but then its hard to check against roles!

https://npmjs.org/package/entitlement Not ideal but here for reference sake.

Mongoose Field Access Control

https://github.com/codedoctor/mongoose-plugins-accessible-by Set access per field of mongoose Schema. Not supported or maintained, and noted as not a perfect fit in all cases… but worth considering as a simple way to control access to fields.

Using Rules to publish/unpublish based on a Date field in Drupal

At /admin/config/workflow/rules/components/add

Create a “Action set”:
Name = Unpublish Content
Data type = Node
Label = Node
Machine name = node

  Node > Unpublish content
  Data selector = node

At /admin/config/workflow/rules
Create a “rule”:
Name = Unpublish Rule
React on event = Node > After saving new content
Restrict by type = your content-type

  Content is published
  Data selector = node

  Schedule component evaluation
  Component Value = Unpublish Content
  Scheduled evaluation date data selector = node:field-your-node-date-field
  Identifier value = Unpublish content ID [node:nid] ([node:title]).
  Node Data selector = node

Yii2 Error: cookieValidationKey Must be Configured With a Secret Key

To overcome this error, I added this code below in config/web.php

'components' => [
        'request' => [
            'enableCookieValidation' => true,
            'cookieValidationKey' => 'your-validation-key',

Hope it helps.

jquery validate date of birth format dd-mm-yy

jquery validation for dob to specific format ie dd-mm-yy

    function(value, element) {
        return value.match(/^dd?-dd?-dd$/);
    "Please enter a date in the format dd-mm-yyyy.");
And then on your form add:
        rules : {
            myDate : {
                dateFormat: true