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 |
|---|---|---|---|---|---|---|---|
C# | UTF-8 | 1,093 | 3.015625 | 3 | [] | no_license | using System.Collections.Generic;
using System.Linq;
namespace EverbridgeWCF.Data {
class DoorDAO : IDoorDAO{
private readonly DoorContext db;
public DoorDAO(DoorContext db) {
this.db = db;
}
public List<Door> getAll() {
return db.doors.ToList();
... |
C++ | UTF-8 | 3,709 | 2.953125 | 3 | [
"FSFAP",
"MIT"
] | permissive | #ifndef SRC_MAIN_CORE_IMPL_FREEZABLE_POSTING_LIST_H_
#define SRC_MAIN_CORE_IMPL_FREEZABLE_POSTING_LIST_H_
#include <memory>
#include <utility>
#include "core/index/posting_list.h"
#include "core/reader/posting_list_reader.h"
#include "core/reader/reader_utils.h"
namespace redgiant {
/*
* - A wrapper of posting list... |
Markdown | UTF-8 | 1,230 | 2.859375 | 3 | [] | no_license | ---
description: 设置活动位置,到达设定好的位置时软件提示
---
# 22.系统功能——位置,自带场景标记
我们在“[5种常见的时间归类方式](../ch02/ch02.16.md)”这一节中提到了“场景分类”。
在aTimeLogger Pro中(aTimeLogger没有这个功能)用户可以进入活动项,选择位置,导出报告时,就不仅有时间数据,还能给所有时间数据加上位置标记,增加了一个场景分析的维度。
在更多-位置,右上角“+”新建,输入位置名称,点击进入,可选的地图有苹果地图和百度地图,我默认选择苹果地图,因为苹果地图有当前坐标和定位坐标显示,长按紫色定位标可以手动修正,百度地图没有当前位置,且手动设置坐... |
Swift | UTF-8 | 2,468 | 3.21875 | 3 | [] | no_license | //
// Author: Alex Cummaudo
// Student ID: 1744070
// Program: A2 - Inference Engine
// Unit: COS30019 - Intro to AI
// Date: 4/05/2016
//
///
/// Implements the backward chaining algorithm for entailing information. Refer to
/// p.257 of AIMA for more.
///
struct BackwardCh... |
Java | GB18030 | 652 | 3.953125 | 4 | [] | no_license | package demo02.Stream;
import java.util.stream.Stream;
/*
*
* limitһӳٷֻǶеԪؽнȡ
* صһµԿԼStreamе
*/
public class Demo06Stream_limit {
public static void main(String[] args) {
//ȡһStream
String[] arr = {"","ϲ","","̫","̫"};
Stream<String> stream = Stream.of(arr);
//ʹlimitStreamеԪؽнȡֻҪǰ3Ԫ
Strea... |
Java | UTF-8 | 514 | 2.796875 | 3 | [] | no_license | package Modules;
import java.util.ArrayList;
public class Building {
public String name;
public String libelle;
public ArrayList<Room> rooms;
public Building(String name, String libelle){
this.name = name;
this.libelle = libelle;
this.rooms = new ArrayList<>();
}
public String getName() {
return nam... |
C# | UTF-8 | 609 | 2.84375 | 3 | [] | no_license | using System;
using System.Runtime.CompilerServices;
namespace FabricTraining
{
public class BikeFactoryTester
{
public static void Main()
{
BikeFactory factory = new BikeFactory();
IBike roadBike = factory.GetBike("RoadBike");
roadBike.FrameSize = 54;
... |
C# | UTF-8 | 1,644 | 2.5625 | 3 | [] | no_license | using CamadaDados;
using System.Data;
namespace CamadaNegocio
{
public class NPrograma
{
// Metodo Inserir
public static string Inserir(
string audio,
string duracao,
string dataCadastro,
string sintese)
{
DPrograma Obj = ... |
Markdown | UTF-8 | 2,504 | 2.78125 | 3 | [] | no_license | # Sequences-of-Objects
Sequences of Objects (SO) is a novel and effective method for ancient Chinese 'Shan Shui' painting composition classification.
This repository contains a TensorFlow implementation of SO. The repository is separated in two main parts: (1) object detector; (2) sequence classifier. Here we apply [... |
PHP | UTF-8 | 1,241 | 2.609375 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | <?php
/**
* Created by PhpStorm.
* User: pablocamara
* Date: 24/03/2018
* Time: 23:25
*/
class Article_model extends CI_Model {
public $id;
public $associated_category_id;
public $url_tag;
public $title;
public $small_description;
public $full_description;
public $createdAt;
publ... |
C++ | UTF-8 | 817 | 2.625 | 3 | [] | no_license | #ifndef ZORKISH_BAG_H
#define ZORKISH_BAG_H
#include <vector>
#include "../InventoryItem/InventoryItem.h"
#include "../Inventory/Inventory.h"
class Bag {
private:
Inventory bagEntities = Inventory("bag");
bool bagOpen;
string unlockItemName;
string itemKey;
string itemName = "null";
string it... |
C++ | UTF-8 | 266 | 2.78125 | 3 | [] | no_license | // https://zxi.mytechroad.com/blog/simulation/1528-shuffle-string/
class Solution {
public:
string restoreString(string s, vector<int>& indices) {
string ans(s);
for (int i = 0; i < indices.size(); ++i)
ans[indices[i]] = s[i];
return ans;
}
};
|
Markdown | UTF-8 | 1,819 | 2.578125 | 3 | [] | no_license | <h2>분산시스템을 이용하여 대규모 그래프에 존재하는 모든 삼각형 찾아내기</h2>
<h4>박하명 교수님</h4>
<b>Graph are EVERYWHERE</b><br>
세상 어디에든 그래프는 존재한다. 데이터는 그래프로 표현될 수 있으며 그래프에 존재하는 모든 삼각형을 찾아내어
그것을 가지고 노드간의 관계를 찾을 수 있다.<br>
*삼각형이란 3개의 노드가 연결되어있는 것을 의미한다.
<b>spam/fake user detection</b><br>
Facebook을 예로, 일반유저들 사이에서 친구관계를 그래프로 나타내면
군집화되어 나타나며 삼각형이 이루어... |
JavaScript | UTF-8 | 1,030 | 4.5 | 4 | [] | no_license | /*
Jogo de Adivinhação
- O sistema sorteia um número aleatório de 0 a 50;
- O sistema pede um palpite para o usuário;
- Se o usuário acertar, ele venceu;
- Se não:
- O sistema avisa se o palpite do usuário é maior ou menor que o número sorteado;
- A cada erro, o usuário perde 1 vida. Ele tem dez vidas p... |
Markdown | UTF-8 | 2,943 | 3.09375 | 3 | [] | no_license |
### CHESSY v1.0: A generic OOP framework for board games [aspirationally]
Author: Ranga Muvavarirwa
#### Motivation:
Many situations arise whereby two sides need to simultaneously use a public good [e.g. a river, a game board etc] in
pursuit of their own self-regarding goals (e.g. cross river, get as many pieces as ... |
C++ | UTF-8 | 541 | 3.09375 | 3 | [
"MIT"
] | permissive | #ifndef _NODO_HASH_H_
#define _NODO_HASH_H_
#include <string>
#include <iostream>
using namespace std;
class NodoHash
{
private:
long double clave;
string valor;
public:
NodoHash();
long double getClave();
string getValor();
void setClave(long double);
void setValor(string);
~NodoHash();
void operator=(con... |
Markdown | UTF-8 | 1,133 | 3.421875 | 3 | [] | no_license | ---
layout: post
id: 90
alias: try-mockito
tags: Java
date: 2011-09-13 01:40:44
title: mockito
---
写单元测试,早晚会需要mock,不然有的东西没法测。曾经在一年前,我试用过EasyMock,这个目前使用人数最多、好评也很多的mock库,可以让我们方便的mock一个接口或者一个类。
<p>但是,还不够方便,虽然比我们自己写一个mock类方便很多,但是,总觉得还不够方便。
<p>直到有一天,我看到了mockito,原来,mock还可以更简单。如果自己写mock的复杂度是10的话,使用easymock大约是4,而mockito应该是3。不... |
C# | UTF-8 | 3,685 | 3.234375 | 3 | [] | no_license | using ExchangeRates.Repositories;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace ExchangeRates.Services
{
public class RateService : IRateService
{
// inject repository layer
private readonly IRateRepository _rateRepository;
... |
Java | UTF-8 | 2,396 | 2.203125 | 2 | [] | no_license | package me.isaaceichelberger.speeduhc;
import me.isaaceichelberger.speeduhc.commands.CommandKit;
import me.isaaceichelberger.speeduhc.handlers.Game;
import me.isaaceichelberger.speeduhc.listeners.InventoryClick;
import me.isaaceichelberger.speeduhc.listeners.MGListener;
import me.isaaceichelberger.speeduhc.listeners.P... |
JavaScript | UTF-8 | 312 | 3.53125 | 4 | [] | no_license | // https://www.hackerrank.com/challenges/diagonal-difference/problem
function diagonalDifference(arr) {
let left = 0
let right = 0
if(arr.length === 0) return 0
for(let i = 0; i < arr.length; i++){
left += arr[i][i]
right += arr[i][arr.length - 1 - i]
}
return Math.abs(left-right)
} |
Java | UTF-8 | 355 | 2.0625 | 2 | [] | no_license | package com.example.psrihariv.gentcmobile;
/**
* Created by psrihariv on 3/1/2016.
*/
public class GenTCJNILib {
static {
System.loadLibrary("GenTCjni");
}
public static native void init(String path);
public static native void draw(float AngleX, float AngleY);
public static native void... |
C++ | UTF-8 | 1,073 | 2.921875 | 3 | [] | no_license | #ifndef NUMBER_H
#define NUMBER_H
#include "token.h"
#include <cmath>
#include <string>
class number:public token{
public:
number(double val):token(std::to_string(val)),value(val){;}
virtual tokenType getType() const{return tokenType::_number; }
inline const double getValue()const {return value;}
private:... |
C# | UTF-8 | 2,109 | 2.78125 | 3 | [
"MIT"
] | permissive | using System;
using System.Collections.Concurrent;
using System.Text;
namespace Abc.Zerio.Core
{
public struct MessageTypeId : IEquatable<MessageTypeId>
{
private static readonly ConcurrentDictionary<Type, MessageTypeId> _values = new ConcurrentDictionary<Type, MessageTypeId>();
private static... |
C | UTF-8 | 629 | 2.515625 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"LicenseRef-scancode-other-permissive",
"LicenseRef-scancode-musl-exception",
"MIT",
"LLVM-exception",
"Apache-2.0",
"NCSA"
] | permissive | #define _GNU_SOURCE
#include <math.h>
#include <stdint.h>
double exp10(double x)
{
static const double p10[] = {
1e-15, 1e-14, 1e-13, 1e-12, 1e-11, 1e-10,
1e-9, 1e-8, 1e-7, 1e-6, 1e-5, 1e-4, 1e-3, 1e-2, 1e-1,
1, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9,
1e10, 1e11, 1e12, 1e13, 1e14, 1e15
};
double n, y =... |
C++ | UTF-8 | 383 | 3.234375 | 3 | [] | no_license | //to check maximum and minimum in a array
#include<iostream>
#include<ctype.h>
using namespace std;
int main (void)
{
char x[101],max=0,min=0;
cout<<" enter ";
cin.getline(x,100);
for(int i=1;x[i]!='\0';i++)
{
if(x[i]>max)
{
max=x[i];
}
if(x[i]<min)
{
min=x[i];
... |
Python | UTF-8 | 3,158 | 2.734375 | 3 | [] | no_license |
import socket, sys, threading, hashlib,time, logging,os
from sys import stderr
from time import gmtime, strftime
from logging import getLogger, StreamHandler, Formatter, DEBUG
#ESTAS SIMPLEMENTE SON VARIABLES
host, port = '', 9000
hasher = hashlib.md5()
TAMANO = 60000
tamano = 0
class transfer :
#ESTE ES EL SOCKE... |
PHP | UTF-8 | 414 | 2.515625 | 3 | [] | no_license | <?php
namespace Waka\Crsm\Classes\Imports;
use Waka\Crsm\Models\ProjectState;
use Maatwebsite\Excel\Concerns\ToModel;
use Maatwebsite\Excel\Concerns\WithHeadingRow;
class ProjectStateImport implements ToModel, WithHeadingRow
{
public function model(array $row)
{
return new ProjectState([
... |
C# | UTF-8 | 894 | 2.515625 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Text;
namespace conti.maurizio._4H.MediaMobile
{
class Campione
{
public DateTime Data { get; set; }
public double Temperatura { get; set; }
public int Umidita { get; set; }
public int Pressione { get; set; }
... |
Java | UTF-8 | 2,196 | 2.296875 | 2 | [] | no_license | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.ReminderApp.Servlets;
import com.ReminderApp.Model.Employee;
import java.io.IOException;
import java.io.PrintWrit... |
Java | UTF-8 | 357 | 2.015625 | 2 | [] | no_license | package org.dora.jdbc.grammar.model.operand;
import org.dora.jdbc.grammar.model.operand.BinaryOperand;
import org.dora.jdbc.grammar.model.operand.Operand;
/**
* Created by SDE on 2018/5/8.
*/
public class QuotientOperand extends BinaryOperand {
public QuotientOperand(Operand left, Operand right) {
supe... |
Rust | UTF-8 | 103,425 | 2.765625 | 3 | [] | no_license | use crate::xb::{HasXB, MightHaveXB};
///! This module defines data structures for FDS input data, and the functions
///! for converting them to and from Fortran Namelists. This is inherently less
///! flexible than the Namelist data, which can hold any data, but allows us to
///! operate more flexibly on FDS input data... |
Java | UTF-8 | 7,079 | 1.992188 | 2 | [] | no_license | package com.qiunan.flink.connector.clickhouse.table.internal.executor;
import com.qiunan.flink.connector.clickhouse.table.internal.connection.ClickHouseConnectionProvider;
import com.qiunan.flink.connector.clickhouse.table.internal.converter.ClickHouseRowConverter;
import com.google.common.util.concurrent.AbstractExec... |
Markdown | UTF-8 | 2,469 | 2.828125 | 3 | [
"Unlicense"
] | permissive | ---
layout: post
title: How to Fix "Cannot find module" in TypeScript
date: 2016-10-28
---
When using external library in TypeScript, one of the most common problem is that the `tsc` failed to find module. For example,
12 import Image from 'react-native-image-progress';
~~~~~~~~~~~~~~~~~~~~~~... |
Python | UTF-8 | 976 | 3.9375 | 4 | [
"Apache-2.0"
] | permissive | '''
Created on Aug, 11 2015
@author: mlaptev
'''
# First: create list that contains tuple with following structure:
# 1. the element
# 2. square of the element
# 3. cube of the element
first_task_result = [(elem, elem**2, elem**3) for elem in range (1, 21)]
# Second: create list that contains cube of even numbers
s... |
Java | UTF-8 | 1,093 | 3.703125 | 4 | [] | no_license |
public class EditDistance {
public static int editDistance(String s, String t) {
// initialize the table:
int[][] myTable = new int[s.length() + 1][t.length() + 1];
for (int i = 0; i < s.length() + 1; i++) {
myTable[i][0] = i;
}
for (int j = 0; j < t.length() + 1; j++) {
myTable[0][j] = j;
}
//... |
C++ | UTF-8 | 714 | 3.265625 | 3 | [] | no_license | #include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int *a,n,prod=1,multi=1,sumo=0,sume=0;
cout<<"\nEnter no of elements....";
cin>>n;
a=new int[n];
for (int i=0;i<n;i++)
{
cin>>a[i];
}
clrscr();
cout<<"\nArray A={";
for (int j=0;j<n;j++)
{
cout<<a[j]<<",";
}
cout<<"\b}";
for (int k=0;k<n;... |
Markdown | UTF-8 | 1,023 | 3.171875 | 3 | [] | no_license | # Command Pattern
### Terminology
* **Command object**: Knows about a Receiver and invokes a method on it.
* **Receiver object**: Handles the state of the design pattern (Light).
* **Invoker**: Knows about the Command object and invokes the concrete interface implementation.
* **Client**: Uses the invoker.
#### Usa... |
Markdown | UTF-8 | 422 | 2.53125 | 3 | [
"MIT"
] | permissive | # Responsive Timeline
This application uses pure CSS to display a responsive timeline. Go ahead, resize
your browser window. See if you can catch all the changes!
## Screenshot

## Installation
```
git clone https://github.com/mkhira2/responsive-timeline.git
cd... |
Python | UTF-8 | 22,848 | 3.09375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
pip_services3_commons.data.StringValueMap
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
StringValueMap implementation
:copyright: Conceptual Vision Consulting LLC 2018-2019, see AUTHORS for more details.
:license: MIT, see LICENSE for more details.
"""
from datetime imp... |
Java | UTF-8 | 6,005 | 2.0625 | 2 | [] | no_license | package shu.cloud.tools;
import java.io.File;
import java.io.IOException;
import java.sql.Timestamp;
import java.util.Iterator;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import jav... |
Java | UTF-8 | 730 | 2.140625 | 2 | [
"MIT"
] | permissive | package org.ofdrw.core.image;
import org.junit.jupiter.api.Test;
import org.ofdrw.TestTool;
import org.ofdrw.core.basicType.ST_Array;
import org.ofdrw.core.pageDescription.color.color.CT_Color;
import static org.junit.jupiter.api.Assertions.*;
public class BorderTest {
public static Border borderCase(){
... |
PHP | UTF-8 | 3,832 | 2.765625 | 3 | [
"MIT"
] | permissive | <?php
/*
* This file is part of Badcow DNS Library.
*
* (c) Samuel Williams <sam@badcow.co>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Badcow\DNS;
use Badcow\DNS\Rdata\AAAA;
use Badcow\DNS\Rdata\A;
use Badcow\DNS\... |
SQL | UTF-8 | 6,208 | 4.0625 | 4 | [] | no_license | -- Add below your SQL statements.
-- You can create intermediate views (as needed). Remember to drop these views after you have populated the result tables.
-- You can use the "\i a2.sql" command in psql to execute the SQL commands in this file.
-- Query 1 statements
create view q1full as
select cid as c2id, ... |
Markdown | UTF-8 | 755 | 2.625 | 3 | [] | no_license | ---
layout: home
title: Home
list_title: Blog posts
exclude: true
main-image: "main.jpg"
image-alt: "Karlbergskanalen"
image-class: "wide-image"
---
Welcome!
This site was originally created for the course ["Client-based web programming"](https://coursepress.lnu.se/kurs/klientbaserad-webbprogrammering/) at Linnaeus u... |
C++ | UTF-8 | 1,073 | 2.78125 | 3 | [] | no_license | /**
* Simple Arduino RC Receiver for one Channel
* Author: Heinz Bruederlin
* Date: 01/2018
*/
#include "RcRx.h"
RcRx* RcRx::singleton = NULL;
/**
* only port 2 or 3 support external interrupts
* (otherwise we have to use pin change interrupt code ...)
*/
RcRx::RcRx(int _portNo) {
portNo = _portNo;
}
void... |
Markdown | UTF-8 | 2,442 | 3.953125 | 4 | [] | no_license | ---
id: kth-largest-element-in-an-array
title: Kth Largest Element in an Array
sidebar_label: Kth Largest Element in an Array
---
## Description
<div class="description">
<p>Find the <strong>k</strong>th largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth disti... |
Java | UTF-8 | 1,093 | 2.484375 | 2 | [] | no_license | package models;
import elements.Button;
import elements.Dropdown;
import elements.Link;
import elements.Page;
public class MensClothing extends PageObject{
private static MensClothing instance;
private Link linkItem;
private Dropdown options;
private Button addToCard;
public static MensClothing ... |
Java | UTF-8 | 1,352 | 1.882813 | 2 | [] | no_license | package com.dream.city.base.model.req;
import lombok.Data;
import lombok.ToString;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* @author wvv
* 玩家投资订单
*/
@ToString
@Data
public class InvestOrderReq implements Serializable {
private Integer id;
/**
* 订单id
... |
C++ | UTF-8 | 712 | 2.65625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int main(void)
{
ios::sync_with_stdio(false); cin.tie(NULL);
int T; cin >> T;
while(T--) {
int x1, y1, r1, x2, y2, r2; cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
if(r1 < r2) {
swap(x1,x2); swap(y1,y2); swap(r1,r2);
}
int dist2 = (x1-x2) * (x1-x2) + (y1-y2) ... |
Java | UTF-8 | 4,644 | 2.078125 | 2 | [] | no_license | package com.game.open.controller;
import com.game.chat.util.JsonUtils;
import com.game.common.vo.ResultVO;
import com.game.login.domain.Account;
import com.game.open.domain.GameDataRVO;
import com.game.open.service.OpenService;
import com.game.util.CommonFunUtil;
import com.game.util.Constant;
import com.game.util.Sig... |
Java | UTF-8 | 855 | 3.28125 | 3 | [] | no_license | package summixLinker;
import java.util.ArrayList;
import summixAssembler.TextFile;
/**
* Processes the object files with pass1 and pass2, then returns the final program file, loaded into memory at the the spot decided by the user.
* @author Michael Pinnegar
*
*/
public class Linker {
/**
* Take... |
Markdown | UTF-8 | 1,843 | 3.484375 | 3 | [] | no_license | # Digital-Concept-Tutorial: Number Systems & Conversions
### Author: Chlotte Crim
## Summary of Purpose
This tutorial is covering the types of number systems as well as how to convert between them.
## Content Tutorial
;
}
|
Java | UTF-8 | 153 | 2.078125 | 2 | [] | no_license | package template;
public class CurrentAccount extends Account{
public void calculateInterest() {
System.out.println("活期利息。。。");
}
}
|
Java | UTF-8 | 2,134 | 2.296875 | 2 | [] | no_license | package com.eai.serviceimpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.eai.model.Role;
import com.eai... |
Python | UTF-8 | 129 | 2.96875 | 3 | [] | no_license | import datetime
x = datetime.datetime.now()
print(x.strftime("%a"))
#%I - Tunnid
#%M - Minutid
# Friday 17:35
print(x.year)
|
JavaScript | UTF-8 | 1,831 | 2.5625 | 3 | [] | no_license | /*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/* eslint-env browser */
class SyliusVariantImages {
constructor() {
this.mainImageLink = document.que... |
Java | UTF-8 | 290 | 2.0625 | 2 | [
"Apache-2.0"
] | permissive | package org.tangence.java;
public class TangenceException extends Exception {
/**
* Constructor for TangenceException.
* @param string String
*/
public TangenceException(final String string) { super(string); }
private static final long serialVersionUID = -271328471238567238L;
}
|
JavaScript | UTF-8 | 590 | 3.140625 | 3 | [
"MIT"
] | permissive | import { quotes } from './quotes.js';
const button = document.getElementById('button');
function getRandomQuote(quotes) {
const randIndex = Math.floor(Math.random() * quotes.length);
return quotes[randIndex];
}
function renderQuote(quotes) {
let quote = getRandomQuote(quotes);
const renderQuote = `
<p cla... |
C | UTF-8 | 398 | 3.5 | 4 | [] | no_license | #include<stdio.h>
int main(){
int ar[] = {1,2,32,42,4,456,67,34,2};
int len = sizeof(ar)/sizeof(ar[0]);
printf("Arary is: \n");
for (int i = 0; i < len; i++){
printf(" %d ",ar[i]);
}
int lar = ar[0];
for (int i = 1; i < len; i++){
if (ar[i] > lar){
la... |
C | ISO-8859-1 | 7,590 | 3.21875 | 3 | [] | no_license | #include "grid.h"
#include <time.h>
#include <stdlib.h>
#include <math.h>
static void turn(grid g);
static void turningxtimes(grid g, int x);
static int firstRota(dir d);
static int secondRota(dir d);
static int rand_a_b(int a, int b);
static void fusion(grid g, dir d);
static void decalage(grid g, dir d);
/**
* \br... |
C++ | UTF-8 | 1,744 | 2.53125 | 3 | [] | no_license | void setup() {
for(int i=5;i<9;i++)
pinMode(i,OUTPUT);
}
void forward() {
digitalWrite(5,HIGH);
digitalWrite(6,LOW);
digitalWrite(7,LOW);
digitalWrite(8,HIGH);
}
void backward(){
digitalWrite(5,LOW);
digitalWrite(6,HIGH);
digitalWrite(7,HIGH);
digitalWrite(8,LOW);
}
void left(){
... |
Java | UTF-8 | 1,081 | 2.25 | 2 | [] | no_license | package org.cocome.cloud.web.frontend.navigation;
public enum NavigationElements {
LOGIN("/login", null),
ENTERPRISE_MAIN("/enterprise/main", null),
STORE_MAIN("/store/main", null),
START_SALE("/store/start_sale", "cashier"),
ORDER_PRODUCTS("/store/order_products", "stock manager"),
SHOW_STOCK("/store/show_stock... |
Shell | UTF-8 | 2,021 | 4.21875 | 4 | [] | no_license | #!/bin/bash
set -eo pipefail
# 変数
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
REGION="$1"
FLAG="$2"
# 引数チェック
if [ "$#" -ne 2 ]; then
echo "第1引数にリージョン、第2引数にフラグを指定してください"
exit 1
fi
if [[ "$REGION" != "ap-northeast-1" && "$REGION" != "ap-southeast-1" ]]; then
echo "第1引数にはap-northeast-1,ap-southeast-1のいずれかを指定してくださ... |
Python | UTF-8 | 2,580 | 2.8125 | 3 | [] | no_license | from config.config import *
import json
import asyncio
def transfer_json(msg, method):
"""字符串与json格式互相转换"""
if method:
return json.dumps(msg)
else:
return json.loads(msg)
async def handle_echo(reader, writer):
local_addr = writer.get_extra_info('sockname')
connect_request = await... |
Python | UTF-8 | 1,322 | 3.578125 | 4 | [] | no_license | # Union method
# set_a = {"a", "b", "c", 1, 2, 3}
# set_b = {"c", "d", "e", 3, 4, 5}
# set_c = {5, 6, 7}
# print (set_a.union(set_b))
# print (set_b.union(set_a))
# print (set_a.union(set_b, set_c))
# print (set_b.union(set_a, set_c))
# print (set_a | set_b)
# print (set_b | set_a)
# # Intersection method
# set_a =... |
C++ | UTF-8 | 2,485 | 3.09375 | 3 | [] | no_license | //
// Tree.cpp
// CM
//
// Created by Yuantong Ding on 12/14/14.
// Copyright (c) 2014 Yuantong Ding. All rights reserved.
//
#include "Tree.h"
void Tree::setRoot(int name, int type){
_root->_name = name;
_root->_type = type;
_root->_weight = 1;
_root->_parent = NULL;
}
void Tree::addLineage(vec... |
Java | UTF-8 | 1,233 | 3.9375 | 4 | [] | no_license | package com.koreait.downcasting;
class Car {
private String model;
public Car(String model) {
super();
this.model = model;
}
public void drive() {
System.out.println(model + "타고 드라이브중 .");
}
}
class EV extends Car {
private int battery;
private final int FULL_BATTERY = 80;
public EV(String model, in... |
Go | UTF-8 | 4,252 | 2.71875 | 3 | [] | no_license | // @Title
// @Description
// @Author Niels 2020/5/27
package glog
import (
"archive/zip"
"io"
"io/ioutil"
"log"
"os"
"sort"
"strconv"
"strings"
"time"
)
var cfg *LogCfg
var running bool
func restartTask(newCfg *LogCfg) {
cfg = newCfg
if running {
return
}
//date按天、week按周、month按月、none不生成新的文件
//自动加载配... |
C# | UTF-8 | 1,763 | 2.75 | 3 | [] | no_license | using OpenCvSharp;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Threading.Tasks;
namespace genshinbot.diag
{
public class CvThread
{
static bool running;
static ConcurrentQueue<Action> run = new C... |
PHP | UTF-8 | 7,012 | 2.84375 | 3 | [] | no_license |
<?php
// TODO FINISH UP:
// --------------------------------------------------
// time and phone number validation plus errors
// get date and time limiter code from Rob
// get UI code from rob or randall. Use it if needed
// fix "between DATE and DATE"
// Silence warnings
error_reporting(E_ALL ^ E_WARNING);
?>... |
JavaScript | UTF-8 | 2,503 | 2.578125 | 3 | [] | no_license | //app.js
App({
onLaunch: function () {
// 展示本地存储能力
var logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
// 登录
wx.login({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
}
})
// 获取用户信息
wx.getSetti... |
C++ | UTF-8 | 1,518 | 2.890625 | 3 | [] | no_license | class Solution {
public:
string getPermutation(int n, int k) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
assert (k >= 1);
int total = 1;
for (int i=2; i<=n; ++i) total *= i;
k = k % total; if (k == 0) k = total;
string dig ... |
Go | UTF-8 | 837 | 2.625 | 3 | [] | no_license | package sql
import (
"testing"
)
func TestSQL_IndexNormal(t *testing.T) {
man, err := New(NewConfig())
if err != nil {
t.Fatal(err)
}
defer func() {
if err = man.Shutdown(); err != nil {
t.Fatal(err)
}
}()
err = man.IndexOffer(
map[string]string{
"abc.com/topic": "abc.com/topic_hub",
})
if er... |
TypeScript | UTF-8 | 2,288 | 2.859375 | 3 | [] | no_license | import { ThunkAction } from "redux-thunk";
import { AppState } from "./rootReducer";
import { Action } from "@reduxjs/toolkit";
import { getImageFolderSuccessful } from "./imagesSlice";
import { IImageFolder, IPhoto } from "../types";
const shufflePhotos = (photoArray: IPhoto[]) => {
var currentIndex = photoArray.le... |
Java | UTF-8 | 15,456 | 2.34375 | 2 | [] | no_license | package com.zipingfang.aihuan.utils;
import android.app.Activity;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import ... |
Java | UTF-8 | 239 | 1.8125 | 2 | [] | no_license | package br.andretto.sample02.services;
import br.andretto.sample02.model.Produto;
import java.util.List;
public interface IProdutoService {
public Produto buscarProdutoPorId(int cod);
public List<Produto> buscarTodos();
} |
Java | UTF-8 | 1,729 | 3.03125 | 3 | [] | no_license | package pinckneyjames.AcquiaAdventure;
public class ConferenceRoom implements Rooms{
String[] objectList, interactableList, enemiesList, exitList;
public ConferenceRoom()
{
objectList = null;
interactableList = null;
enemiesList = null;
exitList = null;
}
public ConferenceRoom(String[] objects)
{... |
JavaScript | UTF-8 | 1,171 | 3.15625 | 3 | [] | no_license | function Particle(ctx) {
this.random = function(a, b) {
return Math.floor(Math.random() * b) + a;
};
this.randPick = function(arr) {
return arr[Math.floor(Math.random() * arr.length)];
};
this.width = ctx.canvas.width;
this.height = ctx.canvas.height;
this.colors = ['#3c40c6', '#0be881', '#ff3f... |
TypeScript | UTF-8 | 3,465 | 2.765625 | 3 | [] | no_license | import { Request, Response } from 'express';
import pool from '../database';
// ==================================================
// Lista los tipos de documento de la BD
// ==================================================
class TiposDocumentosController {
public async list(req: Request, res: Respons... |
Go | UTF-8 | 4,834 | 2.765625 | 3 | [] | no_license | package usecase
import (
"database/sql"
"github.com/NikitaLobaev/BMSTU-DB/internal/models"
"github.com/NikitaLobaev/BMSTU-DB/internal/thread/repository"
. "github.com/NikitaLobaev/BMSTU-DB/internal/tools/response"
VoteUsecase "github.com/NikitaLobaev/BMSTU-DB/internal/vote/usecase"
"github.com/labstack/gommon/lo... |
C++ | UTF-8 | 1,083 | 2.703125 | 3 | [] | no_license | #pragma once
#include <string>
#include <map>
#include <memory>
# include <boost/serialization/base_object.hpp>
# include <boost/serialization/shared_ptr.hpp>
# include <boost/serialization/map.hpp>
/**
* @brief Contains a trie's node
*/
template<typename key_type>
class trie_node
{
public:
template<typena... |
C++ | UTF-8 | 498 | 4.1875 | 4 | [] | no_license | /* Using char[] */
// CPP program to illustrate char
// concatenation using standard functions
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
// take large size of array
char str[] = "Hello";
cout << "Before Concatenation : " << str << endl; // Hello
strcat(str,... |
C# | UTF-8 | 3,096 | 3.1875 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using SQLite;
using HangmanWordGame.Resources;
using System.IO;
namespace HangmanWordGame
{
class SqlConnection
{
private string dbpath { get; set; }
private SQLiteConnection db { get; set; }
public SqlConnection()
{
... |
PHP | UTF-8 | 865 | 2.953125 | 3 | [] | no_license | <?php
namespace Ecommerce\Shipping;
use Ecommerce\Address\Address;
use Ecommerce\Cart\Cart;
use Ecommerce\Customer\Customer;
class GetData
{
private Cart $cart;
private Customer $customer;
private Address $shippingAddress;
public static function create(): self
{
return new self();
}
public function getC... |
Markdown | UTF-8 | 630 | 3.96875 | 4 | [] | no_license | ### Insertion sort
[참고자료](https://gmlwjd9405.github.io/2018/05/06/algorithm-insertion-sort.html)
**코드**
```java
import java.util.Arrays;
public class Insertion_sort {
public static void main(String[] args) {
int[] input = {6, 15, 5, 7, 25, 12};
insertion_sort(input);
System.out.println(Arrays.toString(input)... |
Java | UTF-8 | 807 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | package pro.taskana.user.api.exceptions;
import java.util.Map;
import pro.taskana.common.api.exceptions.ErrorCode;
import pro.taskana.common.api.exceptions.TaskanaException;
import pro.taskana.user.api.models.User;
/**
* This exception is thrown when a specific {@linkplain User} referenced by its {@linkplain
* User... |
C# | UTF-8 | 4,387 | 2.59375 | 3 | [
"BSD-3-Clause"
] | permissive | /*
* Copyright (c) 2014, Furore (info@furore.com) and contributors
* See the file CONTRIBUTORS for details.
*
* This file is licensed under the BSD 3-Clause license
* available at https://raw.github.com/furore-fhir/spark/master/LICENSE
*/
using System;
using System.Collections.Generic;
using System.IO;
using... |
Java | UTF-8 | 992 | 1.976563 | 2 | [
"Apache-2.0"
] | permissive | package com.services.pojo.csedemo;
import com.services.pojo.csedemo.model.Person;
import java.util.List;
import javax.validation.constraints.*;
import io.servicecomb.provider.pojo.RpcSchema;
import com.services.pojo.csedemo.Csedemo;
@javax.annotation.Generated(value = "io.swagger.codegen.languages.CsePojoCodegen", d... |
Java | UTF-8 | 1,811 | 2.640625 | 3 | [] | no_license | import com.google.common.base.Objects;
/**
* @author patrick
*/
public class DocumentSimilarity implements Comparable<DocumentSimilarity> {
private double distance;
private int rank;
private String targetDocument;
private String index;
private String className;
public DocumentSimilarity(doub... |
Python | UTF-8 | 1,046 | 2.9375 | 3 | [] | no_license | import sqlite3
import sys
import json
def get_print(id):
conn = sqlite3.connect('scorelib.dat')
cur = conn.cursor()
cur.execute('SELECT person.name, person.born, person.died '
'FROM print '
'INNER JOIN edition ON print.edition = edition.id '
'INNER JOIN score... |
C# | UTF-8 | 45,184 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | /*
* 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")... |
Markdown | UTF-8 | 1,971 | 2.625 | 3 | [] | no_license | # Socketry
A portmanteu of Socket and Wizardry. We'll see if that pans out.
Something something "socket activation."
## Running
```
make bin/server
./hack/run.sh
```
or
```
./hack/runc.sh
./hack/run.sh runc run server
```
and
```
curl --unix-socket ./service.sock
```
## Rough Sketch
Zero downtime deployments ... |
C# | UTF-8 | 803 | 3.15625 | 3 | [] | no_license | private void setInformation(DataTable dt, List<string> text)
{
var cache = new Dictionary<string, int>(); //cache column numbers
foreach(var entry in text) cache[entry] = getColumnNumberByValue(dt, entry);
for(int i=1; i < dt.Rows.Count; i++)
{
foreach(var entry in te... |
Java | UTF-8 | 464 | 2.046875 | 2 | [] | no_license | package com.algaworks;
import java.math.BigDecimal;
import com.algaworks.bean.PedidoVendaService;
import com.algaworks.model.PedidoVenda;
import com.algaworks.util.cdi.WeldContext;
public class Principal {
public static void main(String[] args) {
PedidoVendaService service = WeldContext.INSTANCE.getBean(PedidoVe... |
Ruby | UTF-8 | 684 | 3.09375 | 3 | [] | no_license | require_relative "base_repository"
require_relative "../models/meal"
class MealRepository < BaseRepository
# def initialize(csv_file)
# @csv_file = csv_file
# @meals = []
# @next_id = 1
# load_meals if File.exists?(@csv_file)
# end
# def all
# @meals
# end
# def find(meal_id)
# @me... |
C# | UTF-8 | 15,278 | 3.765625 | 4 | [] | no_license | namespace Set
{
using System;
using System.Collections;
using System.Collections.Generic;
/// <summary>
/// Class that implements a set as a binary search tree
/// </summary>
/// <typeparam name="T">type of the elements of a set</typeparam>
public class Set<T> : ISet<T>
where T... |
C# | UTF-8 | 3,309 | 3.265625 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
namespace Generic.Extend
{
/// <summary>
/// .NET 4.0
/// 只能放在接口或者委托的泛型参数里面
/// out 协变covariant 修饰返回值
/// in 逆变contravariant 修饰传入的参数
/// 逆变和协变只能放在泛型接口和泛型委托的泛型参数里
/// <see cref="https://www.cnblogs.com/wangbaicheng1477865665... |
Python | UTF-8 | 5,055 | 3.484375 | 3 | [] | no_license | """
Class for a classification algorithm.
"""
import pdb
import numpy as np
import math
class Naive_Bayes:
def __init__(self, classifier_type, **kwargs):
"""
Initializer. Classifier_type should be a string which refers
to the specific algorithm the current classifier is using.
... |
Shell | UTF-8 | 1,984 | 3.46875 | 3 | [] | no_license | #!/bin/bash
#
#DESCRIPTION
# Monitor usage of cohesity view using listViews.py python script
#
#NOTES
# File Name : usage_cohesity_view.sh
# Author : Miquel Mariano - @miquelMariano | https://miquelmariano.github.io
# Version : 1
#
#USAGE
# Put this script on /var/prtg/scriptsxml and use "SSH script ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.