[Q] [JavaScript] What does this code do? - Other Operating Systems and Languages

Hi,
I was looking at Github's Spoon-Knife repo, and decided to clone it.
After inspecting the html file, all it really does is display a gif with funny text below it. However there is JavaScript, that appears to do something when a key is pressed, showing a 'rainbow message'.
Here is the code:
Code:
var keyCodes=new Array(10);
var pattern=[38,38,40,40,37,39,37,39,66,65];
function keydownHandler(e){
keyCodes.shift();
keyCodes.push(e.keyCode);
if(keyCodes.every(function(element, index, array){return element===pattern[index];})){
document.getElementById("rainbow-message").style.display="";
}
}
window.onkeydown=keydownHandler;
Here is the repo:
https://github.com/octocat/Spoon-Knife
I'm very interested to know what this could be as I am certain it's a joke.
Thanks,
Wolf

It just set css's display-attribute from "rainbow-message" to nothing (shows it), if one of the special keys (one of "pattern") is pressed.
Kind Regards

EmptinessFiller said:
It just set css's display-attribute from "rainbow-message" to nothing (shows it), if one of the special keys (one of "pattern") is pressed.
Kind Regards
Click to expand...
Click to collapse
Thanks man. But could you enlighten me about the special keys? Which would I press?
- Amp Milk

Wolf Pup said:
Thanks man. But could you enlighten me about the special keys? Which would I press?
- Amp Milk
Click to expand...
Click to collapse
Being a nerd, after looking at it I'm going to guess up, up, down, down, left, right, left, right, b, a.
I'll run it and check because you've got me curious now
Edit: Confirmed. I am a nerd

Archer said:
Being a nerd, after looking at it I'm going to guess up, up, down, down, left, right, left, right, b, a.
I'll run it and check because you've got me curious now
Edit: Confirmed. I am a nerd
Click to expand...
Click to collapse
Thanks mate, I'll try it tomorrow.
- Amp Milk

Archer said:
Being a nerd, after looking at it I'm going to guess up, up, down, down, left, right, left, right, b, a.
I'll run it and check because you've got me curious now
Edit: Confirmed. I am a nerd
Click to expand...
Click to collapse
LOL, I didn't notice at first but when I looked at the pattern array again, the "38,38,40,40,37,39,37,39" part is pretty obvious. :victory:

Konami code, classic one.

Related

[APP][2009-03-03] Vibra - tool to vibrate phone fo a given time

Hi,
I created a little tool for a friend that can be called from scripts. It will vibrate for a given time that can be passed through a command line parameter.
Feel free to use it wherever you want.
Usage:
vibra.exe -l=X (X = milliseconds to vibrate)
History:
V1.0
initial release
My girl is gonna love this for her phone! unfortunately i'll mean I won't see her as much.
whats this good for? why would anyone ever need something like this
also vibrating long periods will surly break the phone. how about a maximum length (about 15 seconds) to avoid lawsuits
this could be helpful for some of my applications. thanks.
this is goning to be a fun app nice job!!
be good for s2u2.. unlock2exe (your vibra tool)
good stuff!
thanks
lol, I read the heading and I said to myself, "yup, this app is for the girls"
definitely for the girls! lol
mawst95 said:
My girl is gonna love this for her phone! unfortunately i'll mean I won't see her as much.
Click to expand...
Click to collapse
Muaahaahahahaahahaaaa
mawst95 said:
My girl is gonna love this for her phone! unfortunately i'll mean I won't see her as much.
Click to expand...
Click to collapse
hahaha!
i only just got this..
What would be the best way to get this to vibrate at random intervals of between 10 and 20 minutes? Mortscript? I had an idea and this sounds like it will take me 1 step closer.
http://forum.xda-developers.com/showthread.php?t=423451
Sunra said:
What would be the best way to get this to vibrate at random intervals of between 10 and 20 minutes? Mortscript? I had an idea and this sounds like it will take me 1 step closer.
http://forum.xda-developers.com/showthread.php?t=423451
Click to expand...
Click to collapse
Yes, I would suggest MortScript to do this.
How do you edit vibrate time length (make vibrate longer or shorter)?
Well - just read the first post.
Command line parameter: -l=X
where X is the length.
MarcLandis said:
Hi,
I created a little tool for a friend that can be called from scripts.
Click to expand...
Click to collapse
The friend is a girl, right?
I'm pretty sure my friend won't let herself be called from scripts...
Nice one ty!! my girl will know how to use the app!!!! ;p
vibra use...
mawst95 said:
My girl is gonna love this for her phone! unfortunately i'll mean I won't see her as much.
Click to expand...
Click to collapse
hahaha. good one!
In my Samsung i780, when i use it, instead of vibrating it lights up a LED... my girlfriend will be disappointed.
Now what this needs is a option to call or text trigger the vibration so you can REALLY revolutionize the GSM/CDMA Sex Toy Industry! Lends to a new meaning of reach out and touch someone!
The Pocket(PC) Rocket! LOL

