Skip to content

Instantly share code, notes, and snippets.

View sahilrajput03's full-sized avatar
💭
I'm happy these days.

Sahil Rajput sahilrajput03

💭
I'm happy these days.
View GitHub Profile
@sahilrajput03
sahilrajput03 / OpenWithSublimeText3.bat
Created August 27, 2020 16:33 — forked from roundand/OpenWithSublimeText3.bat
Open folders and files with Sublime Text 3 from windows explorer context menu (tested in Windows 7)
@echo off
SET st3Path=C:\Program Files\Sublime Text 3\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@sahilrajput03
sahilrajput03 / storm catpuring
Created September 12, 2020 09:37
exception catpuring with closures.
noExcepttion(() =>
new Promise((res, rej) => {
rej('error occured due to storm');
})
);
function noExcepttion(cb) {
cb().catch((t) => console.log(`::INFO::NOEXCEPTION:: ${t}`));
};
@sahilrajput03
sahilrajput03 / Adding event handler to execut on key press events.js
Last active September 17, 2020 09:41
Its made for `Custom Javascript for website` chrom'e extension, to be able to click `edit` and`update` buttons with ctrl+y hotkey.
// ctrl+shift+e => Edit Button
// ctrl+shift+s => Update Gist Button
// ctrl+shift+k => Preview Button
// ctrl+shift+; => Write Button
// To get keycodes visit: "https://keycode.info/"
// To get chrome extension visit: "https://chrome.google.com/webstore/detail/custom-javascript-for-web/poakhlngfciodnhlhhgnaaelnpjljija?hl=en"
// BELOW CODE IS TO GET EDIT BUTTON AND REGISTER EVENT HANDLER FOR IT.
let elements1 = document.getElementsByClassName("btn btn-sm");
let idEditButtonExists = elements1[0].textContent.includes("Edit");
@sahilrajput03
sahilrajput03 / Formik notorious HOC revelation.md
Last active September 17, 2020 17:53
Dealing curiosity with <Formik> {<ComponentHere/> /* is bad thing */}.md

CHECK IF WE GET AUTOTYPING, AUTOCOMPLETE WHEN WE PASS FORM COMPONENT EXPLICITLY TO <Formik> Component

const MyFormComponent = () => (<Form> </Form>)

<Formik> {MyFormComponent} </Formik>`

instead of passing inplicityly passing component as

const FomikComponent = () => (<Formik>{() => 	(<Form> and other bullshit.. <<<here..refer formik site...>>>)})
@sahilrajput03
sahilrajput03 / README.md
Created September 18, 2020 16:43 — forked from iansu/README.md
Create React App 4.0 Alpha Testing

Create New App

JavaScript Template

npx create-react-app@next --scripts-version=@next --template=cra-template@next my-js-app

TypeScript Template

npx create-react-app@next --scripts-version=@next --template=typescript@next my-ts-app

@sahilrajput03
sahilrajput03 / random number(async).js
Last active September 22, 2020 14:36
Generating random number while waiting.
const randomNumber = () =>
new Promise((res, rej) =>
setTimeout(() => {
res("happy birthday");
}, 2000)
);
console.log("Cool", await randomNumber());
@sahilrajput03
sahilrajput03 / json stringify.js
Created September 23, 2020 05:34
This is a JsonStringify react component.
const JsonStringify = ({data}) => <pre>{JSON.stringify(data, null, 2)}</pre>;
@sahilrajput03
sahilrajput03 / live debug.js
Last active September 26, 2020 14:51
Tags: #live debug, #live-debug, #jsx debug, #jsx debug, #debugging
<div><pre><b>|--Live-Debug--|</b>{JSON.stringify(values, null, 2)}</pre></div>
@sahilrajput03
sahilrajput03 / Search my gists.md
Created September 26, 2020 16:43 — forked from santisbon/Search my gists.md
How to search gists

Enter this in the search box along with your search terms:

Get all gists from the user santisbon.
user:santisbon

Find all gists with a .yml extension.
extension:yml

Find all gists with HTML files.
language:html