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 |
|---|---|---|---|---|---|---|---|
Markdown | UTF-8 | 6,965 | 3.171875 | 3 | [] | no_license | <h1 align="center">JavaScript Games</h1>
<h2 align="center">
<img src="assets/gamepad.png" height="300px" width="310;ppx">
</h2>
- ### 🚥 Connect [](https://github.com/amirtha4501/JavaScriptGames/tree/master/Connect)
- ### 🧠 Memory Game [![Let... |
Java | ISO-8859-1 | 2,027 | 2.75 | 3 | [] | no_license | package carvajal.autenticador.android.util;
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import org.apache.log4j.Logger;
import android.os.AsyncTask;
/**
* Implementacin de lo Mtodos utilitarios para la verificacin de
* conectividad.
*
* @author g... |
Markdown | UTF-8 | 2,226 | 2.703125 | 3 | [
"BSD-3-Clause"
] | permissive | <img align="left" height="96" width="229" src="https://github.com/kumina/k8s-redirectory/blob/master/documentation/_static/redirectory_logo.png">
Redirectory is a tool that manages redirects on a kubernetes cluster.
Requests that would usually end in a **404 PAGE NOT FOUND** can now be
redirected to new pages specifie... |
JavaScript | UTF-8 | 1,022 | 2.53125 | 3 | [] | no_license | var Discord = require("discord.js");
var exports = module.exports = {};
var request = require('request');
exports.test = function(msg) {
var data = {};
data.title = "hello";
data.color = [0,0,256];
var a = new Discord.RichEmbed();
msg.channel.sendEmbed({
color: 3447003,
title: 'Thi... |
PHP | UTF-8 | 3,166 | 2.53125 | 3 | [] | no_license | <?php
use Phinx\Migration\AbstractMigration;
class N4903 extends AbstractMigration
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstra... |
C++ | UTF-8 | 2,141 | 2.8125 | 3 | [] | no_license | #include "PWM.h"
PWM_PCA985::PWM_PCA985()
{
std::cout << "[Actuator|PWM] Initializing" << std::endl;
pwmDriver = new I2CDevice(PCA985_DEVICE_ID);
if(!pwmDriver->isValid()) {
std::cout << "[Actuator|PWM] Failed to create i2c device!" << std::endl;
}
init();
}
PWM_PCA985::~PWM_PCA985()
{
delete pwmDriv... |
Python | UTF-8 | 2,822 | 2.953125 | 3 | [] | no_license | import turtle
import numpy as np
import pygame
from config import *
from game_object import GameObject, DynamicObject
class Rocket(DynamicObject):
def __init__(self, position=(SCREEN_WIDTH / 2, 0), rotation=np.pi / 2, scale=10):
super().__init__(position, rotation, scale)
self.time_since_thrust... |
Java | UTF-8 | 1,051 | 3.265625 | 3 | [] | no_license | import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class BallTest {
/**
* Test that updatePosition changes the x and y position of the ball instance when called
*/
@Test
void updatePosition() {
Ball ball = new Ball();
assertEquals(ball.getPosit... |
C# | UTF-8 | 1,460 | 2.515625 | 3 | [] | no_license | using CIV.Services;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace CIV.Controllers
{
[Route("api/[controller]")]
public class GameController: Controller
{
private readonly IHubContext<GameHub> _gameHubCo... |
PHP | UTF-8 | 3,112 | 2.6875 | 3 | [] | no_license | <?php
include_once $_SERVER['DOCUMENT_ROOT'].'/classes/photoCollection.php';
include_once $_SERVER['DOCUMENT_ROOT'].'/classes/photo.php';
include_once $_SERVER['DOCUMENT_ROOT'].'/classes/photo_comment.php';
include_once $_SERVER['DOCUMENT_ROOT'].'/classes/photo_annotation.php';
include_once 'verifySession.php';
i... |
C++ | UTF-8 | 3,268 | 2.703125 | 3 | [] | no_license | #pragma once
#include <vector>
#include <Eigen/Core>
struct Coordinate {
public:
int idx_[ 8 ];
float val_[ 8 ];
float nval_[ 8 ];
};
class ControlGrid
{
public:
ControlGrid(void);
~ControlGrid(void);
public:
std::vector< Eigen::Vector3f > ctr_;
int resolution_;
float length_;
float unit_length_;
int min_b... |
Markdown | UTF-8 | 833 | 2.984375 | 3 | [] | no_license | # node-errno
[](https://travis-ci.org/evanlucas/node-errno)
An easier way to track errno's
This is mainly for use with [node-launchctl](http://github.com/evanlucas/node-launchctl)
## Install
```bash
$ npm install syserrno
```
## API
### #strerror(err... |
C++ | UTF-8 | 4,629 | 3.28125 | 3 | [] | no_license | /*
Li Chen Koh's solution to Google Code Jam Round 2 2017 Problem B
This is adapted from my original submission during the live contest.
Full Problem Statement:
https://code.google.com/codejam/contest/5314486/dashboard#s=p1&a=0
Problem Summary:
You have a roller coaster that has N seats numbered 1 through N from ... |
Python | UTF-8 | 791 | 3.640625 | 4 | [] | no_license | import unittest
"""
Chocolate covered candy
Phil the confectioner is making a new batch of chocolate covered candy. Each candy centre is shaped like an ellipsoid of revolution defined by the equation:
$b^2 x^2 + b^2 y^2 + a^2 z^2 = a^2 b^2$.
Phil wants to know how much chocolate is needed to cover one candy centre wi... |
Java | UTF-8 | 1,835 | 2.234375 | 2 | [
"Apache-2.0"
] | permissive | /**
* Copyright [2016] [Muhammad Afzal]
*
* 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 agree... |
Python | UTF-8 | 4,572 | 3.234375 | 3 | [] | no_license | import datetime
import time
from random import randint
class PeriodRandomizer:
def __init__(self):
# 0 - 23 format
self.from_hour = 7
self.to_hour = 23
self.from_time = None
self.to_time = None
self.work_for = 6 * 60 # means bot will be working for a total of # minutes
# periods
sel... |
Java | UTF-8 | 1,011 | 1.890625 | 2 | [] | no_license | package com.neorays.cnfgs;
import java.util.Properties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.sprin... |
Swift | UTF-8 | 709 | 3.03125 | 3 | [] | no_license | //
// CircularViewing.swift
// TMS
//
// Created by Suke Hozumi on 8/7/16.
// Copyright © 2016 yhozumi. All rights reserved.
//
import UIKit
//CircularViewing protocol helps with reusability and abstraction of configuring a view to a circular view
protocol CircularViewing {
func configureCircular(view: [UIView]... |
C# | UTF-8 | 749 | 3 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LeetCode
{
class _328//奇偶链表
{
public ListNode OddEvenList(ListNode head)
{
if (head==null||head.next==null)
return head;
ListNod... |
Java | UTF-8 | 2,208 | 3.59375 | 4 | [] | no_license | import java.util.ArrayList;
import java.util.List;
/***
* Klasa opisująca użytkownika systemu typu trener
* @author Maria
*
*/
public class Trener extends Osoba {
private ArrayList<Uzytkownik> podopieczni = new ArrayList<Uzytkownik>();
/***
* Konstruktot
* @param nick Nazwa konta
* @param zdjecieProfilow... |
Java | UTF-8 | 1,653 | 2.78125 | 3 | [] | no_license | package com.simplilearn.training.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@Entity
public class Product {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private String name;
p... |
C# | UTF-8 | 1,909 | 2.875 | 3 | [] | no_license | using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Explicit)]
public struct Int32Fog
{
//something like union
[FieldOffset(0)] public Int32 Value;
[FieldOffset(0)] public byte Byte1;
[FieldOffset(1)] public byte Byte2;
[FieldOffset(2)] public byte Byte3;
[FieldOffset(3)] public byte B... |
Python | UTF-8 | 2,505 | 3.625 | 4 | [] | no_license | #!/usr/bin/env python3
"""
Mailroom 1
"""
import sys
donors = [("Robyn Rihanna", [100, 200, 300]),
("Ariana Grande", [2250, 4000, 1000]),
("Beyonce Carter-Knowles", [150000, 3500, 25000]),
("Aubrey Drake Graham", [15000, 5500.25, 1200]),
("Justin Bieber", [2500, 250, 750.50])
... |
C++ | UTF-8 | 3,257 | 2.625 | 3 | [] | no_license | // -*- Mode: c++; tab-width: 8; c-basic-offset: 2; indent-tabs-mode: nil -*-
// NOTE: the first line of this file sets up source code indentation rules
// for Emacs; it is also a hint to anyone modifying this file.
// File : the_document.hxx
// Author : Pavel Aleksandrovich Koshevoy
// Created : Tue... |
Java | UTF-8 | 7,824 | 1.914063 | 2 | [] | no_license | package entidades;
import java.io.Serializable;
import javax.persistence.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import enumerados.Raza;
import enumerados.TipoParto;
import enumerados.convert.RazaConvert;
import enumerados.convert.TipoPartoConvert;
i... |
Python | UTF-8 | 2,129 | 3.8125 | 4 | [] | no_license | #CSV
# Q1 read the ford_escort.csv example file using python csv library and print each row
import csv
with open('ford_escort.csv', 'r') as file:
reader = csv.reader(file, delimiter = ',')
for row in reader:
print(row)
# Q2 Extend the above so that the data is read into a dictionary
import csv
wi... |
C# | UTF-8 | 3,467 | 2.53125 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace StudentEVL
{
public partial class manageUserForm : Form
{... |
Markdown | UTF-8 | 555 | 2.640625 | 3 | [] | no_license | # File reporter.py
## Class Reporter
This class should be used to print instead of print()
It should be imported as follows:
from urnai.utils.reporter import Reporter as rp
or
from utils.reporter import Reporter as rp
And then the function report should be called to print:
rp.report("My message")
If the message is a ... |
Ruby | UTF-8 | 3,099 | 2.578125 | 3 | [] | no_license | require 'csv'
require 'json'
require 'mongo'
require 'gnuplot'
require 'rest-client'
def mean(array)
array.inject(array.inject(0) { |sum, x| sum += x } / array.size.to_f)
end
client = Mongo::Client.new([ '127.0.0.1:27017' ], :database => 'analytics')
perfomance_data = nil
verified_compensations = client["verifi... |
C | UTF-8 | 4,339 | 2.59375 | 3 | [] | no_license | #include <stdio.h>
#include <unistd.h>
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
typedef unsigned char u8;
#define SHORT_MESSAGE 0x10
#define LONG_MESSAGE 0x11
struct hidpp2_message {
u8 report_id;
u8 device_index;
u8 feature_index;
#define HIDPP_SET_FUNC(msg, func) ((msg)-... |
TypeScript | UTF-8 | 1,135 | 2.78125 | 3 | [
"MIT"
] | permissive | import { z } from 'zod'
export const WORD_IS_NOT_INCLUDED_ERROR = 'WordIsNotIncludedError'
export const WORD_IS_ALREADY_PRESENT_ERROR = 'WordIsAlreadyFoundError'
export const WORD_LENGTH_IS_LESS_THAN_REQUIRED_ERROR =
'WordLengthIsLessThanRequiredError'
export type ApplyWordError = [
typeof WORD_IS_NOT_INCLUDED_ER... |
C# | UTF-8 | 1,681 | 3.1875 | 3 | [] | no_license | using System;
using System.Security.Principal;
namespace DirectoryLibrary
{
public class DirectoryUtility
{
/// <summary>
/// 特別解析 objectguid 和 objectsid 的值,轉為人類可閱讀的字串,其它皆轉為字串。
/// </summary>
/// <param name="name">Attribut Name</param>
/// <param name="value">Attribut ... |
Java | UTF-8 | 3,568 | 2.78125 | 3 | [] | no_license | package com.mycompany.app;
import static spark.Spark.get;
import static spark.Spark.port;
import static spark.Spark.post;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import spark.ModelAndView;
import spark.template.mustache.MustacheTemplateEngine;
public class App {
public static Str... |
JavaScript | UTF-8 | 9,346 | 2.515625 | 3 | [] | no_license | /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (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.mozilla.org/MPL/
*
... |
C# | UTF-8 | 922 | 2.75 | 3 | [] | no_license | using System;
using System.Threading;
using Confluent.Kafka;
namespace ApacheKafkaExample.Producer1
{
class Program
{
static void Main(string[] args)
{
var config = new ProducerConfig { BootstrapServers = "localhost:9092" };
Action<DeliveryReport<Null, string>> handler... |
Python | UTF-8 | 449 | 3.015625 | 3 | [] | no_license | from tqdm import tqdm
def save_img(name, data_array):
data = _print_img(data_array)
with open(name, 'w') as f:
f.write(data)
def _print_img(data_array):
w = len(data_array[1])
h = len(data_array)
rows = []
for row in tqdm(data_array):
row_data = [str(int(pix*255)) for pix in r... |
Python | UTF-8 | 831 | 3.671875 | 4 | [] | no_license | loops
for loop
savings = [100,200,150,450,600]
sum=0
for saved in savings:
sum+=saved
print("total savings are",sum)
#
a="whats up"
for i in a:
print(i) # for single line use end parameter in print
savings = [100,200,150,450,600]
sum=0
for saved in savings[0:3]:
sum+=saved
print("total savings are",sum)
#remeber ... |
Java | UTF-8 | 352 | 1.859375 | 2 | [] | no_license | package com.lukasz.myweather.webApi;
import com.lukasz.myweather.POJO.WeekWeather;
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.Query;
/**
* Created by Lukasz on 2018-03-07.
* Upload Picture
*/
public interface WebService {
@GET("daily?&APPID=032a76b432cfa81e175c33bc81dae187")
... |
JavaScript | UTF-8 | 390 | 2.546875 | 3 | [
"MIT"
] | permissive | import mongoose, { Schema } from 'mongoose';
const locationSchema = new Schema({
name: String,
});
locationSchema.statics.create = function (locationName) {
const location = {name: locationName};
const newLocation = new this(location);
return newLocation.save().catch(e=>console.log(e));
};
const location = m... |
Markdown | UTF-8 | 1,629 | 2.515625 | 3 | [
"MIT"
] | permissive | Sanjay Nair (sanjaysn@usc.edu)
-----------------------------
Compler requirements
---------------------
Implementation of this project is done using c++. The implemenation uses std library classes such as std::string and std::map. My nunki account (default setup by ISD) points to the g++ directory /usr/usc/gnu/gcc/3.3... |
Java | UTF-8 | 2,488 | 2.578125 | 3 | [] | no_license | package AlienWarsLogin;
import restShared.AccountDTO;
import Hashing.HashingClass;
import javax.sql.rowset.CachedRowSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class AlienwarsLogin {
private DbClass dbClass = new Db... |
Python | UTF-8 | 6,233 | 2.53125 | 3 | [] | no_license | from __future__ import print_function
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap as Basemap
from matplotlib.colors import rgb2hex
from matplotlib.patches import Polygon
from matplotlib.collections import PatchCollection
import csv
df = pd.r... |
C# | UTF-8 | 3,296 | 2.78125 | 3 | [] | no_license | #region
//
// Bdev.Net.Dns by Rob Philpott, Big Developments Ltd. Please send all bugs/enhancements to
// rob@bigdevelopments.co.uk This file and the code contained within is freeware and may be
// distributed and edited without restriction.
//
#endregion
using System;
using Bdev.Net.Dns.Records;
namespace Bdev.N... |
Python | UTF-8 | 145 | 2.9375 | 3 | [] | no_license | s = int(input())
n = [1,0,0]
if s < 3:
print(n[s])
else:
for i in range(s-2):
n.append(n[-1]+n[-3])
print((n[-1])%1000000007) |
Go | UTF-8 | 487 | 2.6875 | 3 | [
"MIT"
] | permissive | package slash
import (
"fmt"
"github.com/nlopes/slack"
)
type SlackMessageError struct {
*slack.Msg
}
func NewSlackMessageError(text string) *SlackMessageError {
return &SlackMessageError{
&slack.Msg{
ResponseType: "ephemeral",
Text: text,
},
}
}
func NewSlackMessageErrorf(format string, tok... |
Python | UTF-8 | 352 | 4.125 | 4 | [] | no_license | def bubble_sort(array: list):
length = len(array)
x = 0
while x < length:
for i in range(length - 1):
if array[i] > array[i+1]:
array[i+1], array[i] = array[i], array[i+1]
else:
pass
x += 1
return array
print(bubble_s... |
Java | UTF-8 | 162 | 1.953125 | 2 | [] | no_license | package com.github.kayvannj.permission_utils;
public abstract class Func {
/* access modifiers changed from: protected */
public abstract void call();
}
|
C++ | UTF-8 | 391 | 3.015625 | 3 | [] | no_license | #ifndef _USERS_H_
#define _USERS_H_
#include <string.h>
class User
{
public:
User(){}
User(char*, char*);
//重载 "==" 运算符
bool operator ==(const User& u) const{
if(!strcmp(userName, u.userName)
&& !strcmp(password, u.password))
return true;
return false;
}
priv... |
C | UTF-8 | 5,460 | 2.59375 | 3 | [] | no_license | /*
* sapi.c
*
* Created on: May 7, 2021
* Author: wels
*/
#include "main.h"
#include "sapi.h"
tick_t tickCounter = 0;
extern UART_HandleTypeDef huart2;
//Función Inicializa los periféricos
void boardInit(void){
HAL_Init();
SystemClock_Config();
MX_GPIO_Init();
MX_USART2_UART_Init();
}
void Delays_NB... |
Java | UTF-8 | 741 | 3.25 | 3 | [] | no_license | import java.awt.Color;
import java.awt.Point;
public class ShapeFactory {
public myShape create(String shape,Point start,Point end,Color strokeColor,Color fillColor,float stroke) {
if (shape.equals("line")) {
return new Line(shape,start,end,strokeColor,fillColor,stroke);
} else if (shape.equals("rectangle")) ... |
Shell | UTF-8 | 5,668 | 4.34375 | 4 | [] | no_license | #!/bin/bash
set -o errexit
set -o pipefail
set -o nounset
RED=$(tput setaf 1)
GREEN=$(tput setaf 2)
BLUE=$(tput setaf 4)
RESET=$(tput sgr0)
SOURCE="${BASH_SOURCE[0]}"
SCRIPT_DIR="$(cd "$(dirname "$SOURCE")" >/dev/null && pwd)"
debug() {
echo "${BLUE}DEBUG:${RESET} $*"
}
info() {
echo "${GREEN}INFO:${RESET} ... |
C | UTF-8 | 6,844 | 3.3125 | 3 | [] | no_license | struct{
int id;
char name[51];
char lastname[51];
float salary;
int sector;
int isEmpty;
}typedef eEmployee;
struct{
int id;
char description[30];
}typedef eSector;
/** \brief funcion para mostrar el menu del ABM
*
* \return un int (opcion a ejecutar del men... |
PHP | UTF-8 | 5,393 | 2.765625 | 3 | [] | no_license | <?php
/**
* @backupGlobals disabled
* @backupStaticAttributes disabled
*/
require_once "src/Cuisine.php";
require_once "src/Restaurant.php";
$DB = new PDO('pgsql:host=localhost;dbname=restaurants_test');
class CuisineTest extends PHPUnit_Framework_TestCase
{
protected fun... |
Java | UTF-8 | 2,753 | 2.5625 | 3 | [] | no_license | package com.sreekanth.duelist;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import org.joda.time.DateTime;
import org.joda.time.Period;
import org.joda.time.PeriodType;
import android.app.Activity;
import android.app.DatePickerDialog;
import android.app.Dialog;
import android.os.Bundle;
... |
Java | UTF-8 | 596 | 3.328125 | 3 | [] | no_license | package lv.javaguru.workshops.streams.t0_ananonymousclasses;
import lv.javaguru.workshops.streams.code.User;
import java.time.LocalDateTime;
public class A1_AnonymousImmutableClassExample {
/**
* TODO :
* create object of anonymous class which
* extends class User and overrides method
* getN... |
C | UTF-8 | 347 | 3.4375 | 3 | [] | no_license | #include<stdio.h>
#include<stdlib.h>
int main(){
int sum = 0;
for (int i = 100; i <= 200; i++)
{
int j = 0;
for ( j = 2; j <= i; j++)
{
if (i%j == 0)
{
break;
}
}
if (j == i){
sum++;
printf("%d ", i);
}
}
printf("\n");
printf("100µ½200Ö®¼ä×ܹ²ÓÐ%d¸öËØÊý", sum);
getchar();
retu... |
Python | UTF-8 | 391 | 3.21875 | 3 | [] | no_license | #!/usr/bin/python
m = 100 #have user input
a = [0] * (m + 1)
#base cases
a[1] = 1 # one black
a[2] = 2 # two black, one red
a[3] = 4 # black/red, red/black, green, 3black
a[4] = 8 # red/red, red/black/black, black/black/red, black/red/black, green/black, black/green, blue, 4 black
for i in range(5,m + 1):
a[i] = a... |
JavaScript | UTF-8 | 1,436 | 3.140625 | 3 | [] | no_license |
jQuery(document).ready(function() {
//tabs change on click
$( function() {
$( "#highseastabs" ).tabs();
} );
//tabs change on mouseover
$( function() {
$( "#sunnyscapetabs" ).tabs({
event:"mouseover"
});
});
var btn = document.getElementById("subBtn");
... |
Markdown | UTF-8 | 547 | 2.953125 | 3 | [] | no_license | # Week 8 - Day 1
> **Agenda:** Simple ES6 Modules
## 50 Shades Demo
This project is designed to show the problem with global variables. It has a variable called bookInfo that contains information about the book.
To change the book price:
* Load the page
* Open chrome console
* Type: ```bookInfo.price = 0.01```
## ... |
C | UTF-8 | 5,621 | 3.515625 | 4 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include "../include/Errors.h"
#include "../include/Node.h"
#include "../include/Heap.h"
int heap_test()
{
// Heap tests.
Heap* test_heap = NULL;
int err = 0;
Node* tmp = NULL;
if (err = heap_init(&test_heap))
printf("ERROR: %d\n", err);
if (e... |
Python | UTF-8 | 554 | 2.515625 | 3 | [] | no_license | from balanced_partition import balanced_partition
from nose_xml_reader import read_nose_xml
with open('/tmp/nosetests.xml') as f:
test_result = read_nose_xml(f.read())
p1, p2 = balanced_partition([
(testcase['classname'] + '.' + testcase['name'], testcase['time'])
for testcase in test_result if testcase['... |
JavaScript | UTF-8 | 1,803 | 2.828125 | 3 | [] | no_license | const BADGE_TYPES = {
NUM_CASES_NEWBIE: {
name: 'Newbie',
description: '< 10 Cases'
},
NUM_CASES_NOVICE: {
name: 'Novice',
description: '10 to 25 Cases'
},
NUM_CASES_ROOKIE: {
name: 'Rookie',
description: '25 to 50 Cases'
},
NUM_CASES_INTERMEDIATE: {
name: 'Intermediate',
d... |
Java | UTF-8 | 343 | 2.046875 | 2 | [] | no_license | package test.testngVsJunit.junit;
import org.junit.Test;
/**
* @author <a href="mailto:joyrap@qq.com">joyrap@qq.com</a>
* @date 7/16/15
*/
public class TestWithException {
@Test(expected = NullPointerException.class)
public void throwNullPointException() {
// throw new NullPointerException();
throw new... |
Java | UTF-8 | 3,705 | 2.203125 | 2 | [] | no_license | package co.edu.ufps.petsworld.Administrator;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import and... |
Shell | UTF-8 | 938 | 3.328125 | 3 | [] | no_license | function sigint() {
echo -n "SIGINT: "
if pkill -P $$ ; then
echo "$0: killed all child processes"
else
echo "$0: Failed to kill child processes"
fi
exit 1
}
trap sigint SIGINT
#workdir=$TMPDIR/harmonic-oscillator
workdir=/data/work/harmonic-oscillator
#workdir=harmonic-oscillator
mkdir -... |
JavaScript | UTF-8 | 2,385 | 4.0625 | 4 | [] | no_license | //
//
//
//
//
//
//
//
/*
let nombre = "Julian"
let apellido = "Fuoco"
let edad = 28
let disp = false
let vestimenta = {
remera: "Nike",
pantalon: "Adiddas"
}
let segundoArray = ["Pepe", 30, true]
//.length
let miPrimerArray = [nombre, apellido, edad, disp, vestimenta, segund... |
Java | UTF-8 | 1,251 | 2.21875 | 2 | [] | no_license | package com.example.prototype2.Room;
import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import androidx.room.Update;
import java.util.List;
@Dao
public interface PlanDao {
@Qu... |
PHP | UTF-8 | 3,899 | 3.0625 | 3 | [] | no_license | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Delete member</title>
</head>
<body>
<?php
include "config.php"; //load in any variables
$DB... |
PHP | UTF-8 | 2,196 | 2.953125 | 3 | [
"ISC"
] | permissive | <?php
declare(strict_types=1);
namespace Jarenal\App\Model;
use Exception;
use Jarenal\Core\ModelAbstract;
/**
* Class ProductQueries
* @package Jarenal\App\Model
*/
class ProductQueries extends ModelAbstract
{
/**
* @return array
* @throws Exception
*/
public function findAll(): array
... |
JavaScript | UTF-8 | 897 | 2.84375 | 3 | [] | no_license | const modalOverlay = document.querySelector('.modal-overlay');
const cards = document.querySelectorAll('.card');
const closeModal = document.querySelector('.close-modal');
cards.forEach(card =>
card.addEventListener('click', () => {
modalOverlay.classList.add('active');
modalOverlay.querySelector('iframe').src = ... |
Java | UTF-8 | 1,748 | 2.34375 | 2 | [] | no_license | package com.changhong.system.web.facade.assember;
import java.util.ArrayList;
import java.util.List;
import org.springframework.context.support.StaticApplicationContext;
import org.springframework.util.StringUtils;
import com.changhong.common.repository.EntityLoadHolder;
import com.changhong.system.domain.a... |
C | UTF-8 | 4,288 | 2.734375 | 3 | [] | no_license | #ifndef PROC_H
#define PROC_H
#include "../settings.h"
/**
* @brief show Proc status
*/
enum cpuState : char {
OFF = 0,
ASSEMBLING,
EXECUTE,
BROKEN
};
/**
* @brief errors in stack funcions
*
* @param line ptr to string begin
* @param strlen number of letters in string
*/
enum StackError : cha... |
Shell | UTF-8 | 171 | 2.84375 | 3 | [
"MIT"
] | permissive | #!/bin/bash
#saving the given text file as a variable
text=$1
#grabbing the html stuff
bits=$2
#target file name
target=$3
cat $2_header.html $1 $2_footer.html > $target
|
Python | UTF-8 | 875 | 2.78125 | 3 | [] | no_license | import RPi.GPIO as GPIO
import time
dac = [26, 19, 13, 6, 5, 11, 9, 10]
bits = len(dac)
levels = 2 ** bits
max_voltage = 3.3
def decimal_to_binary(number):
return [int(i) for i in bin(number)[2:].zfill(len(dac))]
def decimal_to_dac(value):
signal = decimal_to_binary(value)
GPIO.output(dac, signal)
re... |
Java | UTF-8 | 1,498 | 2.078125 | 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 pe.com.syscenterlife.dao.venta;
import java.util.List;
import org.springframework.stereotype.Repository;
import pe.com.syscent... |
C | UTF-8 | 1,431 | 3.40625 | 3 | [] | no_license | #include <stdio.h>
#include <pthread.h>
#include <unistd.h>
#include <error.h>
void *clean(void *arg)
{
printf("cleanup:%s \n",(char *)arg);
return (void *)0;
}
void * thr_fn1(void *arg)
{
printf("thread 1 start \n");
pthread_cleanup_push((void*)clean,"thread 1 first handler");
pthread_cleanup_push((void*)clean,... |
Rust | UTF-8 | 2,930 | 2.6875 | 3 | [
"MPL-2.0"
] | permissive | use super::InternalEvent;
use crate::tls::TlsError;
use metrics::counter;
#[derive(Debug)]
pub struct TcpSocketConnectionEstablished {
pub peer_addr: Option<std::net::SocketAddr>,
}
impl InternalEvent for TcpSocketConnectionEstablished {
fn emit_logs(&self) {
if let Some(peer_addr) = self.peer_addr {
... |
C++ | UTF-8 | 741 | 2.796875 | 3 | [] | no_license | //
// Created by Admin on 11/19/2018.
//
#include "../blocklib/SHA256Hasher.hpp"
#include "../blocklib/POWMiner.hpp"
#include "../blocklib/BlockChain.hpp"
using namespace std;
int main()
{
int32_t difficulty = 3;
BlockChain<SHA256Hasher, POWMiner> chain = BlockChain<SHA256Hasher, POWMiner>(3);
cout << "A... |
JavaScript | UTF-8 | 1,678 | 4.71875 | 5 | [] | no_license | /**
Design a data structure that supports all following operations in average O(1) time.
Note: Duplicate elements are allowed.
insert(val): Inserts an item val to the collection.
remove(val): Removes an item val from the collection if present.
getRandom: Returns a random element from current collection of elements. Th... |
PHP | UTF-8 | 1,534 | 2.671875 | 3 | [] | no_license | <?php
/**
* Created by PhpStorm.
* User: sanokouhei
* Date: 2017/12/24
* Time: 13:28
*/
namespace Conversation;
class IntentionConfigLoader
{
/**
* @param Configure $configure
*
* @return IntentionProvider
*/
public static function load($configure)
{
$intention_groups = [... |
Markdown | UTF-8 | 878 | 3.484375 | 3 | [] | no_license | ### 139. Word Break
-----
  给定一个非空字符串 s 和一个包含非空单词列表的字典 wordDict,判定 s 是否可以被空格拆分为一个或多个在字典中出现的单词。
  字典中没有重复的单词,拆分时可以重复使用字典中的单词。
-----
#### 正解一 DP
  dp[i]:字符串 s 的前 i 个字符组成的子串 s[0..i-1] 能否拆分成若干个字典中出现的单词。
  因此要枚举 s[0..i-1] 中的分割点 j ,看 s[0..j-1] 组成的字符串是否合法,即 dp[j];以及 s... |
JavaScript | UTF-8 | 1,015 | 2.765625 | 3 | [] | no_license | 'use strict';
const ValueObject = require('./ValueObject');
/**
* The AuthResult is a DTO that contains the result of an authentication request.
* It holds the generated token and metadata about the course of authentication:
* whether the token generated is final and what the next step is if not.
* @extends Value... |
PHP | UTF-8 | 2,775 | 2.921875 | 3 | [] | no_license | <?php
require_once 'php/model/glossaire.php';
// DEBUG
// print_r($glossaire);
// on crée une fonction qui prend en paramètre un tableau
function displayRandomTerm($array)
{
// on stocke la longueur du tableau dans une variable
$length = count($array);
// Utilisation ... |
Java | UTF-8 | 2,207 | 3.328125 | 3 | [] | no_license | import java.util.*;
import java.io.*;
class Score
{
String date;
Integer score;
Score(String d, int s)
{
date = d;
score = s;
}
public String getDate()
{
return date;
}
public Integer getScore()
{
return score;
}
public String toString()
{
return date + " " + score;
}
}
public class TestMap
... |
C# | UTF-8 | 874 | 2.609375 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Factory
{
public class CreadorTipoPago : ICreadorTipoPago
{
private Pedido pedido;
public CreadorTipoPago(Pedido _pedido)
{
this.pedido = _pedido;
... |
Java | UTF-8 | 4,298 | 2.5 | 2 | [
"MIT"
] | permissive | package com.arassec.igor.simulation.job;
import com.arassec.igor.application.simulation.JobSimulator;
import com.arassec.igor.application.simulation.SimulationResult;
import com.arassec.igor.core.model.job.Job;
import com.arassec.igor.core.model.job.execution.JobExecution;
import com.arassec.igor.core.model.trigger.Ev... |
C++ | UTF-8 | 1,054 | 2.765625 | 3 | [] | no_license | //
// Created by hoho on 2019-07-08.
//
#include "Code_15664.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#define MAX 9
using namespace std;
int N_15664, M_15664;
int inputArr_15664[MAX];
vector<int> targetVector_15664;
set<vector<int>> outputSet_15664;
void re... |
Java | UTF-8 | 3,055 | 2.296875 | 2 | [] | no_license | package ph.txtdis.fx.control;
import javafx.beans.value.ObservableValue;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.scene.control.Button;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.HBox;... |
C | UTF-8 | 209 | 2.84375 | 3 | [] | no_license | // ARQUIVO COPIADO DO AVA
#include<stdio.h>
#include<stdlib.h>
main() {
int cont;
for(cont=0;cont<30;cont++) {
printf("Exibindo o valor de cont %d\n",cont);
}
system("pause");
}
|
Java | UTF-8 | 843 | 2.109375 | 2 | [] | no_license | package edu.sjsu.models;
import java.util.ArrayList;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
public interface UserDao extends CrudRe... |
Python | UTF-8 | 6,204 | 2.734375 | 3 | [] | no_license | import math
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
import mnist
def random_mini_batches(X, Y, mini_batch_size = 64):
m = X.shape[0]
mini_batches = []
permutation = list(np.random.permutation(m))
shuffled_X = X[permutation,:]
shuffled_Y = Y[permutation,:].reshap... |
Markdown | UTF-8 | 2,016 | 3.71875 | 4 | [] | no_license | The questions will be posted as homework.
However, for this assignment specifically,
you are allowed to work in pairs or small groups.
These programs should be written in Scheme.
# Questions
Everyone knows that grading is done via random number generation.
The trick is figuring out the correct distribution to use.
Y... |
C# | UTF-8 | 1,676 | 3.453125 | 3 | [] | no_license | using System;
using System.Collections;
using System.Collections.Generic;
public class Node<T> : IEnumerable<T>, IComparable<Node<T>> where T : IComparable<T>
{
public Node(T value)
{
this.Value = value;
this.Parent = null;
this.LeftChild = null;
this.RightChild = null;
}
... |
Java | UTF-8 | 419 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | package com.daniel_araujo.byteringbuffer;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
public class PeekCallbackTracker implements ByteRingBuffer.PeekCallback {
public final List<byte[]> calls = new ArrayList<>();
@Override
public void borrow(ByteBuffer chunk) {
... |
JavaScript | UTF-8 | 2,097 | 3.875 | 4 | [] | no_license | //El resultado es undefined, porque la variable no está declarada
console.log(a);
console.log(b);
console.log(c);
console.log(d);
console.log(e);
// Declara las variables
// Hay 5 tipos de datos
var a = "Wilt"; //texto
var b = 3; //número
var c = true; //boolean
var d = undefined; //null
var e = null; //indefinido
/... |
TypeScript | UTF-8 | 872 | 2.6875 | 3 | [] | no_license |
let gridcontainer: HTMLElement = document.getElementById("admingrid");
let images: NodeListOf<HTMLImageElement> = gridcontainer.querySelectorAll("img");
let imageurls: string[] = JSON.parse(sessionStorage.getItem("images"));
for (let index: number = 0; index < images.length; index++) {
const image: HTMLImageElemen... |
C# | UTF-8 | 4,430 | 2.578125 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Bot.Builder.Dialogs;
using Microsoft.Bot.Connector;
namespace LuisAndQandA1.Dialogs
{
[Serializable]
public class CoordinatedHRLinksDialog : IDialog<bool> //IDialog<object>
{
public async Task StartAsync(... |
Markdown | UTF-8 | 3,956 | 3.140625 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | # How To use Multi Materials
A multi-material is used to apply different materials to different parts of the same object as you can see below

To be able to define a multi-materials you first have to define some standard materials:
```javascript
var material... |
JavaScript | UTF-8 | 2,058 | 2.53125 | 3 | [] | no_license | 'use strict';
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
$(document).ready(function () {
... |
Java | UTF-8 | 1,181 | 2.109375 | 2 | [] | no_license | package com.infore.service;
import java.util.List;
import com.infore.model.UserInfo;
import com.infore.model.dto.UserInfoDto;
/**
* @desc .
* @author Created by Cai.xu
* @date 2017/6/30-上午9:44
*/
public interface UserInfoService extends BaseService<UserInfoDto> {
/**
* 检查登录信息
* @param loginName
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.