melannen: Commander Valentine of Alpha Squad Seven, a red-haired female Nick Fury in space, smoking contemplatively (Default)
melannen ([personal profile] melannen) wrote2019-01-17 11:10 pm

More Joy: Itchy Coding Fingers Edition

I don't have anything super joyful for more joy day, but I do still have itchy coding fingers. I forget that the reason I don't code very much anymore is that I haven't really learned how to stop coding yet.

So: [personal profile] sara has declared February Dreamwidth is for Shitposting month (sorry, too late to take it back):

DREAMWIDTH IS FOR SHITPOSTING: AN EXERCISE IN FEBRUARY

Since I have suggested it twice in comments and people seem to like the idea, I now propose it formally, a solution to two experiences we might like not to have: one, February, when it rains, or is excessively hot, or is in some other way invariably unsatisfactory! a month from which we would like to be distracted until circumstances improve! and two, this illusion that DREAMWIDTH IS FOR SERIOUS, which...no, I am here to assure you that we have been entirely full of shit on this website since the dawn of same. BUT! you say, Sara, everyone here is OLD and also ERUDITE AS FUCK and sometimes it is ALL A BIT MUCH.


I don't know if I will participate because I am shit at shitposting (it either becomes srs longform meta or homestuck references with me, no middle ground) but I look forward to seeing everyone else shitposting like crackerjack that month.

She included an AMAZING list of suggested topics, but she made the mistake of saying "or there could be a randomizer; or there could be any number of things. But there aren't." and the thing is, I had this randomizer just sitting around, so... now there is a randomizer for it?

shiptoast topic generator

I had that code just lying around because it is basically the code from the les miserables random pairing generator

(there is also one that is just injokes from miseres chat. Ah, sweet shitposting nostalgia.)

I was going to offer to make random pairing generators with that code for anybody who has a list of things they would like to randomly pair, but actually, it's REALLY SIMPLE code, so instead, I am going to tell you how to do it YOURSELF, even if you think you can't write code.

And I am going to do that merely by giving you the entire text of the random pairing generator, complete with comments in it that tell you exactly what to do to change stuff. I encourage anyone who would like to make their own javascript program to make a random shit generator of their own!

Here's how to do it: either copy + paste the code in the box below into a TEXT EDITOR (notepad is the basic choice, if you're on windows, or something equally stripped down - no microsoft word or any of that nonsense!) or download the file http://melannen.katycat.net/shiptoast.html , and then open that in your TEXT EDITOR (It will want to open in your browser, but don't let it.)

If you don't have a text editor at home, you can also edit the code right in the text box on this page, but there will be no way to save it except to copy + paste it somewhere else.

The only things you should need to know about javascript going in:
1. if it starts with // or <!-- , that's comments for humans. Computers will ignore it. You can do literally anything you want there.
2. Punctuation is very important, don't mess with it. Linebreaks and whitespace are mostly decorative, you can mess with them.





Read the contents! Follow the instructions! Change whatever you want to change! Then, save the file with whatever filename you want, and a .html file extension. Open the file you just saved in a web browser, and you should be able to test your new computer program that you forked yourself! If it doesn't do anything, that means you messed up the javascript syntax somehow. (You probably deleted a bit of punctuation you shouldn't have). If it does something but doesn't do what you wanted it to do, you probably accidentally told it to do something else (look more carefully at what you actually want it to do.)

If you try this and it doesn't work and you can't figure out why, or if you need me to break something down more simply or I missed a step, feel free to ask in a comment! (You will probably need to put any bits of code in <textarea> tags or dw will try to read them as html.)

Now, to actually share it with other people, you need to be able to upload it somewhere that will let you run javascript, which does not include dreamwidth. If you have your own website, you can definitely upload it there. If you don't, I am going to be home for the long weekend, and I will offer to host any basic forks from this code on my website that I am leeching from my sister shhhh if you get them to me by next Tuesday. Email me your .html file (my @dreamwidth.org address should still work if you don't have my main one) and I will test it and then upload it and send you the new web address!

The next step - once you are a real coder, who has made a real javascript program - is to learn how to do it right. That's harder. (It's still mostly just messing around with shit in other people's code, though.)
primeideal: Text: "Right, the colors. Whoa! Go away! We're trying to figure out the space-time continuum here." on Ravenclaw banner (ravenclaw)

[personal profile] primeideal 2019-01-18 05:14 am (UTC)(link)
This is excellent and I will absolutely try to use a modified version of the code for sparking ideas! (Which may or may not turn into longform seriousness!)
stellar_dust: Stylized comic-book drawing of Scully at her laptop in the pilot. (Default)