FINALLY a solution to the keyboard backlight turning off

I have to give great credit to No2Chem over at PPCGeeks for putting together a solution to the issue with our CDMA landscape keyboard backlights shutting down after 5 seconds.
I diligently worked on CAB file that keeps the keyboard on all the time when the keyboard is open, and shuts off when you close it.
Here is the link to the Thread.
http://forum.ppcgeeks.com/showthread.php?t=44773
Donate if it works for you, and you like it.
Didn't work for me...
OUTSTANDING!
It requires a soft reset before it will work.
That explains it... I lost all my stylus so cant reset anymore
shutting off the phone is like doing a soft reset... hold the power button in for 4 seconds then it will confirm shutoff, then power on you just did a soft reset.
aaron580 said:
That explains it... I lost all my stylus so cant reset anymore
Click to expand...
Click to collapse
you can use a paperclip, or ballpoint pen, or just download the softreset CAB installer and that will give you a button under programs to do a software soft-reset, no need to press the button
-C
Thank you for posting this. Never thought I'd actually see it work!
aaron580 said:
That explains it... I lost all my stylus so cant reset anymore
Click to expand...
Click to collapse
stylii? lol
jirafabo said:
stylii? lol
Click to expand...
Click to collapse
At first I was gona correct you for correcting him, but then I remember the TP comes with two styli. haha
Finally, I can use my keyboard in the dark with fear of hitting the wrong key! By the way, is there a way to stop the keyboard from coming up on the screen every time I have to type something?!
Anybody else get the issue of the front keys staying on when the keyboard is in?
cd85233 said:
At first I was gona correct you for correcting him, but then I remember the TP comes with two styli. haha
Click to expand...
Click to collapse
Yeah i wasn't necessarily correcting him, I just knew it sounded funny, but so does styli. was just wondering what you call those!
if you need a stylus just go in and ask, I bet they give you one. I get so much free stuff from a friend bc they can take what people return. I get battery covers and batteries. I have 3 sitting on my dresser now.
radar369 said:
Finally, I can use my keyboard in the dark with fear of hitting the wrong key! By the way, is there a way to stop the keyboard from coming up on the screen every time I have to type something?!
Click to expand...
Click to collapse
It seems I remember a setting in advanced config for "SIP Auto Deploy" that did the trick for me. I know I got it fixed (except in Opera), I just don't remember exactly how. So there's an answer out there if you look hard enough.
Can anyone explain why this interferes with the keyboard sliding sounds? Right now, if I use this, the sliding sounds won't work, but if I remove this, they work just fine.
i second that.....
on screen keyboard ? by rdar369,but then remembered the setting philipdhall mentioned and he's right ,want to try this cab file but read some where as well about the keys staying lit after closed and dont have an extended battery to spare the juice ,if i do try i will repost my findings

Secret buttons!

