Skip to content

Instantly share code, notes, and snippets.

@Sutil
Sutil / form.tsx
Last active December 27, 2024 23:34
Shandcn UI Money Mask Input - NextJS.
"use client";
import { zodResolver } from "@hookform/resolvers/zod";
import { useForm } from "react-hook-form";
import MoneyInput from "src/components/custom/money-input";
import { Button } from "src/components/ui/button";
import { Form } from "src/components/ui/form";
import * as z from "zod";
const schema = z.object({
@Sutil
Sutil / @OneToMany unidirectional example
Last active September 6, 2021 14:41
@onetomany unidirectional examplo usint Spring JPA.
@OneToMany unidirectional examplo usint Spring JPA.
<ng-template #conteudoDaLinha >
<tr class="{{ classeCss }}" >
<!-- percorrer cada coluna -->
<td *ngFor="let coluna of colunas; let i = index" class="{{ coluna.classeCss }}" >
<div class="conteudo-celula" >
<!-- Deve existir um recuo na linha dependendo de cada nível na tabela -->
<div *ngIf="i === 0" class="recuo-linha-filha-nivel-{{ nivel }}" ></div>
<table>
<thead>
<tr>
<!-- percorrer cada coluna -->
<th *ngFor="let coluna of colunas" class="{{ coluna.classeCssCabecalho }}" >
{{ coluna.cabecalho }}
</th>
</tr>
</thead>
<tbody>
import { TemplateRef } from '@angular/core';
export interface ColunaTabelaAninhada {
/**
* Texto que aparece no cabeçalho da coluna
*/
cabecalho: string;
/**
<tabela-aninhada
[colunas]="colunas"
[linhas]="linhas"
[extratorDeFilhos]="extratorDeLinhasFilhas"
[extratorDeClasseCss]="extratorDeCssClassCustomizadaParaLinha" ></tabela-aninhada>
#include <stdio.h>
#include <mpi.h>
#define N 100
#define PRODUCER 0
#define CONSUMER 0
#define MAX_PRODUCERS 5
MPI_Status status;
#include <stdio.h>
#include <mpi.h>
#define N 100
void produtor() {
int prod, rec;
while(1) {
MPI_Recv(&rec, 1, MPI_INT, 1, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
#include <mpi.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char* argv[]) {
MPI_Init(NULL, NULL);
int rank;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
int size;
MPI_Comm_size(MPI_COMM_WORLD, &size);
#include "stddef.h"
#include "mpi.h"
#include "stdio.h"
#define LIMITE 10
int count = 0;