Skip to content

Commit 6a01db7

Browse files
committed
day 14
1 parent 7d5bf8c commit 6a01db7

23 files changed

+95
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@ Motivate yourself to code daily till 30 days, and see the magic!
2929
| [Day 10](./each%20day%20build%20day!/Day%2010/) | [Infinite scrolling ComicBook](./each%20day%20build%20day!/Day%2010/) | [demo]() | [Takeaways](./each%20day%20build%20day!/Day%2010/README.md/) |
3030
| [Day 11](./each%20day%20build%20day!/Day%11/) | [Drag & Drop File Upload](./each%20day%20build%20day!/Day%2011/) | [demo]() | [Takeaways](./each%20day%20build%20day!/Day%2011/README.md/) |
3131
| [Day 12](./each%20day%20build%20day!/Day%12/) | [Multi select checkboxes](./each%20day%20build%20day!/Day%2012/) | [demo]() | [Takeaways](./each%20day%20build%20day!/Day%2012/README.md/) |
32-
| [Day 13](./each%20day%20build%20day!/Day%13/) | [Custom video player](./each%20day%20build%20day!/Day%2013/) | [demo]() | [Takeaways](./each%20day%20build%20day!/Day%2013/README.md/) |
32+
| [Day 13](./each%20day%20build%20day!/Day%13/) | [Custom video player](./each%20day%20build%20day!/Day%2013/) | [demo]() | [Takeaways](./each%20day%20build%20day!/Day%2013/README.md/) |
33+
| [Day 14](./each%20day%20build%20day!/Day%14/) | [Key sequence detection](./each%20day%20build%20day!/Day%2014/) | [demo]() | [Takeaways](./each%20day%20build%20day!/Day%2014/README.md/) |
File renamed without changes.
File renamed without changes.
File renamed without changes.

each day build day!/Day 14/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Konami sequence
2+
3+
4+
Key sequence detection using plain javascript.
5+
Nothing fancy here yet powerful.
6+
7+
# Challenges
8+
- keyup event
9+
- array methods
10+
- regex
11+
12+
# snap
13+
![before](demo.png)
14+
![after](demo1.png)

each day build day!/Day 14/demo.png

80.9 KB
Loading

each day build day!/Day 14/demo1.png

154 KB
Loading

each day build day!/Day 14/index.html

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Key Sequence (Konami sequence) 🐣 </title>
8+
<style>
9+
body {
10+
font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;
11+
line-height: 2em;
12+
}
13+
14+
.container {
15+
min-height: 800px;
16+
background-color: rgb(142, 146, 146);
17+
display: flex;
18+
flex-direction: column;
19+
justify-content: start;
20+
align-items: center;
21+
22+
}
23+
24+
li {
25+
list-style: armenian;
26+
font-size: 23px;
27+
color: rgb(44, 12, 12);
28+
}
29+
30+
.display {
31+
height: 300px;
32+
width: 400px;
33+
background: #fff;
34+
}
35+
</style>
36+
<script type="text/javascript" src="https://www.cornify.com/js/cornify.js"></script>
37+
</head>
38+
39+
<body>
40+
<div class="container">
41+
<h1>How key sequence works in editors ?</h1>
42+
<h3>Remember, that cool mario hack up up down down left right left right B A. <br>
43+
Well I always wondered how it worked ? <br>
44+
Similarily, in editors and ide we see combination of keys for a particular activity.
45+
</h3>
46+
47+
<ul>
48+
<li>Type pikapika and see the magic</li>
49+
<li>Type charizad and see the magic</li>
50+
<li>Type your name</li>
51+
</ul>
52+
53+
<div class="display">
54+
55+
</div>
56+
57+
58+
</div>
59+
60+
61+
<script>
62+
const pressed = [];
63+
window.addEventListener('keyup', e => {
64+
pressed.push(e.key);
65+
console.log(pressed);
66+
const secretCode = 'pikapika'
67+
const secretCode2 = 'charizad'
68+
pressed.splice(-secretCode.length - 1, pressed.length - secretCode.length);
69+
if (pressed.join('').includes(secretCode) || pressed.join('').includes(secretCode2)) {
70+
71+
cornify_add();
72+
}
73+
//console.log(pressed);
74+
});
75+
76+
</script>
77+
</body>
78+
79+
</html>

0 commit comments

Comments
 (0)