Skip to content

Instantly share code, notes, and snippets.

View Wallacy's full-sized avatar

Wallacy Freitas Wallacy

View GitHub Profile

Keybase proof

I hereby claim:

  • I am wallacy on github.
  • I am wallacy (https://keybase.io/wallacy) on keybase.
  • I have a public key ASCa7DnCWk7wpgisRWLLcPG3VdJp9TDMAbYJvaDf9RhybQo

To claim this, I am signing this object:

@Wallacy
Wallacy / apollo.ts
Last active January 29, 2023 16:33
Apollo Server + Cloudflare Workers
import { ApolloServerBase, Config, gql } from 'apollo-server-core'
export class ApolloServer extends ApolloServerBase {
protected override serverlessFramework(): boolean {
return true
}
public async createHandler() {
await this.ensureStarted()
return async (request: Request) => {
@Wallacy
Wallacy / prime.c
Created January 21, 2021 21:23
"A small C program to print the biggest prime number" | Fabrice Bellard - https://bellard.org/mersenne.html
#include <stdio.h>
int m = 1811939329, N = 1, t[1 << 26] = {2}, a, * p, i, e = 73421233, s, c, U = 1;
void g(int d, int h) {
for (i = s; i < 1 << 25; i *= 2) d = d * 1LL * d % m;
for (p = t; p < t + N; p += s)
for (i = s, c = 1; i; i--) a = p[s] * (h ? c : 1LL) % m, p[s] = (m * 1U + * p - a) * (h ? 1LL : c) % m, * p = (a * 1U + * p) % m, p++, c = c * 1LL * d % m;
}
int main() {
while (e /= 2) {
@Wallacy
Wallacy / deepMerge.ts
Created May 23, 2020 21:35
Just sharing my deepMerge
import { RecursivePartial } from ".";
function isObject(item: any): boolean {
return item && typeof item === "object" && !Array.isArray(item);
}
function prumeLength(target: any[], lengths = [] as number[]) {
lengths.push(target.length);
const getProto = (obj: any) => {
if (obj) {