Skip to content

Instantly share code, notes, and snippets.

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

Miguel Palau shelldandy

🏠
Working from home
View GitHub Profile
@shelldandy
shelldandy / likes-cleaner.js
Last active September 14, 2021 15:13
Scrub your likes from Twitter
import Twitter from 'twitter-lite'
import sleep from 'sleep'
import chalk from 'chalk'
const options = {
consumer_key: process.env.CONSUMER_KEY,
consumer_secret: process.env.CONSUMER_SECRET,
access_token_key: process.env.ACCESS_TOKEN_KEY,
access_token_secret: process.env.ACCESS_TOKEN_SECRET
}
@shelldandy
shelldandy / cuda_gopro_export.sh
Last active June 28, 2021 21:17
Linux DaVinci Resolve back to original bitrate on h265 using nvidia hwaccel
#!/usr/bin/bash
#
# Author: BowlineDandy
#
# Convert DaVinci Resolve Videos Back to Original GoPro sizes
# And have them be web friendly as well
# Outperforms Compressor in Mac
# Requires Nvidia GPU
# Requires CUDA Enabled ffmpeg (Custom compiled from Source)
#
#!/bin/bash
font_family="FiraCode-Regular.ttf"
image="logo.jpg"
getMetaTitle (){
tmp=$( ffprobe "$1" 2>&1 | grep title)
echo ${tmp##*:}
}
@shelldandy
shelldandy / vanilla-js-accordion.js
Last active September 12, 2018 15:33
Like slideToggle from jquery but cooler
import loopQuery from '../tools/loopQuery' // https://gist.github.com/shelldandy/da437ea6a134dca26a4ceec42b88e893
import { faqs } from 'styles'
const accordion = ({
activeClass = 'js-accordion-active',
// The whole accordion
accordionSelector = '[data-accordion]',
// The part of the accordion that shrinks and shows
contentSelector = '[data-content]',
// The part of the accordion you click
@shelldandy
shelldandy / imagemin.js
Created July 18, 2018 14:36
Best Imagemin Settings with Gulp
const gulp = require('gulp')
const imagemin = require('gulp-imagemin')
const imageminPngquant = require('imagemin-pngquant');
const imageminZopfli = require('imagemin-zopfli');
const imageminMozjpeg = require('imagemin-mozjpeg'); // need to run 'brew install libpng'
const imageminGiflossy = require('imagemin-giflossy');
gulp.task('esketit', () =>
gulp.src(['src/**/*.{gif,png,jpg,jpeg,svg}'])
.pipe(imagemin([
@shelldandy
shelldandy / Toggle.js
Created July 3, 2018 13:07
A React Toggle Componer that uses render props
import { Component, createRef } from 'react';
import PropTypes from 'prop-types';
class Toggle extends Component {
state = {
on: false,
}
wrapper = createRef()
@shelldandy
shelldandy / webpack.config.js
Created April 2, 2018 14:54
Update webpack 3 to 4 with separate vendors of node_modules
{
// ...
optimization: {
splitChunks: {
cacheGroups: {
commons: {
test: /[\\/]node_modules[\\/]/,
name: 'vendor',
chunks: 'initial',
},
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQENBFnQbV8BCACyN7kRYtOgi9vY6cCp1BZcVKRBcJd6JZTieABLw6+Rgr2xozyl
e3npvPBtg2ccPQqlG0CgpJkxQfNpo7MhMp3svVcgebwnYzCrJmM95NU9IDYcAI9N
HR+HOAOIiXJTPX7nujoBshxZ2bl8GuJYggVLIyOEX5qtS49TdZ8jvRWkC9bxR3Jh
7O5PADlKe74Tce/k1nwQdlpIRJ+0zu/yDdjOuBtCxCrEX2h0GDHZD3xa8oYE2ed2
DBQO3bAB9x0MTcrwzatvtr163JTxGBKPc2GpC5mEaZCaLd1QhmfqtvlyLjeXHa2Z
TzDdimbDgSyY/HP67Hc0RMuCC8ovxGHIgxcnABEBAAG0Kk1pZ3VlbCBQYWxhdSBa
YXJ6YSA8bXBhbGF1emFyemFAZ21haWwuY29tPokBVAQTAQgAPhYhBIBn5gFjR1dK
CHpqfomJAF5ePzhuBQJZ0G1fAhsDBQkDwmcABQsJCAcCBhUICQoLAgQWAgMBAh4B
@shelldandy
shelldandy / loopQuery.js
Created March 19, 2018 04:55
Make a document.querySelectorAll loopable
/**
* Make a document.querySelectorAll loopable
* @author Todd Motto
* @tutorial https://toddmotto.com/ditch-the-array-foreach-call-nodelist-hack
* @param {NodeList} elements
* @param {Function} callback function that takes element and index
* @param {this} scope what this refers to
*/
const loopQuery = (elements, callback, scope) => {
for (let i = 0; i < elements.length; i++) {
// Paste in console on the product list in the admin
// EXAMPLE
// https://************.myshopify.com/admin/products
// Select all the links to product pages
function downloadSP (name) {
$(`tbody td a[href^="/admin/${name}"]`).each(function (index) {
const me = $(this)
// Grab the original href