Skip to content

Instantly share code, notes, and snippets.

View johnrobertmcc's full-sized avatar

J.R. McCann johnrobertmcc

View GitHub Profile
@johnrobertmcc
johnrobertmcc / README.txt
Created February 17, 2022 03:33
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=builtin&optimize=false&runs=200&gist=
REMIX EXAMPLE PROJECT
Remix example project is present when Remix loads for the very first time or there are no files existing in the File Explorer.
It contains 3 directories:
1. 'contracts': Holds three contracts with different complexity level, denoted with number prefix in file name.
2. 'scripts': Holds two scripts to deploy a contract. It is explained below.
3. 'tests': Contains one test file for 'Ballot' contract with unit tests in Solidity.
SCRIPTS
@johnrobertmcc
johnrobertmcc / .custom_commands.sh
Last active March 1, 2022 16:54
convert to webp
function ctwp() {
extension=$1
params=$2
for i in *.$extension
do
file=$i
convert $file $params ${file%.*}.webp
done
}
$ identify -verbose bull.jpg
Image: bull.jpg
Format: JPEG (Joint Photographic Experts Group JFIF format)
Geometry: 5179x7200+0+0
Resolution: 72x72
Compression: JPEG
Filesize: 5282240B
$ identify -verbose bull-resized.jpg
Image: bull-resized.jpg
Format: JPEG (Joint Photographic Experts Group JFIF format)
Geometry: 432x600+0+0
Compression: JPEG
Quality: 73
Filesize: 59548B
function ctwp() {
extension=$1 # take the extension you provided the function
for i in *.$extension # iterate through the files in the directory based on the extension
do
file=$i # declare the file as an easy-to-read variable
convert $file ${file%.*}.webp
# The above line:
#a) executes the ImageMagick command, and
#b) removes the basename from the file to grab only the file name
#(so ‘bull.jpg’ becomes ‘bull’)
function ctwp() {
extension=$1
params=$2 # Add this
for i in *.$extension
do
file=$i
convert $file $params ${file%.*}.webp # Add params here
done
}
function rjd(){
mkdir $1; cd $1; touch $1.js; touch $1.module.css; touch index.js
echo "export {default} from './$1.js';" >> index.js
echo "import PropTypes from 'prop-types';" >> $1.js
echo "import styles from './$1.module.css';" >> $1.js
echo "/**" >> $1.js
echo "* Renders the $1 Component" >> $1.js
echo "*" >> $1.js
echo "* @param {object} props The component as props." >> $1.js
echo "* @param {string} props.component The name of the component." >> $1.js
function echo_args() {
echo "DEFAULTEXT $DEFAULTEXTENSION"
echo "DEFAULTAUTHOR $DEFAULTAUTHOR"
echo "DEFAULTVERSION $DEFAULTVERSION"
echo "DEFAULTVERSION $DEFAULTFALSE"
echo "username $username"
echo "version $version"
echo "test $test"
echo "storybook $storybook"
echo "extensionflag $extensionflag"