Bubble Sort
Bubble Sort example in Javascript and Go
Javascript
function BubbleSort(array) {
var swapCount = 1
while (swapCount > 0) {
swapCount = 0
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)" | |
} |
function BubbleSort(array) {
var swapCount = 1
while (swapCount > 0) {
swapCount = 0
function BinarySearch(array, number) {
var minIndex = 0
var maxIndex = array.length - 1
while (minIndex <= maxIndex) {
var midIndex = Math.floor((maxIndex + minIndex) / 2)
osascript -e 'tell application "Spotify" to artist of current track & " - " & name of current track' |
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 |
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()
# 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 " |
for d in ./*/ ; do (cd "$d" && echo "${PWD##*/}" && ls ; [ -f manifest.json ] && vtex link); done |
## https://askubuntu.com/questions/730754/how-do-i-show-the-git-branch-with-colours-in-bash-prompt | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
if [ "$color_prompt" = yes ]; then | |
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;31m\] $(parse_git_branch)\[\033[00m\]\$ ' | |
else | |
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(parse_git_branch)\$ ' | |
fi |
/* Autocomplete */ | |
interface ISearchAutocomplete{ | |
queries: Array<IQueries> | |
products: Array<IProducts> | |
} | |
interface IProducts{ | |
id: string | |
name: string | |
price: number |