Skip to content

Instantly share code, notes, and snippets.

View mezbahalam's full-sized avatar
🏠

Mezbah Alam mezbahalam

🏠
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Opacity Sample</title>
<style>
.gallery {display:none;}
</style>
<script>
function Gid(id) {

Products

index of products 25 first

curl -i -H "X-Spree-Token: YOUR_TOKEN_ID" http://0.0.0.0:3000/api/products.json

Show a product

curl -i -H "X-Spree-Token: YOUR_TOKEN_ID" http://0.0.0.0:3000/api/products/706676762.json

Modify a product

curl -i -X PUT -H "X-Spree-Token: YOUR_TOKEN_ID" -d "product[name]=Headphones" http://0.0.0.0:3000/api/products/706676762.json

@mezbahalam
mezbahalam / user.rb
Last active May 14, 2018 09:49
rails strong password validator regex
validates :password,
length: { minimum: 10 },
format: { with: /\A(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[\W]).{10,}\z/,
message: "Must contain at least one uppercase letter, one special character, one number and one lowercase letter" }
@mezbahalam
mezbahalam / docker-destroy-all.sh
Last active November 11, 2018 18:55 — forked from JeffBelback/docker-destroy-all.sh
Destroy all Docker Containers and Images
#!/bin/bash
# Stop all containers
docker stop $(docker ps -a -q)
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
# Delete all volume / data
docker volume rm $(docker volume ls -q)
require 'rails_helper'
RSpec.describe TodosController, :type => :controller do
describe "GET #index" do
#describe "POST #create" do
#describe "GET #show" do
#describe "PATCH #update" do (or PUT #update)
#describe "DELETE #destroy" do
#describe "GET #new" do
@mezbahalam
mezbahalam / rspec_model_testing_template.rb
Created May 15, 2019 09:50 — forked from SabretWoW/rspec_model_testing_template.rb
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems:
@mezbahalam
mezbahalam / install_rabbitmq.md
Created August 9, 2019 10:03
install rabbitmq on ubuntu 18

Install RabbitMq on Ubuntu 18

sudo apt-get update
sudo apt-get install erlang  
sudo apt-get install rabbitmq-server  
sudo systemctl enable rabbitmq-server  
sudo systemctl start rabbitmq-server
sudo systemctl status rabbitmq-server  
sudo rabbitmq-plugins enable rabbitmq_management
@mezbahalam
mezbahalam / 1. nginx.conf
Created October 1, 2019 14:02
conflict for multidomain ssl
## /etc/openresty/nginx.conf
user www-data;
events {
worker_connections 1024;
}
http {
lua_shared_dict auto_ssl 1m;
lua_shared_dict auto_ssl_settings 64k;
@mezbahalam
mezbahalam / 1. nginx.conf
Last active August 13, 2021 11:37
ruby on rails multiple custom domains over Https using Openresty and lua (https://www.babar.im/blog/sysadmin/serve-your-saas-customer-domains-over-https-for-free.html)
## /etc/openresty/nginx.conf
user www-data;
events {
worker_connections 1024;
}
http {
lua_shared_dict auto_ssl 1m;
  1. Nginx (/etc/nginx) totally remove kore only Openresty dia server run kora jabe ?

  2. certificate gula create hoe tar location koi ?( /etc/resty-auto-ssl folder e certificate khuje pai na)

  3. current status of my server config https://gist.github.com/mezbahalam/ad4ff7450cecbd0239d44f26a025c874

  4. folder structure & .conf file er kono best practice ase ?

  5. custom certificate kivabe generate kore ?