Skip to content

Instantly share code, notes, and snippets.

View bhumijgupta's full-sized avatar
😎
Exploring new ideas

Bhumij Gupta bhumijgupta

😎
Exploring new ideas
View GitHub Profile
// ***************
// IMPORTS
// ***************
import {
parse,
green,
bold,
Args,
existsSync,
writeJsonSync,
// api.ts
import { IArticle } from "./types.d.ts";
class Api {
// private property
readonly #baseURL: string = "https://newsapi.org/v2/top-headlines";
#apiKey: string = "";
// set API key
constructor(apikey: string) {
// ***************
// IMPORTS
// ***************
import {
parse,
green,
bold,
Args,
existsSync,
writeJsonSync,
// ***************
// IMPORTS
// ***************
import { parse, green, bold } from "./deps.ts";
import { displayHelpAndQuit } from "./error.ts";
// ***************
// FUNCTIONS
// ***************
const displayBanner = (): void => {
//error.ts
// Importing colors
import { red, bold, cyan } from "./deps.ts";
// Shows help text, error message(if present) and exits the program
export const displayHelpAndQuit = (error?: string): void => {
if (!error) {
} else if (error === "INVALID_KEY") {
console.log(
// deps.ts
export { parse, Args } from "https://deno.land/std/flags/mod.ts";
export { readJsonSync } from "https://deno.land/std/fs/read_json.ts";
export { writeJsonSync } from "https://deno.land/std/fs/write_json.ts";
export { existsSync } from "https://deno.land/std/fs/exists.ts";
export {
red,
green,
bold,
cyan,
// types.d.ts
export interface IArticle {
source: Object;
author: string;
title: string;
description: string;
url: string;
urlToImage: string;
publishedAt: string;
content: string;
@bhumijgupta
bhumijgupta / connect.sh
Last active September 16, 2022 08:50
Easy connect to VIT WiFi
#!/bin/sh
#replace your credentials here
roll=17BIT0170
pass=bhumij
login_and_check()
{
echo "Connecting to pronto server..."
output=`curl -X POST \
@bhumijgupta
bhumijgupta / gist:de6968299a28e826fb2f628784698434
Created January 3, 2020 17:45 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue: