language stringclasses 15
values | src_encoding stringclasses 34
values | length_bytes int64 6 7.85M | score float64 1.5 5.69 | int_score int64 2 5 | detected_licenses listlengths 0 160 | license_type stringclasses 2
values | text stringlengths 9 7.85M |
|---|---|---|---|---|---|---|---|
Java | UTF-8 | 3,836 | 2.296875 | 2 | [] | no_license | package demo.face.plus.faceplus.service.serviceImpl;
import com.mongodb.client.result.UpdateResult;
import demo.face.plus.faceplus.entity.*;
import demo.face.plus.faceplus.repository.UserFaceInfoRepository;
import demo.face.plus.faceplus.service.FacesetInfoService;
import demo.face.plus.faceplus.service.UserFaceInfoSe... |
C++ | GB18030 | 4,800 | 2.65625 | 3 | [] | no_license | #include "stdafx.h"
#include"filefunc.h"
int strsplinum(char *str, const char*del)
{
char *first = NULL;
char *second = NULL;
int num = 0;
first = strstr(str, del);
while (first != NULL)
{
second = first + 1;
num++;
first = strstr(second, del);
}
return num;
}
void split_del(char **arr, char *str, const... |
JavaScript | UTF-8 | 6,999 | 2.984375 | 3 | [] | no_license | define( [
"../core",
"../core/camelCase",
"../var/rnothtmlwhite",
"./var/acceptData"
], function( jQuery, camelCase, rnothtmlwhite, acceptData ) {
"use strict";
// require core.js 获得 jQuery
// require core/camelCase.js 获得 camelCase 方法 是将于将css前缀转换成驼峰形式的
// require var/rnothtmlwhite.js 获得 正则表达式
// require ./var... |
Markdown | UTF-8 | 781 | 2.78125 | 3 | [] | no_license | # elms-frontend
## Front end for the [elms](https://github.com/wangonya/elms.git) api
Simple leave management system.
A user should be able to
* [x] register & login to the system
* [ ] see eligibility details (like how many days of leave he/she is eligible for etc)
* [x] see leave history
* [ ] apply for leave, spe... |
C | UTF-8 | 6,251 | 2.921875 | 3 | [] | no_license | #include "database.h"
#include "common.h"
#include "csv.h"
#include "event.h"
void database_init(Database *db)
{
db->modified = false;
db->count = 0;
db->events = NULL;
}
void database_destroy(Database *db)
{
for (unsigned i = 0; i < db->count; i++) {
event_destroy(&db->events[i]);
}
... |
PHP | UTF-8 | 3,318 | 2.984375 | 3 | [] | no_license | <?php
Class Jugador_Model extends Models{
public function __construct()
{
parent::__construct();
}
/* Inserta un jugador en la BD */
public function guardarJugador($datos){
//Consulto existencia
$consultaExistenciaJugador = $this->db->select("SELECT * FROM jugador "
... |
Java | UTF-8 | 1,007 | 4.03125 | 4 | [] | no_license | package java_solutions;
import tools.MyStopwatch;
public class p006 {
public static void main(String[] args) {
MyStopwatch sw = new MyStopwatch().start();
System.out.println("The difference between the sum of the squares of the " +
"first one hundred natural numbers and the square of the sum is " +
... |
Python | UTF-8 | 1,014 | 2.859375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8
import zipfile
import os
class ziputilities(object):
def tozip(self, file, filename):
zip_file = zipfile.ZipFile(filename, 'a')
if os.path.isfile(file):
zip_file.write(file)
else:
self.addfoldertozip(zip_file, file)
... |
Markdown | UTF-8 | 1,399 | 2.640625 | 3 | [] | no_license | # Resources
#### Scrapers:
[Newspaper: Article Scraping and Curation](https://www.gitbook.com/book/tristanburke/bias-scraper/edit#)
[Grepsr: General Web Scraping](https://www.grepsr.com/)
#### News API's:
[News API: Free JSON API providing metadata, descriptions, links, and images for news articles from over 70 so... |
PHP | UTF-8 | 4,939 | 2.96875 | 3 | [] | no_license | <?php
if (session_status()==PHP_SESSION_NONE)
session_start();
$textArray;
include_once "config.php";
include_once "generic.php";
include_once "langfunc.php";
if (file_exists(TEXTFILE))
{
//to put it all in a nice array
$textArray = xmlToArray(TEXTFILE);
}
else
{
//hope this never happens?
echo "<!DOCTYPE htm... |
Java | UTF-8 | 1,297 | 2.09375 | 2 | [] | no_license | package com.aadu_maadu_kozhi.gregantech.adapter;
import androidx.databinding.DataBindingUtil;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import com.aadu_maadu_kozhi.gregantech.R;
import com.aadu_maadu_kozhi.gregantech.adapter.listener.BaseRecyclerAdapterListener;
import com.aadu_maadu_kozhi.gr... |
Python | UTF-8 | 379 | 3.96875 | 4 | [] | no_license | import random
n = random.randint(0,100)
tries = 10
while(tries > 0):
user_ip = int(input(str('Guess the number : ')))
if( n > user_ip):
print("Number is greater than ",user_ip)
elif( n < user_ip):
print("Number is lesser than ",user_ip)
elif( n == user_ip):
print("Number matche... |
Swift | UTF-8 | 3,220 | 3.015625 | 3 | [] | no_license | //
// Post.swift
// Continuum
//
// Created by DevMountain on 9/17/18.
// Copyright © 2018 trevorAdcock. All rights reserved.
//
import UIKit
import CloudKit
class Post{
let recordTypeKey = "Post"
fileprivate let captionKey = "caption"
fileprivate let timestampKey = "timestamp"
fileprivate le... |
JavaScript | UTF-8 | 195 | 3.640625 | 4 | [] | no_license | function sumFirstLast(numbers) {
let firstElement = Number(numbers[0]);
let lastElement = Number(numbers.pop());
let result = firstElement + lastElement;
console.log(result);
}
|
Java | ISO-8859-1 | 1,474 | 3.03125 | 3 | [] | no_license | /*Classe responsvel por controlar a tela de login e seus mtodos*/
package br.com.cityshare.controller;
import javax.swing.JOptionPane;
import br.com.cityshare.dao.FuncionarioDao;
import br.com.cityshare.view.LoginView;
import br.com.cityshare.view.PrincipalView;
public class LoginController {
LoginView telaLogin;
... |
C++ | UTF-8 | 1,384 | 3.8125 | 4 | [] | no_license | /*
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and put.
get(key) - Get the value (will always be positive) of the key if the key exists in the cache, otherwise return -1.
put(key, value) - Set or insert the value if the key is not already p... |
PHP | UTF-8 | 468 | 3.1875 | 3 | [] | no_license | <!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Exo 5</title>
</head>
<body>
<div>
## Exercice 5
**En allant** de 1 à 15 avec un pas de 1, afficher le message **On y arrive presque**.
</di... |
Rust | UTF-8 | 743 | 2.890625 | 3 | [
"MIT"
] | permissive | #![deny(warnings)]
use std::net::SocketAddr;
use warp::Filter;
/// Create a server that requires header conditions:
///
/// - `Host` is a `SocketAddr`
/// - `Accept` is exactly `*/*`
///
/// If these conditions don't match, a 404 is returned.
#[tokio::main]
async fn main() {
pretty_env_logger::init();
// For ... |
Shell | UTF-8 | 107 | 2.671875 | 3 | [] | no_license | #!/bin/bash
for pid in $(ps -aux | grep "node index.js" | awk '{ print $2 }');
do
sudo kill $pid
done
|
C++ | UTF-8 | 1,798 | 2.859375 | 3 | [] | no_license | /* LevelClass.H ::: Luke Harper */
#ifndef LEVELCLASS_H
#define LEVELCLASS_H
#include "worldDefs.h"
#include "gameobject.h"
#include "floorobject.h"
#include "wallobject.h"
#include "gamemodel.h"
#include "LightObject.h"
#include "LockObject.h"
#include "DoorObject.h"
#include "enemyobject.h"
#include "arraylist.h"
... |
Markdown | UTF-8 | 974 | 2.828125 | 3 | [] | no_license | # README #
Project Name: food you miss
url: foodyoumiss.com
In the root directory, the index.html and index.js are the entrance point of the front-end.
the main content of the web app is in the "app" folder.
the main content of android and ios app are in the "android" and "ios" folder respectively
### How to setup... |
Python | UTF-8 | 554 | 3.6875 | 4 | [] | no_license | #!/usr/bin/env python
#-*- coding: utf-8 -*-
def sifre(kelime):
#verilen kelimeyi rot13 e göre şifreler.
for i in kelime:
a=ord(i)
if 65<=a<78 or 97<=a<110:
b=chr(a+13)
print b
else:
b=chr(a-13)
print b
def sifresiz(kelime):
#şifrelen... |
Java | UTF-8 | 595 | 3.171875 | 3 | [] | no_license | package LinkedList;
public class RotateList {
public Node rotateRight(Node head, int n) {
if(head == null || head.next == null) {
return head;
}
Node dummy = new Node(0);
dummy.next = head;
Node fast = dummy;
Node slow = dummy;
int i;
f... |
C++ | UTF-8 | 1,306 | 2.59375 | 3 | [] | no_license | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Coord.class.hpp :+: :+: :+: ... |
Markdown | UTF-8 | 952 | 3.609375 | 4 | [] | no_license | ---
title: 로또번호 생성기(Random 사용)
keywords: 로또번호 생성기(Random 사용)
last_updated:
tags:
summary: "로또번호 생성기(Random 사용) 설명"
sidebar: mydoc_sidebar
permalink: java_code_lotto.html
folder: java_code
---
### 로또번호 생성기
랜덤값을 사용한 로또번호 생성기 연습
```java
/**
* 로또번호 생성기
* 랜덤으로 번호 받아올때 중복된 값이있을 수 있으므로 중복체크 필요함
* @return
*/
public int[... |
Java | UTF-8 | 3,337 | 2.171875 | 2 | [] | no_license | package am.rate.ui.fragments.bankDetails.viewModel;
import android.app.Application;
import com.dm.dmnetworking.DMNetworkLiveDataBag;
import com.dm.dmnetworking.model.error.ErrorE;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
import am.rate.applicatio... |
C | UTF-8 | 1,570 | 3.796875 | 4 | [] | no_license | #include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <string.h>
void encrypt(char *key, char *text, size_t size);
void decrypt(char *key, char *text, size_t size);
void print_value(char *value, size_t size)
{
size_t index;
index = 0;
while (index < size)
{
printf("%02x", (unsigned char)value[index... |
JavaScript | UTF-8 | 751 | 3.265625 | 3 | [] | no_license | var dog, dog_img1, dog_img2;
var food;
var milk, milk_img;
function preload() {
dog_img1 = loadImage("virtual pet images/Lazy.png");
dog_img2 = loadImage("images/dogImg1.png");
milk_img = loadImage("virtual pet images/milk.png");
}
function setup() {
createCanvas(800, 700);
dog = createSprite(650,400,20,20)... |
Java | UTF-8 | 1,278 | 2.28125 | 2 | [] | no_license | package pages.hotel;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import pages.PageBase;
public class NewAddressPage extends PageBase {
@FindBy(id = "address1")
private WebElement addressInput;
@FindBy(id = "postcode")
privat... |
Java | UTF-8 | 2,809 | 3.328125 | 3 | [] | no_license | public class RangeModule {
private Segment top_interval;
class Segment {
int left;
int right;
Segment left_child;
Segment right_child;
boolean covered = false;
Segment() {
left_child = null;
right_child = null;
}
void add... |
Ruby | UTF-8 | 1,131 | 4.09375 | 4 | [] | no_license | def convert_to_euros(usd)
usd * 0.95 if usd.is_a?(Numeric)
end
def convert_to_pesos(usd)
usd * 20.67 if usd.is_a?(Numeric)
end
def convert_to_rupees(usd)
usd * 68.13 if usd.is_a?(Numeric)
end
p convert_to_euros(1000)
p convert_to_pesos(1000)
p convert_to_rupees(1000)
def convert_one(usd, currency, rate)
yie... |
JavaScript | UTF-8 | 4,548 | 2.578125 | 3 | [] | no_license | // 后台主页 动态加载左侧菜单
var paras = [];
var values = [];
layui.use('form',function () {
var form=layui.form;
form.verify({
username: function(value, item){ //value:表单的值、item:表单的DOM对象
if(!new RegExp("^[a-zA-Z0-9_\u4e00-\u9fa5\\s·]+$").test(value)){
retur... |
Go | UTF-8 | 1,313 | 2.734375 | 3 | [] | no_license | package main
import (
"context"
"fmt"
"go.etcd.io/etcd/clientv3"
"llvvlv00.org/logagent/utils"
"time"
)
// etcd 使用put命令设置键值对数据,get命令用来根据key获取值
func main(){
cli, err := clientv3.New(clientv3.Config{
Endpoints: []string{"192.168.10.10:2379"},
Username:"test",
Password:"123456",
DialTimeout: 5 * time.Second... |
JavaScript | UTF-8 | 333 | 3.015625 | 3 | [] | no_license | function end(str, target) {
// "Never give up and good luck will find you."
// -- Falcor
if(str.substr(-1,1) === target.substr(-1,1)) {
return true;
} else {
return false;
}
console.log(end);
}
end('Walking on water and developing software from a specification are easy if both are frozen', 'spe... |
Python | UTF-8 | 637 | 2.734375 | 3 | [] | no_license | from __future__ import division
import cv2 as cv
import time
#import numpy
#read the image
img = cv.imread('coder.jpg', 0)
#do the processing
#display on screen
screen_res = 1280, 720
scale_width = screen_res[0] / img.shape[1]
scale_height = screen_res[1] / img.shape[0]
scale = min(scale_width, scale_height)
window... |
JavaScript | UTF-8 | 2,567 | 2.734375 | 3 | [] | no_license | #! /usr/bin/env node
var shell = require('shelljs');
var p = require('path');
var fs = require('fs');
var args = process.argv.slice(2);
// Default configuration to generate files
var generatorConfig = {
c: {
files: [
{
suffix: 'component',
ext: 'ts',
template: p.join(__dirname, '..... |
JavaScript | UTF-8 | 1,650 | 2.515625 | 3 | [
"MIT"
] | permissive | let token = localStorage.getItem("token")
let qus = document.getElementById('qus');
let opsa = document.getElementById('opsa');
let opsb = document.getElementById('opsb');
let opsc = document.getElementById('opsc');
let opsd = document.getElementById('opsd');
let curans = document.getElementById('curans');
let quizna... |
Python | UTF-8 | 716 | 2.625 | 3 | [
"MIT"
] | permissive | from pathlib import Path
import json
voice_dir = Path("voice")
config_dir = Path("config")
dir_dict = dict(enumerate(voice_dir.iterdir()))
SUFFIX = [".mp3", ".wav"]
for k, v in dir_dict.items():
print(f"index:{k} [{v}]")
idx = int(input("index:"))
year = input("year:")
month = input("month:")
choice_dir = dir_d... |
JavaScript | UTF-8 | 5,881 | 2.921875 | 3 | [] | no_license | var ws = new WebSocket('ws://localhost:7777');
var windowWidth = window.innerWidth;
var windowHeight = window.innerHeight;
var xCenter = windowWidth / 2;
var yCenter = windowHeight / 2;
var eyeOuterDiameter = Math.min(windowWidth, windowHeight);
var xEyeTranslate = (windowWidth - eyeOuterDiameter) / 2;
var yEyeTransla... |
Java | UTF-8 | 317 | 1.859375 | 2 | [] | no_license | package ua.com.spiritus.repositories;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import ua.com.spiritus.models.User;
@Repository
public interface UserRepository extends CrudRepository<User, Integer>{
User findBylogin(String login);
}
|
Python | UTF-8 | 5,276 | 2.84375 | 3 | [] | no_license | from typing import List, Dict, NamedTuple, Tuple, Iterator
import math
from collections import defaultdict
class Asteroid(NamedTuple):
x: int
y: int
Asteroids = List[Asteroid]
def parse(raw: str) -> Asteroids:
return [
Asteroid(x, y)
for y, line in enumerate(raw.strip().split("\n"))
... |
Markdown | UTF-8 | 1,418 | 3.046875 | 3 | [] | no_license | # 有序性
Java内存模型中,允许编译器和处理器对指令进行重排序,但是重排序过程不会影响到单线程程序的执行,却会影响到多线程并发执行的正确性
volatile、synchronized、Lock
## 有序性-happens-before原则
如果两个操作的执行顺序不能从happens-before原则推导出来,则不能保证操作的执行顺序,虚拟机可以随意的对操作进行重排序
* 程序次序规则 : 一个线程内,按照代码顺序,书写在前面的操作现行发生于书写在后面的操作
* 锁定规则 : 一个unLock操作先行发生于后面对同一个锁的lock操作
* volatile变量规则 : 对一个变量的写操作先行发生于后面对这个变量的... |
Java | UTF-8 | 592 | 2.359375 | 2 | [] | no_license | package hibernate;
/**
* Customer entity. @author MyEclipse Persistence Tools
*/
public class Customer extends AbstractCustomer implements java.io.Serializable {
// Constructors
/** default constructor */
public Customer() {
}
/** minimal constructor */
public Customer(String customerId) {
super(customerId... |
Python | UTF-8 | 4,035 | 3.078125 | 3 | [] | no_license | import numpy as np
import pickle
class Tree:
def __init__(self):
self.left = {}
self.right = {}
self.feature = None
self.feature_value = None
self.isTerminal = False
self.label = 0
self.feature_count = 0
class DecisionTree:
def __init__(self, max_depth=5, minimum_num_leaves=10):
self.max_depth = m... |
Python | UTF-8 | 8,934 | 3.515625 | 4 | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause"
] | permissive | """Interfaces to SDP solvers"""
from sympy import Basic, ordered, sympify, BlockDiagMatrix
from .lm import lin_expr_coeffs, lm_sym_to_coeffs
from .lmi import LMI
class NotAvailableError(Exception):
def __init__(self, function_name):
msg = 'Function %s not available since cvxopt package '\
... |
C++ | UTF-8 | 373 | 3.484375 | 3 | [] | no_license | #include<iostream>
#include<vector>
using namespace std;
int maxProfit(vector<int>&prices)
{
int sum = 0;
if (prices.size() < 2)
return sum;
for (int i = prices.size() - 1; i >0 ; i--)
{
if (prices[i-1] < prices[i])
{
sum += prices[i] - prices[i-1];
}
}
return sum;
}
int main()
{
vector<int> vec = ... |
C | UTF-8 | 10,461 | 2.8125 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <lwasm.h>
#include <math.h>
#include <parse.h>
#include "tokenfinder/tokenfinder.h"
static const TokenFinder* tokenFinders = NULL;
static unsigned int numTokenFinders = 0;
CharType getCharType(char input) {
if (input >= '0' && input <= '9') {
... |
Shell | UTF-8 | 524 | 2.90625 | 3 | [] | no_license | # Config Command
#
# Config main page
enrol.config() {
echo "Enrol config command"
echo "Type enrol.config + TAB to see your available commands."
echo "Those will make the configuration of enrol easier."
}
# Config global setting in nano (command line)
enrol.config.global() {
eval nano ~/.oh-my-zsh/plugins/enrolz... |
Java | UTF-8 | 938 | 3.328125 | 3 | [] | no_license | import java.math.BigInteger;
import java.util.Arrays;
public class Cheatsheet {
static boolean isPowerOfTwo(int x) {
return x != 0 && ((x & (x - 1)) == 0);
}
public static int gcd(int a, int b) {
BigInteger b1 = BigInteger.valueOf(a);
BigInteger b2 = BigInteger.valueOf(b);
... |
Java | UTF-8 | 762 | 2.328125 | 2 | [] | no_license | package csd.chennai;
import junit.framework.TestCase;
import cucumber.api.PendingException;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
public class RPNRegressionTest extends TestCase{
String input;
@Given("^user enter \"([^\"]*)\"$")
public void user_enter(String arg1) throws Th... |
C++ | UTF-8 | 25,627 | 3.015625 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <iomanip>
#include <vector>
#include <sstream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <math.h>
#include <ctime>
void board_check2( std::vector<std::vector<char> > ship_table, int ship_max_val, //main recursion fun... |
Swift | UTF-8 | 1,680 | 2.5625 | 3 | [] | no_license | //
// CarListingViewModel.swift
// CarFax
//
// Created by Harsh_Dev on 2020-09-17.
// Copyright © 2020 Pineapple Inc. All rights reserved.
//
import Foundation
import UIKit
import Alamofire
public class CarListingViewModel{
//MARK: Model Object
var listing: [Listing] = []
//MARK: Call API T... |
Java | UTF-8 | 235 | 1.890625 | 2 | [] | no_license | package org.example.logdesign.v1;
import org.apache.log4j.Logger;
public class Log4jTest {
public static void main(String[] args) {
Logger logger = Logger.getLogger(Log4jTest.class);
logger.debug("hello");
}
}
|
C | UTF-8 | 1,735 | 2.84375 | 3 | [] | no_license | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* list_frac.c :+: :+: :+: ... |
C# | UTF-8 | 1,527 | 2.78125 | 3 | [] | no_license | using System;
using System.Collections.Generic;
namespace Leaf.Data.Configuration
{
public class DatabaseInformationOptions : Dictionary<string, string>
{
private const string NamePropertyName = "name";
private const string DatabaseTypePropertyName = "type";
private const string StoreT... |
Markdown | UTF-8 | 4,887 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive | ### IFileSystemFileAttribute
<details>
<summary><b>IFileSystemFileAttribute</b> is interface for setting file attributes. (<u>Click here</u>)</summary>
```csharp
/// <summary>
/// File system that set file attribute.
/// </summary>
public interface IFileSystemFileAttribute : IFileSystem, IFileAttributeOption
{
//... |
Java | UTF-8 | 1,088 | 2.90625 | 3 | [] | no_license | import java.io.File;
import java.util.Random;
public class Main
{
public static void main(String[]args)
{
File folder1 = new File("D:\\ibtd\\Original");
File folder2 = new File("D:\\ibtd\\Mask");
File[] files1=folder1.listFiles();
File[] files2=folder2.listFiles();
Image[]im... |
TypeScript | UTF-8 | 1,299 | 2.734375 | 3 | [] | no_license | import { DetailFactory } from './detail.factory';
import { DefinitionFactory } from './definition.factory';
import { ProblemDetail } from '../models/problem-detail';
describe('DetailFactory', () => {
let detailFactory: DetailFactory;
beforeEach(() => {
const definitionFactory = new DefinitionFactory();
de... |
SQL | UTF-8 | 1,919 | 2.65625 | 3 | [] | no_license | INSERT INTO dqa_database_log VALUES (NULL, NOW(), '1.05', 'Starting upgrade process');
INSERT INTO dqa_database_log VALUES (NULL, NOW(), '1.05', 'Creating dqa_remote_connection table');
CREATE TABLE dqa_remote_connection
(
connection_id INTEGER NOT NULL IDENTITY,
connection_code VARCHAR(128) NOT NU... |
JavaScript | UTF-8 | 1,027 | 3.078125 | 3 | [] | no_license | let levys = [];
let levyLimit = 13;
let levyCount = 0;
function levySetup() {
let a = createVector(dims/3 + dims/11, dims/2);
let b = createVector(dims*2/3 - dims/11, dims/2);
let d1 = new Levy(a, b);
levys.push(d1);
d1.show();
}
function levyPressed() {
if (levyCount < levyLimit) {
let nextGeneration... |
Java | UTF-8 | 612 | 2.421875 | 2 | [] | no_license | package api.service.fizzbuzz;
import org.junit.Test;
import static java.util.Arrays.asList;
import static java.util.Collections.emptyList;
import static org.junit.Assert.assertEquals;
public class FizzBuzzConverterTest {
private final FizzBuzzConverter converter = new FizzBuzzConverter();
@Test
public v... |
Python | UTF-8 | 1,403 | 3.4375 | 3 | [] | no_license | n = int(input())
ways = [-1 for i in range(n+1)]
# first index represents 'start' point,
# second index represents 'end' point to which there
# is a direct slide from the 'start' point
# Ex. paths[4][7] : the direct slide from point 4 to point 7
# if paths[4] == [7,3,5] , there are direct slides from point ... |
C# | UTF-8 | 1,241 | 3 | 3 | [
"MIT"
] | permissive | // Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using System;
using System.IO;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
namespace IOSimulator
{
static class exiting
{
// see https://stackoverflow.com/questions/943... |
C++ | UTF-8 | 8,310 | 3.84375 | 4 | [] | no_license | #include <gtest/gtest.h>
#include "../src/linkedlist.c"
//
class Linkedlist : public testing::Test
{
public:
struct node * list = NULL;
void SetUp() override {
list = linkedlist_newNode(0);
}
void TearDown() override {
free(list);
}
};
// Constructor Test
TEST_F(Linkedlis... |
Java | UTF-8 | 3,080 | 2.875 | 3 | [] | no_license | package cn.tanghaha.mvpDome.util;
import android.util.Log;
import cn.tanghaha.mvpDome.BuildConfig;
/**
* 日志工具类
* Created by ${user} on 2017/10/10.
*/
public class L
{
//调试状态标识 true:调试状态 false:上线状态
protected static final String TAG = "MVP_DOME";
/**
* 打印调试日志信息
*
* @param msg 调试日志信息
... |
Java | UTF-8 | 7,011 | 2.078125 | 2 | [] | no_license | package com.ddaqe.dgn_download_companies;
import org.apache.log4j.Logger;
import org.testng.Assert;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import com.ddaqe.Listener.TestListener;
import com.ddaqe.b... |
C++ | UTF-8 | 4,901 | 3.28125 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <stack>
#include <fstream>
#include <vector>
#include <algorithm>
#include <queue>
#define COUNT 10
std::string::iterator find_end(std::string& str, std::string::iterator start){
int cntr = 0;
while (start < str.end()){
if (*start == '(')
++cntr;
if (*start == ... |
C# | UTF-8 | 2,189 | 3.140625 | 3 | [] | no_license | using System;
using System.IO;
namespace Gruppo.SDK.Communications
{
/// <summary>
/// The header of a socket message. This contains all of the information for reading the whole message from the socket
/// </summary>
public class MessageHeader
{
public MessageHeader()
{
_Version = "1.00";
... |
Markdown | UTF-8 | 1,508 | 3.046875 | 3 | [
"LicenseRef-scancode-generic-cla",
"Apache-2.0"
] | permissive | ## CREATE INDEX (Transaction Per Chunk)
```SQL
CREATE INDEX ... WITH (timescaledb.transaction_per_chunk, ...);
```
This option extends [`CREATE INDEX`][postgres-createindex] with the
ability to use a separate transaction for each chunk it creates an
index on, instead of using a single transaction for the entire hype... |
Python | UTF-8 | 331 | 2.734375 | 3 | [
"MIT"
] | permissive | """
它可以在命令行中使用 2to3 转换成 Python 3.x 版本的代码:
$ 2to3 example.py
这个命令会打印出和源文件的区别。通过传入 -w 参数,2to3 也可以把需要的修改写回到原文件中(除非传入了 -n 参数,否则会为原始文件创建一个副本):
$ 2to3 -w example.py
""" |
Java | UTF-8 | 2,743 | 2.40625 | 2 | [] | no_license | package com.shop.service.shops;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import org.sp... |
C++ | UTF-8 | 579 | 3.21875 | 3 | [] | no_license | #include <iostream>
#include <climits>
using namespace std;
unsigned long long int fibonacci_huge (unsigned long long int n, unsigned long long int m){
if (n==0)
return 0;
else if (n==1)
return 1;
unsigned long long int *F = new unsigned long long int[n + 1];
F[0] = 0;
F[1] = 1;
for (unsigned long ... |
C# | UTF-8 | 413 | 2.515625 | 3 | [] | no_license | using UnityEngine;
public class SoundManager : MonoBehaviour
{
public static SoundManager instance {get; private set;}
[SerializeField]private AudioSource source;
// Start is called before the first frame update
void Awake()
{
instance = this;
source = GetComponent<AudioSource>();
... |
C# | UTF-8 | 1,206 | 2.703125 | 3 | [
"MIT"
] | permissive | using System;
using System.Collections.Generic;
using JetBrains.ReSharper.Psi.ExtensionsAPI.Tree;
namespace ReSharperPlugin.SpecflowRiderPlugin.Psi
{
public static class CompositeElementExtensions
{
public static T FindChild<T>(this CompositeElement element, Predicate<T> predicate)
where T:... |
C++ | UTF-8 | 766 | 2.5625 | 3 | [] | no_license | // vim: ts=4:sw=4 expandtab
#pragma once
#include "Action.h"
class State;
class Ability {
public:
const int energyCosts;
inline explicit Ability(int energyCosts_) :
energyCosts(energyCosts_) {
}
virtual bool create(State&, int triggeredBy) const = 0;
virtual ~Ab... |
Python | UTF-8 | 4,323 | 2.796875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Feb 18 21:47:09 2019
==================================20 MINUTES===================================
"""
from bs4 import BeautifulSoup
import requests
import pandas as pd
import os
import json
import time
import datetime
from datetime import datetime as dt2
%run functions.... |
C# | UTF-8 | 1,989 | 2.578125 | 3 | [] | no_license | using NET.efilnukefesin.Contracts.Logger;
using NET.efilnukefesin.Contracts.Mvvm;
using NET.efilnukefesin.Implementations.Logger.SerilogLogger;
using System;
using System.Collections.Generic;
using System.Text;
namespace NET.efilnukefesin.Implementations.Mvvm
{
/// <summary>
/// this class is used in cases th... |
Python | UTF-8 | 281 | 3.328125 | 3 | [] | no_license | class Group:
def __init__(self, name, date):
self.name = name
self.date = date
def addTax(self, totalAmount):
price = int(totalAmount * 1.1)
return '{:,}'.format(price)
def addDotto(self, price):
return '{:,}'.format(price) |
JavaScript | UTF-8 | 652 | 4.28125 | 4 | [] | no_license | /*
https://www.codewars.com/kata/simple-remove-duplicates/train/javascript
Simple remove duplicates
In this Kata, you will remove the left-most duplicates from a list of integers and return the result.
// Remove the 3's at indices 0 and 3
// followed by removing a 4 at index 1
solve([3, 4, 4, 3, 6, 3]); // => [4, 6... |
Python | UTF-8 | 1,663 | 3.578125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Nov 4 10:36:48 2017
@author: Don Gass
"""
import matplotlib.pyplot as plt
def monthly_payment(loan_amount, yearly_interest_rate,
number_of_months, initial_point_payment=0):
'''
loan_amount = total amout of loan eg. 200000
... |
Java | UTF-8 | 10,728 | 2.484375 | 2 | [] | no_license | package com.terracore.handlers;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import com.terracore.storages.Cards;
import com.terracore.storages.Textures;
import com.terracore.wizards.Wizards;
public class HordeMouseHandler implements MouseListener,... |
Java | UTF-8 | 1,682 | 2.421875 | 2 | [] | no_license | package com.liuqitech.demo.config.security.authenticationprovider;
import com.liuqitech.demo.config.security.userdetailsservice.UsernamePasswordUserDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationProvider;
import org.spring... |
C# | UTF-8 | 1,428 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | using UnityEngine;
using System;
public class Logger
{
public static bool bDebug = true;
public static void SetDebug(bool bValue)
{
bDebug = bValue;
}
public static void Log(string info)
{
if (bDebug == true)
{
Debug.Log(info);
}
}
public ... |
Swift | UTF-8 | 2,466 | 3.234375 | 3 | [
"MIT"
] | permissive | func reduceBandwidth(_ matrix: [[Bool]]) -> [Int] {
let degs = degrees(matrix)
let sortedVertices = (0..<matrix.count).sorted {
// As of Swift 2.2, sort is not stable. The second condition makes the sort stable for
// easier testability.
let d0 = degs[$0]
let d1 = degs[$1]
... |
C++ | UTF-8 | 3,481 | 3.078125 | 3 | [] | no_license | //#include<stdlib.h>
#include "stack.h"
#include<iostream>
#include<string>
#include<ctype.h>
//#include<cstring>
//#include<sstream>
//break after errros
using namespace std;
using namespace cop4530;
int main(){
string variable="";
string postfix="";
string expression;
Stack<char>op;
cout<<"Enter in... |
Swift | UTF-8 | 10,835 | 3.390625 | 3 | [
"MIT"
] | permissive | //
// Arithmetic.swift
// Element-wise arithmetic operations
//
// Created by Matteo Rossi on 02/01/21.
//
import Accelerate
// MARK: - Addition
public func + (lhs: Matrix, rhs:Matrix) -> Matrix {
return withMatrix(from: lhs) { add(&$0, rhs, 1.0) }
}
public func + (lhs: Matrix, rhs:Double) -> Matrix {
ret... |
SQL | UTF-8 | 807 | 2.96875 | 3 | [
"MIT"
] | permissive | INSERT INTO department (name)
VALUES
('Legal'),
('Promotions'),
('Sales'),
('Entertainment');
INSERT INTO role (title, salary, department_id)
VALUES
('Engineer', 85000.99, null),
('Intern', 7000.00, 2),
('Lawyer', 101000.50, 1),
('Manager', 65000.00, null),
('Legal Assistant', 30000... |
Java | UTF-8 | 2,727 | 2.140625 | 2 | [] | no_license | package estimate.ejb;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.NonUniqueResultException;
import javax.persistence.PersistenceException;
import javax.persistence.Query;
import piv.model.TempTb;
import util.emSelect.EmSelector;
import estimate.model.Pcestdtt;... |
Python | UTF-8 | 524 | 2.734375 | 3 | [] | no_license | # Each data structure should theoretically require 40,000 bits
TOTAL_BITS = 40000
# Both
WIDTH = 10000
# Queue
DEPTH = int(TOTAL_BITS / WIDTH)
RESOLUTION = 100
# Counting
BITS = int(TOTAL_BITS / WIDTH)
# The default time used for simulation, long enough for the
# entire bloom queue to cycle through twice
TIME = RES... |
Python | UTF-8 | 1,608 | 3.90625 | 4 | [] | no_license | # Given an array of strings words representing an English Dictionary, return the longest word in words that can be built one character at a time by other words in words.
# If there is more than one possible answer, return the longest word with the smallest lexicographical order. If there is no answer, return the empty... |
Java | UTF-8 | 1,537 | 2.6875 | 3 | [] | no_license | package com.leewardassociates.input.validator.wrappers;
import java.io.CharArrayWriter;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
public class CharResponseWrapp... |
TypeScript | UTF-8 | 5,681 | 2.65625 | 3 | [
"MIT"
] | permissive | import { zod as z } from '@umijs/utils';
import { zodToTs } from './zod';
test('zod default', () => {
enum Fruits {
Apple = 'apple',
Banana = 'banana',
Cantaloupe = 'cantaloupe',
A = 5,
}
const example2 = z.object({
a: z.string(),
b: z.number(),
c: z.array(z.string()).nonempty().leng... |
Python | UTF-8 | 207 | 3.359375 | 3 | [] | no_license | import sys
name_argument = sys.argv[1]
location_argument = sys.argv[2]
def i_here(name, location):
print('My name is {0}. I am in {1}'.format(name, location))
i_here(name_argument, location_argument)
|
Shell | UTF-8 | 3,568 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | # 获取脚本所在目录完整路径
project_path=$(cd `dirname $0`; pwd)
# 渲染生成部署文件
cat > $project_path/deploy.yaml << EOF
apiVersion: v1
kind: Service
metadata:
name: ${SERVICE_NAME}
namespace: ${NAMESPACE}
spec:
type: ClusterIP
ports:
- name: http-tomcat
port: 8080
targetPort: 8080
protocol:... |
Markdown | UTF-8 | 4,807 | 3 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | ## Start
### 启动
```
npm run watch
```
## 说明文档
* 开始
* [环境要求](#environment)
* [开始](#get-started)
* [写一篇博文](#write-posts)
* 各组成部分
* [侧边栏](#sidebar)
* [mini-about-me](#mini-about-me)
* [标签云](#featured-tags)
* [好友链接](#friends)
* [HTML5演示文档布局](#keynote-layout)
* 评论与 Google/Baidu Analytics
* [评论](#comment)
* [网站分析]... |
Markdown | UTF-8 | 2,129 | 3.921875 | 4 | [] | no_license | # Binary Search Tree Depth First Search - In Order
Write a method on a `BinarySearchTree` class called `dfsInOrder`. This method should return an array of values.
Definition Depth First Search:
**Depth-first search (DFS)** is an algorithm for traversing or searching tree or graph data structures. The algorithm start... |
PHP | UTF-8 | 1,654 | 2.59375 | 3 | [] | no_license | <?php
require_once("tfpdf.php");
class MY_tfpdf extends TFPDF
{
function __construct()
{
parent::__construct();
}
function _putcatalog()
{
parent::_putcatalog();
// Disable the page scaling option in the printing dialog
// SEE http://stackoverflow.com/a/8444588/627473
$this->_out('/Viewer... |
JavaScript | UTF-8 | 1,753 | 2.546875 | 3 | [] | no_license | /**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
*/
import React, { Component } from 'react';
import { Button, View, Text } from 'react-native';
import AudioComponent from './audio';
import DrawerLayout from 'react-native-drawer-layout';
type Props = {};
const audios ... |
PHP | UTF-8 | 761 | 2.875 | 3 | [] | no_license | <form method="post">
<input type ="text" name ="username"/>
<input type ="password" name ="password"/>
<input type ="submit" value ="Login" name ="login"/>
</form>
<?php
$db = new PDO("mysql:host=localhost; dbname=game",
"root",
""
);
if(!empty($_POST['login'])){
$username = $_POST[... |
Python | UTF-8 | 7,579 | 2.90625 | 3 | [] | no_license | import numpy as np
import cv2
import random
## COMMON RANSAC FUNCTIONS
def calc_N(confidence, outlier_percentage, num_model_params):
denominator = np.log(1 - ((1 - outlier_percentage) ** num_model_params))
if denominator == 0:
return np.inf
return np.log(1 - confidence) / denominator
def ransac... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.