Skip to content

Instantly share code, notes, and snippets.

View manuel-schoebel's full-sized avatar

Manuel Schoebel manuel-schoebel

View GitHub Profile
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCRhOs8GZnf3ABTukUiFLTsmPxlQMHLt4dd0VIFC0J7OKZnS/YBcIojrMwDWx9Vt05lTm3KK1m7/tBqhb8uWUrKZ1v5Upmbq5+f6+uMFwcexezJaKDtPNnaN6yKoPIA5Jp+qC5xFhK95Uq+4fSXMoccUf/9IVbz6pEx6odglbYHS5ftMhMChGWrr7Va7UWhRo+0lEPLZgGVU/Fjq47FuLv3OPH1DEecOysmwuWDQitnZZuNAl2bnZiN73cboO3BqHOrHCu6pRL7VStShUVuJmG7PCLIXwNxFkJwgu1gEspWxt+rSWOLhrMAX6+9p0D1N7z6VLHDQBlbrO3p2HUKvImz [email protected]
#cloud-config
package_update: true
package_upgrade: true
packages:
- fail2ban
- ufw
- docker.io
- docker-compose
- unattended-upgrades
- git
@manuel-schoebel
manuel-schoebel / api-log-route.ts
Last active April 18, 2024 08:32
next.js simple logger
import { NextRequest, NextResponse } from 'next/server';
export async function POST(request: NextRequest, res: NextResponse) {
const data = await request.json();
switch (data.level) {
case 'error':
console.error(data);
break;
case 'warn':
console.warn(data);
@manuel-schoebel
manuel-schoebel / draftmode.ts
Created March 6, 2024 09:47
Next.js revalidation for headless cms
// route handler enabling draft mode
import { getPageByPath } from "@/lib/api/getPageByPath";
import { defaultLocale } from "@/config/i18n";
import { draftMode } from "next/headers";
import { redirect } from "next/navigation";
export async function GET(request: Request) {
const { searchParams } = new URL(request.url);
const secret = searchParams.get("secret");
const path = searchParams.get("path");
@manuel-schoebel
manuel-schoebel / static-rendering.tsx
Last active September 19, 2023 12:00
Example static rendering next app router
import { readdirSync } from "fs";
import path from "path";
import { performance } from "perf_hooks";
async function getBlogPosts(path: string) {
const postFiles = await readdirSync(path);
const posts = postFiles.map((name) => ({ name }));
console.log("posts", posts);
return posts;
console.log('hello');
@manuel-schoebel
manuel-schoebel / gist:fbb1f8bc8a6262a5bf31
Last active August 29, 2015 14:04
$.serializeObject
// http://forum.jquery.com/topic/serializeobject
// https://github.com/hongymagic/jQuery.serializeObject/blob/master/jquery.serializeObject.js
$.fn.serializeObject = function() {
var a, o;
o = {};
a = this.serializeArray();
$.each(a, function() {
if (o[this.name] !== void 0) {
@manuel-schoebel
manuel-schoebel / html5boilerplate.jade
Created July 9, 2012 08:14 — forked from xtian/html5boilerplate.jade
HTML5 Boilerplate in jade
!!! 5
//if lt IE 7
<html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en">
//if IE 7
<html class="no-js lt-ie9 lt-ie8" lang="en">
//if IE 8
<html class="no-js lt-ie9" lang="en">
//[if gt IE 8]><!
html(class='no-js', lang='en')
//<![endif]