[personal profile] stellar_dust 2019-01-18 05:31 am (UTC)(link)
in the spirit of shitposting: NOICE
stellar_dust: Stylized comic-book drawing of Scully at her laptop in the pilot. (Default)

[personal profile] stellar_dust 2019-01-18 04:52 pm (UTC)(link)
bro


shit lets be shitposts
kore: (Default)

[personal profile] kore 2019-01-18 05:39 am (UTC)(link)
HAVE THIS LOVELY BOUQUET OF INTERNETS

(really this February shitpost thing just keeps getting better and better
minim_calibre: (Default)

[personal profile] minim_calibre 2019-01-18 06:05 am (UTC)(link)
EXCELLENT!
harpers_child: a book titled "the perversions of quiet girls" (quiet perversions)

[personal profile] harpers_child 2019-01-18 07:46 am (UTC)(link)
YOur generator gave me "the investment of intellectual capital vs. benign joys" which I'm pretty sure is an essay and not a shitpost. (It spit out other stuff, but that was the first one.)

harpers_child: a neighborhood watch sign where the typical icon has been replaced with a batman signal (DC: the bat is watching)

[personal profile] harpers_child 2019-01-18 07:47 am (UTC)(link)
I tried it again and got "problems of secondary interest vs. television".

I think your generator wants me to make Actual Content.
thenewbuzwuzz: converse on tree above ground (Default)

[personal profile] thenewbuzwuzz 2019-01-18 10:27 am (UTC)(link)
Wow, thanks!!
extrapenguin: Northern lights in blue and purple above black horizon. (Default)

[personal profile] extrapenguin 2019-01-18 11:32 am (UTC)(link)
My actual biggest problem with Tumblr's idiocy and potential upcoming collapse is that it's a damn good place to host JavaScript stuff. It's where I host Poem Line for Title, as well as a few random ship generators.
extrapenguin: Northern lights in blue and purple above black horizon. (Default)

[personal profile] extrapenguin 2019-01-18 08:01 pm (UTC)(link)
Edit appearance -> Edit theme -> Edit HTML, and then Ctrl+a and paste in your desired website layout. Doesn't work on mobile, but whatever. Note that you do need some HTML in there to "run" the JS, while a bookmarklet can be just pure JS, but it's apparently considered a very good option for JS hosting.
lannamichaels: Astronaut Dale Gardner holds up For Sale sign after EVA. (Default)

[personal profile] lannamichaels 2019-01-18 01:32 pm (UTC)(link)
Honest question, what is a shitpost? I have never figured this out. Is it anything that isn't specifically related to something, like it's just random?
lannamichaels: Astronaut Dale Gardner holds up For Sale sign after EVA. (Default)

[personal profile] lannamichaels 2019-01-18 01:45 pm (UTC)(link)
Okay and Actual Relevant Comment, here's another way to do randomizers and put them online. I do it in excel for pairing generators, but it's also can be done in gdocs.

1) Make a list of things, one on each line.
2) In the column to the left of this, have numbers from 1 to wherever it goes. I fancy this up and have it autogenerated by using the ROW() formula and then subtract to get to 1, so if the list starts on row 2, the formula is ROW()-1
3) Made a random formula to pick a number. I go fancy and tell it to get a random number between the smallest number in col A and the biggest number in column A so I don't have to know what my biggest and smallest numberss are. RANDBETWEEN(Min(A:A),Max(A:A)) does the trick.
4) Find whatever value is in column B for that using vlookup.
=VLOOKUP(E3,A2:B12,2,false) , where E3 is the cell with the random number (or just put the randomzation in the vlookiup:
=VLOOKUP(RANDBETWEEN(min(A:A),max(A:A)),A2:B12,2,false) )


Quick'n'dirty gdocs version: https://docs.google.com/spreadsheets/d/10Ew-Ho0SUJznENvfGVxDU0401yVwM2Pwf82eLV_Xcrk/edit?usp=sharing There's prettier ways to do it, but this is the 8am version ;)
lannamichaels: Astronaut Dale Gardner holds up For Sale sign after EVA. (Default)

[personal profile] lannamichaels 2019-01-18 02:59 pm (UTC)(link)

There was a portion of my life where I was spending about half my time trying to convince people to just click the button in excel that says "format as table" and that it would solve 90% of their problems for them. Unreadable formulas? Totals rows? Keeping the header row as you scroll down? Nice filters? Alternate row shading? Auto-expansion? Borders? Boom.

That was the time I got my severe annoyance at ever being referred to as magic, because it was always done by people who refused to just learn how to do basic things and would send it off to me as "oh, Lanna does magic". Especially by people who had certificates from trainings that covered all of this, and we both knew it.

author_by_night: (Default)

