Skip to content

Instantly share code, notes, and snippets.

View arefaslani's full-sized avatar

Aref Aslani arefaslani

View GitHub Profile
;; MX Records
pinato.ir. 300 IN MX 20 mx2.zoho.com.
pinato.ir. 300 IN MX 10 mx.zoho.com.
;; SPF Records (Sender Policy Framework)
pinato.ir. 300 IN SPF "v=spf1 a:pinato.ir include:zoho.com ~all"
Delivered-To: [email protected]
Received: by 10.182.107.163 with SMTP id hd3csp1561928obb;
Tue, 14 Mar 2017 09:45:31 -0700 (PDT)
X-Received: by 10.223.139.219 with SMTP id w27mr32998479wra.179.1489509930969;
Tue, 14 Mar 2017 09:45:30 -0700 (PDT)
Return-Path: <[email protected]>
Received: from srv1.pinato.ir ([79.175.163.70])
by mx.google.com with ESMTP id s8si15977731wma.24.2017.03.14.09.45.30
for <[email protected]>;
Tue, 14 Mar 2017 09:45:30 -0700 (PDT)
# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
module Peafowl
module Errors
class JSONAPI
attr_accessor :errors
def initialize
@errors = []
end
def add(options={})
raise StandardError unless options[:title]
@arefaslani
arefaslani / direct_uploads_controller.rb
Last active January 14, 2024 07:08
Active Storage's direct uploads controller
# frozen_string_literal: true
# Creates a new blob on the server side in anticipation of a direct-to-service upload from the client side.
# When the client-side upload is completed, the signed_blob_id can be submitted as part of the form to reference
# the blob that was created up front.
class ActiveStorage::DirectUploadsController < ActiveStorage::BaseController
skip_before_action :verify_authenticity_token, :only => [:create]
def create
blob = ActiveStorage::Blob.create_before_direct_upload!(blob_args)
@arefaslani
arefaslani / errors.json
Last active August 8, 2018 14:53
JSON API Errors
{
"errors": [
{
"status": "400",
"source": { "pointer": "/data/attributes" },
"title": "parameter missing",
"detail": "parameter missed or empty: /data/attributes"
}
]
}
@arefaslani
arefaslani / self-signed-cert.md
Created December 29, 2018 09:06
Create Self Signed Certificate

Let's generate the server pass key

$ openssl genrsa -des3 -passout pass:x -out server.pass.key 2048

now generate the server key from the pass key

$ openssl rsa -passin pass:x -in server.pass.key -out server.key

we remove the pass key

$ rm server.pass.key

now let's create the .csr file

@arefaslani
arefaslani / nginx.conf
Created February 20, 2019 07:52
Nginx Express Configuration
server {
access_log /var/log/nginx/access.log upstream_time;
listen 8080;
server_name _;
location / {
# default port, could be changed if you use next with custom server
proxy_pass http://localhost:4000;
@arefaslani
arefaslani / next-images-ignore.js
Created March 12, 2019 06:10
Next Images with ns-ignore
module.exports = (nextConfig = {}) => {
return Object.assign({}, nextConfig, {
webpack(config, options) {
const { isServer } = options;
nextConfig = Object.assign({ inlineImageLimit: 8192, assetPrefix: "" }, nextConfig);
if (!options.defaultLoaders) {
throw new Error(
'This plugin is not compatible with Next.js versions below 5.0.0 https://err.sh/next-plugins/upgrade'
)
@arefaslani
arefaslani / failure-notification-command.txt
Last active April 10, 2019 05:15
Sending notifications with terminal-notifier after success or failure of tests with terminal-notifier in iTerm using iTerm triggers
/usr/local/bin/terminal-notifier -title "RSpec Examples" -message "\1 examples failed" -sound default -appIcon "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAMAAADDpiTIAAAAt1BMVEUAAAD3YmD2YV//XFz3YV/4YV/4YWD3YV/3YV/3YV/3YV/3YV/2Yl/2YV/2YV/2YV/3YV/3YV/3YV/3YWD2YWD3YV/2YWD3YV/2YV/3YWD4YV/3YV/3Yl/3YWD2YWD2Yl/3YmD2YV/3YmD/////+fn3Z2X+7+74cnD6kY/4bGr92Nj7o6L5f336mpn4eXb+5eT9z8/+9PT5hYP5ioj93977tLP8yMj8v778urn7qqn+6en7r678w8P++zBOAAAAInRSTlMAEPoH8y4i5+GxQ4U62bx6wp/tcZrNG8jTZEyNXqdYUmqTCevzWAAAFzxJREFUeNrs3YmWmzAMBVAZs+8EEpaQzf//kW1Pe9pOJ5mGEEC23/0FPEZ6UhgCAAAwn/DTYayT5HhrqlMU5WW77/ZtmUfRqWpux6S4nmPPFwQmkX58TZqo7AJHPccJuvzUJH3sE+hL+nGfVG2gZnDCvCrG9ECgFe+cRKF6Iyc7FQPuAw2IuK72jlqGWzbXFBUCV2JI8kAtL4yKVBKw4o9Np1bktMcLrgIeZFpHgdpCVvUewaa8OnfVlnZRjxZhI+LShIqDLolRE6zNK3JH8eFGPZrE1chLEyh+smNKsDg5VK7iKrjhDCwrrnaKtxD3wGLihvvT/ylM0B2+X8ryvf9IlqAmfCdRd0o35Yje8E3iE6eO73m7G14F84kiU/pqe1wDs8SRnn/8f7gNroFXiZpH1DvX/kww3SHhG/hMFdaYHU/kVbrf/R+5RwwNJ4hzZRynQjHwHDnq1/Q/Jx8I/kfWOiV+U3UXgq/Iq8mP/4c9boEv9Gb0fV9rY4K7Rp0zvylKHIE7zr