Bulk Rename Files on Mac OSX

With the need to rename lots of files in bulk I have come to love a terminal application called ‘rename’. On Mac you can install it using Brew by running

brew install rename

Then if you want to rename all the files in a directory so they have a hyphen instead of an underscore you just do

rename -n ‘s/_/-/’ *

The -n flag says to run it as a test and don’t actually change the files. Once I confirm that it is working, I run it again without the test flag like so

rename -v ‘s/_/-/’ *

The v flag outputs what files were changed. You can find a few more examples at http://tips.webdesign10.com/how-to-bulk-rename-files-in-linux-in-the-terminal

Determine if text in google spreadsheet cell exists in text in another column of cells

I had a email newsletter list with name and email addresses listed. I also had a different list of emails that needed to be removed from that list. I used this google spreadsheet cell formula to check to see if the current row’s email was in the list of emails in the next column. Once I had them marked I used Delete a row in google spreadsheets based on value of cell to remove the row.

=IF( COUNTA( IFERROR( FILTER($E$1:$E$97 , $E$1:$E$97=C2 ) ) ) , "Yes" , "No" )

Delete a row in google spreadsheets based on value of cell

I used the following google spreadsheet script to remove a bunch of rows that had a set value:

/**
 * Deletes rows in the active spreadsheet that contain 'Yes' in column A
 * For more information on using the Spreadsheet API, see
 * https://developers.google.com/apps-script/service_spreadsheet
 */
function readRows() {
 var sheet = SpreadsheetApp.getActiveSheet();
 var rows = sheet.getDataRange();
 var numRows = rows.getNumRows();
 var values = rows.getValues();

 var rowsDeleted = 0;
 for (var i = 0; i <= numRows - 1; i++) {
 var row = values[i];
 if (row[0] == 'Yes') {
 sheet.deleteRow((parseInt(i)+1) - rowsDeleted);
 rowsDeleted++;
 }
 }
};

/**
 * Adds a custom menu to the active spreadsheet, containing a single menu item
 * for invoking the readRows() function specified above.
 * The onOpen() function, when defined, is automatically invoked whenever the
 * spreadsheet is opened.
 * For more information on using the Spreadsheet API, see
 * https://developers.google.com/apps-script/service_spreadsheet
 */
function onOpen() {
 var sheet = SpreadsheetApp.getActiveSpreadsheet();
 var entries = [{
 name : "Remove rows where column A is 'True'",
 functionName : "readRows"
 }];
 sheet.addMenu("Script Center Menu", entries);
};

Laravel, Debugbar, and LiveReload

Ran into a gotcha today while using Debugbar with Laravel and LiveReload. For every request, Debugbar creates a json file in the app storage with information on the request. This is great except it was triggering the browser extension to reload the page because there was a file change in the app.

To fix add the debugbar storage folder to the exclusion list. 1) Select monitored folders 2) Select options 3) Add folder to exclusion list 4) Save