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 |
|---|---|---|---|---|---|---|---|
PHP | UTF-8 | 1,024 | 4.15625 | 4 | [] | no_license | <?php
class Triangle extends Shape
{
private $side1 = 1.0;
private $side2 = 1.0;
private $side3 = 1.0;
public function __construct($name, $side1, $side2, $side3)
{
parent::__construct($name);
$this->side1 = $side1;
$this->side2 = $side2;
$this->side3 = $side3;
... |
Python | UTF-8 | 2,544 | 2.875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Reddening functions used when simulating observations.
"""
from __future__ import (print_function, division)
import six
from six.moves import range
import sys
import os
import warnings
import math
import numpy as np
import warnings
__all__ = ["_madau_t1", "_madau_t... |
TypeScript | UTF-8 | 891 | 3.28125 | 3 | [
"Apache-2.0"
] | permissive | import * as lambda from '@aws-cdk/aws-lambda';
/**
* Properties to configure an API Gateway resource handler.
*
* The expectation is that you have a file that matches, e.g.
*
* This resource:
*
* new ResourceHandlerProps('user', 'get');
*
* is implemented in this file:
*
* lambda/user-get.ts
*/
export... |
C# | UTF-8 | 579 | 3.21875 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Prime
{
class Program
{
static void Main(string[] args)
{
int num = int.Parse(Console.ReadLine());
if (IsPrime(num)==true)
... |
Java | UTF-8 | 8,329 | 2.53125 | 3 | [] | no_license | package com.huangxj.common.core.utils;
import com.huangxj.common.core.model.OptionVo;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.BeanWrapper;
import org.springframework.bea... |
TypeScript | UTF-8 | 424 | 3.21875 | 3 | [] | no_license | function mergeSimilarItems(items1: number[][], items2: number[][]): number[][] {
let vwMap = new Map() //vw abbreviates value weight
for (let [value, weight] of items1.concat(items2)) {
if (!vwMap.has(value)) {
vwMap.set(value, weight)
} else {
vwMap.set(value, vwMap.get... |
PHP | UTF-8 | 15,294 | 2.828125 | 3 | [
"MIT"
] | permissive | <?php
/**
*
* This class has all the necessary code for making API calls thru curl library
* @category Helper
* @author Original Author <adrian@socialdiabetes.com>
* @link https://github.com/AdrianVillamayor/CurlHelper
*
*/
declare(strict_types=1);
namespace Adrii;
class CurlHelper
{
public s... |
C++ | UTF-8 | 790 | 2.5625 | 3 | [] | no_license | #include<iostream>
#include<queue>
#include<cstring>
using namespace std;
int K[200+5],vis[200+5]={0},dir[2]={-1,1};
int N,A,B;
struct fl{
int floor,min_count;
};
int bfs(){
queue<fl>q;
fl s1={A,0},s2;
vis[s1.floor] = 1;
q.push(s1);
while(!q.empty()){
s1 = q.front();
if(s1.floor == B){
cout << s1.min_count... |
C++ | UTF-8 | 267 | 2.921875 | 3 | [
"Unlicense"
] | permissive | #include "container/union_find.hpp"
int main() {
int n, q;
cin >> n >> q;
UnionFind uf(n);
for (int i = 0; i < q; ++i) {
int p, a, b;
cin >> p >> a >> b;
if (p == 0) uf.unite(a, b);
else cout << (uf.equal(a, b) ? "Yes" : "No") << endl;
}
}
|
Java | UTF-8 | 11,507 | 1.835938 | 2 | [] | no_license | package org.dainst.gazetteer.controller;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.dainst.gazetteer.converter.JsonPlaceDeserializer;
import org.dainst.gazet... |
TypeScript | UTF-8 | 438 | 2.703125 | 3 | [
"MIT",
"LicenseRef-scancode-generic-cla"
] | permissive | export interface PushNotification {
message: string | null;
title: string | null;
customProperties?: { [name: string]: string };
}
export interface PushListener {
onPushNotificationReceived?: (pushNotification: PushNotification) => void;
}
export function isEnabled(): Promise<boolean>;
export function... |
JavaScript | UTF-8 | 383 | 2.546875 | 3 | [] | no_license | function CastMoviAPI(movieId) {
const key = '6c43de172bd11aba3555d5548a35dbd3';
return fetch(
`https://api.themoviedb.org/3/movie/${movieId}/credits?api_key=${key}&language=en-US`,
).then(response => {
if (response.ok) {
return response.json();
}
return Promise.reject(new Error(`Ничего не н... |
Java | UTF-8 | 20,002 | 2.203125 | 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 mypackage;
import java.awt.HeadlessException;
import java.sql.*;
import java.sql.Connection;
import java.sql.Statement;
impor... |
Python | UTF-8 | 1,449 | 2.9375 | 3 | [] | no_license | import time
import datetime
DELTA_DEFAULT_DAYS = 180 # 6 months
class CommitCutoff(object):
def reset(self):
pass
def cutoff(self, commit):
return False
class MultipleCommitCutoff(CommitCutoff):
def __init__(self, *cutoffs):
self.cutoffs = cutoffs
def reset(self):
fo... |
C++ | UTF-8 | 515 | 3.09375 | 3 | [
"BSD-3-Clause",
"GPL-1.0-or-later",
"LGPL-2.0-only",
"LGPL-2.1-only",
"MIT",
"Zlib",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause"
] | permissive | #pragma once
namespace av {
class Rect
{
public:
Rect();
Rect(int width, int height);
Rect(int x, int y, int width, int height);
void setX(int x) { this->x = x; }
void setY(int y) { this->y = y; }
void setWidth(int w) { width = w; }
void setHeight(int h) { height = h; }
int getX() { ... |
Java | UTF-8 | 1,334 | 2.1875 | 2 | [] | no_license | package com.grabbddemoapp.data.model;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
/**
* Developer: Sandy
*/
public class AppVersion {
@SerializedName("latestAndroidVersion")
@Expose
private int latestAndroidVersion;
@SerializedName("criticalAndroidVe... |
Python | UTF-8 | 1,573 | 2.828125 | 3 | [] | no_license | #!/usr/bin/python3
'''
This is the '2-do_deploy_web_static module.
2-do_deploy_web_static uses Fabric to distribute an archive to selected web
servers.
This module contains 1 function: do_deploy().
'''
from fabric.api import *
env.hosts = ['34.207.77.115', '54.208.161.26']
def do_deploy(archive_path):
'''This ... |
C++ | GB18030 | 3,525 | 2.5625 | 3 | [] | no_license | #pragma once
#include "system.h"
#include <map>
#include <string>
#include "TexFrame.h"
#include "physicslib.h"
namespace sys
{
struct ImageDefine;
struct TextDefine;
}
namespace render
{
class Texture;
class Texture2D;
class TextureCubeMap;
//
class TextureCache
{
public:
TextureCache();
~TextureCach... |
Python | UTF-8 | 2,132 | 2.71875 | 3 | [] | no_license | import sys
import math
sys.path.append('/home/abhinav/Desktop/Academics/Summer/Python')
import numpy as np
import matplotlib.pyplot as plt
import time
from spin import *
from benchmark_ising import *
kb = 1.0
m = 4
n = 4
p = 1
if p > 1:
d = '3d'
elif p == 1:
d = '2d'
tp = 'ising'
qv = 0.0
jv = [0.0]*3
jv[0] = ... |
JavaScript | UTF-8 | 330 | 3.53125 | 4 | [] | no_license | // Create an HTML page with a large element on the page
// that says "Don't hover over me" inside of it.
// When you hover over the element, send an alert to the user
// that says, "Hey, I told you not to hover over me!"
document.getElementById('alert').onmouseover = function (){
alert('Hey, I told you not to hover... |
Java | UTF-8 | 1,191 | 2.6875 | 3 | [] | no_license | package hr.fer.zemris.java.servleti.colors;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet th... |
Java | UTF-8 | 1,910 | 2.140625 | 2 | [
"Apache-2.0"
] | permissive | /*
* Copyright 2016-2017 Axioma srl.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed... |
Markdown | UTF-8 | 6,303 | 2.953125 | 3 | [] | no_license | <br>
This webpage contains complementary material to the research paper:
| <a href="#img1"><img src="bannercolor.jpg" width="100" height="10"></a>| <a href="#img1"><img src="bannercolor.jpg" width="750" height="10"></a>|
|:---:|:---|
|[<img src="icon-pdf.png" width="50">](https://doi.org/10.1016/j.patcog.2021.108198)... |
Java | UTF-8 | 152 | 2.09375 | 2 | [
"Apache-2.0"
] | permissive | // "Escape trailing whitespace characters" "true"
class StringTemplate1 {
String s = STR."""
\{}one\s
two
four"\s""";
} |
Python | UTF-8 | 83 | 3.484375 | 3 | [] | no_license | def asteriscos(numero):
y = '*'*numero
return y
n = 7
print(asteriscos(n)) |
C++ | UTF-8 | 2,471 | 2.875 | 3 | [] | no_license | #ifndef CONSTANT_NODE_H_
#define CONSTANT_NODE_H_
#include <graph/Node.h>
namespace jags {
/**
* @short Top-level Node with constant value
*
* Constant nodes are the top-level nodes in any directed acyclic
* graph (i.e. they have no parents). They have a fixed value that is
* defined when they are constructed a... |
Python | UTF-8 | 1,019 | 2.609375 | 3 | [] | no_license | import math
n = int(input())
rank = []
for i in range(n):
s, p, f, o = map(int, input().split())
s = -1 * s
o = -1 * o
rank.append((s, p, f, o, i))
rank.sort()
score = [100, 75, 60, 50, 45, 40, 36, 32, 29, 26, 24, 22, 20, 18, 16,
15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
finalscore = [... |
C# | UTF-8 | 16,028 | 2.71875 | 3 | [] | no_license | using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Booklovers.Data;
using System;
using System.Linq;
using NLog.Web;
using NLog;
namespace Booklovers.Models
{
public static class SeedData
{
private static Logger logger = NLog.Web.NLogBuilder.ConfigureNLog("nlog.c... |
Python | UTF-8 | 1,780 | 4.125 | 4 | [] | no_license | #30th January class
import random as r
print(r.random()) #between 0 and 1 random value is generateed
print(r.uniform(1,10))
dice = [1,2,3,4,5,6];
print(r.choice(dice))
print(r.choice([1,2,3,4,5,6]))
print (r.sample(dice,2)) # population and size it takes
#it will take 2 values from the dice
r.shuffle(dice)
pri... |
JavaScript | UTF-8 | 921 | 4.125 | 4 | [] | no_license | // This parse - args file should export a single function to parse your command line arguments.The function should accept an array containing the arguments passed on the command line. Convert these arguments to an object with a count and sides property.
'use strict';
module.exports = (args) => {
let count = null;
let... |
Java | UTF-8 | 5,908 | 2.546875 | 3 | [] | no_license | package logic;
import android.util.JsonReader;
import com.google.gson.Gson;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import data.model.Incidencia;
import data.model.Ruta;
public class ParserJSON {
// Clase para... |
C | UTF-8 | 1,355 | 2.75 | 3 | [
"MIT"
] | permissive | #include "unity.h"
#include "HttpRequest.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
void setUp(){
}
void tearDown(){
}
void parseHeaderTest_GET(void){
char const req[] = "GET / HTTP/1.1\r\n\
Host: 192.168.1.65:5001\r\n\
User-Agent: curl/7.55.0\r\n\
Accept: */*\r\n\
Content-Type: application/x-... |
JavaScript | UTF-8 | 720 | 2.625 | 3 | [] | no_license | const express = require('express');
const app = express()
app.use(express.json());
app.listen(3000, () => console.log('Example app listening on port 3000!'))
app.get('/', (req, res) => {
console.log("started!")
})
app.post('/', function (req, res) {
console.log(req);
// let action = req.body.queryResult... |
C# | UTF-8 | 1,800 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | // Copyright 2004-2021 Castle Project - http://www.castleproject.org/
//
// Licensed under the Apache License, Version 2.0 (the "License";
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless r... |
Rust | UTF-8 | 2,206 | 2.640625 | 3 | [
"MIT"
] | permissive | use core::str;
use spin::Mutex;
pub use self::debug::DebugDisplay;
use self::display::Display;
pub mod debug;
pub mod display;
pub static FONT: &[u8] = include_bytes!("../../../res/unifont.font");
pub static DEBUG_DISPLAY: Mutex<Option<DebugDisplay>> = Mutex::new(None);
pub static FRAMEBUFFER: Mutex<(usize, usize,... |
PHP | UTF-8 | 533 | 2.625 | 3 | [] | no_license | <?php
session_start();
include_once('connection.php');
if($_POST['name'] == NULL || $_POST['quote'] == NULL)
{
$_SESSION['message'] = "Please fill out all information in fields";
header("Location: quotingdojoindex.php");
exit(); // exits the page if either field is left empty.
}
else //add to ... |
Markdown | UTF-8 | 217 | 2.640625 | 3 | [] | no_license | # Heat Equation
Used Python to Solve the heat equation below using the methods:
- The Forward Time Centered Space Method(Explicit);
- The Backward Time Centered Space Method(Implicit);
- Crank-Nicolson(Implicit);
|
C | UTF-8 | 4,646 | 2.96875 | 3 | [
"MIT"
] | permissive | #include <stdlib.h>
#include <string.h>
#include <math.h>
#include "blackjack.h"
typedef enum blackjack_result_t_ {
BLACKJACK_DEALER_BUST = 2,
BLACKJACK_WIN = 1,
BLACKJACK_DRAW = 0,
BLACKJACK_LOSE = -1,
BLACKJACK_PLAYER_BUST = -2
} blackjack_result_t;
int blackjack_get_hand_score(
blackjack_c... |
JavaScript | UTF-8 | 2,924 | 2.90625 | 3 | [] | no_license |
/*Funcao de mascara campos */
function mascaravalor(src, mask){
var i = src.value.length;
var saida = mask.substring(1,2);
var texto = mask.substring(i);
if (texto.substring(0,1) != saida){
src.value += texto.substring(0,1);
}
}
function confirmarRemover() {
if( confirm("Deseja realmente excluir ?") ) {
... |
Swift | UTF-8 | 4,976 | 2.828125 | 3 | [] | no_license | //
// BaseView.swift
// CurvedTabBar
//
// Created by Kritbovorn Taweeyossak on 28/9/2563 BE.
//
import SwiftUI
struct BaseView<Content: View>: View {
var content: Content
var indexSelected: Binding<Int>
init(index: Binding<Int>, @ViewBuilder content: () -> Content) {
self.content =... |
Python | UTF-8 | 385 | 3.40625 | 3 | [] | no_license | a = int(input())
b = int(input())
c = int(input())
volume = a * b * c
has_volume = True
box = input()
while not box == 'Done':
box = int(box)
volume -= box
if volume < 0:
has_volume = False
break
box = input()
if has_volume:
print(f'{volume} Cubic meters left.')
else:
print(f'... |
Python | UTF-8 | 1,436 | 2.765625 | 3 | [] | no_license |
from math import log, exp, sqrt
from numpy import maximum, cumsum, mean
from scipy import stats
c = 0
def bsformula(callput, S0, K, r, T, sigma, q=0):
global c
c = c + 1
d1 = (log(S0) - log(K) + (r + 0.5 * sigma ** 2) * T) / (sigma * sqrt(T))
d2 = (log(S0) - log(K) + (r - 0.5 * sigma ** 2) * T) / ... |
Python | UTF-8 | 4,378 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# @Time : 2020-03-12 11:41
# @Author : fgyong 简书:_兜兜转转_ https://www.jianshu.com/u/6d1254c1d145
# @Site : http://fgyong.cn 兜兜转转的技术博客
# @File : create.py
# @Software: PyCharm
from PIL import Image
import os
import sys
import config
import json
savePath = ""
jsonAr... |
JavaScript | UTF-8 | 1,169 | 2.53125 | 3 | [] | no_license | import React, { Component } from 'react'
import axios from 'axios'
class PhotoForm extends Component {
constructor(props) {
super(props)
this.state = {
name: this.props.photo.name
}
}
handleInput = (e) => {
this.setState({[e.target.name]: e.target.value})
}
... |
C# | UTF-8 | 1,062 | 2.515625 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Text;
using CompactFormatter.Attributes;
using CompactFormatter.Interfaces;
namespace iPH.Commons.Functions
{
[CompactFormatter.Attributes.Serializable]
public class PresentationSendFunction: BaseFunction
{
#region Singleton
priva... |
Python | UTF-8 | 563 | 4 | 4 | [] | no_license | import pandas
data = pandas.read_csv("nato_phonetic_alphabet.csv")
nato_data_frame = pandas.DataFrame(data)
# Keyword Method with iterrows()
# {new_key:new_value for (index, row) in df.iterrows()}
#TODO 1. Create a dictionary in this format:
nato_dict = {row.letter:row.code for (index, row) in nato_data_frame.iterro... |
Go | UTF-8 | 799 | 4 | 4 | [] | no_license | package main
import "fmt"
/**
给定一个整数数组 nums 和一个目标值 target,请你在该数组中找出和为目标值的那 两个 整数,并返回他们的数组下标。
你可以假设每种输入只会对应一个答案。但是,你不能重复利用这个数组中同样的元素。
示例:
给定 nums = [2, 7, 11, 15], target = 9
因为 nums[0] + nums[1] = 2 + 7 = 9
所以返回 [0, 1]
*/
func main() {
a := []int{1, 2, 3, 5, 7, 12}
b := 12
c := twoSum(a, b)
fmt.Println(c)
}
... |
Python | UTF-8 | 2,397 | 2.625 | 3 | [] | no_license | import os.path
import numpy as np
import torch
from torch.utils.data import Dataset
class AG_News(Dataset):
num_classes=4
class_weights=None
ignored_index=-100
dim = 768
def __init__(self, root=os.path.expanduser('~/datasets/AGNEWS/'), train=True, transform=None, target_transform=None,
... |
JavaScript | UTF-8 | 163 | 2.703125 | 3 | [] | no_license | function getDaysOfMonth(year,month){
var date=new Date(year,month,0);
var days=date.getDate();
return days;
}
module.exports = {
getDaysOfMonth
}; |
Java | UTF-8 | 848 | 2.75 | 3 | [] | no_license | package testerClasses;
import generalClasses.P3Utils;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.ArrayList;
import dataManagement.Document;
import dataManagement.WordInDocument;
/**
* tests document
* @author carlosgriver... |
Java | UTF-8 | 307 | 2.578125 | 3 | [] | no_license | package designs.creational.abstractfactory.factories;
import designs.creational.abstractfactory.object.Bank;
import designs.creational.abstractfactory.object.Loan;
public abstract class AbstractFactory {
public abstract Bank getBank(String bank);
public abstract Loan getLoan(String loanType);
}
|
JavaScript | UTF-8 | 3,907 | 3.453125 | 3 | [] | no_license | var fs = require("fs");
var inquirer = require("inquirer");
var BasicCard = require("./BasicCard.js");
var ClozeCard = require("./ClozeCard.js");
var log = require("./log.json");
function LetsBegin(){
console.log("***************************************************************");
console.log("---------------------... |
C | UTF-8 | 1,899 | 2.890625 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <kcorrect.h>
/*
* k_filter_struct
*
* Deal with the filter structure.
*
* Mike Blanton
* 6/2003
*/
typedef struct {
double lambda;
double pass;
} FILTER_STRUCT;
void k_print_filter_struct(void **input_struct,
... |
JavaScript | UTF-8 | 1,658 | 3.109375 | 3 | [] | no_license | var meuArray = [10, 14, 20, 9, 16, 22];
console.log(meuArray);
console.log(meuArray[0]);
console.log(meuArray[1]);
console.log(meuArray[2]);
console.log(meuArray[3]);
console.log(meuArray[4]);
console.log(meuArray[5]);
console.log(meuArray[0] + meuArray[0]);
console.log(meuArray[0] + meuArray[1]);
console.log(meuArray[... |
C++ | UTF-8 | 683 | 2.859375 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
vector <int>prime;
void bitwiseseive(int n){
int arr[(n/64)+1];
memset(arr,0,sizeof(arr));
for (int i = 3; i*i < n; i+=2)
{
if(!(arr[i/64] & (1 << ((i >> 1)& 31)))){
for (int j = i*i; j < n; j+= 2*i)
{
arr[j/64... |
Python | UTF-8 | 108 | 3.28125 | 3 | [] | no_license | a = int(input())
sum=0
i=1
while(i<=4):
sum=int(sum+int(a%10))
a=int(a/10)
i=i+1
print(sum)
|
C# | UTF-8 | 3,523 | 2.875 | 3 | [] | no_license | using System.Collections.Generic;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using Dapper;
using Microsoft.Extensions.Configuration;
using Utils.Interfaces;
using Utils.Models;
namespace DataAccessDapper
{
public class SaleRepoDapper : ISaleRepository
{
private readonly string co... |
PHP | UTF-8 | 6,284 | 2.515625 | 3 | [] | no_license | <?php
use function PHPSTORM_META\type;
include_once('../php/default.php');
require_once('../php/checksession.php');
require_once("../php/connect.php");
$starttime = $endtime = $startdate = $enddate = $repeattype = $uid = "";
if($_SERVER["REQUEST_METHOD"] == "POST")
{
global $equipment;
global $room;
global $sta... |
C++ | UTF-8 | 742 | 2.671875 | 3 | [] | no_license | #pragma once
#include "IConnection.h"
namespace echo {
class EchoConnection final : public std::enable_shared_from_this<EchoConnection>, public IConnection {
public:
explicit EchoConnection(boost::asio::io_context& context);
auto Start() noexcept -> void override;
auto Socket() noexcept -> boost::asio::ip::t... |
PHP | UTF-8 | 190 | 3.265625 | 3 | [] | no_license | <?php
$cont=0;
$num=2;
$suma=0;
while($cont<3){
$suma=0;
for($i=1;$i<$num;$i++){
if(($num%$i)==0){
$suma+=$i;
}
}
if($num==$suma) {
echo $num."<br>";
$cont++;
}
$num++;
}
?> |
PHP | UTF-8 | 1,175 | 3 | 3 | [] | no_license | <?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
?>
<!DOCTYPE html>
<html>
<head>
<title>Laet Static Binding</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
<!-- jQuery library -->
<scr... |
C++ | UTF-8 | 368 | 2.6875 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int countOccurrences(string s, intl)
{
int n = s.length();
int C, c1 = 0, c2 = 0;
for (int i = 0; i < n; i++)
{
if (s[i] == 'a')
c1++;
if (s[i] == 'b')
{
c2++;
C += c1;
}
}
return C * l + (l * (l - 1) / 2) * c1 * c2;
}
int main()
{
string S = "abcb";
int l = 2;
cout ... |
C# | UTF-8 | 3,369 | 2.75 | 3 | [] | no_license | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
public class RodentAI : MonoBehaviour
{
#region singleton
public static RodentAI instance;
void Awake()
{
instance = this;
}
#endregion
//Player
public GameObject indiana;
... |
C++ | UTF-8 | 754 | 3.625 | 4 | [] | no_license | #define LED_PIN 12
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_PIN, OUTPUT);
// initialize communication over serial port
Serial.begin(9600);
}
// the loop function runs over and over again forever
void... |
Python | UTF-8 | 1,976 | 2.828125 | 3 | [] | no_license | import socket
class App:
urls = {}
def __init__(self):
self.client_connection = None
self.client_address = None
def run_server(self, host='localhost', port=9005):
serv_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
serv_socket.setsockopt(socket.SOL_SOCKET, soc... |
Python | UTF-8 | 1,173 | 2.703125 | 3 | [
"MIT"
] | permissive | import sys
import os.path
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from Code.MathLib import regression_b0
import test_common
import pytest
upper_x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
upper_y = [793029, 689403, 389032, 203819, 2, -182039, -403290, -584039, -859302, -1029329]
lower_x = [1, 2, 4, 5,... |
Java | UTF-8 | 3,276 | 2.21875 | 2 | [
"Apache-2.0",
"BSD-3-Clause",
"EPL-1.0",
"CDDL-1.1",
"MIT",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | 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"); you ... |
Python | UTF-8 | 568 | 3.71875 | 4 | [] | no_license | """Load a dictionary file as a list.
Arguments:
-dictionary file name
Exceptions:
-IOError
-Requires import sys
"""
import sys
def load(filename):
"""Open dict text file, check for errors, & make word list."""
try:
with open(filename) as my_file:
my_list = my_file.read().strip()... |
Java | UTF-8 | 4,256 | 3.1875 | 3 | [] | no_license | package lexeme.java.tree.expression.statement;
import java.util.Optional;
import lexeme.java.intervals.Parenthesis;
import lexeme.java.tree.expression.Expression;
import lexeme.java.tree.expression.ExpressionVisitor;
import lexeme.java.tree.expression.statement.operators.binary.BinaryOperator;
import lexeme.java.tree... |
JavaScript | UTF-8 | 420 | 3.203125 | 3 | [] | no_license | var T = readline()
var res = []
for(var i = 0; i < T; i++){
var group = readline().split(' ')
var N = group[0]
var K = group[1]
var data = readline().split(' ')
var sum = 0
for(var j = 0; j < N; j++){
if(data[j] <= 0){
sum += 1
}
}
if(sum < K){
res.pu... |
Java | UTF-8 | 1,674 | 2.640625 | 3 | [] | no_license | package com.github.eoinf.jiggen.TemplateCreator.components;
import com.badlogic.gdx.graphics.Pixmap;
public abstract class TemplateCreatorComponent {
private TemplateCreatorComponent nextComponent;
protected TemplateCreatorData data;
// Top level component
TemplateCreatorComponent() {
this.d... |
Java | UTF-8 | 16,909 | 2.09375 | 2 | [] | no_license | package me.oggunderscore.Utils;
import java.util.ArrayList;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.configuration.Configuration;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.... |
Python | UTF-8 | 773 | 2.59375 | 3 | [
"MIT"
] | permissive | # -*- coding:utf-8 -*-
"""封装Request对象"""
class Request(object):
"""框架内置请求对象, 设置请求信息"""
def __init__(self, url, method='GET', headers=None, params=None, data=None,
parse='parse',
filter=True,
meta=None):
self.url = url
self.method = method
... |
Java | UTF-8 | 5,860 | 1.96875 | 2 | [
"MIT"
] | permissive | package openmods.network;
import io.netty.buffer.*;
import io.netty.channel.*;
import io.netty.channel.ChannelHandler.Sharable;
import java.io.*;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
import net.minecraft.network.IN... |
C++ | UTF-8 | 1,055 | 4.0625 | 4 | [] | no_license | /*
Idex: p.95
Title: Calculate Moving Average
Description: Given N, let's calculate M months's moving average
Time Complexity: O(N)
*/
#include <iostream>
#include <vector>
#include <ctime>
#include <cstdlib>
using namespace std;
double getRandValue() {
return rand() % 100 + 1;
}
vector<double> movingAverage2(const... |
Python | UTF-8 | 1,746 | 3.296875 | 3 | [] | no_license | """ Initial file for stating the project."""
from block_development_officer import BlockDevelopmentOfficer
from gram_panchayat_member import GramPanchayatMember
from member import Member
from schema import Schema
import sqlite3
def sql_connection():
"""
Setup connection with sqlite3 backend.
:return: sq... |
C | UTF-8 | 1,559 | 2.984375 | 3 | [] | no_license | /***********************************************************************
*file: Lab1_test.c
*synopsis: The argz functions use malloc/realloc to allocate/grow argz vectors, *and so any argz vector creating using these functions may be freed by using *free; conversely, any argz function that may grow a string expects t... |
Shell | UTF-8 | 467 | 3.203125 | 3 | [
"MIT"
] | permissive | #!/bin/bash
for ROUTE in $(cat ../../../routes.json | jq -r '.[].path')
do
if [ ! -f ${ROUTE}.go ]
then
cat ../../templates/routes.tmpl | sed -e 's/ROUTEUPPER/'${ROUTE^}'/g' | sed -e 's/ROUTE/'${ROUTE}'/g' > ${ROUTE}.go
fi
if [ ! -d ${ROUTE} ]
then
mkdir ${ROUTE}
cd ${ROUTE... |
C | UTF-8 | 3,723 | 2.8125 | 3 | [] | no_license | #include<linux/futex.h>
#include <sys/syscall.h>
#include<sys/time.h>
#include <unistd.h>
#include <sys/ipc.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <fcntl.h>
unsigned short xchg_8(void *ptr, unsigned char x)
{
__asm__ __volatile__("xchgb %... |
Java | UTF-8 | 5,007 | 2.109375 | 2 | [
"LicenseRef-scancode-ogc"
] | permissive | /*
* GeoAPI - Java interfaces for OGC/ISO standards
* http://www.geoapi.org
*
* Copyright (C) 2006-2021 Open Geospatial Consortium, Inc.
* All Rights Reserved. http://www.opengeospatial.org/ogc/legal
*
* Permission to use, copy, and modify this software and its documentation, with
* or without... |
C++ | UTF-8 | 2,361 | 2.5625 | 3 | [] | no_license | #include "operationview.h"
OperationView::OperationView(QWidget *parent) : QDockWidget(parent)
{
widget = new QWidget(this);
layout = new QGridLayout(widget);
labelImage = new QLabel("图片区域",widget);
labelName = new QLabel("图片名",widget);
button = new QPushButton("导入图片",widget);
labelBin... |
Java | UTF-8 | 671 | 2.640625 | 3 | [] | no_license | package com.example.azatsepin.theguardianreader.utils;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
public final class Utils {
private static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH:mm:ss yyyy-MM-dd");
private static SimpleDateFormat simpleDat... |
Rust | UTF-8 | 679 | 3.78125 | 4 | [] | no_license | pub fn brackets_are_balanced(string: &str) -> bool {
let mut stack: Vec<String> = Vec::new();
for elem in string.chars() {
let elem = elem.to_string();
if elem == "{" || elem == "[" || elem == "(" {
stack.push(elem.clone());
};
if elem == "}" || elem == "]" || elem ==... |
Python | UTF-8 | 1,092 | 3.046875 | 3 | [] | no_license | from itertools import permutations, combinations, chain
def solution(relation):
answer = 0
column_cnt = len(relation[0])
tuple_cnt = len(relation)
tmp = [i for i in range(column_cnt)]
keys = []
for i in range(len(tmp)):
for j in list(combinations(tmp, i+1)):
if tuple_cnt... |
Markdown | UTF-8 | 2,568 | 2.75 | 3 | [
"MIT"
] | permissive | +++
# About/Biography widget.
widget = "about"
active = true
date = "2017-12-20T00:00:00"
# Order that this section will appear in.
weight = 5
+++
Building robust statistical infrastructure that ensure the collection and the analysis of statistical information to inform citizen, decision makers and scientists is a ... |
C# | UTF-8 | 826 | 3.375 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace assignment5._2
{
class Fraction
{
public int Numerator;
public int Denominator;
public Fraction()
{
Numerator = 1;
Denominator = 1;
}
public Fraction(... |
JavaScript | UTF-8 | 8,761 | 2.703125 | 3 | [] | no_license | /*jslint browser: true, unparam: true*/
(function (tangelo, $) {
'use strict';
if (!$) {
tangelo.AbstractMapLayer = tangelo.unavailable({
plugin: "AbstractMapLayer",
required: ["JQuery"]
});
return;
}
function abstractFunction () {
tangelo.f... |
Python | UTF-8 | 471 | 2.671875 | 3 | [] | no_license | import numpy as np
from PIL import ImageFont, ImageDraw, Image
import cv2
import time
## Make canvas and set the color
def drawText(img, text, pos, fontSize, color=(255,255,255)):
b,g,r = color
fontpath = "./service/font/FC Iconic Bold.ttf"
font = ImageFont.truetype(fontpath, fontSize)
img_pil = Image.... |
Ruby | UTF-8 | 680 | 2.625 | 3 | [
"MIT"
] | permissive | require_relative './util'
notes_path = ENV['STANDUP_NOTES_PATH'] || 'daily/standup'
note_type = 'standup'
title = title_today('Standup')
tags = %w[notes daily solstice standups]
people = %w[Ugwem Cole Tyler Ekundayo]
person_standup_template = <<~STT
### {{name}}:
- yest:
-
- today:
-
- asks:
-
ST... |
JavaScript | UTF-8 | 1,201 | 2.78125 | 3 | [] | no_license | const Engine = Matter.Engine;
const World= Matter.World;
const Bodies = Matter.Bodies;
const Body = Matter.Body;
const Constraint = Matter.Constraint;
var engine, world, body;
//var bob1;
function preload(){
}
function setup(){
var canvas = createCanvas(windowWidth/1, windowHeight/1.5);
engine ... |
Python | UTF-8 | 174 | 2.78125 | 3 | [] | no_license | #!/usr/bin/python3
import math
matrix_divided = __import__('2-matrix_divided').matrix_divided
matrix = [
[1, 2]
]
print(matrix_divided(matrix, math.inf))
print(matrix)
|
Python | UTF-8 | 4,077 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | """
This is a template for creating custom RegexBasedColumnMapExpectations.
For detailed instructions on how to use it, please see:
https://docs.greatexpectations.io/docs/guides/expectations/creating_custom_expectations/how_to_create_custom_regex_based_column_map_expectations
"""
from typing import Dict, Opt... |
Swift | UTF-8 | 1,429 | 2.734375 | 3 | [] | no_license | //
// DockWidgetView.swift
// OpenTouchBar
//
// Created by Nikita Arutyunov on 13/01/2019.
// Copyright © 2019 Nikita Arutyunov. All rights reserved.
//
class DockWidgetView: NSStackView {
let dragTargetView: NSView!
override open var intrinsicContentSize: NSSize {
return NSSize(width: NSView.n... |
Java | UTF-8 | 156 | 1.664063 | 2 | [] | no_license | public class marcaZap {
String zapato1 = "Dr Martens";
String zapato2 = "Nike";
String zapato3 = "Vans";
String zapato4 = "";
}
|
C# | UTF-8 | 1,979 | 2.953125 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FiddleFiddle.Logon
{
class NotImplementedFiddleTask : Exception { }
interface ILogonTask
{
void DoTask();
}
/// <summary>
/// Logon 관련 Task 의 Factory 를 제공한다.
... |
Markdown | UTF-8 | 18 | 2.71875 | 3 | [] | no_license | # 22may-001-public |
Python | UTF-8 | 311 | 3 | 3 | [] | no_license |
from env import HEIGHT
class Spot:
def __init__(self, value_x=0, value_y=0, radius=5):
self.value_x = value_x
self.value_y = value_y
self.radius = radius
# self.pos_x = 0
# self.pos_y = 0
def get_pos(self):
return int(self.value_x), int(self.value_y)
|
Java | UTF-8 | 1,980 | 2.796875 | 3 | [
"MIT"
] | permissive | package com.firebase.androidchat;
import java.util.ArrayList;
import java.util.Map;
import java.util.Scanner;
import java.util.HashMap;
public class Person
{
@SuppressWarnings("unused")
private String name;
private ArrayList<Person> friends;
private ArrayList<Debt> debts;
private ArrayList<Debt> loans;
private ... |
Java | UTF-8 | 357 | 2.296875 | 2 | [] | no_license | package com.hcpurchase.util;
import java.text.SimpleDateFormat;
import java.util.Date;
public class DateUtil {
private static Date date = new Date();
private static final String str = "yyyyMMddhhmmss";
public static String getNowString() {
SimpleDateFormat sdf = new SimpleDateFormat(str);
String string = sdf... |
Ruby | UTF-8 | 668 | 2.859375 | 3 | [] | no_license | module SAW
module Entities
# +SAW::Entities::UnitsPricing+
#
# This entity represents an object with available rates for property
# units: entity includes +units+ array which has unit rates and the
# currency used for the current property
#
# Attributes
#
# +property_id+ - property... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.