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
#!/bin/bash | |
docker ps --filter "label=com.docker.compose.project" -q | xargs docker inspect --format='{{index .Config.Labels "com.docker.compose.project"}}'| sort | uniq |
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
/** | |
This script takes a sub-directory of your repository, renames relative links | |
in HTML files to point to a Github Pages subdirectory, and publishes to your | |
gh-pages branch. | |
Use: | |
1. Download this script into the root of your project. | |
2. Run npm install --save-dev fs-extra rebase gh-pages | |
3. Rename "your-project" to the name of your Github project | |
4. If you have more than one HTML file, add it to the "files" |
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 | |
// Run this with drush, like "drush scr access.php" | |
use Drupal\user\Entity\User; | |
// You should delete this user after you're done testing. | |
if (!($auth = user_load_by_name('tmp_access_script'))) { | |
$auth = User::create(['name' => 'tmp_access_script']); | |
$auth->save(); |
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
// Put this file in a directory where @stencil/core exists in node_modules, then run: +var stencil = require('@stencil/core/server'); | |
// $ echo $HTML | node ssr.js [root] [build-dir] [namespace] | |
// Full example from my use case: | |
// $ echo '<sam-text text="Hello, world"></sam-text>' | node ssr.js /var/www/stencil/sams-components/ ../dist sam | |
// Pipes are used because HTML strings can be really long, and bash has limits on how large argument lists can get (~256k usually). | |
var stencil = require('@stencil/core/server'); | |
var args = process.argv.slice(2); | |
if (args.length < 3) { | |
console.error('Not enough args'); | |
} |
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
#!/bin/bash | |
# Save this to a file named "drush" (not "drush.sh") and put it in the same | |
# directory as your docker-compose file. Replace "SERVICE" with your docker | |
# container's name. | |
# Now every time you run "drush" from this directory, it runs drush inside | |
# your container instead. Cool! | |
docker-compose exec SERVICE drush $@ |
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 | |
# Run this with drush scr, silly! | |
use Drupal\Core\Serialization\Yaml; | |
foreach (file_scan_directory('.', '/core\.entity_.*display.*\.yml/') as $file) { | |
$filepath = realpath($file->uri); | |
$yml = Yaml::decode(file_get_contents($filepath)); | |
if (isset($yml['content'])) { |
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 | |
$build['your_key'] = [ | |
'#type' => 'link', | |
'#title' => $this->t('My button'), | |
'#url' => Url::fromRoute('your_route'), | |
'#attributes' => [ | |
'class' => ['button', 'use-ajax'], | |
'data-dialog-type' => 'modal', | |
'data-dialog-options' => json_encode([ |
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
html, | |
body { | |
height: 100%; } |
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
version: '2' | |
services: | |
web: | |
build: . | |
ports: | |
- "8000:80" | |
volumes: | |
- ./modules:/var/www/html/modules | |
- ./files:/var/www/html/sites/default/files | |
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
# Extend the official Drupal image. | |
FROM drupal:8.1.7-apache | |
# Install required binaries. | |
RUN apt-get update && apt-get install netcat mysql-client -y | |
# Safely remove the normal modules directory. | |
RUN rm /var/www/html/modules/README.txt && rmdir /var/www/html/modules | |
# Install Composer. |