Skip to content

Instantly share code, notes, and snippets.

View caseydriscoll's full-sized avatar

Casey Driscoll caseydriscoll

View GitHub Profile
@caseydriscoll
caseydriscoll / config.js
Created July 8, 2017 22:57
Set Development Config Settings
{
"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 July 2, 2017 20:35
Sage directory after running `composer install`
.
├── 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 July 10, 2017 00:05
Fresh Sage Theme 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 July 1, 2017 22:47
Simple Drush backup script
#!/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 June 30, 2017 22:48
Sample GitLab CI yaml file
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 June 29, 2017 23:37
Example nginx conf with global redirect
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 June 29, 2017 23:31
Example of catch-all 301 nginx redirect
server {
listen 80;
server_name caseydris.co www.caseydris.co;
return 301 https://$host$request_uri;
}
@caseydriscoll
caseydriscoll / redirect.conf
Created June 29, 2017 23:16
Nginx Global Redirect File for Let's Encrypt
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 14:23
Rails console output from 'Issue Generating Objects Indirectly from Patch Controller Method'
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 November 5, 2015 22:41
Body Class Explanation
// 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