This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install git | |
sudo apt-get install nginx | |
sudo apt-get install nodejs | |
sudo apt-get install imagemagick | |
sudo apt-get install libpq-dev #postgres ext lib required | |
sudo apt update | |
sudo apt-get install libmagick++-dev #imagemagick dependency | |
# Installing Ruby using .rbenv | |
sudo apt install git curl autoconf bison build-essential \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Daily backup at 2 a.m. | |
0 2 * * * /root/scripts/postgres_backup.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -x | |
export PGPASSWORD=myPGPassword | |
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | |
#Script Begin | |
DATE=`date +%d_%m_%Y_%H_%M` | |
if ! /usr/bin/pg_dump -O -U postgres -h localhost project_production -f /root/backups/postgres/daily/project_production_pg_$DATE.sql; then | |
/bin/echo "#########################################################" >> /var/log/postgres_backup.log | |
/bin/echo "Postgres Backup backup failed on `date +%d-%m-%Y`" >> /var/log/postgresql_backup.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get '/tmp/:page' => 'tmp#index' | |
get '/tmp/:page/:inner_page' => 'tmp#index' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage YearRange.new(2).range_string | |
# "1990-1991 | 2011-2013" | |
class YearRange | |
def initialize(range = 1) | |
@range = range | |
@years = (1980..2015).to_a | |
end | |
def collect | |
divide_factor = @years.size/@range |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme", | |
"draw_white_space": "all", | |
"font_size": 11, | |
"ignored_packages": | |
[ | |
"Vintage" | |
], | |
"margin": 2, | |
"rulers": |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# autoload concerns | |
module YourApp | |
class Application < Rails::Application | |
config.autoload_paths += %W( | |
#{config.root}/app/controllers/concerns | |
#{config.root}/app/models/concerns | |
) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#resetting the password of postgresql | |
sudo -u postgres psql postgres | |
postgres=# \password postgres | |
# restoring postgres dump database | |
pg_restore -c -i -U postgres -h localhost -d database_name -v "dump_file" -W | |
pg_restore --verbose --host localhost --username postgres --clean --no-owner --no-acl --dbname database_name dump_file.dump | |
# for mac: full path is required. | |
Applications/Postgres.app/Contents/Versions/9.4/bin/pg_restore -c -i -U postgres -h localhost -d database_name -v "dump_file" -W |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function displayVideo(elementID, options) { | |
var defaults; | |
defaults = { | |
height: 347, | |
width: 624, | |
swfPath: '/jwplayer/jwplayer.flash.swf', | |
controls: false, | |
autostart: true | |
}; | |
var settings = $.extend({}, defaults, options); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BaseCreator < Creators::Base | |
EXTRA_PARAMS = [:action, :controller, :format,:utf8,:authenticity_token] | |
def initialize(raw_params, model) | |
super(raw_params,model) | |
end | |
def refine_params | |
@params.deep_symbolize_keys.delete_if{|k,v| EXTRA_PARAMS.include? k } |