Skip to content

Instantly share code, notes, and snippets.

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

rusllonrails rusllonrails

💭
👨‍💻 💻 🖱️ 🍻 🏋️‍♂️
  • Tbilisi, Georgia
View GitHub Profile
@rusllonrails
rusllonrails / POSTGRESQL TRICKS
Created August 7, 2015 17:07
POSTGRESQL TRICKS
```
PostgreSQL SQL Tricks I
```
http://postgres.cz/wiki/PostgreSQL_SQL_Tricks_I
```PostgreSQL SQL Tricks II
```
http://postgres.cz/wiki/PostgreSQL_SQL_Tricks_II
```PostgreSQL SQL Tricks III
@rusllonrails
rusllonrails / Sendgrid Helper
Created August 4, 2015 17:01
Sendgrid Helper
https://github.com/ministryofjustice/prison-visits/search?utf8=%E2%9C%93&q=SendgridHelper
@rusllonrails
rusllonrails / Remove from email from invalid AWS SES list
Created August 4, 2015 15:33
Remove from email from invalid AWS SES list
http://docs.aws.amazon.com/ses/latest/DeveloperGuide/remove-from-suppression-list.html
@rusllonrails
rusllonrails / SLIM EMAIL PROBLEM with missing breaks
Created August 3, 2015 14:20
SLIM EMAIL PROBLEM with missing breaks
Need to add data-force-encoding="✓" for body in custom layout
Like:
body data-force-encoding="✓"
@rusllonrails
rusllonrails / USEFULL LIMITS
Last active August 29, 2015 14:26
USEFULL LIMITS
1) URL length - 2000 characters.
2) EMail content 550 Maximum line length
RFC 821 states the maximum line lengths for SMTP transmissions:
command line
The maximum total length of a command line including the
command word and the <CRLF> is 512 characters.
reply line
@rusllonrails
rusllonrails / GIT: How to pull from branch if someone force pushed to it and you already have local version
Created July 30, 2015 07:00
GIT: How to pull from branch if someone force pushed to it and you already have local version
1)
git reset --hard origin/your_branch
2)
git branch -D your_branch
git fetch origin
git checkout -b your_branch origin/your_branch
git pull origin your_branch
@rusllonrails
rusllonrails / POSTGRESQL JSONB USEFULL FUNCTIONS
Last active August 29, 2015 14:23
POSTGRESQL JSONB USEFULL FUNCTIONS
1) Check if array 'risk_phrases' in 'doc' jsonb column is not empty
(doc -> 'risk_phrases')::text <> '[]'::text
2) Check if key 'name' in 'doc' jsonb column is not blank
(doc ->> 'name')::text <> '{}'::text
3) Check if array 'supplier_ids' in 'doc' jsonb column contain at least of one element from array ['bar', 'goo', 'foo']
(doc -> 'supplier_ids')::jsonb ?| array['bar', 'goo', 'foo']
4) Check if key 'type' in 'doc' jsonb column has defined "Vasa" value:
@rusllonrails
rusllonrails / Ubuntu enable SSH manually
Last active August 29, 2015 14:23
Ubuntu enable SSH manually
sudo ufw enable
sudo ufw allow 22/tcp
sudo ufw status
@rusllonrails
rusllonrails / CRON SET LOG LEVEL
Created June 9, 2015 09:36
CRON SET LOG LEVEL
1)
You can edit the cron init script (/etc/init/cron.conf) as follow:
```
# cron - regular background program processing daemon
#
# cron is a standard UNIX program that runs user-specified programs at
# periodic scheduled times
description "regular background program processing daemon"
@rusllonrails
rusllonrails / Fastfix (tested on Ubuntu 15.04)
Created June 5, 2015 15:19
Fastfix (tested on Ubuntu 15.04)
mv ~/.local/share/Steam/ubuntu12_32/steam-runtime/i386/lib/i386-linux-gnu/libgcc_s.so.1{,.disable}
mv ~/.local/share/Steam/ubuntu12_32/steam-runtime/i386/usr/lib/i386-linux-gnu/libstdc++.so.6{,.disable}