Skip to content

Instantly share code, notes, and snippets.

View skplunkerin's full-sized avatar
🐰
Working W02K1N6 01110111 01101111 01110010 01101011 01101001 01101110 01100111

Skplunkerin skplunkerin

🐰
Working W02K1N6 01110111 01101111 01110010 01101011 01101001 01101110 01100111
View GitHub Profile
@skplunkerin
skplunkerin / errors.md
Last active August 29, 2015 14:23
rails model error message to sentence
flash[:error] = "#{@post.errors.full_messages.to_sentence}"
@skplunkerin
skplunkerin / message.md
Last active December 6, 2023 05:02
rails custom error message validation without column

Best solution:

http://stackoverflow.com/a/808776/1180523

# model
validates   :email,    :uniqueness => { message: "is wrong" }
validates   :name,    :uniqueness => { message: "Your name is wrong" }

HUMANIZED_ATTRIBUTES = {
  :email => "E-mail address",
  :name => "" # don't include column name in error

How to setup your VMWare Fusion 6 images to use static IP addresses on Mac OS X

At Crush + Lovely, we use Railsmachine's Moonshine to automate the configuration of our servers. When writing our deployment recipes, VMWare Fusion's ability to take snapshots and rollback to these snapshots is a huge timesaver because it takes just seconds to roll a server image to it's original state.

When you're just configuring a single server, having a static IP address for your server image isn't too important, but when you're configuring multi-server setups, it can be useful to duplicate a number of server images and give each a static IP address so you can consistently deploy to them. While not documented well at all, it turns out that this is relatively easy to accomplish in four simple steps.

1. Determine the MAC address of your guest machine

Let's say you have a guest machine with the name ubuntu-lucid-lynx-base

@skplunkerin
skplunkerin / backitup.sh
Created August 3, 2016 16:04 — forked from wyliethomas/backitup.sh
Wylies mysql s3 backup daily backup cron solution
#!/bin/bash
NOWDATE=`date +%Y-%m-%d`
BACKUPNAME="$NOWDATE.sql.gz"
echo "Creating backup of database finances to $BACKUPNAME"
mysqldump --user=[username] --password=[password] [database] | gzip -9 > $BACKUPNAME
echo "Succesfully created database backup"
echo "Uploading backup to Amazon S3 bucket…"
@skplunkerin
skplunkerin / 1-Intro.md
Last active August 26, 2016 15:58
ruby on rails tutorials
@skplunkerin
skplunkerin / scribbles.md
Created August 26, 2016 01:11
ruby on rails local environment recipe
# Install Git and Ruby
$ sudo apt-get install git ruby

# Install Node v5 (or higher)
(https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions)

$ curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -
$ sudo apt-get install -y nodejs build-essential
@skplunkerin
skplunkerin / rails-fix.md
Last active December 20, 2016 18:21
X-Frame-Options to SAMEORIGIN

In application_controller.rb

before_filter :allow_iframe_requests

def allow_iframe_requests
  # allows iframe testing in development
  # http://stackoverflow.com/a/17862331/1180523
  response.headers.delete('X-Frame-Options')
end
@skplunkerin
skplunkerin / ssh-broken-pipe.md
Last active December 16, 2021 02:08
ssh broken pipe fix
@skplunkerin
skplunkerin / readme.md
Last active November 4, 2017 16:33
EC2 server psql postgres postgresql external IP access
@skplunkerin
skplunkerin / vmware-gparted.md
Last active November 8, 2017 17:46
vmware gparted increase disk space