This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type Extract<T> = (limit: number, offset: number) => T[] | Promise<T[]> | |
export type Transform<TSource, TDest = TSource> = (result: TSource[]) => TDest[] | Promise<TDest[]> | |
export type Load<T> = (result: T[]) => void | Promise<void> | |
export interface PipelineStep<TSource, TDest = TSource> { | |
name: string | |
extract: Extract<TSource> | |
transform: Transform<TSource, TDest> | |
load: Load<TDest> | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { type AnyColumn, type SQL, sql } from 'drizzle-orm' | |
/** | |
* The Coalesce function evaluates the arguments in the specified order | |
* and always returns the first non-null value from the argument list. | |
* | |
* @template T - The type of the value being coalesced. | |
* @param args - The value to be coalesced. | |
* @returns - The SQL expression representing the coalesced value. | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION public.update_audit_metadata() | |
RETURNS trigger | |
LANGUAGE 'plpgsql' | |
AS | |
$$ | |
DECLARE | |
BEGIN | |
IF TG_OP = 'UPDATE' THEN | |
NEW.created_at := OLD.created_at; | |
NEW.created_by := OLD.created_by; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.michaelpellegrini.example.functional; | |
import io.vavr.Function1; | |
import io.vavr.collection.List; | |
import static io.vavr.API.$; | |
import static io.vavr.API.Case; | |
import static io.vavr.API.Match; | |
import static io.vavr.Predicates.instanceOf; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.jboss.resteasy.annotations.interception.ServerInterceptor; | |
import org.jboss.resteasy.core.ResourceMethod; | |
import org.jboss.resteasy.core.ServerResponse; | |
import org.jboss.resteasy.spi.Failure; | |
import org.jboss.resteasy.spi.HttpRequest; | |
import org.jboss.resteasy.spi.interception.MessageBodyWriterContext; | |
import org.jboss.resteasy.spi.interception.MessageBodyWriterInterceptor; | |
import org.jboss.resteasy.spi.interception.PreProcessInterceptor; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LocalDateBinder implements Binder<Bind, LocalDate> { | |
@Override | |
public void bind(SQLStatement<?> stmt, Bind bind, LocalDate localDate) { | |
stmt.bind(bind.value(), localDate.format(DateTimeFormatter.ISO_LOCAL_DATE)); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.naming.Context; | |
import javax.naming.NamingEnumeration; | |
import javax.naming.NamingException; | |
import javax.naming.directory.Attributes; | |
import javax.naming.directory.DirContext; | |
import javax.naming.directory.InitialDirContext; | |
import javax.naming.spi.NamingManager; | |
import java.net.InetSocketAddress; | |
import java.util.ArrayList; | |
import java.util.Collection; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a configuration | |
Configuration configuration = new Configuration(); | |
//Create a CacheManager using defaults | |
CacheManager manager = CacheManager.create(configuration); | |
//Create a Cache specifying its configuration. | |
Cache testCache = new Cache( | |
new CacheConfiguration("test", maxElements) | |
.memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LFU) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<web-fragment version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd"> | |
<display-name>display-name</display-name> | |
<description>description</description> | |
</web-fragment> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Better | |
public static boolean isEqual(byte[] a, byte[] b) { | |
if (a.length != b.length) { | |
return false; | |
} | |
int result = 0; | |
for (int i = 0; i < a.length; i++) { | |
result |= a[i] ^ b[i] | |
} |
NewerOlder