text stringlengths 184 4.48M |
|---|
// Functions for generating data
// Returns vanilla data with 3 circular normals
function threenorm(n) {
var rnorm = d3.random.normal();
var data = new Array(n);
for (var i = 0; i < n; i++) {
var j = Math.floor(Math.random() * 3);
if (j % 3 == 0) {
mux = -6;
muy = -6;
} else if (j % 3 ==... |
/******************************************************************************/
/* */
/* gstlearn C++ Library */
/* ... |
<navbar></navbar>
<div class="container">
<div class="row">
<h1>myXPulse: Manage my profile</h1>
</div>
<div class="row">
<table class="table table-hover">
<thead>
<tr>
<th scope="col"></th>
<th scope="col"></th>
<th scope="col"></th>
</tr>
</thead... |
<?php
namespace App\Http\Livewire\Admin\Store;
use App\Models\Country;
use App\Models\Store;
use App\Models\StoreBranch;
use App\Models\StoreBranchImage;
use App\Models\StoreDate;
use App\Traits\UploadTrait;
use Exception;
use Illuminate\Support\Facades\DB;
use Livewire\Component;
use Livewire\WithFileUploads;
class... |
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { ReactiveFormsModule } from '@angular/forms';
import { AppRoutingModule } from './app-routing.module';
import { Ng2SearchPipeModule... |
from steps.step import Step
from utils import external_project as ext
from utils import command
from utils.log import log
from steps.windows.folders import KnownFolder
from pathlib import Path
class IconsStep(Step):
def __init__(self):
super().__init__("Icons")
self._icons_dir = Path(__file__).par... |
package com.example.myapplication
// imports all important classes
import android.icu.text.SimpleDateFormat
import android.icu.util.Calendar
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageButton
import android.widget.TextView
import androidx.recycle... |
import { useEffect, useState } from 'react'
import { Link, useParams } from 'react-router-dom'
import { useAuth } from '../../../../hooks/useAuth'
import api from '../../../../services/api.service'
import { FriendProps } from '../../../../interfaces'
import { Button } from '../../../../components/Button'
import { F... |
const date = new Date()
const years = []
const months = []
const days = []
const outtype = ["早饭", "午饭", "晚饭", "零食", "饮料酒水", "购物", "交通", "教育", "娱乐", "红包礼物", "水电费", "网费", "话费", "医疗", "投资", "其他"]
const intype = ["工资", "投资收入", "红包", "借入", "二手闲置", "其他"]
for (let i = 1990; i <= date.getFullYear(); i++) {
years.push(i)
}
f... |
import React, { useEffect } from "react";
import { useContext } from "react";
import appIcon from "../../assets/vid.png";
import { useParams, useLocation } from "react-router";
import { useNavigate } from "react-router-dom";
import "../../styles/video.css";
import videoContext from "../../Context/videoContext";
import... |
package tk.springmvc.controller;
import com.google.protobuf.ByteString;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.an... |
package net.minecraft.resources;
import com.mojang.serialization.DataResult;
import com.mojang.serialization.DynamicOps;
import com.mojang.serialization.Lifecycle;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optio... |
import { Resolver, Query, Mutation, Args, Int, ResolveField, Parent } from '@nestjs/graphql';
import { MaintenanceService } from './maintenance.service';
import { MaintenanceObjectType } from './entities/maintenance.entity';
import { CreateMaintenanceInput } from './dto/create-maintenance.input';
import { UpdateMainten... |
import React from "react";
import recipes from "./recipe.json";
import { Rating } from "semantic-ui-react";
import Link from "next/link";
import { Button } from "semantic-ui-react";
import "semantic-ui-css/semantic.min.css";
import styles from "@/styles/recipe.module.scss";
const RecipeDetails = ({ recipe }) => {
co... |
# Data postman level 2
หากเราต้องการที่จะ ทดสอบ Test scenario เดียวจำนวนมากกว่า 1 ครั้งโดยใช้ data ที่ต่างกัน สามารถทำได้ 2 วิธี
1 คือ สร้าง collection ใหม่แล้วแก้ไขข้อมูล วิธีนี้จะมีข้อเสียที่จะต้องสร้าง collection มากตาม data ที่ต้องการทดสอบ
2 สร้างไฟล์ data แล้วนำมาใช้ Run collection บน postman วิธีนี้สามาร... |
const mongoose = require('mongoose');
const Order = require('./models/order');
const Item = require('./models/product');
mongoose.connect('mongodb://localhost:27017/products', { useNewUrlParser: true, useUnifiedTopology: true })
.then(() => {
console.log("Mongo connection is open")
})
.catch(err =>... |
# ubuntu 环境下 的 ROS 工程中 设计绑定设备的串口号
1. 确保设备已经连接到计算机上,并且确定设备文件路径,例如 /dev/ttyUSB0
```shell
$ ls /dev
```
```shell
# Intel D435i 相机串口
$ lsusb
Bus 001 Device 006: ID 8086:0b3a Intel Corp. Intel(R) RealSense(TM) Depth Camera 435i
```
2. 创建规则文件,例如 htc-robot-device.rules
3. 在规则文件中添加内容
模版
KERNEL=="ttyUSB*", ATTRS{idVendor}... |
import 'package:autoagro_firebase/language/locale.dart';
import 'package:autoagro_firebase/provider/auth_provider.dart';
// import 'package:autoagro_firebase/screen/login/login_page.dart';
import 'package:autoagro_firebase/screen/login/options_page.dart';
import 'package:autoagro_firebase/screen/login/splash_screen.dar... |
import React from "react";
import { GlobalProvider } from "../../context/GlobalProvider";
import Item from "../Item/Item";
const ItemList = ({ products }) => {
const { buscar } = GlobalProvider()
let arr = [];
if (buscar.length > 0) {
if (products.length > 0) {
let busqueda = buscar.toLowerCase()
... |
<script setup lang="ts">
import { useI18n } from 'vue-i18n'
import { computed, onMounted, ref, watch } from 'vue'
import { QFile } from 'quasar'
import CollectionName from 'file-uploader/enums/collection-name'
import { useFileUploadStore } from 'file-uploader/stores/file-upload-store'
import QFileParams from 'src/inter... |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
.wrap{
border: 1px solid #111;
}
</style>
</head>
<body>
<div id="container"></div>
<script src="src/react.js"></script>
<script src="src/react-dom.js"></script>
<!-- 解析jsx语法 -->
<script src="src/browser.min.js"></script>... |
public class GenshinImpact {
public String nama;
public int level;
public int adventureRank;
public boolean isAlive; // tambahan variabel boolean
public GenshinImpact(){
}
public GenshinImpact(String nama, int level, int adventureRank) {
this.nama = nama;
this.level = l... |
package classes;
import exception.MovimentoInvalidoException;
public class Robo {
protected int x, y;
protected String color;
protected int qtdMov = 0;
protected int qtdMovInv = 0;
protected int nextMove;
public Robo(String color){
this.color = color;
this.x = 4;
this.y = 0;
this.nextMove... |
import './style.css';
import * as d3 from 'd3';
import { Continents, Data, DataItem, YearData } from './types/Data';
import fetchD3Data from './fetchD3Data';
import d3Tip from 'd3-tip';
let interval: any;
const margin = { top: 10, right: 10, bottom: 150, left: 100 };
const height = 400 - margin.top - margin.bottom;
... |
/****************************************************************************
** @license
** This demo file is part of yFiles for HTML 2.6.0.4.
** Copyright (c) 2000-2024 by yWorks GmbH, Vor dem Kreuzberg 28,
** 72070 Tuebingen, Germany. All rights reserved.
**
** yFiles demo files exhibit yFiles for HTML functio... |
using AdaptiveCards;
using AriBotV4.AppSettings;
using AriBotV4.Enums;
using AriBotV4.Models;
using AriBotV4.Models.MyCarte;
using AriBotV4.Services;
using Azure.AI.TextAnalytics;
using LuisEntityHelpers;
using Microsoft.Bot.Builder;
using Microsoft.Bot.Builder.AI.Luis;
using Microsoft.Bot.Builder.Dialogs;
using Micro... |
import { Matrix4, Vector2 } from "three";
import { MaterialBase } from "../MaterialBase"
import { MeshBVHUniformStruct, UIntVertexAttributeTexture } from "three-mesh-bvh";
// utils
import { renderStructsGLSL } from './glsl/renderStructs.glsl'
import { cameraUtilsGLSL } from './glsl/cameraUtils.glsl'
import { traceScen... |
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';
import 'package:sachintha_uee/models/supply_model.dart';
import 'package:sachintha_uee/utils/constants.dart';
import 'package:sachintha_uee/utils/custom_states.dart';
import 'package:sachintha_uee/utils/index.dart';
import 'p... |
use crate::Bytes;
/// # Invariant
///
/// * `self.ptr` is always a valid pointer to a slice of bytes of len at least
/// `self.len`.
/// * `self.pos < self.len`
pub struct BytesIter {
ptr: *const u8,
len: usize,
pos: usize,
_b: Bytes,
}
impl BytesIter {
#[inline]
fn new(bytes: Bytes) -> Bytes... |
/* @settings
name: Minimal
id: minimal-style
settings:
-
id: instructions
title: Welcome 👋
type: heading
level: 2
collapsed: true
description: Use the Minimal Theme Settings plugin to access hotkeys, adjust features, select fonts, and choose from preset color schemes. Use the settings below for more gran... |
---
changelog:
- 2024-01-28, gpt-4-0125-preview, translated from English
date: 2024-01-28 22:08:18.799169-07:00
description: 'Hoe te: Om een HTTP-verzoek met basisverificatie te verzenden, gebruik
je doorgaans de module `Net::HTTP` in Ruby. Hier is een snel voorbeeld.'
lastmod: '2024-03-13T22:44:51.337747-06:00'
mode... |
//你的笔记本键盘存在故障,每当你在上面输入字符 'i' 时,它会反转你所写的字符串。而输入其他字符则可以正常工作。
//
// 给你一个下标从 0 开始的字符串 s ,请你用故障键盘依次输入每个字符。
//
// 返回最终笔记本屏幕上输出的字符串。
//
//
//
// 示例 1:
//
// 输入:s = "string"
//输出:"rtsng"
//解释:
//输入第 1 个字符后,屏幕上的文本是:"s" 。
//输入第 2 个字符后,屏幕上的文本是:"st" 。
//输入第 3 个字符后,屏幕上的文本是:"str" 。
//因为第 4 个字符是 'i' ,屏幕上的文本被反转,变成 "rts" 。
//输入第 5... |
import type { ActionArgs, LoaderArgs } from "@remix-run/node";
import { json, redirect } from "@remix-run/node";
import { Form, useActionData, useLoaderData, useNavigation, isRouteErrorResponse, useRouteError, } from "@remix-run/react";
import invariant from "tiny-invariant";
import { createPost, updatePost, getPost } ... |
import { NextPage } from 'next'
import { ArrowPathIcon } from '@heroicons/react/24/outline'
import TwitterBox from './TwitterBox'
import { FeedProps, ITweet } from '../typings'
import Tweet from './Tweet'
import { fetchTweets } from '../utils/fetchTweets'
import { useState } from 'react'
import toast from 'react-hot-to... |
package com.example.productorder.order.controller;
import com.example.productorder.order.domain.*;
import com.example.productorder.order.helper.OrderHelper;
import com.example.productorder.order.service.OrderService;
import com.example.productorder.product.domain.Price;
import com.example.productorder.product.service.... |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
package com.game.framework.message;
import com.game.framework.threads.SimpleThreadFactory;
import com.game.framework.time.ITriggerTaskExecutor;
import com.game.framework.time.TriggerFuture;
import com.game.framework.time.impl.TriggerTaskExecutor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.ut... |
import type { FC } from "react";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";
import {
TableContainer,
Table,
Thead,
Tr,
Th,
Tbody,
Td,
Radio,
Link,
Tag,
} from "@chakra-ui/react";
import { GetServerSideProps } from "next/types";
import { QueryClient, dehydrate, useQ... |
import React, { useContext } from 'react';
import DarkModeOutlinedIcon from '@mui/icons-material/DarkModeOutlined';
import ExpandLess from '@mui/icons-material/ExpandLess';
import ExpandMore from '@mui/icons-material/ExpandMore';
import LightModeOutlinedIcon from '@mui/icons-material/LightModeOutlined';
import { Box, ... |
package com.example.flashlight
import android.hardware.camera2.CameraAccessException
import android.hardware.camera2.CameraManager
import android.os.Build
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.Button
import android.widget.Toast
import androidx.annotation.Require... |
from functools import partial
from typing import Iterable, List, Optional
import attrs
import pandas as pd
import spacy
from .base import Transformer
@attrs.define
class DummySentenceTokenizer(Transformer):
"""
Initialize Dummy Sentence Tokenizer.
Attributes
----------
input_column : str
... |
//{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function Template for C++
class Solution {
public:
bool is_palin(string &s){
// int a=0;
// for(int i=0;i<s.size();i++){
// a ^= (1<<s[i]-'a');
// }
// ... |
## DBsubject(Calculus - multivariable)
## DBchapter(Differentiation of multivariable functions)
## DBsection(Directional derivatives and the gradient)
## Institution(W.H.Freeman)
## Author(JustAsk - Vladimir Finkelshtein)
## MLT(DirDerivAtPt)
## Level(3)
## MO(1)
## TitleText1('Calculus: Early Transcendentals')
## Auth... |
<?php
class AdornEdgeSideAreaOpener extends AdornEdgeWidget {
public function __construct() {
parent::__construct(
'edge_side_area_opener',
esc_html__('Edge Side Area Opener', 'adorn'),
array( 'description' => esc_html__( 'Display a "hamburger" icon that opens the side area', ... |
# Send Get Requests
```javascript
import React, {useState} from 'react';
import MoviesList from './components/MoviesList';
import './App.css';
function App() {
const [movies, setMovies] = useState([]);
function fetchMoviesHandler () {
fetch('https://swapi.dev/api/films')
.then(response => {
r... |
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strmapi.c :+: :+: :+: ... |
import fs from 'fs';
// https://adventofcode.com/2021/day/17
interface Range { min: number, max: number }
interface Area { x: Range, y: Range }
export function load(filename: string) {
return fs.readFileSync(filename, { encoding: 'utf-8' })
.replace('target area:', '').trim().split(', ')
.reduce((out, li... |
<!--
// Copyright © 2020 Anticrm Platform Contributors.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
//
// Unless required by applicable l... |
int a = 1; //input, skal skrives manuelt da processing ikke har en inputfunktion
int x = 2;
int b = 3;
int y = 5;
int testX1; int testY1; //initierer to (x,y) koordinater til linjen der,
int testX2; int testY2; //skal gå fra venstre side af skærmen til højre
void setup() {
size(1000, 1000);
background(255, 1... |
/**
* refracta - 마이크로프로세서및실습 (CSE124-02)
* 과제 3 IR Sensor 소스 코드
*/
#include <IRremote.h>
#include <LiquidCrystal.h>
#define BUZZER_PIN 10
#define RECEIVE_PIN 7
#define LC_D0_PIN 5
#define LC_D1_PIN 4
#define LC_D2_PIN 3
#define LC_D3_PIN 2
#define LC_ENABLE_PIN 11
#define LC_RS_PIN 12
#define IR_CH_MINUS 0xFFA25D... |
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
use Tir\Crud\Support\Scaffold\BaseScaffold;
use Tir\C... |
#ifndef BINARYTREE_H_INCLUDED
#define BINARYTREE_H_INCLUDED
#include <algorithm>
#include <cmath>
template <typename T>
struct Node {
T data;
Node<T>* left;
Node<T>* right;
Node(T data) {
this->data = data;
this->left = nullptr;
this->right = nullptr;
}
};
template <typena... |
<template>
<div class="data-table">
<div class="card-deck d-block d-sm-none">
<div
v-for="notification in data.data"
:key="notification.id"
class="card"
>
<div class="card-body shadow">
<div class="d-flex align-items-center mb-3">
<notification-use... |
import React, {Component} from 'react';
import { Line } from 'react-chartjs'
import * as Kastra from '../../constants'
import { translate } from 'react-i18next';
import Pagination from '../common/pagination';
class Home extends Component {
constructor(props) {
super(props);
this.state = {
... |
const router = require('express').Router();
const { celebrate, Joi } = require('celebrate');
const { errors } = require('celebrate');
const {
getCards,
createCard,
deleteCardById,
likeCard,
dislikeCard,
} = require('../controllers/cards');
// возвращает все карточки
router.get('/cards', getCards);
// создаё... |
+++
title = "Quick Xamarin RE Guide"
date = "2023-08-30"
author = "Joan Calabrés"
description = "Get started with Xamarin reverse engineering with this quick guide."
+++
## What is Xamarin?
Xamarin is an open source platform used to compile modern applications with a great performance for iOS, Android and Window... |
<div class="flex flex-col justify-center items-center">
<div class="mt-2 bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded relative" role="alert" *ngIf="error">
<strong class="font-bold">Ops!</strong>
<span class="block sm:inline ml-1">Something seriously bad happened.</span>
... |
import { CARTA } from "carta-protobuf";
import { Client, AckStream, Usage, AppendTxt, EmptyTxt, Wait, Monitor } from "./CLIENT";
import * as Socket from "./SocketOperation";
import config from "./config.json";
let testServerUrl: string = config.localHost + ":" + config.port;
let testSubdirectory: string = config.path.... |
#include <stdio.h>
#include <stdlib.h>
#include <dirent.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#define STR_LEN 256
#define BUFF_READ_LEN 20
#ifndef MULTILIB_ASCII
#define MULTILIB_ASCII
static const int VOWELS[] = {97, 101, 105, 1... |
<?php
use App\Http\Controllers\AccessTokenController;
use App\Http\Resources\UserResource;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| API Routes
|----------------------------------------------... |
import Image from "next/image";
import { useCallback, useState } from "react";
import { useDropzone } from "react-dropzone";
import toast from "react-hot-toast";
interface ImageUploadProps {
onChange: (base64: string) => void;
label: string;
value?: string;
disabled?: boolean;
}
const ImageUpload: React.FC<Imag... |
import React from 'react';
import { getMergeSortAnimations, getQuickSortAnimations, getHeapSortAnimations, getBubbleSortAnimations } from '../sortingAlgorithms/sortingAlgorithms.js';
import './SortingVisualizer.css';
// Change this value for the speed of the animations.
const ANIMATION_SPEED_MS = 0.7;
// Change this ... |
import numpy as np
import pandas as pd
import os
from tqdm import tqdm
import matplotlib.pyplot as plt
# Base class
class Layer:
def __init__(self):
self.input = None
self.output = None
def forward_propagation(self, input):
raise NotImplementedError
def backward_propagation(self, ... |
import axios from 'axios';
import { logger } from '../logger';
import { generateFUBHeader } from './generate-fub-header';
export const getPersonIdByPhoneNumber = async (apiKey: string, phone: string, logPrefix: string): Promise<number> => {
const url = process.env.FUB_API_ENDPOINT + '/people?phone=' + phone;
t... |
import json, math
from collections import defaultdict, Counter, OrderedDict
import re
from itertools import chain
import multiprocessing
import json
from decimal import Decimal
import argparse
import os
import sys
class PMICalculator:
"""Code to read the SNLI corpus and calculate PMI association metrics on it.
... |
const CACHE_NAME = "version-1";
const urlsToCache = ["index.html", "public.html"];
const self = this;
// Install SW
self.addEventListener("install", (event) => {
event.waitUntil(
caches.open(CACHE_NAME).then((cache) => {
console.log("Opened cache");
return cache.addAll(urlsToCache);
})
);
});... |
// -- Interface --
interface Product {
readonly code: number
name: string
colour?: string
price: number
}
const product1: Product = {
code: 9001,
name: 'Summer Candy Skirt',
price: 1200
}
// -- Interface Method
interface Person {
name: string
age: number
info: () => void
}
const person1: Person... |
#include <glad/glad.h>
#include <glm/glm.hpp>
#include <glm/gtc/type_ptr.hpp>
#include <iostream>
#include <array>
#include <algorithm>
#include <numeric>
#include "shader.h"
Shader::Shader(const std::string& vertexShaderPath, const std::string fragmentShaderPath, const std::string& geometryShaderPath) {
createP... |
#ifndef SOFA_SpringInteractor_H
#define SOFA_SpringInteractor_H
#include <SofaSimpleGUI/config.h>
#include "Interactor.h"
#include <sofa/component/statecontainer/MechanicalObject.h>
#include <sofa/component/solidmechanics/spring/StiffSpringForceField.h>
#include <sofa/defaulttype/VecTypes.h>
namespace sofa{
namespac... |
package com.example.dinder;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.action.ViewActions.closeSoftKeyboard;
import static androidx.test.espresso.action.ViewActions.typeText;
import static androidx.test.espre... |
import { fetchDoctors } from "@/services/fetchDoctors"
import { useEffect, useState } from "react"
import { useDebounce } from "./useDebouncer"
export const useDoctors = () => {
const [doctors, setDoctors] = useState([])
const [inputValue, setInputValue] = useState('')
const [selectedSpecialty, setSelected... |
<?php
/**
* Copyright (C) 2024 Daniel Fernández Giménez <hola@danielfg.es>
*/
namespace FacturaScripts\Plugins\PortalCliente\Controller;
use FacturaScripts\Core\Base\DataBase\DataBaseWhere;
use FacturaScripts\Core\Cache;
use FacturaScripts\Core\Session;
use FacturaScripts\Core\Tools;
use FacturaScripts\Dinamic\Lib\... |
import { getCustomRepository, getRepository } from 'typeorm';
import AppError from '../errors/AppError';
import TransactionsRepository from '../repositories/TransactionsRepository';
import Transaction from '../models/Transaction';
import Category from '../models/Category';
interface Request {
title: string;
valu... |
#include <stdio.h>
#include "includes/debug.h"
#include "includes/chunk.h"
#include "includes/value.h"
void disassemble_chunk(Chunk* chunk, const char* name) {
printf("== %s ==\n", name);
// chunk_info(chunk, name);
for (int offset = 0; offset < chunk->count;) {
offset = disassemble_instruction(c... |
namespace BinaryTrees {
// binary_trees, from the Computer Language Benchmarks Game.
// http://benchmarksgame.alioth.debian.org/u64q/binarytrees-description.html#binarytrees
// This implementation is loosely based on:
// http://benchmarksgame.alioth.debian.org/u64q/program.php?test=binarytrees&lang=fs... |
//throttle 节流
function throttle(fn, interval, options = { leading: true, trailing: false }) {
//1.记录上一次的开始时间
const { leading, trailing } = options; //控制首次,尾次是否触发函数
let lastTime = 0;
//2.事件触发时,真正执行的函数
const _throttle = function () {
//2.1获取事件触发的当前时间
const nowTime = new Date().getTime();
if (!lastTime && !lea... |
//Copyright © 2023 Charles Kerr. All rights reserved.
import Foundation
/*
HueEntry
WORD ColorTable[32];
WORD TableStart;
WORD TableEnd;
CHAR Name[20];
HueGroup
DWORD Header;
HueEntry Entries[8];
*/
// HueEntry
struct HueEntry {
static public let RECORDSIZE = 88
public var colors = [UInt16]... |
// Задача: Создать и добавить стиль для элемента:
// Напишите функцию, которая создает новый элемент, добавляет его в DOM и устанавливает для него стиль с помощью CSS.
//создаем функцию, которая принимает в себя, тег элемента, содержимое объекта и объект стили
function createAndAddElement(tag, content, style) {
/... |
package com.sll.lib_framework.base.activity
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.viewmodel.CreationExtras
import androidx.viewbinding.ViewBinding
import com.sll.lib_framework.base.interfaces.IViewModel
import com.sll.lib_framework.ext.lazyNone
/**
... |
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or t... |
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\PendudukModel;
use App\Models\UmkmKategoriModel;
use App\Models\UmkmModel;
use App\Models\KategoriModel;
use Illuminate\Support\Facades\Validator;
use Illuminate\Http\Request;
class UmkmController extends Controller
{
... |
<?php
namespace App\Entity;
use App\Repository\OrganisationRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: OrganisationRepository::class)]
class Organisation implements \Stringable
{
#[ORM\Id]
... |
import { Message } from "discord.js";
import { stripIndents, oneLine } from "common-tags";
/// Detect direct links to trainer and show adjusted links.
export default async (message: Message) => {
const trainerLinks = message.content.match(PATTERN);
if (!trainerLinks) return false;
const links = trainerLinks.map... |
/*
* Copyright 2022 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applica... |
#include <stdio.h>
#include <stdlib.h>
#include <wiringPi.h>
#include <pthread.h>
#include <signal.h>
#include <unistd.h>
#include <string.h>
#include <time.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <stdbool.h>
#include "./include/tempos.h"
// Estrutura para guardar as pinagens... |
using Microsoft.AspNetCore.Mvc;
using Mvc.Application.Models;
using Mvc.Application.Repository;
namespace Mvc.Application.Controllers;
[Route("[controller]")]
public class ProductsController : Controller
{
private readonly IGenericRepository<Product> _repository;
public ProductsController(IGenericRepository<... |
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:glizit_app/features/screens/dashboard/view/video.dart';
import '../bloc/dashboard_bloc.dart';
import '../bloc/dashboard_event.dart';
import '../bloc/dashboard_state.dart';
class Dashboard extends StatefulWidget {
... |
<!--<br> <br> <br>
<div class="container">
<div class="row">
<h1> table des events </h1>
<table>
<thead>
<th>Groups Name</th>
<th>Groups Items</th>
</thead>
<tbody>
<tr *ngFor="let group of events">
<td>{{group.name}}</td>
<td>
<ul>
<li *ngFor="let item of group... |
/* eslint-disable react/prop-types */
import { useContext } from "react";
import TodoItem from "../TodoItem/TodoItem";
import { TodoContextObj } from "../../context/TodoContext";
const TodoList = () => {
const { todos, setTodos } = useContext(TodoContextObj);
const changeFinished = (todo, isCompleted) => {
co... |
"use client";
import Link from "next/link";
import { Button, Card } from "react-bootstrap";
import Image from "next/image";
import { auth, db } from "@/firebase/firebase";
import { collection, doc, getDoc, setDoc } from "firebase/firestore";
import { useRouter } from "next/navigation";
import React, { useEffect, useSta... |
const execute = require('./SIGN.runtime');
module.exports = {
name: 'SIGN',
category: 'Math',
title: 'Return sign of a number',
description: 'Returns -1 if the parameter is a negative number, 1 if it is positive, and 0 if it is zero. Returns `null` if it\'s not a number.',
parameters: [{
type: 'number',
... |
import { useState } from "react";
import { Question } from "../types/AppTypes";
import { useQuizContext } from "../hooks/useQuizContext";
import "./QuizQuestion.scss";
const mapper = ["A", "B", "C", "D"];
const QuizQuestion = ({
correctAnswer,
options,
type,
flagUrl,
countryCapital,
}: Question) =... |
// SpecializedListInterface.
//
// Interface for a class that implements a list of bytes
// There can be duplicate elements on the list
// The list has two special properties called the current forward position
// and the current backward position -- the positions of the next element
// to be accessed by getNextItem an... |
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
export interface DocumentsIndex {
'docs.count': string;
'docs.deleted': string;
health: 'green' | 'yellow';
index: string;
pri: string;
'pri.store.size': string;
rep: string;
status: 'open' | 'close';
'store.size': stri... |
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a co... |
package jsonschema_test
import (
"fmt"
"reflect"
"testing"
"time"
"github.com/DimmyJing/valise/jsonschema"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
//nolint:forcetypeassert
func TestValueToAny(t *testing.T) { //nolint:funlen
t.Parallel()
//nolint:tagliatelle
type testVa... |
<script lang="ts">
import DataTable, { Body, Cell, Head, Row } from "@smui/data-table";
import { onMount } from "svelte";
import type { Currency } from "../models";
import { apiUrl } from "./api";
let currencies: Currency[] = [];
onMount(async () => {
await getCurrencies();
});
const getCurrencie... |
/******************************************************************************
* Copyright (C) 2022 Xilinx, Inc. All rights reserved.
* Copyright (C) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
* SPDX-License-Identifier: MIT
*****************************************************************************... |
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Lesson 2.7</title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body>
<form>
<!-- label привязывается к инпуту через атрибут for="... |
#include <arcxx.hpp>
#include <iostream>
struct Goods : public arcxx::model<Goods> {
static constexpr auto table_name = "goods_table";
struct ID : public arcxx::attributes::integer<Goods, ID, std::size_t> {
using integer<Goods, ID, std::size_t>::integer;
static constexpr auto column_name = "id"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.