I hereby claim:
- I am samhernandez on github.
- I am samhernandez (https://keybase.io/samhernandez) on keybase.
- I have a public key ASCdNwvonoGRirJ-FkeD6EMRJye3b7i5E20BM1EfoFtemQo
To claim this, I am signing this object:
| # For Drupal multilingual sites | |
| # | |
| # When the first segment of the url path is a language like 'en', 'fr', 'es' | |
| # paths to files break because Drupal adds them to the base url. | |
| # This turns `http://site.com/es/style.css` into `http://site.com/style.css` | |
| # if the latter is actually a file. | |
| RewriteCond %{DOCUMENT_ROOT}/$1 -f | |
| RewriteRule ^/?\w{2}/(.+)$ %{DOCUMENT_ROOT}/$1 [L] |
| #!/bin/bash | |
| # This script assumes you have ssh access to a remote server | |
| # Both databases are backed up to sql files in the same directory | |
| # this script is executed from. | |
| # Usage: | |
| # 1. Make sure this file is executable with `chmod +x mysqlsync` | |
| # 2. Set the credentials for the variables at the top | |
| # (Remember, no spaces around the '=' sign) | |
| # 3. Run it from a directory where you'd like the backup files to go: |
| {# | |
| Don't call this method directly from templates. Rather, call the `neo` or `matrix` | |
| methods to keep things future-proof. | |
| Block templates may be named (from most generic to most specific) | |
| { block type }_{ entry field handle }_{ entry section handle}_{ entry type}.twig | |
| { block type }_{ entry field handle }_{ entry section handle}.twig | |
| { block type }_{ entry field handle }.twig | |
| { block type }.twig |
| # Suppose there is service defined in the docker-compose.yml file | |
| # named `mysql` but it does not have `container_name` defined so | |
| # we don't know what the container name is right now | |
| CONTAINER_NAME=$(docker-compose -f docker-compose.yml ps | grep mysql | awk '{ print $1 }') | |
| echo "Restarting mysql container" | |
| docker stop $CONTAINER_NAME | |
| docker start $CONTAINER_NAME |
I hereby claim:
To claim this, I am signing this object:
| <?php | |
| namespace modules; | |
| use Craft; | |
| /** | |
| * MAMP Helper class. | |
| * File: /modules/MampHelper.php | |
| * | |
| * MySQL database backups triggered from the Craft 3 Control Panel fail because, |
| {# | |
| Resets the username, password, and email address | |
| of the first found Admin account in case of | |
| lost admin access or for support cases. | |
| #} | |
| {% set values = { | |
| username: 'me', | |
| password: craft.app.security.hashPassword('mypassword'), | |
| email: '[email protected]', | |
| passwordResetRequired: 0 |
| {# | |
| Assuming: | |
| - this route is like: `/listing/[primary category slug]/[secondary category slug]` | |
| - the secondary category nav should only show what is relevant to the primary category | |
| #} | |
| {% set slug1 = craft.app.request.segment(2) %} | |
| {% set slug2 = craft.app.request.segment(3) %} | |
| {% set primaryCat = craft.categories.group('primaryCategory').slug(slug1).one() %} | |
| {% set secondaryCat = craft.categories.group('secondaryCategory').slug(slug2).one() %} |
| {# limit to 300 characters, then 40 words, and remove last word which is likely cut off #} | |
| {{ content | slice(0, 300) | split(' ') | slice(0, 40) | slice(0, -1) | join(' ') | raw }}… |
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>Contact Form Plugin Example with Axios</title> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.js"></script> | |
| </head> | |
| <body> | |
| <!-- |