This file contains hidden or 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
| # vim:ft=zsh ts=2 sw=2 sts=2 | |
| # | |
| # agnoster's Theme - https://gist.github.com/3712874 | |
| # A Powerline-inspired theme for ZSH | |
| # | |
| # # README | |
| # | |
| # In order for this theme to render correctly, you will need a | |
| # [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts). | |
| # Make sure you have a recent version: the code points that Powerline |
This file contains hidden or 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
| #!/bin/sh | |
| # https://gist.github.com/John-Almardeny/04fb95eeb969aa46f031457c7815b07d | |
| # Create a Notification With Sound with a Given Message and Time | |
| # The Downloaded Sound is from Notification Sounds https://notificationsounds.com/ | |
| MSSG="$1" | |
| TIME="$2" | |
| # install wget if not found |
This file contains hidden or 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
| javascript:(function()%7Bfunction callback()%7B(function(%24)%7Bvar jQuery%3D%24%3B%24.fn.swap %3D function (elem) %7Belem %3D elem.jquery %3F elem %3A %24(elem)%3Breturn this.each(function () %7B%24(document.createTextNode('')).insertBefore(this).before(elem.before(this)).remove()%3B%7D)%3B%7D%3Bfunction getPrice(e)%7Breturn Number(%24(%24(e).find('.product-item__price--final')%5B0%5D).text().match(%2F%5B0-9%5D%2Fg).join(''))%3B%7Dfunction sortProducts()%7Bproducts %3D %24('.product-item.product-item-flashdeal')%3Bfor (i %3D 0%3B i < products.length - 1%3B i%2B%2B) %7Bvar k %3D i%3Bfor (j %3D i %2B 1%3B j < products.length%3B j%2B%2B) %7Bproducts %3D %24('.product-item.product-item-flashdeal')%3Bp2 %3D %24(products%5Bj%5D)%3Bp1 %3D %24(products%5Bi%5D)%3Bif(getPrice(p1) > getPrice(p2))%7Bk %3D j%3Bp1.swap(p2)%3B%7D%7D%7D%7DloadingTime %3D 1%3BlastHeight %3D 0%3BloadingMorePage %3DsetInterval(function()%7Bif(lastHeight < %24(document).height())%7Bconsole.log("Scrolling to bottom%3A " %2B loadingTime %2B " tim |
This file contains hidden or 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
| package main | |
| import "fmt" | |
| func BinarySearch(array []int, element int) int { | |
| low := 0 | |
| high := len(array) - 1 | |
| for low <= high { | |
| index := (high + low) / 2 |
This file contains hidden or 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
| https://medium.com/@limichelle21/read-it-learn-it-build-it-sorting-algorithms-in-ruby-ead04b04baa6 | |
| https://en.wikipedia.org/wiki/Sorting_algorithm#Stability | |
| https://www.rubyguides.com/2017/07/ruby-sort/ | |
| https://8thlight.com/blog/will-warner/2013/03/26/stable-sorting-in-ruby.html | |
| https://nguyenvanhieu.vn/thuat-toan-tim-kiem-nhi-phan/ | |
| https://nguyenvanhieu.vn/thuat-toan-sap-xep-bubble-sort/ |
This file contains hidden or 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
| package main | |
| import "fmt" | |
| func BubbleSort(array []int) []int { | |
| endIndex := len(array) | |
| var flag, counter int | |
| // Cach 1 | |
| // counter = 0 |
This file contains hidden or 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
| package main | |
| import "fmt" | |
| func InsertionSort(array []int) []int { | |
| var counter int | |
| size := len(array) | |
| for i := 1; i < size; i++ { | |
| for j := i; j > 0 && array[j-1] > array[j]; j-- { | |
| counter++ |
This file contains hidden or 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
| #include <stdio.h> | |
| int main(){ | |
| int arr[127]={0}; | |
| char *str="a1221321bbccasdcsd"; | |
| int length=(int)sizeof(str)/sizeof(str[0]); | |
| int i; | |
| for(i=0;i<length;i++) | |
| { | |
| arr[*(str+i)]+=1; |
This file contains hidden or 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
| class Array | |
| def go_map | |
| raise unless block_given? | |
| result = [] | |
| each { |element| result << yield(element) } | |
| result | |
| end | |
| end | |
| [1, 2, 3].go_map |
This file contains hidden or 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
| def fibonacci(number) | |
| return number if (0..1).cover?(number) | |
| fibonacci(number - 1) + fibonacci(number - 2) | |
| end | |
| def fibonacci_array(number) | |
| return 'nil' if number < 1 | |
| array = [] |
OlderNewer