(require '[clojure.string :as str])
(defn to-relative [src dst]
(let [src-items (str/split src #"/")
dst-items (str/split dst #"/")
shared (count (filter #(apply = %)
(map list src-items dst-items)))]
(str/join "/" (apply conj (drop shared dst-items)
(repeat (- (count src-items) shared) "..")))))
(println (to-relative "1"
"1/2/3.txt")) ; => 2/3.txt
(println (to-relative "1/2/3"
"3/4/5/6.txt")) ; => ../../../3/4/5/6.txt
(println (to-relative "1/2/3"
"1/2/3")) ; => ""
(println (to-relative "1/2/3"
"1/2/3/4")) ; => "4"
(println (to-relative "1/2/3/4"
"1/2/3")) ; => ".."
siiiick
2 hours ago
1
0
0
0
canonically, in The Young Pope, Jude Law uses his divine, entirely real connection to god almighty to ask Him to smite a corrupt nun in Africa who is siphoning funds from the charity she runs for starving children and she dies that very night. in my heart of hearts i believe Pope Leo has this power
10 hours ago
927
90
22
16
they're shutting down the local takes factory because of the Kirby avatar that wants to do a Bolshevik revolution
9 hours ago
371
38
21
2
(Wearing a mustache) I like the Kirby girl
9 hours ago
1094
47
34
1
im going to make reese watch the tokyo calling music video and then when she is too focused ill do a dance like this
1 day ago
3
0
0
0
Indivisible game cover. It's a dark haired, darkish skin girl doing fighting pose with other miscellaneous characters behind her..
sick game so far. battle system *looks* simple turn based/atb but has some interesting rhythm and reaction elements. not a rhythm game just a rhythm to how you fight and react.
if i had played paper mario i think id be making comparisons
1 day ago
1
0
0
0
A guy with a large CRT monitor under his shirt on a bus.
i like this joke because someone gives up their seat for him. plus remember CRTs???
then i remember who made this show and can only imagine how the writing process went "A MAN????? AND HE'S PREGARNENT???? HYA HYA HYA HYA HYA" and then his massive fucking head bobs up and down like lemongrab.
2 days ago
0
0
0
0
Advertisement
Who let all the scumbag landlords in here
going to post this exact phrase on one of the zionist fb groups ive wormed my way into
2 days ago
1
0
0
0
He was only a capo! How could he afford this?
How could Tony afford his house? | the Sopranos explained
CineRanter Uncut
3 days ago
1
0
0
0
im unc as fuck and drunk to boot 😤
3 days ago
1
0
0
0
the company that produces the fell for again award medals has collapsed after production accelerated and the foundry exploded
3 days ago
54
7
1
0
most peoples views are complex and contradictory, my own for sure.
the act of speaking up or pointing out these contradictions invites interest and excitement (anathema to a workplace) as well as anger and resentment (the lifeblood that powers the modern workplace) 4/4
3 days ago
4
0
0
0
how do you communicate to people that your goals and viewpoint are "different"?
I hate the twin copes of "everyone feels the way I do but are afraid to speak up" and "my viewpoint is 100% unique and brave in a sea of conformity". their presumptions irritate me anyway 3/4
3 days ago
4
0
1
0
I've been throwing around the question of what motivates me (they kept asking) and how to translate "death to Israel" to something professionally appropriate.
it might finally be time to finish up a teased long form post on what it means to be the heel at work. to be the one who can't shut up. 2/4
3 days ago
3
0
1
0
i do a little blog here today:
awful work-related outing. i was asked if i had gotten the surgery, then they had the gall to try to poach me for their team. ive never wanted to work with someone less. it was like every word out of their mouth was designed, on specification, to repulse me. 1/4
3 days ago
5
0
2
0
I'm still confused. Who is this guy and what is this show?
4 days ago
1
1
1
0
Advertisement
lmao ok that's actually very funny now that I know
3 days ago
1
1
0
0
twitter screenshot
tarachara
@tara_chara
do you watch Tonari No Sainferudo with subs or dubs.
Image of a collection of Japanese seinfeld DVDs
jerry seinfeld. he had a popular American TV show in the 1990s. i think this is from the official japanese sub or dub of his tv show but it could also be fake.
4 days ago
0
0
1
0
rad. i think. happy easter weekend
4 days ago
1
0
1
0
thank you catholic jampants. did you check out the young pope and convert?
4 days ago
1
0
1
0
too busy having avo toast and watching the office
4 days ago
1
1
0
0
people dont want to twerk anymore =(
4 days ago
8
1
3
0
Advertisement
now martin is scoring off him.
4 days ago
2
0
0
0
if you know anything about Education as an industry, this means the nation's present & future kiddos are super screwed, cuz Boston is where they roll out every new "innovative reform" pilot (that ultimately amounts to muntzing teachers & their unions out of the decision matrix)
4 days ago
17
6
1
0
It’s me. I’m coughing 99% of the time. At one point I’m very clearly sweating and crying after eating a wing with no sauce on it. I drink 16 glasses of milk and I keep saying “ouughhhh my tummy”
4 days ago
628
26
12
1
people love to get on here and post about how the site is being destroyed by mean leftists, and then you check their timeline and it is exclusively them getting into hours-long arguments with said leftists
5 days ago
1219
121
27
12
seinfeld on stage. seinfeld tv intro but it's japanese
5 days ago
30
13
2
1