Skip to content

Instantly share code, notes, and snippets.

@vargeorge
vargeorge / gist:8b20488b7d7b6c101b4b
Created September 4, 2014 20:45
Show full path on OS X terminal / iTerm before the $ prompt
1. Edit ~/.bash_profile and add the following line to show full path before the $ prompt.
For example, as user@hostname:path/to/directory$
# show path before the $ prompt
export PS1='\u@\H:\w$ '
2. Save file and restart terminal or run source command
$ source ~/.bash_profile
@vargeorge
vargeorge / gist:2f7a727c64e9a7bb093e
Created August 29, 2014 16:37
How to delete a child records in a One To Many association using Play Framework / Ebean
This looks like bug / hack that's not very obvious. When you remove a childBean and save the parentBean using Ebean, it doesn't seem to delete the corresponding child record from the database.
For example:
partentBean.childBeans.remove(aChildBean)
Ebean.save(parentBean)
=> Expected to see aChildBean record deleted from DB, however the above doesn't delete it
Solution:
@vargeorge
vargeorge / gist:3842072
Created October 5, 2012 20:09
Mac OS X: sudo install_name_tool -change does not work; How to fix it?
Issue:
$ sudo install_name_tool -change completes without errors however running "otool -L shows that the dylib has not been changed.
e.g.
$ sudo install_name_tool -change ~/Download/mysql-5.5.28/libmysql/libmysqlclient.18.dylib /Applications/MAMP/Library/lib/libmysqlclient.18.dylib ~/.rvm/gems/ruby-1.9.3-p194/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle
$ otool -L ~/.rvm/gems/ruby-1.9.3-p194/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle
/Users/username/.rvm/gems/ruby-1.9.3-p194/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle:
/Users/username/.rvm/rubies/ruby-1.9.3-p194/lib/libruby.1.9.1.dylib (compatibility version 1.9.1, current version 1.9.1)
@vargeorge
vargeorge / gist:3841988
Created October 5, 2012 19:54
Mysql2 gem installation on OS X with MAMP installed
Use the following steps if you are looking to reuse MAMP mysql install for your rails app. This is how I set my machine. Hope its useful to others.
Steps:
1. Download mysql source code for the mysql version in your MAMP installation.
a. Find your MAMP version
$ system_profiler SPApplicationsDataType | grep -B5 "MAMP" | awk '/Version/ { print $2 }'
b. Find your MAMP mysql component version
Go to http://www.mamp.info/en/documentation/releases.html to find mysql component
@vargeorge
vargeorge / gist:3768187
Created September 22, 2012 23:19
FIX for Faraday::Error::ConnectionFailed SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
ISSUE:
Ran into this errors when adding Aumniauth with provider strategies such as Google to my rails app on Mac OS X development box. Clicking on 'Sign in with ...' (E.g. Sign in with Google), resulted in an error page:
Faraday::Error::ConnectionFailed
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
Faraday::Error::ConnectionFailed SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
DIAGNOSIS: