Skip to content

Instantly share code, notes, and snippets.

@MichaelMartinez
MichaelMartinez / railsmysql.md
Created June 22, 2012 06:08
Local MySQL rails set-up
#Change host: localhost in config/database.yml to host: 127.0.0.1 to make rails connect over TCP/IP instead of local socket.

development:
  adapter: mysql2
  host: 127.0.0.1
  username: root
  password: xxxx
 database: xxx
@MichaelMartinez
MichaelMartinez / sessions.rb
Created June 21, 2012 17:54
PostgreSQL Casting error
def create
auth = request.env["omniauth.auth"]
user = User.where(:provider => auth['provider'],
:uid => auth['uid']).first || User.create_with_omniauth(auth)
session[:user_id] = user.id
if user.email.blank?
redirect_to edit_user_path(user), :alert => "Please enter your email address."
else
#was redirect to root_url then user_path(user) and now gists_path
redirect_to gists_path, :notice => 'Signed in!'
@MichaelMartinez
MichaelMartinez / chown.md
Created June 21, 2012 07:08
Change Permissions on DIR for brew installs

michaelmartinez in ~ ≥ sudo chown -R whoami /usr/local/share/doc

Set up databases to run AS YOUR USER ACCOUNT with:
    unset TMPDIR
    mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp

To set up base tables in another folder, or use a different user to run
mysqld, view the help for mysqld_install_db:
    mysql_install_db --help
@MichaelMartinez
MichaelMartinez / iTermOutput.md
Created June 21, 2012 06:27
PostgreSQL Install
Last login: Wed Jun 20 16:02:50 on console

michaelmartinez in ~

michaelmartinez in ~
≥ 

michaelmartinez in ~
≥ brew install postgresql 16:04
# Customize to your needs...
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin
export NODE_PATH=/usr/local/lib/node_modules
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
[[ -s "/Users/michaelmartinez/.rvm/scripts/rvm" ]] && source "/Users/michaelmartinez/.rvm/scripts/rvm"
  1. ID on first go; 2864993
  2. ID on second go; 2943172
  3. ID on third go; 2943172
  4. ID on fourth go; 2943172
  5. changed find_or_intialize by to gist instead of ghgistid
dfdsdfsdf
sdfsdfsdfsdf
sdfsdfsdf

The first of many

<%= current_user.name %>
  1. moar
  2. even moar
  3. even even moar

1 2 3 4 5

.area { width: 80%; height: 400px; }