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 | 1,162 | 3.09375 | 3 | [] | no_license | from nufi.basefilters import Summer, Counter
class Mean(Summer, Counter):
def __init__(self):
Summer.__init__(self)
Counter.__init__(self)
def process(self, number):
Summer.process(self, number)
Counter.process(self, number)
def output(self):
print floa... |
C++ | UTF-8 | 1,963 | 2.796875 | 3 | [
"MIT"
] | permissive | #include "vertex_binding.hpp"
#include "vertex_layout.hpp"
#include "buffer.hpp"
_agpu_vertex_binding::_agpu_vertex_binding()
{
}
void _agpu_vertex_binding::lostReferences()
{
// Release vertex buffer references.
for (auto buffer : vertexBuffers)
{
if (buffer)
buffer->release();
}... |
Python | UTF-8 | 4,904 | 2.78125 | 3 | [] | no_license | import wx
from db_script import SQLiteDatabase, RedisDatabase
class CustomFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, title='Yo!')
# Здесь вместо SQLiteDatabase можно указать RedisDatabase при условии, что у вас работает локальный
# Redis-сервер
self.db = SQL... |
JavaScript | UTF-8 | 422 | 4.53125 | 5 | [] | no_license | //create secretNumber
var secretNumber = 24;
//asks user for guess
var stringGuess = prompt("Guess a number");
//converts the input from string to number
var guess = Number(stringGuess);
//checks if guess is right
if(guess === secretNumber) {
alert("YOU GOT IT RITGHT");
}
//checks if guess is higher
else if(guess... |
Python | UTF-8 | 2,103 | 3.8125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
""" A Program to find the anagram words from a file """
# Importing collections
from collections import OrderedDict
# importing itertools.groupby
# Itertools is used to handle iterators operation fastly
from itertools import groupby
# To get execution time imported time module
import time
# ... |
Python | UTF-8 | 3,350 | 2.9375 | 3 | [] | no_license | import math
from objects import symbol, bar
#standard
#narrow = 0.5
#wide = 1.0
#half time
narrow = 1.0
wide = 2.0
#defining the integer symbols
symbol0 = ['n','n','w','w','n']
symbol1 = ['w','n','n','n','w']
symbol2 = ['n','w','n','n','w']
symbol3 = ['w','w','n','n','n']
symbol4 = ['n','n','w','n','w']
symbol5 = ['... |
Markdown | UTF-8 | 1,712 | 4.25 | 4 | [] | no_license | # JS - Object Array 賦值問題
## 關於我遇到的問題
這是我在寫小 DEMO 發現的,關於 JS 的賦值問題,這裡涉及到了 Pointer。
下面是我用簡單的 Code 描述我遇到的問題,`object` 是一個 Object Array,然後傳入函數進行局域變量賦值。
```js
let object = [
{
name: "John",
age: 18
},
{
name: "Amy",
age: 20
},
]
function Test(object) {
let newOne = obj... |
Java | UTF-8 | 450 | 1.78125 | 2 | [] | no_license | package com.censpeed.shop.mapper;
import com.censpeed.shop.entity.CHomePage;
import java.util.List;
public interface CHomePageMapper {
int deleteByPrimaryKey(Integer id);
int insert(CHomePage record);
int insertSelective(CHomePage record);
CHomePage selectByPrimaryKey(Integer id);
int updateB... |
JavaScript | UTF-8 | 2,973 | 2.71875 | 3 | [] | no_license | /***********************
* Adobe Edge Animate Composition Actions
*
* Edit this file with caution, being careful to preserve
* function signatures and comments starting with 'Edge' to maintain the
* ability to interact with these actions from within Adobe Edge Animate
*
***********************/
(function($, Edge, com... |
Markdown | UTF-8 | 13,149 | 3.53125 | 4 | [] | no_license | ---
layout: post
title: "Beersweeper with React and Jest"
---
Over the weekend, I worked on a browser-based minesweeper clone called Beersweeper. The main focus was to practice TDD and learn Jest. Jest is Facebook's javascript unit testing framework, and it works well with React. They use Jasmine 1.X as the lower leve... |
Python | UTF-8 | 4,706 | 2.515625 | 3 | [] | no_license | import requests
import json
from contextlib import closing
import time
import threading
import queue
# print(reqs["data"]["next_offset"])
class bili(threading.Thread):
def __init__(self,url,next_offset,video_queue):
threading.Thread.__init__(self)
self.url = url
self.next_offset... |
C# | UTF-8 | 1,592 | 3.625 | 4 | [] | no_license | using System;
namespace BankingApplication
{
public class CheckingAccount : Account
{
int warningCounter;
public CheckingAccount(double initialBalance = 0)
{
this.Balance = initialBalance;
warningCounter = 0;
this.status = true;
}
publ... |
JavaScript | UTF-8 | 3,872 | 2.859375 | 3 | [] | no_license | import React, { useEffect, useState } from 'react';
import Course from './Course';
import axios from 'axios'
const Calc = () => {
const [hours, setHours] = useState(0);
const [gpa, setGpa] = useState(0);
const [newCourse, setNewCourse] = useState("");
const [catPic, setCatPic] = useState("https://cdn2... |
Java | UTF-8 | 224 | 2.328125 | 2 | [] | no_license | package main;
public class Sector {
public int id;
public Trein trein;
public Sector(int id){
this.id=id;
trein=null;
}
public boolean vrij(){
if (trein==null)
return true;
else return false;
}
}
|
C# | UTF-8 | 1,941 | 2.78125 | 3 | [] | no_license | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Shelf: MonoBehaviour
{
public List<Slot> slots;
void Start()
{
slots = new List<Slot>();
for (int i = 0; i < transform.childCount; i++)
{
Transform child = transform.GetChild(i... |
Java | UTF-8 | 1,314 | 2.234375 | 2 | [] | no_license | package pagefactorypom;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
public class RegisterPOM {
WebDriver driver;
@FindBy(id="gender-female")
WebElement gender;
@FindBy(id="... |
C++ | UTF-8 | 1,267 | 2.734375 | 3 | [
"MIT"
] | permissive | #pragma once
#include <vpp/fwd.hpp>
#include <string>
namespace vpp
{
vk::PfnVoidFunction vulkanProc(vk::Instance instance, const char* name);
vk::PfnVoidFunction vulkanProc(vk::Device device, const char* name);
}
///Macro for calling a vulkan function pointer.
///\param iniOrDev vulkan instance or device (dependi... |
Java | UTF-8 | 3,479 | 2.453125 | 2 | [] | no_license | package forge.toolbox;
import java.awt.Cursor;
import java.awt.Desktop;
import java.awt.Toolkit;
import java.awt.datatransfer.StringSelection;
import java.net.URI;
import java.net.URISyntaxException;
import javax.swing.SwingWorker;
import forge.UiCommand;
@SuppressWarnings("serial")
public class FHy... |
Markdown | UTF-8 | 821 | 2.78125 | 3 | [] | no_license | # DengAI-Predicting-Disease-Spread
Predict the number of dengue cases each week (in each location) based on environmental variables
Using environmental data collected by various U.S. Federal Government agencies—from the Centers for Disease Control and Prevention to the National Oceanic and Atmospheric Administration ... |
C# | UTF-8 | 1,207 | 3.046875 | 3 | [] | no_license | using System;
using ThreeTierArchitecture.BussinessLayer;
using ThreeTierArchitecture.DomainModel;
namespace ThreeTierArchitecture.ui
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(" Enter EmailId");
string emailId = Console.ReadLine();
... |
Python | UTF-8 | 8,059 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
"""
Training a Recurrent Neural Network for Text Generation
=======================================================
This implements a char-rnn, which was heavily inspired from
Andrei Karpathy's work on text generation and adapted from
example code introduced by keras.
(http://karpathy.github.io/... |
Python | UTF-8 | 3,152 | 2.640625 | 3 | [] | no_license | #coding:utf-8
from wxpy import *
from random import choice
import time,datetime
bot = Bot(cache_path=True)
tuling = Tuling(api_key='0e8d70b241fcc4a898ee0410937b0551220')
naXienian=bot.groups().search(u'那些年')[0]
fristHello=[u'亲们有没有想我?',u'Hello,我来啦!!',u'都出来聊天呢!']
naXienian.send(choice(fristHello))
ms... |
Python | UTF-8 | 1,074 | 3.046875 | 3 | [
"MIT"
] | permissive | def adapter_array_01(jolts):
differences = [0, 0, 1]
for i in range(len(jolts) - 1):
differences[jolts[i + 1] - jolts[i] - 1] += 1
return differences[0] * differences[2]
def adapter_array_02(jolts):
groups = [True if jolts[i + 2] - jolts[i] <= 3 else False for i in range(len(jolts) - 2)]
gr... |
Java | UTF-8 | 833 | 2.125 | 2 | [] | no_license | package org.firstinspires.ftc.teamcode.logging;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.util.ElapsedTime;
import org.firstinspires.ftc.teamcode.framework.subsystems.imu.IMU;
import org.firstinspires.ftc.teamcode.framework.Utility;
import org.firstinspires.ftc.teamcode.logging.Dou... |
Java | UTF-8 | 2,637 | 1.890625 | 2 | [] | no_license | package com.peace.ostp.domain;
import java.util.Date;
public class CourseInfo {
private String courseid;
private String coursetitle;
private String courseauthor;
private Date updatetime;
private String content;
private String coverpicture;
private String sporttypeid;... |
Java | UTF-8 | 6,052 | 2.25 | 2 | [] | no_license | package clasem.entities.user;
import clasem.config.SecurityUtility;
import clasem.entities.DeletableModel;
import org.hibernate.annotations.ResultCheckStyle;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import org.hibernate.validator.constraints.Length;
import java.util.Date;
im... |
Java | UTF-8 | 549 | 4.25 | 4 | [] | no_license | package doit.chap05;
import java.util.Scanner;
//팩토리얼 값을 비재귀적으로 구합니다.
public class FactorialEx_05_01 {
//양의 정수 n의 팩토리얼 값을 반환
static int factorical(int n) {
int fact = 1;
while (n > 1)
fact *= n--;
return fact;
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
... |
Java | UTF-8 | 6,966 | 1.765625 | 2 | [] | no_license | package com.example.bbook;
import java.io.IOException;
import java.util.List;
import org.w3c.dom.Text;
import com.example.bbook.api.Page;
import com.example.bbook.api.Server;
import com.example.bbook.api.entity.Orders;
import com.example.bbook.api.widgets.GoodsPicture;
import com.example.bbook.api.widgets... |
C++ | UTF-8 | 2,788 | 3.296875 | 3 | [] | no_license | #ifndef OSTIMER_H
#define OSTIMER_H
#include <chrono>
#include <limits>
#include "xolotlPerf/perfConfig.h"
#include "xolotlPerf/ITimer.h"
#include "xolotlCore/Identifiable.h"
namespace xolotlPerf {
/// A timer that measures how long something takes to execute.
/// Uses an operating system/runtime timer interface.
cl... |
Java | UTF-8 | 7,826 | 2.3125 | 2 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | package org.highj.data.num;
import org.highj.data.ratio.Rational;
import org.highj.data.tuple.T2;
import org.highj.typeclass0.num.Integral;
import org.highj.typeclass0.num.Num;
import org.highj.typeclass0.num.Real;
import org.highj.util.ArrayUtils;
import org.junit.jupiter.api.Test;
import java.math.BigInteger;
impo... |
Java | UTF-8 | 1,609 | 2.328125 | 2 | [] | no_license | package com.example.jinming.gamestopdemo.util;
import android.content.Context;
import android.graphics.Color;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
impo... |
Java | UTF-8 | 10,267 | 2.46875 | 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 project;
import java.awt.BorderLayout;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
/**
*
* @author amjad
*/
p... |
Markdown | UTF-8 | 1,948 | 3.078125 | 3 | [
"MIT"
] | permissive | Themed LayoutGrid from <a href="https://github.com/material-components/material-components-web-react/tree/master/packages/layout-grid" target="_blank">material-components-web-react</a>
### Installation
```bash
yarn add @fv-components/layout-grid;
```
### Usage
```js static
import Grid, {
Cell,
Row,
} from '@fv-... |
PHP | UTF-8 | 258 | 2.8125 | 3 | [] | no_license | <?php
namespace StudentManagementSystem;
class Grade
{
// Properties
public $grade_id;
public $grade_name;
public function getGradeId(){
return $this->grade_id;
}
public function getGradeName(){
return $this->grade_name;
}
} |
C++ | GB18030 | 3,149 | 3.703125 | 4 | [] | no_license | /****************************************************************************************************/
/*
ܣӦC++ʵֵĸ
ĽڵLinkNodeװһSListཫЧڵ
ijԱ
캯캯ֵء
**
**ľ
** 1βڵ
** 2ӡ
** 3ÿ
** 4ββڵ
** 5ͷ
** 6ɾڵ
** ... |
C++ | UTF-8 | 775 | 3.46875 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function Template for C++
class Solution
{
public:
vector<int> sieveOfEratosthenes(int N)
{
// Write Your Code here
vector<int> prime(N + 1, 1);
prime[0] = prime[1] = 0;
for (int i = 2; i <= N; i++)
{
if (prime[i])
{
for ... |
Python | UTF-8 | 398 | 3.265625 | 3 | [] | no_license | import json
clientes_dict = {'maria': 27, 'Pedro': 22, 'João': 14, 'Ana': 17}
# Criando e Salvando Arquivo Json convertendo dicionário
with open('clientes.json', 'a+') as arquivo:
json.dump(clientes_dict, arquivo)
# # Abrindo arquivo Json e convertendo o objeto em dicionario python
# with open('client... |
C# | UTF-8 | 1,364 | 2.546875 | 3 | [] | no_license | // **************************************************************************************
// ** **
// ** (C) FOOSBOT - Final Software Engineering Project, 2015 - 2016 **
// ** (C) Authors: M.Toubian, M.Shimon, E.Kleinman, O.Sasson, J.Gleyzer **
// ** Advisors: Mr.Resh Amit &... |
Python | UTF-8 | 1,778 | 3.890625 | 4 | [] | no_license | """
Date:27/04/2021
1622. Fancy Sequence - Leetcode Hard
The following problem is solved using maths logic..+ modular inverse multiplication.
The concept used are:
1)modular arithetic assumes normal rules of arithmetic under modular operation,so operations are lossless..
2)Whenver (N/D)%mod is to performed,then alway... |
C++ | UTF-8 | 7,606 | 2.625 | 3 | [] | no_license | #include "Distances.h"
#include "DirectXLib\D3DVECTORHelper.h"
//////////////////////////////////////////////////////////////////////////
//
//
//////////////////////////////////////////////////////////////////////////
float PointDistanceFromShape(CShapeImm* pcShape, D3DVECTOR* pcPoint)
{
int iType;
void* ... |
C# | UTF-8 | 440 | 2.71875 | 3 | [
"MIT"
] | permissive | using System;
namespace Proxy.AOP
{
public class RealFightManager : IFightManager
{
public void DoFight(string username)
{
Console.WriteLine(username + " 帶領冒險者們與無辜的怪物戰鬥");
Console.WriteLine("......正在戰鬥中.....");
Console.WriteLine(username + " 帶領冒險者們洗劫怪物的家,結束一... |
Python | UTF-8 | 2,719 | 2.9375 | 3 | [
"Apache-2.0"
] | permissive | '''
Usage: {hods} SUBCOMMAND [ARGUMENTS]
{hods} help SUBCOMMAND
Manage structured data stored in plain text files with YAML or JSON formatting.
Available subcommands:
{subcommands}
To view help message for a specific subcommand use:
{hods} help SUBCOMMAND
Copyright 2018 Vitaly Potyarkin
https://githu... |
C++ | UTF-8 | 898 | 3.203125 | 3 | [] | no_license | /*
* Complexidade:
* Pior Caso: O(n^2)
* Caso medio: O()
* Melhor Caso: O(n+k)
*
* Memoria usada:
* O(n) para vetor
* O(n.k) para auxiliar
*
* Estavel: Sim
*/
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include "../utils.h"
using namespace std;
const int MAX = 8;
... |
Java | UTF-8 | 1,085 | 2.40625 | 2 | [] | no_license | package org.pitest.pitclipse.pitrunner.client;
import java.io.Closeable;
import java.io.IOException;
import org.pitest.pitclipse.pitrunner.PitRequest;
import org.pitest.pitclipse.pitrunner.PitResults;
import org.pitest.pitclipse.pitrunner.io.ObjectStreamSocket;
import org.pitest.pitclipse.pitrunner.io.SocketProvider;... |
Java | UTF-8 | 589 | 2.390625 | 2 | [] | no_license | package com.javaweb.michaelkai.common.enums;
/**
* @ClassName MsgActionEnum
* @Description TODO
* @Author YuKai Fan
* @Date 2019/8/22 23:07
* @Version 1.0
**/
public enum MsgActionEnum {
CONNECT(1, "第一次(或重连)初始化连接"),
CHAT(2, "聊天消息"),
SIGNED(3, "消息签收"),
KEEPLIVE(4, "客户端保持心跳");
public final Int... |
Java | UTF-8 | 413 | 3.546875 | 4 | [] | no_license | package com.tyss.javaprogram.inheritance;
public class PrimeNumber {
public static void main(String[] args) {
int a=9;
int count=0;
for (int i =2; i <=a/2; i++)
{
if(a%i==0)
{
count++;
break;
}
}
if(count==0)
{
System.out.println("It i... |
C | UTF-8 | 1,080 | 2.84375 | 3 | [
"MIT"
] | permissive | #include "./stb_image_custom.h"
typedef struct data_t {
unsigned char* data;
size_t capacity;
size_t size;
} data;
data* data_init() {
data* d = malloc(sizeof(data));
d->capacity = 1024;
d->size = 0;
d->data = malloc(sizeof(unsigned char) * d->capacity);
return d;
}
void data_free(data* d) {
free(d->data);
... |
Markdown | UTF-8 | 2,466 | 3.21875 | 3 | [] | no_license | # Unscented_Kalman_Filter_Project
I built this Unscented Kalman filter using C++ to estimate the state of a moving object of interest with noisy lidar and radar measurements
A standard Kalman filter can only handle linear equations. Both the Extended Kalman filter and the Unscented Kalman filter allow you to use non-... |
C# | UTF-8 | 2,995 | 3.03125 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace WiseBet.Models
{
public class LottoNumbers
{
public int num1 { get; set; }
public int num2 { get; set; }
public int num3 { get; set; }
public int num4 { get; set; }
... |
Java | UTF-8 | 394 | 1.9375 | 2 | [] | no_license | package org.company.erp.core.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.company.erp.core.model.Template;
import org.company.erp.core.model.TemplatesGroup;
import java.util.List;
@Mapper
public interface TemplateMapper {
List<Template> getTemplateList();
List<TemplatesGroup> getTemplate... |
PHP | UTF-8 | 635 | 2.765625 | 3 | [] | no_license | <?php
/**
* Interfaz que define los metodos que realizaran
* consultas sobre la base de datos relacionado con la entidad
* correspondiente.
* @author Miguel Callon
*/
interface IEstadoUsuarioDAO extends IDAO {
/**
* Metodo que obtiene un EstadoUsuario de base de datos pasandole
* un EstadoUsuarioBean con el i... |
Java | UTF-8 | 1,600 | 2.65625 | 3 | [
"MIT"
] | permissive | /*
* 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 ggj16.officeobjects;
import bropals.lib.simplegame.animation.Animation;
import bropals.lib.simplegame.entity.GameWorld;
import... |
Markdown | UTF-8 | 1,403 | 3.34375 | 3 | [
"MIT"
] | permissive | skypper
=======
Converts an image into Skype emoticons using the HTML5 Canvas element. Because, well, it's possible.
- Input: an image element with data (mario.png!)
- Output: a text block with a lot of Skype emoticons
Creates a one-to-one mapping between each image pixel and the predefined colors,
so pretty much th... |
Java | UTF-8 | 21,323 | 2.34375 | 2 | [] | no_license | package com.dk.pojo;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
public class CarExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public CarExample() {
oredCriteria = new Arr... |
Ruby | UTF-8 | 764 | 3.71875 | 4 | [] | no_license | # Helper Method
def position_taken?(board, location)
!(board[location].nil? || board[location] == " ")
end
# Define your WIN_COMBINATIONS constant
WIN_COMBINATIONS = [
[0,1,2],
[3,4,5],
[6,7,8],
[0,3,6],
[1,4,7],
[2,5,8],
[0,4,8],
[2,4,6]
]
def won?(board)
WIN_COMBINATIONS.detect do |winner|
winner.all? {|t... |
Java | UTF-8 | 2,531 | 2.515625 | 3 | [] | no_license | import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.mybatis.domain.Shop;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import ... |
Java | UTF-8 | 1,205 | 2.1875 | 2 | [] | no_license | package com.example.pedro.greateranglia.services;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.support.annotation.Nullable;
import com.example.pedro.greateranglia.services.CheckLocation;
/**
* Created by Pedro on 23/04/2018.
*/
public class ServiceLocation e... |
Python | UTF-8 | 25,591 | 2.59375 | 3 | [
"BSD-3-Clause"
] | permissive | """Module to provide main autocas functions.
All functions here, provide basic autocas workflows for groundstates and excited states
in combination with standard and large cas protocols.
"""
# -*- coding: utf-8 -*-
__copyright__ = """ This code is licensed under the 3-clause BSD license.
Copyright ETH Zurich, Laborato... |
Java | UTF-8 | 5,632 | 2.25 | 2 | [] | no_license | package com.haitago.business.baseandcommon;
import android.os.Bundle;
import android.support.annotation.Nullable;
import com.haitago.factory.bean.base.OpenResponse;
import com.haitago.presenter.RxPresenter;
import com.haitago.utils.ACache;
import com.haitago.utils.StrUtils;
import org.json.JSONObject;
import rx.Obs... |
Python | UTF-8 | 11,688 | 2.875 | 3 | [] | no_license |
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# model averaging ensemble for the blobs dataset
from sklearn.datasets import make_blobs
from sklearn.me... |
C++ | UTF-8 | 361 | 2.6875 | 3 | [] | no_license | #include "wordlist.h"
#include "freqlist.h"
using namespace std;
int main()
{
int size;
WordList L;
L.read("input.txt");
FreqList F1;
FreqList F2;
F1.frequency(L,L.head);
size = F2.frequency_unsorted(L);
F2.sort(size);
cout << "F1 is:" << endl;
F1.print();
cout << "F2 is:" ... |
Shell | UTF-8 | 268 | 2.953125 | 3 | [] | no_license | #!/bin/bash
source platform
source prettyecho
source dots
case $PLATFORM in
Debian*)
# sudo apt-get install git -y
;;
Darwin*)
brew install git
;;
*)
log_error "Platform not supported"
exit 1
;;
esac
setup_dotfile git/gitconfig
|
TypeScript | UTF-8 | 2,024 | 3.609375 | 4 | [] | no_license | let initialPrimeNumbers = [2];
export const isPrime = (num: number) => {
if (num < 3) {
return true;
}
const maxPossible = Math.floor(Math.sqrt(num));
for(let i = 3; i <= maxPossible; i += 2) {
if (num % i === 0) {
return false;
}
}
return true;
}
export con... |
Markdown | UTF-8 | 1,352 | 2.875 | 3 | [] | no_license | ---
title: DNSimple Services
excerpt:
categories:
- DNSimple
---
# DNSimple Services
DNSimple provides several services that every system connected to the Internet needs: domain registration, hosted DNS and SSL certificates.
## DNS Hosting
DNSimple DNS hosting is billed as a monthly service. We currently offer... |
PHP | UTF-8 | 1,779 | 2.546875 | 3 | [] | no_license | <?php
@include("objects/page.class.php");
@include("../objects/page.class.php");
$page = new Page();
$page->loadMeta("Protocollen website");
$page->loadHeader();
$user = new User();
$MySql = new MySql();
if(isset($_SESSION["loggedin"])){
$user = $_SESSION["loggedin"];
}
else{
$user = new User();
}
if($user->... |
JavaScript | UTF-8 | 713 | 2.953125 | 3 | [] | no_license | /**
* Created by cuss on 2016/7/8.
*/
let slice = Array.prototype.slice,
toString = Object.prototype.toString;
let utils = {
isArray(obj){
let type = utils.checkType(obj);
if(type == 'Array'){
return true;
}
return false;
},
//判断是否是函数
isFunction(obj){
... |
C++ | UTF-8 | 25,917 | 2.796875 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | //=======================================================================
// Copyright (c) 2014-2016 Baptiste Wicht
// Distributed under the terms of the MIT License.
// (See accompanying file LICENSE or copy at
// http://opensource.org/licenses/MIT)
//==================================================================... |
C# | UTF-8 | 649 | 2.96875 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PooCalculaIdade
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("programa para calcular a idade da pessoa.");
Console.Writ... |
C# | UTF-8 | 8,692 | 3.03125 | 3 | [] | no_license | using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace DominionCards
{
public abstract class Player
{
private int number;
private Stack<Card> deck = new Stack<Card>();
... |
C++ | UTF-8 | 392 | 2.75 | 3 | [] | no_license | #include <fstream>
using namespace std;
int main()
{
ifstream in("input.txt");
ofstream out("output.txt");
int n, m;
int i, j;
int *k;
int c;
in >> n >> m;
k = new int[n];
for(c = 0; c < n; ++c)
k[c] = 0;
for(c = 0; c < m; ++c)
{
in >> i >> j;
++k[i-1];
++k[j-1];
... |
JavaScript | UTF-8 | 7,155 | 2.9375 | 3 | [
"MIT",
"BSD-3-Clause"
] | permissive | function getNormalizationFactorByInvertingMaxValue(max){
if (max == 0) {
factor = 1;
}
else{
factor = 1/ max;
}
return factor;
}
function getMaxFromCellsLists(cellsLists){
var max = 0.0;
for (var i in cellsLists){
var cellsList = cellsLists[i];
var curMax = g... |
Python | UTF-8 | 4,741 | 4.53125 | 5 | [] | no_license | #XOR decryption
#Each character on a computer is assigned a unique code and the preferred standard is ASCII (American Standard Code for Information Interchange). For example, uppercase A = 65, asterisk (*) = 42, and lowercase k = 107.
#A modern encryption method is to take a text file, convert the bytes to ASCII, th... |
JavaScript | UTF-8 | 1,480 | 2.890625 | 3 | [] | no_license | // using our types for action types on reducers
import {
LOGIN_USER,
LOGIN_USER_ERROR,
REGISTER_USER,
REGISTER_USER_ERROR,
LOG_USER_OUT,
FETCH_USER,
FETCH_USER_ERROR
} from "../actions/Types";
// our initial state
const initialState = {
isAuthenticated: false,
login: {},
register: {},
user: {}
};... |
PHP | UTF-8 | 142 | 2.609375 | 3 | [] | no_license | <?php
if ($_GET) {
if ($_GET["name"] == "Brandi") {
echo "Hi, Brandi!";
} else {
echo "Sorry, You're Not Welcome";
}
}
?> |
Java | UTF-8 | 1,075 | 3.75 | 4 | [] | no_license | /**
* Ejercicio 19
* Realiza un programa que pinte una pirámide por pantalla. La altura se debe pedir
* por teclado. El carácter con el que se pinta la pirámide también se debe pedir
* por teclado.
*
* @author Alejandro Zambrana Naranjo
*/
public class Ejercicio19 {
public static void main(String[] args) ... |
Java | UTF-8 | 2,066 | 3.015625 | 3 | [] | no_license | package Dictionary;
import java.util.Scanner;
public class DictionaryCommandline {
private DictionaryManagement manager = new DictionaryManagement();
public void showAllWords() {
manager.showDictionary();
}
public void dictionaryBasic() {
manager.insertFromCommandLine();
}
p... |
PHP | UTF-8 | 1,829 | 3.3125 | 3 | [] | no_license | <?php
class Truck extends Vehicle {
protected $maxSpeed = 90;
protected $capacity;
protected $items = [];
protected $trailer = false;
public function __construct($brand, $price, $capacity, $wheels) {
parent::__construct($brand, $price);
$this->capacity = $capacity;
$this->whe... |
Java | UTF-8 | 11,746 | 2.28125 | 2 | [
"Apache-2.0"
] | permissive | // Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.util.io;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.util.ConcurrencyUtil;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.No... |
C# | UTF-8 | 1,136 | 2.765625 | 3 | [
"MIT"
] | permissive | using System;
using PublicHolidays.Au.Internal.PublicHolidays;
using Shouldly;
using Xunit;
namespace PublicHolidays.Au.UnitTests.Internal.PublicHolidays
{
public class NewYearsDayTests
{
private readonly NewYearsDay _newYearsDay;
public NewYearsDayTests()
{
_newYearsDay =... |
Java | UTF-8 | 299 | 3.0625 | 3 | [] | no_license | package com.vishwa.lld.designpattern.structuraldesignpattern;
/**
* Base Car decorator
*/
public class CarDecorator implements Car{
protected Car car ;
public CarDecorator(Car car) {
this.car = car;
}
@Override
public void manufactureCar() {
this.car.manufactureCar();
}
}
|
Markdown | UTF-8 | 393 | 3.078125 | 3 | [] | no_license | 520. Detect Capital
**Easy**
[Original Page](https://leetcode.com/problems/largest-triangle-area/)
You have a list of points in the plane. Return the area of the largest triangle that can be formed by any 3 of the points.
```
Example:
Input: points = [[0,0],[0,1],[1,0],[0,2],[2,0]]
Output: 2
Explanation:
The five p... |
JavaScript | UTF-8 | 619 | 3.875 | 4 | [] | no_license | // for(i = 0; i < 10; i++){
// console.log(i);
// if(i === 9){
// break;
// }
// }
// console.log ("end of loop");
// var links = document.getElementsByTagName("a");
// for (i = 0; i < links.length; i++){
// links[i].className = "link-" + i ;
// }
// function getAverage (a,b){
// var average = (a + b)/ 2;
//... |
Java | UTF-8 | 203 | 2.328125 | 2 | [] | no_license | package absFactory;
/**
* @author tjk
* @date 2019/8/3 17:30
*
* 抽象工厂
*/
public abstract class AbstractFactory {
abstract Product1 ProductA();
abstract Product2 ProductB();
}
|
Java | UTF-8 | 1,516 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | package org.drools.analytics.components;
import java.util.HashSet;
import java.util.Set;
import org.drools.analytics.result.Cause;
/**
* Instance of this class represents a possible combination of Constraints under
* one Pattern. Each possibility returns true if all the Constraints in the
* combination ... |
Java | UTF-8 | 965 | 2 | 2 | [] | no_license | package com.zszd.ai.service.resource;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.zszd.ai.dao.resource.ResourceDao;
import com.zszd.ai.pojo.Resources;
@Service
public class ResourceServiceImpl implements ResourceService {
@Resource
private Re... |
Ruby | UTF-8 | 1,420 | 3.46875 | 3 | [
"MIT"
] | permissive | def matrix_addition_reloaded(*matrices)
matrix = matrices.first
height = matrix.length
width = matrix[0].length
empty_matrix = Array.new(height) { [0] * width }
matrices.inject(empty_matrix) do |m1, m2|
return nil if m2.length != height or m2[0].length != width
matrix_addition(m1, m2)
end
end
def ... |
Shell | UTF-8 | 343 | 2.640625 | 3 | [
"MIT"
] | permissive | #!/bin/bash
cd /opt/streamer
# check and copy configuration files from secrets
if [ -f $STREAMER_SERVICE_CONFIG ]; then
cp $STREAMER_SERVICE_CONFIG config/default.json
fi
if [ -f $STREAMER_MAILER_CONFIG ]; then
cp $STREAMER_MAILER_CONFIG config/mailer.json
fi
/opt/nodejs/bin/node --expose-gc --max-old-space... |
JavaScript | UTF-8 | 687 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | /** @jsx React.DOM */
var React = require('react');
var requireStylesheet = require('stylesheets').requireStylesheet;
var MyComponent = React.createClass({
componentWillMount: function() {
// this call can be put outside of `componentWillMount`. Reason why it's
// here:
// - lazy loading
// - makes s... |
Python | UTF-8 | 2,114 | 4.21875 | 4 | [] | no_license | # multiple versions of the algorithm
# this version will pick the 'middle' element of the 'array'
# quicksort requires a partition function as well as the sort function
import random
import time
def quicksort(arr, left, right):
# print(f"Current left value: {left}")
# print(f"Current right value: {right}")
... |
C# | UTF-8 | 2,978 | 2.828125 | 3 | [] | no_license | using ClearSkies.Prefabs.Bullets;
using Microsoft.DirectX;
using ClearSkies.Prefabs.Enemies.Tanks;
namespace ClearSkies.Prefabs.Turrets
{
/// <summary>
/// A Turret the player will control in the game.
/// </summary>
abstract class Turret : Prefab
{
#region Fields
protected Turret... |
JavaScript | UTF-8 | 878 | 2.640625 | 3 | [] | no_license | import 'fetch'
import { HttpClient } from 'aurelia-fetch-client';
export class WeatherApi {
constructor() {
this.http = new HttpClient().configure(config => {
config
.withBaseUrl('https://crossorigin.me/http://api.openweathermap.org/')
.withInterceptor({
request(request) {
... |
Java | UTF-8 | 402 | 2.125 | 2 | [] | no_license | package cn.edu.sdut.dao;
import java.util.List;
import cn.edu.sdut.domain.Staff;
public interface StaffMapper {
public List<Staff> selectAll();
public Staff selectStaff(int s_id);
public int add(Staff staff);
public int update(Staff staff);
public int delete(int s_id);
public int getSum();
public int avgAge... |
Java | UTF-8 | 311 | 2.5 | 2 | [] | no_license | package com.notesapp.models;
import java.sql.SQLException;
public class NoteTest {
public static void main(String []args) throws SQLException {
Note note1 = Note.insertNoteToDB("Hello", "Hello world from our notes app", 2);
System.out.printf("%s\n%s", note1.title, note1.content);
}
}
|
Python | UTF-8 | 1,190 | 3.296875 | 3 | [] | no_license | import random
print("__________ Dice Stimulator __________")
while True:
number = random.randint(1,6)
if number == 1:
print("----------")
print("| |")
print("| O |")
print("| |")
print("----------")
elif number == 2:
print("----------")
... |
Java | GB18030 | 1,285 | 2.484375 | 2 | [] | no_license | package com.icss.dao;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import com.icss.util.DbInfo;
public class BaseDao implements IBaseDao{
protected Connection conn;
public Connection getConn() {
return conn;
}
public void setConn(Connection conn) {
this.co... |
C++ | UTF-8 | 1,819 | 3.578125 | 4 | [] | no_license | /*
* @lc app=leetcode id=166 lang=cpp
*
* [166] Fraction to Recurring Decimal
*
* https://leetcode.com/problems/fraction-to-recurring-decimal/description/
*
* algorithms
* Medium (19.28%)
* Total Accepted: 84.7K
* Total Submissions: 439.4K
* Testcase Example: '1\n2'
*
* Given two integers representing ... |
Markdown | UTF-8 | 3,850 | 2.765625 | 3 | [] | no_license | ---
description: "Steps to Make Favorite Microwaved Bread Pudding for One"
title: "Steps to Make Favorite Microwaved Bread Pudding for One"
slug: 2131-steps-to-make-favorite-microwaved-bread-pudding-for-one
date: 2021-06-25T06:25:25.486Z
image: https://img-global.cpcdn.com/recipes/6233633403699200/680x482cq70/microwave... |
Java | GB18030 | 808 | 2.234375 | 2 | [] | no_license | package mr.flowcount;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Partitioner;
public class ProvincePartitioner extends Partitioner<Text, FlowBean>{
@Override
public int getPartition(Text key, FlowBean val... |
TypeScript | UTF-8 | 2,439 | 2.828125 | 3 | [
"MIT"
] | permissive | import database from '../../services/database';
import execution from '../../services/execution';
import LogManager from '../../services/logManager';
import cacheTTL from 'map-cache-ttl';
import {IncomingMessage, ServerResponse} from 'http';
const idCache = new cacheTTL('8s', '30s');
/**
* Gets the function ID of th... |
Shell | UTF-8 | 1,254 | 2.59375 | 3 | [] | no_license | # vim:ft=sh
alias be='bundle exec'
alias gerp='grep -rs --include=*.{js,coffee,hbs,json,rb,py} --exclude-dir={bower_components,node_modules,tmp,dist}'
alias all_vars='(set -o posix; set) | less -R'
alias cm='cd '$DOTFILE_DIR
alias cdg='cd $(git root)'
alias gemdir='cd $(gem environment gemdir)'
alias tree='tree -Ca --... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.