probably been found before but i've found if i hold down the bottom left of the phone (under and to the left of the home key) i get a 'recent' menu pop up with all the apps i've used recently.
do the same on the other corner and you get the 'speak now' pop up
common knowledge??
Yeah, it's common knowledge.
Welcome to the world of Android .Yes this is extreme common knowledge across all android devices. Good effort though.
If you hold power and volume down you enter a secret menu when the phone powers up.
Just found this out by accident today
Sent from my PG86100 using Tapatalk
jonbaker76 said:
probably been found before but i've found if i hold down the bottom left of the phone (under and to the left of the home key) i get a 'recent' menu pop up with all the apps i've used recently.
do the same on the other corner and you get the 'speak now' pop up
common knowledge??
Click to expand...
Click to collapse
its actually just a long press of the home key and same for the search key. NOT under and to the left of the key. Just press and hold the home key for 1.5-2sec and release and youll get it to pop up.
but yeah thats common android like everyone else said.
jonbaker76 said:
probably been found before but i've found if i hold down the bottom left of the phone (under and to the left of the home key) i get a 'recent' menu pop up with all the apps i've used recently.
do the same on the other corner and you get the 'speak now' pop up
common knowledge??
Click to expand...
Click to collapse
You are not hitting a secret button, you are long pressing the home button and the search button.
Common knowledge.
Long press the "Menu" button and the keyboard pops up... betcha didn't know THAT, now, didja? ~
Long press the back button and it goes back a page in most apps!
Sent from my PG86100 using Tapatalk
Tilde88 said:
Welcome to the world of Android .Yes this is extreme common knowledge across all android devices. Good effort though.
Click to expand...
Click to collapse
lol yeah, its extreme common knowledge to press down the hard plastic side of your phone to get the recent apps. also us super-powerusers like to slam our phones against wall for more battery
good effort though
lol, i thought as much, noob to android, 3 days in
guitardoc64 said:
Yeah, it's common knowledge.
Click to expand...
Click to collapse
Someone mention me?
jasonb1108 said:
If you hold power and volume down you enter a secret menu when the phone powers up.
Just found this out by accident today
Sent from my PG86100 using Tapatalk
Click to expand...
Click to collapse
That would be the hboot and fast boot menus, more useful if you're going to root.
i know it's annoying but i'll ask anyway,
in brief, what is rooting?
jonbaker76 said:
i know it's annoying but i'll ask anyway,
in brief, what is rooting?
Click to expand...
Click to collapse
In a short explanation, Rooting is taking the panties off your phone and exposing the goods, and what you can do with those goods.
knowledge561 said:
In a short explanation, Rooting is taking the panties off your phone and exposing the goods, and what you can do with those goods.
Click to expand...
Click to collapse
Yep.. It allows you to permanently write to the "root" directories of your phone... Most importantly, the /boot & /system partitions...
Sent from my 3::::::::::::Ð
knowledge561 said:
In a short explanation, Rooting is taking the panties off your phone and exposing the goods, and what you can do with those goods.
Click to expand...
Click to collapse
well put!
And to OP welcome to Android.
jasonb1108 said:
If you hold power and volume down you enter a secret menu when the phone powers up.
Just found this out by accident today
Sent from my PG86100 using Tapatalk
Click to expand...
Click to collapse
You are too funny. Shhh, don't tell them about the self-destruct button.
liverstealerJobs said:
You are too funny. Shhh, don't tell them about the self-destruct button.
Click to expand...
Click to collapse
Yea what ever you do don't push the big red button that says do not press (located under the LCD) I had to learn the hard way.
How about long-pressing the power button. Did you know it brings up a menu to turn your phone OFF!?! OMFGWTFBBQ!?!!
Here comes the trolls and **** boys. Obviously he's new to Android, no need to start jokes.
Uhhhh.....ummm.....**Fainted from Signature Fright**

How to take screen shots with rezound

