Skip to content

Instantly share code, notes, and snippets.

View marchev's full-sized avatar

Martin Marchev marchev

View GitHub Profile
@marchev
marchev / script.sh
Created July 20, 2024 14:45 — forked from lopezjurip/script.sh
Github full code review
# Create empty branch.
git checkout --orphan review
git rm -rf .
git commit --allow-empty -m "Create empty branch"
git push --set-upstream origin review
# Create `project` branch from `master` current state.
git checkout -b project
git merge master --allow-unrelated-histories
git push --set-upstream origin project
@marchev
marchev / quicksort.hs
Created September 24, 2017 19:03
Quicksort in Haskell
-- Quicksort in Haskell
quicksort :: (Ord a) => [a] -> [a]
quicksort [] = []
quicksort [x] = [x]
quicksort (x:xs) =
let lessThanOrEqualToXSorted = quicksort [y | y <- xs, y <= x]
greaterThanXSorted = quicksort [z | z <- xs, z > x]
in lessThanOrEqualToXSorted ++ [x] ++ greaterThanXSorted
jshell> listOfFoos.stream().forEach(foo -> foo.setFoo(stringValues.iterator().next()));
jshell> listOfFoos.stream().forEach(x -> System.out.println(x.getFoo()));
one
one
one
-----------------------------------------------------------------------------------------
jshell> Iterator<String> strValsIterator = stringValues.iterator();