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
JavaScript
UTF-8
2,928
2.515625
3
[ "CC-BY-3.0" ]
permissive
import { onFrame } from './init.js'; const gamepad = { stick: { x: 0, y: 0 }, camStick: { x: 0, y: 0 }, accelerate: false, brake: false, fire: false }; const heldKeys = new Set(); window.addEventListener('keydown', e => heldKeys.add(e.key.toUpperCase())); window.addEventListener('keyup', e => heldKeys.delete(e.k...
Markdown
UTF-8
4,609
2.9375
3
[]
no_license
16061121 2019年春季 北航《计算机科学前沿讲座》 挑战 ========== # 问题1 >3.1 在一个游戏中,主办方在三个门中任选一个,在门后放了一个奖品,另外两个门之后是空的。选手要在三个门中选择一个抽奖。 当选手选择了一个门,未曾打开门之前,主办方打开了另外两个门中没有奖品的那个门,并向选手说, 他可以改变他的选择,即转为选择剩下一个没有打开的门。 请问,如果选手此时改变选择, 他会提高或降低获奖的可能性么?提高多少?请给出你的分析。 会提高中奖的可能性。原来的中奖概率为1/3,现在转变为2/3,所以中奖概率提高了1/3。 如果没有主办方为选手打开门,选手的中奖概率为1/3。而主办方为选手打开一扇没有...
PHP
UTF-8
204
2.578125
3
[]
no_license
<h1>Добро пожаловать!</h1> <p> </p> <?php foreach($data as $row) { print_r("<br>Name: " . $row['name'] . "<br>Age: " . $row['age'] . "<br>Address: " . $row['address'] . "<br>"); } ?>
SQL
UTF-8
2,606
3.1875
3
[ "MIT" ]
permissive
CREATE DATABASE `db_noticias`; CREATE TABLE `tbl_categoria` ( `idcategoria` int(11) NOT NULL, `nomecategoria` varchar(35) NOT NULL ); INSERT INTO `tbl_categoria` (`idcategoria`, `nomecategoria`) VALUES (2, 'Entretenimento'), (1, 'Esporte'), (17, 'Futebol'), (19, 'Lutas'), (7, 'Música'), (10, 'Teatro'), (21, 'Tecn...
Java
UTF-8
1,506
2.0625
2
[]
no_license
package dressesPageTest; import org.testng.Assert; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import HomePage.basepageReuseMethods; import HomePage.dressesObjects; public class testdressesPage { dressesObjects ds; basepageReuseMethods bp; publi...
Java
UTF-8
802
2.25
2
[]
no_license
package com.baseserver.file.config; import org.springframework.boot.context.embedded.MultipartConfigFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import javax.servlet.MultipartConfigElement; /** * <p> * 文件服务器相关配置 * </p> * * @author shi_...
JavaScript
UTF-8
354
3.3125
3
[]
no_license
function log(target, name, descriptor){ var origin = descriptor.value; descriptor.value = function(target, name, descriptor){ console.log('Calling ${name} with', arguments); return origin.apply(this, arguments); } return descriptor; } class Sum{ @log add(a, b){ return a + b; } ...
C#
UTF-8
442
3.0625
3
[]
no_license
namespace PCG3.TestFramework { /// <summary> /// Provides methods to check, if certain conditions in a test method are met. /// If a condition is not met, the methods throw an AssertFailedException. /// </summary> public static class Assert { public static void AreEqual(object expected, object actual) ...
Python
UTF-8
414
3.53125
4
[]
no_license
#Name: Karthik and Vivan #Date: 10/2/2019 from random import random n = int(raw_input("Value of n: ")) trials = [] for trial in range(10000): m = 2*n +1 j = n+1 steps = 0 while 1<=j<=m: r = random() if r < 0.5: j+=1 else: j-=1 steps += 1 t...
Java
UTF-8
535
2.546875
3
[]
no_license
package com.estudo.ocp.solucao; public class CalculadoraDePreco { private ServicoDeFrete frete; private TabelaDePreco entrega; public CalculadoraDePreco(ServicoDeFrete frete, TabelaDePreco entrega) { this.frete = frete; this.entrega = entrega; } public double calcula(Produto prod...
JavaScript
UTF-8
374
3.3125
3
[]
no_license
/** * @param {number[]} nums * @return {number[]} */ var findDisappearedNumbers = function(nums) { let map = new Map(); let newArray = []; for(let i = 0; i < nums.length; i++){ map.set(nums[i]); } for(let i = 1 ; i <= nums.length; i++){ if(!map.has(i)){ newArray....
Java
UTF-8
1,176
3.140625
3
[]
no_license
package q028; public class Solution { public static void getNext(String a, int[] next) { int q,k; int m = a.length(); next[0] = 0; for (q = 1,k = 0; q < m; ++q) { while(k > 0 && a.charAt(q) != a.charAt(k)) k = next[k-1]; if (a.charAt(q) == a.charAt(k)) { ...
Java
UTF-8
475
1.859375
2
[]
no_license
package fr.adaming.dao; import java.util.List; import fr.adaming.model.BienImmobilier; import fr.adaming.model.Conseiller; import fr.adaming.model.Proprietaire; public interface IProprietaireDao { public int createProprietaire (Proprietaire prop); public int updateProprietaire (Proprietaire prop); ...
C++
UTF-8
1,194
3.0625
3
[]
no_license
#ifndef __IOPERAND_HPP__ #define __IOPERAND_HPP__ #include "abstractVM.hpp" class IOperand { private: /* Variable types std::string; int; double; float; bool; */ protected: public: /* Return types std::string; int; double; float; bool; */ //getters // virtual int getPr...
Java
UTF-8
857
2.1875
2
[]
no_license
package com.prj.web.entity; public class DramaObject { private int id; private String name; private String src; private String iframe; public DramaObject() { } public DramaObject(int id, String name, String src, String iframe) { super(); this.id = id; this.name = name; ...
JavaScript
UTF-8
569
4.3125
4
[]
no_license
// faster/easier way to access/unpack variable from arrays, objects const fruits = ["orange", "banana", "lemon"]; const friends = ["john", "peter", "bob", "anna", "kelly"]; const fruit1 = fruits[0]; const fruit2 = fruits[1]; const fruit3 = fruits[2]; console.log(fruit1, fruit2, fruit3); // orange, banana, lemon con...
Java
UTF-8
6,793
2.0625
2
[]
no_license
package com.gs.spider.dao; import com.gs.spider.utils.StaticValue; import org.apache.commons.io.FileUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.action.admin.indices.create...
Markdown
UTF-8
8,997
3.390625
3
[ "MIT" ]
permissive
# Ruby Holidays Gem [![Build Status](https://travis-ci.org/holidays/holidays.svg?branch=master)](https://travis-ci.org/holidays/holidays) Functionality to deal with holidays in Ruby. Extends Ruby's built-in Date and Time classes and supports custom holiday definition lists. ## Installation ``` gem install holidays ...
TypeScript
UTF-8
2,699
3.296875
3
[ "MIT" ]
permissive
/// <reference path="../typings/jasmine/jasmine.d.ts" /> import { Color } from "../lib/color"; describe("instance", () => { it("should construct from rgb array", () => { new Color([255, 0, 5]); }); it("should construct from css rgb string", () => { new Color("rgb(255, 0, 0)"); }); it("should not con...
Go
UTF-8
4,052
3
3
[ "MIT" ]
permissive
package dga import ( "bytes" "fmt" "io" "time" ) const ( // Star is used to model any predicate or any object in an NQuad. Star = "*" // DateTimeFormat is the format used by Dgraph for facet values of type dateTime. DateTimeFormat = "2006-01-02T15:04:05" // DgraphType is a reserved predicate name to refer ...
Markdown
UTF-8
1,674
3.8125
4
[]
no_license
#小解OC Categories `Categories`是Objective-C最有用的一个特性。事实上,`Category`可以使你为一个类添加一个方法,而不需要继承这个类甚至不用知道这个类的内部实现的细节。 这是非常有用的因为你可以为内建的对象添加方法。如果你想把在你应用中所有的的NSString实例添加一个方法,那你只加一个`Category`就好了。并不是所有的事情都需要自定义子类的。 比如,如果你想给NSString添加一个方法来判断字符串本身是否是URL,那就会像下面这样: #import <Cocoa/Cocoa.h> @interface NSString (Utilities) - (BOOL)...
Markdown
UTF-8
8,498
2.703125
3
[ "MIT", "LicenseRef-scancode-public-domain" ]
permissive
--- layout: post title: "谈独立思考" date: 2001-02-15 author: 欧远方 from: http://www.yhcqw.com/ tags: [ 炎黄春秋 ] categories: [ 炎黄春秋 ] --- [ 2001年第2期 谈独立思考 欧远方 ] 泗县第一小学举办金秋书画展,要我题字,我赠送他们一个条幅,上书“独立思考”四字。这是有感而发。 前些年,某刊发表一篇湖南人访问胡耀邦的文章。当时胡耀邦已不担任中共中央总书记。在他的谈话中,除反思他个人解放后犯了两个错误外,还谈到党内长期以来强调集中强调纪律而不强调民主,形成党员中产生驯服工具思想和奴隶主义思想,缺少独立思考。...
Markdown
UTF-8
4,853
2.71875
3
[]
no_license
# Article A931-2-1 I.-Toute demande d'agrément administratif présentée par une institution de prévoyance ou une union d'institutions de prévoyance en application de l'article L. 931-4 doit être produite en double exemplaire et comporter : a) La liste, établie conformément aux dispositions de l'article R. 931-2-1, de...
PHP
WINDOWS-1251
272
2.578125
3
[]
no_license
<!-- : . --> <html><body> <h2> :</h2> <?$f = fopen("../news.txt", "r") ?> <?for ($i=1; !feof($f) && $i<=5; $i++) {?> <li><?=$i?>- : <?=fgets($f, 1024)?> <?}?> </body></html>
Python
UTF-8
9,224
3
3
[]
no_license
'''Debbuging interface for the m5mbridge. All parts of m5mbridge that support debugging must be registered here. Debugging is hierarchical to control the degree of debugging output that is desired. Every part is a direct or indirect child of the debugging class 'all' which enables debugging globally. Children of 'all...
Python
UTF-8
1,007
3.25
3
[ "MIT" ]
permissive
# # @lc app=leetcode.cn id=13 lang=python3 # # [13] 罗马数字转整数 # # @lc code=start class Solution: def romanToInt(self, s: str) -> int: map_roman = {'I':1,'V':5,'X':10,'L':50,'C':100,'D':500,'M':1000} i = 0 str_len = len(s) str_list = [s[0]] sums = 0 while True: ...
Java
UTF-8
1,363
3.390625
3
[]
no_license
import java.io.*; import java.util.*; class nqueen{ public static void main(String args[])throws IOException{; System.out.println("Enter row and column"); Scanner sc = new Scanner(System.in); int row = sc.nextInt(); int col = sc.nextInt(); int matrix[][] = new int[row][col]; List<List<Cell>> answer = new ...
C#
UTF-8
1,255
2.703125
3
[]
no_license
using System.Collections; using System.Collections.Generic; using UnityEngine; using Fungus; namespace Assets.Scripts { [CommandInfo("Custom", "InteractionTrigger", "Modifies Stance and/or Mood by specified number.")] [AddComponentMenu("")] public class InteractionTrigger : Command { [Tooltip(...
Java
UTF-8
973
2.984375
3
[]
no_license
package br.com.renato.ControleDeTurmas; import br.com.renato.utilitarios.io.Console; public class App { public static void main(String[] args) { Instituicao a1 = new Instituicao(); a1.getTurmas(); String ra, nome, codigo, nomeTurma; String opcao; do { ...
Python
UTF-8
1,171
2.828125
3
[]
no_license
import cv2 import matplotlib.pyplot as plt import os from mtcnn import mtcnn import time def detect_face(weights_file, image_file): """ Introduction ------------ 使用mtcnn模型检测人脸 Parameters ---------- weights_file: 模型权重文件 image_file: 检测图片文件 Returns ------- resul...
Java
UTF-8
1,352
2.125
2
[]
no_license
package com.kunyuesoft.dao.mapper; import java.util.List; import com.kunyuesoft.model.domain.SysDictData; /** * 字典数据Mapper接口 * * @author kunyuesoft * @date Fri Aug 13 15:27:32 CST 2021 */ public interface SysDictDataMapper { /** * 查询字典数据 * * @param dictCode 字典数据ID * @return 字典数据 *...
Markdown
UTF-8
3,649
3.359375
3
[]
no_license
[1]: https://raw.githubusercontent.com/Geeksltd/Zebble.Docs/master/assets/automated-ui-testing/1.png ### ABOUT AUTOMATED UI TESTING ![1] User Interface test automation is a tricky practice. UI tests are an essential part of protecting your application's critical paths, and it's easy to start building them in the wr...
C++
UTF-8
3,096
2.5625
3
[]
no_license
// // pixel_layer.hpp // VLImageKit // // Created by chance on 3/30/17. // Copyright © 2017 Bychance. All rights reserved. // #ifndef pixel_layer_hpp #define pixel_layer_hpp #include <stdio.h> #include "common/common.h" #include "common/pixel_layer_defines.h" namespace VLImageKit { /** PixelLayer 作为图像合成抽象图层,不...
Markdown
UTF-8
388
2.53125
3
[]
no_license
# Competition-Model-of-Two-Species-in-Population-Biology-Using-pplane This project is to simulate the behavior of 2 species living in the same environment and compete on the same food source. By running this simulation, you can get the equilibria points for the biological system and determine the competition model typ...
C++
UTF-8
2,403
3.625
4
[]
no_license
// SIMPLICITY ( Adding 1 to the number directly instead of convert it to base 10 adding 1 and back to base b). #include <iostream> #include <bits/stdc++.h> using namespace std; int addTwoNumberInGivenBase(int number1 ,int number2, int base){ int carry = 0; int ans = 0; int multiplier = 1; while(number...
JavaScript
UTF-8
1,021
2.90625
3
[]
no_license
var App_B = (function(){ var forecasts; function getForecast(){ return new Promise(function(resolve, reject){ ServerAPI.fetchForecast(function(data){ console.log('Successfully retrieved weather data', data); forecasts = data.list; resolve(); }, function(error){ ...
C++
UTF-8
606
3.15625
3
[]
no_license
#include <iostream> #include "observer.hpp" struct Foo { void print(int a, int b) { std::cout << "Foo " << a + b << std::endl; } }; struct Bar { void print(int a, int b) { std::cout << "Bar " << a + b << std::endl; } }; int main() { Events<std::function<void (int, int)>> evt; ...
Java
UTF-8
4,137
1.9375
2
[]
no_license
package com.example.wander; import android.content.Context; import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.location.Location; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGrou...
Markdown
UTF-8
1,009
2.953125
3
[]
no_license
[Title]: # (Assess your risk) [Order]: # (1) ### Understand what could happen before you reveal sensitive information. (Learn about [Security Planning](umbrella://assess-your-risk/security-planning/beginner).) Sharing information that others would prefer to hide comes with potential consequences. These consequences...
C++
GB18030
1,345
3.6875
4
[]
no_license
class MergeSort { public: int* mergeSort(int* A, int n)//տʼĺ { int *p = new int[n]; //һAһСpʱmergeArrayлõ if (!p) return NULL; mergeSort(A, 0, n - 1, p); // delete[] p; return A; } private: void mergeSort(int *A, int begin, int end, int *temp) //ֳ { if (begin<end) { int middle = (begin + end...
TypeScript
UTF-8
425
2.78125
3
[]
no_license
export default class Move { row: number; col: number; player: number; pointValue: number; isHighestScoring: boolean; constructor( row: number, col: number, points: number, playerId: number, isHighestScoring: boolean = false ) { this.col = col; this.row = row; this.point...
C
UTF-8
527
3.765625
4
[]
no_license
#include<stdio.h> #define SWAP(x,y,t) ((t) = (x), (x) = (y), (y) = (t)) void permutation(char arr[], int i, int n){ int j, temp; if (i == n){ for(j=0; j<=n; j++) printf("%c", arr[j]); printf("\n"); return; } for(j=i; j<=n; j++){ SWAP(arr[i], arr[j], temp); permu...
Java
UTF-8
2,737
1.976563
2
[]
no_license
package com.example.healthguide; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.ImageButton; import android.widget.ImageView; public class workout_Activity extends AppCompatActivity { @Override protec...
Markdown
UTF-8
1,209
2.625
3
[ "MIT" ]
permissive
# MD5 File Hashing ```cs var md5 = System.Security.Cryptography.MD5.Create(); string[] imageFilePaths = System.IO.Directory.GetFiles($"./", "*.png"); foreach (string filePath in imageFilePaths) { string hashString = ""; using (var stream = System.IO.File.OpenRead(filePath)) { byte[] hashBytes = md5....
Java
UTF-8
1,327
2.765625
3
[]
no_license
package com.app.apprfid.asciiprotocol.enumerations; import java.util.HashMap; public class AlertDuration extends EnumerationBase { public static final AlertDuration LONG = new AlertDuration("lon", "A long duration"); public static final AlertDuration MEDIUM = new AlertDuration("med", "A medium duration ...
C++
UTF-8
354
3.359375
3
[]
no_license
#include<iostream> using namespace std; int main() { int number=50; int *p;//pointer to int p=&number;//stores the address of number variable cout<<"Address of p variable is \n"<<p; p=p+3; //adding 3 to pointer variable cout<<"\n After adding 3: Address of p variable is...
C++
UTF-8
715
3.125
3
[ "MIT" ]
permissive
#include "token.h" namespace libtoken { void token::clear(char new_parts_separator) { parts_separator = new_parts_separator; parts.clear(); } token::Type token::get_type() const { if (parts.size() == 0) // empty token return token::Type::Undefined; if (parts.size() > 1) // token consis...
Java
UTF-8
1,386
3.0625
3
[]
no_license
package com.kodilla.good.patterns.challenges.submodule2; import java.util.HashMap; import java.util.stream.Collectors; public class Order { private Customer customer; private HashMap<Product, Integer> productList; private String delivery; private Double toPay; private boolean isPrepared = false; public Order()...
Java
UTF-8
618
2.5
2
[]
no_license
package fr.arolla.core; import org.junit.Test; import static org.assertj.core.api.Assertions.assertThat; public class InMemoryPlayersTest { private InMemoryPlayers players = new InMemoryPlayers(); @Test public void should_reset_score__even_with_username_containing_uppercase_letter() { players.a...
C#
UTF-8
354
3.0625
3
[ "Apache-2.0" ]
permissive
using System; using System.Collections.Generic; using System.Text; namespace LeetCode.AskGif.Easy.String { public class FindLUSlengthSoln { public int FindLUSlength(string a, string b) { if (a == b) return -1; else return Math.Max(a.Lengt...
C
UTF-8
4,793
3.1875
3
[ "BSD-2-Clause" ]
permissive
/* * Generate a 'good enough' gaussian random variate. * based on central limit thm , this is used if better than * achipolis projection is needed */ double randn() { int i; float s = 0.0; for(i = 0;i<6; i++)s+=((float)rand())/RAND_MAX; return s - 3.0; } /* *print @size values of an integer vector @v ...
Java
UTF-8
741
3.375
3
[]
no_license
package cn.design.pattern.op; import java.util.ArrayList; import java.util.List; public class Turtle implements Observable { private List<Observer> observerList = new ArrayList<Observer>(); public void hungry() { this.notifyObservers("我饿了!"); } @Override public void addObserver(Observer...
C++
UTF-8
8,579
2.59375
3
[ "Apache-2.0" ]
permissive
// // Copyright 2019 Google LLC // // 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 to ...
C
UTF-8
406
2.828125
3
[]
no_license
#include<stdio.h> #include<stdlib.h> char * command_str; int kernel_enabled = 1; void command_parser(char * x){ if(x == "help"){ printf("%s", "-help: previews this screen..."); } } void commands(){ printf("%s", "<C:/>"); scanf("%s", command_str); command_parser(command_str); } int m...
Java
UTF-8
366
2.046875
2
[]
no_license
package kakao.pay.test.invest.interfaces; import java.util.List; /** * 투자정보 조회 서비스. */ public interface InvestProductReceiptService { /** * userId와 일치하는 투자정보들을 리턴합니다. * @param userId 사용자 식별값 * @return 투자정보 목록 */ List<InvestProductReceipt> findAllByUserId(long userId); }
PHP
UTF-8
498
2.703125
3
[]
no_license
<?php session_start(); if (isset($_GET['lang'])) { $_SESSION['lang'] = $_GET['lang']; } else { if(!isset($_SESSION['lang'])){ $_SESSION['lang'] = "en-en"; } } switch ($_SESSION['lang']) { case "en-en": include_once('assets/lang/en-en.php'); break; case "de-de": include_once('assets/lang/de-de.php'); bre...
Java
UTF-8
833
2.78125
3
[]
no_license
/** * Copyright (C), 2015-2018, XXX有限公司 FileName: Person Author: byron Date: 2018/8/6 14:02 * Description: History: * <author> <time> <version> <desc> * 作者姓名 修改时间 版本号 描述 */ package com.example.demo.other; public class Person { public String str =...
PHP
UTF-8
3,897
2.515625
3
[]
no_license
<?php /** * 主贴评论类,针对ebh_revert表 */ class RevertModel extends CModel{ /** *根据参数条件获取主贴评论评论列表 *@param array $param *@return array */ public function getList($param = array()){ $sql = 'select p.subject,u.username,r.*,c.crname from ebh_revert r left join ebh_classrooms c on r.cid = c.crid left join...
Go
UTF-8
428
3.140625
3
[ "MIT" ]
permissive
package validator import "strconv" // Range validator type Range struct { Min int Max int } // Check a param within a range func (r Range) Check(param string) (int, bool) { if isBlank(param) { return 0, true } v, err := strconv.Atoi(param) return v, err == nil && !(v < r.Min) && !(v > r.Max) } // Validate...
Java
UTF-8
2,820
2.390625
2
[]
no_license
package ch.heigvd.wns.security; import ch.heigvd.wns.security.jwt.JWTAuthenticationFilter; import ch.heigvd.wns.security.jwt.JWTLoginFilter; import ch.heigvd.wns.security.jwt.UserDetailsServiceImp; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import ...
Java
UTF-8
256
1.742188
2
[]
no_license
package gov.nist.csd.pm.policy.model.graph.relationships; import gov.nist.csd.pm.policy.exceptions.PMException; public class InvalidAssignmentException extends PMException { public InvalidAssignmentException(String msg) { super(msg); } }
PHP
UTF-8
780
2.78125
3
[]
no_license
<?php error_reporting(E_ALL); ini_set("display_errors", 1); $mysqli = new mysqli("mysql.eecs.ku.edu", "willthomas", "ANahy9ui", "willthomas"); $userId = $_POST["userId"]; if ($mysqli->connect_error) { die("Connect Failed: ". $mysqli->connect_error); } $checkQuery = "select * from Users where user_id = \"$userI...
C++
UTF-8
2,221
3.234375
3
[]
no_license
/* * Item.cpp * * Created on: Dec 7, 2016 * Author: lai61 */ #include "Item.h" #include <iostream> namespace std { Item::Item(rapidxml::xml_node<> *item) { // TODO Auto-generated constructor stub xml_node<>* elements = item->first_node(); turnon_flag = false; while(elements != NULL) { if(string(ele...
Rust
UTF-8
3,160
3.265625
3
[ "MIT", "LicenseRef-scancode-proprietary-license", "LicenseRef-scancode-unknown-license-reference" ]
permissive
use std::cmp::Ordering; use crate::common::math; use cgmath::{InnerSpace, Vector2, Vector3}; // TODO: make this a cvar const SUBDIVIDE_SIZE: f32 = 32.0; /// Subdivide the given polygon on a grid. /// /// The algorithm is described as follows: /// Given a polygon *P*, /// 1. Calculate the extents *P*min, *P*max and ...
Markdown
UTF-8
14,325
3.796875
4
[]
no_license
# REACT with Traversy Media <b>React</b> is a javascript library which is actually seen as a framework by a lot of devs due to the way it is used to handle multiple tasks relevant to the whole dev process. A react app is created on-the-go with some boilerplate code using `npx create-react-app *directory_name*` Th...
Markdown
UTF-8
31,248
3.359375
3
[]
no_license
[String / StringBuilder / StringBuffer](https://12bme.tistory.com/42) 1. 풀이 ```java class Solution { public String solution(int n) { String answer = ""; StringBuilder sb = new StringBuilder(); for(int i=0; i < n; i++){ if(i%2 == 0) sb.append("수"); else sb.append("박")...
C++
UTF-8
870
2.96875
3
[ "LicenseRef-scancode-public-domain" ]
permissive
#pragma once #include "ContextBase.h" #define GLTEST_DEFAULT_WIDTH 160 #define GLTEST_DEFAULT_HEIGHT 90 #define GLTEST_DEFAULT_DEPTH 4 //Basic interface for OpenGL tests class GLTest { protected: std::shared_ptr<ContextBase> context; int w; int h; int d; int size; int mode; /*Constructor. Set u...
Shell
UTF-8
308
3.046875
3
[]
no_license
# This file is part of elasticsearch restore. #!/bin/sh # URL where elasticsearch is running. OUTPUT=http://localhost:9200 # destination where dump files are located DUMPS=./dumps for FILENAME in "$DUMPS"/* do echo "$FILENAME" elasticdump --input=$FILENAME --output=$OUTPUT/$FILE --type=data done
Java
UTF-8
522
2.390625
2
[]
no_license
package movies.raemacias.com.movieappstage2.api; import retrofit2.Retrofit; import retrofit2.converter.gson.GsonConverterFactory; public class Client { public static final String BASE_URL = "http://api.themoviedb.org/3/movie/"; public Retrofit retrofit; public Retrofit getClient() { retrofi...
JavaScript
UTF-8
1,273
2.625
3
[]
no_license
var express = require("express"); var router = express.Router(); // Import the model to use its database functions. var burger = require("../models/burger.js"); router.get("/",function(req,res){ burger.selectAll(function(data){ var burgerObj = { burgers: data }; res....
Java
UTF-8
10,768
3.375
3
[]
no_license
import java.util.Scanner; import java.util.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; class TuringMachine { static JFrame frame1; static Container pane; static JButton btn1, btn2, btn3; static JLabel prompt; static JTextField input; static Insets inse...
Java
UTF-8
798
3.15625
3
[]
no_license
package Heap; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Collections; import java.util.PriorityQueue; public class Acmicpc_11279_최대힙 { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String...
Markdown
UTF-8
1,182
2.734375
3
[]
no_license
# redux-server-side-rendering My demo project of React and Redux server side rendering. I used the counter idea from the Redux Docs on [server side rendering](http://redux.js.org/docs/recipes/ServerRendering.html), as well as a very simple and easy to follow [universal-redux-template](https://github.com/mz026/univers...
Python
UTF-8
11,344
3
3
[ "MIT" ]
permissive
import numpy as np import PIL from IPython.display import display def reshape_single_as_picture(input, size): ''' Takes a np array and reshapes it to the specified size. Essentially, a transparent wrapper for np.reshape(input, size) ''' return np.reshape(input, size) def as_single_picture(input, size...
Java
UTF-8
368
1.875
2
[]
no_license
package ru.home.aws.pictures.service; import ru.home.aws.pictures.dto.Picture; public interface PictureService { Iterable<Picture> getPictures(); Picture getPictureById(Long id); Picture getRandom(); Picture getPictureByName(String name); Picture create(Picture picture); Picture update(Long id...
Java
UTF-8
2,722
2.3125
2
[]
no_license
package com.oce.app.service.impl; import com.oce.app.service.TypeServiceService; import com.oce.app.domain.TypeService; import com.oce.app.repository.TypeServiceRepository; import com.oce.app.service.dto.TypeServiceDTO; import com.oce.app.service.mapper.TypeServiceMapper; import org.slf4j.Logger; import org.slf4j.Logg...
Markdown
UTF-8
4,610
3.3125
3
[]
no_license
### Q1) How do I get started? (insert the "Important Notes for New ML Students" here) Familiarize yourself with the Resources menu (see the links on the left side of your browswer) and the Discussion Forums. Questions regarding Machine Learning should be posted on the course Discussion Forums Technical issues/sugg...
Python
UTF-8
1,291
2.59375
3
[]
no_license
import cv2 import numpy as np from keras.datasets import mnist from keras.layers import Dense, Flatten from keras.layers.convolutional import Conv2D from keras.models import Sequential from keras.utils import to_categorical import matplotlib.pyplot as plt import datetime as dt print("hora de inicio") print(dt.datetim...
Java
UTF-8
397
2.78125
3
[]
no_license
package duke.exceptions; //used when delete description is in the wrong format public class DeleteFormatException extends Exception { public final String DELETE_FORMAT_RESPONSE = "Could you rephrase that for Kao ( ̄▽ ̄*)?" + "\nThe following format must be used: delete [index]"; @Override publ...
C++
UTF-8
1,617
2.9375
3
[]
no_license
#include <minpt/math/matrix4.h> #include <minpt/core/exception.h> namespace minpt { Matrix4f& Matrix4f::inverse() { int idxr[4], idxc[4]; bool visited[4] = { false, false, false, false }; for (auto i = 0; i < 4; ++i) { auto row = 0; auto col = 0; auto pivot = 0.0f; for (auto r = 0; r < 4; ++r) ...
C
UTF-8
843
2.53125
3
[ "BSD-2-Clause" ]
permissive
/* * Copyright 2019 Shannon F. Stewman * * See LICENCE for the full copyright terms. */ #ifndef ADT_MAPPINGSET_H #define ADT_MAPPINGSET_H struct fsm_alloc; struct mapping_set; struct mapping; struct mapping_iter { struct hashset_iter iter; }; struct mapping_set * mapping_set_create(const struct fsm_alloc *a, ...
Markdown
UTF-8
4,229
2.65625
3
[]
no_license
![cabecalho memed desafio](https://user-images.githubusercontent.com/2197005/28128758-3b0a0626-6707-11e7-9583-dac319c8b45b.png) # Desafio do Autocomplete ## Problema: A forma como um médico interage com a tecnologia ao escrever uma prescrição é um dos pontos mais importantes para a Memed. Por dia, um médico realiza ...
C++
UTF-8
208
2.625
3
[]
no_license
#include <iostream> using namespace std; int main() { int n,c,b; cin >> n; c = 2; b = 1; do { b = b + 1; c = c * 2 ; } while (b < n); cout << c << endl; }
Python
UTF-8
206
3.53125
4
[]
no_license
# 100累加 i = 0 result = 0 while i < 100: i += 1 result += i print(result) j = 0 result2 = 0 while j < 100: j += 1 if (j % 2 == 0): print(j) result2 += j print(result2)
Python
UTF-8
770
4.25
4
[]
no_license
#Exmple for overriding #Base or parent class class Employee: def __init__(self, name, sal): self.name = name self.salary = sal def getName(self): return self.name def getSalary(self): return self.salary #Sub or child class class SalesOfficer(Employee): def __init__(se...
Markdown
UTF-8
6,797
2.78125
3
[]
no_license
--- title: '安卓文本居中——关于css,字体和line-box的笔记' date: 2018-12-27 2:30:12 hidden: true slug: zfeub4j94xg categories: [reprint] --- {{< raw >}} <h2 id="articleHeader0">前言</h2> <p>本文主要探索在安卓系统下浏览器中小字号中文居中的实现以及在混排时的对齐处理。本文是受《<a href="http://iamvdo.me/en/blog/css-font-metrics-line-height-and-vertical-align"...
Python
UTF-8
196
3.390625
3
[]
no_license
def sqrt(x): last_guess = x/2.0 while True: guess = (last_guess + x/last_guess)/2 if abs(guess - last_guess) < .000001: return guess last_guess = guess
JavaScript
UTF-8
2,480
3
3
[]
no_license
$(function(){ var loaderPoke = $('.js-loader-pokeball').hide(); var setBackgroundForType = function(type) { var color = null switch(type) { case 'water': color = 'lightblue' break; case 'fire': color = 'red' break; default: color = 'green' } $('...
Java
UTF-8
6,888
1.804688
2
[]
no_license
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.sirelab.controller.estructuralaboratorio; import com.sirelab.ayuda.MensajesConstantes; import com.sirelab.bo.int...
JavaScript
UTF-8
3,435
2.53125
3
[]
no_license
// CRUD create read update delete // const mongodb = require('mongodb') // const MongoClient = mongodb.MongoClient // const MongoClient = mongodb.ObjectID const { MongoClient, ObjectID } = require ('mongodb'); const connectionURL = 'mongodb://127.0.0.1:27017' const databaseName = 'aics-test' // const id=new ObjectID(...
C++
UTF-8
3,805
3.1875
3
[]
no_license
/********************************** ** Program Name: main.cpp ** Author: Miao Pan ** Date: 01/13/2019 ** Description: This is the main function of the Langton's Ant game. **********************************/ #include <iostream> #include <string> #include "menu.cpp" #include "Board.cpp" #include "Ant.cpp" using std::...
JavaScript
UTF-8
17,124
2.8125
3
[]
no_license
$(document).ready(function() { /* ============================================================== INITIALISATION ==============================================================*/ var page = 1 var selectedNumber = parseInt($("input[type='radio']:checked").val()) var mod...
Java
UTF-8
1,189
2.359375
2
[]
no_license
package com.lp.sidebar_master.adapter; import android.content.Context; import com.lp.sidebar_master.R; import com.lp.sidebar_master.base.viewholder.CommonAdapter; import com.lp.sidebar_master.base.viewholder.ViewHolder; import com.lp.sidebar_master.presenter.CountryBean; import java.util.List; /** * 俩种adapter封装框架...
Ruby
UTF-8
2,610
2.828125
3
[]
no_license
require 'nokogiri' require 'nori' require_relative 'error' module WSDiscovery # Represents the probe response. class Response attr_accessor :response # @param [String] response Text of the response to a WSDiscovery probe. def initialize(response) @response = response end # Shortcut ac...
C#
UTF-8
1,257
3.328125
3
[ "MIT" ]
permissive
using System; using System.Collections.Generic; using System.Text; namespace System.Data.Wrapper { /// <summary> /// Extension methods /// </summary> internal static class Extensions { /// <summary> /// Ensures that a string ends with ".sql" /// </summary> ...
JavaScript
UTF-8
2,886
2.859375
3
[]
no_license
import React, { Component } from "react"; //Используем готовый компонент infiniteScroll import InfiniteScroll from "react-infinite-scroller"; import ArrayItem from "./ArrayItem"; import ArrayList from "./ArrayList"; //Запрос локального JSON через fetch. const dataLink = `${window.location.href}data.json`; class Item...
PHP
UTF-8
777
2.546875
3
[]
no_license
<?php /** @noinspection PhpMissingDocCommentInspection */ declare(strict_types=1); namespace tests\Exporters\Processors; use PHPUnit\Framework\TestCase; use vvvitaly\txs\Core\Export\Data\Transaction; use vvvitaly\txs\Exporters\Processors\AutoIdCounter; final class AutoIdCounterTest extends TestCase { public fu...
Markdown
UTF-8
3,422
3.4375
3
[]
no_license
# JavaScript All the Way Down ![turtles](http://www.tricycle.com/sites/default/files/images/webexclusives/turtles.jpg) Today, you learned how to allow your client-side JavaScript to talk to your Express server through the magic of AJAX. Tonight, you're going to get some more practice with AJAX and continue working wi...
PHP
UTF-8
163
3.3125
3
[]
no_license
<?php // Function to find out BMI function BMI($mass,$height){ $BMI = $mass / ($height * $height); echo "Your BMI Is = $BMI <br>"; } BMI(70,6);
C++
UTF-8
370
2.96875
3
[]
no_license
#include <bits/stdc++.h> using namespace std; int main() { int n; long sum = 0; string s; cin>>n; while (n-- > 0){ cin>>s; if (s == "Tetrahedron"){ sum += 4; } else if ( s == "Cube"){ sum += 6; } else if (s == "Octahedron"){ sum += 8; } else if (s == "Dodecahedron"){ sum += 12; } e...