export default class InfiniteLoader extends Component {
componentDidMount() {
window.addEventListener('scroll', this.handleScroll.bind(this))
}
componentWillUnMount() {
window.removeEventListener('scroll', this.handleScroll.bind(this))
}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const nameToURL = name => encodeURIComponent( | |
name.split(' ') | |
.map(str => str.toLowerCase()) | |
.join('-') | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const deepCompareObjects = (obj1, obj2) => { | |
// Create arrays of property names | |
const obj1Props = Object.getOwnPropertyNames(obj1) | |
const obj2Props = Object.getOwnPropertyNames(obj2) | |
// If number of properties is different, objects are not equivalent | |
if (obj1Props.length !== obj2Props.length) { | |
return false | |
} | |
for (let i = 0; i < obj1Props.length; i++) { | |
const propName = obj1Props[i] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Symbol GC test | |
require 'java' | |
java_import 'java.lang.System' | |
before = Symbol.all_symbols.size | |
100_000.times do |i| | |
"sym#{i}".to_sym |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
* 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) { |
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
OlderNewer