Skip to content

Instantly share code, notes, and snippets.

Avatar
🎉
Enjoying Life

Edgar Muentes Emuentes

🎉
Enjoying Life
View GitHub Profile
@Emuentes
Emuentes / Convert_mov_to_gif_using_ffmpeg.sh
Last active Jun 24, 2020
Bash Function to convert an MOV file into an animated gif (great for adding a small animated clip of new functionality to a Pull Request)
View Convert_mov_to_gif_using_ffmpeg.sh
function convertMovToGif
{
pathToSourceFile=$1
pathToSourceFileDirectory=$(dirname "${pathToSourceFile}")
fileName=$(basename "${pathToSourceFile}")
filenameWithoutExtension="${fileName%.*}"
nameToSaveFileAs="$2"
generatedFilePath="$pathToSourceFileDirectory/${nameToSaveFileAs:-$filenameWithoutExtension-generated}.gif"
echo "*************************************"
echo "-----VIDEO TO GIF - INPUT DATA-------"
@Emuentes
Emuentes / index.js
Created Oct 16, 2019
Run all files in repl.it root folder
View index.js
// This will automatically import all the files in your repl's root folder that have a file name beginning with "autoAdd"
var files = fs.readdirSync('./');
for(file of files) {
if(file.startsWith("autoAdd")) {
require("./" + file);
}
}
View A game of CAT & MOUSE (pointer)
// Playing around with the Higher Order Components exercise from the React-Training github!
// https://github.com/ReactTraining/react-workshop/tree/master/subjects/HigherOrderComponents
// FUN FUN FUN!!!
import React from 'react'
import ReactDOM from 'react-dom'
import PropTypes from 'prop-types'
import * as styles from './styles'
const withMouse = (Component) => {
@Emuentes
Emuentes / firebase-graphql-basic.js
Created Sep 26, 2017 — forked from brygrill/firebase-graphql-basic.js
Deploying a GraphQL Server with Firebase Functions
View firebase-graphql-basic.js
// sample graphql server deployed with firebase functions
// minimal server setup
// via http://graphql.org/graphql-js/running-an-express-graphql-server/
const functions = require('firebase-functions');
const express = require('express');
const graphqlHTTP = require('express-graphql');
const { buildSchema } = require('graphql');
// Init express
const app = express();
View external_links_css_selector_generator.js
@Emuentes
Emuentes / git-checkout-remote-branches.sh
Last active Mar 22, 2016
GIT checkout ALL remote branches other than "origin/master", "origin/develop", & origin/HEAD which comes up in the git remote branch list.
View git-checkout-remote-branches.sh
git branch -r | grep -v -E '(\*|master$|develop$|HEAD$)' | cut -f2- -d '/' | xargs -n 1 git checkout
@Emuentes
Emuentes / git_push_all_local_branches_upstream_to_origin.sh
Last active Mar 2, 2016
Push all local branches to upstream origin -- handy when migrating to a new git host
View git_push_all_local_branches_upstream_to_origin.sh
# handy when migrating your local branches to a new git host
# git branch prints out each local branch on it's own line
# the grep command excludes the lines that end with master, develop, or HEAD
# it also excludes the currently checked out branch, which begins with an asterisk
# for example:
# if your git branch command returns the following:
# *develop
# master
@Emuentes
Emuentes / Preferences.sublime-settings
Created Feb 18, 2016
My current sublime settings
View Preferences.sublime-settings
{
"auto_complete_triggers":
[
{
"characters": "<",
"selector": "text.html"
},
{
"characters": " ",
"selector": "text.html meta.tag"
@Emuentes
Emuentes / two_branch_cleanup_scripts.sh
Last active Oct 12, 2020
SCRIPT-ONE: will print the names of the branches that have been merged into develop AND master in green. Also, branches that are only merged into develop but not master are listed in red. ---- SCRIPT-TWO: will delete the fully merged branches, those listed in green when you run SCRIPT-ONE
View two_branch_cleanup_scripts.sh
#######################################
# SCRIPT 1 - PREVIEW BRANCH DELETIONS #
#######################################
# will print the names of the branches that have been merged into develop and master in green and branches that are only merged into develop but not master in red.
BRANCHES_IN_MASTER=`git branch -r --merged origin/master | grep -v -E '(\*|master$|develop$)' | cut -f2- -d '/' | tr '\n' ';'` && export BRANCHES_IN_MASTER && git branch -r --merged origin/develop | grep -v -E '(\*|master$|develop$)' | cut -f2- -d '/' | xargs -L1 bash -c 'if [ $(grep -o "$0" <<< "$BRANCHES_IN_MASTER" | wc -l) -gt 0 ] ; then printf "\e[0;32m $0 \e[0m\n"; else printf "\e[0;31m $0 is merged into DEVELOP but not MASTER \e[0m\n"; fi';
#################################################################################################################################
# SCRIPT 2 - DANGER -- RUN AT YOUR OWN RISK -- The following script will DELETE the branches listed in the above preview script #
###########################
@Emuentes
Emuentes / delete_merged_remote_branches.sh
Last active Sep 17, 2018
Delete remote git branches that have been merged into develop
View delete_merged_remote_branches.sh
# Breakdown of the process
# NOTE: I am searching for branches merged into Develop because I'm using GiT flow
# 1) git branch -r --merged develop
# Get remote branches that have been merged into develop
# 2) grep -v -E '(\*|master|develop)'
# From those branches returned by the above command,
# exclude: master, develop, & the currently selected branch (the branch name beggining with an asterisk)