Skip to content

Instantly share code, notes, and snippets.

View damuz91's full-sized avatar
🎯
Focusing

David Muñoz damuz91

🎯
Focusing
View GitHub Profile
class User < ActiveRecord::Base
Statuses = {inactive: 0, active: 1, suspended: 2, deleted: 3}
def self.statuses_for_select
{
"Active" => Statuses[:active],
"Inactive" => Statuses[:inactive],
"suspended" => Statuses[:suspended],
"Deleted" => Statuses[:deleted]
}
class User < ActiveRecord::Base
Statuses = {inactive: 0, active: 1, suspended: 2, deleted: 3}
end
class User < ActiveRecord::Base
ACTIVE = 1
INACTIVE = 0
SUSPENDED = 2
DELETED = 3
end
@damuz91
damuz91 / mysql_db_backup.sh
Created April 26, 2017 13:22
Script for auto backing up a mysql db, gzip it and upload to Amazon S3
#!/bin/bash
DBNAME=mydb
USER="david"
PASSWORD='mypassword123'
DATE=`date +"%Y%m%d"`
SQLFILE=$DBNAME-${DATE}.sql
BUCKETNAME=my-aws-bucket-name
cd
echo "Starting with the following data:"