Skip to content

Commit fc35d63

Browse files
committed
📦 NEW: First commit
0 parents  commit fc35d63

294 files changed

Lines changed: 34037 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.gitignore‎

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# NPM #
2+
##########
3+
# Ignore all directories called node_modules in current folder and any subfolders.
4+
node_modules/
5+
/node_modules/
6+
7+
# Packages #
8+
############
9+
*.7z
10+
*.dmg
11+
*.gz
12+
*.bz2
13+
*.iso
14+
*.jar
15+
*.rar
16+
*.tar
17+
*.zip
18+
*.tgz
19+
*.map
20+
21+
# Logs and databases #
22+
######################
23+
*.log
24+
*.sql
25+
*.env
26+
27+
# OS generated files #
28+
######################
29+
**.DS_Store*
30+
ehthumbs.db
31+
Icon?
32+
Thumbs.db
33+
._*
34+
**settings.dat*
35+
36+
# Vim generated files #
37+
######################
38+
*.un~
39+
40+
# SASS #
41+
##########
42+
**/.sass-cache
43+
**/.sass-cache/*
44+
**/.map
45+
46+
# Composer #
47+
##########
48+
!assets/js/vendor/
49+
wpcs/
50+
/vendor/
51+
52+
# Bower #
53+
##########
54+
assets/bower_components/*
55+
56+
# Codekit #
57+
##########
58+
/codekit-config.json
59+
*.codekit
60+
**.codekit-cache/*
61+
62+
# Compiled Files and Build Dirs #
63+
##########
64+
/README.html
65+
66+
# PhpStrom Project Files #
67+
.idea/
68+
library/vendors/composer
69+
assets/img/.DS_Store
70+
71+
# VSCode related files #
72+
# .vscode
73+
74+
# Next.js
75+
.next
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const fs = require('fs');
2+
3+
function getFilesizeInBytes(filename) {
4+
const stats = fs.statSync(filename);
5+
const fileSizeInBytes = stats['size'];
6+
return fileSizeInBytes;
7+
}
8+
9+
console.log(getFilesizeInBytes(`${process.cwd()}/01-nodejs/index.js`), `bytes`);
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
const http = require('http');
2+
3+
const hostname = '127.0.0.1';
4+
const port = 3000;
5+
let count = 1;
6+
7+
const server = http.createServer((req, res) => {
8+
console.log('VISIT:', count++);
9+
res.statusCode = 200;
10+
res.setHeader('Content-Type', 'text/plain');
11+
res.end(`Hello ${req.headers['user-agent']}`);
12+
});
13+
14+
server.listen(port, hostname, () => {
15+
console.log(`Server running at http://${hostname}:${port}/`);
16+
});
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Installing Node.js & npm
2+
3+
## Node.js Versions
4+
5+
- Current (breaking new changes)
6+
- LTS (Long Term Support)
7+
- Active LTS (non-breaking new changes + bug fixes)
8+
- Maintenance LTS (bug fixes)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# npx vs npm
2+
3+
```sh
4+
npx <command>
5+
```
6+
7+
Executes `<command>` either from a local node_modules/.bin, or from a central cache, installing any packages needed in order for `<command>` to run.
8+
9+
By default, `npx` will check whether `<command>` exists in $PATH, or in the local project binaries, and execute that. If `<command>` is not found, it will be installed prior to execution.
10+
11+
- [Documentation](https://www.npmjs.com/package/npx)
12+
- [Introduction to npx](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env node
2+
3+
console.log(`Hello, this is Awais.`);

‎10-CLI Projects #1-7 & #11-21/23-cli-hello/package-lock.json‎

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "@ahmadawais/hello",
3+
"version": "0.0.1",
4+
"bin": {
5+
"hello": "index.js"
6+
}
7+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env node
2+
const dirName = process.argv[2];
3+
const { exec } = require('child_process');
4+
5+
const cb = (error, stdout, stderr) => {
6+
if (error) {
7+
console.error(`exec error: ${error}`);
8+
return;
9+
}
10+
console.log(`stdout: ${stdout}`);
11+
console.error(`stderr: ${stderr}`);
12+
};
13+
exec(`mkdir -p ${dirName}`, cb);
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env node
2+
const dirName = process.argv[2];
3+
4+
// Execute using child_process.
5+
const { exec } = require('child_process');
6+
exec(`mkdir -p ${dirName}`);
7+
8+
// Execute using execa.
9+
const execa = require('execa');
10+
(async () => {
11+
await execa(`mkdir`, [`-p`, dirName]);
12+
})();
13+
14+
// Execute using shelljs.
15+
const { mkdir } = require('shelljs');
16+
mkdir(`-p`, dirName);

0 commit comments

Comments
 (0)