Skip to content

Instantly share code, notes, and snippets.

View markysharky70's full-sized avatar

Mark Wilson markysharky70

View GitHub Profile
@markysharky70
markysharky70 / mail_received_field_formatted_date_patch
Created March 30, 2011 20:33
Mail::ReceivedField.formatted_date throwing "invalid date" error (temp fix)
Mail::ReceivedField.class_eval do
def formatted_date
date_time.strftime("%a, %d %b %Y %H:%M:%S ") + date_time.zone.delete(':')
rescue ArgumentError => e
raise e unless "invalid date"==e.message
end
end
@markysharky70
markysharky70 / gist:1019289
Created June 10, 2011 17:20
Copy your production database to your staging database hosted on Heroku
1) backup production database:
heroku pgbackups:capture --expire --remote production
2) obtain url string to backup from step 1:
heroku pgbackups:url --app production_app_name --remote production_app_branch_name
3) transfer backup from production to staging app:
heroku pgbackups:restore DATABASE 'production_app_backup_url_string_from_step_2' --app production_app_name --app staging_app_branch_name
@markysharky70
markysharky70 / connection_fix.rb
Created May 25, 2012 20:41 — forked from shinzui/connection_fix.rb
MySQL automatic reconnect
# If your workers are inactive for a long period of time, they'll lose
# their MySQL connection.
#
# This hack ensures we re-connect whenever a connection is
# lost. Because, really. why not?
#
# Stick this in RAILS_ROOT/config/initializers/connection_fix.rb (or somewhere similar)
#
# From:
# http://coderrr.wordpress.com/2009/01/08/activerecord-threading-issues-and-resolutions/
@markysharky70
markysharky70 / gist:3970938
Created October 29, 2012 01:46
Install Canon Imageclass MF4530d printer driver in Ubuntu 12.0.4 (64bit)
1. Download printer driver from:
http://www.usa.canon.com/cusa/support/consumer/printers_multifunction/imageclass_series/imageclass_mf4350d#DriversAndSoftware
sudo apt-get install libc6-i386 ia32-libs lib32z1 alien
sudo -i
cp /home/user/Downloads/Linux_UFRII_PrinterDriver_V250_us_EN.tar.gz /opt/
cd /opt
tar xzvf Linux_UFRII_PrinterDriver_V250_us_EN.tar.gz
cd Linux_UFRII_PrinterDriver_V250_us_EN/64-bit_Driver/RPM
ln -s /usr/lib /usr/lib64
Uncaught exception: SyntaxError: Function constructor: failed to compile function
Error thrown at line 22, column 8 in <anonymous function>(str, data) in http://dev.wilsonsdev.com/assets/jquery-fileupload/vendor/tmpl.js?body=1:
var f = !/[^\w\-\.:]/.test(str) ? tmpl.cache[str] = tmpl.cache[str] ||
called from line 22, column 8 in <anonymous function>(str, data) in http://dev.wilsonsdev.com/assets/jquery-fileupload/vendor/tmpl.js?body=1:
var f = !/[^\w\-\.:]/.test(str) ? tmpl.cache[str] = tmpl.cache[str] ||
called from line 11, column 10 in <anonymous function: add>(e, data) in http://dev.wilsonsdev.com/assets/users/images.js?body=1:
data.context = $(tmpl("template-upload", file));
called via Function.prototype.call() from line 277, column 2 in <anonymous function: _trigger>(type, event, data) in http://dev.wilsonsdev.com/assets/jquery-fileupload/vendor/jquery.ui.widget.js?body=1:
return !( $.isFunction(callback) &&
called from line 756, column 16 in <anonymous function: _onAdd>(index, element)
@markysharky70
markysharky70 / gist:4746244
Created February 9, 2013 17:40
How to fix VirtualBox uuid already exists error as shown below: Failed to open the hard disk /media/xxx/XXX.VHD. Cannot register the hard disk '/media/xxx/XXX.VHD' {f9d5c07a-a492-4444-8f63-efb4a4} because a hard disk '/media/xxx/XXX.VHD' with UUID {f9d5c07a-a492-4444-8f63-efb4a4} already exists. Result Code: NS_ERROR_INVALID_ARG (0x80070057) Com…
VBoxManage internalcommands sethduuid XXX.VHD (if not in the current path use full path to .vdh file)
# Gemfile
gem "puma"
# Procfile
web: bundle exec puma -p $PORT -e $RACK_ENV -C config/puma.rb
# add to config block config/environments/production.rb
config.threadsafe!
# get rid of NewRelic after_fork code, if you were doing this:
@markysharky70
markysharky70 / gist:0565ffa040e3bbf58e468065d033cdd0
Created June 3, 2018 17:12
Installing Ruby 2.4.4 on MacOS High Sierra using RUBY_CONFIGURE_OPTS to specify openssl and readline directory locations from homebrew
RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl) --with-readline-dir=$(brew --prefix readline)" rbenv install 2.4.4
@markysharky70
markysharky70 / gist:b473c0de5a375cb79dd1d9dc15f077fe
Created August 10, 2018 16:54
MacOS Finder - Show Full Path In Title Bar
launch a terminal and issue this command:
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true; killall Finder