Skip to content

Instantly share code, notes, and snippets.

View mariusbolik's full-sized avatar
🏠
Working from home

Marius B. mariusbolik

🏠
Working from home
View GitHub Profile
@perkinsjr
perkinsjr / middleware.ts
Last active January 31, 2024 11:06
Using Clerk with Upstash for Middleware rate limiting and API Protection
import { getAuth, withClerkMiddleware } from "@clerk/nextjs/server";
import { NextResponse, NextFetchEvent } from "next/server";
import type { NextRequest } from "next/server";
import { Ratelimit } from "@upstash/ratelimit";
import { Redis } from "@upstash/redis";
// Add public paths for Clerk to handle.
const publicPaths = ["/", "/sign-in*", "/sign-up*", "/api/blocked"];
// set your rate limit.
@Supamiu
Supamiu / apollo.interceptor.ts
Created December 9, 2019 13:06
Example interceptor for apollo-angular
import { Injectable } from '@angular/core';
import { HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http';
import { filter, switchMap } from 'rxjs/operators';
@Injectable()
export class ApolloInterceptor implements HttpInterceptor {
constructor(private myAuthService: AuthService) {
}
@mayneyao
mayneyao / notion2blog.js
Last active February 29, 2024 18:01
Notion.so > Personal Blog | custom domain + disqus comment
const MY_DOMAIN = "agodrich.com"
const START_PAGE = "https://www.notion.so/gatsby-starter-notion-2c5e3d685aa341088d4cd8daca52fcc2"
const DISQUS_SHORTNAME = "agodrich"
addEventListener('fetch', event => {
event.respondWith(fetchAndApply(event.request))
})
const corsHeaders = {
"Access-Control-Allow-Origin": "*",
@santiq
santiq / config.yml
Created March 5, 2019 06:33
Automate generation Ionic App APK with CircleCI.
version: 2
jobs:
build:
docker:
- image: circleci/android:api-28-node
working_directory: ~/repo
environment:
JVM_OPTS: -Xmx3200m
steps:
- checkout
@perguth
perguth / .htaccess
Last active January 28, 2024 19:01
Apache reverse proxy `.htaccess` file eg. for NodeJS. @Uberspace
SetEnvIf Request_URI "^(.*)" PORT=65300
RewriteEngine On
RewriteBase /
# CORS
Header add Access-Control-Allow-Origin "*"
# HTTPS
RewriteCond %{HTTPS} !=on
@jonalvarezz
jonalvarezz / Nginxg frontend proxy for Ghost
Created January 27, 2014 05:40
Nginx as frontend proxy for Ghost
server {
server_name www.sitedomain.com;
rewrite ^ http://sitedomain.com$request_uri? permanent;
}
server {
listen 0.0.0.0:80;
server_name sitedomain.com;
access_log /var/log/nginx/sitedomain.log;