Skip to content

Instantly share code, notes, and snippets.

View shelldandy's full-sized avatar
🏠
Working from home

Miguel P shelldandy

🏠
Working from home
View GitHub Profile
@mikoim
mikoim / README.md
Last active October 2, 2025 02:55
[Updated! Aug 14 2020] YouTube recommended encoding settings on ffmpeg (+ libx264)

Parameters

Container: MP4

Parameter YouTube recommends setting
-movflags faststart moov atom at the front of the file (Fast Start)

Video codec: H.264

/*
Streamlined Shopify theme development.
NOTE: depends on module gulp-shopify-theme
npm install --save-dev yargs gulp gulp-sass gulp-changed gulp-sourcemaps gulp-autoprefixer gulp-uglify gulp-concat gulp-replace gulp-plumber gulp-babel browser-sync gulp-if del gulp-add-src gulp-rename gulp-yaml gulp-shopify-theme
Highlights:
- https proxying via BrowserSync
// Bonfire: Find the Longest Word in a String
// Author: @mike3run
// Challenge: http://www.freecodecamp.com/challenges/bonfire-find-the-longest-word-in-a-string?solution=function%20findLongestWord(str)%20%7B%0A%20%20var%20array%20%3D%20str.split(%27%20%27)%3B%0A%20%20var%20arrayLength%20%3D%20array.length%3B%0A%20%20var%20numeros%20%3D%20%5B%5D%3B%0A%20%20for%20(i%20%3D%200%3B%20i%3C%20arrayLength%20%3B%20i%2B%2B)%7B%0A%20%20%20%20var%20conteo%20%3D%20array%5Bi%5D.length%3B%0A%20%20%20%20numeros.push(conteo)%3B%0A%20%20%7D%0A%20%20return%20Math.max.apply(%20Math%2C%20numeros%20)%3B%0A%7D%0A%0AfindLongestWord(%22The%20quick%20brown%20fox%20jumped%20over%20the%20lazy%20dog%22)%3B%0A
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function findLongestWord(str) {
var array = str.split(' ');
var arrayLength = array.length;
var numeros = [];
for (i = 0; i< arrayLength ; i++){
// Bonfire: Check for Palindromes
// Author: @mike3run
// Challenge: http://www.freecodecamp.com/challenges/bonfire-check-for-palindromes?solution=function%20palindrome(str)%20%7B%0A%20%20%2F%2F%20Good%20luck!%0A%20%20var%20min%20%3D%20str.toLowerCase().replace(%2F%5Cs%2B%2Fg%2C%20%27%27).replace(%2F%5B.%2C-%5C%2F%23!%24%25%5C%5E%26%5C*%3B%3A%7B%7D%3D%5C-_%60~()%5D%2Fg%2C%22%22)%3B%0A%20%20var%20inv%20%3D%20min.split(%27%27).reverse().join(%27%27)%3B%0A%20%20%0A%20%20if%20(min%20%3D%3D%3D%20inv)%20%7B%0A%20%20%20%20return%20true%3B%0A%20%20%7Delse%20%7B%0A%20%20%20%20return%20false%3B%0A%20%20%7D%0A%7D%0A%0A%0A%0Apalindrome(%22A%20man%2C%20a%20plan%2C%20a%20canal.%20Panama%22)%3B%0A
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function palindrome(str) {
// Good luck!
var min = str.toLowerCase().replace(/\s+/g, '').replace(/[.,-\/#!$%\^&\*;:{}=\-_`~()]/g,"");
var inv = min.split('').reverse().join('');
@tonymtz
tonymtz / gist:d75101d9bdf764c890ef
Last active July 24, 2025 16:11
Uninstall nodejs from OSX Yosemite
# first:
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
# To recap, the best way (I've found) to completely uninstall node + npm is to do the following:
# go to /usr/local/lib and delete any node and node_modules
cd /usr/local/lib
sudo rm -rf node*
@joshcarr
joshcarr / window-height-width.js
Created July 3, 2014 00:04
vanilla JS window width and height
// vanilla JS window width and height
var w=window,
d=document,
e=d.documentElement,
g=d.getElementsByTagName('body')[0],
x=w.innerWidth||e.clientWidth||g.clientWidth,
y=w.innerHeight||e.clientHeight||g.clientHeight;
@kosinix
kosinix / custom-nav-walker-usage.php
Last active January 4, 2025 08:57
WordPress: Using a custom nav walker to create navigation menus in plain <a> tags. That is the <ul> and <li> tags are not present. Very useful if you want to create simple links that can be centered with a simple text-align:center on the containing element.
<?php
// In your template files like footer.php
// The items_wrap value ('%3$s') removes the wrapping <ul>, while the custom walker (Nav_Footer_Walker) removes the <li>'s.
wp_nav_menu(array('items_wrap'=> '%3$s', 'walker' => new Nav_Footer_Walker(), 'container'=>false, 'menu_class' => '', 'theme_location'=>'footer', 'fallback_cb'=>false ));
?>
@carolineschnapp
carolineschnapp / gist:5397337
Last active January 20, 2023 10:11
Sample JavaScript file added with ScriptTag resource. This sample file is meant to teach best practices. Your app will load jQuery if it's not defined. Your app will load jQuery if jQuery is defined but is too old, e.g. < 1.7.
/* Sample JavaScript file added with ScriptTag resource.
This sample file is meant to teach best practices.
Your app will load jQuery if it's not defined.
Your app will load jQuery if jQuery is defined but is too old, e.g. < 1.7.
Your app does not change the definition of $ or jQuery outside the app.
Example: if a Shopify theme uses jQuery 1.4.2, both of these statements run in the console will still return '1.4.2'
once the app is installed, even if the app uses jQuery 1.9.1:
jQuery.fn.jquery => "1.4.2"
$.fn.jquery -> "1.4.2"
*/
@chrisroos
chrisroos / gpg-import-and-export-instructions.md
Created September 9, 2011 10:49
Instructions for exporting/importing (backup/restore) GPG keys

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/

or, instead of backing up trustdb...

@sbusso
sbusso / asshole.js
Created May 25, 2011 07:29 — forked from Kilian/annoying.js
How to be an asshole
/**
* Annoying.js - How to be an asshole to your users
*
* DO NOT EVER, EVER USE THIS.
*
* Copyright (c) 2011 Kilian Valkhof (kilianvalkhof.com)
* Visit https://gist.github.com/767982 for more information and changelogs.
* Licensed under the MIT license. http://www.opensource.org/licenses/mit-license.php
*
*/