Skip to content

Instantly share code, notes, and snippets.

@adrianhajdin
adrianhajdin / cron.route.ts
Created September 30, 2023 10:15
Web Scraping Full Course 2023 | Build and Deploy eCommerce Price Tracker
import { NextResponse } from "next/server";
import { getLowestPrice, getHighestPrice, getAveragePrice, getEmailNotifType } from "@/lib/utils";
import { connectToDB } from "@/lib/mongoose";
import Product from "@/lib/models/product.model";
import { scrapeAmazonProduct } from "@/lib/scraper";
import { generateEmailBody, sendEmail } from "@/lib/nodemailer";
export const maxDuration = 300; // This function can run for a maximum of 300 seconds
export const dynamic = "force-dynamic";
@ToJans
ToJans / directus_extensions_endpoints_filestorage_index.js
Last active July 13, 2023 14:06
Quick hack: Redirect to asset by URL - Endpoint extension for directus.io
// Quick hack: Redirect to asset by URL - Endpoint extension for directus.io
// =========================================================================
//
// 2021 - ToJans - Public Domain
//
// *** Don't hold me liable if it breaks anything! Quick hack, might expose all your data!
//
// You can use this endpoint extension to access assets via the folder and file structure
// you used in the file module, so you don't need to reference assets by guid anymore.
//
@bluengreen
bluengreen / mirth-csv-to-array.js
Created April 7, 2018 05:38
Mirth CSV file to collection of JavaScript literals
//the Mirth file reader has a CSV file (now in the msg object)
//be sure your channel's incoming data type is 'delimited text'
//let's pretend this csv contains customers
var customers = [];
var header = msg.row[0];
for(var i=1;i<msg['row'].length();i++)
{
var cust = {};
for (col in msg.row[i].children()) {
@ke4roh
ke4roh / Gemfile
Last active April 2, 2023 10:56 — forked from binarydev/json_utilities.rb
declare module_function
source 'https://rubygems.org'
gem 'json'
group :test do
gem 'minitest'
gem 'test-unit'
end