apt-get -y update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties vim mc ImageMagick
# nginx
add-apt-repository ppa:nginx/stable
apt-get -y update
apt-get -y install nginx
This file contains hidden or 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 lsof | grep AppName | grep -v Applications |
This file contains hidden or 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
(Math.random() + 1).toString(36).substring(2); |
This file contains hidden or 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
Photoset.includes(:photos).where(photos: {photoset_id: nil}) |
This file contains hidden or 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
$ -> | |
token = $('meta[name="csrf-token"]').attr('content') | |
$.ajaxPrefilter (options, originalOptions, xhr) -> | |
xhr.setRequestHeader('X-CSRF-Token', token) |
This file contains hidden or 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 service nginx configtest | |
* Testing nginx configuration [fail] | |
sudo nginx -t | |
nginx: [emerg] could not build the server_names_hash, you should increase server_names_hash_bucket_size: 32 | |
nginx: configuration file /etc/nginx/nginx.conf test failed | |
server_names_hash_bucket_size = 64 | |
sudo service nginx restart |
This file contains hidden or 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
str = "number 5" | |
str.gsub(/number\ (\d+)/, '#\1') | |
# => "#5" |
This file contains hidden or 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 vsftpd | |
sudo vim /etc/vsftpd.conf | |
# Uncomment #local_umask=022 | |
sudo service vsftpd restart |
This file contains hidden or 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
unless Rails.env.production? | |
connection = ActiveRecord::Base.connection | |
connection.tables.each do |table| | |
connection.execute("TRUNCATE #{table}") unless table == "schema_migrations" | |
end | |
sql = File.read('db/import.sql') | |
statements = sql.split(/;$/) | |
statements.pop |
This file contains hidden or 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 Admin::SizesController < Admin::AdminController | |
include OrderableController | |
end |