Skip to content

Instantly share code, notes, and snippets.

View vladbatushkov's full-sized avatar
🇺🇦
Pray for Ukraine

Vlad Batushkov vladbatushkov

🇺🇦
Pray for Ukraine
View GitHub Profile
@vladbatushkov
vladbatushkov / subject-dependency-consumer.cql
Last active February 20, 2022 13:33
Find dependency for subject, and then find other consumers of same dependency
UNWIND ['module1.*', 'module2.*', 'module3.*'] as module
CALL {
WITH module
MATCH (s:File)-[:DEPENDS_ON]->(d:File)<-[:DEPENDS_ON*]-(c:File)
WHERE s.name =~ module
AND NOT c.name =~ module
AND NOT d.name =~ 'common/.*'
WITH DISTINCT s.name as subject,
d.name as dependency,
collect(DISTINCT c.name) as consumers
@vladbatushkov
vladbatushkov / common-usage-folders.cql
Last active February 20, 2022 10:42
Common folder consumers as folders
MATCH (s:File)<-[*]-()-->(consumer:Folder)
WHERE s.name =~ 'common.*'
RETURN DISTINCT s.name as subject,
collect(DISTINCT consumer.name) as consumers
@vladbatushkov
vladbatushkov / common-usage.cql
Last active February 20, 2022 10:42
Common folder consumers
MATCH (s:File)<-[:DEPENDS_ON*]-(consumer:File)
WHERE s.name =~ 'common.*'
RETURN DISTINCT s.name as subject,
collect(DISTINCT consumer.name) as consumers
@vladbatushkov
vladbatushkov / strict-module-n-deep-dependencies.cql
Last active February 20, 2022 10:44
Detect n-deep dependencies from the outside
UNWIND ['module1.*', 'module2.*', 'module3.*'] as module
CALL {
WITH module
MATCH (s:File)-[:DEPENDS_ON*]->(d:File)
WHERE s.name =~ module
AND NOT d.name =~ module
AND NOT d.name =~ 'common.*'
RETURN DISTINCT s.name as subject,
collect(DISTINCT d.name) as dependencies
}
@vladbatushkov
vladbatushkov / strict-module-dependency.cql
Created February 20, 2022 10:10
Detect dependencies from the outside
UNWIND ['module1.*', 'module2.*', 'module3.*'] as module
CALL {
WITH module
MATCH (s:File)-[:DEPENDS_ON]->(d:File)
WHERE s.name =~ module
AND NOT d.name =~ module
AND NOT d.name =~ 'common.*'
RETURN DISTINCT s.name as subject,
d.name as dependency
}
@vladbatushkov
vladbatushkov / eaetnoteat-index.html
Last active November 28, 2020 13:56
eaetnoteat index
<body>
<div id="game"></div>
<script>
var app = Elm.Main.init({
node: document.getElementById('game'),
flags: window.screen.width
});
</script>
</body>
@vladbatushkov
vladbatushkov / eatnoteat-element.elm
Last active November 28, 2020 13:57
eatnoteat element
main : Program Int Model Msg
main =
Browser.element
{ init = init
, view = view
, update = update
, subscriptions = subscriptions
}
init : Int -> ( Model, Cmd Msg )
@vladbatushkov
vladbatushkov / reduce-lite.elm
Last active November 28, 2020 13:46
reduce lite
add : Int -> Int -> Int
add a b =
a + b
dashify : String -> String -> String
dashify a b =
if a == "" then
b
@vladbatushkov
vladbatushkov / eatnoteat-view.elm
Created November 13, 2020 14:59
eatnoteat view
heroList : Model -> List (Html Msg)
heroList model =
List.map
(\x ->
card [ style "margin-top" "1.5rem" ]
[ cardContent []
[ media [ onClick <| ChangeHero x ]
[ mediaLeft [ style "width" "40%" ]
[ image (OneByOne Unbounded)
[]
@vladbatushkov
vladbatushkov / eatnoteat-update.elm
Last active November 28, 2020 14:01
eatnoteat update
type Msg
= Idle
| Eat (List Tags)
| Damage Int
| HpCheck Int
| ChangeHero Hero
| ShuffleFood
| Shuffle (List Food)
| Animate AnimatedObject Animation.Msg