text stringlengths 184 4.48M |
|---|
import pygame as pg
from pygame import *
from OpenGL.GL import *
from OpenGL.GLU import *
import numpy as np
import random
from rectangle import RectangleMesh
from handle_json import write, clear_json
class App:
def __init__(self):
# initialize pygame for GUI
pg.init()
self.display = (51... |
//
// NSObject+LifecycleMonitor.swift
//
//
// Created by Maxim Aliev on 01.05.2024.
//
import UIKit
extension NSObject {
private static var _lifecycleMonitorKey: UInt8 = 21
private static let _monitoringDepth = 5
var monitor: ObjectLifecycleMonitor? {
get { getAssociatedObject(self, key: &... |
import React from 'react';
import { Link } from 'react-router-dom';
import { useSelector, useDispatch } from 'react-redux';
import { signOutUserStart } from './../../redux/User/user.actions';
import './styles.scss';
import Logo from './../../assets/logo.png';
const mapState = ({ user }) => ({
currentUser: user.cu... |
#ifndef AFORM_HPP
# define AFORM_HPP
# include <iostream>
# include <string>
#include "Bureaucrat.hpp"
// need to use forward declaration to solve the circular dependency issue.
class Bureaucrat;
class AForm
{
public:
// Constructors
AForm();
AForm(const AForm ©);
AForm(const std::string name, const int... |
//Assignment 1
#include <stdio.h>
int main()
{
int a,b;
printf("Enter the number: ");
scanf("%d %d",&a, &b);
// Increment and Decrement operator
printf("Pre Increment of a is %d\n", ++a); //Pre Increment of a
printf("a is %d\n", a);
printf("Post Increment of a is %d\n"... |
<?php
namespace App\Policies;
use App\Models\Clinic;
use App\Models\Admin;
use App\Models\Role;
use Illuminate\Auth\Access\HandlesAuthorization;
class ClinicPolicy
{
use HandlesAuthorization;
/**
* Determine whether the user can view any models.
*
* @param \App\Models\Admin $admin
* @r... |
import 'package:flutter/material.dart';
import 'package:todoapp_practice/util/my_button.dart';
class DialogBox extends StatelessWidget {
final controller;
final bool isEdit;
VoidCallback onSaved;
VoidCallback onCancel;
DialogBox(
{super.key,
required this.controller,
required this.onSaved,
... |
<template>
<div>
<app-loading></app-loading>
<div v-if="!loading">
<v-container grid-list-lg>
<v-layout row wrap>
<v-flex
xs12
sm6
md4
v-for="product in pro... |
#+ setup, echo=FALSE
library(tidytext)
library(tidyverse)
library(stringr)
library(knitr)
library(wordcloud)
library(ngram)
#' English Repository Files
blogs_file <- "../data/en_US/en_US.blogs.txt"
news_file <- "../data/en_US/en_US.news.txt"
twitter_file <- "../data/en_US/en_US.twitter.txt"
#' Rea... |
use utf8_slice;
fn slice_str_test() {
let s = "The 🚀 goes to the 🌑!";
let rocket = utf8_slice::slice(s, 4, 5);
// Will equal "🚀"
}
fn main() {
let my_name = "Pascal";
greet(my_name);
let s = String::from("hello world");
let word = first_word(&s); // 切片操作
// s.clear(); // let mut... |
import 'package:channel_sender_client/src/retry_timer.dart';
import 'package:logging/logging.dart';
import 'package:test/test.dart';
void main() {
group('Retry Timer tests', () {
Logger.root.level = Level.ALL;
Logger.root.onRecord.listen((record) {
print('${record.level.name}: ${record.time}: ${record.... |
#if os(OSX) || os(iOS) || os(tvOS) || os(watchOS)
import Foundation
#endif
public typealias ReconValue = Value
public enum Value: ArrayLiteralConvertible, StringLiteralConvertible, FloatLiteralConvertible, IntegerLiteralConvertible, BooleanLiteralConvertible, CustomStringConvertible, Comparable, Hashable {
case Rec... |
import { ReactNode, createContext, useEffect, useState } from "react"
import { api } from "../api/axios";
type Project = {
id: number;
name: string;
imageUrl: string;
description?: string;
githubUrl?: string;
projectUrl?: string;
}
interface ProjectsContextType {
projects: Project[]
}
in... |
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateScrewsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('screws', functio... |
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Vineyard Simulator</title>
<!--
<script src="https://unpkg.com/react@16.2.0/umd/react.production.min.js"></script>
<script src="https://unpkg.com/react-dom@16.2.0/umd/react-dom.production.min.js"></script>
<script src="https://unpkg... |
# S-Plus script developed by Professor Alexander McNeil, A.J.McNeil@hw.ac.uk
# R-version adapted by Scott Ulman (scottulman@hotmail.com)
# QRMlib 1.4.4
# This free script using QRMLib is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY ... |
import { useContext, useEffect, useState } from "react";
import { useParams } from "react-router-dom";
import { MdDeleteOutline } from "react-icons/md";
import { toast, ToastContainer } from "react-toastify";
import "react-toastify/dist/ReactToastify.css";
import { useApi } from "../Context/Context";
import { TableCont... |
# Create neural network class
import torch
import torch.nn as nn
class MyNet(nn.Module):
# define constructor
def __init__(self, input_size, hidden_size, output_size):
# call nn.Module constructor
super(MyNet, self).__init__()
# define input layer for getting inputs
self.input... |
import ReactDOM from 'react-dom/client'
import { createBrowserRouter, RouterProvider } from 'react-router-dom';
import 'bootstrap/dist/css/bootstrap.min.css';
import './index.css';
import App from './App';
import ErrorPage from './pages/ErrorPage.jsx';
import HomePageEng from './pages/English/HomePage.jsx';
import ... |
import typer
import requests
from rich import print
from typing import Any, List
from typing_extensions import Annotated
from decorators import retry
from utils import get_data, format_response
app = typer.Typer(
pretty_exceptions_enable=False,
pretty_exceptions_show_locals=False
)
@app.command()
@retry(r... |
# Simulate the thermal behaviour of the lecture theatre during normal occupied periods.
# The inside temperature will be always maintained within the given lower and upper setpoints.
library(reticulate)
use_virtualenv("./anaconda3/envs/python_venv")
OUTPUT_DIR = "./datasets/text_data/moving_window/without_stl_decomp... |
package main
import (
"fmt"
"math"
)
// Одне яблуко коштує 5.99 грн. Ціна однієї груші - 7 грн.
// Ми маємо 23 грн.
// 1. Скільки грошей треба витратити, щоб купити 9 яблук та 8 груш?
// 2. Скільки груш ми можемо купити?
// 3. Скільки яблук ми можемо купити?
// 4. Чи ми можемо купити 2 груші та 2 яблука?
//
// Зада... |
<!DOCTYPE html>
<html lang="en">
<head></head>
<body>
<pre>
combineAll
</pre>
<script src="/lib/Rx5.js"></script>
<script>
//emit every 1s, take 2
//map each emitted value from source to interval observable that takes 5 values
const source = Rx.Observable
.interval(1000)
.do((x)=>log(x, 'pink'))
... |
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ page import="java.util.List,br.com.alura.gerenciador.modelo.Empresa"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE hmt... |
#include <stdio.h>
#include <stdlib.h>
#include <dirent.h>
#include <sys/types.h>
#include <errno.h>
#include <sys/stat.h>
#include <stdbool.h>
// A HELPFUL PREPROCESSOR MACRO TO CHECK IF ALLOCATIONS WERE SUCCESSFUL
#define CHECK_ALLOC(p) if(p == NULL) { perror(__func__); exit(EXIT_FAILURE); }
// OUR SIMPLE LIST DA... |
/* eslint-disable react/prop-types */
import React from "react";
import { useLocation, useNavigate } from "react-router-dom";
import { toast } from "sonner";
import { toggleStoryBookmark, toggleStoryLike } from "../../../api/story.js";
import { AuthContext } from "../../../contexts/AuthContexts.jsx";
import { ModalCont... |
import {
Divider,
Drawer,
IconButton,
List,
ListItem,
ListItemIcon,
ListItemText,
Box,
Typography,
Tooltip,
Menu,
MenuItem,
Badge,
} from "@mui/material";
import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
import AddCircleOutlineIcon from "@mui/icons-material/AddCircleOutline";
imp... |
import React from 'react'
import { formatTime, transformDecimals } from '#helpers/transform'
import { useCity } from '#city/hook'
import { IconPlastic } from '#ui/icon/plastic'
import { IconMushroom } from '#ui/icon/mushroom'
import { ResourceItem } from '#ui/resource-item'
import { IconDuration } from '#ui/icon/durat... |
'''
Given a Tic-Tac-Toe board as a string array board, return true if and only if it is possible to reach this board position during the course of a valid tic-tac-toe game.
The board is a 3 x 3 array that consists of characters ' ', 'X', and 'O'. The ' ' character represents an empty square.
Here are the rules of Tic... |
import {Component, ElementRef, OnInit, ViewChild} from '@angular/core';
import {FormBuilder, FormControl, FormGroup, Validators} from "@angular/forms";
import {TeamModelForm} from "../../../core/forms/team/team-model-form";
import {FileInterface} from "../../../core/interfaces/file/file.interface";
import {FileService}... |
<?php
namespace core\lib\cloud;
use app\service\sys\ConfigService;
use app\service\core\niucloud\ConfigCloudService;
use Closure;
use core\exception\NiucloudException;
use core\lib\cloud\http\AccessToken;
use core\lib\cloud\http\HasHttpRequests;
use core\lib\cloud\http\Token;
use GuzzleHttp\Exception\GuzzleException... |
import { CoffeType } from "../types";
export default function Coffee ({ coffee }: { coffee: CoffeType }) {
const { image, popular, name, votes, rating, available, price } = coffee
return (
<div className="my-5 scale-90">
<div className="relative">
<img src={image} width={300} height={185} clas... |
#include <iostream>
using namespace std;
class Node {
public:
int data;
Node* left;
Node* right;
// cons
Node(int data) {
this -> data = data;
this -> right = NULL;
this -> left = NULL;
}
};
Node* createNode(int d) {
Node* temp = new Node(d);
return temp;
}... |
package ru.wardrobe.service;
import org.springframework.core.io.Resource;
import org.springframework.core.io.UrlResource;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.net.MalformedURLException;
import java.nio.file.Files;
impor... |
package com.sc.exam.sbb;
import com.sc.exam.sbb.answer.AnswerRepository;
import com.sc.exam.sbb.question.QuestionRepository;
import com.sc.exam.sbb.question.QuestionService;
import com.sc.exam.sbb.user.UserRepository;
import com.sc.exam.sbb.user.UserService;
import org.junit.jupiter.api.BeforeEach;
import org.junit.ju... |
# Hotel Revenue Data Analysis with Power BI
This Project shows a visual data story and dashboard created using **Power BI** to present hotel revenue insights to stakeholders. We'll address the following questions through our analysis:
## 1. Is Our Hotel Revenue Growing by Year?
We'll explore the overall trend in hote... |
import {
Body,
Controller,
Get,
HttpCode,
HttpStatus,
Post,
Request,
} from '@nestjs/common';
import { JwtService } from '@nestjs/jwt';
import { UserDTO } from '../users/user-dto';
import { UsersService } from '../users/users.service';
import { Public } from '../utils/public-decorator';
import { AuthServi... |
Testing ``7-base_geometry`` module
Testing ``BaseGeometry`` class
------------------------------
Importing ``BaseGeometry`` class from ``7-base_geometry`` module:
::
>>> BaseGeometry = __import__("7-base_geometry").BaseGeometry
Instantiate class:
::
>>> base_g = BaseGeometry()
Call area method with no argumen... |
use crate::common::day::{Day, Question};
pub struct Day1;
impl Day for Day1 {
fn question(&self, input: &str, question: Question) {
let result = match question {
Question::First => q1(input),
Question::Second => q2(input),
};
println!("{}", result);
}
fn te... |
---
title: Binary Search Tree 以及一道 LeetCode 题目
date: 2018-03-08 11:08:11
tag:
category: 开发
keywords: leetcode, leetcod 刷题
description: Binary Search Tree 以及一道 LeetCode 题目
---
### 一道LeetCode题目
今天刷一道LeetCode的题目,要求是这样的:
> Given a binary search tree and the lowest and highest boundaries as```L```and```R```, trim the tre... |
const router = require('express').Router();
const User = require('../Models/User');
// register new user
router.post('/users/register', async (req, res) => {
console.log(req.body);
const username = req.body.username ? req.body.username : '',
email = req.body.email ? req.body.email : '',
password = re... |
<?php
namespace Database\Seeders;
use App\Models\Category;
use Illuminate\Database\Seeder;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
class CategorySeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
// $categories = [
// ['name'... |
# frozen_string_literal: true
describe Inventory::Entry::Electronic do
let(:entry) do
create(
:electronic_entry,
mms_id: '9977047322103681',
portfolio_pid: '53496697910003681',
collection_id: '61496697940003681',
activation_status: Inventory::Constants::ELEC_AVAILABLE,
library... |
import React from "react";
class UserClassApiCall extends React.Component{
constructor(props){
super(props);
this.state = {
userInfo: {
name: "Dummy",
location: "Default",
},
};
}
async componentDidMount(){
//API call
... |
package service
import (
"genesis-currency-api/internal/model"
"genesis-currency-api/pkg/dto"
"genesis-currency-api/pkg/errors"
"gorm.io/gorm"
)
type UserService struct {
DB *gorm.DB
}
// NewUserService is a factory function for UserService
func NewUserService(db *gorm.DB) *UserService {
return &UserService{
... |
import React, { Component } from 'react';
import DialogActions from '@material-ui/core/DialogActions';
import DialogContent from '@material-ui/core/DialogContent';
import DialogContentText from '@material-ui/core/DialogContentText';
import DialogTitle from '@material-ui/core/DialogTitle';
import TextField from '@materi... |
package ru.stqa.geometry.figures;
public record Triangle(
double side1,
double side2,
double side3) {
public Triangle {
if (side1 < 0 || side2 < 0 || side3 < 0) {
throw new IllegalArgumentException("Triangle side should be non-negative");
}
if ((side1 +... |
/* Copyright 2019-2020 Centrality Investments Limited
*
* Licensed under the LGPL, Version 3.0 (the "License");
* you may not use this file except in compliance with the License.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS... |
<template>
<div>
<b-form-group>
<b-form-input id="filter-input" v-model="filter" type="search" placeholder="Search Alerts" />
</b-form-group>
<b-table
id="alerts-table"
sticky-header="600px"
hover
head-variant="light"
fo... |
import React, { useCallback, useEffect, useState } from 'react';
import * as S from './styles';
import close from 'assets/close.png';
import { useNavigation } from '@react-navigation/native';
import Input from 'components/Auth/Input';
import Button from 'components/Auth/Button';
import Toast from 'react-native-toast-me... |
package com.example.newsappforandroid.product.di
import android.content.Context
import androidx.room.Room
import com.example.newsappforandroid.product.init.database.dao.FavoritesDao
import com.example.newsappforandroid.product.constants.database.DatabaseConstants.NEWS_DATABASE
import com.example.newsappforandroid.prod... |
package com.github.marcustalbots.haven.dock;
import com.github.marcustalbots.haven.impl.vehicles.dock_vehicles.offloading_vehicles.Crane;
import com.github.marcustalbots.haven.impl.vehicles.dock_vehicles.offloading_vehicles.Pump;
import com.github.marcustalbots.haven.impl.vehicles.dock_vehicles.transport_vehicles.Cont... |
import { Box, IconButton, Paper, Slider, Stack, Typography } from "@mui/material";
import ShuffleIcon from '@mui/icons-material/Shuffle';
import SkipPreviousIcon from '@mui/icons-material/SkipPrevious';
import PlayCircleIcon from '@mui/icons-material/PlayCircle';
import SkipNextIcon from '@mui/icons-material/SkipNext';... |
//
// PillView.swift
// Crit
//
// Created by Ike Mattice on 3/19/22.
//
import SwiftUI
struct PillView: View {
@State var currentState: PillState
let text: String
var viewModel: PillViewModel {
currentState.viewModel
}
var body: some View {
BorderedText(
text,
... |
// Copyright 2022 Redpanda Data, Inc.
//
// Use of this software is governed by the Business Source License
// included in the file https://github.com/redpanda-data/redpanda/blob/dev/licenses/bsl.md
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this softwa... |
//
// MockAstronautService.swift
// SpaceLaunchTests
//
// Created by Sheethal Karkera on 19/1/22.
//
import Foundation
@testable import SpaceLaunch
class MockAstronautService: AstronautService {
var isSuccess = true
override func getAstronautList(completion: @escaping ([Astronaut]?, Error?) -> V... |
import {
ROLLS_RESULTS_FONTS,
NO_DICE_FOUND_ERROR,
USE_FATE_INSTEAD_ERROR,
DICE_TYPES_MAX,
SPECIAL_MAX_DICE_VALUE,
} from '../../defaults';
import { mapMaxValueToDice, mapRollToDice } from '../../services/dices.service';
import { DiceTypes } from '../../types';
describe('mapRollToDice', () => {
... |
//
// LoginView.swift
// EdvoraTaskMHamdino95
//
// Created by A One Way To Allah on 1/11/22.
//
import SwiftUI
struct LoginView: View {
//MARK: - Properities
@State var username: String = ""
@State var password: String = ""
@State var email: String = ""
@State var isAnimated: Bool = true... |
// useFileList.ts
import { useState } from 'react';
export const useFileList = () => {
const [listOfFiles, setListOfFiles] = useState<File[]>([]);
const addFile = (file: File) => {
if (listOfFiles.some(f => f.name === file.name)) {
return;
}
setListOfFiles([...listOfFiles, ... |
/* eslint-disable react/jsx-no-useless-fragment */
import { en, format } from "date-fns";
import MarkdownIt from "markdown-it";
import Image from "next/image";
import Link from "next/link";
import React, { useState } from "react";
import { SearchInput } from "@/widgets";
import styles from "./MainPost.module.scss";
... |
from django.db import models
from django.contrib.auth.models import User
class Testimonial(models.Model):
RATING_CHOICES = (
(1, '1 star'),
(2, '2 stars'),
(3, '3 stars'),
(4, '4 stars'),
(5, '5 stars'),
)
user = models.ForeignKey(User, on_delete=models.CASCADE)
... |
// Modules
import React, { FC, useEffect, useState } from 'react'
import { Image, StyleSheet, Text, View } from 'react-native'
import { ScrollView, TextInput } from 'react-native-gesture-handler'
import { ObjectId } from 'bson'
import Realm from 'realm'
// Components
import LowBar from '../components/containers/LowBar... |
import React, { useState, useEffect } from "react";
import { AiFillInstagram, AiOutlineTwitter } from "react-icons/ai";
const Footer = ({ pageContent }) => {
const [loading, setLoading] = useState(true);
const [footerContent, setFooterContent] = useState({});
useEffect(() => {
setFooterContent(pageContent);... |
package sh.java.exception;
import java.util.InputMismatchException;
import java.util.Scanner;
public class NumberGame {
public static void main(String[] args) {
new NumberGame().start();
}
/**
* 점수에 따라 실행할 게임을 분기처리하는 앱
* - 점수가 60점 이상이면 프리미엄 게임 시작
* - 점수가 60점 미만이면 그냥 그런 게임 시작
*/
private void start... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# PEP8:OK, LINT:OK, PY3:OK
# metadata
'''SyncthinGUI.'''
import os
import sys
import signal
import psutil
import time
from threading import Timer, Event, Lock
# imports
# from datetime import datetime
from ctypes import byref, cdll, create_string_buffer
from getopt impor... |
import React, { useEffect, useRef, useState } from 'react';
import styles from './StopWatch.module.css';
export default function StopWatch() {
const [time, setTime] = useState(650);
const interval = useRef(null);
useEffect(() => {
startClick();
}, []);
function changeSecondstoTime(sec) {
let resul... |
package com.sakura.user.controller;
import com.sakura.user.param.AdminUserRoleParam;
import com.sakura.user.service.AdminUserRoleService;
import lombok.extern.slf4j.Slf4j;
import com.sakura.common.base.BaseController;
import com.sakura.common.api.ApiResult;
import com.sakura.common.log.Module;
import com.sakura.common... |
const { Model, DataTypes } = require("sequelize");
const sequelize = require("../utils/sequelize");
class Card extends Model {}
Card.init(
{
id: {
type: DataTypes.INTEGER.UNSIGNED,
primaryKey: true,
autoIncrement: true,
},
user_id: {
type: DataTypes.INTEGER.UNSIGNED,
allowN... |
import { useContext } from "react";
import { useNavigate } from "react-router-dom";
import { CourseContext } from "../../contexts/course-context";
const Leftbar = () => {
const navigate = useNavigate();
const [, setCourseDetail] = useContext(CourseContext);
return (
<>
<div className="md:flex flex-col... |
import clr
import os
import math
# Import Revit API
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import FamilyLoadSettings, Color, FilteredElementCollector, BuiltInCategory, Transaction, ElementId, FamilySymbol, View, TextNoteType, BuiltInParameter, Family, IFamilyLoadOptions, XYZ, Line
# get the current docum... |
import React, { useContext, useState } from 'react';
import { Main, Scroll, Column, Label, Title, Row, Button, SubLabel } from '@theme/global';
import { ThemeContext } from 'styled-components/native';
import { MotiImage } from 'moti';
import { Dimensions, FlatList, TextInput } from 'react-native';
import { Search } fro... |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="index.css">
<script>
tailwind.config = {
theme: {
extend: {
... |
import threading
import time
import random
from queue import Queue
TAMANO_BUFFER = 5
buffer = Queue(maxsize=TAMANO_BUFFER)
def productor():
while True:
item = random.randint(1, 100)
buffer.put(item)
print(f"Productor produjo: {item}")
time.sleep(random.uniform(0.1, 0.5))
def cons... |
package ma.youcode.gathergrid.repositories;
import jakarta.enterprise.context.RequestScoped;
import jakarta.enterprise.inject.Model;
import jakarta.inject.Inject;
import jakarta.persistence.EntityManager;
import jakarta.persistence.EntityManagerFactory;
import jakarta.persistence.PersistenceContext;
import jakarta.per... |
package com.example.MyBoxYoonho;
import com.example.MyBoxYoonho.dao.UserDAO;
import com.example.MyBoxYoonho.domain.User;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.... |
import { Controller, Get, Request, BadRequestException, Post, Param, UseGuards, Delete, Body, } from '@nestjs/common';
import { ShoppingCartService } from './shopping-cart.service';
import { ShoppingCart } from './interfaces/shopping-cart.interface';
import { JwtService } from '@nestjs/jwt';
import { JwtAuthGuard } fr... |
const express = require('express');
const app = express();
const bodyParser = require('body-parser');
const env = require('dotenv');
const authRoutes = require('./src/routes/auth');
const userRoutes = require('./src/routes/user');
const categoryRoutes = require('./src/routes/category');
const productRoutes = require('.... |
#!/usr/bin/env python3
"""Typing more generalized inputs and output"""
from typing import Sequence, Any, Union
def safe_first_element(lst: Sequence[Any]) -> Union[Any, None]:
"""Returns the first element of a sequence.
Args:
lst: The list.
Returns:
The first element of the list. Othe... |
<div *ngIf="noHay" class="alert alert-danger" role="alert">
<div class="alert-items">
<div class="alert-item static">
<div class="alert-icon-wrapper">
<clr-icon class="alert-icon" shape="exclamation-circle"></clr-icon>
</div>
<span class="alert-text">
Esta liga no tiene equipos, ... |
import { createSlice, createAsyncThunk } from '@reduxjs/toolkit';
import axios from 'axios';
export const fetchOrders = createAsyncThunk(
'orders/fetchOrders',
async () => {
try {
const response = await axios.get(
'https://secondhandbookstoreapi.azurewebsites.net/api/Orders'
... |
// SQL "RDBMS"
// RDBMS -> 상용 S/W 활용
// RDS 서비스를 통해 RDBMS
// code level 에서 어떻게 SQL을 RDBMS
// RDBMS - SQLite, Postgresql, Oracle, MySQL
// code SQL 만들어 -> RDBMS
// code -> SQL " -> " RDBMS
// sqlite3
import sqlite3 from "sqlite3";
const { verbose } = sqlite3;
// DBMS - System -> S/W -> server -> 연결해야댐
const db = new (... |
@page "/product"
@inject IDialogService DialogService
@inject IProductService Service
@inject ISnackbar Snackbar;
@using RestClient.Components.Products
<PageTitle>Prodoct Management</PageTitle>
<h3>Product Management</h3>
<MudButtonGroup Class="mb-2">
<MudIconButton Icon="@Icons.Material.Rounded.Add" Color="Color... |
//
// HomeRepository.swift
// nextStep
//
// Created by 도학태 on 2023/09/23.
//
import Foundation
import RxSwift
import RxCocoa
final class HomeRepository: CommonRepositoryProtocol {
func getLayouts() -> Observable<[HomeLayoutStatus]> {
let willdInformationBetweenAttribute = HomeBetweenBannerAttribute.ge... |
import { motion } from 'framer-motion';
import { Link } from 'react-router-dom';
import { Helmet } from 'react-helmet';
import { useState,useEffect } from 'react';
import Axios from 'axios';
import LogoutModal from '../../modals/LogoutModal';
import BikePagination from '../paginations/BikePagination';
const Bicycles =... |
"""
URL configuration for reez project.
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/4.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
... |
import 'package:firebase_database/firebase_database.dart';
import 'package:flutter/material.dart';
import 'package:flutter_typeahead/flutter_typeahead.dart';
import 'package:forus/model/identification_system.dart';
class CreateChat extends StatefulWidget {
final String groupName;
final String groupId;
const Cre... |
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Transactions;
using Qtc.Branch.BusinessEntities;
using Qtc.Branch.Dal;
using Qtc.Branch.Validation;
using Qtc.Branch.Audit;
namespace Qtc.Branch.Bll
{
[DataObjectAttribute()]
public static class RepairDetailM... |
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { Furniture } from '../models/furniture.model';
const URL = 'http://localhost:8080/api/furnitures';
@Injectable({
providedIn: 'root'
})
export class FurnitureService {
constru... |
import { createReducer, Action, AnyAction, combineReducers } from "@rbxts/rodux";
import { assign, copy as shallowCopy } from "@rbxts/object-utils";
import { intialPlacementSettings } from "template/client/intialState";
import * as Functionalities from "template/shared/Functionalities";
import { PlacementSettings } fro... |
/*
* @author Haoze Wu <haoze@jhu.edu>
*
* The Legolas Project
*
* Copyright (c) 2024, University of Michigan, EECS, OrderLab.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtai... |
import styled from 'styled-components';
const Container = styled.div`
position: relative;
`;
const Label = styled.label`
display: block;
font-size: 1.28rem;
color: ${({ theme }) => theme.colors.light};
font-weight: 600;
margin-bottom: ${({ theme }) => theme.spacing.sm};
`;
const StyledTextArea = styled.t... |
// const persona = {
// nombre: 'emanuel',
// edad: 20,
// }
// let texto = 'hola mundo';
// texto = 2
// texto.concat('hla')
// console.log(texto)
// ignora el typado en javascript
// let str:any = 'hola mundo'
// que nosabes cuales es el tipo
// let str2:unknown = 'hola mundo'
// inferencia
// comoa a ... |
package week2;
public class Person {
public String name;
public int phoneNumber;
public String address;
public Person() {
this.name = null;
this.phoneNumber = 0;
this.address = null;
}
public Person(String name) {
this.name = name;
}
public Person(String name, String address) {
this.name = na... |
import {BitMask, BN, getBytesCount, trim0x} from '@1inch/byte-utils'
import {Extension} from './extension'
import {Interaction} from './interaction'
import {Address} from '../address'
import {ZX} from '../constants'
export enum AmountMode {
/**
* Amount provided to fill function treated as `takingAmount` and ... |
import { InstrumentStatus, Share } from "invest-nodejs-grpc-sdk/dist/generated/instruments";
import logger from "./logger";
import { InvestSdk } from "./types";
class InstrumentsService {
private readonly client: InvestSdk;
constructor(client: InvestSdk) {
if (!client) throw new Error('client is required');
... |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>绑定Value</title>
<meta name="description" content="">
<meta name="keywords" content="">
<link href="" rel="stylesheet">
</head>
... |
package dao;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import domain.Dept;
//sql을 실행할수있게 기능들을 만들어 놓은 클래스가 DAO이다.
public class DeptDao {
// DAO: sql을 실행하는 ... |
#include<bits/stdc++.h>
using namespace std;
const int N = 1e3+5;
vector<int> adj[N];
bool visited[N];
int level[N];
int parent[N];
void bfs (int u) { // (Time complexity - O(2e)) e = Edge
queue<int> q;
q.push(u);
visited[u] = true;
level[u] = 0;
parent[u] = -1;
while (!q.empty()) {
... |
App = {
web3Provider: null,
contracts: {},
account: "0x0",
hasVoted: false,
init: function () {
return App.initWeb3();
},
// connect out client-side application to our local blockchain
initWeb3: function () {
console.log(window);
// web3 == window.web3
if (typeof web3 !== "undefined") ... |
package be.intecbrussel.testy.model.dto.create;
import be.intecbrussel.testy.model.EntityMapper;
import be.intecbrussel.testy.model.entity.ExamEntity;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.time.Instant;
import java.util.Objects;
import static java.util.Objects.hash;
import static ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.