Skip to content

Instantly share code, notes, and snippets.

View elzii's full-sized avatar

Alexander Zizzo elzii

View GitHub Profile
@elzii
elzii / shopify-meteor.js
Created June 21, 2015 23:45
Shopify Meteor Simple API (Private Apps)
/**
* Shopify Client API
*/
Shopify = {}
var API = Shopify.API = function ShopifyAPI(options) {
this.config = {
shop: options.shop,
api_key: options.api_key || null,
@elzii
elzii / .htaccess
Created December 22, 2015 22:51
Redirect Wordpress uploads/ directory to production via .htaccess
# add this to .htaccess
RedirectMatch 301 /wp-content/uploads/(.*)$ http://example.com/wp-content/uploads/$1
@elzii
elzii / instructions.md
Last active November 15, 2016 19:15
Create new git repo from command line

Create new git repo from command line

This method uses storing your personal access token in a separate file, .secrets, so you can gitignore that file to keep your dotfiles safe during backups to potentially public repos.

Requirements

  • curl

Instructions

  1. Go to your Github profile page to create a personal access token
  2. Copy the new token and create a file in your root (~) folder called .secrets
/*
* @author Mudit Ameta
* @license https://github.com/zeusdeux/isInViewport/blob/master/license.md MIT
*/
!function(a,b){function c(b){var c,d=a("<div></div>").css({width:"100%"});return b.append(d),c=b.width()-d.width(),d.remove(),c}function d(e,f){var g=e.getBoundingClientRect(),h=g.top,i=g.bottom,j=g.left,k=g.right,l=a.extend({tolerance:0,viewport:b},f),m=!1,n=l.viewport.jquery?l.viewport:a(l.viewport);n.length||(console.warn("isInViewport: The viewport selector you have provided matches no element on page."),console.warn("isInViewport: Defaulting to viewport as window"),n=a(b));var o=n.height(),p=n.width(),q=n[0].toString();if(n[0]!==b&&"[object Window]"!==q&&"[object DOMWindow]"!==q){var r=n[0].getBoundingClientRect();h-=r.top,i-=r.top,j-=r.left,k-=r.left,d.scrollBarWidth=d.scrollBarWidth||c(n),p-=d.scrollBarWidth}return l.tolerance=~~Math.round(parseFloat(l.tolerance)),l.tolerance<0&&(l.tolerance=o+l.tolerance),0>=k||j>=p?m:m=l.tolerance?h<=l.tolerance&&i>=l.tolerance:i>0&&o>=h}String.prototype.has
@elzii
elzii / cmus-libgme.patch
Created November 15, 2016 19:14
Patch CMUS to have libgme (game-music-emulator) support
diff --git a/Makefile b/Makefile
index 162f0f2..61dc054 100644
--- a/Makefile
+++ b/Makefile
@@ -14,6 +14,7 @@ VERSION = $(or $(_ver0),$(_ver1),$(_ver2),$(_ver3))
all: main plugins man
-include config.mk
+-include config.mx
include scripts/lib.mk
@elzii
elzii / .vimrc
Created November 28, 2016 03:53
VIM setup Nov 2016
set nocompatible "We want the latest Vim settings/options.
so ~/.vim/plugins.vim
" ---------------------- Basic Settings -----------------------
syntax enable
set backspace=indent,eol,start "Make backspace behave like every other editor.
let mapleader = ',' "The default is \, but a comma is much better.
set number "Let's activate line numbers.
if empty(glob('~/.nvim/autoload/plug.vim'))
silent !curl -fLo ~/.nvim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall
endif
call plug#begin('~/.config/nvim/plugged')
Plug 'chriskempson/vim-tomorrow-theme'
@elzii
elzii / .tmux.conf
Created July 6, 2017 01:33
Sloppy tmux config
# ███ ▄▄▄▄███▄▄▄▄ ███ █▄ ▀████ ▐████▀
# ▀█████████▄ ▄██▀▀▀███▀▀▀██▄ ███ ███ ███▌ ████▀
# ▀███▀▀██ ███ ███ ███ ███ ███ ███ ▐███
# ███ ▀ ███ ███ ███ ███ ███ ▀███▄███▀
# ███ ███ ███ ███ ███ ███ ████▀██▄
# ███ ███ ███ ███ ███ ███ ▐███ ▀███
# ███ ███ ███ ███ ███ ███ ▄███ ███▄
# ▄████▀ ▀█ ███ █▀ ████████▀ ████ ███▄
# ============================================================================
@elzii
elzii / script.js
Last active July 7, 2017 00:18
Console script to convert SitePoint table of mimetypes to JSON string - https://www.sitepoint.com/mime-types-complete-list
var data = []
document.querySelectorAll('tbody tr').forEach(el => {
var td = el.querySelectorAll('td')
data.push({
'suffix': td[0].innerHTML.replace(/\./, ''),
'contentType': td[1].innerHTML
})
})
@elzii
elzii / data
Last active July 7, 2020 21:43
Example file to test getting data from API
{
"items": [
1,
2,
3,
4,
5
]
}