combed through the threads in the rezound and didn't come across this so thought i share.
The Rezound has a built in feature like some other phones to take screen shots without the need of Root or paying for apps.
simply press and hold the "power button" and press "home key" and you got a screen shot.
That's great to know! Thanks for posting this!
Sent from my ADR6425LVW using xda premium
Thanks for this. I would have never known otherwise. The documentation that came with the phone is a little lacking...
Yep, this works! Thanks for the tip!
Sent from my HTC Rezound using XDA Premium
michaelvibe said:
Thanks for this. I would have never known otherwise. The documentation that came with the phone is a little lacking...
Click to expand...
Click to collapse
Men don't read instructions, and I doubt this would even be in there.
I sure hope they fix the black line running down the right side in these screenshots.
Cares said:
I sure hope they fix the black line running down the right side in these screenshots.
Click to expand...
Click to collapse
My screenshot looks fine, could you show us what your talking about?
its not a black line, its jsut cut off. the screenshot doesnt save as the same resolution as the screen; it's a little thinner..it sucks lol
jayochs said:
its not a black line, its jsut cut off. the screenshot doesnt save as the same resolution as the screen; it's a little thinner..it sucks lol
Click to expand...
Click to collapse
Ok your right, I see what Cares is talking about. Not really a big deal it does capture the whole screen just as you said doesn't display in full resolution so you see a small border.
Short video showing the screen capture in action.
jayochs said:
its not a black line, its jsut cut off. the screenshot doesnt save as the same resolution as the screen; it's a little thinner..it sucks lol
Click to expand...
Click to collapse
it's not cut off. the screenshot is taking a higher resolution shot than the resolution of the display.
display: 1280x720 (720p)
screenshot: 1280x736.
16 pixels right side = blank = black line.
hope the bump doesn't anger the gods, think the info in this thread is worth it.
do you need to have sense running for this to work, I.E. rosie launcher? I de-sensed my phone and this doesn't appear to work. I assume it is not "hard encoded" obviously, so I would assume it is a sense feature I lost?
paigow said:
combed through the threads in the rezound and didn't come across this so thought i share.
The Rezound has a built in feature like some other phones to take screen shots without the need of Root or paying for apps.
simply press and hold the "power button" and press "home key" and you got a screen shot.
Click to expand...
Click to collapse
http://forum.xda-developers.com/showthread.php?t=1348011
http://forum.xda-developers.com/showthread.php?t=1360655
nosympathy said:
do you need to have sense running for this to work, I.E. rosie launcher? I de-sensed my phone and this doesn't appear to work. I assume it is not "hard encoded" obviously, so I would assume it is a sense feature I lost?
Click to expand...
Click to collapse
Yes, it is part of Sense 3.0+ IIRC.
Thank you for posting this!

Power button blunged in?

Sorry people I got no idea what is the perfect verb to put. As you know the power button should be emerging from the phone, but as I chat a lot and close the phone between messages and stuff it became.. "bent" in?
I cant really put pictures at the moment as I have no camera, but the point is, I can't use the phone properly now.. Sometimes when I try to put the phone to sleep it restarts, or pops up the "power menu" (Reboot, power off..etc) . And sometimes when I am using it the backlights just start flashing and bam, the phone reboots alone.. more terribely it sometimes just becomes stuck in a boot loop due to power button restarting the phone over and over again lol ?
So the question isnt really software but hardware, I tried the pin that you use to bring out the sim slot to try and push the power button out, but well.. It doesnt fit. Anyone got any idea what to do ?
Take the cover off and reposition the button.
sixcarnage said:
Take the cover off and reposition the button.
Click to expand...
Click to collapse
Seems like there wont be any other way other than opening the cover. Guess I will just send it to a local shop to reposition.. Shouldn't cost much..
An advice for others, use the swipe2wake if you can lol ..
Is there a tool similar to the IOS's accessibility tool? You know that little box that you press on and you can choose the "Home button" or "Sleep" ..etc?
Ghand0ur said:
Seems like there wont be any other way other than opening the cover. Guess I will just send it to a local shop to reposition.. Shouldn't cost much..
An advice for others, use the swipe2wake if you can lol ..
Is there a tool similar to the IOS's accessibility tool? You know that little box that you press on and you can choose the "Home button" or "Sleep" ..etc?
Click to expand...
Click to collapse
There WAS one, i'll see if i can find what it's called for you....haven't heard about it in at least 2years though.. (it was on the market) but have a look in the application dev section on xda
Lloir said:
There WAS one, i'll see if i can find what it's called for you....haven't heard about it in at least 2years though.. (it was on the market) but have a look in the application dev section on xda
Click to expand...
Click to collapse
Found a recent one, Floating Toucher.. http://forum.xda-developers.com/showthread.php?t=2355373
Its quite similar, maybe not the best RAM optimized, its a bit laggy but should do the trick. For those interested, have fun. and support the developer.
For those who don't know what I am talking about its called "Assistive touch" on the IOS.
Best of luck, thanks Lloir
Ghand0ur said:
Found a recent one, Floating Toucher.. http://forum.xda-developers.com/showthread.php?t=2355373
Its quite similar, maybe not the best RAM optimized, its a bit laggy but should do the trick. For those interested, have fun. and support the developer.
For those who don't know what I am talking about its called "Assistive touch" on the IOS.
Best of luck, thanks Lloir
Click to expand...
Click to collapse
glad i helped? i guess lol
Ive taken it off myself with a guitar pick and its very strong and holds up more than I thought. So its no problem. Also no warranty is voided doing this if I remember.

Categories

Resources