Skip to content

Instantly share code, notes, and snippets.

View mdominiak's full-sized avatar

Mateusz Dominiak mdominiak

View GitHub Profile
@mdominiak
mdominiak / gist:708015
Created November 20, 2010 18:02
generate public and private ssh keys on ubuntu
mkdir ~/.ssh
chmod 700 ~/.ssh
ssh-keygen -t rsa
@mdominiak
mdominiak / gist:709868
Created November 22, 2010 12:03
create mysql database and user
create database new_vegas_prod default character set utf8;
grant all privileges on new_vegas_prod.* to new_vegas_prod@localhost identified by 'pass';
@mdominiak
mdominiak / gist:709913
Created November 22, 2010 12:36
configure nginx to start up on boot
update-rc.d nginx defaults
@mdominiak
mdominiak / deploy.rb
Created November 22, 2010 13:00
capistrano script for deployment
set :application, "new-vegas"
set :repository, "git@github.com:mdominiak/new-vegas.git"
set :scm, :git
set :host, "newvegas.vault106.com"
set :user, "deploy"
set :use_sudo, false
set :deploy_to, "/home/deploy/new-vegas/production"
role :web, host
@mdominiak
mdominiak / nginx
Created November 22, 2010 13:07
nginx start up script for ubuntu
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
@mdominiak
mdominiak / gist:725069
Created December 2, 2010 10:07
error_messages_for
def error_messages_for(resource)
return "" if resource.errors.empty?
messages = resource.errors.full_messages.map { |msg| content_tag(:li, msg) }.join
sentence = "Please fix the following errors:"
html = <<-HTML
<div class="error_explanation">
<div class="title">#{sentence}</div>
<ul>#{messages}</ul>
@mdominiak
mdominiak / postgres.rdoc
Created September 16, 2011 20:36
Setting up and Using PostgreSQL for Ruby on Rails development on OS X

Installation

brew update
brew install postgresql

Create a database:

initdb /usr/local/var/postgres

If this is your first install, automatically load on login with:

mkdir -p ~/Library/LaunchAgents
@mdominiak
mdominiak / Ruby vs. Java
Last active October 22, 2018 14:32
Ruby vs. Java comparison
Ruby is terse. Getters and setters example.
Java:
Class Circle {
private Coordinate center, float radius;
public void setCenter(Coordinate center) {
this.center = center;
}
public Coordinate getCenter() {
@mdominiak
mdominiak / smoothing.sh
Created March 7, 2014 09:07
Enable font smoothing on Lion when using external LCD
defaults -currentHost write -globalDomain AppleFontSmoothing -int 2
@mdominiak
mdominiak / ruby-install.sh
Created September 26, 2014 08:06
Install the lastest ruby with rbenv on OS X
# Assumptions: rbenv and ruby-build installed with brew
# Update brew formulas
brew update
# Upgrade rbenv and ruby-build
brew upgrade rbenv ruby-build
# List available ruby versions
rbenv install --list