Skip to content

Instantly share code, notes, and snippets.

View siumhossain's full-sized avatar
🥱
?

sium_hossain siumhossain

🥱
?
View GitHub Profile
@siumhossain
siumhossain / 1.js
Last active May 29, 2023 07:20
update specific portion of array after submitting post request in next js
const submitComment = async (e, id) => {
e.preventDefault();
const data = {
comment: commentData,
article: id
}
await axios.post(`${process.env.NEXT_PUBLIC_ROOT_URL}/api/v1/article_comment/`, data, {
headers: { Authorization: `Token ${token}` },
})
.then(res => {
@siumhossain
siumhossain / country_information.csv
Created February 2, 2023 19:15
country_name,country_code,timezones(utc),currency,capital,continent,phone-code etc
name code phone-code continent capital currency timezones
Afghanistan AF 93 Asia Kabul Afghani UTC +04:30
Albania AL 355 Europe Tirana Lek UTC +01:00
Algeria DZ 213 Africa Algiers Dinar UTC +01:00
American Samoa AS 1-684 Oceania Pago Pago Dollar UTC -11:00
Andorra AD 376 Europe Andorra la Vella Euro UTC +01:00
Angola AO 244 Africa Luanda Kwanza UTC +01:00
Anguilla AI 1-264 North America The Valley Dollar UTC -04:00
Antarctica AQ 672 Antarctica None None UTC +11:00
Antigua and Barbuda AG 1-268 North America St. John's Dollar UTC -04:00
@siumhossain
siumhossain / 1.md
Created July 25, 2022 05:48
fiex top and bottom anythig css
.fixed-top {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 1030;
}

.fixed-bottom {
@siumhossain
siumhossain / 1.md
Created July 23, 2022 06:43
kill any running process inside any port in linux (bash terminal)

Check what kind of process running in specific port by

lsof -i:<port_number>
kill $(lsof -i:<port_number>)
@siumhossain
siumhossain / 1.css
Last active July 15, 2022 13:52
css responsive
/* extra small */
/* @media (min-width: 320px) and (max-width: 575px){
} */
/* extra small end*/
/* small device */
/* @media (min-width: 576px) and (max-width: 767px){
} */
@siumhossain
siumhossain / 1.md
Created June 8, 2022 05:27
create link from title

take title valye from product title and put - between space and push to new url

 methods:{
       product(value){
           console.log(value)
           const title = value.title
            const clearTitle = title.replaceAll(' ','-')
            console.log(clearTitle)
            this.$router.push({
 path:`/${clearTitle}/`,
@siumhossain
siumhossain / ex.md
Last active May 14, 2022 09:48
remove under score, remove two slash from both side and remove specific word from start
const route = this.$router.history.current.path
const removeUnderScoretitle = route.split('_').join(' ')
const removeAllSlash = removeUnderScoretitle.replace(/\\|\//g,'')
const title = removeAllSlash.replace('category','')
console.log(title)
@siumhossain
siumhossain / tutorial.md
Created May 12, 2022 11:16
regular expression to extract source url from iframe

extract source url and save in database

def save(self,*args,**kwargs):
        link = self.embeddedLink
        pattern = r"<iframe[^>]*src=[\"|']([^'\"]+)[\"|'][^>]*>"
        newLink = re.findall(pattern,link)[0]
        self.embeddedLink = newLink
        super().save(*args,**kwargs)
@siumhossain
siumhossain / tutorial.md
Created May 12, 2022 11:11
remove underscore and 2 slash from both side dynamic url vue/Nuxt
      const route = this.$router.history.current.path
      const title = route.split('_').join(' ')
      const finalTitle = title.replace(/\\|\//g,'')
      console.log(finalTitle)
      return finalTitle;
@siumhossain
siumhossain / 1.md
Created May 11, 2022 09:14
clear space and replace under score for making link

function to clear under score

thumbnailClick(value){
            const title = value.title
            const clearTitle = title.replaceAll(' ','_')
            this.$router.push({
                path:`${clearTitle}/`
 })