Skip to content

Instantly share code, notes, and snippets.

View jgatjens's full-sized avatar
🏠
working from home!

Jairo Gätjens jgatjens

🏠
working from home!
View GitHub Profile
# For development purposes, note Next.js supports a .env.local
# file, which is already configured to be git ignored.
# Read more about Next.js support of environment variables here:
# https://nextjs.org/docs/basic-features/environment-variables
# The public URL to use for absolute URLs, which are required when
# the Next.js app is run within Sitecore editors.
# This should match the `serverSideRenderingEngineApplicationUrl`
# in your Sitecore configuration (see \sitecore\config\sxastarter.config).
# Be sure to update these values accordingly as your public endpoint changes.
@jgatjens
jgatjens / seed.ts
Created February 9, 2023 05:37
Seed table from csv file with Prisma.
import { clinics, PrismaClient } from "@prisma/client";
import * as fs from "fs";
import * as path from "path";
import * as csv from "fast-csv";
const prisma = new PrismaClient();
type ClinicsCsvRow = Omit<clinics, "date_created" | "date_updated">;
async function main() {
@jgatjens
jgatjens / package.json
Created October 12, 2022 16:09 — forked from jherr/package.json
Simple monorepo starter
{
"name": "packages",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"private": true,
"scripts": {
"start": "concurrently \"wsrun --parallel start\""
},
"workspaces": [
@jgatjens
jgatjens / _middleware.js
Created March 29, 2022 13:48
Next.js Simple Password Protection
import { NextRequest, NextResponse } from 'next/server'
export function middleware(req: NextRequest) {
const basicAuth = req.headers.get('authorization')
if (basicAuth) {
const auth = basicAuth.split(' ')[1]
const [user, pwd] = Buffer.from(auth, 'base64').toString().split(':')
if (user === '4dmin' && pwd === 'testpwd123') {
@jgatjens
jgatjens / index.js
Last active March 29, 2022 13:49
Send Covid Test
var nodemailer = require('nodemailer');
var fromEmail = '[email protected]';
var fromPassword = '';
var toEmail = ['[email protected]'];
// Defined transport
var transporter = nodemailer.createTransport({
service: 'Gmail',
@jgatjens
jgatjens / index.js
Created July 31, 2021 01:59
node.js send email with gmail account
var nodemailer = require('nodemailer');
var fromEmail = '[email protected]';
var fromPassword = '****';
var toEmail = ['[email protected]'];
// Defined transport
var transporter = nodemailer.createTransport({
service: 'Gmail',
@jgatjens
jgatjens / stickynav.js
Last active November 3, 2020 23:31
Javascript scroll sticky navigation
// Example
// https://jsbin.com/kaviwuzeso/edit?css,output
const stickyNav = () => {
const nav = document.querySelector('.ni__pinned-nav--container');
const activeClass = 'is-active';
const navLinks = nav.querySelectorAll('a');
const sections = document.querySelectorAll('.pinned-nav--section');
if (!nav) return;
@jgatjens
jgatjens / scss_js.js
Created April 17, 2020 20:23
share variables with javascript (webpack)
// share variables with javascript (webpack)
variables.scss
:export {
--hww-dark-blue: #0d2126;
--hww-blue: #00b0e0;
--hww-light: #ffffff;
--hww-secondary-green: #57bf9e;
--hww-secondary-yellow: #e8c71c;
--hww-secondary-red: #de2b47;
@jgatjens
jgatjens / examen_sorpresa.cpp
Created October 30, 2019 21:08
Examne sopresa c++
#include<stdio.h>
void examen_sorpresa();
int factorial(int n);
char name[20];
int dia, mes, year, edad, sum, sum_fact, i, fact;
char pregunta;
int main() {
@jgatjens
jgatjens / examne.cpp
Last active October 23, 2019 19:03
test
#include<stdio.h>
void test();
char name[20];
int num1, num2, num3, num, i, sum;
char pregunta;
int main() {
test();