Skip to content

Instantly share code, notes, and snippets.

View elzii's full-sized avatar

Alexander Zizzo elzii

View GitHub Profile
@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
/*
* @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 / 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
@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 / 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 / mario.css
Created January 5, 2015 21:29
mario css
.mario {
width: 1em;
height: 1em;
z-index: 999999999999999;
position: fixed;
left: 50%;
margin-left: -2em;
bottom: 15em;
-webkit-box-shadow: 1em 0em 0em 0em #f83800, 2em 0em 0em 0em #f83800, 3em 0em 0em 0em #f83800, 4em 0em 0em 0em #f83800, 5em 0em 0em 0em #f83800, 0em 1em 0em 0em #f83800, 1em 1em 0em 0em #f83800, 2em 1em 0em 0em #f83800, 3em 1em 0em 0em #f83800, 4em 1em 0em 0em #f83800, 5em 1em 0em 0em #f83800, 6em 1em 0em 0em #f83800, 7em 1em 0em 0em #f83800, 8em 1em 0em 0em #f83800, 0em 2em 0em 0em #af7f00, 1em 2em 0em 0em #af7f00, 2em 2em 0em 0em #af7f00, 3em 2em 0em 0em #ffa347, 4em 2em 0em 0em #ffa347, 5em 2em 0em 0em #af7f00, 6em 2em 0em 0em #ffa347, -1em 3em 0em 0em #af7f00, 0em 3em 0em 0em #ffa347, 1em 3em 0em 0em #af7f00, 2em 3em 0em 0em #ffa347, 3em 3em 0em 0em #ffa347, 4em 3em 0em 0em #ffa347, 5em 3em 0em 0em #af7f00, 6em 3em 0em 0em #ffa347, 7em 3em 0em 0em #ffa347, 8em 3em 0em 0em #ffa347, -1em 4em 0em 0em #af7f00, 0em 4em 0em 0em #ffa347, 1em 4em 0em 0em #af7f00, 2em 4em 0em 0em
if(typeof jQuery == 'undefined') {
console.log('%cERROR', 'color:red', ' - jQuery not found.')
} else {
var App;
!(function ($) {
"use strict";
@elzii
elzii / index.js
Created August 19, 2014 20:42
requirebin sketch
// example using the raf module from npm. try changing some values!
var markdown = require('markdown').markdown;
var $ = require('jquery');
var canvas = document.createElement("canvas");
$.ajax({
url: 'https://api.github.com/repos/ruipgil/scraperjs/contents/README.md',
type: 'GET',
})
@elzii
elzii / leahslider.js
Created May 6, 2014 18:59
leah slider
var tot = images.length,
c = 0, // current image (array key index)
duration = 150,
$hero_image = $('.hero-image'),
$slide_cap = $('#slideCaption');
function initSlide(){
$hero_image.css('background-image', images[c]);
$slide_cap.html(captions[c]);
}
@elzii
elzii / chrome_fix.js
Created March 27, 2014 19:21
Chrome "Invisible Font" fix
!(function ($) {
// user-agent && user-agent helper methods
var ua = navigator.userAgent;
var regex_apple_webkit = new RegExp(/AppleWebKit\/([\d.]+)/);
var result_apple_webkit_regex = regex_apple_webkit.exec(ua);
var apple_webkit_version = (result_apple_webkit_regex === null ? null : parseFloat(regex_apple_webkit.exec(ua)[1]));
// global variables
var GLOBALS = {