Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View adedayojs's full-sized avatar
📖
The word is life

Adedayojs adedayojs

📖
The word is life
View GitHub Profile
@adedayojs
adedayojs / delete_bit_branch.sh
Last active January 25, 2023 07:36
Delete git branch locally
# To delete all branches except for the current branch in one step:
git branch | grep -v $(git rev-parse --abbrev-ref HEAD) | xargs git branch -D
# Delete all branches except a specific branch:
git branch | grep -v "branch name" | xargs git branch -D
# Delete all branches except some specific branch:
git branch | grep -v "branch name" | grep -v "branch name" | xargs git branch -D
@adedayojs
adedayojs / .sh
Created October 18, 2021 15:19
Rewrite Git author history
# Be careful not to use this when you are working with an online repository
# Replace the fields containing the email and name with the appropriate values
git filter-branch -f --env-filter \
"GIT_AUTHOR_NAME='adedayojs'; GIT_AUTHOR_EMAIL='samfeolu@gmail.com'; \
GIT_COMMITTER_NAME='adedayojs'; GIT_COMMITTER_EMAIL='samfeolu@gmail.com';" HEAD
rm -rfv "$HOME/.vscode"
rm -rfv "$HOME/Library/Application Support/Code"
rm -rfv "$HOME/Library/Caches/com.microsoft.VSCode"
rm -rfv "$HOME/Library/Saved Application State/com.microsoft.VSCode.savedState"
@adedayojs
adedayojs / localhost-ssl-certificate.md
Created November 19, 2020 12:42 — forked from ethicka/localhost-ssl-certificate.md
Localhost SSL Certificate on Mac OS

🚨 2020 Update: I recommend using mkcert to generate local certificates. You can do everything below by just running the commands brew install mkcert and mkcert -install. Keep it simple!


This gives you that beautiful green lock in Chrome. I'm assuming you're putting your SSL documents in /etc/ssl, but you can put them anywhere and replace the references in the following commands. Tested successfully on Mac OS Sierra and High Sierra.

Set up localhost.conf

sudo nano /etc/ssl/localhost/localhost.conf

function addAction(type, payload){
action = {
type:'ADD',
payload
}
return action
}
function removeAction(type, payload){
action = {
type:'REMOVE',
counterReducer = (state, action) => {
switch (action.type) {
case 'INCREASE':
return { ...state, count: state.count + 1 };
case 'DECREASE':
return { ...state, count: state.count - 1 };
default:
return state;
}
};
// This function allows you to sum all the numbers in a given array of numbers only
function sumNum(array){
// Check if the argument supplied is an array and not an empty array
return Array.isArray(array) && array.length > 0 ? array.reduce((a,b)=> (a + b)) : 'Argument supplied is not an array or an empty array'
}
// This function allows you to fetch the maximum number in a given array of numbers only
Math.max(...array)
/******--------EXAMPLE-----*******/
// Create your array
const arrayOfNumbers = [1,2,3,4,5,6,7,8,9]
Math.max(...arrayOfNumbers) // Expected Outcome 9
Math.min(...array)
// This function allows you to loop through a certain number of times
// It is similar to the range function in python (if you are familiar with python)
function loopNumbers(number){
for(let i of [].constructor(number)){
// Do your thing
}
// Other function related things
}