Skip to content

Instantly share code, notes, and snippets.

View PaulSebalu's full-sized avatar
🎯

Paul Sebalu PaulSebalu

🎯
  • Kampala
  • 22:35 (UTC +03:00)
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.
@laserlemon
laserlemon / technical-debit.md
Last active July 23, 2020 09:03
Keeping Track of Technical Debit

Keeping Track of Technical Debt

Don't forget your debt! Developers have a tendency to forget the bad or ugly code they write. In the Real World™, there are times when sacrifices in code quality need to be made in the interest of time. We call it "cowboy coding" and it's a slippery slope that can lead to loads of technical debt.

A big problem is that it's too easy for technical debt to be out of sight and out of mind. There are a few good ways to increase your debt's visibility.

Code Comments

Your first step should be to add code comments where appropriate to document technical debt as it arises. Fight the urge to deny the fact that you're writing less-than-awesome code. Try to include what's wrong with the code in question as well as at least one potential solution.

@miguelmota
miguelmota / getDates.js
Last active February 7, 2024 23:43
Get dates in between two dates with JavaScript.
// Returns an array of dates between the two dates
function getDates (startDate, endDate) {
const dates = []
let currentDate = startDate
const addDays = function (days) {
const date = new Date(this.valueOf())
date.setDate(date.getDate() + days)
return date
}
while (currentDate <= endDate) {
@rxaviers
rxaviers / gist:7360908
Last active July 3, 2024 18:37
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue: