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 | 694 | 2.9375 | 3 | [] | no_license | function subjectFactory() {
return new Rx.Subject();
}
var result = Rx.Observable.interval(1000).take(6)
.do(x => console.log('source ' + x) || displayInPreview('source ' + x))
.map(x => Math.random())
.multicast(subjectFactory, function selector(shared) {
var sharedDelayed = shared.delay(500);
var me... |
Java | UTF-8 | 6,161 | 4.15625 | 4 | [] | no_license | package collectionTest;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
/**
* 功能:把一个数组的值存入二叉树中,然后进行3种方式的遍历
*
* 参考资料0:数据结构(C语言版)严蔚敏
*
* 参考资料1:http://zhidao.baidu.com/question/81938912.html
*
* 参考资料2:http://cslibrary.stanford.edu/110/BinaryTrees.html#java
*
* @... |
C++ | UTF-8 | 606 | 3.484375 | 3 | [] | no_license | #include <iostream>
using namespace std;
int sumDigitSquare(int n)
{
int steps = 0;
while (1) {
if (n == 1)
return ++steps;
int sum = 0;
while (n) {
int digit = n % 10;
sum += digit * digit;
n = n / 10;
}
steps++;
n = sum;
if (sum == 4)
break;
}
return 0;
}
int ... |
Markdown | UTF-8 | 11,947 | 2.875 | 3 | [] | no_license | ---
categories: []
date: "2020-07-31T04:00:00+00:00"
featured_image: /v1596229458/library-869061_1920_jkaxzj.jpg
hero_text: ""
keywords: []
profile: []
tags: []
title: 529 Plans vs. Other College Savings Options
---
Section 529 plans can be a great way to save for college. In many cases, it is the best way for families... |
Python | UTF-8 | 1,579 | 3.953125 | 4 | [] | no_license | data = []
count = 0
with open('reviews.txt','r') as f:
for line in f:
data.append(line.strip())
#print(line)
count += 1 # count = count + 1
if count % 1000 == 0: # %求餘數 (除以 1000 餘數為 0)
print(len(data))
print('檔案讀取完了, 總共有',len(data), '筆資料')
sum_len = 0
for d in data:
sum_len = sum_len + len(d)
print('留言平均... |
C | UTF-8 | 3,600 | 3.5 | 4 | [] | no_license | #include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>
#define FALSE 0
#define TRUE 1
int x[20];//column where queens must be placed
int place(int k, int i)
{
int j;
for (j = 1; j <= k; j++)
{
if ((x[j] == i) || (abs(x[j] - i) == abs(j - k)))
return FALSE;
}
... |
TypeScript | UTF-8 | 985 | 2.953125 | 3 | [] | no_license | /**
* Created by PhpStorm.
* Author: Max Ulyanov
* Project: Design-Patterns
* Date: 16.03.2017
* Time: 23:14
*/
'use strict';
import { IPayment } from './IPayment'
export class BankAccount implements IPayment {
cards: IPayment[];
sum: number;
/**
*
* @param sum
*/
constructo... |
Markdown | UTF-8 | 598 | 2.671875 | 3 | [] | no_license | # Chemventory
Chemventory is a database software aimed at assisting science departments in keeping track of their apparatus and chemicals. It has an easy-to-use interface with a database entry system that allows you to add: Product ID, Product name, Product category, Product description, Purchasing date, Expiry date, ... |
Java | UTF-8 | 726 | 2.34375 | 2 | [
"Apache-2.0"
] | permissive | package cn.regionsoft.one.data.persistence.criteria;
/**
* 查询条件
* @author fenglj
*
*/
public class Condition {
private String fieldName;
private Operator operator;
private Object val;
public Condition( String fieldName, Operator operator, Object val) {
super();
this.fieldName = fieldName;
this.operator =... |
JavaScript | UTF-8 | 665 | 2.640625 | 3 | [] | no_license |
(function() {
$(function () {
var panelTemplate;
var url = 'api/cotizaciones'
console.log(url);
$.get('template/panel.html',function(dom){
panelTemplate = dom;
});
$.get(url)
.done(function(data) {
for(var i=0;i<data.length;i++){
var panel = $(panelTemplate);
va... |
Java | UTF-8 | 3,094 | 2.53125 | 3 | [] | no_license | package viki.programming.saveload;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FilenameFilter;
import java.io.PrintStream;
import java.util.Scanner;
import viki.programming.gameoflife.*;
public class SaveLoadFromTextFile implements SaveLoadInterface {
private GameSimulator model;
p... |
Markdown | UTF-8 | 870 | 2.71875 | 3 | [
"MIT"
] | permissive | ---
title: 함수형 프로그래밍 no.01
categories: [programming, functional-programming]
tags: [functional-programming, programming] # TAG names should always be lowercase
---
# 어플리케이션의 설계 요소
* 확장성: 추가 기능을 지원하기 위해 계속 코드를 리팩토링해야 하는가?
* 모듈화 용이성: 파일 하나를 고치면 다른 파일도 영향을 받는가?
* 재사용성: 중복이 많은가?
* 테스트성: 함수를 단위 테스트하기 어려운가?
* 헤아리기 쉬움: ... |
Markdown | UTF-8 | 1,227 | 4.09375 | 4 | [] | no_license | ## 布尔操作符
Javascript中布尔操作符非`!`、与`&&`、或`||`,可以应用于Javascript中的任何值。
### 逻辑非
逻辑非操作符首先会将它的操作数转换为一个布尔值,然后再对其求反并返回。在将操作数转换为布尔值的过程同`Boolean()`函数相同,因此只需
记住其中会被转换为`true`值的规则(其他情况下均为`false`),如下:
|操作数|返回值|
|:-|:-|
|空字符串|true|
|0 或 -0|true|
|NaN|true|
|null|true|
|undefined|true|
> 小技巧:将任意值(`value`)转换为bool类型 => `!!value`
### 逻辑... |
PHP | UTF-8 | 2,638 | 2.6875 | 3 | [] | no_license | <!doctype html>
<html>
<head>
<title>Edit Form</title>
<link rel="stylesheet" href="style12.css">
</head>
<body style="background-color:lightgrey">
<p>
<h1><u>Edit Driver</u></h1>
</p>
<?php
$conn = new mysqli('127.0.0.1', 'root', '', 'brt');
if ($conn->connect_error) {
die("... |
Java | UTF-8 | 421 | 2.109375 | 2 | [] | no_license | package com.kele.springboot_docker.entity;
import lombok.Data;
import javax.persistence.*;
import java.util.Date;
/**
* @Version 2019
* @Author:kele
* @Date:2020/7/2
* @Content:
*/
@Data
@Entity
@Table(name = "user")
public class User {
@Id //这是一个主键
@GeneratedValue(strategy = GenerationType.IDENTITY)/... |
C# | UTF-8 | 1,444 | 3.4375 | 3 | [
"MIT"
] | permissive | using System;
using System.Collections.Generic;
using System.Linq;
namespace AdvertisementMessage
{
class Program
{
static void Main(string[] args)
{
string[] phrases = new string[] {"Excellent product.", "Such a great product.",
"I always use that product." ,"Best ... |
Python | UTF-8 | 734 | 3.3125 | 3 | [] | no_license | filename = "/home/xmbomb/dev/aoc2020/day3/input.txt"
with open(filename, 'r') as file:
data = file.read().split('\n')
def part1(data, right_amount, down_amount):
lines, line_length = len(data), len(data[0])
char_index = 0
trees = 0
for i in range(0, lines, down_amount):
if data[i][char_i... |
Java | UTF-8 | 5,317 | 2.265625 | 2 | [
"Apache-2.0"
] | permissive | /*
*
*/
package com.example.smoke;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.example.NativeBase;
import java.util.List;
import java.util.Map;
public final class Nullable extends NativeBase {
public enum SomeEnum {
ON(0),
OFF(1);
publi... |
JavaScript | UTF-8 | 1,132 | 3.84375 | 4 | [] | no_license | const pilots = [ 'vettel', 'alonso', 'raikkonen', 'massa']
pilots.pop()// remove the last element
console.log(pilots)
pilots.push('vestappen')
console.log(pilots)
console.log(pilots.shift()) // remove the first element
console.log(pilots)
pilots.unshift('shumacher') // add an element in the first position
console.log(p... |
C# | UTF-8 | 4,136 | 3.359375 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Text;
namespace Tree
{
public class ThreadNode
{
public int data;
public int lthread;
public int rthread;
public ThreadNode lchild;
public ThreadNode rchild;
//线索树构造函数
public ThreadNode()
... |
TypeScript | UTF-8 | 1,712 | 3.109375 | 3 | [
"MIT"
] | permissive | import * as assert from 'assert';
import * as sassVar from '.';
describe('sassVar.generate(name: string, value: any): string', () => {
it('should raise when the object includes undefined', () => {
assert.throws(
() => sassVar.generate('var', undefined),
// NOTE: Hack for `TypeError [ERR_AMBIGUOUS_ARG... |
JavaScript | UTF-8 | 1,064 | 2.578125 | 3 | [] | no_license | const nodemailer = require('nodemailer');
// function to be called with api route
const mailFunc = (from, to, message) => {
// creates the transporter object with necessary data to send out emails
const transporter = nodemailer.createTransport({
host: "smtp.sendgrid.net",
port: 587,
secure: false, // up... |
Python | UTF-8 | 1,823 | 2.640625 | 3 | [
"MIT"
] | permissive | import matplotlib.pyplot as plt
memcached = []
seastar_memcached = []
nginx = []
iperf3 = []
data = [
# memcached,
{
'x': [1.05, 2.07, 3.18, 4.22, 5.27, 6.38, 7.44, 8.40, 12.30, 16.34, 33.57, 64],
'y': [467.6, 1046.4, 1528, 1903.2, 2383.2, 2785.6, 3164, 3280, 4524, 5716.8, 9600... |
Java | UTF-8 | 1,954 | 2.140625 | 2 | [] | no_license | package com.epoch.framework.web.component.element;
import java.util.Map;
import java.util.Set;
import javax.faces.component.html.HtmlInputHidden;
import org.apache.commons.lang.StringUtils;
import com.epoch.framework.web.utils.FacesContextUtils;
/**
* Created by IntelliJ IDEA.
* User: else
* Date: 2011-2-28
* ... |
Python | UTF-8 | 7,669 | 2.65625 | 3 | [] | no_license | import sys
import random
from django.utils.functional import Promise
import requests
import pickle
from django.conf import settings
class GameObject:
def __init__(self, x = 0, y = 0):
self.pos_x = x
self.pos_y = y
def x_position(self):
return self.pos_x
def y_position(self):
... |
Markdown | UTF-8 | 5,405 | 3.421875 | 3 | [] | no_license | ## Builtin functions and macros
### I/O functions
```mank
fun putchar: i32 (c: char)
```
Writes a single character `c` to `stdout` and returns the character written if successful and `-1` if not.
---
```mank
fun stderr_putchar: i32 (c: char)
```
Same as `putchar` but writes to `stderr`.
---
```mank
fun getchar: ... |
C++ | UTF-8 | 1,963 | 3.21875 | 3 | [] | no_license | #include <deque>
#include <iostream>
#include <algorithm>
#define sz(a) int((a).size())
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define FOR(a,b,i) for(int i=a; i<=b; i++)
#define RFOR(a,b,i) for(int i=a; i>=b; i--)
#define SET(c,x) mem... |
C# | UTF-8 | 1,588 | 2.75 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using FreeRock.Data;
using FreeRock.Models;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace FreeRock.Controllers
{
public class GenresController : Controller
{
ApplicationDbConte... |
C | UTF-8 | 1,015 | 2.765625 | 3 | [] | no_license | /* Rewritten using /std, Mats 960220 */
inherit "/std/basic_room";
reset(arg) {
if (arg) return;
set_light(1);
add_property("hills");
add_property("water");
set_short("Rolling hills");
set_long("You are in some rolling hills and they continue in all directions.\n" +
"To the west you can see a casc... |
Markdown | UTF-8 | 2,893 | 2.875 | 3 | [] | no_license | # bcode-algorithm-test
## 최초 제안내용
* 가정
1. 손으로 하는거니까 칠할때 빽빽히 1픽셀도 안남기고 칠하는 경우는 없을 것
2. 최소 해당 칸의 절반 이상은 칠해야 인식이 되고라고는 알려줘야 함
* 기존 알고리즘
1. 전체 영역을 9칸(3x3)으로 등분
2. 전체 9칸의 픽셀 값 평균과 각 칸의 픽셀 값 평균을 비교함
3. 각 칸의 평균이 전체 평균보다 낮으면 칠해짐(1) or 높으면 안칠해짐(0) 으로 판단
* 개선 알고리즘
1. 전체 영역을 9칸(3x3)으로 등분
2... |
Java | UTF-8 | 768 | 3.6875 | 4 | [] | no_license | // The sort method uses the compareTo() method to sort. It expects the objects to be sorted to be comparable, otherwise it will not compile when calling sort(list).
// But you can fix this by passing a comparator to sort() method - sort(list, comparator), meaning you can specify sort order without using compareTo() me... |
Shell | UTF-8 | 465 | 3.265625 | 3 | [
"MIT"
] | permissive | #!/bin/sh
build()
{
./gradlew build
}
upload()
{
scp ./build/libs/ROOT.war wolfsound@wolfsound.ddns.net:docker$1/webapp/ROOT.war
}
wolfsound()
{
ssh wolfsound@wolfsound.ddns.net './prepare.sh'
scp ./build/libs/ROOT.war wolfsound@wolfsound.ddns.net:docker/webapp/ROOT.war
ssh wolfsound@wolfsound.dd... |
C# | UTF-8 | 6,500 | 2.625 | 3 | [
"MIT"
] | permissive | using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Voxels.Utils.Collisions {
public class Intersection {
// based on https://www.scratchapixel.com/lessons/3d-basic-rendering/minimal-ray-tracer-rendering-simple-shapes/ray-box-intersection
public static bool In... |
Java | UTF-8 | 443 | 1.671875 | 2 | [
"Apache-2.0"
] | permissive | package org.paasta.servicebroker.sourcecontrol.repository;
import org.paasta.servicebroker.sourcecontrol.model.JpaRepoPermission;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
/**
* Created by lena on 2017-05-16.
*/
@Repository
public interface JpaS... |
C++ | UTF-8 | 728 | 3.3125 | 3 | [] | no_license | #include<iostream>
#include<vector>
#include<map>
using namespace std;
int compress(vector<char>& chars) {
int res=0;
map<char,int> a;
for(int i=0;i<chars.size();i++)
{
a[chars[i]]++;
}
for(auto x:a)
{
if(x.second==1)
res++;... |
Java | UTF-8 | 2,363 | 2.28125 | 2 | [] | no_license | package com.login.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;... |
PHP | UTF-8 | 1,136 | 2.78125 | 3 | [
"MIT"
] | permissive | <?php
namespace Spatie\Ray\Support;
class CacheStore
{
/** @var array */
protected $store = [];
/** @var Clock */
protected $clock;
public function __construct(Clock $clock)
{
$this->clock = $clock;
}
public function hit(): self
{
$this->store[] = $this->clock->n... |
Python | UTF-8 | 1,038 | 3.03125 | 3 | [] | no_license | def calculate(a, b, c):
if c < 2:
if c == 0: return a + b
else: return a - b
else:
if c == 2: return a * b
else: return int(a / b)
def sol(knum, depth):
global max_num, min_num
if depth == n:
max_num = max(max_num, knum)
min_num = min(min_num, knum)
... |
Java | UTF-8 | 2,206 | 2.15625 | 2 | [] | no_license | package cu.edu.cujae.tykestrategy.service.impl;
import cu.edu.cujae.tykestrategy.domain.EstrategiaTemaEntity;
import cu.edu.cujae.tykestrategy.dto.EstrategiaTemaDto;
import cu.edu.cujae.tykestrategy.feignInterface.SchoolarInterface;
import cu.edu.cujae.tykestrategy.repository.EstrategiaTemaRepository;
import cu.edu.cu... |
JavaScript | UTF-8 | 1,588 | 3.734375 | 4 | [] | no_license | "use strict";
// { name: タスクの文字列, state: 完了しているかどうかの真偽値 }
const tasks = [];
/**
* Add TODO
* @param {string} task
*/
function add(task) {
tasks.push({ name: task, tate: false });
}
/**
* Get array of TODOs
* @returns {array}
*/
function list() {
return tasks.filter((task) => isNotDone(task)).map((t) => t.na... |
Shell | UTF-8 | 2,508 | 4.53125 | 5 | [] | no_license | #!/bin/bash
# Run when the container is run locally. Performs a number of tasks:
# 1: Clones the repository specified by the mandatory environment variable GIT_REPOSITORY, with the optional branch specified by GTI_BRANCH (defaults to master).
# 2: Executes any scripts found in /scripts/local. The execution order is al... |
Java | UTF-8 | 1,060 | 3.390625 | 3 | [] | no_license | class NumberOfIslands {
public int numIslands(char[][] grid) {
if(grid == null || grid.length == 0) return 0;
int num = 0;
for(int i = 0 ; i<grid.length ; i++){
for(int j = 0 ; j<grid[i].length ; j++){
if(grid[i][j] == '1'){
num++;
n... |
TypeScript | UTF-8 | 403 | 2.515625 | 3 | [] | no_license | export function extractFilterVals(value: any): any {
if (!value) {
return {};
}
const obj = {};
value.match(/(?:\\,|[^,])+/g).map(el => {
return el.match(/(?:\\:|[^:])+/g);
}).forEach(element => {
obj[element[0]] = element[1];
});
return obj;
}
export function extractIncludeVals(value: any): ... |
Markdown | UTF-8 | 12,611 | 2.609375 | 3 | [
"MulanPSL-2.0",
"LicenseRef-scancode-mulanpsl-2.0-en",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | ---
---
---
title: 1842—1844年条约的缔结
---
在南京条约以后为制定1842—1843年英国条约制度的细则而进行的几次谈判中,双方在南京达成的最初协议的基础上各有截然不同的打算。清方谈判者原来担心英国人会有领土要求,后来才确信英方正如所声称的那样只寻求贸易,而不是领土。因此,中国便打算利用贸易方面的让步去安抚英国人,但对他们的活动则根据条约而予以严格的限制,这样就能通过物质诱导来控制住他们。这里应用的就是一种精心策划而经常用来对付亚洲腹地夷狄的“羁縻”政策。它包括两个方面:(1)在商业和私人交往方面让步,用贸易特权和友谊去收买外国的好战分子;(2)乞灵于文明的等级制礼貌行为以及中国的整个文化优越感... |
JavaScript | UTF-8 | 7,650 | 2.578125 | 3 | [] | no_license | 'use strict';
(function () {
angular
.module('stocks', [])
.controller('stocksController',
['$scope','$http', 'socketio', function ($scope, $http, socketio) {
socketio.on('newStock', function (stock) {
console.log("updating all clients... a stock has been added")
$scope.getStocksFromDB("socke... |
C# | UTF-8 | 2,478 | 2.84375 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace telegramBot
{
class SendEDIMessage
{
string GLN;
string messageType;
public SendEDIMessage(string _GLN, string _messag... |
Markdown | UTF-8 | 3,797 | 3 | 3 | [] | no_license | # Crusader Kings 2 Random Hordes Mod
Randomly spawns a massive army for random AI chracters throughout the years.
Now fear not just the mongols but any war focused character.
##Mechanics
- Every 15 years or so there is a 3% chance for an AI character to gather a massive army. There are a number of rules to the cha... |
Markdown | UTF-8 | 5,970 | 2.578125 | 3 | [] | no_license | ---
description: "Recipe: Favorite Lamb and Vegetables, well mainly Potatoes"
title: "Recipe: Favorite Lamb and Vegetables, well mainly Potatoes"
slug: 5588-recipe-favorite-lamb-and-vegetables-well-mainly-potatoes
date: 2020-03-28T06:46:39.751Z
image: https://img-global.cpcdn.com/recipes/650409eeb4673dc4/751x532cq70/la... |
C# | UTF-8 | 1,545 | 2.609375 | 3 | [] | no_license | using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
namespace RulesMVC.Models.Mapping
{
public class RuleMap : EntityTypeConfiguration<Rule>
{
public RuleMap()
{
// Primary Key
this.HasKey(t => t.ID);
... |
Java | UTF-8 | 1,305 | 2.140625 | 2 | [] | no_license | package com.bandou.music.sample;
import android.app.Application;
import android.content.Context;
import com.bandou.music.MusicPlayer;
import com.bandou.music.event.MediaEnableEvent;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
/**
* @Cl... |
Java | UTF-8 | 12,190 | 3.0625 | 3 | [] | no_license | package game.physics;
import game.geometry.*;
/**
* HingedJoint provides a hinged, i.e. moveable, joint between two bodies.
* to the connected body. Hinged joints may be created that anchor bodies
* by their mid-points or a specified pair of shapes.
* <P>
* Note: The physics engine within this code repository dr... |
Go | UTF-8 | 5,102 | 2.75 | 3 | [] | no_license | package main
import (
`bitbucket.org/kardianos/service/config`
serv `bitbucket.org/kardianos/service/stdservice`
`github.com/kardianos/cron`
`errors`
`fmt`
"io/ioutil"
`net/http`
"os"
"os/exec"
"sync"
)
type UnknownDoErr struct {
Do string
}
func (err *UnknownDoErr) Error() string {
... |
Swift | UTF-8 | 1,770 | 2.9375 | 3 | [
"MIT"
] | permissive | //
// NNFW_UILabel.swift
//
// Created by Saharat Sittipanya on 12/11/2563 BE.
//
import UIKit
extension UILabel {
public func setColorFor(_ text: String, _ color: UIColor, _ font: UIFont?) {
let attributedString: NSMutableAttributedString = NSMutableAttributedString(string: self.text!)
... |
Java | UTF-8 | 2,634 | 2.03125 | 2 | [] | no_license | package com.temobi.ttalk;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
public class NativeSupport {
private static final String TAG = "NativeSupport";
//native basic functions
public native void native_init();
public native void native_destroy();
public native void audioRecordC... |
Java | UTF-8 | 695 | 3.546875 | 4 | [] | no_license |
public class Dog {
public class Food {
private int amount;
public Food(int amount) {
this.amount = amount;
}
public int getAmount() {
return amount;
}
public void hello() {
System.out.println("HelloInner");
}
public void callHello() {
Dog.this.hello();
hello();
System.out.printl... |
Java | UTF-8 | 80 | 1.609375 | 2 | [] | no_license | package oop;
public interface BmwCarInt {
public void navigation();
}
|
Java | UTF-8 | 507 | 2.65625 | 3 | [] | no_license | package com.example.day07;
public class Advanced extends Player {
@Override
public void run() {
// TODO Auto-generated method stub
System.out.println("빨리 달립니다.");
}
@Override
public void jump() {
// TODO Auto-generated method stub
System.out.println("높이 jump합니다.");
System.out.println("높이... |
Java | UTF-8 | 491 | 2.84375 | 3 | [] | no_license |
public enum testEnum {
playerOne("Shea", "Level 1", 22),
monsterOne("Scarebot", "Level 1", 33);
private final String name;
private final String level;
private final int healthPoints;
testEnum(String name, String level, int healthPoints){
this.name = name;
this.level = level;
this.healthPoints = healthP... |
JavaScript | UTF-8 | 5,734 | 3.203125 | 3 | [] | no_license | <!-- 正则验证 start-->
/**
* 判空
*
* @param obj
* @returns {boolean}
*/
function isNull(obj) {
if (obj == null || obj == undefined || obj.trim() == "") {
return true;
}
return false;
}
/**
* 参数长度验证
*
* @param obj
* @param length
* @returns {boolean}
*/
function validLength(obj, length) {
... |
PHP | UTF-8 | 1,410 | 2.578125 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | <?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Surat extends CI_Controller {
/**
* Index Page for this controller.
*
* Maps to the following URL
* http://example.com/index.php/welcome
* - or -
* http://example.com/index.php/welcome/index
* - or -
* Since this controll... |
Python | UTF-8 | 923 | 2.875 | 3 | [] | no_license | import os
class Os:
ret = -1
def system(self, cmd):
ret = -1
ret = os.system(cmd)
# print('system(cmd):', cmd, "ret:", ret)
print('system exec: ' + cmd + ' ret:', ret)
def popen(self, cmd):
ret = os.popen(cmd)
# print('popen(cmd):', cmd, "ret:", ret)
... |
C++ | UTF-8 | 611 | 3.359375 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <iomanip>
using namespace std;
/*
Napisite program u kome cete deklarirati niz od 10 cijelih brojeva koristeci
unaprijed deklariranu konstantu. Niz inicijalizirajte vrijednostima parnih brojeva u
rasponu od 2 do 20. Na kraju program treba ispisati sve vrijednosti niza na ekran.
*/
i... |
Java | UTF-8 | 2,092 | 2.484375 | 2 | [] | no_license | package com.fastcampus.javaallinone.project2.mycontact.repository;
import com.fastcampus.javaallinone.project2.mycontact.domain.Person;
import com.fastcampus.javaallinone.project2.mycontact.domain.dto.Birthday;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.springframework.beans... |
Shell | UTF-8 | 1,458 | 4.375 | 4 | [] | no_license | #!/bin/bash
# ---------------------------------------------------------------------------------------------
# Uses the latest backup taken with the xtrabackup script to create a compressed archive;
# also removes archives older than 10 days
# ----------------------------------------------------------------------------... |
Java | UTF-8 | 1,889 | 2.84375 | 3 | [] | no_license | import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
/**
* Created by Max on 12-10-2017.
*/
public class JDBCCon {
private Connection myConn;
public Connection connect() {
try {
myConn = DriverManager.getConnection("... |
Python | UTF-8 | 2,380 | 3.171875 | 3 | [] | no_license | import pygame
import shapes
def load_tile(filename):
image = pygame.image.load(filename)
rect = image.get_rect()
assert rect.width == 70
assert rect.height == 70
return image
background_filename = './sprites/background.png'
grass_filename = './sprites/grass.png'
grass_mid_filename = './sprites/gra... |
Java | UTF-8 | 4,162 | 2.421875 | 2 | [] | no_license | package com.dantonov.test_task.beanpostprocessor;
import com.dantonov.test_task.annotation.Transaction;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Semaphore;
import org.aopalliance.intercept.MethodInter... |
Ruby | UTF-8 | 172 | 3.46875 | 3 | [] | no_license | class Person
attr_reader :name
def name=(name)
@name = name
end
def to_s
@name
end
end
person1 = Person.new
person1.name = 'Jessica'
puts person1.name
|
JavaScript | UTF-8 | 3,478 | 2.71875 | 3 | [
"MIT"
] | permissive | // Load the http module to create an http server.
var http = require('http');
const util = require('util')
var fs = require('fs');
// console.log(util.inspect(myObject, {showHidden: false, depth: null}))
// alternative shortcut
// console.log(util.inspect(myObject, false, null))
// Configure our HTTP server to respo... |
JavaScript | UTF-8 | 1,771 | 2.6875 | 3 | [] | no_license | import React, { Component } from 'react';
import axios from 'axios';
import './Favts.css'
class Favts extends Component{
constructor(){
super();
this.state={
favts:[],
}
}
componentDidMount(){
axios.get('/buyers/favts')
.then(res => {
... |
Java | UTF-8 | 1,032 | 2.21875 | 2 | [] | no_license | package com.example.duan1maifix.ui.score;
import android.content.Context;
import android.database.Cursor;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CursorAdapter;
import android.widget.TextView;
import com.example.duan1maifix.R;
public class Sc... |
Markdown | UTF-8 | 3,106 | 2.84375 | 3 | [
"Unlicense"
] | permissive |
# L’activité physique au travail n’est pas forcément bonne pour le coeur
Published at: **2019-11-05T10:07:39+00:00**
Author: ****
Original: [Capital.fr](https://www.capital.fr/votre-carriere/lactivite-physique-au-travail-nest-pas-forcement-bonne-pour-le-coeur-1354456)
Une étude menée par l’Inserm en colla... |
Python | UTF-8 | 2,347 | 2.671875 | 3 | [] | no_license | sentence = ""
USERNAME = ""
PASSWORD = ""
def start_logging_keys():
global sentence
import pynput.keyboard
from pynput.keyboard import Key
sentence = ""
def key_press(key):
global sentence
if key == Key.enter:
sentence += '\n'
elif key == Key.caps_lock:
... |
C# | UTF-8 | 1,218 | 2.6875 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ListSharp
{
class IO
{
public static string filename = "", scriptfile = "", currentdir = "";
public static void setScriptFi... |
Java | UTF-8 | 821 | 2.15625 | 2 | [] | no_license | package com.example.demo_code9prj.controler;
import com.example.demo_code9prj.models.Order;
import com.example.demo_code9prj.repository.BookRepository;
import com.example.demo_code9prj.repository.OrderRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotat... |
Swift | UTF-8 | 2,947 | 2.796875 | 3 | [] | no_license | //
// FirstViewController.swift
// lab 1
//
// Created by Ryan Tabler on 2/6/18.
// Copyright © 2018 Ryan Tabler. All rights reserved.
//
import UIKit
class FirstViewController: UIViewController, UIPickerViewDelegate, UIPickerViewDataSource {
@IBOutlet weak var modesPicker: UIPickerView!
@IBOutlet weak ... |
Ruby | UTF-8 | 675 | 2.5625 | 3 | [] | no_license | class YoutubeVideo
require 'httparty'
def self.get id
url = 'https://www.googleapis.com/youtube/v3/videos?part=snippet%2CcontentDetails&key=' + Config.get('google_api_key') + '&id=' + id
response = HTTParty.get url
tmp = JSON.parse response.body
snippet = tmp['items'][0]['snippet']
cont... |
Rust | UTF-8 | 7,822 | 2.75 | 3 | [] | no_license | /// Subscription
///
/// category => problem category
///
struct Subscription {
id: ID,
}
/// CompanyCode
///
/// code => invite code used to sign up
///
struct CompanyCode {
id: ID,
code: String,
}
/// Company
///
/// companies purchase a subscription
///
/// subscription ... |
Java | UTF-8 | 1,517 | 2.328125 | 2 | [
"ECL-2.0"
] | permissive | package edu.uncw.whereami;
import java.util.Date;
import io.objectbox.annotation.Entity;
import io.objectbox.annotation.Id;
@Entity
public class LocationRecording {
@Id
private long id;
private Date timestamp;
private double latitude;
private double longitude;
private double acc;
public... |
Python | UTF-8 | 164 | 3.03125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Aug 29 12:42:15 2019
@author: chen
"""
import copy
a = [0,1,2,3,45,6]
b = a
b = b + [1,1,1,1,1,1]
print(a,'\n')
print(b) |
Python | UTF-8 | 3,666 | 3.171875 | 3 | [] | no_license | import copy
from typing import Generic, Optional, Union
from util.parse import *
from util.tile_map import TileMap
from util.utils import chunk, pairwise
parse_input = compose(
get_ints,
map_func(lambda line: list(chunk(line, 2))),
)
class LazyTileMap(Generic[T]):
"""
A two-dimensional grid of a generic type, w... |
Java | UTF-8 | 48,027 | 1.546875 | 2 | [] | no_license | package com.ca.arcflash.ui.client.backup;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import com.ca.arcflash.ui.client.UIContext;
import com.ca.arcflash.ui.client.backup.advschedule.BackupScheduleTabItem;
import com.ca.arcflash.ui.client.backup.schedule.DailySchedul... |
Java | UTF-8 | 757 | 1.742188 | 2 | [] | no_license | /**
* <copyright>
* </copyright>
*
* $Id$
*/
package metabup.shell.impl;
import metabup.shell.Command;
import metabup.shell.ShellPackage;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.EObjectImpl;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Command</... |
Python | UTF-8 | 1,130 | 3.515625 | 4 | [] | no_license | _range = (165432, 707912)
passwords = [[int(digit) for digit in str(number)] for number in range(_range[0], _range[1])]
print("Passwords count:", len(passwords))
def is_not_descending(password):
for i in range(len(password) - 1):
if password[i] > password[i+1]:
return False
return True
filtered1... |
Markdown | UTF-8 | 1,033 | 3.109375 | 3 | [
"MIT"
] | permissive |
作用域
----------
let声明的变量 旨在 它声明的块或者字块中可用。与var相似,但var尚明的变量的作用域是整个封闭函数。
暂时性死区
----------
let被创建在包含该声明的作用域顶部,一般被成为提升。与通过var声明的初始化值undefined的变量不同,通过let声明的变量知道他们的定义被执行时才初始化。
在变量初始化前访问该变量会导致ReferenceError。该变量处在一个字块顶部到初始化处理的“暂存死区”中。
模仿私有接口
----------
发生在处理构造函数的时候
```
; (global => {
var Fn;
{
let private ... |
Java | UTF-8 | 1,677 | 2.75 | 3 | [] | no_license | package tech.freecode.commonmark.ext.url.accessibility;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
public class ExternalUrlAccessabilityValidator implements UrlAccessibilityValidator {
@Override
public ValidationResult validate(U... |
C++ | UTF-8 | 1,109 | 3.53125 | 4 | [] | no_license | #include<iostream>
using namespace std;
struct SingleNode
{
int data;
SingleNode *next;
};
SingleNode *h;
struct DoubleNode
{
int data;
SingleNode *next;
SingleNode *prev;
};
DoubleNode *head, *tail;
int main()
{
int arr[5] = {1,2,3,4,5};
cout<<"N = 5\n";
cout<<"Static array of size 5\n";
f... |
PHP | UTF-8 | 3,972 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | <?php
/**
* Created by PhpStorm.
* User: Rhilip
* Date: 2019/3/13
* Time: 19:55
*/
namespace Rid\Component;
use Symfony\Component\Translation\Translator;
class I18n
{
/**
* Allowed language
* This is the set of language which is used to limit user languages. No-exist language will not accept.
... |
Swift | UTF-8 | 817 | 3.171875 | 3 | [
"MIT"
] | permissive | //
// ViewController.swift
// Detecting Which Floor the User Is on in a Building
//
// Created by Domenico Solazzo on 17/05/15.
// License MIT
//
import UIKit
import MapKit
import CoreLocation
class ViewController: UIViewController, CLLocationManagerDelegate {
func locationManager(_ manager: CLLocationManage... |
Java | UTF-8 | 7,970 | 2.109375 | 2 | [] | no_license | package limeng.com.findyou.view;
import android.graphics.Color;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import com.google.gson.reflect.TypeToken;
... |
JavaScript | UTF-8 | 2,143 | 2.78125 | 3 | [] | no_license | var cutscene={};
cutscene.active=false;
cutscene.queue=[];
cutscene.update=function() {
if (this.queue.length>0) {
this.queue[0].update();
if (this.queue[0].done) {
this.queue.splice(0,1);
if (this.queue.length==0) {
this.active=false;
}
}... |
Java | UTF-8 | 6,296 | 2.609375 | 3 | [] | no_license | package pl.mazur.simpleabclibrary.utils.pdf;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.springframework.stereotype.Component;
import com.itextpdf.text.BadElementException;
import com... |
C++ | UTF-8 | 996 | 2.71875 | 3 | [] | no_license | /*
* Node.h
*
* Created on: 22 May 2014
* Author: Adam Kosiorek
*/
#ifndef NODE_H_
#define NODE_H_
#include "Movable.h"
#include "typedefs.h"
#include <glm/glm.hpp>
#include <memory>
#include <list>
class IMesh;
class Node : public Movable {
protected:
typedef std::list<NodePtr> NodeList;
public:
Nod... |
C++ | UTF-8 | 12,741 | 2.546875 | 3 | [] | no_license |
#ifndef CHARON_MOLEFRACTION_FUNCTION_IMPL_HPP
#define CHARON_MOLEFRACTION_FUNCTION_IMPL_HPP
#include <algorithm>
#include <iostream>
#include <fstream>
#include <cmath>
#include "Teuchos_ParameterList.hpp"
#include "Teuchos_Assert.hpp"
#include "Teuchos_TestForException.hpp"
#include "Panzer_Workset.hpp"
#include "Pa... |
Python | UTF-8 | 1,977 | 2.625 | 3 | [] | no_license | HORIZONTAL_S_BOX = [11, 5, 4, 15, 12, 6, 9, 0, 13, 3, 14, 8, 1, 10, 2, 7]
HORIZONTAL_S_BOX256 = []
for byte in range(256):
HORIZONTAL_S_BOX256.append((HORIZONTAL_S_BOX[byte >> 4] << 4) | HORIZONTAL_S_BOX[byte & 15])
HORIZONTAL_INVERSE_S_BOX256 = [0] * 256
for index in range(256):
HORIZONTAL_INVER... |
Python | UTF-8 | 416 | 4.15625 | 4 | [] | no_license | def sqrt(x):
"""
Purpose:
Approximate the square root of a given number, x.
Pre-conditions:
x: A non-negative number
Post-conditions:
(none)
Return:
a number y such that y*y is close to x.
Note: if x is negative, the value None is returned
"""
if x < 0:
return None
else:
... |
Java | UTF-8 | 204 | 2.046875 | 2 | [] | no_license | package nogi;
public class ZetonSmoka
{
private int wartosc;
public ZetonSmoka(int wartosc)
{
this.wartosc = wartosc;
}
public int zwrocWartosc()
{
return wartosc;
}
}
|
Python | UTF-8 | 468 | 3.5625 | 4 | [] | no_license | # File: CornerFiveBeepers.py
# -----------------------------
# Places five beepers in each corner
from karel.stanfordkarel import *
def main():
# Repeat once for each corner
for i in range(4):
put_five_beepers()
move_to_next_corner()
# reposition karel to the next corner
def move_to_next_corner() :... |
Java | UTF-8 | 3,959 | 2.828125 | 3 | [] | no_license | package br.dengue.dao;
//import java.sql.Connection;
import br.dengue.modelo.User;
import java.sql.*;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
public class UserDAO {
private Connection connection;
public UserDAO() throws ClassNotFoundException {
thi... |
PHP | UTF-8 | 2,365 | 2.859375 | 3 | [
"MIT"
] | permissive | <?php
namespace hsm;
class reg{
static private $result=array('get'=>array(),'any'=>array(),'post'=>array()); //存储路由结果
static private $pi; // PATH_INFO
static function get($url_preg,$action){
$result_count = count(@self::$result['get']);
self::$result['get'][$result_count][] = $... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.