Skip to content

Instantly share code, notes, and snippets.

View nateshmbhat's full-sized avatar
👨‍💻
Eat - Sleep - Code - Repeat ✨

Natesh Bhat nateshmbhat

👨‍💻
Eat - Sleep - Code - Repeat ✨
View GitHub Profile
@nateshmbhat
nateshmbhat / 0_reuse_code.js
Created March 14, 2017 07:49
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@nateshmbhat
nateshmbhat / vsCode_settings.json
Created December 5, 2017 14:29
Vscode (Visual Studio Code ) Settings.json File which contains some important configuration regarding vim settings and Compiler and Debuggers for various languages
{
"window.zoomLevel": 1,
"git.enableSmartCommit": true,
"workbench.colorTheme": "Monokai Darker",
"vim.useCtrlKeys": false,
"workbench.panel.location": "bottom",
"python.pythonPath": "/usr/bin/python3" ,
"python.linting.pylintArgs": [
"--errors-only"
],
@nateshmbhat
nateshmbhat / launch(vscode C ,C++ windows).json
Last active December 27, 2017 02:11
vsCode ( launch.json ) configuration file which is used to configure the Debugging part of the build process. This config file accessible in the top left corner settings button
{
"version": "0.2.0",
"configurations": [
{
"name": "(Windows) Launch",
"type": "cppvsdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}.exe",
"args": [],
@nateshmbhat
nateshmbhat / All States and Districts.json
Created December 22, 2017 11:41
This gist contains all the States and Districts of India in a JSON format . This is created in the view that it might be useful in any projects like filtering a selection box of districts after selecting state.
{
"Tripura": [
"Dhalai",
"Gomati",
"Khowai",
"North Tripura",
"Sepahijala",
"South Tripura",
"Unakoti",
"West Tripura"
@nateshmbhat
nateshmbhat / fibonacci.cpp
Created November 30, 2019 01:41
Fibonacci Sequence Dynamic Programming | From Exponential time to Linear time to Constant Time Solution
#include<bits/stdc++.h>
using namespace std ;
// Nth number of FIBONACCI SEQUENCE
// Bruteforce = 2^n , O(1) space
// Top down = O(N) Time , O(N) space
// Bottom up = O(N) Time , O(1) Space
// Math Solution = O(1) Time and Space
int totalCalls = 0 ;
@nateshmbhat
nateshmbhat / dijkstra_algorithm.cpp
Created April 28, 2020 04:41
Dijkstra Algorithm for finding shortest path to all vertices from a single source.
#include<bits/stdc++.h>
using namespace std ;
int cost[100][100] , n ;
int getMin(int dist[] , bool visited[]){
int key = 0 ;
int min = INT_MAX ;
for(int i=0;i < n ; i++){
if(!visited[i] && dist[i]<min){
@nateshmbhat
nateshmbhat / O(N) time , O(1) space optimal.cpp
Last active July 6, 2021 14:39
Minimum Jumps to Reach end of Array
int solve(int arr[] , int n ){
int maxReachable , jumps , stepsPossible ;
maxReachable = arr[0] ;
jumps = 1 ;
stepsPossible = arr[0] ;
for(int i = 1 ; i<n ; i++){
if(i==n-1) return jumps ;
@nateshmbhat
nateshmbhat / touchable_flutter_demo_0.dart
Last active August 19, 2020 15:41
touchable usage flutter demo
import 'package:flutter/material.dart';
import 'package:touchable/touchable.dart';
class MyCoolPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
color: Colors.white,
//wrap CustomPaint with CanvasTouchDetector
child: CanvasTouchDetector(
@nateshmbhat
nateshmbhat / touchable_flutter_animation_demo.dart
Last active August 24, 2020 17:33
Contains a flutter screen that has a demo of using touchable library for gestures and animations
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:touchable/touchable.dart';
class MyCoolPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(child: MyWidget());
}
}
@nateshmbhat
nateshmbhat / shaking_error_text.dart
Created October 3, 2020 11:45
Shaking Error Text Widget
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:simple_animations/simple_animations.dart';
enum ErrorAnimationProp { offset }
class ShakingErrorText extends StatelessWidget {
final ShakingErrorController controller;
final int timesToShake;
final MultiTween<ErrorAnimationProp> _tween;