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 |
|---|---|---|---|---|---|---|---|
Python | UTF-8 | 467 | 3.21875 | 3 | [] | no_license | from easygui import *
import sys
# A nice welcome message
ret_val = msgbox("Hello, World!")
if ret_val is None: # User closed msgbox
sys.exit(0)
msg = "What is your favorite flavor?\nOr Press <cancel> to exit."
title = "Ice Cream Survey"
choices = ["Vanilla", "Chocolate", "Strawberry", "Rocky Road"]
while True:
... |
Python | UTF-8 | 743 | 3.609375 | 4 | [] | no_license | # This exercise reads from one file and writes to another.
# Amith, 01/11
from sys import argv
# This allows us to check if a file exists.
from os.path import exists
script, from_file, to_file = argv
print "Copying from %s to %s" % (from_file, to_file)
# we could do these two on one line. How?
in_file = open(from_f... |
C | UTF-8 | 1,064 | 3.203125 | 3 | [
"MIT",
"LicenseRef-scancode-proprietary-license"
] | permissive | /*******************************************************************************
* NAME
* avv - angle between two vectors
*
* SYNOPSIS
* #include <math.h>
* #include <mcce.h>
*
* double avv(VECTOR v1, VECTOR v2);
*
* DESCRIPTION
* The avv() function returns the angle in r... |
JavaScript | UTF-8 | 416 | 3.453125 | 3 | [] | no_license | var fs = require('fs');
/*
//readFileSync 동기
console.log('A');
var result = fs.readFileSync('syntax/sample.txt','utf8');
console.log(result);
console.log('C');
//readFileSync는 return값을 줌.
*/
//readFileAsync 비동기
console.log('A');
fs.readFile('syntax/sample.txt','utf8',function(err,result){
console.log... |
Java | UTF-8 | 560 | 1.710938 | 2 | [] | no_license | package cn.sancell.xingqiu.goods.fragment.listener;
import cn.sancell.xingqiu.homeclassify.bean.ProductInfoDataBean;
import cn.sancell.xingqiu.homeuser.bean.AddressListDataBean;
public interface OnGoodsInfoListener {
void onScrollChange(float alpha); //滑动渐变
void showShareBtn(boolean canShare); //是否可分享
... |
Ruby | UTF-8 | 1,898 | 3.640625 | 4 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | require 'pry'
def get_first_name_of_season_winner(data, season)
new_array = []
data.each do |seasons, all_people|
if seasons == season
all_people.each do |person|
person.each do |statistic, value|
if value == "Winner"
new_array << person["name"].split(" ")
end
end
end
... |
PHP | UTF-8 | 1,284 | 2.59375 | 3 | [] | no_license | <?php
// required headers
header("Access-Control-Allow-Origin: *");
header("Content-Type: application/json; charset=UTF-8");
header("Access-Control-Allow-Methods: POST");
header("Access-Control-Max-Age: 3600");
header("Access-Control-Allow-Headers: Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested... |
Python | UTF-8 | 175 | 3.390625 | 3 | [] | no_license | # text1 = "hello"
# text2 = "world"
# print(text1, text2)
# print("the end", "or is it", "keep watching to learn about python", 456, 354)
print((lambda x, z: x + z) (10, 20)) |
Java | UTF-8 | 7,552 | 2.40625 | 2 | [] | no_license | package cn.edustar.jitar.pojos;
import java.io.Serializable;
import java.util.Date;
/**
* 教研活动的对象
* @author 孟宪会
*
*/
public class Action implements Serializable, Cloneable {
/**
*
*/
private static final long serialVersionUID = 6530165023991769371L;
/** 标识 */
@SuppressWarnings("unused"... |
C++ | UTF-8 | 840 | 3.609375 | 4 | [] | no_license | 给定一个整数,编写一个函数来判断它是否是 2 的幂次方。
示例 1:
输入: 1
输出: true
解释: 2^0 = 1
示例 2:
输入: 16
输出: true
解释: 2^4 = 16
示例 3:
输入: 218
输出: false
-------------------------------------
思路:如果是2的幂,则二进制数必然是 1后面n个0(n∈[0,+无穷)) 这样的形式
所以采用位移算法,有0时不管,遇到1时就判断这个数再位移一位后是不是0
---------------------------------
class Solution {
public:
bool isPower... |
Markdown | UTF-8 | 2,904 | 3.703125 | 4 | [
"MIT"
] | permissive | ---
title: "1. Linked List - Singly Linked List"
tag: DataStructure
---
singly linked list
- 한 방향으로 노드가 노드를 가리키는 구조
- 노드는 data 와 link 를 가진다
- 보통 que(fifo) 를 구현 할 때 이런 방법을 많이 쓴다
- 첫번째 데이터 추가/삭제 시에 O(1), 데이터 검색은 O(n)
- 단점: 검색할 때 무조건 앞쪽부터 노드를 쭉 거쳐야 하므로
index 를 사용하는 array 보다 비효율적
- 장점: 데이터 수정 시 이동이 필요... |
Java | UTF-8 | 251 | 2.1875 | 2 | [] | no_license | package HW_10.task_2;
public class Journal extends Library {
int yetAnotherPrametr;
public Journal(String title, String author, int yetAnotherPrametr){
super(title, author);
this.yetAnotherPrametr = yetAnotherPrametr;
}
}
|
Python | UTF-8 | 2,190 | 2.765625 | 3 | [] | no_license | # FOR CCA EDITING ONLY
from IPython.core.magic import (Magics, magics_class, cell_magic)
from re import sub
@magics_class
class CCAMagics(Magics):
@cell_magic
def write2file(self, line, cell):
"""
Purpose:
This magic-hack executes the current cell or writes it to a file, the twist wi... |
Java | UTF-8 | 352 | 2.046875 | 2 | [] | no_license | package org.marcoavila.ddd.transaction;
import org.marcoavila.ddd.Entity;
import org.marcoavila.ddd.facade.BaseReturn;
/**
* Abstraction that represents an Domain transaction.
*
* @author Marco Avila
*/
public interface DomainTransaction<AGGREGATE extends Entity<?>> {
public BaseReturn<AGGREGATE> e... |
PHP | UTF-8 | 1,024 | 2.625 | 3 | [
"MIT"
] | permissive | <?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateGameServerPlayerStats extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('game_s... |
Java | UTF-8 | 1,006 | 3.0625 | 3 | [] | no_license | package com.im.sky.lock.juc.aqs.test;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.LockSupport;
/**
* @author jiangchangwei
* @date 2019-11-30 下午 4:08
**/
public class LockSupportTest {
private static ConcurrentLinkedQueue<Thread>... |
Java | UTF-8 | 738 | 2.125 | 2 | [] | no_license | package fr.valkya.valkyris.client.gui.faction;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.gui.GuiScreen;
public class GuiFacInfos extends GuiScreen {
public static List<String> infos;
public GuiFacInfos() {
infos = new ArrayList<String>();
}
@Override
public void init... |
JavaScript | UTF-8 | 3,943 | 2.5625 | 3 | [] | no_license | require('dotenv').config();
const express = require('express');
const cors = require('cors');
const request = require('superagent');
const app = express();
app.use(cors());
let latitude;
let longitude;
app.get('/location', async(req, res, next) => {
try {
const location = req.query.search;
const ... |
Python | UTF-8 | 416 | 3.421875 | 3 | [] | no_license | '''
def palindrom(n):
k = 0
temp = n
while n > 0:
k += (n % 10)
k *= 10
n = n/10
return (k/10) == temp
'''
def palindrom(n):
return list(reversed(str(n))) == list(str(n))
def prime(n):
for i in range(2,n):
if(n % i == 0): return False
return True
i = 0
temp =... |
Java | UTF-8 | 4,882 | 1.929688 | 2 | [
"MIT"
] | permissive | package me.prettyprint.hom.openjpa;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import org.apache.openjpa.kernel.OpenJPAStateManager;
import org.apache.openjpa.meta.ClassMetaData;
import org.apache.openjpa.meta.FieldMetaData;
import org.apache.openjpa.meta... |
Markdown | UTF-8 | 343 | 3.140625 | 3 | [] | no_license | # Literally Just Stairs
A minecraft datapack which changes the stair recipe to be more realistic.
<h1>Reasoning For Changes</h1>
<br>
<p>My reasoning for this stems from the fact that a minecraft stair is exactly 3/4 of a block. This means that if you put in 6 planks, as the recipe requires, 6 * 3/4 = 8, so you should... |
Swift | UTF-8 | 3,155 | 3.046875 | 3 | [] | no_license | //
// Machine.swift
// ImageMachinev2
//
// Created by Ilyasa Azmi on 12/03/20.
// Copyright © 2020 Ilyasa Azmi. All rights reserved.
//
import Foundation
import UIKit
import os.log
class Machine: NSObject, NSCoding {
//MARK: Properties
var name: String
var photo: UIImage?
// var rating: ... |
Go | UTF-8 | 6,168 | 2.78125 | 3 | [
"MIT"
] | permissive | package usecase
import (
"context"
"fmt"
"github.com/camphor-/relaym-server/domain/entity"
"github.com/camphor-/relaym-server/domain/event"
"github.com/camphor-/relaym-server/domain/repository"
"github.com/camphor-/relaym-server/domain/spotify"
)
// SessionUseCase はセッションに関するユースケースです。
type SessionUseCase struct... |
Python | UTF-8 | 151 | 2.65625 | 3 | [] | no_license | import json
from sklep import warzywa_i_owoce
print(warzywa_i_owoce)
dane_json = json.dumps(warzywa_i_owoce)
print(dane_json)
print(type(dane_json)) |
C++ | UTF-8 | 14,901 | 2.71875 | 3 | [
"MIT"
] | permissive | #include <CMathGeom3D.h>
#include <CPlane3D.h>
#include <CNPlane3D.h>
#include <CMathGen.h>
#include <CPoint3D.h>
#include <CVector3D.h>
#include <CLine3D.h>
#include <CTriangle3D.h>
#include <CMatrix3D.h>
#include <CMatrix3DH.h>
//! polygon orientation - clockwise or anti-clockwise
CPolygonOrientation
CMathGeom3D::
P... |
Markdown | UTF-8 | 1,814 | 3.203125 | 3 | [] | no_license | 1. Our functional code is already pretty compact, so we probably won't be looking
at it.
What we illustrate here is refactoring our test code, since it isn't very
maintainable as-is.
2. One easy update we can make is to use pytest fixtures. These are used to
simplify the setup/teardown of tests.
... |
C# | UTF-8 | 2,796 | 2.71875 | 3 | [
"MIT"
] | permissive | // This is an open source non-commercial project. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
/* TreeNode.cs -- generic tree node
* Ars Magna project, http://arsmagna.ru
* -------------------------------------------------------
* Status: poor
*/
#... |
C++ | UTF-8 | 2,290 | 3.703125 | 4 | [] | no_license | // Author: Trevor Parsons
// Date: 6/20/18
// Description: Main function of HW1 that creates an arry of
// 20 random variables from 1-100, sorts the array by ascending value, and
// then promps the user for a number between 1-100 and tells the user if
// that value is in the array of random numbers.
#include <iostr... |
C | UTF-8 | 645 | 4.15625 | 4 | [] | no_license | /* 13. (MAT 89) Dizemos que um inteiro positivo n é perfeito se for igual à soma de seus divisores positivos
diferentes de n.
Exemplo: 6 é perfeito, pois 1+2+3 = 6.
Dado um inteiro positivo n, verificar se n é perfeito. */
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(){
int n, i,... |
Python | UTF-8 | 1,410 | 3.28125 | 3 | [] | no_license | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def buildTree1(self, preorder, inorder):
if len(preorder) == 0:
return None
root = TreeNode(preorder[0])
rootidx = -1
for index, ... |
SQL | UTF-8 | 795 | 3.890625 | 4 | [] | no_license | use furama_database;
-- 7. Hiển thị thông tin IDDichVu, TenDichVu, DienTich, SoNguoiToiDa, ChiPhiThue, TenLoaiDichVu
-- của tất cả các loại dịch vụ đã từng được Khách hàng đặt phòng trong năm 2018
-- nhưng chưa từng được Khách hàng đặt phòng trong năm 2019.
select dv.id_dich_vu,dv.ten_dich_vu,dv.dien_tich,dv.so_ng... |
Java | UTF-8 | 921 | 3 | 3 | [] | no_license | package com.itheima.test11;
import java.util.Arrays;
import java.util.Random;
public class DoubleColorBallUtil {
// 产生双色球的代码
public static String create() {
String[] red = {"01","02","03","04","05","06","07","08","09","10",
"11","12","13","14","15","16","17","18","19","20","21","22","23",
"24","25","26","... |
C | UTF-8 | 1,495 | 4.03125 | 4 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
typedef struct queue
{
int capacity;
int rear, front;
int *arr;
} queue;
int main()
{
queue *q = NULL;
q = createQueue(4);
int item;
while(1)
{
system("cls");
printMetaDeta(q);
switch(menu())
... |
C++ | UTF-8 | 804 | 2.6875 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <map>
#include <vector>
#include <algorithm>
#include <math.h>
#define pb push_back
using namespace std;
int h;
int w = 1;
void printfChar(char c, int n) {
for (int i = 0; i < n; i++)
printf("%C", c... |
C | UTF-8 | 585 | 3.578125 | 4 | [] | no_license | #include<stdio.h>
#include<stdlib.h>
char * inputstring();
int main()
{
char *a;
char ch;
int num = 0, i;
printf("Input the sentence : ");
a = inputstring();
printf("result : ");
printf("%s\n", a);
return 0;
}
char * inputstring()
{
char *a, *temp;
char c;
int i, count = 0;
while(1)
{
scanf("%c",... |
Markdown | UTF-8 | 5,958 | 2.640625 | 3 | [] | no_license | # <img src="/res/xsdk-logo.png" width="128">
Draft document generated by the IDEAS xSDK project.
We are actively soliciting suggestions from the community at https://xsdk.info/policies.
# xSDK Community Installation Policies
Version 0.5.0, June 27, 2019
[https://xsdk.info/policies](https://xsdk.info/policies)
## ... |
C++ | UTF-8 | 879 | 2.65625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
#define fore(i, l, r) for(int i = (int)l; i <= (int)r; i++)
const int MAXN = 1e5 + 5;
int n;
int arr[MAXN];
int main(){
cin>>n;
fore(i,1,n){
cin>>arr[i];
}
vector<int> res;
bool flag = true;
res.push_back(arr[1]);
fore(i,2,n){
... |
PHP | UTF-8 | 2,551 | 2.90625 | 3 | [] | no_license | <?php
namespace Prokl\CollectionExtenderBundle\Services\Extenders;
use Illuminate\Support\Arr;
use Illuminate\Support\Collection;
/**
* Class Pick
* @package Prokl\CollectionExtenderBundle\Extenders
* Расширение Collections: pluck по нескольким полям.
*
* @since 16.09.2020
* @since 20.09.2020 Проверка на сущес... |
Java | UTF-8 | 2,729 | 2.25 | 2 | [] | no_license | package com.iamcure.ui.servlet;
import java.io.IOException;
import java.util.Calendar;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.iamcure.bo.listener.MedicalStoreListener;
import... |
C | UTF-8 | 2,181 | 2.6875 | 3 | [
"Unlicense"
] | permissive | /* DannyNiu/NJF, 2018-02-01. Public Domain. */
#include "rijndael.h"
#include <x86intrin.h>
#define NI_Define_AES_Cipher(name,Nr) \
void name(void const *in, void *out, \
void const *restrict w) \
{ \
NI_Rijndael_Nb4... |
Swift | UTF-8 | 1,100 | 2.96875 | 3 | [] | no_license | import SwiftUI
struct MatchView: View {
let teamShieldSize: CGFloat = 45.0
let xSymbolSize: CGFloat = 20.0
var match: Match!
var body: some View {
HStack() {
HStack() {
Text(match.homeTeam)
.font(.system(size: 20.0))
Image(mat... |
JavaScript | UTF-8 | 2,306 | 2.640625 | 3 | [
"MIT"
] | permissive | const db = require( './database' )
const brcypt = require( 'bcrypt' )
const saltRounds = process.env.SALT
const create = ( username, email, password ) => {
bcrypt.hash( password, saltRounds )
.then( hash => {
return db.query(`
INSERT INTO member
( username, email, password )
VALUE... |
Java | UTF-8 | 1,914 | 1.53125 | 2 | [
"Apache-2.0"
] | permissive | /*******************************************************************************
* Copyright 2016, The IKANOW Open Source Project.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
... |
PHP | UTF-8 | 750 | 2.828125 | 3 | [] | no_license | <?php
use PHPMailer\PHPMailer\Exception;
use PHPMailer\PHPMailer\PHPMailer;
class MailSender
{
public static function sendMessage($email, $subject, $message)
{
$mail = new PHPMailer(true);
try {
//Server settings
$mail->isSMTP();
$mail->Host = 'smtp.mailtrap.io';
$mail->SMTPAuth = true;
$mail->Us... |
SQL | UTF-8 | 766 | 2.5625 | 3 | [
"MIT"
] | permissive | create database glycol;
use glycol;
create table orderTable (
log_date char(10) not null,
log_time char(8) not null,
side varchar(4) not null,
amount double not null,
outstanding_size double not null,
average_price int not null,
child_order_acceptance_id varchar(32) not null,
child_order_sta... |
TypeScript | UTF-8 | 944 | 2.640625 | 3 | [
"MIT"
] | permissive | interface FirestoreOptionsData {
aiScoreMultiplier: number;
animationDuration: number;
hintLineWidth: number;
hintRadius: number;
hintTime: number;
roundDuration: number;
roundsNumber: number;
}
interface FirestoreImageData {
clicks: { clickCount: number; x: number; y: number }[];
correctClicks: numb... |
Swift | UTF-8 | 1,237 | 2.9375 | 3 | [
"MIT"
] | permissive | //
// Constants.swift
// RBTreeUI
//
// Created by LiLi Kazine on 2019/3/5.
// Copyright © 2019 LiLi Kazine. All rights reserved.
//
import UIKit
class Colors {
static let red = hex2Color(hex: "cf3030")!
static let red_light = hex2Color(hex: "f67280")!
static let blue = hex2Color(hex: "35477d")!
... |
Java | UTF-8 | 186 | 2.15625 | 2 | [] | no_license | package com.platzhaltr.util.date.result;
import java.util.Date;
/**
* An event without the specification of a time.
*/
public interface Event {
Date getStart();
Date getEnd();
}
|
Markdown | UTF-8 | 12,539 | 2.640625 | 3 | [
"MIT"
] | permissive | ---
title: skill
description:
categories:
- skill
tags:
---
<!-- TOC -->
- [1. skill系统](#1-skill%E7%B3%BB%E7%BB%9F)
- [1.1. 指向性skill](#11-%E6%8C%87%E5%90%91%E6%80%A7skill)
- [1.2. 范围性skill](#12-%E8%8C%83%E5%9B%B4%E6%80%A7skill)
- [1.3. 无锁定skill](#13-%E6%97%A0%E9%94%81%E5%AE%9Askill)
- [2. ski... |
Ruby | UTF-8 | 1,733 | 4.4375 | 4 | [] | no_license | #sets the people variable to 30
people = 30
#sets the cars variable to 40
cars = 40
#sets the trucks variable to 15
trucks = 15
#If cars are greater than people print a statement
if cars > people
#The statement that would printed if the conditions are right
puts "We should take the cars."
# if the above statement... |
C++ | UTF-8 | 6,889 | 3.15625 | 3 | [] | no_license | #include <algorithm>
#include <cstdint>
#include <fstream>
#include <iostream>
#include <unordered_map>
#include <utility>
enum class PositionState {
INVALID,
FLOOR,
AVAILABLE,
OCCUPIED,
};
class Coord {
int16_t x;
int16_t y;
public:
Coord(int16_t x, int16_t y) noexcept : x{x}, y{y} {}
... |
JavaScript | UTF-8 | 827 | 4.84375 | 5 | [] | no_license | /*
Acccessing array[-1]
In some programming languages, we can access array elements using negative indexes, counted from the end.
Like this:
let array = [1, 2, 3];
array[-1]; // 3, the last element
array[-2]; // 2, one step from the end
array[-3]; // 1, two steps from the end
In other words, array[-N] is the same as... |
Python | UTF-8 | 1,016 | 2.578125 | 3 | [
"MIT"
] | permissive | from sklearn.metrics import mean_squared_error
from scipy.stats.stats import pearsonr
from copy import copy
def ForwardPropFeatureImp(model, X_true, Y_true, mp):
'''
Leave one feature out importance
'''
try:
df_grid = mp.df_grid
except:
H_grid = mp.plot_grid()
df_grid = ... |
Python | UTF-8 | 837 | 3.515625 | 4 | [] | no_license | # coding: utf8
# 两个单链表生成相加链表
class Node(object):
def __init__(self,data,_next = None):
self.data = data
self._next = _next
def addList(head1,head2):
s1 = []
s2 = []
while head1:
s1.append(head1.data)
head1 = head1._next
while head2:
s2.append(head2.data)
... |
Python | UTF-8 | 269 | 2.65625 | 3 | [
"MIT"
] | permissive | import importlib
import unittest
solver = importlib.import_module('2020_17_2')
class Test2020Day17Part2(unittest.TestCase):
def test_example1(self):
input = (
'.#.\n'
'..#\n'
'###\n'
)
self.assertEqual(solver.solve(input), 848)
|
Markdown | UTF-8 | 949 | 2.6875 | 3 | [] | no_license | ## Project List:
### 1. hs-dbms: Housing Society - Database Management System
#### About this project:
An application that provides a GUI to access a database. In this particular application, the database is a Housing Society Database Management System (HSDbMS).
#### Libraries used:
Swing, AWT for the GUI and MySQ... |
Java | UTF-8 | 1,963 | 2.421875 | 2 | [
"Apache-2.0"
] | permissive | package com.andreas.main.stages.themeSelectorStage;
import java.io.File;
import com.andreas.main.App;
import com.andreas.main.FileUtils;
import com.andreas.main.app.AppController;
import com.andreas.main.stages.StageUtils;
import org.jdom2.Element;
import javafx.fxml.FXML;
import javafx.scene.control.ComboBox;
impo... |
C# | UTF-8 | 2,343 | 3.203125 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MahjongApp
{
class Game
{
private Field Field;
private Tuple<int, int> DicePointer;
private Tuple<int, int> ChosenDices... |
Markdown | UTF-8 | 3,592 | 2.890625 | 3 | [
"Apache-2.0"
] | permissive | ---
title: Built-in Functions
---
## panic
#
```cadence
fun panic(_ message: String): Never
```
Terminates the program unconditionally
and reports a message which explains why the unrecoverable error occurred.
```cadence
let optionalAccount: AuthAccount? = // ...
let account = optionalAccount ?? panic("mi... |
C# | UTF-8 | 794 | 3.078125 | 3 | [] | no_license | public static BaseTypeFactory
{
public enum Types { DerType1, DerType2, DerType3 }
public static BaseType CreateInstance(Types type)
{
switch(type)
{
case Types.DerType1:
return (BaseType) Activator.
Cre... |
Java | UTF-8 | 1,023 | 2.546875 | 3 | [] | no_license | /*
* Author: Wing Cheang Mok
* Student Number: s3697904
* Course: ISYS1118 Software Engineering Fundamentals
* Assignment: Supermarket Support System
*/
package consoleMenu;
import java.sql.SQLException;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import data.DatabaseManager;
impor... |
Python | UTF-8 | 6,179 | 3.171875 | 3 | [] | no_license | """
XTEA Block Encryption Algorithm
Original Code: http://code.activestate.com/recipes/496737/
Algorithm: http://www.cix.co.uk/~klockstone/xtea.pdf
>>> import os
>>> x = xtea.xtea()
>>> iv = 'ABCDEFGH'
>>> z = x.crypt('0123456789012345','Hello There',iv)
>>> z.encode('hex')
'fe196d0a40d6c2... |
Python | UTF-8 | 229 | 2.84375 | 3 | [] | no_license | def countBitsFlip(a,b):
##Your code here
ans = 0
while a != 0 or b != 0:
if a%2 != b%2:
ans += 1
a //= 2
b //= 2
return ans
|
Java | UTF-8 | 2,356 | 3.65625 | 4 | [] | no_license | package com.codeChefMedium.Sieve;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;
public class NumberOfFactorsSieve {
public static void main(String args[]) throws Exception
{
int i,j,k;
boolean prime[] = new boolean[1000001];
for(i=2;i*i<=1000000;i++)//http://s... |
C++ | UHC | 336 | 3.15625 | 3 | [] | no_license | #include <stdio.h>
int main(){
//10. Ҽ(prime-number) ˻ ϰ ڰ Է μ ϴ α ۼϽÿ.
int a, n;
printf(" Էϼ :");
scanf_s("%d", &a);
for(n=1; n<=a; n=n+1){
if (a%n==0) { printf ("%d %d\n",a,n);
}
}
}
|
JavaScript | UTF-8 | 1,236 | 2.640625 | 3 | [] | no_license | const express = require('express');
const router = express.Router();
const data = require("../data");
const locaitonData = data.locations;
// Single Location Page
router.get("/:id", (req, res) => {
// Find a location by the provided id,
// then display its information
// As well as listing all events tha... |
C++ | UTF-8 | 752 | 3.03125 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <deque>
using namespace std;
const int SIZE = 5;
char arr[SIZE] = { 'a', 'e', 'i', 'o', 'u' };
int main() {
string str;
cin >> str;
while (str != "#") {
int flag = 0;
int str_sz = str.size();
deque <char> dq;
for (int i = 0;i < str_sz;i++)
dq.push_back(str[i]... |
Markdown | UTF-8 | 5,538 | 3.0625 | 3 | [
"Apache-2.0"
] | permissive | # CppCon 2018: Parallel Programming with Modern C++: from CPU to GPU
This repository provides set up instructions and the exerises for the CppCon parallel programing class.
## Pre-requisites
The majority of the exercises will require a only standard C++17 compliant compiler, however if for any reason you cannot use ... |
PHP | UTF-8 | 1,819 | 2.875 | 3 | [] | no_license | <?php
namespace App\Service;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
class CartService
{
private $session;
/**
* CartService constructor.
*/
public function __construct(SessionInterface $session)
{
$this->session = $session;
}
public function getAl... |
TypeScript | UTF-8 | 920 | 3.25 | 3 | [] | no_license | import PVector from './p-vector'
export default class Brain {
step: number
directions: PVector[]
constructor(size: any) {
this.step = 0;
this.directions = [...Array(size)].map(() => {
const randomAngle = random(2 * Math.PI)
const vec = PVector.fromAngle(randomAngle)
return vec
})
}
clone() {
co... |
Java | UTF-8 | 390 | 2.171875 | 2 | [] | no_license | package com.ciuc.andrii.daggertest.model.custom_garage.car.engine;
import javax.inject.Inject;
public class Engine {
Block block;
Cylinders cylinders;
SparkPlugs sparkPlugs;
@Inject
public Engine(Block block, Cylinders cylinders, SparkPlugs sparkPlugs) {
this.block = block;
this... |
Java | UTF-8 | 17,998 | 1.835938 | 2 | [] | no_license | package com.guiji.robot.service.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.guiji.common.model.process.ProcessInstanceVO;
import com.guiji.process.model.ProcessReleaseVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFact... |
Markdown | UTF-8 | 1,212 | 2.859375 | 3 | [] | no_license | # Alt Fuel Finder
Simple app to view alternative fuel stations within 6 miles of a given zip code, limited to 10 results. Completed in a 2 hr period as a mid-mod assessment for mod 3 at Turing.
It uses the NREL alternative fuel station API data found [here](https://developer.nrel.gov/docs/transportation/alt-fuel-sta... |
C | UTF-8 | 413 | 2.640625 | 3 | [
"MIT"
] | permissive | #pragma once
#include "Main.h"
enum
{
FULL_WINDOW,
ASPECT_1_1,
EXIT
};
int Aspect = FULL_WINDOW;
void Menu(int value)
{
switch (value)
{
case FULL_WINDOW:
Aspect = FULL_WINDOW;
Reshape(glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT));
break;
case ASPECT_1_1:
Aspect = ASPECT_1_1;
Reshape(gl... |
Java | UTF-8 | 729 | 2.859375 | 3 | [] | 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 akatkar.exam03.makeupQuestions;
/**
*
* @author akatkar
*/
public class Question7 {
public int getMax(int... |
Python | UTF-8 | 3,081 | 2.53125 | 3 | [] | no_license | import unittest
from selenium import webdriver
from django.test import TestCase
import time
URL = "http://raplev.com:8080"
class SellVisitorTest (TestCase):
def setUp(self):
self.browser = webdriver.Firefox()
def tearDown(self):
self.browser.quit()
def test_user_signup_and_login(self)... |
C++ | UTF-8 | 1,151 | 2.84375 | 3 | [
"MIT"
] | permissive | #ifndef __PLAYER__
#define __PLAYER_
#include <SFML/Graphics.hpp>
#include <array>
#include <map>
enum class PlayerSide { left, right };
enum class PaddleMoveDiretion { UP = -1, DOWN = 1 };
struct Paddle {
const float y_width_center = 128 / 2;
const float x_width = 8;
const float y_width = 128;
float y_posi... |
Java | UTF-8 | 9,881 | 2.84375 | 3 | [] | no_license | package mksinterface.mksitem.src;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import com.mks.api.response.Field;
import com.mks.api.response.Item;
/**
* This special field class represents a full field of an item in Integrity.
* You are able to feed the cla... |
Python | UTF-8 | 1,511 | 3.203125 | 3 | [] | no_license | import random
import string
days = ['Nov 12 2018 ', 'Nov 13 2018 ', 'Nov 14 2018 ']
s = ""
def random_string(string_length=10):
letters = string.ascii_lowercase
return ''.join(random.choice(letters) for _ in range(string_length))
def add_edge(mail1, mail2):
global s
s += mail1 + "," + mail2 + "," ... |
Python | UTF-8 | 4,318 | 2.53125 | 3 | [] | no_license | # -*- coding:utf-8 -*-
from __future__ import print_function
import codecs
import numpy as np
import math
import heapq
import random
import sys
import os
negNum = 100
def get_hit_ratio(rank_list, target_item):
for item in rank_list:
if item == target_item:
return 1
return 0
def get_ndcg... |
Java | UTF-8 | 558 | 3.21875 | 3 | [] | no_license | package arrays;
import java.util.Arrays;
public class Person {
public static void main(String[] args) {
int []ages=new int[5];
ages[0]=12;
ages[1]=22;
ages[2]=32;
ages[3]=42;
ages[4]=52;
System.out.println(Arrays.toString(ages));
String[]names=new String[4];
names[0]="can";
names[1]="ali";
n... |
C# | UTF-8 | 5,293 | 2.703125 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Timers;
using System.Xml.Serialization;
using LotteryVoteMVC.Models;
using System.Web;
namespace LotteryVoteMVC.Core
{
public class TodayLotteryCompany
{
private static object _lockHelpe... |
Python | UTF-8 | 6,482 | 2.671875 | 3 | [] | no_license | import numpy as np
import pandas as pd
import os
import cv2
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.metrics import roc_auc_score
import torch
from torch.utils.data import TensorDataset, DataLoader,Dataset
import torch.nn as nn
import torch.nn.functional as F
im... |
JavaScript | UTF-8 | 6,331 | 2.921875 | 3 | [
"MIT"
] | permissive | 'use strict';
var _ = require('lodash');
var expect = require('must');
var Cache = require('../cache');
function loadTests(cb) {
cb(null, [
{ id: 1, name: 'test 1' },
{ id: 2, name: 'test 2' },
{ id: 3, name: 'test 3' },
]);
}
describe('Cache Tests', function() {
it('loads and gets when calling g... |
Ruby | UTF-8 | 211 | 3.453125 | 3 | [] | no_license | # while not <condition>
# <code>
# end
# until <condition>
# <code>
# end
# <code> until <condition>
i = 0
# while not 10 , runs from 0 to 9
until i >= 10
puts "#{i} is the value"
i += 1
end |
C++ | UTF-8 | 1,792 | 3.296875 | 3 | [
"MIT"
] | permissive | //UVa - 10660 - Citizen attention offices
//Iterative complete search - Generate all possible combinations 25C5
//Coordinate x, y becomes p = x*5 + y, get back x = p / 5, y = p % 5
#include <iostream>
#include <cstring>
using namespace std;
constexpr int INF{ 999999999 };
int dist( int a, int b)
{
return abs(a/5 - ... |
C++ | UTF-8 | 1,460 | 2.90625 | 3 | [] | no_license | #include <algorithm>
#include <iostream>
#include <queue>
#include <string>
#include <time.h>
#include <vector>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
int bfs(vector<vector<int>> &map, vector<vector<bool>> &vertex) {
queue<pll> q;
int di[] = {-1, 0, 1, 0}, dj[] = {0, 1, 0, -1};
int... |
C++ | UTF-8 | 289 | 2.796875 | 3 | [] | no_license | #include "CardGampe.h"
#include <iostream>
using namespace std;
CardGampe::CardGampe(int p)
{
players = p;
totalparticipants += p;
cout << p << " players have started a new game. there are now " << totalparticipants << " players in total" << endl;
}
CardGampe::~CardGampe(void)
{
}
|
Swift | UTF-8 | 634 | 2.78125 | 3 | [] | no_license | //
// PicsumCell.swift
// Picsum
//
// Created by Hari Krishna Bikki on 4/12/20.
//
import UIKit
class PicsumCell: UICollectionViewCell {
@IBOutlet weak var imageView: UIImageView!
@IBOutlet weak var author: UILabel!
func configure(with picsum: Picsum){
// assign the value t... |
C | UTF-8 | 224 | 2.578125 | 3 | [] | no_license | #include "./include/btree.h"
void btree_apply_infix(btree_t *root, int (*applyf)(void *))
{
if(root == 0)
return ;
btree_apply_infix(root->left, *applyf);
applyf(root->item);
btree_apply_infix(root->right, *applyf);
} |
C++ | UTF-8 | 1,636 | 2.546875 | 3 | [] | no_license |
#include "TimeClient.h"
#include <arale/base/Logging.h>
#include <arale/net/EventLoop.h>
#include <functional>
using namespace arale;
using namespace arale::net;
using namespace arale::base;
TimeClient::TimeClient(EventLoop *loop, const InetAddress &addr)
: loop_(loop),
client_(loop, "Time ... |
PHP | UTF-8 | 364 | 2.5625 | 3 | [
"MIT"
] | permissive | <?php
namespace App\Repositories;
interface ClientesRepository {
public function find($id);
public function findAll();
public function create($data);
public function update($id, $data);
public function save($object);
public function delete($object);
public function searchAndPaginate($queryS... |
C | UTF-8 | 5,624 | 3.15625 | 3 | [] | no_license | #include<stdio.h>
#include<conio.h>
#include <malloc.h>
#include<math.h>
#include<windows.h>
int i,j;
int n1,m1,n2,m2;
int getInt(int* a) //ввод целого числа
{
int n;
do {
n=scanf("%d",a);
if (n==0 || (*a<=0) )
{
printf ("Error");
scanf ("%*[^\n]");... |
Swift | UTF-8 | 4,032 | 3.171875 | 3 | [
"Apache-2.0",
"Swift-exception",
"BSD-3-Clause",
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | /*
This source file is part of the Swift.org open source project
Copyright (c) 2019 Apple Inc. and the Swift project authors
Licensed under Apache License v2.0 with Runtime Library Exception
See http://swift.org/LICENSE.txt for license information
See http://swift.org/CONTRIBUTORS.txt for Swift project authors... |
Swift | UTF-8 | 406 | 2.609375 | 3 | [] | no_license | //
// Declarations.swift
//
//
// Created by
//
import UIKit
func mainThread(_ code: @escaping (() -> ())) {
DispatchQueue.main.async {
code()
}
}
func secondThread(_ code: @escaping (() -> ())) {
DispatchQueue.global(qos: .background).async {
code()
}
}
func getScreenWidthPercent... |
Python | UTF-8 | 1,998 | 3.078125 | 3 | [] | no_license | from django.shortcuts import render # render will use for showing the html file on browser
from .models import Prime #Prime is models that is requre to import data to database from here
import datetime
def checkprime(x): #it is function that check is it prime or not
if x<=1:
return 0
else:
for ... |
Java | UTF-8 | 14,043 | 2.453125 | 2 | [] | no_license | /**
*
*/
package au.edu.anu.dspace.client.swordv2.digitisation.crosswalk;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import au.edu.anu.dspace.client.swordv2.digitisation.iiirecord.IIIRECORD;
import au.edu.anu.dspace.client.swordv2.digitisation.iiirecord.MARCSUBFLD;
import au.ed... |
Python | UTF-8 | 7,607 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | import math
import numpy as np
import torch
from torch import nn
from butterfly.complex_utils import complex_mul, conjugate
def toeplitz_krylov_transpose_multiply(v, u, f=0.0):
"""Multiply Krylov(Z_f, v_i)^T @ u.
Parameters:
v: (nstack, rank, n)
u: (batch_size, n)
f: real number
R... |
SQL | UTF-8 | 196 | 3.546875 | 4 | [] | no_license | SELECT sum(salary) FROM developers as dev
LEFT JOIN dev_skills AS dsk ON dev.id = dsk.developer_id
LEFT JOIN skills AS sk ON dsk.skills_id = sk.skill_id
WHERE sk.skill_description LIKE 'java'; |
Java | UTF-8 | 495 | 1.828125 | 2 | [] | no_license | package com.wuhan_data.mapper;
import java.util.List;
import java.util.Map;
import com.wuhan_data.pojo.ColPlate;
import com.wuhan_data.pojo.IndiCorrelative;
public interface ColPlateMapper {
public int add(ColPlate colPlate);
public void delete(int id);
public int update(ColPlate colPlate);
public List<C... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.