Responsive Ad Area

Large Category

<React.Fragment> with ts(2605) in VScode with checkJs enabled

I wanted to use JS type checking capability inside VScode. Everything works like charm but React.Fragment is linted with error: JSX element type 'ReactElement<any>' is not a constructor function for JSX elements. Type 'ReactElement<any>' is missing the following properties from type 'Element': nodeName, attributes, childrents(2605) And this is not all, even imported components from material-ui show simillar ts(2605) error. My jsconfig.json is: { "compilerOptions": { "module": "commonjs", "checkJs": true, "target": "esnext", "jsx": "react", "allowSyntheticDefaultImports": true }, "include": [ "./**/*" ] } Can someone help me please to find out what am I doing wrong? Thanks. <React.Fragment> with ts(2605) in VScode with checkJs enabled <React.Fragment> wi...

How to convert hash to string in javascript?

i used https://www.npmjs.com/package/bcrypt to generate hash from input password in react-js. in my user model: let mongoose = require('mongoose') const bcrypt = require('bcrypt') let UserSchema = new mongoose.Schema({ firstName: { type: String, default: '' }, lastName: { type: String, default: '' }, username: { type: String, default: '' }, email: { type: String, required: true, unique: true, default: '' }, role: { type: String, default: '' }, password: { type: String, default: '' } }, { timestamps: true }) UserSchema.methods.generateHash = function(password) { return bcrypt.hashSync(password, bcrypt.genSaltSync(8), null) }; UserSchema.methods.validPassword = function(password) { return bcrypt.compareSync(password, this.password) }; UserSchema.pre('save', function(next) { this.password = b...

setting sidebar colors in a custom vscode theme

I’m making my first vscode custom theme and I’m confused about why I can set the sidebar colors in my user settings json file, like so: "workbench.colorCustomizations": { "sideBar.background": "#062902", "sideBar.foreground": "#c6c79f", "sideBarSectionHeader.background": "#d17600", "sideBarSectionHeader.foreground": "#102F97", "activityBar.border": "#3700fd", "badge.background": "#81CA91" } but, in the actual theme file json, I don’t know where to add this. It doesn’t take effect in the colors object and I’m not sure how I would format it under the tokencolors objects (what the scope and settings would be). If anyone has any tips or can point me toward documentation that would be great. setting sidebar colors in a custom vscode theme setting sideb...

Make an Absolute positioned carousel responsive

I have a carousel on a web page that I have absolute positioning on of top:420px and left:640px. I would like for it to collapse and become vertical when the screen size changes. I put the media query in display:flex flex-direction: column. The slider doesn’t move from its absolute position. Is there a way I can make it responsive and collapse to a column when screen size is smaller. .main { background: transparent; border-radius: 10px; max-width: 50%; width: auto; text-align: center; position: absolute; top: 420px; left: 640px; } @media screen and (max-width: 600px) { .main { max-width: 100%; width: auto; display: flex; flex-direction: column; justify-content: center; align-items: center; } } .main div img { max-width: 100%; width: auto; } Make an Absolute positioned carousel...

Vue v-if destroys scrollbar plugin

I try to use custom scrollbar using vuebar on dynamic Vue elements. Since v-if destroys and recreates elements, vuebar is not activated after that. On example provided you can see scrollbar works till you change tabs. I know you can use v-show and it starts working, but that solution is impossible to implement in nested components with complicated relations. <div class="vuebar-element" v-bar v-if="tab==0"> <div> tab 0 </div> </div> <div class="vuebar-element" v-bar v-if="tab==1"> <div> tab 1 </div> </div> http://jsfiddle.net/ebwdnqfs/2/ Vue v-if destroys scrollbar plugin Vue v-if destroys scrollbar plugin test {$excerpt:n}

Decimal lost while extracting digits from a string in PHP

I am trying to extract digits and decimal point from a string but the decimal point is lost when I am using following regular expression: <?php $str = "$40.0000"; echo $str; echo "<br />"; $pattern = "/D+/"; $str = preg_replace($pattern, '', $str); echo $str; ?> Output: $40.0000 400000 I want to retain dot also. Decimal lost while extracting digits from a string in PHP Decimal lost while extracting digits from a string in PHP test {$excerpt:n}

Skip to toolbar