Skip to content

Commit 9f1cd29

Browse files
committed
approve and reject a bunch of autocomplete evals
1 parent d05b862 commit 9f1cd29

24 files changed

+381
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
async function fetchWithRetry(url, maxRetries = 3) {
2+
for (let attempt = 0; attempt < maxRetries; attempt++) {
3+
try {
4+
return await fetch(url);
5+
} catch (error) {
6+
if (attempt === maxRetries - 1) throw error;
7+
await new Promise(resolve => setTimeout(resolve, 1000 * (attempt + 1)));
8+
}
9+
}
10+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
function test() {
2+
console.log('hello');
3+
}
4+
5+
function test2() {
6+
console.log('hello2');
7+
}
8+
9+
function test3() {
10+
console.log('hello3');
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
2+
3+
for (let i = 0; i < arr.length; i++) {
4+
console.log(arr[i]);
5+
}
6+
7+
console.log("-----------------------------");
8+
9+
for (let i = arr.length - 1; i >= 0; i--) {
10+
console.log(arr[i]);
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
console.log('test');
2+
3+
const a = 10;
4+
const b = 20;
5+
6+
console.log(a + b);
7+
8+
const c = 30;
9+
const d = 40;
10+
11+
console.log(c + d);
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class User {
2+
constructor(username, email, role) {
3+
this.username = username;
4+
this.email = email;
5+
this.role = role;
6+
}
7+
}
8+
9+
module.exports = User;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
class User
2+
def initialize(username, email, role)
3+
@username = username
4+
@email = email
5+
@role = role
6+
end
7+
8+
def username
9+
@username
10+
end
11+
12+
def email
13+
@email
14+
end
15+
16+
def role
17+
@role
18+
end
19+
20+
def to_s
21+
"#{@username} (#{@email})"
22+
end
23+
end
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
class Animal
2+
def initialize(name)
3+
@name = name
4+
end
5+
end
6+
7+
class Dog < Animal
8+
def initialize(name, breed)
9+
super(name)
10+
@breed = breed
11+
end
12+
end
13+
14+
class Cat < Animal
15+
def initialize(name, color)
16+
super(name)
17+
@color = color
18+
end
19+
end
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class Shape {
2+
area() {
3+
return 0;
4+
}
5+
}
6+
7+
class Rectangle extends Shape {
8+
constructor(width, height) {
9+
super();
10+
this.width = width;
11+
this.height = height;
12+
}
13+
14+
area() {
15+
return this.width * this.height;
16+
}
17+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
class Shape
2+
def area
3+
0
4+
end
5+
end
6+
7+
class Rectangle < Shape
8+
def initialize(width, height)
9+
@width = width
10+
@height = height
11+
end
12+
13+
def area
14+
@width * @height
15+
end
16+
end
17+
18+
class Circle < Shape
19+
def initialize(radius)
20+
@radius = radius
21+
end
22+
23+
def area
24+
Math::PI * @radius * @radius
25+
end
26+
end
27+
28+
class Triangle < Shape
29+
def initialize(base, height)
30+
@base = base
31+
@height = height
32+
end
33+
34+
def area
35+
(@base * @height) / 2
36+
end
37+
end
38+
39+
class Square < Shape
40+
def initialize(side)
41+
@side = side
42+
end
43+
44+
def area
45+
@side * @side
46+
end
47+
end
48+
49+
rectangle = Rectangle.new(5, 10)
50+
circle = Circle.new(7)
51+
triangle = Triangle.new(8, 12)
52+
square = Square.new(6)
53+
54+
puts "Area of Rectangle: #{rectangle.area}"
55+
puts "Area of Circle: #{circle.area}"
56+
puts "Area of Triangle: #{triangle.area}"
57+
puts "Area of Square: #{square.area}"
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Implement functino to add two numbers
2+
// You are not allowed to use + and - operators
3+
// You are not allowed to use incr/decr operators
4+
// You are not allowed to use bitwise operators
5+
6+
#include <iostream>
7+
8+
using namespace std;
9+
10+
int add(int a, int b) {
11+
while (b != 0) {
12+
int carry = a & b;
13+
a = a ^ b;
14+
b = carry << 1;
15+
}
16+
return a;
17+
}
18+
19+
int main() {
20+
int a, b;
21+
cin >> a >> b;
22+
cout << add(a, b) << endl;
23+
return 0;
24+
}

0 commit comments

Comments
 (0)