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:
sara has declared February Dreamwidth is for Shitposting month (sorry, too late to take it back):
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 websitethat 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.)
So:
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
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
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.)
no subject
no subject
no subject
no subject
no subject
shit lets be shitposts
no subject
(really this February shitpost thing just keeps getting better and better
no subject
no subject
no subject
no subject
I think your generator wants me to make Actual Content.
no subject
no subject
no subject
no subject
no subject
no subject
no subject
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 ;)
no subject
(A few times at work I've been like "I can do it for you in javascript or I can do it for you in excel. Just please don't make me do it in google forms. Please.") (many of the people at work think that both javascript and any excel formulas more complicate than SUM are magic.)
no subject
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.
no subject
(Despite all the stuff that I agree with about dw posts not having to be elaborate or substantial... it is somehow very dreamwidth that we respond to "dreamwidth is for shitposting" by doing things like creating challenges, teaching javascript, and having a symposium on definitions.)
I think I parse it as somewhere halfway between "I am posting this despite knowing this is shit" and "I am posting this specifically to be a shit".
no subject
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.
no subject
This is where a kudos/like button would be very handy.
no subject
(I understand why corporate doesn't like profanity, but sometimes you just have to say "this is a fucking horrible hack", you know?)
no subject
no subject
no subject
(sorry for coming in in the middle. just wanted to say thank you for sharing this a+ script.)
no subject
no subject
no subject
no subject
no subject
no subject
no subject
So: is there any way to make sure the second (or third) name picked is different from the first?
no subject
The easiest way would be, after you've gotten the second/third name but before you smush it onto the others, to check whether it matches anything else that's already in the pile.
I would do this with another "while" loop, and probably the "includes()" method, to see if the pile already includes your new name, and try again if it doesn't.
It would need to go between
//this invokes the selector of random shit for the next piece of shit
shitName = GetShit();
(which pulls a new piece of shit, and stores it as shitName)
and
//this mushes the new piece of shit onto the old shit. To change what connects the two pieces of shit, change what is between the quotes in the line below. / is a good one.
shitHtml = shitHtml + " vs. " + shitName;
(which adds the new piece of shit onto shitHtml, which is the the existing pile of shit.)
I would probably write it something like this:
//checks to see if the new shit is already on the pile of shit, keeps going back and getting new shit until it finds one that isn't.
while (shitHtml.includes(shitName)){
shitName = GetShit();}
I've haven't tested it, though, and I've never used the includes() method before (I just looked it up on w3schools to see if there was already a tool to do what I needed.) Try it and see if it works, and if it doesn't, see if you can figure out what I did wrong?
This is the fast and sloppy way, though. I think to do it right, you'd need to either turn off the polyamory option, or completely change the way it's written to make it so the program can remember more than one name at a time. The main disadvantage here is that if you have two characters named "Ann" and "Annabel", it's going to think "Annabel" *always* already includes Ann, and never allow an Annabel/Ann pairing. ("Ann/Annabel" would be okay, though, since "Ann" doesn't include "Annabel". And "Ann the Pilot" and "Annabel" should be fine, so just be careful with how you write your list of names.)
no subject
So, would it be all right if I sent you the .html then? :)
no subject
no subject