Skip to content

Instantly share code, notes, and snippets.

View jitinmaher's full-sized avatar
🎯
Focusing

Jitin Maherchandani jitinmaher

🎯
Focusing
View GitHub Profile
@jitinmaher
jitinmaher / repos.json
Last active September 20, 2021 15:17
Top Repos to contribute to
{
"AI":[
"git://github.com/viebel/klipse.git, HTML, 2775",
"git://github.com/EvgSkv/logica.git, Jupyter Notebook, 1233",
"git://github.com/mthom/scryer-prolog.git, Rust, 934",
"git://github.com/triska/the-power-of-prolog.git, HTML, 825",
"git://github.com/SWI-Prolog/swipl-devel.git, C, 603",
"git://github.com/Anniepoo/prolog-examples.git, Prolog, 445",
"git://github.com/tau-prolog/tau-prolog.git, JavaScript, 385",
"git://github.com/klaussinani/awesome-prolog.git, null, 371",
@jitinmaher
jitinmaher / StickyFunctionalComponent.js
Created November 25, 2018 16:00
Sticky header using hooks
import React from "react";
import { useEffect, useState } from "react";
import SomeRandomText from "./SomeRandomText";
import "./App.css";
function App() {
const fixedText = "I am fixed :)";
const whenNotFixed = "I am not a fixed header :(";
const [headerText, setHeaderText] = useState(whenNotFixed);
useEffect(() => {
@jitinmaher
jitinmaher / StickyHeaderWithClass.js
Created November 25, 2018 15:57
This gist creates sticky header implemented in react classes
import React, { Component } from "react";
import SomeRandomText from "./SomeRandomText";
import "./styles.css";
export default class App extends Component {
constructor(props) {
super(props);
this.state = {
headerText: "I am not fixed :("
};
@jitinmaher
jitinmaher / useScrollListner.js
Last active November 25, 2018 16:08
This gist creates a custom plug and play hook "useScrollListner" which accepts element id and changes the sticky behaviour of the node when user scrolls through the page
import React, { useEffect, useState } from 'react';
const fixedText = 'I am fixed :)';
const whenNotFixed = 'I am not a fixed header :(';
function handleStickyness( node, setText ) {
node.classList.add("sticky");
document.title = fixedText;
setText( fixedText );
}