Skip to content

Instantly share code, notes, and snippets.

View m0o0scar's full-sized avatar
💻
Oscar + coffee + AI => code

Oscar m0o0scar

💻
Oscar + coffee + AI => code
  • Sea
  • Singapore
View GitHub Profile
@ydeshayes
ydeshayes / Setting scroll position with ReactJS
Last active November 16, 2021 15:42
Setting scroll position with ReactJS
// Edit from http://blog.vjeux.com/2013/javascript/scroll-position-with-react.html
componentDidMount() {
const node = ReactDOM.findDOMNode(this);
node.scrollTop = node.scrollHeight;
}
componentWillUpdate: function() {
const node = this.getDOMNode();
this.shouldScrollBottom = node.scrollTop + node.offsetHeight === node.scrollHeight;
},
@sumardi
sumardi / gist:5559896
Created May 11, 2013 12:56
Subdirectory checkouts with Git sparse-checkout
# New repository
mkdir <repo> && cd <repo>
git init
git remote add –f <name> <url>
git config core.sparsecheckout true
echo some/dir/ >> .git/info/sparse-checkout
echo another/sub/tree >> .git/info/sparse-checkout
git pull <remote> <branch>
# Existing repository