Skip to content

Instantly share code, notes, and snippets.

View arslanaly47's full-sized avatar

Arslan Ali arslanaly47

View GitHub Profile
phraseapp pull
require 'openssl'
require 'base64'
aes = OpenSSL::Cipher::AES256.new(:CBC)
aes.encrypt
key = aes.random_key
iv = aes.random_iv
Here's the public key given to me: `MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAl2uzoWA2iEGfeqDYO4XA0mQV8odb6qgdLT0T/k1PsbviMMt+SlAnZpwDkPlFySxNejOv8zAUHwDTWV7NGpYA0y+TrrBLkGGl9uUrzOjQLryJmFWsXxBGFd4emYXYBzROaH+r7pzhK7mIWLw1e2Cj5RL9Ac6wKA56axqCr2UZRNDBcS5A+nKTQTWy5eTrq6EQSBA6Hr81UWtYwlNSo1YbZ9JSNdD75Go7Du/zv1iPI+wWr7tMp0AJVBmieeB0kryXl+8zhli80wa72hDtyTkmfkBJAid5Il1biTrOXtMDaqXdfi9s4xzFp/ilP17KnA+VeAH2eLcqaC6LkEp/A1LApwIDAQAB`
I build a file with an extension of `.pem`, consisting of the public key in the following format:
-----BEGIN PUBLIC KEY-----
...
-----END PUBLIC KEY-----
After that,
@arslanaly47
arslanaly47 / rules.txt
Created September 22, 2017 18:39
Rules to follow for Ruby on Rails development
Followings are the basic rules to follow while building for Rails platform.
1) Write the logic in appropriate component, and avoid creating god classes: classes with more than 100 lines of code.
2) Write the database related stuff in model, and view related stuff in views. Controllers' job should be to connect both.
3) If a model has too much functionality, create multiple modules, and include them inside a model, instead of filling the model with all the functionalty.
4) Try to keep the controllers skinny.
5) Write funtionality that is portable across Web components as well as API components.
6) Make sure that the routes are following the RESTful schema. Avoid having the words like CREATE, UPDATE, DESTROY in the routes. Use HTTP Verbs for these purposes. For more info: https://code.tutsplus.com/tutorials/a-beginners-guide-to-http-and-rest--net-16340
7) Use the methods provided by Rails whereever it's possible. Avoid repeating too much code.
8) Use whitelisting the params, instead of manually assigning the p
GEM
remote: https://rubygems.org/
specs:
RedCloth (4.2.9)
actionmailer (3.2.21)
actionpack (= 3.2.21)
mail (~> 2.5.4)
actionmailer-with-request (0.4.0)
rails (>= 3)
actionpack (3.2.21)