Skip to content

Instantly share code, notes, and snippets.

View ecorson's full-sized avatar

Erin Corson ecorson

  • University of Iowa
View GitHub Profile
@ecorson
ecorson / gist:5022198
Last active December 14, 2015 03:39
vim
Note: ESC just in case you are in INSERT Mode
Necessities
-----------
Save
:w
Quit
:q
@ecorson
ecorson / gist:4724847
Created February 6, 2013 18:55
import sql dump from cli
mysql -u vivek -p -h localhost blog < data.sql
@ecorson
ecorson / gist:4588601
Created January 21, 2013 19:34
Push files by rsync recursively preserving permissions and copying symlinks
rsync -avzr localfile user@localhost:/path/to/remote/
@ecorson
ecorson / rsync.sh
Created August 27, 2012 20:55
rsync Files directory in SiteNow env
rsync -a -v /local/www/shared/files/international.uiowa.edu/files lamp08.its.uiowa.edu::FILES/international.uiowa.edu
@ecorson
ecorson / bootstrapper.php
Created May 8, 2012 15:33
Iterate over nodes via bootstrap and drush
<?php
$stdout = fopen('php://stdout', 'w');
fwrite($stdout, "Script Template\n");
// Site specific variables
$username = "Dale";
$drupal_base_url = parse_url('http://www.example.com');
require_once 'includes/bootstrap.inc';
@ecorson
ecorson / auto_alias_true
Created April 6, 2012 15:51
Turn on auto aliasing via Views Bulk Operations
<?php
$node = node_load($entity->nid);
$node->path['pathauto'] = TRUE;
node_save($node);
@ecorson
ecorson / drush_set_filepath
Created April 3, 2012 20:11
Set public files directory path via Drush
drush vset file_public_path files/example.com/files
@ecorson
ecorson / drush_admin_create
Created April 3, 2012 14:43
Add admin user via Drush
drush user-create adminuser --mail="adminuser@uiowa.edu" --password="UserPw"; drush user-add-role "administrator" adminuser
@ecorson
ecorson / search_and_replace.php
Created April 3, 2012 14:32
Search and replace text using Views Bulk Operations
<?php
/**
* Search and replace using Views Bulk Operations
*/
$node = node_load($entity->nid); //load node form entity supplied by VBO
$haystack = $node->body['und'][0]['value']; //set node body to be haystack
$search = "Office of International Students and Scholars"; //Set the string to search for
$replace = "International Student & Scholar Services"; //String to replace target