text stringlengths 184 4.48M |
|---|
<!--yml
category: codewars
date: 2022-08-13 11:48:20
-->
# Codewars第九天–Can you get the loop ?_soufal的博客-CSDN博客
> 来源:[https://blog.csdn.net/u011562123/article/details/81946003?ops_request_misc=&request_id=&biz_id=102&utm_term=codewars&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduweb~default-9-819... |
import { SWAllItemsResponse } from '@core/models/intefaces/common-response.interface';
import { gameReducer, initialState } from '../game.reducer';
import { GameApiActions } from '../actions';
describe('Game reducer', () => {
it('should update isLoading state', () => {
const state = gameReducer(
initialSta... |
package com.test;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.List;
import java.util.stream.Collectors;
import com.test.Member.MemberDto;
import java.util.ArrayList;
class Member {
private String use... |
// Write a function that takes in an array of numbers and returns an array with all numbers multiplied by 3.
const testArr1 = [3, 9, 15, 4, 10]
// // output: [9, 27, 45, 12, 30]
const mult3 = (array) => {
let newArray = []
for (let i = 0; i < array.length; i++){
newArray.push(array[i] * 3)
}
r... |
import torch
def make_dataset():
"""Return train and test dataloaders for MNIST."""
train_data, train_labels = (
[],
[],
)
for i in range(5):
train_data.append(torch.load(f"data/raw/corruptmnist/train_images_{i}.pt"))
train_labels.append(torch.load(f"data/raw/corruptm... |
// copied from 1-usertojson.dart, adding id prop, new instance fromJson, and method toString
class User {
// Propteries
String name;
int age;
double height;
int id;
// Constructor w/ named parameters
User({required this.name, required this.age, required this.height, required this.id});
// Method
Str... |
async function rangosSalarialesDropdown() {
try {
const respuestaRangosSalariales = await fetch("http://localhost:3000/rangosSalariales");
const rangosSalariales = await respuestaRangosSalariales.json();
console.log(rangosSalariales);
const rangosSalarialesHTML = document.getElementById("... |
<?php
namespace App\Models;
use App\Enum\ShippingOptionTypeEnum;
use App\Models\Traits\Activatable;
use App\Models\Traits\HasFeUsage;
class ShippingOption extends BaseModel
{
use Activatable;
use HasFeUsage;
protected $fillable = [
'name',
'type',
'logo',
'params',
... |
import { db } from './config/firebase';
import { setDoc, doc, getDoc, updateDoc, Timestamp } from 'firebase/firestore';
import { UserInfo } from 'firebase/auth/cordova';
export interface FirestoreUserProfile {
uid: string;
displayName: string;
email: string;
phoneNumber: string | null;
photoURL: string;
pr... |
# python imports
from argparse import Namespace
from struct import pack
from typing import Iterator
from ebp.common.algorithm.mersenne_twister import MtSequenceEncoders
### Encoders to take the MT sequence and present the value in a defined manner.
class MtSequenceCliEncoders(dict):
## Creates a new instanec o... |
#include <stdio.h>
#include <string.h>
#include "encode.h"
#include "types.h"
#include "common.h"
/* Function Definitions */
//step 1.1 step validation check (used for both encoding and decoding)
Status validation_check(int argc)
{
if( argc > 2 && argc <= 5 )
{
printf("validation successfull\n");
return e_s... |
<!-- Improved compatibility of back to top link: See: https://github.com/jamesfrienkins3452/FEP-13-website-project/pull/73 -->
<a name="readme-top"></a>
<!--
*** Thanks for checking out the Best-README-Template. If you have a suggestion
*** that would make this better, please fork the repo and create a pull request
***... |
<template>
<view class="content">
<view class="opreate">
<view>在下面的画布中随意创作吧</view>
<view class="btnGroup">
<button type="default" style="margin-right: 20rpx;" @tap="clearEvent">
<image src="../../static/icon/del.png"></image>
</button>
<button type="default">
<image src="../../static/icon... |
const { DataTypes } = require("sequelize");
module.exports = (sequelize) => {
sequelize.define(
"Country",
{
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
allowNull: false,
},
name: {
type: DataTypes.STRING,
allowNull: ... |
package nuber.students;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.Date;
public class Booking {
private static final AtomicInteger nextId = new AtomicInteger(1); // For unique, sequential job IDs
private final int jobId;
private final NuberDispatch dispatch;
private final Passenger passen... |
import { Request } from "express";
import { uuid } from "uuidv4";
import Slug from "../utils/Slug";
//model
import User from "../models/user";
interface paginateObject {
next: {},
previous: {},
data: []
}
class UserRepository {
body: Request['body'];
params: Request['params'];
query: Request[... |
package ian.Behavioral.Iterator.level2;
import java.util.*;
class DFSIterator implements Iterator {// 深度優先搜索
private Set<User> visited = new HashSet<>();
private Stack<User> check = new Stack<>();
public DFSIterator(User startUser) {
check.push(startUser);
}
@Override
public boolean ... |
package com.cq.seckill.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@AllArgsConstructor
@Data
@NoArgsConstructor
/**
* 公用返回响应对象
*/
public class RespBean {
private long code;
private String message;
private Object obj;
/**
* 成功返回结果
* @return
... |
import { Body, Controller, Get, Param, ParseUUIDPipe, Patch, Query } from '@nestjs/common';
import { ApiTags, ApiQuery, ApiOperation, ApiOkResponse, ApiParam, ApiBody } from '@nestjs/swagger';
import joi2swagger from 'src/common/utils/joi2swagger';
import { UserId } from 'src/common/decorators/user.decorator';
import {... |
import React, { useEffect, useState } from 'react';
import { ScrollView, View } from 'react-native';
import { Input, useTheme } from 'react-native-elements';
import { SwitchInput } from '../../../components/SwitchInput';
import { ENUM_AUTOMATION_TYPE } from '../../../enums';
import { ScheduleInput } from './ScheduleIn... |
/**
* @name CommandLineParser/tests/TestVerifyData.cpp
* @copyright (c) 2022 Sam Caldwell. All Rights Reserved.
* @author Sam Caldwell <mail@samcaldwell.net>
*/
#include "projects/application/CommandLineParser/src/CommandLineParser.h"
class TestBasic : public TestBase {
private:
ConfigStateMap *map;
Conf... |
import {
Body,
Controller,
Post,
HttpStatus,
HttpException,
UseGuards,
Put,
Param,
Get,
Query,
Delete,
} from "@nestjs/common";
import { z } from "zod";
import { ZodValidationsPipe } from "../../../pipes/zod-validations-pipe";
import { CreateBrandUseCase } from "@/domain/catalog/application/use-ca... |
# This program is the pipeline for testing expressiveness.
# It includes 4 stages:
# 1. pre-calculation;
# 2. dataset construction;
# 3. model construction;
# 4. evaluation
from data_utils.preprocess import drfwl2_transform, drfwl3_transform
import numpy as np
import torch
import torch_geometric
from pygmmpp.d... |
import React, { FC } from 'react';
import Layout from 'src/components/layout/Layout';
import TicTacToePlayer from 'src/components/tictactoe/player/TictactoePlayer';
import { useAuth } from 'src/firebase';
import useTranslate from 'src/hooks/useTranslate';
import useIsLocalStorageReady from 'src/hooks/useIsLocalStorage... |
# The robot should use the orders file (.csv ) and complete all the orders in the file. orders.csv
# Only the robot is allowed to get the orders file. You may not save the file manually on your computer.
# The robot should save each order HTML receipt as a PDF file.
# The robot should save a screenshot of each of the o... |
import { NextResponse, NextRequest } from "next/server";
import { NextApiRequest, NextApiResponse } from 'next';
import OpenAI from "openai";
require('dotenv').config({ path: ['.env.local', '.env'] });
export async function POST(req: NextRequest, res: NextResponse) {
if (req.method === 'POST')
{
con... |
from __future__ import annotations
from typing import List
from discord import Interaction, InputTextStyle
from discord.ui import InputText
from UI.Common import FroggeModal
################################################################################
__all__ = ("BGCheckVenueModal",)
###########################... |
/**
* Copyright (C) 2006 NetMind Consulting Bt.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* Thi... |
import type { PostSummary, PostType } from '@/server/data_types/post'
import Image from 'next/image'
import Link from 'next/link'
import { format } from 'date-fns'
import { classnames } from '@/lib/classnames'
import { Card } from '@/ui/card/card'
import { PostTypesDisplayMapping } from '@/server/data_types/post'
// ... |
import gym
import random
from tensorflow.keras import Sequential
from collections import deque
from tensorflow.keras.layers import Dense
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.optimizers import RMSprop
from keras import optimizers
import matplotlib.pyplot as plt
from tensorflow.keras.activat... |
{% extends 'layout.html' %}
{% load i18n static djmoney custom_filters %}
{% block page_content %}
<div class="Middle Middle_top">
<div class="Section">
<div class="wrap">
<div class="Product">
<div class="ProductCard">
<div class="ProductCard-look">
<div class="... |
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document Object MOdel, DOM</title>
<link rel="favicon" href="./../favicon.ico" type="image/x-icon">
<!-- Bo... |
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ShrubberyCreationForm.cpp :+: :+: :+: ... |
import { Request, Response, NextFunction } from "express";
import ErrorResponse from "../utils/errorResponse";
const errorHandler = (
err: any,
req: Request,
res: Response,
next: NextFunction
) => {
let error = { ...err };
error.message = err.message;
// Log to the console
console.error(err);
// If... |
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
import { combineLatest, Subject, Subscription } from 'rxjs';
import { Army, BoardLocation, UnitType } from 'src/app/models/game-models';
import { GameContext } from 'src/app/models/game-utility-models';
import { GameContextService } from 'src/app/serv... |
import { FunctionComponent } from "react";
import { AbsoluteFill, Easing, interpolate, useCurrentFrame } from "remotion";
import Layout from "./Layout";
interface AboutProps {}
interface TextProps {
children: React.ReactNode;
index: number;
isLast?: boolean;
}
const Text: FunctionComponent<TextProps> = ({ chil... |
const express = require("express");
const { check, validationResult } = require("express-validator");
const usersRepo = require("../../repositories/users");
const signupTemplate = require("../../views/admin/auth/signup");
const signinTemplate = require("../../views/admin/auth/signin");
const {
requireEmail,
requir... |
import torch
import torch.nn as nn
from functools import partial
import clip
from einops import rearrange, repeat
from transformers import CLIPTokenizer, CLIPTextModel
import kornia
from ldm.dream.devices import choose_torch_device
from ldm.modules.x_transformer import (
Encoder,
TransformerWrapper,
) # TODO:... |
---
title: Diseño de Páginas Web para Agencias de Seguros en Elche
date: '2023-10-04'
tags: ['Diseño web', 'Agencias de Seguros', 'Elche']
draft: false
banner : diseño_paginas_web_agenciasdeseguros
fondoBanner : diseño_pagina_web_elche
summary: El diseño de páginas web se ha convertido en una herramienta fundamental pa... |
/* eslint-disable jsx-a11y/anchor-is-valid */
import React from "react";
import { Link } from "react-router-dom";
import { Form, Formik } from 'formik'
import * as yup from 'yup'
import { SelectField, TextInput } from "../components/CustomFormFields";
import YupPassword from "yup-password";
YupPassword(yup);
const Reg... |
import { Component } from '@angular/core';
import {
FormControl,
FormGroup,
ReactiveFormsModule,
Validators,
} from '@angular/forms';
import { Router, RouterLink } from '@angular/router';
import {
ButtonModule,
CardModule,
FormModule,
TooltipModule,
} from '@coreui/angular-pro';
import { cilCommentBubbl... |
import React from 'react';
// eslint-disable-next-line import/no-extraneous-dependencies
import { render, screen } from '@testing-library/react';
import FlyoutVideo from '../flyout-video';
describe('FlyoutVideo', () => {
const sampleURL = 'https://www.example.com/sample-video';
beforeEach(() => {
rend... |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Cart - Pharmacy manager</title>
<meta name="description" content="Pharmacy manager">
<!-- style -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="/css/ma... |
## --------------------------- \
# import best-performing first-stage SOM and extract codebook vectors
prototypes = readr::read_rds(here("data/som_files/som_files_full/som1_nrc_22_iter_40.rds"))
prototypes = prototypes$codes[[1]] |> as.data.frame()
# set range of second-stage SOM following range suggested by Eisenack ... |
YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
Linear Next Benchmark
Linear Next is a comprehensive benchmark designed to fairly compare various efficient transformer architectures. This project evaluates different approaches including linear attention, sparse attention, and other model structures under identical training conditions and datasets.
Overview
The benchmark aims to provide an unbiased comparison of efficient transformer variants by ensuring all models are trained with the same datasets, hyperparameters, and evaluation metrics. This allows for a clear understanding of the relative strengths and weaknesses of each approach.
Datasets
The benchmark utilizes a diverse collection of high-quality datasets:
General Text
- DCLM-pro: A large-scale dataset containing diverse text from various domains, designed for general language modeling tasks.
- Cosmopedia-v2: A curated corpus of high-quality web content covering a wide range of topics, with emphasis on educational and informative material.
- Fineweb-edu: A filtered collection of educational web content, focusing on instructional and academic text from reliable sources.
Code
- The Stack v2: A comprehensive collection of source code spanning multiple programming languages, designed to train models on code understanding and generation tasks.
Mathematics
- Finemath: A specialized dataset containing mathematical content, including equations, proofs, and mathematical explanations across various difficulty levels.
Reasoning
- Natural Reasoning: A dataset focused on logical reasoning, problem-solving, and inference tasks, designed to improve models' reasoning capabilities.
Methodology
All models in the Linear Next benchmark are evaluated using identical:
- Training datasets and data mixing ratios
- Optimization parameters
- Hardware configurations
- Evaluation metrics
This controlled environment ensures that performance differences can be attributed to the architectural differences rather than training conditions.
Results
Detailed benchmark results, including training curves, inference speed, memory usage, and performance metrics across different tasks, are available in the project repository.
- Downloads last month
- 60