Skip to content

Instantly share code, notes, and snippets.

@Vincenius
Vincenius / toggleArrayItem.js
Last active October 16, 2019 06:34
Toggle array item
function toggleArrayItem(arr, item) {
arr.includes(item)
? arr.filter(i => i !== item) // remove item
: [ ...arr, item ]; // add item
}
@Vincenius
Vincenius / toggleItemReact.js
Created October 16, 2019 06:35
Toggle array item in react state
onToggleArray = item => {
this.setState(state => {
const arr = state.arr.includes(item)
? arr.filter(i => i !== item) // remove item
: [ ...arr, item ]; // add item
return {
arr,
};
});
}
@Vincenius
Vincenius / deploy.yml
Last active November 7, 2023 06:12
Github Action - Deploy to Linux using password
name: Deploy to Server
on:
push:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
@Vincenius
Vincenius / deploy.yml
Last active November 7, 2023 06:30
Github Action - Deploy to Linux using password
name: Deploy to Server
on:
push:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps: