├── _config.yml ├── assets ├── cropped.png ├── cropped-xs.png ├── screenshot.png ├── cropped-xxs.png └── map-of-india.png ├── .github └── FUNDING.yml ├── src ├── independence.js └── index.js ├── package.json ├── LICENSE ├── republic day └── index.js ├── .gitignore └── README.md /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-leap-day 2 | title: Map of India 3 | plugins: 4 | - jemoji 5 | -------------------------------------------------------------------------------- /assets/cropped.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vinitshahdeo/Map-of-India/HEAD/assets/cropped.png -------------------------------------------------------------------------------- /assets/cropped-xs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vinitshahdeo/Map-of-India/HEAD/assets/cropped-xs.png -------------------------------------------------------------------------------- /assets/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vinitshahdeo/Map-of-India/HEAD/assets/screenshot.png -------------------------------------------------------------------------------- /assets/cropped-xxs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vinitshahdeo/Map-of-India/HEAD/assets/cropped-xxs.png -------------------------------------------------------------------------------- /assets/map-of-india.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vinitshahdeo/Map-of-India/HEAD/assets/map-of-india.png -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [vinitshahdeo] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 13 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 14 | -------------------------------------------------------------------------------- /src/independence.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * @author Vinit Shahdeo 4 | */ 5 | const figlet = require("figlet"), 6 | chalk = require("chalk"), 7 | log = console.log; 8 | 9 | figlet('Happy Independence Day', function (err, message) { 10 | if (err) { 11 | log('OOPS! Something went wrong :(', err); 12 | } else { 13 | log(chalk.red.bold('\n\nWishing\n\n') + 14 | chalk.white.bold('You\n\n') + 15 | chalk.green.bold('A Very\n\n') 16 | ); 17 | 18 | log(message); 19 | 20 | log(chalk.blue.bold('\n\nAuthor: ') + 21 | chalk.yellow.bold('Vinit Shahdeo') 22 | ); 23 | 24 | log(chalk.cyan.bold('\nFollow on GitHub at ') + 25 | chalk.magenta.bold('https://github.com/vinitshahdeo') + 26 | '\n\n' 27 | ); 28 | } 29 | }); 30 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "map-of-india", 3 | "version": "1.0.0", 4 | "description": "A Node.js program to generate Map Of India in terminal", 5 | "main": "index.js", 6 | "scripts": { 7 | "start": "node src/index.js", 8 | "wish": "node src/independence.js", 9 | "draw": "node src/index.js" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "git+https://github.com/vinitshahdeo/Map-of-India.git" 14 | }, 15 | "keywords": [ 16 | "map", 17 | "india", 18 | "nodejs", 19 | "independence", 20 | "day", 21 | "tiranga", 22 | "hindustan", 23 | "bharat" 24 | ], 25 | "author": "Vinit Shahdeo ", 26 | "license": "MIT", 27 | "bugs": { 28 | "url": "https://github.com/vinitshahdeo/Map-of-India/issues" 29 | }, 30 | "homepage": "https://vinitshahdeo.github.io/Map-of-India/", 31 | "dependencies": { 32 | "chalk": "^4.1.0", 33 | "figlet": "^1.5.0" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Vinit Shahdeo 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /republic day/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Code snippet to print 'Map Of India' 4 | * 5 | * @author: Vinit Shahdeo 6 | */ 7 | const MAGIC_STRING = "TFy!QJu ROo TNn(ROo)SLq SLq ULo+UHs UJq TNn*RPn/QPbEWS_JSWQAIJO^NBELPeHBFHT}TnALVlBLOFAkHFOuFETpHCStHAUFAgcEAelclcn^r^r\\tZvYxXyT|S~Pn SPm SOn TNn ULo0ULo#ULo-WHq!WFs XDt!"; 8 | 9 | function revertMe (flag) { 10 | return !flag; 11 | } 12 | 13 | var _logCounter = 0, 14 | _flag = true, 15 | _magicCounter = MAGIC_STRING.charCodeAt(_logCounter), 16 | _newLineCounter = 10; 17 | 18 | while (_magicCounter !== 0) { 19 | _magicCounter = MAGIC_STRING.charCodeAt(_logCounter); 20 | _logCounter++; 21 | while (_magicCounter > 64) { 22 | _magicCounter--; 23 | ++_newLineCounter; 24 | _flag = revertMe(_flag); 25 | 26 | if (_newLineCounter === 90) { 27 | _newLineCounter = 10; 28 | process.stdout.write('\n'); 29 | } else { 30 | ((_logCounter >> 1) << 1 === _logCounter) ? (_flag ? process.stdout.write('1') : process.stdout.write('0')) : process.stdout.write(' '); 31 | } 32 | } 33 | } 34 | 35 | /* 36 | 37 | 38 | _ _ 39 | | | | | 40 | | |__| | __ _ _ __ _ __ _ _ 41 | | __ |/ _` | '_ \| '_ \| | | | 42 | | | | | (_| | |_) | |_) | |_| | 43 | |_| |_|\__,_| .__/| .__/ \__, | 44 | | | | | __/ | 45 | _____ |_| |_| _ |___/ _ 46 | | __ \ | | | (_) 47 | | |__) |___ _ __ _ _| |__ | |_ ___ 48 | | _ // _ \ '_ \| | | | '_ \| | |/ __| 49 | | | \ \ __/ |_) | |_| | |_) | | | (__ 50 | |_|__\_\___| .__/ \__,_|_.__/|_|_|\___| 51 | | __ \ | | 52 | | | | | __|_|_ _ 53 | | | | |/ _` | | | | 54 | | |__| | (_| | |_| | 55 | |_____/ \__,_|\__, | 56 | __/ | 57 | |___/ 58 | 59 | < /> with <3 by vinitshahdeo 60 | 61 | */ 62 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | 9 | # Diagnostic reports (https://nodejs.org/api/report.html) 10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 11 | 12 | # Runtime data 13 | pids 14 | *.pid 15 | *.seed 16 | *.pid.lock 17 | 18 | # Directory for instrumented libs generated by jscoverage/JSCover 19 | lib-cov 20 | 21 | # Coverage directory used by tools like istanbul 22 | coverage 23 | *.lcov 24 | 25 | # nyc test coverage 26 | .nyc_output 27 | 28 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 29 | .grunt 30 | 31 | # Bower dependency directory (https://bower.io/) 32 | bower_components 33 | 34 | # node-waf configuration 35 | .lock-wscript 36 | 37 | # Compiled binary addons (https://nodejs.org/api/addons.html) 38 | build/Release 39 | 40 | # Dependency directories 41 | node_modules/ 42 | jspm_packages/ 43 | 44 | # TypeScript v1 declaration files 45 | typings/ 46 | 47 | # TypeScript cache 48 | *.tsbuildinfo 49 | 50 | # Optional npm cache directory 51 | .npm 52 | 53 | # Optional eslint cache 54 | .eslintcache 55 | 56 | # Microbundle cache 57 | .rpt2_cache/ 58 | .rts2_cache_cjs/ 59 | .rts2_cache_es/ 60 | .rts2_cache_umd/ 61 | 62 | # Optional REPL history 63 | .node_repl_history 64 | 65 | # Output of 'npm pack' 66 | *.tgz 67 | 68 | # Yarn Integrity file 69 | .yarn-integrity 70 | 71 | # dotenv environment variables file 72 | .env 73 | .env.test 74 | 75 | # parcel-bundler cache (https://parceljs.org/) 76 | .cache 77 | 78 | # Next.js build output 79 | .next 80 | 81 | # Nuxt.js build / generate output 82 | .nuxt 83 | dist 84 | 85 | # Gatsby files 86 | .cache/ 87 | # Comment in the public line in if your project uses Gatsby and *not* Next.js 88 | # https://nextjs.org/blog/next-9-1#public-directory-support 89 | # public 90 | 91 | # vuepress build output 92 | .vuepress/dist 93 | 94 | # Serverless directories 95 | .serverless/ 96 | 97 | # FuseBox cache 98 | .fusebox/ 99 | 100 | # DynamoDB Local files 101 | .dynamodb/ 102 | 103 | # TernJS port file 104 | .tern-port 105 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Code snippet to print 'Map Of India' 4 | * 5 | * @author: Vinit Shahdeo 6 | */ 7 | const MAGIC_STRING = "TFy!QJu ROo TNn(ROo)SLq SLq ULo+UHs UJq TNn*RPn/QPbEWS_JSWQAIJO^NBELPeHBFHT}TnALVlBLOFAkHFOuFETpHCStHAUFAgcEAelclcn^r^r\\tZvYxXyT|S~Pn SPm SOn TNn ULo0ULo#ULo-WHq!WFs XDt!"; 8 | 9 | var _logCounter = 0, 10 | _magicCounter = MAGIC_STRING.charCodeAt(_logCounter), 11 | _newLineCounter = 10; 12 | 13 | while (_magicCounter !== 0) { 14 | _magicCounter = MAGIC_STRING.charCodeAt(_logCounter); 15 | _logCounter++; 16 | while (_magicCounter > 64) { 17 | _magicCounter--; 18 | ++_newLineCounter; 19 | if (_newLineCounter === 90) { 20 | _newLineCounter = 10; 21 | process.stdout.write('\n'); 22 | } else { 23 | ((_logCounter >> 1) << 1 === _logCounter) ? process.stdout.write('!') : process.stdout.write(' '); 24 | } 25 | } 26 | } 27 | 28 | /* 29 | _ _ 30 | | | | | 31 | | |__| | __ _ _ __ _ __ _ _ 32 | | __ |/ _` | '_ \| '_ \| | | | 33 | | | | | (_| | |_) | |_) | |_| | 34 | |_|__|_|\__,_| .__/| .__/ \__, | _ 35 | |_ _| | || || | __/ | | | 36 | | | _ __ |_|| ||_|_ _ |___/___ _ __ __| | ___ _ __ ___ ___ 37 | | | | '_ \ / _` |/ _ \ '_ \ / _ \ '_ \ / _` |/ _ \ '_ \ / __/ _ \ 38 | _| |_| | | | (_| | __/ |_) | __/ | | | (_| | __/ | | | (_| __/ 39 | |_____|_| |_|\__,_|\___| .__/ \___|_| |_|\__,_|\___|_| |_|\___\___| 40 | | __ \ | | 41 | | | | | __ _ _ _ |_| 42 | | | | |/ _` | | | | 43 | | |__| | (_| | |_| | 44 | |_____/ \__,_|\__, | 45 | __/ | 46 | |___/ 47 | 48 | With <3 from @vinitshahdeo 49 | */ -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 | 4 | 5 |

6 |

Map of India

7 |

8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |

21 |

22 |

A Node.js script to generate the Map of India in terminal

23 | 24 | 25 | ### Quick Start :rocket: 26 | 27 | Open your terminal and run `npm start` 28 | 29 | ### Setup :gear: 30 | 31 | ```bash 32 | npm install && npm start 33 | ``` 34 | 35 | ### Commands :fire: 36 | 37 | - `npm run draw`: Prints **Map of India** :india: in the terminal 38 | 39 | - `npm run wish`: Prints a **Happy Independence Day** message in the terminal 40 | 41 | ### Explained :building_construction: 42 | 43 | ```bash 44 | cd src && cat index.js 45 | ``` 46 | 47 | Navigate to `src/` folder and check out [`index.js`](https://github.com/vinitshahdeo/Map-of-India/blob/master/src/index.js). 48 | 49 | > **For the binary version of the map, please checkout [`republic day/index.js`](https://github.com/vinitshahdeo/Map-of-India/blob/master/republic%20day/index.js)**. 50 | 51 | ```bash 52 | cd republic\ day 53 | node index.js 54 | ``` 55 | 56 | ```javascript 57 | 58 | 59 | .--,_ 60 | [' '\. 61 | \ `''| 62 | | ,] 63 | `._ ]. 64 | | \ 65 | _/ -'\ 66 | ,' ,' 67 | _/' \ ,..-''L_ 68 | |--'' '-;__ |\ / .,' 69 | \ `--.__,'_ '---- ,-' 70 | `\ \`-'\__ ,| 71 | ,--;/ / .| ,/ 72 | \__ '| / / 73 | ./ _-, _| S@yaN 74 | \__/ / ,/ " 75 | | _/ 76 | | ,/ 77 | \ / 78 | | /.-' 79 | \ _/ : 80 | | / . 81 | | | . 82 | . | | '. 83 | ; \ / ;\ 84 | ' | | 85 | \ _| : 86 | \_,/ "' 87 | : ' 88 | ' 89 | 90 | 91 | _ _ 92 | | | | | __ _ _ __ _ __ _ _ 93 | | |_| |/ _` | '_ \| '_ \| | | | 94 | | _ | (_| | |_) | |_) | |_| | 95 | |_|_|_|\__,_| .__/| .__/ \__, | _ 96 | |_ _|_ __ |_| | |_| _ _|___/__ _ __ __| | ___ _ __ ___ ___ 97 | | || '_ \ / _` |/ _ \ '_ \ / _ \ '_ \ / _` |/ _ \ '_ \ / __/ _ \ 98 | | || | | | (_| | __/ |_) | __/ | | | (_| | __/ | | | (_| __/ 99 | |___|_| |_|\__,_|\___| .__/ \___|_| |_|\__,_|\___|_| |_|\___\___| 100 | | _ \ __ _ _ _ |_| 101 | | | | |/ _` | | | | 102 | | |_| | (_| | |_| | 103 | |____/ \__,_|\__, | 104 | |___/ 105 | ``` 106 | 107 | ### Dependencies :tada: 108 | 109 | - [Figlet](https://www.npmjs.com/package/figlet): An NPM module used to turn a string into ASCII art. 110 | 111 | - [Chalk](https://www.npmjs.com/package/chalk): An NPM module used for terminal string styling. 112 | 113 | ### Support :heart: 114 | 115 | - Do share my **Dev.to** article: **[Code to generate the Map of India using Node.js](https://dev.to/vinitshahdeo/code-to-generate-the-map-of-india-using-node-js-3i06)** 116 | 117 | - **Retweet** [this](https://twitter.com/Vinit_Shahdeo/status/1294487868455284736)! :repeat: 118 | 119 | - Read my open-source journey: **[If You Are A Techie, Your Home Page Should Be GitHub, Not Instagram](https://www.opensourceforu.com/2020/07/if-you-are-a-techie-your-home-page-should-be-github-not-instagram/)**! 120 | 121 | - Read my **Thank You Note**: [My journey from 0 to 1K followers on GitHub](https://dev.to/vinitshahdeo/my-journey-from-0-to-1k-followers-on-github-1n6h) :blue_heart: 122 | 123 | - Leave a star [here](https://github.com/vinitshahdeo/Map-of-India/stargazers) :star: 124 | 125 | ### Acknowledgement :hugs: 126 | 127 | - The image used in this repo is taken from [here](https://www.pngmart.com/files/7/India-Map-Transparent-PNG.png). 128 | 129 | - This repository is inspired from a StackOverflow [thread](https://stackoverflow.com/questions/3533348/how-does-this-code-generate-the-map-of-india). 130 | 131 | ### Author :trophy: 132 | | | 133 | | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | 134 | | **[Vinit Shahdeo](https://fayz.in/stories/s/1522/0/?ckt_id=ZGL1ZGVk&title=story_of_vinit_shahdeo)** | 135 | | | 136 | 137 | 138 | 139 | [![Follow on Twitter @Vinit_Shahdeo](https://img.shields.io/twitter/follow/Vinit_Shahdeo?style=social)](https://twitter.com/Vinit_Shahdeo) 140 | 141 | 142 | --- 143 | 144 | ```javascript 145 | 146 | if (_.isAwesome(thisRepo)) { 147 | thisRepo.star(); // thanks in advance :p 148 | } 149 | 150 | ``` 151 | 152 | --- 153 | --------------------------------------------------------------------------------