This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"net/http" | |
) | |
func main() { | |
mux := http.NewServeMux() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <unistd.h> | |
#include <sys/socket.h> | |
#include <netinet/in.h> | |
#include <pthread.h> | |
const char *HTTP_200_OK = "HTTP/1.1 200 OK"; | |
const char *HTTP_404_NOT_FOUND = "HTTP/1.1 404 Not Found"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FetchEventSource { | |
private url: string | |
private headers: HeadersInit | |
private controller: AbortController | |
private reader?: ReadableStreamDefaultReader<Uint8Array> | |
constructor(url: string, headers: HeadersInit) { | |
this.url = url | |
this.headers = headers | |
this.controller = new AbortController() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/csv" | |
"fmt" | |
"io" | |
"log" | |
"os" | |
"sync" | |
"time" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type ErrorObject = { | |
statusCode: number | |
message: string | |
} | |
const standardErrorObj: ErrorObject = { | |
statusCode: 401, | |
message: 'lol' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum List { | |
Empty, | |
Node(Box<Node>), | |
} | |
struct Node { | |
elem: i32, | |
next: List, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
typedef struct TNode { | |
int value; | |
int height; | |
struct TNode *left; | |
struct TNode *right; | |
} TNode; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
char* longest_palindromic_substring(char *string); | |
int main() { | |
char *inputs[] = { | |
"xyzzyx", | |
"abaxyzzyxf", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TNode<T> { | |
height: number = 0 | |
value: T | |
left?: TNode<T> | |
right?: TNode<T> | |
constructor(value: T) { | |
this.value = value | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn binary_search(array: &[i32], target: i32) -> i32 { | |
let mut left = 0; | |
let mut right = array.len(); | |
while left < right { | |
let midpoint = left + (right - left) / 2; | |
let current_number = array[midpoint]; | |
if current_number < target { | |
left = midpoint + 1; | |
} else if current_number > target { |
NewerOlder