This sheet is a quick overview on generate a basic application and then adding scaffolding.
##TOC
| #!/usr/bin/env bash | |
| tmpfile=/tmp/vhostfile | |
| vhost=/etc/apache2/sites-available/$1 | |
| echo "creating $vhost for directory /var/sites/$2" | |
| echo "<VirtualHost *:80>" > $tmpfile | |
| echo " DocumentRoot /var/sites/$2" >> $tmpfile | |
| echo " ServerName $1" >> $tmpfile | |
| echo " RewriteEngine On" >> $tmpfile | |
| echo " RewriteOptions inherit" >> $tmpfile |
| #!/bin/bash | |
| #Current (Remote) Branch | |
| currentbranch="" | |
| #Fetch from the remote branch | |
| echo "polling..." | |
| if [ -n "$currentbranch" ]; then | |
| git fetch $currentbranch | |
| else |
| #!/bin/bash | |
| #Load all mysql backups in directory | |
| FILES=/you/restore/db/*.mysql | |
| if [ ${#FILES[@]} -gt 0 ]; then | |
| #Loop through files | |
| for f in $FILES | |
| do | |
| #Alert the user |
| #!/bin/bash | |
| drush vset cache 0 | |
| drush vset preprocess_css 0 | |
| drush vset preprocess_js 0 |
| sudo drush dl drush --destination='/usr/share' |
This sheet is a quick overview on generate a basic application and then adding scaffolding.
##TOC
| #!/bin/bash | |
| #Load all mysql backups in directory to mysql | |
| #database is filename | |
| #drop existing database, import database | |
| #clear database script folder | |
| # | |
| #Takes parameters $1 -u $2 username_value $3 -p $4 password_value (example for $files) -f database/folder/*.mysql | |
| #Set $FILES value to location of your database file or use parameter $5 $6 | |
| #FILES="$6" |
| <?php | |
| $query = "SELECT * FROM node"; | |
| $result = db_query($query); | |
| if ($result) { | |
| while ($row = $result->fetchAssoc()) { | |
| dpm($row); | |
| } |
| LOAD DATA LOCAL INFILE '/path/to/file/zip.csv' | |
| INTO TABLE zip_code | |
| FIELDS TERMINATED BY ',' | |
| ENCLOSED BY '\"' | |
| LINES TERMINATED BY '\n' | |
| (zip_code, latitude, longitude, city, state, county, type); |
| #Example for loop zsh | |
| myVar=('foo' 'bar' 'baz') | |
| for i in $myVar; do | |
| print $i | |
| done |