Kselax.ru

Hacker Kselax – the best hacker in the world

Menu
  • Blog
  • Contacts
  • wp plugin generator
  • English
    • Русский
Menu

Tag: javascript

JavaScript sclerotic

Posted on 17 July, 201924 August, 2019 by admin

How to convert value to string you have three ways Converting a value to string in JavaScript String(value) “” + value value.toString() value.toString is the worst. It doesn’t always work. So don’t use it. I personally use String(value) or “” + value   How to use this (hard binding in javascript) this is a binding…

Read more

node.js fs – sclerotic

Posted on 12 December, 201816 February, 2019 by admin

  #How to read write files synchronously with fs

1
2
3
4
5
6
7
8
9
10
11
const fs = require('fs')
 
const str = '1Hello world!'
 
// save data
fs.writeFileSync(`${__dirname}/data.html`, str)
 
// read data
const d = fs.readFileSync(`${__dirname}/data.html`, 'utf8')
 
console.log('d = ', d) // d =  1Hello world!

  #How to read write files asynchronously with fs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
const fs = require('fs')
 
const str = 'Hello world!'
 
// save data
fs.writeFile(`${__dirname}/data.html`, str, err => {
  if (err) throw err
  console.log('saved');
})
 
// read data
fs.readFile(`${__dirname}/data.html`, 'utf8', (err, data) => {
  if (err) throw err
  console.log('data = ', data); // data =  Hello world!
})

    #How to check existence of files Sometimes we have to know whether a file exists or not. To do this we’ll be using a node.js fs module. We could check synchronously by using and…

Read more

How to enable babel with nodejs and express

Posted on 28 November, 201829 November, 2018 by admin

How to set up node.js with a ES6 support. You have to use them to modules that will allow you to wrap the server in a babel wrapper and the code will be work.

Read more

JavaScript tasks that will master skill

Posted on 22 November, 201822 November, 2018 by admin

Doing these tasks on your own you’ll get very quickly a JavaScript master level These tasks will make a real practical skill. As know the repetition is a mother of the teaching. The usage instruction Select the task that you more like and start study code. Afterward when you know how the code works. Do the…

Read more

How to work with node.js modules

Posted on 17 November, 201813 February, 2019 by admin

What is going on when we do require(‘some module’)? What if I want to include the MySQL module to my a few modules and use the same connection, how to have we include it properly? In this article, we’ll try to figure out how the node.js modules work. #How to make your own module Create a…

Read more
passportjs authentication

How to use passportjs with node.js

Posted on 6 November, 201814 November, 2018 by admin

  Links: the official site passportjs Look at my example on GitHub link   Table contents:   #Passportjs the usage scheme Usually you have to implement such a steps: create passport.serializeUser create passport.deserializeUser  passport.use(new SteamStrategy({options}, callback)  initialize the session, passport should be initialized afterward add two routers /auth/steam and /auth/steam/return   #Passportjs general functions #Passport serialize…

Read more
template engine

JavaScript templates for rendering pages

Posted on 1 November, 20183 November, 2018 by admin

Exists many JavaScript templates like handlebars, ejs, pug, etc. In this article I’ll overview some templates that I’ve used first of all it’s my the first template handlebars, I use the module express-handlebar   links: How to integrate express with pug. The official guide link consolidate.js link Github repository with examples of this article link  …

Read more

Where to start creating a node.js app. The detailed instruction for a newbie.

Posted on 31 October, 201831 October, 2018 by admin

How to create a node.js app and where to start the newbies often ask these questions. In this article, we’ll try figuring out how it is going on. Node.js app has a few parts. It has always a config file.   The content table: Create a config file   #Create a config file We use…

Read more

How to use NPM. The main commands for a newbie

Posted on 31 October, 201831 October, 2018 by admin

NPM is a node package manager, which is used for installing removing packages from the NPM repository link. You can publish your own packages there as well.   The content table: NPM the common functionality How to use npm scripts #NPM the common functionality Create a package.json file we use the command

1
npm init

  Install…

Read more

React the basic course. From newbie to ninja

Posted on 27 October, 201831 October, 2018 by admin

Hi. In this article I’ll explain to you how to use react. How to learn it the basic. To the end of which you will able to create powerful react app and will know some pitfalls. Let’s get started. I’m a new to React and decided to create this masterpiece like a crib where I’ll…

Read more

Posts navigation

  • 1
  • 2
  • Next

Categories

  • bash (1)
  • English (9)
  • JavaScript (4)
  • node.js (22)
  • photoshop (1)
  • php (3)
  • React (9)
  • sclerotic (6)
  • Ubuntu (10)
  • Uncategorized (13)
  • Wordpress (1)

Tags

Ajax apache2 automation bash chrome-extension command line editor ejs email English English-grammar framework functions git graphql handlebars hybrid app installation javascript js linux newbie node.js node.js javascript nodemailer npm objects Performance php phpmyadmin playonlinux promise rabbitmq React react-router redis reverse-proxy session shell socket.io sublime text 3 time zones ubuntu unity webpack

Recent Comments

  • damien on How to install npm and nodejs the latest versions on ubuntu
  • Cam on How to install npm and nodejs the latest versions on ubuntu
  • Pierre on socket.io with apache as a reverse proxy on the CentOS
  • admin on How to use react-router with a few languages
  • admin on How to install npm and nodejs the latest versions on ubuntu
©2021 Kselax.ru Theme by ThemeGiant