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 / midi-threejs-poc.jsx
Created June 15, 2025 19:45
Proof of concept manipulating 3D objects with MIDI
import { useRef, useState, useEffect } from 'react'
import { AxesHelper, GridHelper } from 'three'
import { Canvas, useFrame } from '@react-three/fiber'
import { OrbitControls } from '@react-three/drei'
const SPEED = 28
// MIDI Status Codes
const MIDI_STATUS = {
NOTE_ON_CH1: 144,
@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();
}
@nashio
nashio / js-types.js
Created December 18, 2017 18:23
Javascript Types
function isBoolean (v) { return typeof v === 'boolean'; }
function isNumber (v) { return typeof v === 'number'; }
function isString (v) { return typeof v === 'string'; }
function isNumeric (v) { return isNumber(v) || (isString(v) && String(v * 1) === v); }
function isSymbol (v) { return typeof v === 'symbol'; }
function isObject (v) { return v !== null && v === Object(v) && Object.prototype.toString.call(v) === '[object Object]'; }
function isFunction (v) { return v && typeof v === 'function'; }
function isArray (v) { return v && Array.isArray(v); }
function isElement (v) { return v && v.tagName; }
function isset (v) { return v !== null && typeof v !== 'undefined'; }
@nashio
nashio / promise-implementation.js
Last active December 4, 2017 09:38
Promise implementation
Class PromiseDemo {
constructor(executionFunction) {
this.promiseChain = [];
this.handleError = () => {};
this.onResolve = this.onResolve.bind(this);
this.onReject = this.onReject.bind(this);
executionFunction(this.onResolve, this.onReject);
}
@nashio
nashio / .zsh
Created August 11, 2017 15:47
Add Ctrl-P functionality to FZF in the terminal (from Adam Heins)
# This is the same functionality as fzf's ctrl-t, except that the file or
# directory selected is now automatically cd'ed or opened, respectively.
fzf-open-file-or-dir() {
local cmd="command find -L . \
\\( -path '*/\\.*' -o -fstype 'dev' -o -fstype 'proc' \\) -prune \
-o -type f -print \
-o -type d -print \
-o -type l -print 2> /dev/null | sed 1d | cut -b3-"
local out=$(eval $cmd | fzf-tmux --exit-0)
@nashio
nashio / keybase.md
Created January 5, 2017 03:32
keybase verification

Keybase proof

I hereby claim:

  • I am nashio on github.
  • I am nashio (https://keybase.io/nashio) on keybase.
  • I have a public key whose fingerprint is 53F8 A3F0 D3EA 67C9 7FDC 2E77 9D71 3EA1 2DBD 7688

To claim this, I am signing this object:

@nashio
nashio / module-export-example.js
Last active August 26, 2016 23:32
Exporting a function for AMD, Common.js and global
(function () {
'use strict';
function methodName () {
}
if (typeof module !== 'undefined' && module.exports) {
module.exports = methodName;
else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {
// register as 'methodname', consistent with npm package name
@nashio
nashio / gist:19fd6e533d15dc7fe4a1
Last active August 29, 2015 14:23
jQuery plugin starter
/*
* jQuery plugin boiler
* Author: @nashio
*/
;(function($, window, document, undefined) {
var pluginName = 'myPlugin';
var defaults = {