From bc41602ee2e5ec0c9f7b7fb98f036071b50e2a62 Mon Sep 17 00:00:00 2001 From: colinmorris Date: Fri, 17 Feb 2017 11:29:37 -0800 Subject: [PATCH] first commit --- .gitignore | 18 ++++ package.json | 19 ++++ public/canned/badromance.txt | 114 +++++++++++++++++++++++ public/canned/barbiegirl.txt | 72 +++++++++++++++ public/canned/buddyholly.txt | 45 +++++++++ public/canned/cgyoomh.txt | 59 ++++++++++++ public/canned/humps.txt | 141 +++++++++++++++++++++++++++++ public/canned/judas.txt | 56 ++++++++++++ public/canned/plan.txt | 43 +++++++++ public/canned/spiderwebs.txt | 66 ++++++++++++++ public/canned/theecchoinggreen.txt | 32 +++++++ public/canned/thelamb.txt | 21 +++++ public/canned/thepasture.txt | 9 ++ public/canned/thetyger.txt | 29 ++++++ public/favicon.ico | Bin 0 -> 24838 bytes public/index.html | 31 +++++++ src/.Songsim.js.swp | Bin 0 -> 12288 bytes src/.utils.js.swp | Bin 0 -> 12288 bytes src/App.css | 24 +++++ src/App.js | 23 +++++ src/App.test.js | 8 ++ src/LyricsPane.js | 34 +++++++ src/Matrix.css | 3 + src/Matrix.js | 76 ++++++++++++++++ src/SongSelector.js | 36 ++++++++ src/Songsim.js | 83 +++++++++++++++++ src/Word.css | 7 ++ src/Word.js | 18 ++++ src/constants.js | 4 + src/index.css | 5 + src/index.js | 12 +++ src/logo.svg | 7 ++ src/utils.js | 36 ++++++++ src/verse.js | 96 ++++++++++++++++++++ 34 files changed, 1227 insertions(+) create mode 100644 .gitignore create mode 100644 package.json create mode 100644 public/canned/badromance.txt create mode 100644 public/canned/barbiegirl.txt create mode 100644 public/canned/buddyholly.txt create mode 100644 public/canned/cgyoomh.txt create mode 100644 public/canned/humps.txt create mode 100644 public/canned/judas.txt create mode 100644 public/canned/plan.txt create mode 100644 public/canned/spiderwebs.txt create mode 100644 public/canned/theecchoinggreen.txt create mode 100644 public/canned/thelamb.txt create mode 100644 public/canned/thepasture.txt create mode 100644 public/canned/thetyger.txt create mode 100644 public/favicon.ico create mode 100644 public/index.html create mode 100644 src/.Songsim.js.swp create mode 100644 src/.utils.js.swp create mode 100644 src/App.css create mode 100644 src/App.js create mode 100644 src/App.test.js create mode 100644 src/LyricsPane.js create mode 100644 src/Matrix.css create mode 100644 src/Matrix.js create mode 100644 src/SongSelector.js create mode 100644 src/Songsim.js create mode 100644 src/Word.css create mode 100644 src/Word.js create mode 100644 src/constants.js create mode 100644 src/index.css create mode 100644 src/index.js create mode 100644 src/logo.svg create mode 100644 src/utils.js create mode 100644 src/verse.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4fa4a53 --- /dev/null +++ b/.gitignore @@ -0,0 +1,18 @@ +# See http://help.github.com/ignore-files/ for more about ignoring files. + +# dependencies +/node_modules + +# testing +/coverage + +# production +/build + +# misc +.DS_Store +.env +npm-debug.log* +yarn-debug.log* +yarn-error.log* + diff --git a/package.json b/package.json new file mode 100644 index 0000000..cfe9c14 --- /dev/null +++ b/package.json @@ -0,0 +1,19 @@ +{ + "name": "songsim", + "version": "0.1.0", + "private": true, + "devDependencies": { + "react-scripts": "0.9.0" + }, + "dependencies": { + "bootstrap": "^3.3.7", + "react": "^15.4.2", + "react-dom": "^15.4.2" + }, + "scripts": { + "start": "react-scripts start", + "build": "react-scripts build", + "test": "react-scripts test --env=jsdom", + "eject": "react-scripts eject" + } +} diff --git a/public/canned/badromance.txt b/public/canned/badromance.txt new file mode 100644 index 0000000..a8c5574 --- /dev/null +++ b/public/canned/badromance.txt @@ -0,0 +1,114 @@ +Oh, caught in a bad romance +Oh, caught in a bad romance + +Rah, rah, ah, ah, ah +Roma, roma, ma +Gaga, ooh, la, la la +Want your bad romance + +Rah, rah, ah, ah, ah +Roma, roma, ma +Gaga, ooh la la la +Want your bad romance + +I want your ugly, I want your disease +I want your everything as long as it's free +I want your love +Love, love, love, I want your love + +I want your drama, the touch of your hand +I want your leather studded kiss in the sand +I want your love +Love, love, love, I want your love +(Love, love, love, I want your love) + +You know that I want you +And you know that I need you +I want it bad, your bad romance + +I want your love, and I want your revenge +You and me could write a bad romance +I want your love, and all your love is revenge +You and me could write a bad romance + +Oh, caught in a bad romance +Oh, caught in a bad romance + +Rah, rah, ah, ah, ah +Roma, roma, ma +Gaga, ooh la la la +Want your bad romance + +I want your horror, I want your design +'Cause you're a criminal as long as you're mine +I want your love +Love, love, love, I want your love + +I want your psycho, your vertigo shtick +Want you in my rear window, baby, you're sick +I want your love +Love, love, love, I want your love +(Love, love, love, I want your love) + +You know that I want you +And you know that I need you +('Cause I'm a free bitch, baby) +I want it bad, your bad romance + +I want your love, and I want your revenge +You and me could write a bad romance +I want your love, and all your love is revenge +You and me could write a bad romance + +Oh, caught in a bad romance +Oh, caught in a bad romance + +Rah, rah, ah, ah, ah +Roma, roma, ma +Gaga, ooh la la la +Want your bad romance + +Rah, rah, ah, ah, ah +Roma, roma, ma +Gaga, ooh la la la +Want your bad romance + +Walk, walk, fashion, baby +Work it, move that bitch, crazy +Walk, walk, fashion, baby +Work it, move that bitch, crazy + +Walk, walk, fashion, baby +Work it, move that bitch, crazy +Walk, walk, passion, baby +Work it, I'm a free bitch, baby + +I want your love, and I want your revenge +I want your love, I don't wanna be friends +J'veux ton amour et je veux ta revanche +J'veux ton amour, I don't wanna be friends + +No, I don't wanna be friends +(Oh, caught in a bad romance) +I don't wanna be friends + +Want your bad romance +(Oh, caught in a bad romance) +Want your bad romance + +I want your love, and I want your revenge +You and me could write a bad romance +I want your love, and all your lover's revenge +You and me could write a bad romance + +Want your bad romance +(Oh, caught in a bad romance) +Want your bad romance +Want your bad romance +(Oh, caught in a bad romance) + +Rah, rah, ah, ah, ah +Roma, roma, ma +Gaga, ooh la la la +Want your bad romance + diff --git a/public/canned/barbiegirl.txt b/public/canned/barbiegirl.txt new file mode 100644 index 0000000..e239483 --- /dev/null +++ b/public/canned/barbiegirl.txt @@ -0,0 +1,72 @@ +Hiya Barbie +Hi Ken! +Do you want to go for a ride? +Sure Ken +Jump in + +I'm a Barbie girl, in a Barbie world +Life in plastic, it's fantastic +You can brush my hair, undress me everywhere +Imagination, life is your creation + +Come on Barbie, let's go party! + +I'm a Barbie girl, in a Barbie world +Life in plastic, it's fantastic +You can brush my hair, undress me everywhere +Imagination, life is your creation + +I'm a blond bimbo girl, in a fantasy world +Dress me up, make it tight, I'm your dolly +You're my doll, rock'n'roll, feel the glamor in pink +Kiss me here, touch me there, hanky panky +You can touch +you can play +if you say "I'm always yours" + +I'm a Barbie girl, in a Barbie world +Life in plastic, it's fantastic +You can brush my hair, undress me everywhere +Imagination, life is your creation + +Come on Barbie, let's go party! (Ah ah ah yeah) +Come on Barbie, let's go party! (Oh oh) +Come on Barbie, let's go party! (Ah ah ah yeah) +Come on Barbie, let's go party! (Oh oh) + +Make me walk, make me talk, do whatever you please +I can act like a star, I can beg on my knees +Come jump in, bimbo friend, let us do it again +Hit the town, fool around, let's go party + +You can touch +you can play +If you say "I'm always yours" +You can touch +you can play, +If you say "I'm always yours" + +Come on Barbie, let's go party! (Ah ah ah yeah) +Come on Barbie, let's go party! (Oh oh) +Come on Barbie, let's go party! (Ah ah ah yeah) +Come on Barbie, let's go party! (Oh oh) + +I'm a Barbie girl, in a Barbie world +Life in plastic, it's fantastic +You can brush my hair, undress me everywhere +Imagination, life is your creation + +I'm a Barbie girl, in a Barbie world +Life in plastic, it's fantastic +You can brush my hair, undress me everywhere +Imagination, life is your creation + +Come on Barbie, let's go party! (Ah ah ah yeah) +Come on Barbie, let's go party! (Oh oh) +Come on Barbie, let's go party! (Ah ah ah yeah) +Come on Barbie, let's go party! (Oh oh) + +Oh, I'm having so much fun! +Well Barbie, we are just getting started +Oh, I love you Ken + diff --git a/public/canned/buddyholly.txt b/public/canned/buddyholly.txt new file mode 100644 index 0000000..3aef346 --- /dev/null +++ b/public/canned/buddyholly.txt @@ -0,0 +1,45 @@ +What's with these homies, dissing my girl? +Why do they gotta front? +What did we ever do to these guys +That made them so violent? +Woo-hoo, but you know I'm yours +Woo-hoo, and I know you're mine +Woo-hoo, and that's for all time + +Oo-ee-oo I look just like Buddy Holly +Oh-oh, and you're Mary Tyler Moore +I don't care what they say about us anyway +I don't care bout that + +Don't you ever fear, I'm always near +I know that you need help +Your tongue is twisted, your eyes are slit +You need a guardian +Woo-hoo, and you know I'm yours +Woo-hoo, and I know you're mine +Woo-hoo, and that's for all time + +Oo-ee-oo I look just like Buddy Holly +Oh-oh, and you're Mary Tyler Moore +I don't care what they say about us anyway +I don't care bout that +I don't care bout that + +Bang, bang a knock on the door +Another big bang and you're down on the floor +Oh no! What do we do? +Don't look now but I lost my shoe +I can't run and I can't kick +What's a matter babe are you feeling sick? +what's a matter, what's a matter, what's a matter you? +What's a matter babe, are you feeling blue? oh-oh! +And that's for all time +And that's for all time + +Oo-ee-oo I look just like Buddy Holly +Oh-oh, and you're Mary Tyler Moore +I don't care what they say about us anyway +I don't care bout that +I don't care bout that +I don't care bout that +I don't care bout that diff --git a/public/canned/cgyoomh.txt b/public/canned/cgyoomh.txt new file mode 100644 index 0000000..121811e --- /dev/null +++ b/public/canned/cgyoomh.txt @@ -0,0 +1,59 @@ +La la la la la la la la +La la la la la la la la +La la la la la la la la +La la la la la la la la + +I just can't get you out of my head +Boy your loving is all I think about +I just can't get you out of my head +Boy it's more than I dare to think about + +La la la la la la la la +La la la la la la la la + +I just can't get you out of my head +Boy your loving is all I think about +I just can't get you out of my head +Boy it's more than I dare to think about + +Every night, every day +Just to be there in your arms +Won't you stay +Won't you lay +stay forever and ever and ever and ever + +La la la la la la la la +La la la la la la la la +La la la la la la la la +La la la la la la la la + +I just can't get you out of my head +Boy your loving is all I think about +I just can't get you out of my head +Boy it's more than I dare to think about + +There's a dark secret in me +Don't leave me locked in your heart +Set me free +Feel the need in me +Set me free +Stay forever +And ever and ever and ever + +La la la la la la la la +La la la la la la la la +La la la la la la la la +La la la la la la la la + +I just can't get you out of my head +La la la la la la la la +La la la la la la la la +I just can't get you out of my head +La la la la la la la la +La la la la la la la la +I just can't get you out of my head +La la la la la la la la +La la la la la la la la +I just can't get you out of my head +La la la la la la la la +La la la la la la la la \ No newline at end of file diff --git a/public/canned/humps.txt b/public/canned/humps.txt new file mode 100644 index 0000000..0caadb2 --- /dev/null +++ b/public/canned/humps.txt @@ -0,0 +1,141 @@ +Whatcha gonna do with all that junk +All that junk inside your trunk + +I'ma get get get get you drunk +Get you love drunk off my hump +My hump my hump my hump my hump my hump +My hump my hump my hump my lovely little lumps + +Check it out + +I drive these brothers crazy +I do it on the daily +They treat me really nicely +They buy me all these ice +Dolce and Gabbana +Fendi and Madonna +Caring they be sharin' +All their money got me wearing fly +Whether I ain't askin' +They say they love mah ass in +Seven jeans +True religion +I say no +But they keep givin' +So I keep on takin' +And no I ain't takin' +We can keep on datin' +Now keep on demonstratin' + +My love my love my love my love +You love my lady lumps +My hump my hump my hump +My humps they got you + +She's got me spending + +Oh, spending all your money on me +And spending time on me + +She's got me spending + +Oh, spending all your money on me +Uh on me on me + +Whatcha gonna do with all that junk +All that junk inside that trunk + +I'm a get get get get you drunk +Get you love drunk off my hump + +Whatcha gonna do with all that ass +All that ass inside your jeans + +I'm a make make make make you scream +Make you scream make you scream + +'Cause of my humps my hump my hump my hump +My hump my hump my hump my lovely lady lumps + +Check it out + +I met a girl down at the disco +She said hey hey hey ya lets go +I can be ya baby, you could be my honey +Let's spend time not money +And mix your milk with my coco puff +Milky milky coco +Mix your milk with my coco puff +Milky milky +Right + +They say I'm really sexy +The boys they wanna sex me +They always standin' next to me +Always dancin' next to me +Tryin' a feel my hump hump +Lookin' at my lump lump +You can look but you can't touch it +If you touch it +I'm a start some drama +You don't want no drama +No no drama no no no no drama +So don't pull on my hand boy +You ain't my man boy +I'm just tryin' a dance boy + +And move my hump +My hump my hump my hump my hump +My hump my hump my hump my hump my hump my hump +My lovely lady lumps +My lovely lady lumps my lovely lady lumps +In the back and in the front + +My loving got you + +She's got me spending + +Oh, spending all your money on me +And spending time on me + +She's got me spending + +Oh, spending all your money on me +Uh on me on me + +Whatcha gonna do with all that junk +All that junk inside that trunk + +I'm a get get get get you drunk +Get you love drunk off my hump + +Whatcha gonna do with all that ass +All that ass inside your jeans + +I'm a make make make make you scream +Make you scream make you scream + +Whatcha gonna do with all that junk +All that junk inside that trunk + +I'm a get get get get you drunk +Get you love drunk off this hump + +Whatcha gonna do with all that breast +All that breast inside that shirt + +I'm a make make make make you work +Make you work work make you work + +She's got me spending + +Oh, spending all your money on me +And spending time on me + +She's got me spending + +Oh, spending all your money on me +Uh on me on me + +(Surreal, surreal, surreal, surreal, surreal) + diff --git a/public/canned/judas.txt b/public/canned/judas.txt new file mode 100644 index 0000000..a9c1a30 --- /dev/null +++ b/public/canned/judas.txt @@ -0,0 +1,56 @@ +Oh oh, oh oh +I'm in love with Judas, Judas +Oh oh, oh oh +I'm in love with Judas, Judas +Judas, Juda-a-a, Judas, Juda-a-a +Judas Juda-a-a, Judas, Gaga +Judas Juda-a-a, Judas, Juda-a-a +Judas, Juda-a-a, Judas, Gaga +When he calls to me, I am ready +I'll wash his feet with my hair if he needs +Forgive him when his tongue lies through his brain +Even after three times, he betrays me +I'll bring him down, bring him down, down +A king with no crown, king with no crown +I'm just a holy fool, oh baby it's so cruel +But I'm still in love with Judas, baby +I'm just a holy fool, oh baby it's so cruel +But I'm still in love with Judas, baby +Oh oh, oh oh +I'm in love with Judas, Judas +Oh oh, oh oh +I'm in love with Judas, Judas +Judas, Juda-a-a, Judas, Juda-a-a +Judas, Juda-a-a, Judas, Gaga +I couldn't love a man so purely +Even prophets forgave his goofy way +I've learned love is like a brick you can +Build a house or sink a dead body +I'll bring him down, bring him down, down +A king with no crown, king with no crown +I'm just a holy fool, oh baby it's so cruel +But I'm still in love with Judas, baby +I'm just a holy fool, oh baby it's so cruel +But I'm still in love with Judas, baby +Oh oh, oh oh +I'm in love with Judas, Judas +Oh oh, oh oh +I'm in love with Judas, Judas +In the most biblical sense, I am beyond repentance +Fame hooker, prostitute wench, vomits her mind +But in the cultural sense I just speak in future tense +Judas kiss me if offense, don't wear ear condom next time +I wanna love you +But something's pulling me away from you +Jesus is my virtue +And Judas is the demon I cling to, I cling to +Just a holy fool, oh baby it's so cruel +But I'm still in love with Judas, baby +I'm just a holy fool, oh baby it's so cruel +But I'm still in love with Judas, baby +Oh oh, oh oh +I'm in love with Judas, Judas +Oh oh, oh oh +I'm in love with Judas, Judas +Judas, Juda-a-a, Judas, Juda-a-a +Judas, Juda-a-a, Judas, Gaga diff --git a/public/canned/plan.txt b/public/canned/plan.txt new file mode 100644 index 0000000..0156962 --- /dev/null +++ b/public/canned/plan.txt @@ -0,0 +1,43 @@ +In my prison cell I think these words +I was careless +I can see that now +I must be silent +Must contain my secret smile +I want to tell you +You my mirror +You my iron bars + +When I made a shadow on my window shade +They called the police and testified +But they're like the people chained up in the cave +In the allegory of the people in the cave by the Greek guy + +No one understands +No one knows my plan +Why the dancing, shouting +Why the shrieks of pain +The lovely music +Why the smell of burning autumn leaves + +No one understands +No one knows my plan +Why the dancing, shouting +Why the shrieks of pain +The lovely music +Why the smell of burning autumn leaves + +In my prison cell I bide my time +Always thinking +Always busy cooking up an angle +Working on the tiny blueprint of the angle +Sketching out the burning autumn leaves + +No one understands +No one knows my plan +I must be silent, must contain my secret smile +I want to tell you +You my mirror +You my iron bars + +No one understands +No one knows my plan diff --git a/public/canned/spiderwebs.txt b/public/canned/spiderwebs.txt new file mode 100644 index 0000000..be596c2 --- /dev/null +++ b/public/canned/spiderwebs.txt @@ -0,0 +1,66 @@ +You think that we connect +That the chemistry's correct +Your words walk right through my ears +Presuming I likn what I hear +And now I'm stuck in the +The web you're spinning +You've got me for you prey + +Yeah Sorry I'm not home right now +I'm walking into spiderwebs +So leave a message +And I'll call you back +A likely story, but Yeah leave a message +And I'll call you back + +You're intruding on what's mine +And you're taking up my time +Don't have the courage inside me +To tell you please let me be + +Communication, a telephonic invasion +I'm planning my escape... + +Yeah Sorry I'm not home right now +I'm walking into spiderwebs +So leave a message +And I'll call you back +A likely story, but Yeah leave a message +And I'll call you back + +And it's all your fault +I screen my phone calls +No matter who calls +I gotta screen my phone calls + +Now it's gone to deep Now, it's gone too deep +You wake me in my sleep Wake me in my sleep +My dreams become nightmares Dreams become nightmares +'Cause you're ringing in my ears + +Yeah Sorry I'm not home right now +I'm walking into spiderwebs +So leave a message +And I'll call you back +A likely story, but Yeah leave a message +And I'll call you back + +And it's all your fault +I screen my phone calls +No matter-matter-matter-matter who calls +I gotta screen my phone calls + +Oooh, the spiderwebs +Leave a message and I'll call you back +I'm walking into spiderwebs +So, leave a message and I'll call you back +I'm walkink into spiderwebs +It's all your fault, no mattter who calls +I gotta screen my phone calls +It's all your fault, it's all your fault +No matter who calls, no matter who calls + +I'm walking into spiderwebs so, +Leave a message and I'll call you back +I'm walking into spiderwebs so, +Leave a message and I'll call you back \ No newline at end of file diff --git a/public/canned/theecchoinggreen.txt b/public/canned/theecchoinggreen.txt new file mode 100644 index 0000000..c1aeabd --- /dev/null +++ b/public/canned/theecchoinggreen.txt @@ -0,0 +1,32 @@ +The sun does arise, +And make happy the skies. +The merry bells ring +To welcome the Spring. +The sky-lark and thrush, +The birds of the bush, +Sing louder around, +To the bells’ cheerful sound. +While our sports shall be seen +On the Ecchoing Green. + +Old John, with white hair +Does laugh away care, +Sitting under the oak, +Among the old folk, +They laugh at our play, +And soon they all say. +‘Such, such were the joys. +When we all girls & boys, +In our youth-time were seen, +On the Ecchoing Green.’ + +Till the little ones weary +No more can be merry +The sun does descend, +And our sports have an end: +Round the laps of their mothers, +Many sisters and brothers, +Like birds in their nest, +Are ready for rest; +And sport no more seen, +On the darkening Green. diff --git a/public/canned/thelamb.txt b/public/canned/thelamb.txt new file mode 100644 index 0000000..2f0a5bc --- /dev/null +++ b/public/canned/thelamb.txt @@ -0,0 +1,21 @@ +Little Lamb, who made thee? +Dost thou know who made thee? +Gave thee life & bid thee feed +By the stream & o’er the mead; +Gave thee clothing of delight, +Softest clothing, wooly, bright; +Gave thee such a tender voice, +Making all the vales rejoice? +Little Lamb, who made thee? +Dost thou know who made thee? + +Little Lamb, I’ll tell thee, +Little Lamb, I’ll tell thee: +He is callèd by thy name, +For he calls himself a Lamb. +He is meek, & he is mild; +He became a little child. +I a child, & thou a lamb, +We are callèd by his name. +Little Lamb, God bless thee! +Little Lamb, God bless thee! diff --git a/public/canned/thepasture.txt b/public/canned/thepasture.txt new file mode 100644 index 0000000..964971f --- /dev/null +++ b/public/canned/thepasture.txt @@ -0,0 +1,9 @@ +I’m going out to clean the pasture spring; +I’ll only stop to rake the leaves away +(And wait to watch the water clear, I may): +I sha’n’t be gone long.—You come too. + +I’m going out to fetch the little calf +That’s standing by the mother. It’s so young, +It totters when she licks it with her tongue. +I sha’n’t be gone long.—You come too. diff --git a/public/canned/thetyger.txt b/public/canned/thetyger.txt new file mode 100644 index 0000000..a559443 --- /dev/null +++ b/public/canned/thetyger.txt @@ -0,0 +1,29 @@ +Tyger Tyger. burning bright, +In the forests of the night; +What immortal hand or eye. +Could frame thy fearful symmetry? + +In what distant deeps or skies. +Burnt the fire of thine eyes? +On what wings dare he aspire? +What the hand, dare sieze the fire? + +And what shoulder, & what art, +Could twist the sinews of thy heart? +And when thy heart began to beat. +What dread hand? & what dread feet? + +What the hammer? what the chain, +In what furnace was thy brain? +What the anvil? what dread grasp. +Dare its deadly terrors clasp! + +When the stars threw down their spears +And water'd heaven with their tears: +Did he smile his work to see? +Did he who made the Lamb make thee? + +Tyger Tyger burning bright. +In the forests of the night: +What immortal hand or eye. +Dare frame thy fearful symmetry? diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..5c125de5d897c1ff5692a656485b3216123dcd89 GIT binary patch literal 24838 zcmeI4X^>UL6@VY56)S&I{`6Nu0RscWCdj@GJHx(%?6_-;yKy1n;EEf9f}pr1CW5HA zYt$%U#C=}?jWH&%G@BaHBxsWAoUb3}&6%Ei@4Ii_JRa1`RQ23*yU)_wJ$?H0>6gj0 z${d_I^w5kvTW3xYEc?FvyP3>p$!py@`@T`|dVepIsjbbvR}af%KK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rYcPxiS31>U_>mbPTXxkC*!?*zefr#2vF|qr8{|4|u^7-pD|f z&OPc->UKu)=iHgIpysp;Lsbyj}GJWoBkufOA={CRTUjr%af zc5pUH9{pg?M5%+)oN`q9yBbBt@+3xHV)qGm8b)Cp-w7~CwEhtBUk0rbjrqM zTb|tQ3-5-pw^cul`T+X&s?O;?V(FD!(Q9Qg@(LTCNz{0-vBM^SX5lti3|GpxFn4;Ax6pGc~t)R!Bo${lYH(* z!F&5X*?S&}YoDCyzwv1H+XI(+rL`;RN9}iLxlfr-r&vGG8OQa@=>+a)+Ij)sd_{wu z1Am(+3-RFr4&N8N6+hqo19S#;SA1-hG>07p3}&*j4CR+rqdV)^6n; z_vFr!(a%-=#=kb{pYmNL@6|DWkw~%E2V2jYl*e1}c{e$fib?(O+hs}eoBLRo&9(;J}YV}0Mi;LZAe{U$(s= zT<-IaV$Z+q-P!~3{HxN>Kbw30jXzM&I(S<6Ksx^}HvU2Vntb!etSsm0>)j}Me^+L5{2yz--)?W`Q?az z!WLG4UNP}+#C+NKH+ZG-Q=E>IPp%LuKLx$$8NAOGr(#~P>!EA zDYlpXDR=xM?Xv5(-qp74Cw3LzBeASHSBY`OezkbOyjP!G%WSymju_C$VBl--z + + + + + + + React App + + +
+ + + diff --git a/src/.Songsim.js.swp b/src/.Songsim.js.swp new file mode 100644 index 0000000000000000000000000000000000000000..66d771869dd22f291036dd5d97c46782f92757ab GIT binary patch literal 12288 zcmeI2O>7%Q6vwBiv_J_U5S(9Jf$hk(lLiTq#5s^6u*e5AZBz(Rw6VwbR-0XGcbwRA z4F@6*XZg3ah0k z@Eei4tM1qJeer7aFXpf&RspNP?J6*FdG`Fwv>bglGf59Uc=>iGvg51*RspMkRlq7> z6|f3e1*`&Afn%tEXq{lMBJMj(?2h?9G4gF5?Uz-+Dqt0`3RnfK0#*U5fK|XMU=^?m zSOu&C$4~*M#@JgY8Jj+Z;PL4G0#(n~ygAc$BumaA4 zKPDLa0o(%LfUm(P;5v96yas%*0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`=+K1`koXJWduN9RRH>+9iS(>|eDU3T@7{fqCCWp;cXN}jc$WpPWg+%& zy}Z8@z7lIaA>txSb2ER;rJ^jWj)^hL&uqc2l5tlR`9P&Z`+ls`OnFb#KUCllHoyi> zZeUSdx)}H-|NQC-ojr5+<~18jf|umLu}2H3zH8i=-pIJYRoJ7E6*pZ@;;d0L3?;2U@k zUV!Id4-7#c+ygyu1GK;@SOLr6#}abES8xE{f;Zqb*a26;23P}2;0yLY0Q=xG_yj(J z55V>|hiU56r?4S=WAtIxg*+=yuoM z$+;~lFR(#A=n(cYTM=HP2%Qz?Ik6RJt7+0jUbo$*J9QIgT|X`UjG1l2)o{H+@gfi+=G`8)-87Hl^}AO?+SvI!H8CGRg;uJ>=0zbs-Vd!D0tt7z6Wxi8w<6ntoBt%rBn_+hqU% literal 0 HcmV?d00001 diff --git a/src/App.css b/src/App.css new file mode 100644 index 0000000..15adfdc --- /dev/null +++ b/src/App.css @@ -0,0 +1,24 @@ +.App { + text-align: center; +} + +.App-logo { + animation: App-logo-spin infinite 20s linear; + height: 80px; +} + +.App-header { + background-color: #222; + height: 150px; + padding: 20px; + color: white; +} + +.App-intro { + font-size: large; +} + +@keyframes App-logo-spin { + from { transform: rotate(0deg); } + to { transform: rotate(360deg); } +} diff --git a/src/App.js b/src/App.js new file mode 100644 index 0000000..afd45ab --- /dev/null +++ b/src/App.js @@ -0,0 +1,23 @@ +import React, { Component } from 'react'; +import logo from './logo.svg'; +import './App.css'; +import Songsim from './Songsim.js'; + +class App extends Component { + render() { + return ( +
+
+ logo +

Welcome to React

+
+

+ To get started, edit src/App.js and save to reload. +

+ +
+ ); + } +} + +export default App; diff --git a/src/App.test.js b/src/App.test.js new file mode 100644 index 0000000..b84af98 --- /dev/null +++ b/src/App.test.js @@ -0,0 +1,8 @@ +import React from 'react'; +import ReactDOM from 'react-dom'; +import App from './App'; + +it('renders without crashing', () => { + const div = document.createElement('div'); + ReactDOM.render(, div); +}); diff --git a/src/LyricsPane.js b/src/LyricsPane.js new file mode 100644 index 0000000..50ad977 --- /dev/null +++ b/src/LyricsPane.js @@ -0,0 +1,34 @@ +import React, { Component } from 'react'; +import Word from './Word.js'; + +class LyricsPane extends Component { + constructor(props) { + super(props); + } + + handleHover = (e) => { + + } + + renderWord = (word) => { + return (); + } + + renderLine = (line, idx) => { + var words = line.map(this.renderWord); + return

{words}

; + } + + render() { + var lines = this.props.verse.lines.map(this.renderLine); + return ( +
+ {lines} +
+ ); + } +} + +export default LyricsPane; diff --git a/src/Matrix.css b/src/Matrix.css new file mode 100644 index 0000000..32cae37 --- /dev/null +++ b/src/Matrix.css @@ -0,0 +1,3 @@ +rect.focused { + fill: yellow; +} diff --git a/src/Matrix.js b/src/Matrix.js new file mode 100644 index 0000000..fceb6de --- /dev/null +++ b/src/Matrix.js @@ -0,0 +1,76 @@ +import React, { Component } from 'react'; +import './Matrix.css'; + +class Matrix extends Component { + constructor(props) { + super(props); + this.H = 800; + this.W = 800; + this.state = {focused_diagonal: undefined}; + } + + handleClick = (e) => { + console.log(`Clicky click of type ${e.type}`); + } + + handleRectEnter = (e) => { + var rect = e.target; + var x = rect.x.baseVal.value, y = rect.y.baseVal.value; + // Extend selection along diagonal + var diag = this.getLocalDiagonal(x, y); + this.setState({focused_diagonal: diag}); + // Highlight local chunk + corresponding chunks on main diag ( + corresp chunks off main diag?) + // transmit up the chain + this.props.hover_cb([x, y]); + } + + handleRectLeave = (e) => { + this.props.hover_cb([]); + // Clear any highlighting + this.setState({focused_diagonal: undefined}); + } + + shouldHighlight(x, y) { + // TODO: fancier + var d = this.state.focused_diagonal; + if (!d) return false; + return (d.x0 <= x && x <= d.x1 && ((x - y) === (d.x0 - d.y0))); + } + + RectFromCoords(coords) { + var x = coords.x, y = coords.y; + var key = (x * this.props.matrix.length) + y; + // I don't quite get why the 1s need to be quoted? + return ( + ); + } + + render() { + /** Given text, compute self-similarity matrix + * naive drawing impl: for each x,y draw rect + */ + var rects = this.props.matrix.adjacency_list.map( + this.RectFromCoords.bind(this) + ); + var scale = this.H / this.props.matrix.length; + var scalestr = `scale(${scale})`; + return ( + + + {rects} + + + ); + } +} + +Matrix.propTypes = { + // foo: React.PropTypes.string +}; + +export default Matrix; diff --git a/src/SongSelector.js b/src/SongSelector.js new file mode 100644 index 0000000..6f67c54 --- /dev/null +++ b/src/SongSelector.js @@ -0,0 +1,36 @@ +import React, { Component } from 'react'; + +class SongSelector extends Component { + CANNED = [ + {fname: 'badromance.txt', artist: 'Lady Gaga', title: 'Bad Romance'}, + {fname: 'buddyholly.txt', artist: 'Weezer', title: 'Buddy Holly'}, + ] + + constructor(props) { + super(props); + } + + renderOption = (song) => { + return (); + } + + handleChange = (e) => { + var r = new XMLHttpRequest(); + var url = process.env.PUBLIC_URL + '/canned/' + e.target.value; + r.open('GET', url); + r.onload = () => { + this.props.onSelect(r.response); + }; + r.onerror = () => { console.log("uh oh"); }; + r.send(); + } + + render() { + return ( + ); + } +} + +export default SongSelector; diff --git a/src/Songsim.js b/src/Songsim.js new file mode 100644 index 0000000..3aa8014 --- /dev/null +++ b/src/Songsim.js @@ -0,0 +1,83 @@ +import React, { Component } from 'react'; + +import Matrix from './Matrix.js'; +import LyricsPane from './LyricsPane.js'; +import SongSelector from './SongSelector.js'; +import {VerseMatrix, Verse} from './verse.js'; +import {NOINDEX} from './constants.js'; +import {Diagonal} from './utils.js'; + +class Songsim extends Component { + constructor(props) { + super(props); + var text = "I never wanna hear you say\nThat I want it that way"; + this.state = {verse: new Verse(text), + matrix_focal: {x: NOINDEX, y: NOINDEX}, + lyrics_focal: NOINDEX, + }; + } + + onTextChange = (t) => { + this.setState({verse: new Verse(t)}); + } + + get focal_rect() { + console.assert(this.lyrics_focal === NOINDEX + || this.matrix_focal.x === NOINDEX, "Shouldn't both be set"); + if (this.lyrics_focal !== NOINDEX) { + return {x: this.lyrics_focal, y: this.lyrics_focal}; + } + return this.matrix_focal; + } + + get focal_rowcols() { + if (this.lyrics_focal !== NOINDEX) { + var thing = [this.lyrics_focal, this.lyrics_focal]; + return [thing, thing]; + } + if (this.matrix_focal.x !== NOINDEX) { + var diag = this.focal_local_diag; + return [diag.yrange, diag.xrange]; + } + return [undefined, undefined]; + } + + get focal_local_diag() { + if (this.matrix_focal.x === NOINDEX) { + return undefined; + } + var matrix = this.state.verse.matrix; + return matrix.local_diagonal(this.matrix_focal.x, this.matrix_focal.y); + } + + render() { + return ( +
+ +
+ +
+ this.setState({matrix_hover: coords})} + focal_rect={this.focal_rect} + focal_rows={this.focal_rows} + focal_cols={this.focal_cols} + focal_diags={this.focal_diags} + /> +
+ +
+ +
+ +
+
+ ); + } +} + +export default Songsim; diff --git a/src/Word.css b/src/Word.css new file mode 100644 index 0000000..9ed589d --- /dev/null +++ b/src/Word.css @@ -0,0 +1,7 @@ +span { + padding-right: .75ch; +} + +.focus { + color: crimson; +} diff --git a/src/Word.js b/src/Word.js new file mode 100644 index 0000000..c30a8e5 --- /dev/null +++ b/src/Word.js @@ -0,0 +1,18 @@ +import React, { Component } from 'react'; + +import './Word.css'; + + +class Word extends Component { + constructor(props) { + super(props); + } + + render() { + var kls = this.props.focus ? "focus" : ""; + return ({this.props.raw}); + } + +} + +export default Word; diff --git a/src/constants.js b/src/constants.js new file mode 100644 index 0000000..66451ab --- /dev/null +++ b/src/constants.js @@ -0,0 +1,4 @@ + +var NOINDEX = -1; + +export {NOINDEX}; diff --git a/src/index.css b/src/index.css new file mode 100644 index 0000000..b4cc725 --- /dev/null +++ b/src/index.css @@ -0,0 +1,5 @@ +body { + margin: 0; + padding: 0; + font-family: sans-serif; +} diff --git a/src/index.js b/src/index.js new file mode 100644 index 0000000..f0990fb --- /dev/null +++ b/src/index.js @@ -0,0 +1,12 @@ +import React from 'react'; +import ReactDOM from 'react-dom'; +import App from './App'; +import './index.css'; + +import 'bootstrap/dist/css/bootstrap.css'; +import 'bootstrap/dist/css/bootstrap-theme.css'; + +ReactDOM.render( + , + document.getElementById('root') +); diff --git a/src/logo.svg b/src/logo.svg new file mode 100644 index 0000000..6b60c10 --- /dev/null +++ b/src/logo.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/utils.js b/src/utils.js new file mode 100644 index 0000000..3c596bb --- /dev/null +++ b/src/utils.js @@ -0,0 +1,36 @@ + +class Diagonal { + + constructor(x0, y0, x1, y1) { + console.assert(x0 <= x1 && y0 <= y1); + this.x0 = x0; + this.y0 = y0; + this.x1 = x1; + this.y1 = y1; + } + + get xrange() { + return [this.x0, this.x1]; + } + + get yrange() { + return [this.y0, this.y1]; + } + + isMain() { + return this.x0 === this.y0; + } + + /** Return the two main diagonal correlates of this diagonal. + * (Or nothing, if this is part of the main diagonal) + */ + mainCorrelates() { + var correlates = []; + if (this.isMain()) return correlates; + + } + + +} + +export {Diagonal}; diff --git a/src/verse.js b/src/verse.js new file mode 100644 index 0000000..d103f59 --- /dev/null +++ b/src/verse.js @@ -0,0 +1,96 @@ +import {Diagonal} from './utils.js'; + +/** + * A chunk of text, presumably some kind of poem/song. + */ +class Verse { + constructor(text) { + this.parse(text); + } + + static cleanWord(word) { + // TODO: punctuation + return word.toLowerCase(); + } + + parse(text) { + // TODO: portable newlines? + var raw_words = []; + var clean_words = []; + var newlines = []; + for (const line of text.split("\n")) { + for (const word of line.trim().split(/\s+/)) { + raw_words.push(word); + clean_words.push(Verse.cleanWord(word)); + } + newlines.push(clean_words.length - 1); + } + this.raw_words = raw_words; + this.clean_words = clean_words; + this.newline_indices = newlines; + } + + get lines() { + var lines = [] + var i = 0; + for (const eol of this.newline_indices) { + var line = []; + // TODO: this is stupid, don't need a loop + for (; i <= eol; i++) { + line.push({i: i, raw: this.raw_words[i]}); + } + lines.push(line); + } + return lines; + } + + get matrix() { + return new VerseMatrix(this.clean_words); + } +} + +/** TODO: the naive approach here is probably wildly inefficient. + * Is there some js implementation of bitstrings I could use here? + */ +class VerseMatrix { + constructor(words) { + this.length = words.length; + this.adjacency_list = []; + for (var x=0; x < words.length; x++) { + for (var y=0; y < words.length; y++) { + // TODO: wasteful to include diagonal and both reflections off diag + if (words[x] == words[y]) { + this.adjacency_list.push({x, y}); + } + } + } + } + + at(x, y) { + // TODO: sooo unoptimized + return this.adjacency_list.some((pt) => { return pt.x == x && pt.y == y }); + } + + local_diagonal(x, y) { + var x0 = x, x1 = x; + var y0 = y, y1 = y; + // Don't do anything further if this point is on the main diagonal. + if (x !== y) { + // Probe up and left + for (let x_ = x, y_ = y; x_ >= 0 && y_ >= 0 && this.at(x_, y_); x_--, y_--) { + x0 = x_; + y0 = y_; + } + // Probe down and to the right + for (let x_ = x, y_ = y; x_ < this.length && y_ < this.length + && this.at(x_, y_); x_++, y_++) { + x1 = x_; + y1 = y_; + } + } + return new Diagonal(x0, y0, x1, y1); + } + +} + +export {Verse, VerseMatrix};