[personal profile] author_by_night 2019-01-18 03:27 pm (UTC)(link)
A tad OT to the post itself, but in response to this comment: I don't think posts have to be substantial, but I gotta admit I'm better at commenting on posts I can actually add to. I just don't know how I'm supposed to respond to "I went to work, came home, took the dog for a walk, ordered Chinese." I'll sometimes just say "Chinese food is yummy" or something, but I always worry it sounds dismissive (even though that's not how I mean it). IRL I have those conversations too, but you know, there are facial expressions and nods to move the conversation forward.

At the same time, I sometimes find it difficult to comment on substantial posts too, because I'm not always sure I really got the point.
Edited 2019-01-18 15:27 (UTC)
yourlibrarian: DeadTuesday-smidgy06 (SPN-DeadTuesday-smidgy06)

[personal profile] yourlibrarian 2019-01-18 08:25 pm (UTC)(link)
Yes, particularly if the person posting is not necessarily encouraging anyone to respond to particular parts of their post, such as "Do you have this species of bird where you live?" or "What's your favorite takeout food?" etc.

This is where a kudos/like button would be very handy.
batrachian: Dom (from the webcomic Megatokyo) talking on a phone (Dom)

[personal profile] batrachian 2019-01-18 03:43 pm (UTC)(link)
This code is more enjoyable (and also incidentally much more COMPREHENSIBLE) than approximately 90% of the things I am required to write/modify/maintain in my Serious Paid Day Job.

(I understand why corporate doesn't like profanity, but sometimes you just have to say "this is a fucking horrible hack", you know?)
batrachian: (Laughing Frog)

[personal profile] batrachian 2019-01-18 08:35 pm (UTC)(link)
Appropriate variable naming is VERY IMPORTANT. *solemn face*
tinny: (__geek ifruity)

[personal profile] tinny 2019-01-26 07:36 pm (UTC)(link)
Hahaha, lol, yeah. I love it. I wish I got to write code with "shit" in every method name. *dreams on*

(sorry for coming in in the middle. just wanted to say thank you for sharing this a+ script.)
cesperanza: (Default)

[personal profile] cesperanza 2019-01-18 04:57 pm (UTC)(link)
You are a wonderful, wonderful person.
karlht: Mu the giggling dragon, as drawn by Max Toth in 1992-ish (Default)

[personal profile] karlht 2019-01-18 06:32 pm (UTC)(link)
Pardon me, I'm just going to pause a moment to renew my subscription to Dreamwidth. Because this, this glorious madness, is what I'm here for, and I am so very glad there's a place for it.
bossymarmalade: (tangled up in my hair)

[personal profile] bossymarmalade 2019-01-18 06:40 pm (UTC)(link)
SHIPTOAST FOR THE WIN
sistawendy: a cartoon of me saying "Praise Bob!" (prabob)

[personal profile] sistawendy 2019-01-18 09:11 pm (UTC)(link)
Yusss! I actually learned some Javascript from this post. I'm a back end developer. :)
22degreehalo: Souma from Ensemble stars sitting on a giant turtle, smiling, while multicoloured fish swim all around (Ensemble Stars)

[personal profile] 22degreehalo 2019-01-19 06:26 am (UTC)(link)
So!! I tried to alter the code you provided to make a v simple pairing generator (for a particular fandom of mine, Ensemble Stars, with a biiig ensemble cast perfect for something like this) BUT it does have a clear flaw when used for that purpose: the code allows for the same name to be picked twice, generating selfcest pairings! For another more sci fi oriented canon that might actually be vaguely plausible, but not so in this one.

So: is there any way to make sure the second (or third) name picked is different from the first?
22degreehalo: Kanata from Ensemble Stars in a hero costume, pressing a fist to his chest and smiling with determination (Ensemble Stars2)

[personal profile] 22degreehalo 2019-01-20 03:52 am (UTC)(link)
Ah, this works perfectly, even with the poly options! :D Thanks so much!! And luckily it doesn't seem like the Ann/Annabel situation should apply? And if so I could just add in surnames anyway? Which kinda seems like the easy way around it but oh well n.n;; Still mostly don't understand what's going on in there but it's p interesting so I'll keep looking at it - always thought it'd be rly useful to know a lil' coding!


So, would it be all right if I sent you the .html then? :)
22degreehalo: A side character from Beauty and the Beast 2017, immediately after he was focibly dressed in women's clothes and make-up, looking up happily (happy)

[personal profile] 22degreehalo 2019-01-22 10:40 am (UTC)(link)
Okay, sent to melannen@dreamwidth.org and the yahoo email listed on your profile just in case because I wasn't 100% sure if either was correct. n.n;;