Skip to content

Instantly share code, notes, and snippets.

Avatar
💡
Side project https://www.laptoplist.com

Ariful Haque arifulhb

💡
Side project https://www.laptoplist.com
View GitHub Profile
@arifulhb
arifulhb / fibonacci.js
Created Oct 9, 2020
Print Fibonacci series using recursive function
View fibonacci.js
function fib(num) {
let sequence = [0, 1]
function helper(sequence, num) {
const length = sequence.length
// get sum of last two numbers
let sum = sequence[length - 1] + sequence[length - 2]
@arifulhb
arifulhb / amazon-pa-api5-getItemById
Created Oct 27, 2019
Amazon-PA-API50-getItemById
View amazon-pa-api5-getItemById
let resourceList = resources.getItemInfo
resourceList = resourceList
.concat(resources.getImagesPrimary)
api.getItemById(['B079JD7F7G'], {
parameters: resourceList,
condition: condition.Any
}).then((response) => {
console.log(' ===== find by Item ids =====')
console.log('data', response.data)
@arifulhb
arifulhb / Amazon-PA-API50-Credentials
Last active Oct 27, 2019
Amazon-PA-API50: Credentials
View Amazon-PA-API50-Credentials
myConfig.accessKey = '<ACCESS_KEY>'
myConfig.secretKey = '<SECRET_KEY>'
myConfig.partnerTag = '<PARTNER_TAG>'
const api = new Api(myConfig)
@arifulhb
arifulhb / amazon-pa-api50-config
Created Oct 27, 2019
Amazon-pa-api50: Create Config instance
View amazon-pa-api50-config
// By Default all resources and will connect to United States
let myConfig = new Config();
// if you want other country then united states.
let myConfig = new Config(undefined, country.UnitedKingdom);
// if you want custom resources.
// this custom `resources.Offers` will be set default to all of your search. You can customize the resources in your search specific function also.
let myConfig = new Config(resources.Offers);
// if you want custom resources with different country
let myConfig = new Config(resources.ItemInfo, country.Canada);
View amazon-pa-api50-optional-loading
const resources = require('amazon-pa-api50/lib/options').Resources // Optional for different resources
const condition = require('amazon-pa-api50/lib/options').Condition // for product condition
const country = require('amazon-pa-api50/lib/options').Country // Optional for different country
const searchIndex = require('amazon-pa-api50/lib/options').SearchIndex // for Search Index
@arifulhb
arifulhb / amazon-pa-api50-connect
Created Oct 27, 2019
Connect with Amazon Product Affiliate API
View amazon-pa-api50-connect
const Api = require('amazon-pa-api50')
const Config = require('amazon-pa-api50/lib/config')
@arifulhb
arifulhb / install.sh
Last active May 21, 2019
Nginx and PHP-7.2 insall in AWS EC2 Ubuntu 18.04 instance via User Data
View install.sh
#!/bin/bash
sudo apt-get update
sudo apt-get install nginx -y
sudo apt-get install memcached -y
sudo apt install php7.2 php7.2-fpm php7.2-mysql php-common php7.2-cli php7.2-common php7.2-json php7.2-opcache php7.2-readline php7.2-mbstring php7.2-xml php7.2-gd php7.2-curl php-redis php-apcu php-memcached php-memcache -y
sudo apt-get install mysql-client -y
@arifulhb
arifulhb / blog.conf
Created Mar 30, 2019
Nginx Default blog config file
View blog.conf
server {
listen 80;
// @todo Change from localhost to blog.local
server_name localhost;
// @todo Change root from /var/www/html to /var/www/blog
root /var/www/html/;
index index.php index.html index.htm;
@arifulhb
arifulhb / docker-composer.yml
Created Mar 30, 2019
Nginx image and volume for Docker
View docker-composer.yml
nginx:
build:
context: ./images/nginx
dockerfile: Dockerfile
container_name: lempdock_nginx_1
ports:
- "80:80"
- "443:443"
volumes:
- ./www:/var/www
@arifulhb
arifulhb / docker-composer.yml
Created Mar 30, 2019
Volumes in docker-composer.yml
View docker-composer.yml
mysql:
volumes:
- ./data/mysql:/var/lib/mysql
redis:
volumes:
- ./data/redis:/data/redis