Skip to content

Instantly share code, notes, and snippets.

View rusllonrails's full-sized avatar
💭
👨‍💻 💻 🖱️ 🍻 🏋️‍♂️

rusllonrails rusllonrails

💭
👨‍💻 💻 🖱️ 🍻 🏋️‍♂️
  • Tbilisi, Georgia
View GitHub Profile
@rusllonrails
rusllonrails / Heroku Rails getting "Can't verify CSRF token authenticity" even if csrf toke in present
Created February 7, 2017 15:15
Heroku Rails getting "Can't verify CSRF token authenticity" even if csrf toke in present
Myapp::Application.config.session_store :cookie_store, key: '_myapp_session',:domain => :all
to
Myapp::Application.config.session_store :cookie_store, key: '_myapp_session'
@rusllonrails
rusllonrails / CRON GUIDE
Last active December 23, 2016 10:39
CRON GUIDE
https://help.ubuntu.com/community/CronHowto
00 00 * * * ruby path/to/your/script.rb
Syntax:
mm hh dd mt wd command
mm minute 0-59
hh hour 0-23
dd day of month 1-31
@rusllonrails
rusllonrails / Решетки радиатора на Genesis Coupe
Last active May 6, 2016 12:34
Решетки радиатора на Genesis Coupe
http://k-tuning.com/genesisc?bfilter=f3:18;
http://tuningleader.ru/category/genesis-coupe-/
http://k-tuning.com/genesisc/reshetka-radiatora-hyundai-genesis-coupe-roadruns.html
http://tuningleader.ru/product/reshetka-radiatora-roadruns_1y/
http://k-tuning.com/genesisc/reshetka-radiatora-type-d-hyundai-genesis-coupe-m-and-s.html
http://www.aliexpress.com/price/genesis-coupe-grill_price.html
http://www.aliexpress.com/popular/genesis-front-grill.html
@rusllonrails
rusllonrails / MYSQL query to file
Created March 31, 2016 12:11
MYSQL query to file
http://zetcode.com/databases/mysqltutorial/exportimport/
@rusllonrails
rusllonrails / MYSQL REMOTE ACCESS
Created March 3, 2016 18:40
MYSQL REMOTE ACCESS
To expose MySQL to anything other than localhost you will have to have the following line uncommented in /etc/mysql/my.cnf and assigned to your computers IP address and not loopback
#Replace xxx with your IP Address
bind-address = xxx.xxx.xxx.xxx
Or add a bind-address = 0.0.0.0 if you don't want to specify the IP
Then stop and restart MySQL with the new my.cnf entry. Once running go to the terminal and enter the following command.
lsof -i -P | grep :3306
That should come back something like this with your actual IP in the xxx's
@rusllonrails
rusllonrails / MYSQL upgrade with existing dbs
Created March 3, 2016 17:27
MYSQL upgrade with existing dbs
First make a backup of your /var/lib/mysql/ directory just to be safe.
sudo mkdir /home/<your username>/mysql/
cd /var/lib/mysql/
sudo cp * /home/<your username>/mysql/ -R
Next purge MySQL (this will remove php5-mysql and phpmyadmin as well as a number of other libraries so be prepared to re-install some items after this.
sudo apt-get purge mysql-server-5.1 mysql-common
Remove the folder /etc/mysql/ and it's contents
@rusllonrails
rusllonrails / CHEF upgrade from 11 to 12
Created March 3, 2016 13:48
CHEF upgrade from 11 to 12
# 1 Remove old chef
```
sudo rm -rf chef-solo/
sudo rm -rf /opt/chef
sudo apt-get remove chef
sudo apt-get remove chef-server-core
```
# 2 Install new chef
bundle exec knife solo prepare <IP ADDRESS> -x root --bootstrap-version=12
@rusllonrails
rusllonrails / HOW TO SETUP RACKSPACE_TEMP_URL_KEY
Created January 29, 2014 09:49
HOW TO SETUP RACKSPACE_TEMP_URL_KEY
$ curl -v -H "X-Auth-User: <your_rackspace_username>" -H "X-Auth-Key: <your_rackspace_api_key>" https://auth.api.rackspacecloud.com/v1.0
* About to connect() to auth.api.rackspacecloud.com port 443 (#0)
* Trying 67.192.1.11... connected
* Connected to auth.api.rackspacecloud.com (67.192.1.11) port 443 (#0)
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
@rusllonrails
rusllonrails / Scopes Best Practices
Created January 28, 2014 10:51
Scopes Best Practices
scope :with_specialties, -> (specialty_ids) {
joins(:specialties).
where("specialties.id IN (?)", specialty_ids).
group("users.id")
}
scope :for_specialty_id, -> (specialty_id) {
user_ids = UserAndSpecialty.for_specialty_id(specialty_id).select(:user_id)
where id: user_ids
}
@rusllonrails
rusllonrails / convention for scopes naming:
Created January 28, 2014 10:44
convention for scopes naming:
One more thing, it would be great to follow convention for scopes naming:
# filter scopes
scope for_gender, ...
# order scopes
scope by_gender, ...