Skip to content

Instantly share code, notes, and snippets.

View nashio's full-sized avatar
🏠
Working from home

Ignacio Chavez nashio

🏠
Working from home
View GitHub Profile
@nashio
nashio / denite.md
Created January 27, 2019 06:08 — forked from dlants/denite.md
denite setup with interactive ag pattern-search of project contents

Files

First things first, I want to use ag to search through my project files. Coming from fzf, I like to have two bindings for this -- one that respects my projects .gitignore and one that does not. The latter is helpful if I want to examine a built file or look at a node_module dependency while working on my js project.

I use an alias for file_rec source to toggle the -u flag on ag. Now, <C-P> searches in my git files, and <C-O> searches everything.

" denite file search (c-p uses gitignore, c-o looks at everything)
map <C-P> :DeniteProjectDir -buffer-name=git -direction=top file_rec/git<CR>
map  :DeniteProjectDir -buffer-name=files -direction=top file_rec
@nashio
nashio / 1.js
Created June 2, 2018 04:24 — forked from getify/1.js
waitForEvent(..) -- promisified event listener
function waitForEvent(elem,evtName) {
return new Promise(function c(resolve){
elem.addEventListener(evtName,function onEvent(evt){
elem.removeEventListener(evtName,onEvent,false);
resolve(evt);
},false);
});
}
@nashio
nashio / requestAnimationFrame.js
Created March 27, 2018 05:01 — forked from jacob-beltran/requestAnimationFrame.js
React Performance: requestAnimationFrame Example
// How to ensure that our animation loop ends on component unount
componentDidMount() {
this.startLoop();
}
componentWillUnmount() {
this.stopLoop();
}