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 | 3,697 | 3.21875 | 3 | [
"MIT"
] | permissive | console.log('It works tho.')
class Encounter{
constructor(name, description){
this.name = name
this.description = description
}
}
let button = document.getElementById('Engage');
console.dir(button)
button.addEventListener('click', function (event) {
let diceNumber = getRandomIntInclusive(1, 20);
let ran... |
PHP | UTF-8 | 3,242 | 2.625 | 3 | [
"MIT"
] | permissive | <?php
namespace Api\Business;
use Api\Helper\Mail;
use Api\Model\ProductOrder;
class ProductOrderBusiness extends Business {
/**
* get product order
* @param $productId
* @return mixed
*/
public static function productOrder($productId) {
new static;
$productOrders = Prod... |
Java | UTF-8 | 1,073 | 4.03125 | 4 | [] | no_license | package com.SetJihe;
import java.util.Comparator;
import java.util.TreeSet;
public class StuCompa {
public static void main(String[] args) {
//本例使用了匿名内部类实现类Comparator这个接口
// 然后,重载了compare方法
TreeSet<Student> tr=new TreeSet<Student>(new Comparator<Student>() {
@Override
... |
Markdown | UTF-8 | 3,208 | 3.21875 | 3 | [
"MIT"
] | permissive | ---
{
"description": "Kickstand UI's layout utility classes consist of width and height utilities to quickly manage responsive layouts.",
"meta": [
{
"property": "og:title",
"content": "Layout Utilities - Kickstand UI"
},
{
"property": "og:image",
... |
Swift | UTF-8 | 1,450 | 3.953125 | 4 | [
"Apache-2.0"
] | permissive | //: [Previous](@previous)
import Foundation
public class ListNode {
public var val: Int
public var next: ListNode?
public init(_ val: Int, next: ListNode? = nil) {
self.val = val
self.next = next
}
}
class Solution {
func reverseKGroup(_ head: ListNode?, _ k: Int) -> ListNode? {
... |
Python | UTF-8 | 2,911 | 3.234375 | 3 | [] | no_license | #import a bunch of stuff for sql
from sqlalchemy import create_engine, Column, Integer, String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from sqlalchemy.sql import select
from cockroachdb.sqlalchemy import run_transaction
#set these to some of the imports so they c... |
Python | UTF-8 | 373 | 3.109375 | 3 | [] | no_license | import sqlite3
from contextlib import closing
conn = sqlite3.connect("db/helpdesk.sqlite")
with closing(conn.cursor()) as cursor:
query = "SELECT * FROM employees WHERE employeeid = ?"
cursor.execute(query, (1, ))
employee = cursor.fetchone()
print("Name: " + employee[1])
print("Email: " + employ... |
C++ | UTF-8 | 2,677 | 3.359375 | 3 | [
"Unlicense"
] | permissive | /******************************************************************************
*******************************************************************************
**
** Author: Lingurar Petru-Mugurel
** Written: miercuri 10 iunie 2015, 21:53:49 +0300
** Last updated: ---
**
** Compilation: g+... |
JavaScript | UTF-8 | 1,710 | 3.265625 | 3 | [
"MIT"
] | permissive |
Date.prototype.format = function() {
let s = '';
const mouth = (this.getMonth() + 1)>=10?(this.getMonth() + 1):('0'+(this.getMonth() + 1));
const day = this.getDate()>=10?this.getDate():('0'+this.getDate());
s += this.getFullYear() + '-'; // 获取年份。
s += mouth + "-"; // 获取月份。
s += day; // 获取日。
return (s); ... |
Python | UTF-8 | 1,154 | 2.6875 | 3 | [] | no_license | # file = open('test2.txt')
# file2 = open('file2.txt', 'w')
# num = 0
# for line in file:
# file2.write(str(num) + " " + line)
# num += 1
# file.close()
# file2.close()
import requests
# url = "http://httpbin.org/get"
# headers = {'user-agent':'roman browser'}
# params = {'blah1':'yeah', 'blah2':'not yeah'}
# r... |
Markdown | UTF-8 | 1,263 | 2.90625 | 3 | [] | no_license | [](https://travis-ci.org/robertotambunan/go-graphql-sample)
# Go-GraphQL-Sample
This is a very simple project about how to implement graphQL in your golang project. The flow is so simple and very recommended for just quick learnin... |
Python | UTF-8 | 907 | 2.890625 | 3 | [] | no_license | stations = {
'kthree': {'nv', 'ca', 'or'},
'kfour': {'nv', 'ut'},
'ktwo': {'mt', 'wa', 'id'},
'kone': {'nv', 'ut', 'id'},
'kfive': {'az', 'ca'}
}
states_needed = {"mt", "wa", "or", "id", "nv", "ut",
"ca", "az"}
def temp():
remain_stations = dict(stations)
remain_states = ... |
Java | UTF-8 | 2,412 | 1.984375 | 2 | [] | no_license | package com.lvmama.jinjiang.model;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 实时获取团信息
* @author chenkeke
*
*/
public class SimpleGroup {
private String groupCode;
private Date departDate;
private Date returnDate;
private String groupSta... |
C# | UTF-8 | 18,793 | 2.53125 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Collections;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Threading;
namespace SmartGuardSer... |
SQL | UTF-8 | 3,603 | 3.078125 | 3 | [] | no_license | create database professorfacil;
use professorfacil;
create table usuarios(
iduso int primary key auto_increment not null,
uso_nome varchar(200) not null,
uso_cidade varchar(100),
uso_estado varchar(4),
uso_endereco varchar(200),
uso_end_num varchar(8),
uso_email varchar(100),
uso_cpf varchar(20),
uso_celular varchar(5... |
Python | UTF-8 | 2,552 | 3.640625 | 4 | [] | no_license | #!/usr/bin/python
"""
comment in many lines
many many lines
"""
import sys
class obj:
file = None
addr = None
def pass_arg(obj):
obj.file = "bbb"
__obj = obj()
__obj.file = "aaa"
__obj.addr = 0x123
pass_arg(__obj)
print (__obj.file)
#one line comment
#number = 10
#add = number + 11
#print '45654', 'p... |
C# | UTF-8 | 910 | 2.703125 | 3 | [] | no_license | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
[RequireComponent (typeof(Slider))]
public class BarContoller : MonoBehaviour
{
private Slider Bar;
public Text targedText;
public int maxPoints = 100;
public int value = 30;
void Start ()
{
if (Bar == nul... |
Python | UTF-8 | 4,624 | 2.59375 | 3 | [] | no_license | # Configuration for gym_auv gym environment
from dataclasses import dataclass
import dataclasses
from functools import cached_property
from typing import Any, Callable, Tuple, Union
# import gym_auv
from gym_auv.utils.observe_functions import observe_obstacle_fun
from gym_auv.utils.sector_partitioning import sector_p... |
Python | UTF-8 | 646 | 3.15625 | 3 | [] | no_license |
import sys
'''
n = int(input().strip())
s = str(bin(n))
print(len(max(s[2:].split('0'))))
'''
#si.split('0')
#print(si)
#print(len(max(si)))
'''
time = input().strip().upper()
L = len(time)
if time[L-2::1] == 'PM':
hour = time[2:]
if hour == '12':
hour = '00'
else: hour = int(time[:2])+12)
n... |
C++ | UTF-8 | 677 | 3.28125 | 3 | [] | no_license | #include <iostream>
#include <vector>
using std::vector;
int optimal_weight(int W, const vector<int> &w) {
std::vector<std::vector<int>> maxWeight (w.size() + 1, std::vector<int> (W + 1));
int weight {};
for(int i {1}; i <= w.size(); i++) {
for(int j {1}; j <= W; j++) {
maxWeight[i][j] = maxWeight[i - 1][j];... |
Java | UTF-8 | 395 | 3.015625 | 3 | [] | no_license | package link.hooray.jdk8.feature.stream.usual;
import java.util.stream.Stream;
public class Demo02Filter {
public static void main(String[] args) {
Stream<String> stream = Stream.of("张三丰", "张翠山", "赵敏", "周芷若", "张无忌");
Stream<String> stream1 = stream.filter(s -> s.startsWith("张"));
stream1.... |
Python | UTF-8 | 311 | 2.671875 | 3 | [] | no_license | #
# https://realpython.com/fast-flexible-pandas/
#
import os
import pandas as pd
print(pd.__version__)
dir_path = os.path.dirname(os.path.realpath(__file__))
data_file_path = os.path.join(dir_path, 'demand_profile.csv')
print(f"file path: {data_file_path}")
df = pd.read_csv(data_file_path)
print(df.head()) |
Python | UTF-8 | 744 | 2.96875 | 3 | [] | no_license | from math import *
def getline(): return list(map(int, input().split()))
def getint(): return int(input())
N = 10**3 + 1
prime = [True]*N
prime[0] = prime[1] = False
res = [1] * N
primes = []
mem = {}
for i in range(N):
if prime[i]:
res[i] = i+1
primes.append(i)
for j in range(2*i, N, i... |
PHP | UTF-8 | 611 | 2.828125 | 3 | [] | no_license | <?php
declare(strict_types=1);
namespace Models\Patterns\FactoryMethod;
/**
* Class CommonsManager
*
* @package Models\Patterns\FactoryMethod
*/
abstract class CommonsManager
{
/**
* Get instance of message encoder class
*
* @return MessageEncoder
*/
abstract public function getMessage... |
Java | UTF-8 | 3,858 | 2.859375 | 3 | [] | no_license | import java.sql.*;
//import java.String.*;
// exekveras med java DB2Luw_employee //127.0.0.1:50000/SAMPLE user password OBS ! Använd inte ODBC Data Source namn utan db2 instans dbname
public class DB2Luw_employee
{
public static void main(String[] args)
{
String rsEMPNO;
String rsFIRSTNME;
String rs... |
Markdown | UTF-8 | 2,045 | 2.609375 | 3 | [
"CC-BY-4.0",
"MIT"
] | permissive | ---
title: <namedCaches> 的 <clear> 項目
ms.date: 03/30/2017
helpviewer_keywords:
- <clear> element for <namedCaches>
- clear element for <namedCaches>
ms.assetid: ea01a858-65da-4348-800f-5e3df59d4d79
ms.openlocfilehash: bcc0e23f0c47ad3a98430e36da31d39612caa3c9
ms.sourcegitcommit: 4e2d355baba82814fa53efd6b8bbb45bfe054d11
... |
SQL | UTF-8 | 2,625 | 3.296875 | 3 | [] | no_license | DROP TABLE IF EXISTS `qn_qrcode`;
CREATE TABLE IF NOT EXISTS `qn_qrcode` (
`id` bigint(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL,
`title` varchar(50) NOT NULL COMMENT '二维码标题',
`max_scan` bigint(11) NOT NULL DEFAULT '10000' COMMENT '最大扫描次数',
`view_mode` int(11) NOT NULL DEFAULT '1' COMMENT '显示模式',
... |
C# | UTF-8 | 2,672 | 2.53125 | 3 | [] | no_license | using System.Collections.Generic;
using System.Threading.Tasks;
using InchCapeTest.DtoS;
using InchCapeTest.Enums;
using InchCapeTest.Interfaces;
using Microsoft.AspNetCore.Mvc;
namespace InchCapeTest.Controllers.v1
{
[ApiController]
[ApiVersion("1.0")]
[Route("api/v{version:apiVersion}/[controller]")]
... |
JavaScript | UTF-8 | 1,509 | 3.03125 | 3 | [] | no_license | const IMAGE_API_URL = "https://picsum.photos/200/300";
const TEXT_API_URL = "https://dummyapi.io/data/v1/user?limit=10";
let imageElement = document.getElementById("image");
let userInformation = document.getElementById("userInfo");
function myFetch(url, options) {
return new Promise((resolve, reject) => {
... |
C++ | UTF-8 | 2,106 | 3.46875 | 3 | [] | no_license | /*
굉장히 재미있던 문제!
이분 탐색 + 다익스트라를 이용해면 시간 안에 해결을 할 수 있다.
1) 이분탐색
얼마 이하의 길들만 이용할지 를 기준으로 이분탐색을 진행한다.
그러면 이분탐색의 범위는 1 ~ 10^9 가 된다.
2) 다익스트라
이분탐색으로 얼마 이하의 길들을 이용할지 정해졌다면,
A지점에서 B지점으로 최단 거리를 구하면 된다.
3)
cost 이하의 길들만 이용해서 A에서 B로 가는 길이
우리가 가지고 있는 C원 이하이면 갈 수 있으므로 답을 갱신한다.
--> 이분탐색과 다익스트라를 이용하면 복잡도를 줄일 수 있다.
-->... |
C# | UTF-8 | 2,234 | 3.109375 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.AspNetCore.Identity;
using NUnit.Framework;
using WordGame.Helpers;
using WordGame.Models;
namespace WordGameTest
{
public class Tests
{
[SetUp]
public void Setup()
{
}
... |
Java | UTF-8 | 453 | 2.046875 | 2 | [] | no_license | package com.coursera.admin.web.model;
public class Token {
public static String tokenID;
public static String cognitoUserId;
public static String getTokenID() {
return tokenID;
}
public static void setTokenID(String tokenID) {
Token.tokenID = tokenID;
}
public static String getCognitoUserId() {
ret... |
Markdown | UTF-8 | 2,053 | 2.984375 | 3 | [] | no_license | # Trigger Pull Repo
This little NodeJS app updates your local git repository when there is a change on the branch *master* of your remote repository. It uses a github webhook.
## Prerequisites
* OS: Ubuntu
* Already installed: [NodeJS](https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distr... |
Ruby | UTF-8 | 373 | 2.65625 | 3 | [] | no_license | towns = SmarterCSV.process('public/src_files/town_data.csv')
towns.each do |town|
town.delete :fecha
town.delete :id_municipio
town.delete :id_provincia
Town.create town
end
parties = SmarterCSV.process('public/src_files/party_data.csv')
parties.each do |party|
town= Town.find_by town_code: party[:town_code]
... |
C++ | UTF-8 | 2,867 | 2.640625 | 3 | [] | no_license | /*
* Software by Thanh Phung -- thanhtphung@yahoo.com.
* No copyrights. No warranties. No restrictions in reuse.
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <new>
#include <string>
#include "appkit/CmdLine.hpp"
#include "appkit/DelimitedTxt.hpp"
#incl... |
C++ | UTF-8 | 2,945 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | #include "CacheConfig.hh"
#include <string>
#include "inipp.h"
CacheConfig::CacheConfig(const CacheType type, const uint64_t size, const int line_size,
const int set_size)
: type(type), size(size), line_size(line_size), set_size(set_size) { }
CacheConfig::CacheConfig(std::istream&& conf... |
Markdown | UTF-8 | 7,060 | 3.140625 | 3 | [
"MIT"
] | permissive | # README
Library to access and modify the contents of an Epub

## Usage
Initialize with the path to an epub file, note any setters will edit the epub itself, so work on a copy if you don't want to modify the original
epub = Epub::Documen... |
JavaScript | UTF-8 | 1,241 | 2.9375 | 3 | [] | no_license | var bird;
var pipes = [];
var speed = 3;
var tick = 0;
var initJump = false;
var counter = 0;
var score;
function setup() {
createCanvas(window.innerWidth,window.innerHeight);
bird = new Bird();
score = new Score();
}
function draw() {
background(52, 235, 235);
for (var i = pipes.len... |
Java | UTF-8 | 368 | 1.984375 | 2 | [] | no_license | package com.lin.framework.soap;
import com.lin.model.Customer;
/**
* @author lkmc2
* @date 2018/9/18
* @since 1.0.0
* @description 客户SOAP接口服务
*/
public interface CustomerSoapService {
/**
* 根据客户ID获取客户对象
* @param customerId 客户id
* @return 客户对象
*/
Customer getCustomer(long customerId);... |
Go | UTF-8 | 3,641 | 3.59375 | 4 | [] | no_license | package tablet
import (
"fmt"
"regexp"
"strconv"
)
// Tablet describes a programmable sound making device
type Tablet struct {
instructions []instruction
registers map[string]int
playedSounds []int
}
// Make constructs a Tablet from a set of programming instructions
func Make(rawInstructions []string) Table... |
TypeScript | UTF-8 | 609 | 3 | 3 | [
"Apache-2.0"
] | permissive | import { set } from './set.js'
import type { Writable } from './writable.js'
/**
* Returns a function to set the given store using the value returned by `setter`.
* This is useful in conjunction with [subscribe](#subscribe).
*/
export function set_store_<Val extends unknown = unknown>(
store:Writable<Val>,
setter ... |
Shell | UTF-8 | 2,520 | 3.953125 | 4 | [
"MIT"
] | permissive | #!/bin/bash
set -e
setupSSH() {
local SSH_PATH="$HOME/.ssh"
mkdir -p "$SSH_PATH"
touch "$SSH_PATH/known_hosts"
echo "$INPUT_KEY" > "$SSH_PATH/deploy_key"
chmod 700 "$SSH_PATH"
chmod 600 "$SSH_PATH/known_hosts"
chmod 600 "$SSH_PATH/deploy_key"
eval $(ssh-agent)
ssh-add "$SSH_PATH/deploy_key"
s... |
JavaScript | UTF-8 | 398 | 3.84375 | 4 | [] | no_license | function max()
{
let x = document.getElementById("FirstNumber").value
let y = document.getElementById("SecondNumber").value
document.getElementById("result").value = Math.max(x, y);
}
function min()
{
let x = document.getElementById("FirstNumber").value
let y = document.getElementById("SecondNum... |
Python | UTF-8 | 194 | 3.1875 | 3 | [] | no_license | # print sentences
print "Hello World!"
print "Hello Again"
print "I like typing this"
print "This is fun"
print "Yay! Printing"
print "I'd much rather you 'not"
print 'I "said do not touch this' |
Python | UTF-8 | 2,891 | 2.53125 | 3 | [
"MIT"
] | permissive | from base64 import b64encode, b64decode
import unittest
from hamcrest import *
from nose.tools import raises
from backdrop.core.bucket import Bucket, BucketConfig
from backdrop.core.errors import ValidationError
from tests.core.test_bucket import mock_repository, mock_database
class TestBucketAutoIdGeneration(unittes... |
Python | UTF-8 | 1,809 | 2.640625 | 3 | [] | no_license | from ..base_node import BaseNode
from ...core import socket_types as socket_types
from ...core.Constants import Colors
class Vector3(BaseNode):
def __init__(self, scene, x=0, y=0):
super().__init__(scene, title_background_color=Colors.vector3, x=x, y=y)
self.change_title("[0.0, 0.0, 0.0]")
... |
C++ | UTF-8 | 507 | 2.875 | 3 | [] | no_license | class Solution {
public:
bool judgeCircle(string moves) {
int L = 0;
int U = 0;
for(int i = 0;i<moves.length();i++){
if(moves[i]=='R'){
L--;
}
else if(moves[i]=='L'){
L++;
}
else if(moves[i]=='D'){
... |
Java | UTF-8 | 925 | 2.875 | 3 | [] | no_license | package ie.gmit.sw;
public class FinalResult {
//variables for storing.
private String fileName;
private double jaccardSimilarity;
private double minHashSimilarity;
//constructor
public FinalResult(String fileName, double jaccardSimilarity, double minHashSimilarity) {
this.fileName = fileName;
this.jaccardS... |
Java | UTF-8 | 2,049 | 3.5625 | 4 | [] | no_license | import java.util.Iterator;
/**
* @author jayadeepj
*
* GenericResizingStack : Doubles the size of the array in push() if it is full
* Also the size of the array is halved in pop() if it is less than one-quarter full.
* The Stack is able to handle generic entities.
* @param <Item>
*/
public class GenericResi... |
C++ | UTF-8 | 615 | 2.546875 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int main()
{
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
int test;
cin >> test;
for(int i=1; i<=test; i++)
{
double v1,v2,a1,a2,v3,d,s;
cin >> v1 >> v2 >> v3 >> a1 >> a2;
d = (((v1*v1)/a1) + ((v2*v2)/a2... |
Python | UTF-8 | 1,052 | 3 | 3 | [] | no_license |
class UnionFind:
def __init__(self):
self.id = {}
self.weight = {}
def __getnode__(self, node):
if not node in self.id:
self.id[node] = node
self.weight[node] = 1
def root(self, node):
while self.id[node] != node:
self.id[no... |
Python | UTF-8 | 3,114 | 2.828125 | 3 | [] | no_license | import xlrd
from xlutils.copy import copy
from interface.pn1.utils.public import *
from interface.pn1.utils.excal_data import *
class OperationExcal:
def getExcal(self):
db = xlrd.open_workbook(data_dir(data='data', fileName='data3.xlsx'))
# 获取excal第一个sheet
sheet = db.sheet_by_index(0)
... |
C# | UTF-8 | 2,949 | 2.53125 | 3 | [] | no_license | using AutoMapper;
using MVCProject.Models;
using MVCProject.Models.Repository;
using MVCProject.Service.Interface;
using MVCProject.Service.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MVCProject.Service
{
public class ProductService: BaseService, IPr... |
JavaScript | UTF-8 | 2,292 | 2.53125 | 3 | [] | no_license | import React, {Component} from 'react'
import jss from './JSS.jsx'
import {
Area,
AreaChart,
CartesianAxis,
Tooltip,
ResponsiveContainer,
XAxis,
YAxis,
} from 'recharts'
const brandColor = '#FF5443'
const chartHeight = 200
const {classes} = jss.createStyleSheet({
root ... |
C++ | GB18030 | 694 | 3.75 | 4 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
struct student{
string name;
int age;
int score;
};
//βθΪָ룬Լڴռ䣬ҲḴµconstԱֹ֤
void printstudent1(const student* s) {
cout << s->name << endl;
}
int main_6() {
student s = {"", 18, 80};
printstudent1(&s);
system("pause");
return 0;
}
/*
void pri... |
Java | UTF-8 | 1,252 | 3.46875 | 3 | [] | no_license | // https://leetcode.com/problems/merge-intervals/description/
/**
* Definition for an interval.
* public class Interval {
* int start;
* int end;
* Interval() { start = 0; end = 0; }
* Interval(int s, int e) { start = s; end = e; }
* }
*/
class Solution {
public List<Interval> merge(List<I... |
Rust | UTF-8 | 668 | 3.171875 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | //! Cross-platform type abstractions over low-level platform-specific window events.
/// Represents an interaction with an editor window.
#[derive(Clone, Debug, PartialEq)]
pub enum WindowEvent {
/// XY coordinates. Each coordinate is based in the range [0, 1], scaled to the bounds of the
/// window. Origin is... |
PHP | UTF-8 | 539 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | <?
class Vonnegut_Namespace {
public $name;
public $classes;
public $constants;
public $functions;
public $interfaces;
public $namespaces;
public $variables;
public function __construct($name = null) {
$this->name = $name;
$this->classes = new StdClass();
$t... |
Markdown | UTF-8 | 2,547 | 2.96875 | 3 | [] | no_license | # Using Python scripts in Node.js server
ref: https://www.ivarprudnikov.com/nodejs-server-running-python-scripts/
## Using child process
```javascript=
child_process.spawn()
```
> 目前 tdtoolkit_web 是使用 python-shell,不過開啟時需要 Loading moduled 相當費時,有沒有好的方法?
```javascript=
const path = require('path')
const {spawn} = require... |
C# | UTF-8 | 8,711 | 3.046875 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] | permissive | using System;
using System.Collections.Generic;
using System.Linq;
namespace Ledger.Core
{
public class MemoryLedgerStore : ILedgerStore
{
private IList<IEntry> _entries = new List<IEntry>();
private IList<IEntryItem> _entryItems = new List<IEntryItem>();
private IDictionary<IBook, ILis... |
Markdown | UTF-8 | 621 | 2.9375 | 3 | [] | no_license | # exam_prep
In-class hints for the final math exam.
## Week 2:
XOR
Implication (False case)
Bitwise
Considder one bit at a time and do a boolean result of each.
* & and
* && or
Be able to add binary!! (quiz next week)
## Week 3:
* Sets
* Set Notation
## Week4:
* multiply matricies
* converting from matrix to g... |
Python | UTF-8 | 1,135 | 3.046875 | 3 | [] | no_license | def run():
f = open('B-large.in')
number_of_testcase = f.readline()
for test_case in range(1, int(number_of_testcase)+1):
game_param = f.readline().split(' ')
game_param = map(lambda x: float(x), game_param)
last_best_time = game_param[2] / 2.0
current_production_rate = 2... |
Java | UTF-8 | 528 | 1.835938 | 2 | [] | no_license | package Premium.A02_service;
import java.util.ArrayList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import Premium.A03_repository.A05_AndroidDao;
import Premium.vo.And_work;
import Premium.vo.And_workCeo;
@Service
public class A05_AndroidService {
... |
Ruby | UTF-8 | 476 | 3.046875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | require 'pry'
class MP3Importer
attr_reader :path, :files
def initialize(file_path)
@path = file_path
end
def files
@file_array = Dir.entries(@path)
@file_array.delete_if{|file| file.include?('mp3') == false}
end
def import
self.files
@chomped_array = @file_array.map{|file| file.cho... |
Markdown | UTF-8 | 1,522 | 3.125 | 3 | [] | no_license | # text-based-adventure-game
## how it works
This game is a text based adventure game based around classic murder mysteries like 'Clue' and 'Murder on the Orient Express' combined with a text-input game such as 'Zork' or 'Collosal Cave Adventure'. You are a detective that is trying to get away for an unplugged retreat ... |
Python | UTF-8 | 629 | 3.515625 | 4 | [] | no_license | import pygame
class Ship:
"""A class to manage the ship"""
def __init__(self, ai_game):
"""Init the ship and starting position"""
self.screen = ai_game.screen
self.screen_rect = ai_game.screen.get_rect()
# Load the ship image and get its rect
self.image = pygame.image.... |
Python | UTF-8 | 623 | 2.765625 | 3 | [] | no_license | from bs4 import BeautifulSoup
import requests
page = requests.get('https://forecast.weather.gov/MapClick.php?lat=33.94251000000003&lon=-118.40896999999995#.XOnRqlL0nIU')
soup = BeautifulSoup(page.content, 'html.parser')
week = soup.find(id='seven-day-forecast-body')
items = week.find_all(class_='tombstone-container')... |
C | UTF-8 | 1,484 | 3.8125 | 4 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include "functions.h"
void random_array(int *array) {
for (int i = 0; i < N; i++) {
array[i] = (rand() % RANGE);
}
}
void print_array(int *array) {
for (int i = 0; i < N; i++) {
printf_s("%2d", array[i]);
}
}
void print_array_count(int *array, i... |
C# | UTF-8 | 1,241 | 2.921875 | 3 | [] | no_license | /********************************************************************
Class : ListViewItemComparer
Created by : Ali Özgür
Contact : ali_ozgur@hotmail.com
Copyright: Ali Özgür - 2007
*********************************************************************/
using System;
using System.Collections;
using ... |
JavaScript | UTF-8 | 2,361 | 2.6875 | 3 | [] | no_license | const ImageBaseURL = 'https://image.tmdb.org/t/p/w500';
export const getPopularMovies = (page = 1) => {
const path = page > 1 ? buildPath('/Movie', { pageNumber: page }) : '/Movie';
return new Promise((resolve, reject) => {
fetch(path)
.then(response => response.json())
.then(listings ... |
Python | UTF-8 | 5,726 | 2.546875 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference",
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"MIT",
"Apache-2.0"
] | permissive | # Copyright 2014 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""ELF parsing related helper functions/classes."""
from __future__ import print_function
import cStringIO
import os
from chromite.scripts import lddtr... |
Markdown | UTF-8 | 2,314 | 2.90625 | 3 | [
"Apache-2.0"
] | permissive | # Project 4 - *Parstagram*
This is an Instagram clone with a custom Parse backend that allows a user to post photos and view a global photos feed.
Time spent: **6** hours spent in total
## User Stories
The following **required** functionality is completed:
- [x] User sees app icon in home screen and styled launch ... |
PHP | UTF-8 | 3,885 | 2.671875 | 3 | [] | no_license | <?php
require 'connection.inc.php';
function clean_values($con,$value){
$value=stripslashes($value);
$value=stripcslashes($value);
$value=mysqli_escape_string($con,$value);
$value=mysqli_real_escape_string($con,$value);
return $value;
}
// for inserting/Updating into database
function insert_update($con,$quer... |
Java | UTF-8 | 416 | 3.25 | 3 | [] | no_license | package T210930;
public class ArrayTest03 {
public static void main(String[] args) {
// TODO Auto-generated method stub
int aa[] = {10,20,30,40,50};
int count, size;
count = aa.length;
size=count*Integer.BYTES;
System.out.printf("배열 aa[]의 요소의 개수는 %d 개입니다.\n", count);
System.out.printf("배열 aa[]의 요소의 ... |
Java | UTF-8 | 2,981 | 2.40625 | 2 | [] | no_license | package cn.edu.sdwu.android.classroom.sn170507180227;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.CompoundButton;
import android.widget.Spinner;
import android.widget.To... |
TypeScript | UTF-8 | 189 | 3.0625 | 3 | [] | no_license | export const makeArray = (from: number, length = 5) => {
const newArr = new Array(length).fill(0);
for (let i = 0; i < length; i++) {
newArr[i] = from + i;
}
return newArr;
};
|
Java | UTF-8 | 365 | 1.671875 | 2 | [] | no_license | package com.fball.service;
import java.util.List;
import com.fball.dto.VirtualMatchDTO;
public interface VirtualMatchService {
List<VirtualMatchDTO> getListVirtualMatchByIdMatch(int id);
String newVirtualMatchInId(int idVirtual, String string);
String joinVirtualMatchInId(int id, String string);
String cance... |
Java | GB18030 | 326 | 1.992188 | 2 | [] | no_license | package com.insigma.mvc.model;
public class ExcelExportModel implements java.io.Serializable {
private String excel_info; // varchar2(36) ʱ֮ʱ
public String getExcel_info() {
return excel_info;
}
public void setExcel_info(String excel_info) {
this.excel_info = excel_info;
}
} |
Go | UTF-8 | 5,340 | 3.046875 | 3 | [] | no_license | package controllers
import (
"encoding/json"
"fmt"
"net/http"
"regexp"
"../models"
"../utils"
"github.com/gorilla/mux"
)
// validateEmail checks if the ID is valid
func validateEmail(email string) bool {
Re := regexp.MustCompile(`^[a-z0-9._%+\-]+@[a-z0-9.\-]+\.[a-z]{2,4}$`)
return Re.MatchString(email)
}
/... |
Markdown | UTF-8 | 2,431 | 2.859375 | 3 | [
"MIT"
] | permissive | # GBBS: Graph Based Benchmark Suite
Clique Counting and Peeling Algorithms
--------
This folder contains code for our parallel k-clique counting and peeling.
Detailed information about the required compilation system and
input graph formats can be found in the top-level directory of this
repository. We describe her... |
PHP | UTF-8 | 1,603 | 2.703125 | 3 | [] | no_license | <?php
include("con_db.php");
if(isset($_POST['register'])){
if(strlen($_POST['name']) >= 1 &&
strlen($_POST['contraseña']) >= 1 &&
strlen($_POST['contraseña1']) >= 1){
if(strlen($_POST['contraseña']) > 3){
if($_POST['contraseña'] == $_POST['contraseña1'])... |
C++ | UTF-8 | 1,439 | 3.15625 | 3 | [] | no_license | #include <iostream>
#include <stdio.h>
#include <string>
using namespace std;
void process(int n, int *froms);
void simulate(int n, int *froms);
void print_solution(int n, int *froms);
int main() {
string line;
while (!cin.eof()) {
int n;
cin >> n;
printf("%d\n", n);
int * froms = new int[n];
... |
Python | UTF-8 | 1,225 | 2.71875 | 3 | [] | no_license | import sqlite3
# g is object made for each request
# current_app is object that points to Flask app handling request
import click
from flask import current_app, g
from flask.cli import with_appcontext
def get_db():
if 'db' not in g:
g.db = sqlite3.connect(
current_app.config['DATABASE'],
detect_types=sqlite3... |
Java | UTF-8 | 49 | 1.851563 | 2 | [] | no_license |
public enum PriorityType {
normal, high, max
}
|
JavaScript | UTF-8 | 1,499 | 2.5625 | 3 | [] | no_license | import React, { Component } from 'react'
import styled from 'styled-components'
import { rgba } from 'polished'
// TODO:
// Refactor this one, rewrite entirely with styled comp.
// Think about the way to use tag literal.
// Something like:
// <div>
// DynamicCode`
// <span>
// ${this.props.text + 'px'}... |
Java | UTF-8 | 2,125 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | package org.krystianekb.sorting.file;
import com.google.code.externalsorting.ExternalSort;
import org.apache.commons.lang3.time.StopWatch;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.Arrays;
import java.util.List;
import static com.google.code.externalsorting.Ex... |
C++ | UTF-8 | 1,947 | 2.734375 | 3 | [
"MIT"
] | permissive | /*
* ContactMap.h
*
* Created on: Jun 20, 2014
* Author: e4k2
*/
#ifndef CONTACTMAP_H_
#define CONTACTMAP_H_
#include "Contact.h"
#include <tr1/array>
using namespace std;
class ContactMapIterator;
/**
* Contains all contacts (distance determined by caller) added by the user using makeEntry and add
*/... |
Java | UTF-8 | 11,110 | 2.390625 | 2 | [
"BSD-2-Clause"
] | permissive | import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static play.mvc.Http.Status.BAD_REQUEST;
import static play.mvc.Http.Status.NOT_FOUND;
import static play.mvc.Http.Status.SEE_OTHER;
import static play.test.Helpers.callAction;
import static play.test.Helpers.contentAsString;... |
Java | UTF-8 | 1,885 | 2.171875 | 2 | [
"MIT"
] | permissive | package uk.gov.hmcts.ccd.domain.model.std;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.jayway.jsonpath.DocumentContext;
import com.jayway.jso... |
Java | UTF-8 | 1,519 | 2.9375 | 3 | [] | no_license | class Site extends Thread{
/* Constantes associ�es au site */
static final int stockInit = 9;
static final int stockMax = 10;
static final int borneSup = 7;
static final int borneInf = 2;
int stockVelos;
int numeroSite;
public Site(int numeroSite){
this.numeroSite = numeroSite;
this.stockVelos = stoc... |
Java | UTF-8 | 1,023 | 1.703125 | 2 | [] | no_license | package com.tencent.p177mm.plugin.wallet_payu.pwd.p1054a;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.p177mm.sdk.platformtools.C4990ab;
import com.tencent.p177mm.wallet_core.p1512e.p1513a.C36383a;
import java.util.HashMap;
import org.json.JSONObject;
/* renamed from: com.tencent.mm.plugin.w... |
C | UTF-8 | 198 | 2.609375 | 3 | [
"MIT",
"NCSA"
] | permissive | // This program should run. "The } that terminates a function is reached, and the value of the function call is not used by the caller (6.9.1)."
int f(void){
}
int main(void){
f();
return 0;
}
|
Swift | UTF-8 | 774 | 2.890625 | 3 | [] | no_license | //
// DynamicTypeTextField.swift
// TimersApp
//
// Created by Łukasz Bazior on 12/05/2020.
// Copyright © 2020 Łukasz Bazior. All rights reserved.
//
import UIKit
class DynamicTypeTextField: UITextField {
override init(frame: CGRect) {
super.init(frame: frame)
setup()
}
requ... |
Java | UTF-8 | 148 | 2.0625 | 2 | [] | no_license | package d0922_1.Demo7;
public class Father {
//不能被重写,可以继承
public final void method1(){}
public void method2(){}
}
|
Java | UTF-8 | 2,216 | 2.734375 | 3 | [] | no_license | package com.monkey.interceptor.test;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* @program: demo
* @description: TODO
* @author: Mr.Wang
* @create:... |
Shell | UTF-8 | 809 | 3.953125 | 4 | [
"Apache-2.0"
] | permissive | #!/bin/bash
# Difido server
#
# description: Script that can be added to the /etc/init.d and will cause the server to run at the init stage. In additions, allows to use the start, stop and restart services.
#
# Instructions:
# 1. Set the DIFIDO_PATH variable with the location of the difido-server. e.g. /usr/local/bin... |
Java | UTF-8 | 2,460 | 3.09375 | 3 | [] | no_license | package main.kazgarsrevenge.util.managers;
import java.awt.image.BufferedImage;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import main.kazgarsrevenge.model.ChunkComponent;
import main.kazgarsrevenge.model.impl.Room;
import main.kazgarsrevenge.model.impl.RoomBlock;
import main.kazgarsrevenge... |
Ruby | UTF-8 | 597 | 2.84375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env ruby
begin
require 'feed_yamlizer'
rescue LoadError
require 'rubygems'
require 'feed_yamlizer'
end
require 'open-uri'
# just prints the text, not yaml
def print_text(res)
res[:items].each {|x|
puts '-' * 30
puts x[:title]
puts
puts x[:content][:text]
}
end
if ARGV.first == '... |
Ruby | UTF-8 | 1,211 | 2.859375 | 3 | [] | no_license | require 'spec_helper'
describe "XML menu" do
before(:all) do
@xml_menu = GuiseppesMenu.new
end
it "no price should be more than £10" do
@xml_menu.price_array_maker
@xml_menu.price_array.each do |price|
expect(price).to be < 10
end
end
it "should have no item with calories over 1000 e... |
C++ | UTF-8 | 1,269 | 3.609375 | 4 | [] | no_license | #include <iostream>
#include <cmath>
using namespace std;
// C++ 11 std.
class triangle_numerics
{
public:
double a, b, c; // triangle sides
double circumference (double a, double b, double c);
private:
bool isIttriangle (double, double, double);
};
double triangle_numerics::circumference (double a, double b, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.