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 / direcory_tag.rb
Created February 10, 2014 22:03
jekyll-plugin loop_directory
#usage:
#{% loop_directory directory:images iterator:image filter:*.jpg sort:descending %}
# <img src="{{ image }}" />
#{% endloop_directory %}
module Jekyll
class LoopDirectoryTag < Liquid::Block
include Liquid::StandardFilters
Syntax = /(#{Liquid::QuotedFragment}+)?/
@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 / go prod ftp
Created July 26, 2016 05:22
Upload folder to a FTP using lftp command.
#!/bin/bash
read -p "Are you sure you want to go to production? <y/N> " prompt
if [[ $prompt =~ [yY](es)* ]]
then
echo "---- UPDATE example.net SITE ----"
HOST="ftp.example.net"
USER="username"
PASS="password"
FTPURL="ftp://$USER:$PASS@$HOST"
LCD="/Users/username/Sites/project-name"
@jgatjens
jgatjens / index.js
Last active March 29, 2022 13:49
Send Covid Test
var nodemailer = require('nodemailer');
var fromEmail = 'jgatjens@gmail.com';
var fromPassword = '';
var toEmail = ['z1priano@gmail.com'];
// Defined transport
var transporter = nodemailer.createTransport({
service: 'Gmail',
@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
Created July 31, 2021 01:59
node.js send email with gmail account
var nodemailer = require('nodemailer');
var fromEmail = 'jgatjens@gmail.com';
var fromPassword = '****';
var toEmail = ['makod3v@gmail.com'];
// 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;