Skip to content

Instantly share code, notes, and snippets.

View MarioRicalde's full-sized avatar

Mario Ricalde MarioRicalde

View GitHub Profile
@MarioRicalde
MarioRicalde / shopify_checkout.js
Created October 22, 2019 05:02
Shopify Checkout.liquid javascript helper to parse product list.
console.clear()
var product_rows = document.querySelectorAll('.sidebar .product-table .product')
var products_main = []
var products_accs = []
var product_main_strings = ["Regex Title"]
var product_accs_strings = ["Regex Title2", "Regex Title3"]
var matchProducts = function(i) { if ( this.product.name.match(i) ) this.array.push(this.product) }
@MarioRicalde
MarioRicalde / youtube-url-regexp.php
Last active February 18, 2021 06:32
YouTube URL PHP Regexp Shit
<?php
/**
* YouTube Preg Match Test Case.
*
* @author Mario "Kuroir" Ricalde
*/
// Regular Expression (the magic).
$youtube_regexp = "/^http:\/\/(?:www\.)?(?:youtube.com|youtu.be)\/(?:watch\?(?=.*v=([\w\-]+))(?:\S+)?|([\w\-]+))$/";

Zapier YouTube Playlist to Spotify Playlist sync

Actions:

  1. Trigger: New Video in Playlsit in YouTube
  2. Action: Run javascript (below)
  3. Action: Find Track in Spotify (using artist and track from previous step)
  4. Action: Add Track to Playlist in Spotify (id passed from previous step )
@MarioRicalde
MarioRicalde / git-recover-branch.md
Created October 29, 2012 01:30 — forked from jbgo/git-recover-branch.md
How to recover a git branch you accidentally deleted

Oops! I accidentally deleted a local git branch, and I haven't pushed it to a remote server yet. The branch has several important commits, and it hasn't been merged with any other branches yet. How do I find the missing branch?

1. Create a list of all dangling or unreachable commits.

$ git fsck --full --no-reflogs --unreachable --lost-found
unreachable tree 4a407b1b09e0d8a16be70aa1547332432a698e18
unreachable tree 5040d8cf08c78119e66b9a3f8c4b61a240229259
unreachable tree 60c0ce61b040f5e604850f747f525e88043dae12
unreachable tree f080522d06b9853a2f18eeeb898724da4af7aed9

Keybase proof

I hereby claim:

  • I am marioricalde on github.
  • I am marioricalde (https://keybase.io/marioricalde) on keybase.
  • I have a public key ASBHC1_HoAIVPv5YPGbtRFwUOTcKW5gD1x-WX8Fwp1-jZwo

To claim this, I am signing this object:

@MarioRicalde
MarioRicalde / shopify_checkout.js
Created October 22, 2019 05:02
Shopify Checkout.liquid javascript helper to parse product list.
console.clear()
var product_rows = document.querySelectorAll('.sidebar .product-table .product')
var products_main = []
var products_accs = []
var product_main_strings = ["Regex Title"]
var product_accs_strings = ["Regex Title2", "Regex Title3"]
var matchProducts = function(i) { if ( this.product.name.match(i) ) this.array.push(this.product) }
@MarioRicalde
MarioRicalde / sshd_config.sh
Created July 25, 2014 23:08
SSH config that is password less – the file for OSX is located in `/private/etc/sshd_config` – then restart ssh with `sudo killall ssh-agent`.
# $OpenBSD: sshd_config,v 1.89 2013/02/06 00:20:42 dtucker Exp $
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options override the

Mac Color Picking Done Right

Picking a Color on Mac is hard. Mainly due to the fact that several applications floating around the web ( AppStore and independant ), grab the color "incorrectly".

Why incorrectly?

The color picker is not picking the "real" color, but rather, it's picking the color that your screen is displaying, what do I mean?

Lets try to grab the following color:

@MarioRicalde
MarioRicalde / install-all-sky-fonts.js
Last active January 3, 2016 04:58
Installing all SkyFonts - run this on your JavaScript console.
var time = 500;
$('.skyfonts-wrapper').each(function() {
var el = this;
time += 500;
setTimeout( function() {
$(el).find('button').click().parent().parent().find('.skyfonts-dropdown .input-submit').click();
console.log('installing...');
}, time );
})
" ---------------------------------------------------------------------------------------------------
" Search and Replace Functionality
" https://github.com/MarioRicalde/vim-qargs/tree/master/plugin
" :vimgrep /match/ **
" :Qdo %s//replace/g
command! -nargs=0 -bar Qargs execute 'args ' . s:QuickfixFilenames()
command! -nargs=1 -complete=command -bang Qdo call s:Qdo(<q-bang>, <q-args>)
command! -nargs=1 -complete=command -bang Grep call s:Grep(<q-bang>, <q-args>)