language stringclasses 15
values | src_encoding stringclasses 34
values | length_bytes int64 6 7.85M | score float64 1.5 5.69 | int_score int64 2 5 | detected_licenses listlengths 0 160 | license_type stringclasses 2
values | text stringlengths 9 7.85M |
|---|---|---|---|---|---|---|---|
C++ | UTF-8 | 316 | 3.234375 | 3 | [] | no_license | #include <iostream>
#include <math.h>
using namespace std;
int main()
{
float x; float y; float z;
float p;
cout<<"Ingrese el primer numero: ";
cin>>x;
cout<<"Ingrese el segundo numero: ";
cin>>y;
cout<<"Ingrese el tercer numero: ";
cin>>z;
p=(x+y+z)/3;
cout<<"Promedio: ";
cout<<p;
}
|
Markdown | UTF-8 | 1,699 | 3.09375 | 3 | [
"MIT"
] | permissive | # Amber-s-Training-Widget-1
This is to help with css flexbox mock ups, and understanding :)
-Yours Truly Amber Meador (Lambda TL extraordinaire)
Starter Questions / Things to Do
1. I want to center up the title "Amber's Widget" so it aligns with the rest of the content?
2. I would like the nav 'Things' to be spread... |
C++ | UTF-8 | 2,012 | 2.859375 | 3 | [] | no_license | class Solution {
public:
bool check (int start, int end, vector<int>& leagle) {
bool ok = false;
for (int i = start; i <= end; i++) {
if (leagle[i] == 2) {
return false;
} else if (leagle[i] == 1) {
ok = true;
}
}
re... |
C++ | UTF-8 | 2,263 | 2.875 | 3 | [] | no_license | /*
* File: main.cpp
* Author: peter
*
* Created on March 25, 2014, 5:01 PM
*/
#include <iostream>
#include <locale>
class Money {
public:
Money( long int amount) : amount_(amount) {}
operator long int() { return amount_; }
private:
long int amount_;
};
class My_money_io : public std::moneypunct... |
Java | UTF-8 | 2,946 | 3.65625 | 4 | [] | no_license | import java.util.*;
// Recursive implementation of
// word break problem in java
public class WordBreakProblem {
// set to hold dictionary values
private static Set<String> dictionary = new HashSet<>();
public static void main(String[] args) {
// array of strings to be added in dictionary set.
... |
Markdown | UTF-8 | 17,050 | 2.9375 | 3 | [] | no_license | ---
id: manage-your-families
themes: catalog-settings
title: Manage your **families and variant families**
popular: false
ee: false
related: what-is-a-family
---
# Manage your families
## See all your families
To see your families, edit them or create a new family go to `Settings/Families`.
![List of familie... |
Markdown | UTF-8 | 1,374 | 2.5625 | 3 | [
"CC-BY-4.0",
"MIT"
] | permissive | ---
title: 'Como: Substituir a árvore lógica'
ms.date: 03/30/2017
helpviewer_keywords:
- overriding the logical tree [WPF]
- logical tree [WPF], overriding
ms.assetid: 0ae4d074-8113-4b06-b4fa-e0f39d4967a6
ms.openlocfilehash: bf3459fff1a90326794d6713dd39c73596b0e960
ms.sourcegitcommit: 9b552addadfb57fab0b9e7852ed4f1f1b8... |
JavaScript | UTF-8 | 812 | 2.984375 | 3 | [] | no_license | const Paint = require('./paint.js')
const Room = require('./room.js')
const Decorator = function () {
this.stock = [];
}
Decorator.prototype.addPaint = function (paint) {
this.stock.push(paint);
}
Decorator.prototype.countLitres = function () {
total = 0;
for (i = 0; i < this.stock.length; i++) {
total +... |
C++ | WINDOWS-1256 | 370 | 2.984375 | 3 | [] | no_license | /**
* Author
* Date 2019/3/27
* Version 1.0
*/
#include <iostream>
using namespace std;
int main()
{
double ba, interestRate;
cout<<"Enter balance and interest rate (e.g., 3 for 3%): ";
cin>>ba>>interestRate;
double in = ba * (interestRate / 1200);
cout<<"The in... |
JavaScript | UTF-8 | 364 | 2.6875 | 3 | [
"MIT"
] | permissive | /* Start Scroll Top Button */
var scrollbtn = document.getElementById('scrollup');
window.onscroll = function() {
if (window.pageYOffset >= 900) {
scrollbtn.style.display = "block";
} else {
scrollbtn.style.display = "none";
}
};
scrollbtn.onclick = function() {
window.scro... |
Java | UTF-8 | 770 | 2.390625 | 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 pbo10119913latihan59;
/**
* Nama :Muhammad Alvin Rizqi Ramdahn
* Kelas : IF10K
* NIM : 10119913
* @author Lenovo
*/
publi... |
PHP | UTF-8 | 31,780 | 2.96875 | 3 | [] | no_license | <?php
use SebastianBergmann\CodeCoverage\Driver\Xdebug;
/**
* Classe d'accès aux données.
*
* PHP Version 7
*
*
* @category PPE
* @package GSB\Includes
* @author Cheri Bibi - Réseau CERTA <contact@reseaucerta.org>
* @author José GIL - CNED <jgil@ac-nice.fr>
* @copyright 2017 Réseau CERTA
* @licen... |
C# | ISO-8859-3 | 3,625 | 2.6875 | 3 | [] | no_license | // DOSBox, Scrum.org, Professional Scrum Developer Training
// Authors: Rainer Grau, Daniel Tobler, Zhlke Technology Group
// Copyright (c) 2012 All Right Reserved
using System.Collections.Generic;
using System.Linq;
using DosBox.Filesystem;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace DosBoxTest.Fil... |
C++ | UTF-8 | 1,069 | 2.90625 | 3 | [] | no_license | #ifndef EVENTS_HPP
#define EVENTS_HPP
#include <iostream>
#include <random>
#include <string>
#include "../../spark.hpp"
class Die {
private:
std::mt19937 eng{std::random_device{}()};
unsigned int rolls, sides;
public:
unsigned int roll() {
unsigned int roll = 0;
for(unsigned int i = 0; i < rolls; ++i) {
... |
Java | UTF-8 | 17,426 | 2.265625 | 2 | [] | no_license | package com.test;
import com.google.common.hash.BloomFilter;
import com.google.common.hash.Funnels;
import org.apache.commons.io.FileUtils;
import org.neo4j.graphdb.*;
import org.neo4j.graphdb.factory.GraphDatabaseFactory;
import org.neo4j.graphdb.schema.IndexDefinition;
import org.neo4j.helpers.collection.MapUtil;
i... |
Java | UTF-8 | 757 | 2.234375 | 2 | [] | no_license | package com.QuasarFireOperationMS.web.model.base;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
public class ResponseModel<T> extends ResponseInfo {
T data;
public ResponseModel(T data) {
this.data = data;
}
private ResponseM... |
Java | UTF-8 | 2,678 | 2.546875 | 3 | [] | no_license | package com.cs414.monopoly.ui.dialog;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.scenes.scene2d.Group;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.Touchable;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.... |
C | UTF-8 | 2,051 | 2.765625 | 3 | [] | no_license | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_fill_env.c :+: :+: :+: ... |
Java | UTF-8 | 4,275 | 2.671875 | 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 contactmanagementsoftware.strategy.pattern;
import contactmanagementsoftware.Acquaintances;
import contactmanagementsoftware.M... |
Python | UTF-8 | 394 | 2.90625 | 3 | [] | no_license | res1 = []
r, c = [int(temp) for temp in input().split()]
for temp in range(c + 1) : res1.append(0)
for tem in range(r) :
tem1 = [temp for temp in input().split()]
tem2 = list(map(int, tem1))
print(' '.join(tem1) + ' ' + str(sum(tem2)))
for mak in range(c) :
res1[mak] = res1[mak] + tem2[mak]
... |
Markdown | UTF-8 | 1,786 | 2.90625 | 3 | [
"MIT"
] | permissive | # About
The tests use [Intern](https://theintern.github.io/intern/).
There are unit tests and functional tests.
The unit tests test the *was-the-site-loaded-from-cache* decision making,
and the functional tests are used to capture Resource Timing data from a
[dummy site](./www/) (which can be used as input to the th... |
Shell | UTF-8 | 566 | 3.15625 | 3 | [] | no_license | #!/bin/bash
net="2001:470:5816:f::/64"
out_dir=/tmp/keylogger/
ip route add local "$net" dev lo
tcpdump -l -i any "icmp6[icmptype] == icmp6-echo and dst net $net" \
| awk -v out_dir="$out_dir" -f <(cat - <<-'SCRIPT'
function save_char(n, ip) {
n = strtonum("0x"n)
if(n == 0xd) {
n = 0xa;
}
i... |
Java | UTF-8 | 993 | 1.953125 | 2 | [] | no_license | package au.edu.rmit.bdm.Torch.mapMatching;
import au.edu.rmit.bdm.Torch.base.Torch;
public class MMProperties {
public String vehicleType = Torch.vehicleType.CAR;
public String mmAlg = Torch.Algorithms.HMM_PRECOMPUTED;
public String trajSrcPath;
public String osmPath;
public int batchSize = 10000... |
Java | UTF-8 | 1,024 | 3.640625 | 4 | [] | no_license | package Structural.Facade.Subsistem;
public class GameCoins {
private int gameCoins = 60;
public int getGameCoins() {
return this.gameCoins;
}
public void decreaseGameCoins(int spentCoins) {
this.gameCoins -= spentCoins;
}
public void increaseGameCoins(int earnedCoins) ... |
C# | UTF-8 | 1,792 | 3.453125 | 3 | [] | no_license | using System;
using System.Threading;
namespace ConsoleApp6
{
class Program
{
static void Main(string[] args)
{
Student student = new Student("Долженко Илья Андреевич", 32, "ТПО", 98, DateTime.Now);
Console.WriteLine($"Студент: {student.getName()}, Группа: {student.getG... |
Swift | UTF-8 | 466 | 2.609375 | 3 | [] | no_license | //
// InvestmentModel.swift
// MyInvestment
//
// Created by Daniel Yount on 1/30/19.
// Copyright © 2019 Daniel Yount. All rights reserved.
//
import Foundation
struct Investment: Codable {
let name: String
let amount: Double
let returnOnInvestment: Double
let id: Int
enum CodingKey... |
Java | UTF-8 | 1,992 | 2.234375 | 2 | [] | no_license | package pl.edu.pw.bgtTracker.db.entities;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import net.minidev.json.JSONObject;
import org.springframework.format.annotation.DateTimeFormat;
import pl.edu.pw.bgtTracker.db.entities.ba... |
Python | UTF-8 | 1,021 | 2.546875 | 3 | [
"BSD-3-Clause"
] | permissive | import torch
import io
from torchtext.utils import download_from_url, extract_archive, unicode_csv_reader
from torchtext.data.utils import ngrams_iterator
from torchtext.data.utils import get_tokenizer
from torchtext.vocab import build_vocab_from_iterator
def _csv_iterator(data_path, ngrams, yield_cls=False):
tok... |
C | UTF-8 | 2,629 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | /*
* k w i l d . c
*
* perform a wildcard match and place in the file list
* Original by VSL International, Switzerland.
* Modified: 01-May-87 J. A. Pickering, Southampton Univ., UK.
* Modified: Aug 1987 E. Zakrajsek, Cromemco Inc.
*/
#include "kermit.h"
extern char *strchr();
extern char *malloc();
/*
* ... |
JavaScript | UTF-8 | 1,098 | 2.90625 | 3 | [] | no_license | import React from 'react'
class TodoList extends React.Component {
constructor() {
super()
this.state = {
item:'',
items: []
}
this.handleInputChange=this.handleInputChange.bind(this)
this.addItem=this.addItem.bind(this)
}
handleInputChange(event)... |
C | UTF-8 | 162 | 3.0625 | 3 | [] | no_license | #include <stdio.h>
int main() {
char arr[101];
int i=0;
gets(arr);
while(arr[i]!='\0') i++;
for(i-=1; i>=0; i--) printf("%c", arr[i]);
return 0;
}
|
JavaScript | UTF-8 | 4,928 | 2.625 | 3 | [] | no_license | import conf from './conf';
const addYears = (dt, years) => {dt.setFullYear(dt.getFullYear() + years); return dt;}
const yearsAdded = (dt, years) => addYears(new Date(dt), years);
const addMonths = (dt, months) => dt.setMonth(dt.getMonth() + months);
const monthsAdded = (dt, months) => addMonths(new Date(dt), months);... |
Java | UTF-8 | 2,420 | 1.78125 | 2 | [] | no_license | // Generated code from Butter Knife. Do not modify!
package com.example.ui;
import android.view.View;
import butterknife.ButterKnife.Finder;
import butterknife.ButterKnife.ViewBinder;
public class MainActivity$$ViewBinder<T extends com.example.ui.MainActivity> implements ViewBinder<T> {
@Override public void bind(f... |
Java | UTF-8 | 659 | 1.523438 | 2 | [] | no_license | /*
* Copyright 2001-2008 Aqris Software AS. All rights reserved.
*
* This program is dual-licensed under both the Common Development
* and Distribution License ("CDDL") and the GNU General Public
* License ("GPL"). You may elect to use one or the other of these
* licenses.
*/
package net.sf.refactorit.c... |
Java | UTF-8 | 466 | 2.0625 | 2 | [
"Apache-2.0"
] | permissive | package com.store.sale.converters;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.store.sale.input.SaleInput;
import com.store.sale.model.Sale;
@Component
public class SaleDisassemblerInput {
@Autowired... |
Python | UTF-8 | 1,164 | 3.703125 | 4 | [] | no_license | #!/usr/bin/env python
# _*_coding:utf-8 _*_
#@Time :2019/1/3 16:31
#@Author :ZYK
#@FileName: 590_n-ary-tree-postorder-traversal.py
'''
给定一个 N 叉树,返回其节点值的后序遍历。
例如,给定一个 3叉树 :
返回其后序遍历: [5,6,3,2,4,1].
'''
"""
# Definition for a Node.
class Node(object):
def __init__(self, val, children):
self.val... |
Java | UTF-8 | 1,887 | 2.5625 | 3 | [] | no_license | package com.example.demo.config;
import com.example.demo.bean.UserBase;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.util.Date;
@Component... |
Python | UTF-8 | 1,584 | 2.8125 | 3 | [] | no_license | # Removing outliers using a Conditional or RadiusOutlier removal
# http://pointclouds.org/documentation/tutorials/remove_outliers.php#remove-outliers
import pcl
import numpy as np
import random
import argparse
parser = argparse.ArgumentParser(
description='PointCloudLibrary example: Remove outliers')
parser.add_... |
Markdown | UTF-8 | 2,328 | 3.515625 | 4 | [] | no_license | 一致性hash
凡是涉及到分布式的系统,就会有负载均衡和数据分布的问题。为了让连接(或者数据)能够分布得更均匀,很多时候会使用到Hash算法
Hash算法:
把任意长度得输入,通过Hash算法变换成固定长度的输出,这个输出就是Hash值,哈希值的空间远小于输入的空间,所以可能会发生“哈希碰撞”,即两个不同的输入产生了同一个输出。
负载均衡
先Hash再取模,在负载均衡中十分常见
hash(request)%n
假设我们现在有三个服务器,想要做负载均衡,就可以对请求的ip地址或者用户id等使用hash函数,然后计算得出hash值对3取模,余数为几,就把请求分配到相应的服务器上
弊端:
在分布式场景下,横向... |
C# | UTF-8 | 757 | 2.859375 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ChangePass
{
public partial class ChangePassword : Form
{
static string path =... |
JavaScript | UTF-8 | 1,661 | 3.8125 | 4 | [] | no_license | // Los elementos que queremos
let lista = document.getElementById("listaDeTareas");
let botonAgregarTarea = document.getElementById("botonAgregarTarea");
let inputTareaNueva = document.getElementById("nuevaTarea")
// Reaccionamos al clic
botonAgregarTarea.addEventListener("click", agregarTareaALista);
function agrega... |
Java | ISO-8859-1 | 5,738 | 3.390625 | 3 | [] | no_license | package dados.repositorios;
import negocios.classesBasicas.Cliente;
import negocios.classesBasicas.Produto;
import negocios.exceptions.EmptyListException;
/**
* Classe que representa o repositorio de clientes implementado em Lista.
*
* @author lfs
*
*/
public class RepositorioClientesLista implements Repositor... |
Ruby | UTF-8 | 206 | 2.625 | 3 | [] | no_license | require './Egoing'
#require_relative 'Egoing' #상대경로
module K8805_a #대문자로 써야 되네?
module_function()
def b()
return 'B'
end
end
puts(Egoing.a())
puts(K8805_a.b()) |
PHP | UTF-8 | 4,215 | 2.734375 | 3 | [
"MIT"
] | permissive | <?php
declare(strict_types=1);
/*
* This file is part of PHP CS Fixer.
*
* (c) Fabien Potencier <fabien@symfony.com>
* Dariusz Rumiński <dariusz.ruminski@gmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace PhpCsFixer;
us... |
C++ | UTF-8 | 2,752 | 2.5625 | 3 | [
"BSL-1.0"
] | permissive | /*
* ExpressionTree.h
*
* Created on: 2013/06/18
* Author: kryozahiro
*/
#ifndef EXPRESSIONTREE_H_
#define EXPRESSIONTREE_H_
#include <random>
#include <boost/property_tree/ptree.hpp>
#include "../../solver/GeneticOperable.h"
#include "../Program.h"
#include "ConstantNode.h"
#include "ExpressionNode.h"
#in... |
Shell | UTF-8 | 836 | 2.859375 | 3 | [
"MIT"
] | permissive | #!/bin/bash
yc_app=($(yc compute instance list | grep reddit-app | awk '{print $4, $10}'))
yc_db=($(yc compute instance list | grep reddit-db | awk '{print $4, $10}'))
if [[ "$1" == "--list" ]]; then
#heredoc
cat<<EOF
{
"_meta": {
"hostvars": {
"${yc_app[0]}": {
"ansible_host"... |
Markdown | UTF-8 | 1,083 | 3.3125 | 3 | [] | no_license | # GitHub_Issue_Tracker
Problem Description
Create a repository on GitHub and write a program in any programming language that will do the following:
Input : User can input a link to any public GitHub repository
Output :
Your UI should display a table with the following information -
- Total number of open issues... |
Markdown | UTF-8 | 15,466 | 2.546875 | 3 | [] | no_license | [m-dictionary-item name="D_HEADER_JUMBOTRON"]
# "Two inline pictures with text first right" component (PRO)
[/m-dictionary-item]
[m-dictionary-item name="D_MAIN_CONTENT"]
D_COMPONENT
[m-component component="two-inline-pictures-with-text-first-right" folder="images-and-text" M_ATTRIBUTES=""]
[m-component-ite... |
Python | UTF-8 | 8,320 | 2.53125 | 3 | [] | no_license | # engine.py
"""
Mini engine. Rewrite of source.engine due to removal of ui from old engine.
Defines systems, components, and managers that should be created and processed
during the main game.
"""
import random
import time
from source.common import join, join_drop_key, squares
from source.ecs import Position
from so... |
C | UTF-8 | 2,090 | 2.65625 | 3 | [
"Unlicense"
] | permissive | #ifndef __CONFIG_H_
#define __CONFIG_H_
/* 1 to add a space to the right of the bar. 0 for no pad. */
#define RIGHTPAD 1
/* The delimeter between modules */
#define MODULE_DELIMETER " | "
#define SIGBUF 256 /* This is how many bytes any given module can hold */
#define STATUSBUF 256 /* This is how many bytes the ... |
PHP | UTF-8 | 795 | 2.921875 | 3 | [] | no_license | <?php
class Session {
public static $account = null;
public static function logged_in() {
if(isset($_SESSION["loggedIn"]) && $_SESSION["loggedIn"] == true) {
return true;
} else {
return false;
}
}
public static function login($admin) {
$_SESSION[... |
JavaScript | UTF-8 | 490 | 3.421875 | 3 | [
"MIT"
] | permissive | /**
* Calculte player ELO rating after match
*/
export default ({ playerRating, opponentRating, victory }) => {
// K - factor
let K = 32;
if (playerRating >= 2100 && playerRating <= 2400) {
K = 24;
} else if (playerRating > 2400) {
K = 16;
}
// Calculate new ELO rating
const winProbability = 1 ... |
PHP | UTF-8 | 16,365 | 2.984375 | 3 | [
"MIT"
] | permissive | <?php
define('RSS1', 'RSS 1.0', true);
define('RSS2', 'RSS 2.0', true);
define('ATOM', 'ATOM', true);
/**
* RSS Feeds - Feed Writer class
*
* Genarate RSS 1.0, RSS2.0 and ATOM Feed
*
* @package RSS Feeds PHP
* @author Anis uddin Ahmad <anisniit@gmail.com>
* @author Guenther ... |
C# | UTF-8 | 1,850 | 3.953125 | 4 | [] | no_license | using System;
namespace InClassWeek6_Arrays
{
class Program
{
static void Main(string[] args)
{
// *********************************************** Monday 11/25/19 ************************************************************
//string person1 = "Lopa";
//stri... |
Shell | UTF-8 | 1,302 | 2.953125 | 3 | [] | no_license | #!/usr/bin/env bash
set -o errexit
echo "verify config file exists"
if [ ! -f src/config.json ]; then
echo "--- missing src/config.json ---"
exit
fi
echo "remove www dir"
rm -rf www && mkdir -p www/js www/css
echo "eslint before copying"
./node_modules/.bin/eslint src
echo "copy src files to www"
cp src/h... |
Python | UTF-8 | 1,735 | 3.734375 | 4 | [] | no_license | import random
while True:
try:
"""Taking input from user"""
first_name = str(input("Enter first name:"))
last_name = str(input("Enter last name:"))
if len(first_name) == 0 or len(last_name) == 0:
raise ValueError
except ValueError:
print("Invalid In... |
C# | UTF-8 | 2,447 | 2.546875 | 3 | [] | no_license | namespace CarolineCottage.Repository.Migrations
{
using System;
using System.Data.Common;
using System.Data.Entity;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.History;
using System.Linq;
using CarolineCottageClasses;
internal sealed class Configuration : DbM... |
Markdown | UTF-8 | 1,276 | 3.40625 | 3 | [
"MIT"
] | permissive | # Take
Берет только определенное количество значений, после чего завершается
> 💡 `take` является противоположным оператором оператора `skip`, если `take` берет *n* значений и закрывается, то `skip` пропускает эти значения
## Сигнатура
```typescript
take<T>(count: number): MonoTypeOperatorFunction<T>
```
## Параме... |
Java | UTF-8 | 14,836 | 1.65625 | 2 | [] | no_license | package com.arpit.miraquee.afterauthenticated;
import android.content.Context;
import android.net.Uri;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import... |
TypeScript | UTF-8 | 3,794 | 2.734375 | 3 | [
"MIT"
] | permissive | import { expect } from "chai";
import GildedRose from "../app/GildedRose";
import AgedBrie from "../app/AgedBrie";
import BackstagePasses from "../app/BackstagePasses";
import StandardItem from "../app/StandardItem";
import Sulfuras from "../app/Sulfuras";
describe("Gilded Rose", function () {
it("SellIn value is de... |
Python | UTF-8 | 384 | 3.578125 | 4 | [
"MIT"
] | permissive | # Script will start by asking for input.
# Then it will scan that input for big H and little h
# occurrences and print those out.
# See https://github.com/Static-Void-Academy/Module0-Challenges/blob/master/M0_C2.md
message = input('Input message: ')
H = 0
h = 0
for char in message:
if char == 'H':
H += 1
... |
Python | UTF-8 | 8,279 | 2.875 | 3 | [] | no_license | #coding=utf-8
import math
import copy
class Iris:
attribute=[]
data=[]
label=[]
pass
def load_dataset(filename="Iris_train.txt"):
f=open(filename)
line=f.readline().strip()
propty=line.split(',')[:-1]#属性名
total=Iris()
total.attribute=propty
dataset=[]#保存每一个样本... |
JavaScript | UTF-8 | 302 | 3.59375 | 4 | [] | no_license | function distancePoints(x1, y1, x2, y2) {
let point1 = { x: x1, y: y1 };
let point2 = { x: x2, y: y2 };
let distanseX = Math.pow(point1.x - point2.x, 2);
let distanseY = Math.pow(point1.y - point2.y, 2);
console.log(Math.sqrt(distanseX + distanseY));
}
distancePoints(2, 4, 5, 0); |
Markdown | UTF-8 | 3,719 | 4 | 4 | [] | no_license | ### python闭包
在一个内部函数中,对外部作用域的变量进行引用,(并且一般外部函数的返回值为内部函数),那么内部函数就被认为是闭包
闭包存在的意义就是它夹带了外部变量(私货),如果它不夹带私货,它和普通的函数就没有任何区别。**同一个的函数**夹带了**不同的私货**,就实现了不同的功能。其实你也可以这么理解,闭包和面向接口编程的概念很像,可以把闭包理解成轻量级的接口封装。
函数身为第一类对象,它可以作为函数的返回值返回,现在我们来考虑如下的例子:
```python
def print_msg():
# print_msg 是外围函数
msg = "zen of python"... |
Python | UTF-8 | 2,426 | 3.59375 | 4 | [] | no_license | import unittest
from character import *
from item import *
from location import *
from parse import *
class LocationTest(unittest.TestCase):
player = Player("hero", "i'm so brave", 100)
sword = Weapon("sword", "ouch it's sharp!", 100, 20)
front_gate = Location("Front gate", "You're outside the front gate... |
Python | UTF-8 | 3,305 | 3.015625 | 3 | [] | no_license | from dataclasses import dataclass
from typing import Dict, List, Optional
MIN_BYR = 1920
MAX_BYR = 2002
MIN_IYR = 2010
MAX_IYR = 2020
MIN_EYR = 2020
MAX_EYR = 2030
HEIGHT_UNIT_INCHES = "in"
HEIGHT_UNIT_CENTIMETERS = "cm"
MIN_HEIGHT_INCHES = 59
MAX_HEIGHT_INCHES = 76
MIN_HEIGHT_CENTIMETERS = 150
... |
C# | UTF-8 | 338 | 2.9375 | 3 | [
"MIT"
] | permissive | namespace Tests.Models.Inheritance
{
public abstract class Shape
{
protected Shape(bool prefill = false, string id = "123")
{
Id = id;
if (!prefill) return;
Color = "Purple";
}
public string Id { get; set; }
public string Color { get... |
Python | UTF-8 | 2,946 | 2.875 | 3 | [] | no_license | from chatterbot import ChatBot
from chatterbot.trainers import ChatterBotCorpusTrainer, ListTrainer
def create_chatbot():
"""Creates a ChatBot instance"""
bot = ChatBot(
'Xaman',
logic_adapters=[
{
'import_path': 'chatterbot.logic.BestMatch',
'defaul... |
Java | UTF-8 | 3,767 | 3.34375 | 3 | [] | no_license | /**
* Copyright © zuoguoqing
*
* @description
* @package name.zuoguoqing.concurrency.async
* @file Shop.java
* @author zuoguoqing
* @date 2020年10月11日
* @version
*/
package name.zuoguoqing.concurrency.async;
import java.util.Random;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.E... |
PHP | UTF-8 | 1,763 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | <?php
namespace inklabs\kommerce\EntityDTO\Builder;
use inklabs\kommerce\Entity\ShipmentTracker;
use inklabs\kommerce\EntityDTO\ShipmentTrackerDTO;
class ShipmentTrackerDTOBuilder implements DTOBuilderInterface
{
use IdDTOBuilderTrait, TimeDTOBuilderTrait;
/** @var ShipmentTracker */
protected $entity;
... |
Java | UTF-8 | 4,640 | 2.078125 | 2 | [] | no_license | package com.hxx.flexboxlayoutdemo;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import android.widget.TextView;
import com.google.a... |
C++ | GB18030 | 1,414 | 2.859375 | 3 | [] | no_license | #include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
/*
Ҫ˼·ȰѱȻ鼯жǷͨ kruskal=+鼯
*/
struct node
{
int u,v,w;
bool operator < (const node &x)const//ijԱʽthisָ
{ //ڳԱconstʾݵһָthisָ
... |
Markdown | UTF-8 | 5,953 | 3.4375 | 3 | [
"MIT"
] | permissive | # Angular Bootstrap Popup & Spinner
A simple and elegant angular service inspired by [ionic popup](http://ionicframework.com/docs/v1/api/service/$ionicPopup) to show loader/spinner and popup(or dialogue) window for `alert` and `confirm` with custom content and look.
## Dialoge Box
PopupSvc exposes two methods `alert... |
Swift | UTF-8 | 1,123 | 2.71875 | 3 | [
"MIT"
] | permissive | //
// NeumorphismTabTests.swift
// NeumorphismTabTests
//
// Created by touyou on 2020/01/08.
// Copyright © 2020 touyou. All rights reserved.
//
import XCTest
@testable import NeumorphismTab
class NeumorphismTabTests: XCTestCase {
override func setUp() {
// Put setup code here. This method is called... |
Java | UTF-8 | 2,601 | 2.390625 | 2 | [] | no_license | package controllers;
import backend.api.AgencyServiceGenerator;
import backend.api.ReservationService;
import backend.model.Payment;
import backend.model.PaymentType;
import backend.model.Reservation;
import backend.model.ReservationStatus;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.... |
Python | UTF-8 | 60 | 3.3125 | 3 | [] | no_license | a=3.5
b=4.5
add=a+b
sub=a-b
mul=a*b
print(add)
print(sub)
|
Python | UTF-8 | 606 | 3.765625 | 4 | [
"MIT"
] | permissive | '''
Compute hypotenuse length given angle and opposite side length.
Status: Accepted
'''
import math
###############################################################################
def compute_length(length, angle):
'''Compute hypotenuse length'''
return math.ceil(length / math.sin(angle * math.pi / 180.0))... |
C# | UTF-8 | 99,442 | 2.625 | 3 | [] | no_license | namespace ReviewApplication.Data.Migrations
{
using Core.Domain;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.Migrations;
using System.Linq;
internal sealed class Configuration : DbMigrationsConfiguration<ReviewApplication.Data.Infrastru... |
Java | UTF-8 | 5,260 | 2.28125 | 2 | [] | no_license | package com.lmax.api.internal.events;
import java.util.HashMap;
import java.util.Map;
import com.lmax.api.FixedPointNumber;
import com.lmax.api.TimeInForce;
import com.lmax.api.order.Order;
import com.lmax.api.order.OrderType;
public class OrderEventBuilder
{
private String instructionId;
private String orig... |
Java | UTF-8 | 34,071 | 2.453125 | 2 | [
"MIT"
] | permissive | package duke.parser;
import duke.command.BackupCommand;
import duke.command.ExitCommand;
import duke.command.ListPriorityCommand;
import duke.command.UndoBudgetCommand;
import duke.command.Command;
import duke.command.SetPriorityCommand;
import duke.command.DeleteCommand;
import duke.command.FilterCommand;
import duke... |
JavaScript | UTF-8 | 1,486 | 2.578125 | 3 | [] | no_license | var fs = require("fs");
var path = require("path");
var utilities = require("./utilities");
var logger = require("console");
const ONE_REQUIRED_GRADLE_VERSION = "6.7.1";
const GRADLE_DISTRIBUTION_URL = "https\\://services.gradle.org/distributions/gradle-" + ONE_REQUIRED_GRADLE_VERSION + "-all.zip";
function bumpGradl... |
JavaScript | UTF-8 | 519 | 3.96875 | 4 | [] | no_license | const todos = ['Go home', 'Pray', 'Sleep', 'Code', 'Watch movies']
// console.log(todos[todos.length - 1], todos[todos.length - 2])
console.log(todos)
// Delete the 3rd item
todos.splice(2, 1)
// Add a new item unto the end
todos.push('Call your girlfriend')
// Remove the first item from the list
todos.shift()
// con... |
TypeScript | UTF-8 | 630 | 2.71875 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import {
_GPSCoordinates,
_UnmarshalledGPSCoordinates
} from "./_GPSCoordinates";
/**
* <p>Specifies GPS-based criteria for including or excluding endpoints from a segment.</p>
*/
export interface _GPSPointDimension {
/**
* <p>The GPS coordinates to measure distance from.</p>
*/
Coordinates: _GPSCoordi... |
Java | UTF-8 | 718 | 3.21875 | 3 | [] | no_license | package DayEleven;
public class WareHouse {
private int countOrder;
private double balance;
public WareHouse(int countOrder, double balance) {
this.countOrder = countOrder;
this.balance = balance;
}
public int getCountOrder() {
return countOrder;
}
public void inc... |
Shell | UTF-8 | 1,083 | 3.125 | 3 | [
"Apache-2.0"
] | permissive | #!/bin/sh
# Copyright 2017 Google Inc. All rights reserved.
# Modifications copyright 2019 Erik Maciejewski
#
# 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/licens... |
Java | UTF-8 | 1,032 | 2.21875 | 2 | [] | no_license | package com.technicalinterview.ldaprestapi.service;
import com.technicalinterview.ldaprestapi.domain.User;
import com.technicalinterview.ldaprestapi.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service... |
Java | UTF-8 | 402 | 2.125 | 2 | [] | no_license | package bupt.lth;
import bupt.lth.SpringTextField;
//Spring界面皮肤工厂:具体工厂
public class SpringSkinFactory implements ISkinFactory {
public IButton createButton() {
return new SpringButton();
}
public ITextField createTextField() {
return new SpringTextField();
}
public IComboBox crea... |
PHP | UTF-8 | 544 | 2.53125 | 3 | [
"MIT"
] | permissive | <?php namespace AdventureTimeBundle\Model;
use AdventureTimeBundle\Constants;
use Symfony\Component\Finder\Exception\AccessDeniedException;
class PersonageModel
{
protected $em;
public function __construct($em)
{
$this->em = $em;
}
public function getPersonages()
{
return $t... |
Python | UTF-8 | 3,119 | 2.65625 | 3 | [] | no_license | from numpy import *
def loadDataSetFile(fileName):
dataMat = []
f = open(fileName)
for line in f.readlines():
curLine = line.strip().split(',')
proj_lonlats_string = [curLine[1],curLine[2]]
proj_lonlats = map(float, proj_lonlats_string)
dataMat.append(proj_lonlats)
return dataMat
def distEclud_lonlats(A_lo... |
Java | UTF-8 | 927 | 3.921875 | 4 | [] | no_license | import java.util.ArrayList;
public class ArrayGenericListEx {
public static void main(String[] args) {
// TODO Auto-generated method stub
/*The problem with above ArrayList is we want only strings to be in the list, but we can add other than strings also like below
ArrayList names = new ArrayList();
na... |
PHP | UTF-8 | 708 | 2.765625 | 3 | [] | no_license | <?php
$conn = new mysqli('localhost', 'root', '', 'proyecto');
// Check connection
if ($conn->connect_error) {
die("Database Connection failed: " . $conn->connect_error);
}
date_default_timezone_set('America/Mexico_City');
$d = date("Y-m-d");
$t = date("H:i:s");
if(!emp... |
JavaScript | UTF-8 | 7,290 | 2.5625 | 3 | [] | no_license | var express = require('express');
var router = express.Router();
var pg = require('pg');
var path = require('path');
var connectionString = require(path.join(__dirname, '../', 'config'));
module.exports = router;
router.post('/api/v1/upload', function(req, res) {
if (!req.files)
return res.status(400).send('No ... |
JavaScript | UTF-8 | 3,292 | 2.59375 | 3 | [] | no_license | $(() => {
const params = window.location.search.replace('?', '').split('&').reduce(
(p, e) => {
const a = e.split('=');
p[decodeURIComponent(a[0])] = decodeURIComponent(a[1]);
return p;
},
{},
);
const buyItem_currentCar = document.getElementsByClassName('order-settings__current-car... |
Swift | UTF-8 | 471 | 2.75 | 3 | [
"MIT",
"Apache-2.0",
"LicenseRef-scancode-facebook-software-license"
] | permissive | /**
Returns a minimal `Location` from a `LocationFragment`
*/
extension Location {
static func location(from locationFragment: GraphAPI.LocationFragment) -> Location? {
guard let id = decompose(id: locationFragment.id) else { return nil }
return Location(
country: locationFragment.country,
disp... |
Java | UTF-8 | 1,065 | 1.765625 | 2 | [] | no_license | /*
* generated by Xtext 2.16.0
*/
package org.xtext.msl.parser.antlr;
import com.google.inject.Inject;
import org.eclipse.xtext.parser.antlr.AbstractAntlrParser;
import org.eclipse.xtext.parser.antlr.XtextTokenStream;
import org.xtext.msl.parser.antlr.internal.InternalMSLParser;
import org.xtext.msl.service... |
PHP | UTF-8 | 376 | 2.859375 | 3 | [
"MIT"
] | permissive | <?php
namespace ODJuno\Interfaces;
/**
* Interface ODJunoInterface
*
* @author Fernando Campos de Oliveira <fernando@odesenvolvedor.net>
*
* @package ODJuno\Interfaces;
*/
interface ODJunoInterface
{
/**
* @param $json
*
* @return \stdClass
*/
public static function fromJson($json)... |
Markdown | UTF-8 | 621 | 2.53125 | 3 | [
"MIT"
] | permissive | **Work in progress**
# Moira Helm Charts [](https://t.me/moira_alert)
If you're new here, better check out our main [README](https://github.com/moira-alert/moira/blob/master/README.md).
## Accessing repo charts
To add Moira charts repo execute... |
Python | UTF-8 | 1,244 | 2.546875 | 3 | [] | no_license | from django.shortcuts import render, HttpResponse
from .models import Account
def index(request):
return HttpResponse('<h1>Welcome to accounts application!</h1>')
def create(request, uname, psw):
account = Account(username = uname, password = psw)
account.save()
return HttpResponse('Account: {} was c... |
Java | UTF-8 | 1,069 | 2.21875 | 2 | [] | no_license | package djs.com.happysharebuy.utils;
import android.content.Context;
import org.xutils.http.RequestParams;
/**
* Created by bin on 2017/7/1.
* 请求参数类
*/
public class CustomRequestParams {
// public CustomRequestParams(Context context) {
// super(HttpUrlUtils.url);
// int perid = PrefUtil.getIntP... |
Java | UTF-8 | 953 | 3.265625 | 3 | [] | no_license | import java.util.Scanner;
public class RFC {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String nombreCompleto= new String();
String nombre,aPaterno,aMaterno,rfc;
String fecha;
String dd,mm,aa;
int y;
System.out.println("Introduce tu nombre completo");
nombreCom... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.