Skip to content

Instantly share code, notes, and snippets.

View caseydriscoll's full-sized avatar

Casey Driscoll caseydriscoll

View GitHub Profile
@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 / 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 / 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
Created August 6, 2014 21:06
Tribe: Change publish status of all submitted Community Events
//Add to functions.php of your active theme
add_filter( 'tribe_events_community_sanitize_submission', 'set_community_events_publication_status' );
function set_community_events_publication_status( $submission ) {
// Uncomment one of the lines below to change the default status
//$submission['post_status'] = 'publish';
//$submission['post_status'] = 'pending';
return $submission;
}