Skip to content

Instantly share code, notes, and snippets.

View klaaz0r's full-sized avatar
🚢
shipping

Klaas Foppen klaaz0r

🚢
shipping
View GitHub Profile
@klaaz0r
klaaz0r / googleIndexAPI.ts
Created December 10, 2023 12:23
Google Indexing API for Homestra.com
import getDataSource from '../dataSource';
import { ListingStatus, Property } from '../entities/Property';
import log from '../logger';
import fetch from 'node-fetch';
import { IsNull } from 'typeorm';
//@ts-ignore <- fight me
import { google } from 'googleapis';
// Enable the Indexing API here:
@klaaz0r
klaaz0r / emails.ts
Created September 6, 2021 12:31
Email settings
const createOptions = (variables: any) => {
return {
maizzle: {
env: "node",
...variables,
clientUrl: config.clientUrl,
assetsUrls: "https://images.reason.fm/email-assets",
company: {
url: config.clientUrl,
name: "Reason",
@klaaz0r
klaaz0r / waitForDomElement.js
Last active October 12, 2022 11:34
Wait for a DOM element to appear with a MutationObserver
const waitForElement = selector => new Promise((resolve, reject) => {
const element = document.querySelector(selector);
if (element) {
return resolve(element);
}
const timeout = setTimeout(() => reject(new Error('element not found')), 15000);
const walkDOM = (node, fn) => {
@klaaz0r
klaaz0r / 01-directory-structure.md
Created March 5, 2018 14:57 — forked from tracker1/01-directory-structure.md
Anatomy of a JavaScript/Node project.

Directory structure for JavaScript/Node Projects

While the following structure is not an absolute requirement or enforced by the tools, it is a recommendation based on what the JavaScript and in particular Node community at large have been following by convention.

Beyond a suggested structure, no tooling recommendations, or sub-module structure is outlined here.

Directories

  • lib/ is intended for code that can run as-is
  • src/ is intended for code that needs to be manipulated before it can be used
@klaaz0r
klaaz0r / inference.hs
Created September 19, 2017 13:15
manual type inference
foldr . map
(. map) foldr
(.) :: (b1 -> c1) -> (a1 -> b1) -> a1 -> c1
map :: (a2 −> b2) −> [a2] −> [b2]
foldr :: (a3 -> b3 -> b3) -> b3 -> [a3] -> b3
(b1 -> c1) ~ (a2 −> b2) −> [a2] −> [b2]
DECLARE
v_amount_of_columns_total NUMBER;
apex_templateid NUMBER;
apex_businessruleid NUMBER;
v_amount_of_columns_used NUMBER;
BEGIN
apex_templateid := :P70_TEMPLATEID;
apex_businessruleid := :P70_ID;
@klaaz0r
klaaz0r / get_tables_and_columns.plsql
Created December 13, 2015 12:19
Loading all the tables and columns from a oracle db
BEGIN
dbms_output.Put_line (USER
|| ' Tables in the database:');
FOR t IN (SELECT table_name
FROM user_tables) LOOP
dbms_output.Put_line(t.table_name);
FOR i IN (SELECT column_name
FROM user_tab_cols
@klaaz0r
klaaz0r / delete_tables_and_sequences.sql
Last active October 10, 2018 13:22
Easy deleting tables and sequences in an oracle db
BEGIN
FOR i IN (SELECT *
FROM tabs) LOOP
EXECUTE IMMEDIATE ('drop table '|| i.table_name|| ' cascade constraints'
);
END LOOP;
END;
/
BEGIN