function cssHandles(...arguments) {
return arguments.reduce((acc, cur) => {
if (typeof cur === 'string') return acc + ` ${cur}`;
if (typeof cur === 'object') {
return Object.keys(cur).map((key) => {
if(cur[key]) return acc + ` ${key}`
return acc
}).filter(Boolean).join('').trim()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for d in ./*/ ; do (cd "$d" && echo "${PWD##*/}" && ls ; [ -f manifest.json ] && vtex link); done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# terminal utils | |
alias pkg="cat package.json" | |
alias head-pkg="head package.json" | |
alias tail-pkg="tail package.json" | |
alias pkg-scripts="pkg | jq .scripts" | |
alias hgrep="history | grep " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function copy(value) { | |
setTimeout(async()=>console.log( | |
await window.navigator.clipboard.writeText(value)), 3000); | |
console.log("Color: " + value); | |
} | |
window.colorPicker = () => new EyeDropper().open().then((color)=> copy(color.sRGBHex)) | |
window.colorPicker(); | |
// create color picker snippet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
osascript -e 'tell application "Spotify" to artist of current track & " - " & name of current track' |
Example Binary search in Javascript and Go
function BinarySearch(array, number) {
var minIndex = 0
var maxIndex = array.length - 1
while (minIndex <= maxIndex) {
var midIndex = Math.floor((maxIndex + minIndex) / 2)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function pr(){ | |
repo="${PWD##*/}" | |
branch_name=$(git symbolic-ref -q HEAD) | |
task=$(echo $branch_name | awk -F/ '{print $NF}') | |
message=$(echo $(git log -n 1 --pretty=format:%B)) | |
gh pr create --title "$message" --body "## $message [$task](https://<your-org>.atlassian.net/browse/$task)" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function pr_notify() { | |
url=$(echo $(gh pr view | sed '10!d' | sed 's/.*://')) | |
title=$(echo $(gh pr view | sed '1!d' | sed 's/.*://')) | |
state=$(echo $(gh pr view | sed '2!d' | sed 's/.*://')) | |
author=$(echo $(gh pr view | sed '3!d' | sed 's/.*://')) | |
data=$(echo '{ | |
"cards": [ | |
{ | |
"header": { | |
"title": "🤖 Code Review", |
Switch to the branch from which you created the pull request:
$ git checkout pull-request-branch
Overwrite the modified file(s) with the file in another branch, let's consider it's master:
git checkout origin/master -- src/package-lock.json
OlderNewer