forked from swapagarwal/geeksay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
geeksay.js
212 lines (204 loc) · 6.25 KB
/
geeksay.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
const translations = {
"save": "ctrl+s",
"break": "<br>",
"control": "ctrl",
"rule": "ctrl",
"escape": "esc",
"black": "#000",
"white": "#fff",
"bang": "!",
"not": "!",
"new": "ctrl+n",
"open": "ctrl+o",
"anchor": "<a>",
"bold": "<b>",
"cut": "ctrl+x",
"copy": "ctrl+c",
"paste": "ctrl+v",
"quit": "ctrl+q",
"close": "ctrl+w",
"help": "f1",
"rename": "f2",
"undo": "ctrl+z",
"redo": "ctrl+y",
"search": "ctrl+f",
"find": "ctrl+f",
"replace": "ctrl+r",
"print": "ctrl+p",
"greet": "ping",
"get": "git",
"got": "git",
"home": "127.0.0.1",
"house": "127.0.0.1",
"local": "127.0.0.1",
"localhost": "127.0.0.1",
"fuck": "fork",
"hello": "ping",
"hi": "ping",
"hey": "ping",
"command": "cmd",
"forget": "ctrl+z",
"world": "0.0.0.0/0",
"want": "require",
"need": "require",
"name": "alias",
"address": "url",
"pie": "π",
"function": "fn",
"kill": "ctrl+c",
"stop": "abort",
"refresh": "f5",
"slow": "O(n^n)",
"fast": "O(1)",
"leet": "1337",
"hacker": "haxor",
"geek": "g33k",
"plus": "+",
"minus": "-",
"and": "&&",
"or": "||",
"binary": "01",
"call": "ping",
"me": "self",
"owner": "admin",
"god": "root",
"please": "sudo",
"at": "@",
"fix": "debug",
"shit": "dump",
"bullshit": "dump",
"poop": "dump",
"delete": "del",
"force": "ma",
"coffee": "covfefe",
"number": "#",
"image": "img",
"photo": "img",
"pic": "img",
"picture": "img",
"snap": "img",
"snapshot": "img",
"bye": "exit",
"noob": "n00b",
"life": "42",
"universe": "42",
"everything": "42",
"lifetime": "runtime",
"sleep": "shutdown",
"red": "#ff0000",
"green": "#00ff00",
"blue": "#0000ff",
"marry": "merge",
"propose": "commit",
"not found": "404",
"link": "url",
"forbidden": "403",
"send": "push",
"alternate": "alt",
"alternative": "alt",
"inspect": "ctrl+shift+i",
"equal": "=",
"remove": "rm",
"move": "mv",
"random": "rand",
"mathematics": "math",
"heart": "<3",
"love": "<3",
"smile": ":)",
"list": "ls",
"ok": "200",
"okay": "200",
"question": "?",
"history": "log",
"on": "1",
"off": "0",
"pixel": "px",
"say": "log",
"body": "<body>",
"head": "<head>",
"restart": "ctrl+alt+del",
"death": "BSOD",
"wait": "load",
"waiting": "loading",
"forbidden": "403",
"unauthorized": "401",
"nothing": "void",
}
const quotes = [
"Hello World", // ping 0.0.0.0/0
"Bye World", // exit 0.0.0.0/0
"Forget that ever happened", // ctrl+z that ever happened
"Home is where the heart is", // 127.0.0.1 is where the heart is
"Home is where ideas come to life", // 127.0.0.1 is where ideas come to 42
"Home is where the wifi connects automatically", // 127.0.0.1 is where the wifi connects automatically
"fuck that shit", // fork that dump
"go hard or go home", // go hard || go 127.0.0.1
"I will call you", // I will ping you
"I want the world to know me", // I require the 0.0.0.0/0 to know self
"I am the owner", // I am the admin
"I am God", // I am root
"please make me a sandwich", // sudo make self a sandwich
"coffee is life", // covfefe is 42
"what's your name", // what's your alias
"I will find you and I will fix you!", // I will ctrl+f you && I will debug you!
"I need help", // I require f1
"geek alert", // g33k alert
"geek inside", // g33k inside
"copy that!", // ctrl+c that!
"get out of home", // git out of 127.0.0.1
"not everything is black and white", // ! 42 is #000 && #fff
"to be or not to be, that is the question", // to be || ! to be, that is the ?
"i was 5 and he was 6", // i was 101 && he was 110
"he wore black and i wore white", // he wore #000 && i wore #fff
"bang bang my baby shot me down", // ! ! my baby shot self down
"Today is the first day of the rest of your lifetime", // Today is the first day of the rest of your runtime
"i need to sleep", // i require to shutdown
"There are ten types of people in the world: those who understand binary and those who don't", // There are ten types of people in the world: those who understand 01 && those who don't
"I love my life", // I <3 my 42
"I love my house", // I <3 my 127.0.0.1
"heart break", // <3 <br>
"I like to fix shit", // I like to debug dump
"eat sleep code repeat", // eat shutdown code repeat
"roses are red, violets are blue", // roses are ##ff0000, violets are ##0000ff
"The greatest trick the devil ever pulled was convincing the world he didn't exist", // The greatest trick the devil ever pulled was convincing the 0.0.0.0/0 he didn't exist
"home sweet home", // 127.0.0.1 sweet 127.0.0.1
"history repeats itself", // log repeats itself
"My dog likes to greet me at the door.", // My dog likes to ping me at the door.
"keep calm and geek on", // keep calm && g33k 1
"somebody save me", // somebody ctrl+s me
"Easy as pie", // easy as π
"Live, laugh, love", // live, laugh, <3
"Green with envy", // #00ff00 with envy
"The cake is a lie", // cake != cake
]
function isNumeric(num) {
return !isNaN(parseInt(num));
}
function geeksay(text) {
const input = Array.isArray(text) ? text : String(text).split(' ');
return input.map(geeksayWord).join(' ');
}
function geeksayWord(word) {
if (isNumeric(word)) {
return (word >>> 0).toString(2);
}
else {
lowerCaseText = removeSymbols(word).toLowerCase();
if (translations.hasOwnProperty(lowerCaseText)) {
word = word.toLowerCase().replace(lowerCaseText, translations[lowerCaseText]);
}
return word;
}
}
function removeSymbols(word) {
return word.replace(/(?!\n|\r\n)[^a-zA-Z0-9]+/, '');
}
function getRandomTranslation() {
const keys = Object.keys(translations);
const randomKey = keys[Math.floor(Math.random() * keys.length)];
return "Random Translation: " + randomKey + " -> " + translations[randomKey];
}
function getRandomQuote() {
return quotes[Math.floor(Math.random() * quotes.length)];
}
module.exports = geeksay;