Skip to content

Instantly share code, notes, and snippets.

View nimish-gupta's full-sized avatar
💻
Programming Deliberately

Nimish Gupta nimish-gupta

💻
Programming Deliberately
View GitHub Profile
@nimish-gupta
nimish-gupta / scrape-angel-co.js
Last active June 19, 2020 12:23
Scrape angel co for jobs
// SITE - https://angel.co
const scroll = () => {
const scrollingElement = document.scrollingElement || document.body;
scrollingElement.scrollTop = scrollingElement.scrollHeight;
};
const sleep = (time = 2) =>
new Promise((resolve) => setTimeout(resolve, time * 1000));
@nimish-gupta
nimish-gupta / scrape-remote-co.js
Created June 18, 2020 01:26
Scrape remote co jobs
// SITE - https://remote.co/
const sleep = () => new Promise((resolve) => setTimeout(resolve, 2 * 1000));
const getCompanyInfo = (elem) => {
const [openings, companyName] = elem.innerText.split('\n');
const link = elem.querySelector('a').getAttribute('href')
return {
companyName,
openings,
@nimish-gupta
nimish-gupta / scrape-hackernews-jobs.js
Last active June 19, 2020 07:57
Scrape jobs from hacker news
// SITE - https://www.workatastartup.com
const scroll = () => {
const scrollingElement = document.scrollingElement || document.body;
scrollingElement.scrollTop = scrollingElement.scrollHeight;
};
const sleep = () => new Promise((resolve) => setTimeout(resolve, 2 * 1000));
const getOpenings = (elem) => [...elem.querySelectorAll('.jobs-list>.job>.job-line>.job-details')]
@nimish-gupta
nimish-gupta / .vimrc
Created May 2, 2020 12:18
Vimrc Config
syntax on
colorscheme monokai
set tabstop=8 softtabstop=0 expandtab shiftwidth=4 smarttab
set autoindent
set number
autocmd BufNewFile * startinsert
@nimish-gupta
nimish-gupta / play-with-docker.dockerfile
Last active May 12, 2020 14:27
This script i use for generally up and running on play with docker for any of my development.
FROM node:latest
RUN apt-get update && apt-get install vim -y
RUN mkdir -p ~/.vim/colors && \
git clone https://github.com/crusoexia/vim-monokai.git && \
cp vim-monokai/colors/monokai.vim ~/.vim/colors/ && \
rm -rf vim-monokai
RUN git clone https://gist.github.com/11aecdb37904750ca469f34b97239d6f.git vimrc-config && \
@nimish-gupta
nimish-gupta / render.re
Created June 29, 2019 17:06
React render Lifecycle implemented using Reason React hooks
[@react.component]
let make = (~name) => {
// the whole body of this method comes under render lifecycle.
name -> React.string;
};
@nimish-gupta
nimish-gupta / constructor.re
Created June 29, 2019 16:44
React constructor Lifecycle implemented using Reason React hooks
type state = { counter: int };
// Assign intial state in constructor method
let initialState = () => { counter: 0 };
[@react.component]
let make = () => {
let (state, setState) => React.useState(initialState);
"initial state is set using hooks" -> React.string;
@nimish-gupta
nimish-gupta / componentDidUpdate.re
Last active June 29, 2019 17:29
React componentDidUpdate LifeCycle implemented in Reason React hooks
[@react.component]
let make = (~name, ~) => {
let (counter, setCounter) => React.useState(() => 0);
// This will allow the change of the state/props only if certain props are passed or changed to.
React.useEffect1(
() => {
if (name === "componentDidUpdate") {
setCounter(_ => counter + 1);
None
@nimish-gupta
nimish-gupta / componentWillUnMount.re
Last active June 29, 2019 16:04
React componentWillUnMount Lifecycle implemented in Reason React hooks
[@react.component]
let make = () => {
let (counter, setCounter) = React.useState(() => 0);
React.useEffect(() => {
let clearTimeout = Js.Global.setTimeout(() => setCounter(_ => counter + 1), 500);
Some(Js.Global.clearTimeout(clearTimeout)) // This will be called when the component will be un-mounted
});
("Counter is updated " ++ counter -> string_of_int ++ " times.") -> React.string;
@nimish-gupta
nimish-gupta / componentDidMount.re
Last active June 29, 2019 17:26
React ComponentDidMount LifeCycle implemented using Reason React hooks
[@react.component]
let make = (~name: string) => {
let (counter, setCounter) = React.useState(() => 0);
// Enter any thing you want to enter in componentDidMount.
React.useEffect1(
() => {
setCounter(_ => counter + 1);
None
},