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 |
|---|---|---|---|---|---|---|---|
Java | UTF-8 | 1,181 | 3.71875 | 4 | [] | no_license | package oop.codblock;
/** 代码块的使用
* @author hyc
* @date 2020/12/7
*
* 代码块有静态代码块和费静态代码块
*
* 静态代码块在类加载时自动执行,只会执行一次
* 非静态代码块在对象创建时自定执行,每次创建对象都会被执行一次.
* 不能显示调用代码块的执行.
*
*
* 非静态代码块可以用来初始化成员信息,关于初始化顺序:
* 代码块的初始化顺序和就地初始化的顺序取决于声明的顺序
*/
public class CodeBlockTest {
public static void main(String[] args) {
... |
C++ | UTF-8 | 1,771 | 3 | 3 | [] | no_license | /*
* ++C - C++ introduction
* Copyright (C) 2013, 2014, 2015, 2016, 2017 Wilhelm Meier <wilhelm.meier@hs-kl.de>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the Li... |
Java | UTF-8 | 402 | 1.835938 | 2 | [] | no_license | package top.duanyd.plantation.dao;
import top.duanyd.plantation.entity.SpeciesEntity;
public interface SpeciesDao {
int deleteByPrimaryKey(Long id);
int insert(SpeciesEntity record);
int insertSelective(SpeciesEntity record);
SpeciesEntity selectByPrimaryKey(Long id);
int updateByPrimaryKeySel... |
Rust | UTF-8 | 7,455 | 3.09375 | 3 | [
"MIT"
] | permissive | use crate::misc::error::{AoCError, AoCResult};
use std::collections::{BTreeSet, HashMap};
use std::fmt;
use std::fmt::{Display, Formatter};
use std::fs::File;
use std::io::{BufRead, BufReader};
struct TicketData {
my_ticket: Vec<usize>,
nearby_tickets: Vec<Vec<usize>>,
parameters: HashMap<String, BTreeSet<... |
Java | UHC | 877 | 3 | 3 | [] | no_license | package swexpert;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Solution_1859_鸸Ʈ {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int T = Integer.parseInt(br.read... |
Java | UTF-8 | 1,417 | 2.453125 | 2 | [] | no_license | package com.traversebd.calorie_hunter.adapters;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.traversebd.calorie_hunter.R;
import java.util.Arr... |
Java | UTF-8 | 2,555 | 2.6875 | 3 | [] | no_license | package com.example.articles.model.data;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import androidx.annotation.Nullable;
import com.example.articles.model.dto.Use... |
Java | UTF-8 | 889 | 2.09375 | 2 | [] | no_license | package com.fitpolo.support.task;
import com.fitpolo.support.FitConstant;
import com.fitpolo.support.OrderEnum;
import com.fitpolo.support.callback.OrderCallback;
import com.fitpolo.support.entity.BaseResponse;
/**
* @Date 2017/5/11
* @Author wenzheng.liu
* @Description 设置手环震动
* @ClassPath com.fitpolo.support.tas... |
Python | UTF-8 | 204 | 3.296875 | 3 | [] | no_license | def monotonic(lst):
for i in range(1,len(lst)):
if lst[i-1] >= lst[i]:
yield True
else:
yield False
lst = "6 5 4 4".split()
print(all(list(monotonic(lst))))
|
Java | UTF-8 | 122 | 1.632813 | 2 | [] | no_license | package com.practice.creational.patterns.abstract_factory;
public class AmexPlatinumCreditCard extends CreditCard {
}
|
Java | UTF-8 | 645 | 2.796875 | 3 | [] | no_license | package musicShop;
import Behaviours.ISell;
public class MusicAccessories implements ISell {
String name;
double costPrice;
double listPrice;
public MusicAccessories(String name, double costPrice, double listPrice){
this.name = name;
this.costPrice = costPrice;
this.listPrice ... |
Java | UTF-8 | 303 | 2.640625 | 3 | [] | no_license | package com.zyd.strategy;
import com.zyd.Door;
import java.util.List;
public class ChangeChoiceStrategy implements ChooseStrategy {
@Override
public void chooseSecondTime(List<Door> doors) {
doors.stream().filter(d -> !d.isOpened()).forEach(d -> d.setChosen(!d.isChosen()));
}
}
|
Java | UTF-8 | 1,724 | 3.5625 | 4 | [] | no_license | package offer.chapter3;
import offer.structure.TreeNode;
/**
* Created by ryder on 2017/5/7.
*
*/
public class P117_SubstructureInTree {
//判断sub是否是root树的子结构
//很像是字符串模式匹配的暴力解法
//因此,针对于树结构,应该也有更优的匹配算法
public static boolean isSubtree(TreeNode root,TreeNode sub){
if(sub==null)
retur... |
Java | UTF-8 | 426 | 1.90625 | 2 | [] | no_license | package enterprises.orbital.impl.evexmlapi.chr;
import java.util.HashSet;
import java.util.Set;
import enterprises.orbital.impl.evexmlapi.ApiResponse;
public class MailMessagesResponse extends ApiResponse {
private Set<ApiMailMessage> mails = new HashSet<ApiMailMessage>();
public void addApiMail(ApiMailMessage ... |
JavaScript | UTF-8 | 1,515 | 2.953125 | 3 | [] | no_license | 'use strict';
const meow = require('meow');
const chalk = require('chalk');
const tlv = require('tlv');
const hexify = require('hexify');
const cli = meow(``, {
string: ['_']
});
const input = cli.input[0];
if (!input) {
console.error('TLV required');
process.exit(1);
}
const bytes = hexify.toByteArra... |
PHP | UTF-8 | 3,642 | 2.71875 | 3 | [] | no_license | <?php
/*****************
GLOBALS
******************/
$level_admin = $_SESSION['MM_UserGroup']==1;
$level_user = $_SESSION['MM_UserGroup']==2;
$status_on = '<span class="label label-success">online</span>';
$status_off = '<span class="label label-danger">offline</span>';
$dateNow = date("Ymd-His");
$form... |
C# | UTF-8 | 5,896 | 2.59375 | 3 | [
"MIT"
] | permissive | using System;
using System.Threading;
using System.Threading.Tasks;
using DiagnosticCore.Statistics;
namespace DiagnosticCore
{
/// <summary>
/// Register Options for tracker callbacks and Cancelltion token
/// </summary>
public class ProfilerTrackerOptions
{
/// <summary>
/// Canc... |
Java | UTF-8 | 3,794 | 2.125 | 2 | [] | no_license | package com.example.majujayarental;
import android.app.Activity;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import androidx.annotation.Nullable;
import androi... |
Java | UTF-8 | 1,513 | 3.6875 | 4 | [
"MIT"
] | permissive | package com.github.songjiang951130.leetcode.dp;
public class Square {
/**
* @todo case5 未通过
* @param matrix
* @return
*/
public int maximalSquare(char[][] matrix) {
int len = 0;
for (int i = 0; i < matrix.length; i++) {
for (int j = 0; j < matrix[i].length; j++)... |
Python | UTF-8 | 184 | 3.390625 | 3 | [] | no_license | vowels = ['a', 'e', 'i', 'o', 'u']
types = ["Vowel" if i in vowels else "Consonant" for i in "hello"]
types = ['Vowel' if i in vowels else "Consonents" for i in "hello"]
print(types)
|
Python | UTF-8 | 371 | 3.8125 | 4 | [] | no_license | while True: # (1) it is a while look whose condition is always true
print('Please type your name.')
name = input() # (2)
if name == 'your name': # (3) if statement is present inside the wile statement
break #... |
Java | UTF-8 | 3,418 | 2.546875 | 3 | [
"Apache-2.0",
"MIT"
] | permissive | //snippet-sourcedescription:[ListMetrics.java demonstrates how to list Amazon CloudWatch metrics.]
//snippet-keyword:[AWS SDK for Java v2]
//snippet-service:[Amazon CloudWatch]
/*
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package com.example... |
C | UTF-8 | 11,552 | 2.765625 | 3 | [] | no_license | //
// server.c
// File Server
//
// Created by Alessio Giordano on 23/12/18.
//
// O46001858 - 23/12/18
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
#include <sys/types.h>
#include <dirent.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#... |
PHP | UTF-8 | 5,707 | 2.953125 | 3 | [] | no_license | <?php
/**
* PHP Class to manage table structures (print table, order by, etc)
*
* <code><?php
* include('table.class.php');
* $table = new tableManager();
* ? ></code>
*
* ==============================================================================
*
* @version $Id: table.class.php,v 0.93 2008... |
PHP | UTF-8 | 1,011 | 2.578125 | 3 | [
"Unlicense"
] | permissive | <?php
namespace ServiceBoiler\Prf\Site\Mail\Esb;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use ServiceBoiler\Prf\Site\Models\EsbUserVisit;
class EsbVisitEmail extends Mailable implements ShouldQueue
{
use Queuea... |
Markdown | UTF-8 | 8,195 | 3.203125 | 3 | [] | no_license | ---
lang: fr
lang-ref: ch.02-3
title: Motivation des problèmes, algèbre linéaire et visualisation
lecturer: Alfredo Canziani
authors: Rajashekar Vasantha
date: 04 Feb 2021
typora-root-url: 02-3
translation-date: 19 Jun 2021
translator: Loïck Bourdois
---
<!--
## Resources
Please follow Alfredo Canziani [on Twitter @... |
Markdown | UTF-8 | 2,409 | 2.6875 | 3 | [] | no_license | # SO item 085
I have an Excel AddIn (`.xlam` file) and within it is a few macros and my attemt at a custom ribbon tab. The Macros work as expected but now I am trying to make a ribbon to call them to be more user friendly. I have the ribbon and a button which works, and a dropdown menu which I cannot figure out. I am u... |
JavaScript | UTF-8 | 1,612 | 2.921875 | 3 | [] | no_license | window.onload = function () {
fetchAllPosts();
};
async function fetchAllPosts() {
try {
const response = await fetch("http://localhost:5000/posts");
const posts = await response.json();
let postHTML = "";
for (post of posts) {
let dateObj = new Date(post.date);
postHTML += `
... |
Python | UTF-8 | 3,543 | 2.84375 | 3 | [
"MIT"
] | permissive | #codigo por
#Eduardo Migueis
#Illy Bordini
#Guilherme Lima
from controller import Robot, Motor, DistanceSensor, Camera
import requests
from PIL import Image
import threading
import time
# cria a instancia do robo
robot = Robot()
time_step = 64
max_speed = 6.28
# motor
# rodas da frente
right_motor_front = robot.g... |
Java | UTF-8 | 1,265 | 2.203125 | 2 | [] | no_license | package br.com.PersistStruts.servicos;
import java.util.List;
import javax.inject.Inject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;
import br.com.PersistStruts.dao.ClienteDao;
import br.com.PersistS... |
TypeScript | UTF-8 | 1,512 | 2.734375 | 3 | [] | no_license | import {Injectable} from '@angular/core';
import {User} from '../models/user';
import {JwtHelper} from 'angular2-jwt';
@Injectable()
export class AuthService {
private _token_key = 'id_token';
constructor() {
}
public login(token: string): void {
let jwtHelper = new JwtHelper();
try {
jwtHelpe... |
Python | UTF-8 | 911 | 2.765625 | 3 | [] | no_license | class Presenter:
"""This class controls the console view
author: V. Van den Schrieck
date: November 2020
"""
def __init__(self, sites):
self.__sites = sites
self.__sites.attach(self)
self.__view = None
def set_view(self, view_instance):
self.__view = view_instanc... |
Java | UTF-8 | 270 | 2.03125 | 2 | [] | no_license | package sso.domain.user.core.domain;
import sso.util.domain.ValueObject;
public class UserId extends ValueObject<Long> {
private UserId(long value) {
super(value);
}
public static UserId of(long value) {
return new UserId(value);
}
}
|
TypeScript | UTF-8 | 1,008 | 3.03125 | 3 | [
"MIT"
] | permissive | import 'reflect-metadata';
export interface DecoratorFunction<T> extends Function {
new (...args: any[]): T;
}
export class DecoratorReader {
private annotationMap: Map<DecoratorFunction<any>, symbol> = new Map();
create<T>(func: DecoratorFunction<T>): Function {
const symbol = Symbol(func.name);
this.... |
Python | UTF-8 | 976 | 4.34375 | 4 | [] | no_license | """
Problem Statement
Given an integer array, find and return all the subsets of the array. The
order of subsets in the output array is not important. However the order of
elements in a particular subset should remain the same as in the input array.
Note: An empty set will be represented by an empty list
Example 1
a... |
PHP | UTF-8 | 780 | 2.546875 | 3 | [
"MIT"
] | permissive | <?php
namespace Facade\Ignition\Middleware;
use Facade\FlareClient\Report;
use Facade\IgnitionContracts\SolutionProviderRepository;
class AddSolutions
{
/** @var \Facade\IgnitionContracts\SolutionProviderRepository */
protected $solutionProviderRepository;
public function __construct(SolutionProviderRep... |
Markdown | UTF-8 | 2,840 | 3.40625 | 3 | [] | no_license | # Assignment 1: Welcome to App Lab
Due Monday, September 9
# Instructions
1. Clone this repository to your local computer (hint: use the terminal and the `git clone` command).
2. Open the `welcome-to-app-lab-yourgithubusername` folder in vscode.
3. Edit the file `README.md` in response to the prompt (The Benefits and ... |
PHP | UTF-8 | 1,849 | 2.890625 | 3 | [] | no_license | <?php
require_once 'Conexao.class.php';
class Produto
{
private $con;
function __construct()
{
$conexao = new Conexao();
$this->con = $conexao->getConexao();
}
//Insert novo produto
function insertProduto($sql)
{
if ($this->con->exec($sql)){
return... |
Python | UTF-8 | 178 | 3.34375 | 3 | [] | no_license | a=int(input("ingres el numero:"))
b=int(input("ingres el otro numero:"))
c=a+b
if a<b:
print(a**b)
elif a>b:
print(a//b)
print(c)
print(a*b)
print(a/b)
#hola
#holax2
#holax3
|
Swift | UTF-8 | 6,270 | 2.578125 | 3 | [] | no_license | //
// SavedRecipesViewController.swift
// Yes Chef
//
// Created by Adam Larsen on 2016/02/02.
// Copyright © 2016 Conversant Labs. All rights reserved.
//
import UIKit
class SavedRecipesViewController: UITableViewController, UISearchResultsUpdating, SavedRecipesConversationTopicEventHandler
{
var selectionBl... |
Python | UTF-8 | 512 | 4.125 | 4 | [] | no_license | def cumulative_sum(numlist):
""""
Takes a list of numbers and sums each element cumulatively and shows the result of each sums'
numlist: Must be a list of numbers; No nesting allowed
Returns a new list with each element being the cumulative sum of the previous elements of the original list
"""
incrementor=0
c... |
Python | UTF-8 | 1,496 | 2.625 | 3 | [] | no_license | import numpy as np
from PIL import ImageGrab
import cv2
import time
from SimulateKeypress import PressKey, ReleaseKey, W, A, S, D
# import pyautogui
def RegionOfInterest(img, vertices):
mask = np.zeros_like(img)
cv2.fillPoly(mask, vertices, 255)
masked = cv2.bitwise_and(img, mask)
return masked
# def DrawLines(i... |
Markdown | UTF-8 | 3,060 | 3.1875 | 3 | [
"MIT"
] | permissive | ---
layout: post
title: grep command in Linux
bigimg: /img/image-header/road-to-solution.jpeg
tags: [Linux]
---
<br>
## Table of contents
- [Given problem](#given-problem)
- [Solution of grep command](#solution-of-grep-command)
- [Wrapping up](#wrapping-up)
<br>
## Given problem
In Linux, we usually have to se... |
JavaScript | UTF-8 | 24,242 | 2.890625 | 3 | [] | no_license | TEXTWIDTH=80
MAXLINES=8
function isEmpty(obj) {
for(var prop in obj) {
if(obj.hasOwnProperty(prop))
return false
}
return true
}
function jsNode(nm,o) {
this.name=nm;
this.parent={}
this.type='leaf';
this.visible=true // are you visible
//why should this structure hold visibility and not the page?
this... |
Ruby | UTF-8 | 2,233 | 2.546875 | 3 | [] | no_license | require 'serialport'
require 'eventmachine'
require 'em-websocket'
require 'filewatch/tail'
require 'childprocess'
# Serial Port connection
begin
# @@sp = SerialPort.new("/dev/master", 9600, 8, 1, SerialPort::NONE)
rescue => e
STDERR.puts 'cannot open serial port!'
STDERR.puts e.to_s
exit 1
end
@@recvs = Arra... |
JavaScript | UTF-8 | 689 | 3.40625 | 3 | [] | no_license | $(document).ready(function(){
// take the information from the search input
let images = document.getElementsByTagName('a');
// get the text that the user has typed
//use toLowerCase incase the user uses upper case
$('.search_box').on('keyup',function(){
let search = $('.searchInput').val().toLowerCase();
... |
Java | UTF-8 | 2,233 | 3.375 | 3 | [] | no_license | import java.util.Date;
import java.util.Objects;
public abstract class Bike implements Movable {
protected String color;
protected String nameOfTheOwner;
protected Brand brand;
protected int numberOfSpeeds;
protected boolean moving;
protected Date dayOfRelease;
public Bike() {
}
... |
Java | UTF-8 | 8,225 | 2.875 | 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 Game;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.event.KeyAdapter;
import java.aw... |
Python | UTF-8 | 1,568 | 2.640625 | 3 | [] | no_license | # Utility script to provide some commonly used functions
def conn_s3():
"""
This function will build connection
to S3 with credentials
"""
aws_access_key = os.getenv('AWS_ACCESS_KEY_ID', 'default')
aws_secret_access_key = os.getenv('AWS_SECRET_ACCESS_KEY', 'default')
conn = boto.connect_s3... |
Shell | UTF-8 | 1,867 | 2.8125 | 3 | [] | no_license | # reference: https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap
# 6 ways to create configmap
# 1. create from config folder
# Folder files:
# the_folder/
# ui.properties
# logic.properties
# Result in:
# data:
# ui.properties: /
# screen_width: 40
# screen_hei... |
Markdown | UTF-8 | 10,147 | 2.890625 | 3 | [
"Unlicense"
] | permissive | ---
title: "Automatentheorie (German)"
layout: post
---
Dieser Blogeintrag befasst sich mit den Inhalten der AT-Klausur 2021. Die Inhalte dieser Klausur sind aufgrund der Pandemie leider reduziert, was der Herausforderung verschuldet ist, dass die Lehrveranstaltung online zu organisieren und abzuhalten war.
Im Folgen... |
Python | UTF-8 | 983 | 2.671875 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause"
] | permissive | # coding=utf-8
from django.test import TestCase
from django.test.utils import override_settings
from oscar.core import utils
sluggish = lambda s: s.upper()
class TestSlugify(TestCase):
def test_uses_custom_mappings(self):
mapping = {'c++': 'cpp'}
with override_settings(OSCAR_SLUG_MAP=mapping):
... |
Swift | UTF-8 | 1,064 | 2.953125 | 3 | [
"MIT"
] | permissive | //
// Date+Extensions.swift
// Ogrenich iOS Framework
//
// Created by Andrey Ogrenich on 13/06/2017.
// Copyright © 2017 Andrey Ogrenich. All rights reserved.
//
import Foundation
public extension Date {
public static func from(string: String,
with format: String = "yyyy-MM-d... |
Java | UTF-8 | 1,157 | 2.6875 | 3 | [] | no_license | package com.exilant.day1;
public class PriorityCustomer {
private int customerId;
private String customerName;
private String customerType;
public int getCustomerId() {
return customerId;
}
public void setCustomerId(int customerId) {
this.customerId = customerId;
}
public String getCustomerName() {
retu... |
Python | UTF-8 | 1,337 | 3.921875 | 4 | [] | no_license | import jieba.analyse
"""
文字檔案的編碼格式與文字檔讀取方法
讀取檔案三部曲
1. 所有資源放在專案底下
2. 檔案路徑: 相對路徑
r 指唯讀 W 指可寫
3. 檔案編碼: 最好使用 utf-8 , 避免有難字、亂碼等情況出現
"""
print('--- 檔案的處理 START ---\n')
# 打開檔案
"""
1. open('檔名1.txt')
2. open('/data/檔名2.txt')
3. open('./data/檔名3.txt')
4. open('../data/檔名4.txt')
5. open('C:\\user\\檔名5.txt')
"""
BasicFile ... |
C++ | UTF-8 | 225 | 2.765625 | 3 | [] | no_license | class Solution {
public:
int trailingZeroes(int n) {
int t =5;
int count5 = 0;
while(n/t != 0){
count5 += n/t;
t = t*5;
}
return count5;
}
}; |
Java | UTF-8 | 2,632 | 1.820313 | 2 | [] | no_license | package com.example.airbag.airbag.fragments;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.app.Fragment;
import android.util... |
PHP | UTF-8 | 2,980 | 2.875 | 3 | [
"Apache-2.0"
] | permissive | <?php
namespace Mix\Udp\Server;
use Swoole\Coroutine\Socket;
use Mix\Concurrent\Coroutine;
/**
* Class UdpServer
* @package Mix\Udp\Server
* @author liu,jian <coder.keda@gmail.com>
*/
class UdpServer
{
/**
* @var int
*/
public $domain = AF_INET;
/**
* @var string
*/
public $... |
Shell | UTF-8 | 6,341 | 3.59375 | 4 | [] | no_license | #!/bin/bash
# fonctionnement:
# il récupere les hosts depuis Ganglia en s'aidant du script /usr/share/ganglia-webfrontend/nagios/get_hosts.php se trouvant sur la machine Gmetad
# il récupere les hosts depuis l'API Centreon aprés l'authentification et l'obtention d'un jeton
# test si les hosts de Ganglia existe déja s... |
C++ | UTF-8 | 2,078 | 3.0625 | 3 | [] | no_license | /* Written by Brian Sun
* Date: August 1, 2020
* An obstacle detecting robot that produces sound
*/
#include <NewPing.h> // include the NewPing library for this program
#include <Servo.h>
Servo myservo; //create servo object to control a servo
#define VCC_PIN 13
#define TRIGGER_PIN 12 // sonar tr... |
Ruby | UTF-8 | 694 | 3.015625 | 3 | [] | no_license | require('minitest/autorun')
require('minitest/rg')
require_relative('../models/card_game')
require_relative('../models/card')
class CardGameTest < MiniTest::Test
def test_check_for_ace
card_game = CardGame.new()
card = Card.new('ace', 1)
assert_equal(true, card_game.check_for_ace(card))
end
def tes... |
Java | UTF-8 | 1,166 | 2.421875 | 2 | [] | no_license | package com.vida.sushi.domains.aquariums;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.TypeAlias;
import org.springframework.data.mongodb.core.mapping.Document;
i... |
C# | UTF-8 | 755 | 3.09375 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
namespace Assignment_1
{
public class Problem4
{
public int NumJewelsInStones(string jewels, string stones)
{
int ans = 0;
Dictionary<... |
Markdown | UTF-8 | 4,074 | 2.5625 | 3 | [] | no_license | # Curated List of Javascript Podcasts
There are lots of great podcasts coming out these days. I wanted to compile a list of some of the great ones. This list contains only currently running podcasts (atleast 1 episode in the past month). I have also included some tangentially related podcasts that you may find interest... |
Java | UTF-8 | 1,188 | 2.609375 | 3 | [] | no_license | package com.example.myjsondemo;
/**
* Created by peacock on 5/9/16.
*/
public class Employee {
private String name;
private String destination;
private String pay;
private String Lanline;
private String mobile;
Employee(String name,String destination,String pay,String lanline,String mobile)... |
Java | UTF-8 | 1,016 | 2.359375 | 2 | [] | no_license | package com.ifoodtest.giolo.playlist;
/**
* Configurações de cache
*
* @author <a href="mailto:m.eduardo5@gmail.com">Mario Eduardo Giolo</a>
*
*/
public final class Caches {
private Caches() {
}
public static final String WEATHER_BY_CITY = "weather_by_city";
public static final String WEATHER_BY_GPS = "w... |
PHP | UTF-8 | 1,620 | 2.75 | 3 | [
"MIT"
] | permissive | <?php
/*
* This file is part of the PhpM3u8 package.
*
* (c) Chrisyue <http://chrisyue.com/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Chrisyue\PhpM3u8\Tag;
class ProgramDateTimeTag extends AbstractTag
{
use ... |
JavaScript | UTF-8 | 2,229 | 3.625 | 4 | [] | no_license | // Il software deve generare casualmente le statistiche di gioco di 100 giocatori di basket per una giornata di campionato.
// In particolare vanno generate per ogni giocatore le seguenti informazioni, facendo attenzione che il numero generato abbia senso:
// - Codice Giocatore Univoco (formato da 3 lettere maiuscole c... |
Rust | UTF-8 | 898 | 2.71875 | 3 | [
"MIT"
] | permissive | use glium::glutin::{ElementState, KeyboardInput, VirtualKeyCode};
use rustyboy_core::hardware::joypad::{Button, Input, InputType};
pub fn keymap(input: KeyboardInput) -> Option<Input> {
let key_code = input.virtual_keycode?;
let button = match key_code {
VirtualKeyCode::Up => Button::Up,
Virtu... |
Java | UTF-8 | 5,108 | 1.703125 | 2 | [] | no_license | package org.edec.main.model.dao;
public class UserRoleModuleESOmodel {
private boolean groupLeader = false;
private boolean readonly = true;
private boolean student = false;
private boolean teacher = false;
private boolean parent = false;
private Integer formofstudy;
private Integer formo... |
JavaScript | UTF-8 | 2,246 | 2.625 | 3 | [] | no_license | import React, { useCallback, useEffect } from "react";
import data from "./mock";
import "./App.css";
import Switch from "./components/switch";
import usePersistedState from "./use-persisted-state";
import { getDayNumbers, getDaysBetween } from "./utils";
import AuntCalender from "./components/aunt-calender";
function... |
Java | UTF-8 | 528 | 1.96875 | 2 | [] | no_license | package com.investMessage.config.data;
import javax.sql.DataSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
@Configuration
@Profile("postgres-local")
public class PostgresLocalDataSourceCon... |
JavaScript | UTF-8 | 600 | 3.9375 | 4 | [] | no_license | // long running function
function waitforThreeSeconds(){
var ms = 10000+new Date().getTime();
while(new Date() < ms){
// time waisting loop
}
console.log('Execution Stack Event ONE, Finished Function !!!')
}
// this is asynchronous function , will execute once all the stack items get clea... |
PHP | UTF-8 | 5,521 | 2.59375 | 3 | [] | no_license | <?php
namespace controllers;
use models\Task;
use app\UserAuth;
use app\View;
use helpers\Url;
use helpers\Validator;
use helpers\Strings;
// EXPLAIN: ...
class TaskController extends BaseController
{
const PAGE_FIRST = 1;
const PAGE_LIMIT = 3;
// EXPLAIN: ...
public $prepared;
private $args;
private $cou... |
JavaScript | UTF-8 | 1,087 | 4.78125 | 5 | [] | no_license | // Chapter 5 - Linked Lists
// Setting up/Assumptions:
// Function for creating a new node:
function ListNode(value){
this.val = value;
this.next = null;
}
// Function for creating a new list:
function List(){
this.head = null;
}
// Call to list function to instantiate a new list object
myList = new List();
/... |
Python | UTF-8 | 616 | 2.921875 | 3 | [] | no_license | from gamesprite import GameSprite
from settings import Settings
class Background(GameSprite):
"""背景精灵组,让背景图移动起来"""
def __init__(self, is_alt=False):
super().__init__("images/backgroud.png")
if is_alt:
self.rect.y = -self.rect.height
self.settings = Settings()
def updat... |
Markdown | UTF-8 | 498 | 3.375 | 3 | [] | no_license | ### Lectura por teclado
Para que el usuario pueda igresar los datos se utiliza:
```
input()
```
Para convertir los valores basta con:
```
str = input("Ingresa un valor --> ")
15
Si queremos sumar un valor a ese 15, tendremos un error. Debemos convertir ese valor.
str = int(valor)
str + 45 #60
De ser n... |
Java | UTF-8 | 621 | 2.09375 | 2 | [] | no_license | package casestudy.javaweb.persistence.repository;
import casestudy.javaweb.persistence.entity.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;
... |
Java | UTF-8 | 645 | 3.3125 | 3 | [] | no_license | public abstract class Education
{
private String code;
private String title;
public Education(String code, String title) {
this.code = code;
this.title = title;
}
public String getCode() {
return code;
}
public String getTitle() {
return title;
}
public boolean equ... |
Java | UTF-8 | 1,634 | 2.484375 | 2 | [] | no_license | package cloudSearch.search;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.amazonaws.util.json.JSONArray;
import com.amazonaws.util.json.JSONException;
/**
* Created by dan.houseman on 9/14/16.
*/
public class Hit {
public String id;
public M... |
Java | UTF-8 | 230 | 2.015625 | 2 | [] | no_license | /*
* Cameron Boyd
* CECS 444
* Baby Scanner
*/
import java.io.IOException;
public class MyScannerClass {
public static void main(String[] args) throws IOException{
ScannerClass List = new ScannerClass();
List.initUI();
}
}
|
C++ | UTF-8 | 1,035 | 3.5625 | 4 | [] | no_license | #include <iostream>
/*
Rat in a Maze - Backtracking
+------>(x)
|
|
v (y)
*/
const int SIZE = 4;
const int maze[SIZE][SIZE] = { { 1,1,0,1 },
{ 0,1,1,1 },
{ 0,0,0,1 },
{ 0,1,0,1 } };
bool isLegal(int x, int y) {
if (maze[x][y] == 0 || (x > SIZE || x < 0 || y < 0 || y > SIZE)) {
retur... |
C++ | UTF-8 | 11,115 | 3.15625 | 3 | [] | no_license | #include "cartelera.h"
Cartelera::Cartelera()
{
}
Cartelera::~Cartelera()
{
}
//Ingresa peliculas a la cartelera
void Cartelera::setCartelera(int _id, Pelicula _pelicula)
{
cartelera.insert(make_pair(_id, _pelicula));
}
//Retorna la cartelara con las peliculas
map<int, Pelicula> Cartelera::getCartelera()
{
r... |
Shell | UTF-8 | 7,192 | 3.9375 | 4 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env bash
function info() {
datetime=`date "+%Y-%m-%d %H:%M:%S |"`
echo -e "\033[1;94m${datetime} INFO |\033[0m\033[0;94m $@ \033[0m"
}
function error() {
datetime=`date "+%Y-%m-%d %H:%M:%S |"`
echo -e "\033[1;91m${datetime} ERROR |\033[0m\033[1;91m $@ \033[0m" >&2
}
readonly DIR="$(cd $(di... |
PHP | UTF-8 | 458 | 2.703125 | 3 | [] | no_license | <?php
require_once 'Harimau.php';
require_once 'Elang.php';
class Hewan{
public $nama,
$darah=50,
$jumlahKaki,
$keahlian;
public function atraksi(){
return $this->nama."Sedang".$this->keahlian;
}
}
echo $Harimau->atraksi();
echo... |
PHP | UTF-8 | 253 | 2.890625 | 3 | [] | no_license | <?php
namespace MrMe\Util;
class StringFunc
{
public static function GetX()
{
return ">>x<<";
}
public static function startWith($haystack, $needle)
{
return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== false;
}
}
?> |
Ruby | UTF-8 | 319 | 2.953125 | 3 | [] | no_license | class Frequency
def format(freq_pool,min,max)
output = []
freq_pool.each do |entry|
if entry < min
output << min
elsif
entry > max
output << max
else
output << entry
end
end
return output
end
end |
Markdown | UTF-8 | 10,866 | 3.21875 | 3 | [] | no_license | # [Kaggle] New York texi-trip duration
*<div style="text-align: center;" markdown="1">`EDA` `regression` `clustering` `scikit-learn` `numpy` `pandas`</div>*
## Introduction
This is the [competition](https://www.kaggle.com/c/nyc-taxi-trip-duration) of the machine learning. The data is the travel information for the Ne... |
JavaScript | UTF-8 | 4,534 | 3.359375 | 3 | [] | no_license | var cars = [];
var picture = []; // an array for the objects
var frogPos;
let state = -1;
let timer = 0;
let img1;
let img2;
let bubbles;
let gamebg;
let song1, song2, song3;
let maxBirds = 10;
let font;
function preload() {
song1 = loadSound("assets/1.mp3");
song2 = loadSound("assets/2.mp3");
song3 = loadSound... |
C++ | UHC | 375 | 2.734375 | 3 | [] | no_license | // 3_ ø Ȱ
#include <iostream>
//
template<typename T> struct xremove_pointer
{
typedef T type;
};
template<typename T> struct xremove_pointer<T*>
{
//typedef T type;
typedef typename xremove_pointer<T>::type type;
};
int main()
{
xremove_pointer<int***>::type n;
std::cout << typeid(n).na... |
Python | UTF-8 | 2,700 | 3.890625 | 4 | [] | no_license | """
https://leetcode.com/problems/minimum-window-substring/
"""
import collections
import unittest
from typing import Counter
class Solution:
def minWindow(self, s: str, t: str) -> str:
"""
need : 필요한 문자 각각의 개수
missing : 필요한 문자의 전체 개수
left : 슬라이딩 윈도우의 왼쪽 index
right : 슬라이딩... |
Java | UTF-8 | 5,269 | 3.328125 | 3 | [] | no_license | import java.io.*;
import java.util.HashMap;
public class WikiParser {
// Assume default encoding.
private static FileWriter fileWriter;
private static FileWriter fileWriter2;
// Always wrap FileWriter in BufferedWriter.
private static BufferedWriter bufferedWriter;
private static BufferedWrite... |
Markdown | UTF-8 | 994 | 3.1875 | 3 | [
"MIT"
] | permissive | ## vddl-handle
在`vddl-nodrag`元素中使用`vddl-handle`组件,以便允许拖动该元素。 因此,通过组合`vddl-nodrag`和`vddl-handle`,您能制定自定义的句柄元素(handle)拖动`vddl-draggable`元素。
#### 基本用法
```html
<vddl-draggable v-for="(item, index) in list" :key="item.id"
:draggable="item"
:index="index"
:wrapper="list"
effect-allowed="move">
<vddl-nodrag cla... |
C | UTF-8 | 1,857 | 2.671875 | 3 | [] | no_license | #include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <error.h>
#include <errno.h>
#include <sys/types.h> /* See NOTES */
#include <sys/socket.h>
#include <string.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#define ERR_EXIT(m) \
do \
{ \
... |
Java | UTF-8 | 1,245 | 2.671875 | 3 | [
"MIT"
] | permissive | package teamOD.armourReborn.common.leveling;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
/**
* This interface is to be implemented by all armour items that are levelable.
* @author MightyCupcakes
* @see ItemModArmour
*
*/
public... |
Go | UTF-8 | 3,090 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | package helpers
import (
"github.com/aerogear/mobile-security-service/pkg/models"
"github.com/google/uuid"
)
//GetMockUser returns a dummy user
func GetMockUser() *models.User {
user := &models.User{
Username: "TestUser",
Email: "test@user.com",
}
return user
}
// GetMockAppList returns some dummy apps
f... |
C# | UTF-8 | 833 | 3.015625 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Web;
namespace Projector.Core.Logic.Utilities.MyLinq
{
public class MyList<T> : List<T>
{
public void ForEach(Action<T> action)
{
foreach(var item in this)
{
action(item);
}
... |
Python | UTF-8 | 1,089 | 2.796875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
from collections import defaultdict
import sys
import re
def extract(s):
return [int(x) for x in re.findall(r'\d+', s)]
def main(args):
data = sorted([extract(s) for s in sys.stdin])
i = 0
sleep_time = defaultdict(int)
most_common = defaultdict(lambda: defaultdict(int))
... |
JavaScript | UTF-8 | 588 | 3.109375 | 3 | [] | no_license | module.exports = { isDateLower, isDateBetween, addDays };
function isDateLower(date1, date2) {
return new Date(date1).getTime() < new Date(date2).getTime();
}
function isDateBetween(date, dateFrom, dateTo) {
const date1 = new Date(date).getTime();
return (
date1 >= new Date(dateFrom).getTime() && date1 <= n... |
Markdown | UTF-8 | 788 | 2.828125 | 3 | [
"MIT"
] | permissive | DarvinCrawlerBundle
===================
This bundle provides console command that detects broken links on your website.
## Sample configuration
```yaml
# config/packages/dev/darvin_crawler.yaml
darvin_crawler:
default_uri: https://example.com # Default value of command's "uri" argument
blacklists:
pa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.