Skip to content

Instantly share code, notes, and snippets.

View pritam3010's full-sized avatar

Pritam Kumar pritam3010

View GitHub Profile
@pritam3010
pritam3010 / nodejs-csv-export.js
Created October 28, 2021 06:31 — forked from chris-burkhardt/nodejs-csv-export.js
Export CSV File - React/Javascript
import { zipObject } from 'lodash';
export const CSVExport = csvData => {
const { items, headers, filename } = csvData;
// use headers if available, if not, use the key names for headers
// updated to create same type with zipped object
const headerKeys = Object.keys(items[0]);
const rowHeader = headers || zipObject(headerKeys, headerKeys);
@pritam3010
pritam3010 / NodeJS-base64encodedimage-to-S3.txt
Created October 27, 2021 03:39 — forked from chris-burkhardt/NodeJS-base64encodedimage-to-S3.txt
JS Upload Base64 Encoded Image to AWS S3 Bucket
'use strict'
const AWS = require("aws-sdk");
const S3 = new AWS.S3();
module.exports = async function (inputs, context) {
// example encoded images can be created here: https://www.base64-image.de/
// upload image to S3
try {
const s3BucketLocation = await uploadImageToS3(inputs.DeviceDiagnosticRequest.IMEIImage, "IMEIImage", inputs, context);
} catch (error) {
@pritam3010
pritam3010 / NodeJS-base64encodedimage-to-S3.txt
Created October 27, 2021 03:39 — forked from chris-burkhardt/NodeJS-base64encodedimage-to-S3.txt
JS Upload Base64 Encoded Image to AWS S3 Bucket
'use strict'
const AWS = require("aws-sdk");
const S3 = new AWS.S3();
module.exports = async function (inputs, context) {
// example encoded images can be created here: https://www.base64-image.de/
// upload image to S3
try {
const s3BucketLocation = await uploadImageToS3(inputs.DeviceDiagnosticRequest.IMEIImage, "IMEIImage", inputs, context);
} catch (error) {
@pritam3010
pritam3010 / FileUpload.js
Created August 5, 2021 04:16 — forked from nyx-code/FileUpload.js
This NodeJS API which will upload files onto the AWS S3 Bucket. Video -> https://youtu.be/TtuCCfren_I
require('dotenv/config')
const express = require('express')
const multer = require('multer')
const AWS = require('aws-sdk')
const uuid = require('uuid/v4')
const app = express()
const port = 3000
@pritam3010
pritam3010 / socialSharePopups.js
Created July 24, 2021 12:40 — forked from ouelletv/socialSharePopups.js
Facebook & Twitter Share Popup Windows
export default function() {
document.querySelectorAll('.js-share-facebook-link').forEach(function(el){
el.addEventListener('click', function(e){
var href = e.target.href;
e.preventDefault();
window.open(href, "Facebook", "toolbar=no,location=0,status=no,menubar=no,scrollbars=yes,width=600,height=400,resizable=1");
})
});
@pritam3010
pritam3010 / socialSharePopups.js
Created July 24, 2021 12:38 — forked from josephabrahams/socialSharePopups.js
Facebook & Twitter Share Popup Windows
(function($) {
$('.js-share-twitter-link').click(function(e) {
e.preventDefault();
var href = $(this).attr('href');
window.open(href, "Twitter", "height=285,width=550,resizable=1");
});
$('.js-share-facebook-link').click(function(e) {
e.preventDefault();
var href = $(this).attr('href');
window.open(href, "Facebook", "height=269,width=550,resizable=1");
<?php
/*
* MySQL Mass Find and Replace
* Author: Lee Woodman - https://www.linkedin.com/in/leewoodman
* License: GNU
*/
// Connect to your MySQL database.
$hostname = "localhost";
$username = "root";
@pritam3010
pritam3010 / webhook.php
Created July 23, 2021 09:38 — forked from visitdigital/webhook.php
Very Simple Facebook Chat Bot PHP Webhook Script Example
<?php
$challenge = $_REQUEST['hub_challenge'];
$verify_token = $_REQUEST['hub_verify_token'];
// Set this Verify Token Value on your Facebook App
if ($verify_token === 'testtoken') {
echo $challenge;
}
$input = json_decode(file_get_contents('php://input'), true);
@pritam3010
pritam3010 / post-receive.sh
Created October 12, 2020 14:08 — forked from benfrain/post-receive.sh
post-receive hook for multiple branches
#!/bin/bash
while read oldrev newrev ref
do
branch=`echo $ref | cut -d/ -f3`
if [ "master" == "$branch" ]; then
git --work-tree=./path/under/root/dir/live-site/ checkout -f $branch
echo 'Changes pushed live.'
fi
@pritam3010
pritam3010 / eslint_prettier_airbnb.md
Created February 19, 2020 19:47 — forked from bradtraversy/eslint_prettier_airbnb.md
ESLint, Prettier & Airbnb Setup

VSCode - ESLint, Prettier & Airbnb Setup

1. Install ESLint & Prettier extensions for VSCode

Optional - Set format on save and any global prettier options

2. Install Packages

npm i -D eslint prettier eslint-plugin-prettier eslint-config-prettier eslint-plugin-node eslint-config-node