Skip to content

Instantly share code, notes, and snippets.

Avatar

Casey Driscoll caseydriscoll

View GitHub Profile
@caseydriscoll
caseydriscoll / config.js
Created Jul 8, 2017
Set Development Config Settings
View config.js
{
"entry": {
"main": [
"./scripts/main.js",
"./styles/main.scss"
],
"customizer": [
"./scripts/customizer.js"
]
}, <= This 'publicPath' is for 'Bedrock' setups.
@caseydriscoll
caseydriscoll / Sage Directory with Composer Dependencies
Created Jul 2, 2017
Sage directory after running `composer install`
View Sage Directory with Composer Dependencies
.
├── CHANGELOG.md
├── LICENSE.md
├── README.md
├── app/
│   ├── admin.php
│   ├── filters.php
│   ├── helpers.php
│   ├── lib
│   └── setup.php
@caseydriscoll
caseydriscoll / Sage Directory with no Dependencies
Last active Jul 10, 2017
Fresh Sage Theme Directory with no dependencies
View Sage Directory with no Dependencies
.
└── wcdc17
├── CHANGELOG.md
├── LICENSE.md
├── README.md
├── app/
├── composer.json
├── composer.lock
├── package.json
├── phpcs.xml
@caseydriscoll
caseydriscoll / drush-backup.sh
Created Jul 1, 2017
Simple Drush backup script
View drush-backup.sh
#!/bin/bash
BACKUP_DATE=$(date +%Y%m%d%H%M%S)
if [[ $CI_RELEASE ]]; then
BACKUP_DATE=$CI_RELEASE
fi
drush sql-dump > ../db/$BACKUP_DATE.sql
@caseydriscoll
caseydriscoll / .gitlab-ci.yml
Created Jun 30, 2017
Sample GitLab CI yaml file
View .gitlab-ci.yml
before_script:
- git clone https://git.caseydris.co/casey/drupal-runner.git steps
- chmod -R 775 steps
- export CI_RELEASE=$(date +%Y%m%d%H%M%S)
build_stage:
stage: build
script:
- steps/deploy $STAGE_PATH $CI_RELEASE
- steps/harden $STAGE_PATH $CI_RELEASE
@caseydriscoll
caseydriscoll / caseydris.co
Created Jun 29, 2017
Example nginx conf with global redirect
View caseydris.co
server {
listen 80;
server_name caseydris.co www.caseydris.co;
root /srv/www/caseydris.co/public_html;
include global/redirect.conf;
}
server {
listen 443 ssl http2;
@caseydriscoll
caseydriscoll / caseydris.co
Created Jun 29, 2017
Example of catch-all 301 nginx redirect
View caseydris.co
server {
listen 80;
server_name caseydris.co www.caseydris.co;
return 301 https://$host$request_uri;
}
@caseydriscoll
caseydriscoll / redirect.conf
Created Jun 29, 2017
Nginx Global Redirect File for Let's Encrypt
View redirect.conf
location /.well-known/acme-challenge/ {
try_files $uri /dev/null =404;
}
location / {
return 301 https://$host$request_uri;
}
@caseydriscoll
caseydriscoll / print.rb
Last active May 20, 2017
Rails console output from 'Issue Generating Objects Indirectly from Patch Controller Method'
View print.rb
class Print < ApplicationRecord
has_many :project_print
has_many :projects, :through => :project_print
attr_accessor :title, :left_photo_id, :right_photo_id
end
@caseydriscoll
caseydriscoll / functions.php
Last active Nov 5, 2015
Body Class Explanation
View functions.php
// Edit 0 - 2015-11-05 16:55:34 - Init
// Edit 1 - 2015-11-05 17:04:18 - Add global and short circuit
// Edit 2 - 2015-11-05 17:17:44 - Add is_tree
// Edit 3 - 2015-11-05 17:39:14 - Remove is_tree, use get_post_ancestors
// Hook into the 'body_class' filter with the name of a unique function
add_filter( 'body_class', 'page_parent_specific_body_classes' );
// Callback function for adding a class to the body element