Skip to content

Instantly share code, notes, and snippets.

View tanvirstreame's full-sized avatar
💻
Superman

Tanvir Islam Streame tanvirstreame

💻
Superman
View GitHub Profile
const stripe = require('stripe')((process.env.STRIPE_PRIVATE_SECRET));
productList.forEach(element => {
line_items.push({
price_data: {
currency: 'usd',
product_data: {
name: element?.name,
},
//here is document with NESTED Array
{
"_id": "xyz-800",
"site": "xyz",
"user": 800,
"timepoints": [
{"timepoint": 0, "a": 1500, "b": 700},
{"timepoint": 2, "a": 1000, "b": 200},
{"timepoint": 4, "a": 3500, "b": 1500}
]
@tanvirstreame
tanvirstreame / gist:8db36b580aced32c004b7a07bc9c7850
Last active May 25, 2020 21:40
programming hero Tareq Rahman task solved
app.get('/product/:key', (req, res) => {
const key = req.params.key;
client = new MongoClient(uri, { useNewUrlParser: true },{useUnifiedTopology: true});
client.connect(err => {
const collection = client.db("onlineStore").collection("products");
collection.findOne({key},(err, documents)=>{
if(err){
console.log(err)
res.status(500).send({message:err});
}
https://github.com/TangentSolutions/DRF-tutorial/wiki/Setting-up-the-project-with-Docker
@tanvirstreame
tanvirstreame / text.py
Created January 21, 2020 21:05
Read text from docx any language via python
import docxpy
import codecs
# read Input file : Input.docx
file = 'text.docx'
# extract text from file
text = docxpy.process(file)
print(text)
@tanvirstreame
tanvirstreame / js object keys
Created September 17, 2019 13:01
js object keys foreach
Object.keys(formValue).forEach(key => {
if (key !== "steve") {
formValueForState[key] = data[key];
}
});
@tanvirstreame
tanvirstreame / next js route query
Last active September 17, 2019 12:40
next js route query enable
static getInitialProps({ query, res }) {
return { query };
}
this.props.query;
@tanvirstreame
tanvirstreame / React js windows top
Created September 17, 2019 12:33
React js windows top
window.scroll({top: 0});