Skip to content

Instantly share code, notes, and snippets.

View mdominiak's full-sized avatar

Mateusz Dominiak mdominiak

View GitHub Profile
@mdominiak
mdominiak / .dockerignore
Created August 28, 2022 06:07
Docker configuration for Rails 7
.git
.gitignore
tmp/*
log/*
@mdominiak
mdominiak / login.html
Last active June 15, 2022 09:10
Login page using TailwindCSS
<div class="min-h-screen overflow-auto bg-black text-white">
<h1 class="py-4 text-center">Sign in to ToDo</h1>
<div class="mx-auto max-w-md rounded border border-gray-600 bg-white bg-opacity-5 p-3">
<input type="email" placeholder="Email" class="block w-full rounded border border-gray-500 bg-black p-2 outline-none focus:border-white" />
<input type="password" placeholder="Password" class="mt-2 block w-full rounded border border-gray-500 bg-black p-2 outline-none focus:border-white" />
<input type="submit" value="Sign in" class="mt-3 block w-full cursor-pointer rounded bg-purple-800 p-2 outline-none hover:bg-purple-700 focus:outline focus:outline-1 focus:outline-offset-0 focus:outline-white" />
</div>
</div>
@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
@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 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 / 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 / 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 / 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 / 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 / gist:709913
Created November 22, 2010 12:36
configure nginx to start up on boot
update-rc.d nginx defaults