Skip to content

Instantly share code, notes, and snippets.

View unyo's full-sized avatar

Cody Moniz unyo

View GitHub Profile
@unyo
unyo / player.html
Created May 11, 2016 21:22
MP3 Player for simple http server with file listing
<script src="https://code.jquery.com/jquery-2.2.3.js" integrity="sha256-laXWtGydpwqJ8JA+X9x2miwmaiKhn8tVmOVEigRNtP4=" crossorigin="anonymous"></script>
<script>
$(function() {
var audio;
var playlist;
var tracks;
var current;
fetch('./').then((res) => {
res.text().then((text) => {
let tmp = $('<div />').html(text)
@unyo
unyo / player2.html
Created June 15, 2016 00:24
player2.html
<script>
/* Zepto v1.1.6 - zepto event ajax form ie - zeptojs.com/license */
var Zepto=function(){function L(t){return null==t?String(t):j[S.call(t)]||"object"}function Z(t){return"function"==L(t)}function _(t){return null!=t&&t==t.window}function $(t){return null!=t&&t.nodeType==t.DOCUMENT_NODE}function D(t){return"object"==L(t)}function M(t){return D(t)&&!_(t)&&Object.getPrototypeOf(t)==Object.prototype}function R(t){return"number"==typeof t.length}function k(t){return s.call(t,function(t){return null!=t})}function z(t){return t.length>0?n.fn.concat.apply([],t):t}function F(t){return t.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function q(t){return t in f?f[t]:f[t]=new RegExp("(^|\\s)"+t+"(\\s|$)")}function H(t,e){return"number"!=typeof e||c[F(t)]?e:e+"px"}function I(t){var e,n;return u[t]||(e=a.createElement(t),a.body.appendChild(e),n=getComputedStyle(e,"").getPropertyValue("display"),e.parentNode.removeChild(e),"none"==n
@unyo
unyo / params.js
Created August 9, 2016 23:52
Params.js - A simple, flexible parameter module
var params = function(w) {
var win = w || window;
var baseQstring = (win.location.search) ? win.location.search : (win.location.hash.split('?')[1] || '');
var qstring = decodeURIComponent(baseQstring.replace('?',''));
var keyval_groups = qstring.split(/[\?&]/);
var p = {};
for (var i in keyval_groups) {
var first_equal = keyval_groups[i].indexOf('=')
var key = keyval_groups[i].slice(0, first_equal);
var value = keyval_groups[i].slice(first_equal+1);
@unyo
unyo / wrap-array.js
Last active January 20, 2017 00:24
Wrapping array index snippet
// Here is an easy way to increment / decement an index by any amount and get the correct value if you were in an infinite / wrapping array
var x = [0, 1, 2, 3, 4] // this is the wrapping array we want
var n = x.indexOf(0) // this is the index
n++ // now you increment or decment, by any amount
var val = x[(n>=0)?n%x.length:x.length+n] // this is the magic wrapping sauce
console.log(val==1)// true
n = -1
val = x[(n>=0)?n%x.length:x.length+n]
console.log(val==4)
n = -2
@unyo
unyo / nested-data.js
Last active August 4, 2018 00:06
Get and Set Nested Data in an Array
// # setNestedData
export function setNestedData(root, path, value) {
var paths = path.split('.');
var last_index = paths.length - 1;
paths.forEach(function(key, index) {
if (!(key in root)) root[key] = {};
if (index==last_index) root[key] = value;
root = root[key];
});
return root;
@unyo
unyo / package-list.txt
Last active August 9, 2018 18:41
Atom.io Plugin List (ES6 JSX React Redux MobX)
Sublime-Style-Column-Selection@1.7.4
atom-beautify@0.32.4
atom-jade@0.3.0
auto-detect-indentation@1.3.0
auto-indent@0.5.0
autocomplete-modules@2.0.0
blame@1.0.1
busy-signal@1.4.3
custom-title@1.0.1
emmet@2.4.3
@unyo
unyo / .vimrc
Last active May 1, 2018 05:52
.vimrc
set tabstop=2
set shiftwidth=2
set expandtab
set autoindent
set noswapfile
set nobackup
syntax on
@unyo
unyo / .profile
Last active June 23, 2018 01:06
.profile
# bash history w/ tmux (order matters)
shopt -sq cdspell cmdhist extglob histappend
export PROMPT_COMMAND="history -a; $PROMPT_COMMAND"
# new bash prompt (single quotes important)
export PS1='[\u@\h:\w ] $ '
config defaultToCurrentScreen true
config nudgePercentOf screenSize
config resizePercentOf screenSize
# Push Bindings
bind right:ctrl,cmd push right bar-resize:screenSizeX/2
bind left:ctrl,cmd push left bar-resize:screenSizeX/2
bind up:ctrl,cmd push up bar-resize:screenSizeY/2
bind down:ctrl,cmd push down bar-resize:screenSizeY/2
bind up:ctrl,alt,cmd resize 100% 100% top-left
@unyo
unyo / initiate.sh
Last active October 1, 2018 05:02
OSX initiation script
# # Install brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# # Install apps
brew install docker docker-compose tmux wget curl git
brew cask install atom slate blender ultimaker-cura google-chrome gimp firefox gqrx inkscape keka figma slack synergy zoom.us virtualbox vlc
# # Install settings files
wget https://gist.githubusercontent.com/unyo/bfcdfc81a66d2101c67aced713f5dedd/raw/3adc63023d3fc531dd8f8f87ee27c92d3485841f/.bashrc
wget https://gist.githubusercontent.com/unyo/b405b78b5a01926fbbce0452c4b69eaf/raw/0a3159012de010913eb87e887a6cd2c84568bb80/.slate
wget https://gist.githubusercontent.com/unyo/284cbbd269cde81f85b9e4162a6b6128/raw/f1cb2ec4dc4bb319124cb9f58f42ded7bcf5a4bf/.vimrc
wget https://gist.githubusercontent.com/unyo/8f280210381ff9a3f41fb7ab4cff7d43/raw/3b902fff44959c2443d8ad3ece1da63c54e69978/package-list.txt