Skip to content

Instantly share code, notes, and snippets.

View Shobhit1's full-sized avatar
🎧
Remote work!

Shobhit Shobhit1

🎧
Remote work!
View GitHub Profile
@Shobhit1
Shobhit1 / main.js
Created December 4, 2019 22:45 — forked from sidprice/main.js
const electron = require('electron')
// Module to control application life.
const app = electron.app
// Module to create native browser window.
const BrowserWindow = electron.BrowserWindow
const path = require('path')
const url = require('url')
// Keep a global reference of the window object, if you don't, the window will
@Shobhit1
Shobhit1 / .gitconfig
Last active February 18, 2020 05:58
My Git Config
[alias]
c = commit -m
up = pull
p = push
s = status
co = checkout
st = status
br = branch
nb = checkout -b
bdm = "!git branch --merged | grep -v '*' | xargs -n 1 git branch -d"
@Shobhit1
Shobhit1 / GitCommitEmoji.md
Created March 18, 2019 17:05 — forked from parmentf/GitCommitEmoji.md
Git Commit message Emoji
var arraySum = function(array) {
var total = 0;
if(array.length === 0) {
return 0;
}
var popped = array.pop();
if(Array.isArray(popped)) {
total += arraySum(popped);
return total += arraySum(array);
}
@Shobhit1
Shobhit1 / vim_cheatsheet.md
Created April 11, 2018 06:29 — forked from awidegreen/vim_cheatsheet.md
Vim shortcuts

Introduction

  • C-a == Ctrl-a
  • M-a == Alt-a

General

:q        close
:w        write/saves
:wa[!]    write/save all windows [force]
:wq       write/save and close
call plug#begin('~/.vim/plugged')
" Syntax and language specific
Plug 'tpope/vim-git'
Plug 'tasn/vim-tsx'
Plug 'vim-ruby/vim-ruby'
Plug 'othree/html5.vim'
Plug 'othree/jsdoc-syntax.vim'
Plug 'othree/javascript-libraries-syntax.vim'
Plug 'leshill/vim-json'
@Shobhit1
Shobhit1 / index.html
Created August 29, 2017 18:08 — forked from anonymous/index.html
Slider using JS, HTML and CSS
<div class="slider">
<button id="previous-button">Previous</button>
<div class="item-container selected"></div>
<div class="item-container"></div>
<div class="item-container"></div>
<div class="item-container"></div>
<div class="item-container"></div>
<button id="next-button">Next</button>
</div>
</div>
@Shobhit1
Shobhit1 / spec_helper_jest.js
Created July 10, 2017 13:52 — forked from gdborton/spec_helper_jest.js
This bit of code essentially bridges the Mocha/Jest api so that Jest can be used in place of Mocha.
// There are other differences between Jest and Mocha,
// but these were the functions being used at Airbnb.
global.context = describe;
global.before = beforeAll;
global.after = afterEach;
@Shobhit1
Shobhit1 / js-tricky-bits.md
Last active July 2, 2017 15:26 — forked from amysimmons/js-tricky-bits.md
Understanding closures, callbacks and promises in JavaScript

Understanding closures, callbacks and promises

For a code newbie like myself, callbacks, closures and promises are scary JavaScript concepts.

10 months into my full-time dev career, and I would struggle to explain these words to a peer.

So I decided it was time to face my fears, and try to get my head around each concept.

Here are the notes from my initial reading. I'll continue to refine them as my understanding improves.

@Shobhit1
Shobhit1 / change-favicon.js
Created May 21, 2017 21:29 — forked from mathiasbynens/change-favicon.js
Dynamically changing favicons with JavaScript
/*!
* Dynamically changing favicons with JavaScript
* Works in all A-grade browsers except Safari and Internet Explorer
* Demo: http://mathiasbynens.be/demo/dynamic-favicons
*/
// HTML5™, baby! http://mathiasbynens.be/notes/document-head
document.head || (document.head = document.getElementsByTagName('head')[0]);
function changeFavicon(src) {