Skip to content

Instantly share code, notes, and snippets.

View skomarfaruque's full-sized avatar

Sk. Omar faruque skomarfaruque

  • Dhaka
View GitHub Profile
// find inside array
let res = await this.state.categories.find(data => {
return data.CategoryName === value
})
// empty object
Object.keys(this.q).forEach(key => {
this.q[key] = ''
})
//merge two objects
Object.assign(obj1,obj2)
//unique number by date
new Date().valueOf()
//file upload with rename
let body = ctx.request.body
let imagename = ctx.params.image
let image = body.files.file
var path = require('path')
const fs = require('fs');
let ext = path.extname(image.name)
image.name = `${imagename}_${ext}`
@skomarfaruque
skomarfaruque / vue
Last active September 15, 2017 04:19
//set in store
this.$store.commit('SET_WEEK_SETUP', this.booking)
// get out put from store
self.$store.state.authUser
//load router
this.$router.push('/dashboard')
//emit send from component
this.$emit('saveMap', this.$data)
chmod -R 777 microback-starter/
var date = moment().format("YYYY-MM-01")
var begin = new Date(moment(date).format("YYYY-MM-01"));
var end = new Date(moment(date).format("YYYY-MM-") + moment(date).daysInMonth());
var result = [];
while (begin <= end) {
console.log('ads')
result.push(begin.toISOString());
begin.setDate(begin.getDate()+1);
}
and query
let getSchedule = await Calendar.find({ $and: [{ start_date: { $gte: date} }, { user: user }, { start_date: { $lt: nextDay} }] })