Skip to content

Instantly share code, notes, and snippets.

Anchal Sachdeva anchal20

  • Bangalore
View GitHub Profile
@anchal20
anchal20 / StepsForAngularApp.md
Last active Jun 29, 2018
Listing the steps to be followed to create a new angular application
View StepsForAngularApp.md

This gist lists down the steps to create a new angular application

  1. Download node from https://nodejs.org/en/download/ in your system and then install, where npm gets installed automatically with node installation. After this to check if it is installed properly run node -v && npm -v in the terminal, it will tell you the node & npm version installed.

  2. Now install angular-cli globally by running npm install -g @angular/cli. The angular cli helps you to setup angular project with the bare minimum requirements so that you can onboard quickly and start with angular app development.

  3. Now go the directory where you want to build your project and run ng new <app-name> for example ng new my-app. The Angular CLI installs the necessary npm packages, creates the project files, and populates the project with a simple default app

@anchal20
anchal20 / node_package_version_explanation.md
Last active Feb 14, 2018
Explaining the meaning of '~', '^' etc of node package versions in package.json
View node_package_version_explanation.md

In the package.json file we see that there are devDependencies and dependencies with some node packages. Something like this - "babel": "^6.26.0"

Now, many of us do not understand what the symbol at the start of the version means. This gist will give you a consolidated solution to the question.

Premitive operators

  • < Less than
  • <= Less than or equal to
  • > Greater than
  • >= Greater than or equal to
View Vuejs_Project_on_ghpages.md

Below are the steps to run your vue-cli project on gh-pages

  • Edit your config/index.js - change all dist to docs and add update 'assetsPublicPath' value to './' in the build module
  • Run 'npm run build', this will build your project and create production files.
  • Now push your code to your master branch.
  • Lastly, go to your github repo, open settings(the last tab), scroll down to the 'Github pages' section. Here update the source to 'master branch /docs folder'

Now open your url which would be https://[your user name].github.io/[your repo name].

Tada!! your vue-cli project is up and running! Congratulations :)

View Important_CSS_fixes.md

Fixing space between two spans

I had wriiten a code as

<div>
  <span>AN</span>
  <span>C</span>
  <span>HAL</span>
</div>```

The end result was something like this - AN C HAL
@anchal20
anchal20 / Uninstalling_Node_npm_completely.md
Last active Jan 17, 2017
I had lot of issue while reinstalling node/npm. After lot of googling I came across the solution which worked for me. This Gist iterates the steps to remove node and npm completely from the system.
View Uninstalling_Node_npm_completely.md

When I upgraded my node to 7+ and npm to 4+ I started facing problem while running 'npm install'. It was throwing error ‘Cannot find module 'internal/fs'’. I googled a lot and found out that my node/npm versions were unsupportive of certain modules. I tried to change the version but nothing happened. Then i tried running ‘Gulp’ which I was using in my app for module bundling. To my surprise it said ‘zsh: command not found: gulp’.

Now I thought, the only way to get rid of these problems to re-install node/npm again. I did ‘brew uninstall node’ and still node -v -> v7.4.0 This was frustrating!!!

I googled to see if there is another one line code by Node to uninstall it, but could’nt find anything. Then I read somewhere on the web that I have to remove node from all possible places and only then I will be assured that its been uninstalled.

Below are the steps that you should follow to uninstall node/npm and then re-install it.

@anchal20
anchal20 / Vuejs builds explained
Last active May 21, 2020
What is a standalone and runtime-only build in Vue js?
View Vuejs builds explained
In this Document you will find two ways to write a vuejs app - standalone build and runtime-only build. The former includes the template compiler and later does not. The template compiler is responsible for compiling vue templates to plain javascript render function
1. The standalone build includes the compiler and supports the template option. It also relies on the presence of browser APIs so you cannot use it for server-side rendering.
2. The runtime-only build does not include the template compiler, and does not support the template option. You can only use the render option when using the runtime-only build, but it works with single-file components, because single-file components’ templates are pre-compiled into render functions during the build step.
The npm package exports the runtime-only build by default. To use standalone build use the following in the webpack config file:
resolve: {
alias: {
'vue$': 'vue/dist/vue.common.js'
You can’t perform that action at this time.