language stringclasses 15
values | src_encoding stringclasses 34
values | length_bytes int64 6 7.85M | score float64 1.5 5.69 | int_score int64 2 5 | detected_licenses listlengths 0 160 | license_type stringclasses 2
values | text stringlengths 9 7.85M |
|---|---|---|---|---|---|---|---|
Markdown | UTF-8 | 1,089 | 2.53125 | 3 | [
"MIT"
] | permissive | # Templates
[](https://twitter.com/fromkk)
[](https://developer.apple.com/swift/)

[![G... |
Python | UTF-8 | 480 | 3.625 | 4 | [] | no_license | #!/usr/bin/env python
import pygame
#player ship
"""
def draw_player(surf, color):
rect = surf.get_rect() #what does this do?
d = min(rect.width, rect.height)
pygame.draw.rect(surf, color, (0,0, (d/8), rect.height))
"""
def draw_player(surf, x, y):
YELLOW = (255,255,0) #yellow
rect = surf.g... |
Python | UTF-8 | 1,128 | 3.484375 | 3 | [] | no_license | #!/usr/bin/env python3
import sys
class Solution:
def max_profit(self, prices):
"""
:type prices: List[int]
:rtype: int
超时
"""
maximum = 0
indexes = [i for i in range(len(prices))]
pri_ind = zip(prices, indexes)
sorted_prices = sorted(pri_in... |
C# | UTF-8 | 2,602 | 2.515625 | 3 | [
"MIT"
] | permissive | #nullable enable
using Cybtans.Proto.AST;
using Cybtans.Proto.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace Cybtans.Proto.Generators.CSharp
{
public class MessageClassInfo
{
readonly MessageDeclaration _msg;
readonly ... |
Markdown | UTF-8 | 4,985 | 2.78125 | 3 | [
"MIT"
] | permissive | ---
layout: post
title: Ubiquity command Say
tags: ubiquity
---
So It's being a long time I haven't posted anything and bla bla bla... (Not
going to go on with this useless text). Finally I managed to work on something
interesting and think it makes sense to blog about it...
So the topic will be another Ub... |
C++ | UTF-8 | 324 | 2.5625 | 3 | [] | no_license | #include "ReplayViewer.h"
#include <iostream>
using namespace std;
int main(int argc, char** argv)
{
const char* title = "Artificial Life Replay Viewer";
int width = 1100;
int height = 800;
ReplayViewer application;
if (!application.Initialize(title, width, height))
return 1;
application.Run();
return 0... |
C# | UTF-8 | 1,079 | 2.765625 | 3 | [] | no_license | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Linq;
public class WindowSystem : MonoBehaviour
{
#region public methods
public void ShowWindow(string windowId)
{
WindowUI targetWindow = GetWindow(windowId);
ShowWindow(targetWindow);
}
pu... |
Python | UTF-8 | 4,428 | 2.859375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Apr 16 08:13:25 2020
@author: Administrator
The generic Sliding Window algorithm
Algorithm Seg_TS = Sliding_Window(T, max_error)
anchor = 1;
while not finished segmenting time series
i = 2;
while caculate_error(T[anchor: anchor + i]) < max_error
i = i + 1;
e... |
C++ | UTF-8 | 386 | 3.390625 | 3 | [] | no_license | /*
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
*/
class Solution {
public:
bool isPalindrome(int x) {
if (x < 0){
return false;
}
int a = 0, y = x;
while (x > 0) {
a = a * 10 + x % 10;... |
C++ | UTF-8 | 14,808 | 2.53125 | 3 | [
"BSD-2-Clause"
] | permissive | #ifndef CHARGE_COMMON_NODE_LABEL_CONTAINER_HPP
#define CHARGE_COMMON_NODE_LABEL_CONTAINER_HPP
#include "common/adapter_iter.hpp"
#include "common/constants.hpp"
#include "common/function_graph.hpp"
#include "common/interpolating_function.hpp"
#include "common/linear_function.hpp"
#include "common/piecewise_function.hp... |
Java | UTF-8 | 29,300 | 1.796875 | 2 | [] | no_license | package unsw.dungeon.DungeonBuilder;
import java.io.File;
import java.io.FileNotFoundException;
import java.awt.AWTException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import javafx.application.Application;
import javafx.applica... |
Java | UTF-8 | 479 | 2.375 | 2 | [] | no_license | package lessonFiles;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.io.File;
public class Main {
public static void main(String[] args) {
Path path = Paths.get("taskTreeSer.txt");
File file = new File("G:\\Ira_student/", "Hello.txt");
System.out.println("hello" + file.... |
C | UTF-8 | 353 | 3.625 | 4 | [] | no_license | /*
Hailstone sequence
*/
#include <stdio.h>
void hailstone()
{
int ch;
printf("Enter a non-zero natural number: ");
scanf("%d",&ch);
if(ch <= 0) {
printf("Invalid input.\n");
return;
}
while(ch != 1)
{
printf("%d, ",ch);
if(ch%2 == 1)
ch = 3*ch + 1;
else
ch /= 2;
}
printf("1\n");
}
int mai... |
Markdown | UTF-8 | 1,407 | 2.84375 | 3 | [
"MIT"
] | permissive | ---
id: Dominate Monster
title: 支配怪物Dominate Monster
---
**8 环**
附魔
施法时间:1 动作
施法距离:60 尺
法术成分:V、S
持续时间:专注,至多 1 小时
你试图安抚一个施法距离内你能看见的生物,必须成功通过一次感知豁免,否则将在法术持续时间内被你魅惑。若它正与你或你的友方生物战斗,则其进行该豁免时具有优势。
该生物被魅惑时,只要你与其处于同一位面就可以与之保持心灵感应。你在有意识时,可以通过心灵感应命令该生物(不需要作动作),而它则会尽量服从。你可以描述一个简单具体的行为指令,比如“攻击那个生物”“跑到那个位置”或是“去拿那个物品”。生物完... |
C | UTF-8 | 1,004 | 3.578125 | 4 | [
"MIT"
] | permissive | #include <stdio.h>
double leia_numero(char *msg) {
int i =0; double num = 0;
// printf("%c - %d - %s\n", msg[i], msg[i], msg);
while(msg[i]!=0 && msg[i] > '0' && msg[i] < '9'){
num = num*10; num = num + msg[i] - 48; i++;
}
if ((msg[i] < '0' || msg[i] > '9') && msg[i]!=0){
//... |
C++ | UTF-8 | 334 | 2.765625 | 3 | [] | no_license | class Solution {
public:
int jump(vector<int>& nums) {
int cnt=0;
for(int i=nums.size()-1;i>0;){
for(int j=0;j<i;j++){
if(nums[j]>=i-j){
cnt++;
i=j;
break;
}
}
}
return... |
Java | UTF-8 | 2,588 | 3.671875 | 4 | [] | no_license | package usta.sistemas;
import java.util.Random;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
/*Author: Andres Nicolas Morales Perez
Date: 2020 - April - 27
Description: program that, Using repetitive cycles build a program that prints the multiplicat... |
C# | UTF-8 | 394 | 2.671875 | 3 | [] | no_license | using System;
using System.Net;
namespace Pokemon.Models
{
public class ApiException : Exception
{
public string ErrorMessage { get; set; }
public HttpStatusCode ErrorCode { get; set; }
public ApiException(HttpStatusCode code, string errorMessage)
{
this.ErrorCode ... |
C# | UTF-8 | 692 | 3.078125 | 3 | [] | no_license | private static Task<bool> CreateTask(CancellationTokenSource cts)
{
return Task.Run(async () =>
{
var result = await TaskAction(cts.Token);
// If result is false, cancel all tasks
if (!result)
cts.Cancel();
return result;
});
}
private static async Task<bool> TaskAction(C... |
C++ | UTF-8 | 562 | 2.875 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std ;
vector<vector<int> > adj ;
vector<bool> visited(1000) ;
void BFS(int n){
queue<int> q ;
visited[n] = true ;
q.push(n) ;
while(!q.empty()){
int node = q.front() ;
cout<< node << " " ;
q.pop() ;
for(int i=0; i<adj[node].size(... |
TypeScript | UTF-8 | 582 | 3 | 3 | [] | no_license | export const stripTrailingSlash = (str: string) => {
return str.endsWith('/') ? str.slice(0, -1) : str
}
export const getBasicAuthString = (username: string, password: string) => {
const token = username + ':' + password
const hash = Buffer.from(token).toString('base64')
return 'Basic ' + hash
}
export const ... |
Ruby | UTF-8 | 474 | 3 | 3 | [] | no_license | class Complement
def self.of_dna(s)
ns = ''
for i in 0...s.length
case s[i]
when 'G' then ns+='C'
when 'C' then ns+='G'
when 'T' then ns+='A'
when 'A' then ns+='U'
end
end
ns
end
def self.of_rna(s)
ns = ''
for i in 0...s.length
case s[i]
... |
Java | UTF-8 | 522 | 2.40625 | 2 | [
"MIT"
] | permissive | package net.openid.conformance.variant;
@VariantParameter(
name = "sender_constrain",
displayName = "Sender Constraining",
description = "The method to use to sender constrain access tokens. FAPI2 allows the use of MTLS or DPoP as proof-of-possession methods, select the one you support. MTLS was the mechanism used ... |
JavaScript | UTF-8 | 8,638 | 3.25 | 3 | [] | no_license | let canvas = document.getElementById('canvas')
let ctx = canvas.getContext('2d')
let snakeWidth = 20
let snake = [{x: 0, y: snakeWidth}, {x: snakeWidth, y: snakeWidth}, {x: snakeWidth * 2, y: snakeWidth}]
let snakeMaxLen = 1000
let head = 2
let len = 3
let directions = [[0, -1], [0, 1], [-1, 0], [1, 0]]
let direction =... |
Markdown | UTF-8 | 4,391 | 3.390625 | 3 | [] | no_license | # Observer パターン
## 課題
高度に統合されたシステムをつくりたい。システムの各部分が、システム全体の状態についての関心や知識を持つといったものだ。またメンテナンスしやすいようにしたい。そのためにクラス同士の密結合は避けるべきだ。
## 解決策
別のコンポーネント (subjectコンポーネント) の挙動を知っているコンポーネント (observerコンポーネント) がほしい場合、単純に両方のクラスを強固に繋ぎ合わせて、subjectコンポーネントの挙動をobserverコンポーネントに知らせることはできる。つまりsubjectコンポーネントをつくるときにobserverコンポーネントの参照を渡し、subjectコ... |
PHP | UTF-8 | 4,202 | 2.921875 | 3 | [] | no_license | <?php
class MenyNgPlaceWebsiteAlgorithmParser extends NgPlaceWebsiteAlgorithmParser
{
// VARIABLES
private static $REGEX_HOURS_WEEKDAYS = '/Hverdager/i';
private static $REGEX_HOURS_STAURDAY = '/Lørdag/i';
private static $REGEX_HOURS_SUNDAY = '/Søndag/i';
private static $REGEX_HOURS_HO... |
C++ | UTF-8 | 1,407 | 3.125 | 3 | [] | no_license |
#include "move.hpp"
Move::Move(int start, int end)
: start_(start)
, end_(end)
{
}
Move::Move(int start, int end, int eatIdx)
: start_(start)
, end_(end)
{
eatIdxs_.push_back(eatIdx);
}
Move::Move(Move move, int end, int eatIdx)
: start_(move.start_)
, end_(end)
, eatIdxs_(move.eatI... |
C++ | UTF-8 | 1,720 | 3.25 | 3 | [] | no_license | #include "pieces.h"
Pieces::~Pieces(){LegalMoves.clear();}
Pieces::Pieces(Board *theBoard, bool White, Position Location): theBoard{theBoard},
White{White},
Location{Location},
LegalMoves{},
Protected{false},
Pinned{nullptr},
... |
C# | UTF-8 | 5,428 | 2.53125 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace SlideShow
{
public partial class FrmMain : Form
... |
Python | UTF-8 | 11,308 | 2.640625 | 3 | [] | no_license | # Python bytecode 2.7 (decompiled from Python 2.7)
# Embedded file name: scripts/common/Lib/email/_parseaddr.py
__all__ = ['mktime_tz',
'parsedate',
'parsedate_tz',
'quote']
import time, calendar
SPACE = ' '
EMPTYSTRING = ''
COMMASPACE = ', '
_monthnames = ['jan',
'feb',
'mar',
'apr',
'may',
'jun',
'jul',
'au... |
Python | UTF-8 | 1,505 | 3.8125 | 4 | [] | no_license | '''
Online Python Compiler.
Code, Compile, Run and Debug python program online.
Write your code in this editor and press "Run" button to execute it.
'''
class Stack:
def __init__(self):
self.items = []
self.length = 0
def push(self, val):
... |
Java | UTF-8 | 470 | 2.15625 | 2 | [] | no_license | package com.m2i.poe;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class TBmardi {
// public static void main(String[] args) {
// public static void main (String[]args){
//
// ArrayList<Integer> 1 = new ArrayList<Integer>();
// l.add(1);
// ... |
PHP | UTF-8 | 1,510 | 2.671875 | 3 | [
"MIT"
] | permissive | <?php
namespace PHPDataGen\Node;
class File extends \PHPDataGen\Node
{
use \PHPDataGen\DataClassTrait;
private const FIELDS = ['namespace' => 'Namespace', 'uses' => 'Uses', 'class' => 'Class'];
private $namespace = null;
private $uses = [];
private $class = null;
public function __construct(ar... |
SQL | UTF-8 | 2,000 | 2.75 | 3 | [] | no_license | --Datos departamentos
insert into departamento (nombre)
values ('Artigas');
insert into departamento (nombre)
values ('Canelones');
insert into departamento (nombre)
values ('Cerro Largo');
insert into departamento (nombre)
values ('Colonia');
insert into departamento (nombre)
values ('Durazno');
insert into departamen... |
Markdown | UTF-8 | 1,378 | 2.6875 | 3 | [] | no_license | How to get started
===========
A spawned cloud instance should close itself at 6:30PM everyday, this is for your own sake to stop you burning out!
Any vagrant up executions past that time require a 'sudo shutdown -H now' inside the instance before you finish your session.
^^^ This is your first given responsibility.
... |
Markdown | UTF-8 | 10,139 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | ---
layout: post101
title: Synchronous Replication
categories: XAP101ADM
parent: replication.html
weight: 200
---
{% summary %} {% endsummary %}
In a synchronous replication, the client receives acknowledgement for any replicated operations only after all the space instances in the replication group ha... |
Java | UTF-8 | 4,803 | 2.390625 | 2 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference",
"MIT",
"Apache-2.0"
] | permissive | /*
* Tencent is pleased to support the open source community by making Angel available.
*
* Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
*
* Licensed under the BSD 3-Clause License (the "License"); you may not use this file except in
* compliance with the License. You may obtain a... |
Markdown | UTF-8 | 3,619 | 2.875 | 3 | [] | no_license | # Текст 49
असक्तबुद्धिः सर्वत्र जितात्मा विगतस्पृहः ।
नैष्कर्म्यसिद्धिं परमां संन्यासेनाधिगच्छति ॥४९॥
асакта-буддхит̣ сарватра
джита̄тма̄ вигата-спр̣хат̣
наишкармйа-сиддхим̇ парама̄м̇
саннйа̄сена̄дхигаччхати
_асакта-буддхит̣_ — тот, чей разум свободен от привязанностей; _сарватра_ — везде; _джита-а̄тма̄_ — т... |
SQL | UTF-8 | 1,008 | 4.375 | 4 | [] | no_license | -- Q1
SELECT CASE WHEN COUNT(*) = (SELECT COUNT(*) FROM tbl_A)
AND COUNT(*) = (SELECT COUNT(*) FROM tbl_B)
THEN '相等' ELSE '不相等' END AS result
FROM (SELECT * FROM tbl_A
UNION
SELECT * FROM tbl_B) TMP;
-- Q2
SELECT DISTINCT emp
FROM EmpSkills ES1
WHERE NOT EXISTS (SELECT skill
... |
C++ | UTF-8 | 454 | 3.578125 | 4 | [] | no_license | // Book: C++ Primer Plus
// Chapter: 5
// Exercise: 2
#include <iostream>
#include <array>
const unsigned int arraySize = 101;
int main(void) {
std::array<long double, arraySize> factorials {{1.0, 1.0, 0.0}};
for (unsigned int i = 2; i < arraySize; ++i) {
factorials.at(i) = i * factorials.at(i - 1)... |
C# | UTF-8 | 2,182 | 2.546875 | 3 | [] | no_license | using System.Collections;
using System.Collections.Generic;
using System;
using System.Runtime.Serialization.Formatters.Binary;
using UnityEngine;
using System.IO;
public class SavedProgression : MonoBehaviour {
private string filePath = "";
public Setting setting;
private Dictionary<string,... |
C++ | UTF-8 | 3,047 | 3.625 | 4 | [] | no_license | // 21. Modify the program from exercise 19 so that when you enter an integer, the program will output all the names with
// that score or score not found.
#include "std_lib_facilities.h"
#include <string>
bool is_int(string str, int base = 0) { // if base == 0, base is auto-detected
size_t pos = 0 ;
try {
... |
Java | UTF-8 | 186 | 1.679688 | 2 | [] | no_license | package cc.messcat.service.system;
import cc.messcat.vo.AdvertisementVo;
public interface AdvertisementManagerDao {
public abstract AdvertisementVo getAdvertisement(int paramInt);
}
|
C# | UTF-8 | 2,146 | 3.296875 | 3 | [] | no_license | using System;
namespace estruturasDeDados.estruturas
{
public class ListaDupla
{
Posicao cabeça;
int tamanho = 0;
private void checaLista(int posicao)
{
if (this.tamanho < posicao)
{
throw new InvalidOperationException("Posicao não dispon... |
PHP | UTF-8 | 4,219 | 2.75 | 3 | [] | no_license | <?php
namespace autoPushWebsite;
include_once "Db.php";
include_once "Helper.php";
use swoole_process;
class Robot
{
//CPU核心数目
public $workerMaxNum = 32;
public $works = [];
public $masterPid;
public $urls = [];
public $engines = [];
public $engineIndex = 0;
//构造函数
public functio... |
Python | UTF-8 | 332 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import web
def jsonify(*args, **kwargs):
"""Dumps input arguments into a JSON object.
Note that the 'Content-Type' header is automatically set to JSON.
"""
web.header('Content-Type', 'application/json')
return json.dumps(dict(*args,... |
Markdown | UTF-8 | 1,138 | 3.21875 | 3 | [] | no_license | # ***\#aggressive*** adj
英音 ə'ɡresɪv
英音
<audio src="./media/aggressive-B.aac" controls="controls"></audio>
美音 ə'ɡresɪv
美音
<audio src="./media/aggressive.aac" controls="controls"></audio>
| 词频 3 | 口语 1 | 阅读 2 |
英文释义
---
### 1.*高义频:* **好斗的;侵略性的;攻击性的:**
> aggressive behaviour
> 攻击性行为
> Every cultur... |
Java | UTF-8 | 1,745 | 2.453125 | 2 | [] | no_license | package io.egen.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import io.egen.entity.Customer;
import io.egen.exception.CustomerAlreadyExistsException;
impor... |
Go | UTF-8 | 374 | 2.671875 | 3 | [] | no_license | package database
import (
"database/sql"
"fmt"
"github.com/go-sql-driver/mysql"
)
var DB *sql.DB
func Connect() {
cfg := mysql.Config{
User: "debian-sys-maint",
Passwd: "YZkKRHnDn0I8XsvK",
Net: "tcp",
DBName: "test",
}
db, err := sql.Open("mysql", cfg.FormatDSN())
DB = db
fmt.Println("Databa... |
Python | UTF-8 | 7,712 | 2.90625 | 3 | [] | no_license | ### EDF --- An Autograd Engine for instruction
## (based on joint discussions with David McAllester)
import numpy as np
from numpy import newaxis
# Global list of different kinds of components
ops = []
params = []
values = []
# Global forward
def Forward():
for c in ops: c.forward()
# Global backward
def Ba... |
Markdown | UTF-8 | 1,052 | 2.515625 | 3 | [] | no_license | # ubuntu-debian
## How to autoupdate ubuntu&debian
### Install the required packages
apt-get install unattended-upgrades apt-listchanges
#### Put the lines below into the configuration file /etc/apt/apt.conf.d/50unattended-upgrades,
#### everything that was originally inside the generated file can be removed b... |
Java | UTF-8 | 2,682 | 2.609375 | 3 | [] | no_license | package edu.rosehulman.rafinder.model;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import edu.rosehulman.rafinder.R;
import edu.rosehulman.rafinder.UserType;
import edu.rosehulman.rafinder.controller.HomeFragment;
import edu.rosehulman.rafinder.model.person.Employee;
/**
* Model... |
C++ | UTF-8 | 646 | 3.0625 | 3 | [
"BSD-2-Clause"
] | permissive | #include "Anim.hpp"
// Par défaut
Anim::Anim()
{
}
// déstructeur
Anim::~Anim()
{
}
// Par copie
Anim::Anim(const Anim& Cpy)
{
myFrame = Cpy.myFrame;
}
// Ajouter une frame
void Anim::PushFrame(const Frame& NewFrame)
{
myFrame.push_back(NewFrame);
}
// Nombre de frame(s)
size_t Anim::Size() const
{
r... |
Java | UTF-8 | 1,753 | 2.703125 | 3 | [] | no_license | package org.optimization.service.model.validation;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.function.Predicate;
import org.optimization.service.model.Problem;
import org.optimization.service.model.validation.ProblemValidator.Issue;
/** Validates if problem is corr... |
C# | UTF-8 | 1,963 | 2.765625 | 3 | [] | no_license |
using Atom.Api.Application.Interfaces;
using LazZiya.ImageResize;
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Hosting;
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Threading.Tasks;
namespace Atom.Api.Application.Utilities
{
public class ... |
Java | UTF-8 | 1,079 | 3.34375 | 3 | [] | no_license | package com.it.api;
/**
* @author LY
* @PackageName:com.it.api
* @ClassName:TopoLogical
* @date 2021/6/1 10:47
* 类说明: <br>
*/
public class TopoLogical {
/**顶点的拓扑排序*/
private Stack<Integer> order;
/**
* 功能说明:构造拓扑排序对象
* @Param [G]
*/
public TopoLogical(Digraph G) {
//创建检测环对... |
Java | UTF-8 | 447 | 1.929688 | 2 | [] | no_license | package com.prospect.druid.mapper;
import com.prospect.druid.bean.db.Account;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author: ant
* @Date: 2021/11/9 2:07 下午
*/
@Mapper
public interface AccountMapper {
/**
* 保存
* @param record 账户
* @return
*/
int inse... |
Python | UTF-8 | 970 | 4.34375 | 4 | [] | no_license | '''
Create a program that:
Contains information on currency conversion rates from USD to four other currencies
User can enter in an amount in USD and the currency they want to convert it into
The programme then outputs the amount in the new currency
'''
print('This is a Currency Converter')
country_currency={'Philippin... |
JavaScript | UTF-8 | 1,838 | 2.65625 | 3 | [
"MIT"
] | permissive | import axios from 'axios';
let axiosOpts = {
headers: {
'Content-Type': 'application/json; charset=utf-8'
}
};
export class Result {
data;
errors;
get hasErrors() {
return this.errors !== null && Array.isArray(this.errors) && this.errors.length > 0;
}
constructor(data, ...errors) {
this.d... |
C# | UTF-8 | 1,553 | 2.84375 | 3 | [] | no_license | <Query Kind="Program">
<Namespace>System.Security.Cryptography</Namespace>
</Query>
void Main()
{
var dictStrings = File.ReadLines(@"C:\Users\and\Downloads\wordlist.txt")
// .Take(10)
.Select(x => CalculateMD5Hash(x))
// .Dump()
;
var lookupString = "AAAAAAAAAAAAAAAAAAAAAAAAASAA... |
Java | UTF-8 | 427 | 2.21875 | 2 | [] | no_license | package uk.me.conradscott.maths;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public interface PointIfc {
int x();
int y();
@NotNull
PointIfc plus( int dx, int dy );
@NotNull
PointIfc plus( @NotNull PointIfc point );
@NotNull
PointIfc minus( int x, int y );
... |
Java | UTF-8 | 147 | 1.640625 | 2 | [] | no_license | package com.huaxin.regexp;
/**
* Created by Administrator on 2016/5/6.
*/
public interface ExpFetcher {
public String parse(String str);
}
|
C# | UTF-8 | 477 | 2.546875 | 3 | [] | no_license | using System.Text.RegularExpressions;
namespace StoicDreams.FileProxy.Filter
{
public static class Filters
{
public static readonly Regex RemoveFromPath = new Regex(@"[A-Za-z]+\:\/\/[^\/]+", RegexOptions.IgnoreCase & RegexOptions.Singleline);
public static string FilterURLToRoutePath(this string input)
{
s... |
Python | UTF-8 | 473 | 3.171875 | 3 | [] | no_license |
exam_results = [21, 11, 4, 96, 48, 5, 13, 64, 28, 33, 43, 20, 70, 24, 88, 57, 31, 9, 35, 47, 56, 45, 14, 74, 35, 6, 79, 62, 17, 83, 5, 8, 44, 56, 60, 47, 17, 23, 96, 66, 17, 43, 7, 21, 18, 100, 30, 8, 15, 15]
new_results = []
for n in exam_results:
if n >= 50:
new_results.append(n)
print new_results
# ... |
Java | UTF-8 | 1,391 | 3.4375 | 3 | [] | no_license | package aptech;
import java.util.ArrayList;
import java.util.Scanner;
public class PersonManager {
private ArrayList<Person> persons = new ArrayList<>();
Scanner getScanner() {
return new Scanner(System.in);
}
public void setPersons() throws Exception{
System.out.println("En... |
C | UTF-8 | 696 | 4.03125 | 4 | [] | no_license | /* 编写程序实现从键盘读入文件名,计算该文件的行数(换行符的个数)并显示在界面上。
*/
#include <stdio.h>
#include <stdlib.h>
#ifdef FILENAME_MAX
#undef FILENAME_MAX
#endif
#define FILENAME_MAX 1024
int main() {
char fname[FILENAME_MAX];
printf("输入文件名:");
scanf("%s", fname);
FILE* fp = fopen(fname, "r");
if (NULL == fp) {
prin... |
Python | UTF-8 | 913 | 3.96875 | 4 | [] | no_license | class Node(object):
def __init__(self, val):
self.val = val
self.left = None
self.right = None
def __repr__(self):
# string representation
return self.val
def deepest(node):
if not node:
return
levels = find_height(node)
deepest_(node, levels)
... |
Java | UTF-8 | 1,928 | 2.78125 | 3 | [
"Apache-2.0"
] | permissive | package com.example.morro.FastBuyApp.UI;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.helper.ItemTouchHelper;
import android.support.v7.widget.helper.ItemTouchHelper.Callback;
/**
* Handle the gestures by calling adapter's ActionCompletionContract methods
*/
public class SwipeAndD... |
JavaScript | UTF-8 | 4,225 | 2.65625 | 3 | [] | no_license | const initialState = {
item: [],
postsLoading: false,
};
export const postsReducer = (state = initialState, action) => {
switch (action.type) {
case 'get/posts/start':
return {
postsLoading: true,
};
case 'get/posts/successes':
return {
postsLoading: false,
item:... |
Python | UTF-8 | 1,062 | 2.953125 | 3 | [] | no_license | #!/usr/bin/env python
#coding:utf-8
import wx
class MyWindow(wx.Frame):
def __init__(self, parent=None, id=-1, title=None):
wx.Frame.__init__(self, parent, id, title)
self.panel = wx.Panel(self, size=(300, 200))
self.panel.SetBackgroundColour('WHITE')
font = wx.Font(60, wx.FONTFA... |
Java | UTF-8 | 866 | 3.90625 | 4 | [] | no_license | package com.cheneyin.design.mode.iterator;
/**
* @ClassName: Main
* @Description: ToDo
* @Author: CheneyIn
* @Date: 2019-12-23
*/
public class Main {
public static void main(String[] args) {
/* 先初始化来一个存放书的书架 */
BookShelf bookShelf = new BookShelf(4);
bookShelf.appendBook(new Book("firs... |
Java | UTF-8 | 1,650 | 1.789063 | 2 | [] | no_license | package com.appleframework.ras.api;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.gitee.easyopen.ApiConfig;
import com.gitee.easyopen.AppSecretManager;
import com.gitee.easyopen.support.ApiController;
/**... |
Java | UTF-8 | 990 | 2.59375 | 3 | [] | no_license | package com.example.demo.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.example.demo.model.Company;
import com.example.demo.repository.CompanyRepository;
import com.example.exceptions.CompanyException;
@Service("companyService")
publi... |
Python | UTF-8 | 243 | 3.5625 | 4 | [] | no_license | def findelem(word,litter):
output=[]
for i,j in enumerate(word):
if litter == j:
output.append(i)
return output
# word=input('input the word ')
# litter=input('input the litter ')
# print(findelem(word,litter)) |
JavaScript | UTF-8 | 378 | 4.03125 | 4 | [] | no_license | let num = [5,4,8]
console.log (`Nosso vetor é o ${num}`)
num.push(1)
console.log (`Nosso vetor é o ${num}`)
// comprimento do vetor :
let tamanho = num.length
console.log (`Nosso vetor é o ${num} e possui ${tamanho} elemento(s)`)
// ordenação de vetor
let numordenado = num.sort()
console.log (`Nosso vetor é o ${num... |
Markdown | UTF-8 | 4,578 | 3.265625 | 3 | [] | no_license | > 최초작성 : 2021.02.07
## ******Level2 - 위장**** (java/kotlin)**
[코딩테스트 연습 - 위장](https://programmers.co.kr/learn/courses/30/lessons/42578)
| **문제 설명** |
| --- |
| 스파이들은 매일 다른 옷을 조합하여 입어 자신을 위장합니다.<br>예를 들어 스파이가 가진 옷이 아래와 같고 오늘 스파이가 동그란 안경, 긴 코트, 파란색 티셔츠를 입었다면 다음날은 청바지를 추가로 입거나 동그란 안경 대신 검정 선글라스를 착용하거나 해야 합니다.|
| **종... |
C++ | UTF-8 | 549 | 3.421875 | 3 | [] | no_license | #include<iostream>
using namespace std;
template<typename T>
T Max(T a,T b)
{
return (a > b) ? a : b;
}
bool isAnagram(string s1,string s2)
{
int n = s1.length();
if(n!=s2.length())
return false;
int count[26] = {0};
for(int i = 0;i<n;i++)
{
count[s1[i]-'a']++;
count[s2[i]-'a']--;
}
for(int i ... |
Markdown | UTF-8 | 4,138 | 2.9375 | 3 | [
"MIT"
] | permissive | ---
layout: post
title: 애니메이션 구현에 CSS가 자바스크립트보다 더 좋은 이유
categories: JavaScript
---
브라우저에서 하나의 애니메이션 프레임을 처리한다는 것은 애니메이션 구현에 필요한 모든 계산 과정과 계산을 통해 얻어진 픽셀 자리를 업데이트 하는 것까지 포함합니다. 버벅이지 않는 애니메이션을 보려면 프레임별 렌더링이 문제없이 잘 이루어져야합니다. 애니메이션을 어떻게 적용하느냐에 따라 렌더링성능은 달라지게 되고 자연스럽지 못한 애니메이션을 경험하게 될지도 모릅니다. 특히 자바스크립트보다 CSS로 애니메이션을 적용하는것이 ... |
Python | UTF-8 | 1,703 | 2.984375 | 3 | [
"MIT"
] | permissive | import numpy as np
MAX_MOVING_AVG_LEN = 10
class predict:
def __init__(self, trend_block):
self.data = []
self.trend_block = trend_block
def push_data(self, price):
self.data.append(price)
def _cal_moving_avg(self, day):
total = 0
for index in range(MAX_MOVING_AVG_LEN):
if ((day ... |
Java | UTF-8 | 1,987 | 2.0625 | 2 | [] | no_license | package com.winxuan.ec.admin.controller.order;
import java.util.Date;
import com.winxuan.ec.model.area.Area;
/**
* 订单发货报表-FORM
* @author heyadong
* @version 1.0, 2012-8-9 下午03:24:20
*/
public class OrderDeliveryReportForm {
private Long[] channels;
private Area[] areas;
private String orders;
pr... |
C++ | UTF-8 | 1,716 | 2.578125 | 3 | [] | no_license | /***************************************************
file: Scheduler.h
class: CPTR 352 - OS Design
purpose: Provide the class to represent the
CPU scheduler.
creators: Howard Heaton & Blake Kruppa
date: June 2016
**********************************************... |
Java | UTF-8 | 386 | 2.015625 | 2 | [] | no_license | package com.nt.test;
import com.nt.comps.Flipkart;
import com.nt.factory.FlipkartFactory;
public class StrategyDPtest {
public static void main(String[] args) {
Flipkart fpkt=null;
fpkt=FlipkartFactory.getInstant("EcomExp");
System.out.println(fpkt.getInstant(new String[] {"Tv","Refrigetor","Was... |
Python | UTF-8 | 4,550 | 2.78125 | 3 | [
"MIT"
] | permissive | import os
import sys
from pathlib import Path
from sys import stderr
from typing import Any, Optional, Tuple
import numpy as np
from numba import jit
from numpy import float64 as f64
from numpy import ndarray
class ConvergenceError(Exception):
def __init__(self, *args: object) -> None:
super().__init__(*... |
Java | UTF-8 | 1,726 | 3.21875 | 3 | [] | no_license | /**
* Project: A00973569Lab2
* File: PlayerReport.java
* Date: May 2, 2016
* Time: 9:16:26 PM
*/
package a00973569.lab2.report;
import a00973569.lab2.data.Player;
/**
* PlayerReport class prints out Player details in a certain
* format and spaces out each column to align with the headers
*
* @author Ronnie ... |
Python | UTF-8 | 2,040 | 2.515625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Oct 9 12:38:22 2020
@author: Fabian
"""
import uuid
import csv
from LatLon23 import LatLon, Longitude, Latitude, string2latlon
import pyproj
with open('file.xml', 'w') as f:
print("<?xml version=\"1.0\"?>\n<FSData version=\"9.0\">", file=f)
f.close()
with ... |
Ruby | UTF-8 | 414 | 3.46875 | 3 | [] | no_license |
# raw_data = $stdin.readlines().map { |data| data.chomp.to_i }
# number_of_test_case = raw_data[0]
# test_cases = raw_data[1..-1]
def add_digits(number)
total = 0
number.to_s.split("").each do |n|
total += n.to_i
end
if total.to_s.length > 1
div_by_3(@total)
end
total
end
def div_... |
Markdown | UTF-8 | 4,706 | 3.265625 | 3 | [] | no_license | # Instructions for the Re-Exam
To pass the course, you have to prepare a software project and a written report
on it. Everything has to be uploaded as a single zip file containing the following:
- `report.pdf`: this is the written report.
- `code`: a directory containing all source code of the software project.
Detai... |
Java | UTF-8 | 939 | 2.5 | 2 | [] | no_license | package com.salutation.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
/**
* Created by khayapro on 2016/06/21
*/
@Entity
public class Attendee {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
pr... |
Java | UTF-8 | 1,427 | 2.515625 | 3 | [] | no_license | package eu.ase.proiect.util;
import java.util.HashMap;
import java.util.Map;
import eu.ase.proiect.database.model.Book;
public class User {
private int idUser;
private String email;
private String username;
private String password;
// 0 - barbat, 1 -feminin
private String sex;
publ... |
C++ | UTF-8 | 816 | 2.796875 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
vector<vector<int>> g;
vector<int> value;
vector<bool> visited;
void dfsMax(int u, int &c)
{
visited[u] = true;
c += value[u];
int t = c;
for (auto i : g[u])
{
if (!visited[i])
{
dfsMax(i, c);
c = ma... |
Java | UTF-8 | 633 | 2.0625 | 2 | [
"MIT"
] | permissive | package test;
import org.junit.experimental.categories.Category;
import test.categories.Integration;
/**
* @author mikegarts
* Learning test to get famliar with the project
*/
@Category({Integration.class})
public class TestLearning extends TestCommon {
final static boolean REAL_CRYPTO_OPS = true;
@Override
... |
Markdown | UTF-8 | 7,456 | 3.15625 | 3 | [] | no_license | 分布式锁概述:
在多线程的环境下,为了保证一个代码块在同一时间只能由一个线程访问,Java中我们一般可以使用synchronized语法和ReetrantLock去保证,这实际上是本地锁的方式。但是现在公司都是流行分布式架构,在分布式环境下,如何保证不同节点的线程同步执行呢?
实际上,对于分布式场景,我们可以使用分布式锁,它是控制分布式系统之间互斥访问共享资源的一种方式。
比如说在一个分布式系统中,多台机器上部署了多个服务,当客户端一个用户发起一个数据插入请求时,如果没有分布式锁机制保证,那么那多台机器上的多个服务可能进行并发插入操作,导致数据重复插入,对于某些不允许有多余数据的业务来说,这就会造成问题。而分布式锁机制就是为了解决... |
Java | UTF-8 | 4,240 | 1.976563 | 2 | [] | no_license | package com.github.wxiaoqi.security.jinmao.controller.web;
import com.github.wxiaoqi.security.auth.client.annotation.CheckClientToken;
import com.github.wxiaoqi.security.auth.client.annotation.CheckUserToken;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.m... |
JavaScript | UTF-8 | 900 | 2.765625 | 3 | [] | no_license | /**
* @author user
*/
// upload JPEG files
function UploadFile(file) {
var xhr = new XMLHttpRequest();
if (xhr.upload && file.type == "image/jpeg" && file.size <= $id("MAX_FILE_SIZE").value) {
// create progress bar
var o = $id("progress");
var progress = o.appendChild(document.createElement("p"));
pro... |
Python | UTF-8 | 1,244 | 2.578125 | 3 | [] | no_license | from exts import db
from datetime import datetime
class User(db.Model):
__tablename__ = "user"
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
username = db.Column(db.String(50), nullable=False)
password = db.Column(db.String(100), nullable=False)
class Reporter(db.Model):
__table... |
Markdown | UTF-8 | 4,297 | 2.546875 | 3 | [
"NTP",
"RSA-MD",
"LicenseRef-scancode-pcre",
"Apache-2.0",
"MIT",
"LicenseRef-scancode-rsa-1990",
"Beerware",
"LicenseRef-scancode-other-permissive",
"Spencer-94",
"BSD-3-Clause",
"LicenseRef-scancode-rsa-md4",
"metamail",
"HPND-sell-variant",
"LicenseRef-scancode-zeusbench"
] | permissive |
# Introduction
From **release 6.7** we have the possibility to pre-process the site descriptor file before execute it to coordinate its deployment. Such processor (or _template engine_) can be plugged into processing using a module (i.e. _java library_) containing processor implementation that is published using [Jav... |
Python | UTF-8 | 199 | 3.03125 | 3 | [] | no_license | n = int(input())
a = list(map(int, input().split()))
m = 10 ** 9
for i in range(n):
s = 0
for j in range(n):
s += (abs(i - j) + j + i) * 2 * a[j]
if s < m:
m = s
print(m)
|
Java | UTF-8 | 984 | 2.359375 | 2 | [] | no_license | import java.util.ArrayList;
interface ViewInterface {
// 初期データ読み込み完了メソッド
public void successStart();
// 更新データ再読み込み完了メソッド
public void successRestart();
// 推論順に探索結果返却メソッド
public ArrayList<StepResult> showStepResult(ArrayList<StepResult> stepresults);
// 検索探索結果返却メソッド
public ArrayLis... |
Go | UTF-8 | 2,452 | 2.546875 | 3 | [
"MIT"
] | permissive | package showname
import (
"context"
"log"
"github.com/jmoiron/sqlx"
"github.com/opentracing/opentracing-go"
"go.uber.org/zap"
jaegerLog "showname/pkg/log"
"showname/pkg/tracing"
)
type (
// Data ...
Data struct {
mysql *sqlx.DB
stmtMySQL map[string]*sqlx.Stmt
tracer opentracing.Tracer
logger j... |
Markdown | UTF-8 | 2,501 | 3.515625 | 4 | [] | no_license | # TIL 200707(Tue)
# BOJ 7576 토마토 c++
백준 7576 토마토 문제
<br>
먼저 X, Y는 pair<int, int>를 위해 define 한다.
<br>
dx[n] + dy[n] 는 항상 상, 하, 좌, 우 중 하나를 나타낸다.
<br>
토마토가 배치된 맵을 담을 board 2차원 배열을 선언하고,
또 거리를 나타낼 dist 2차원 배열을 선언한다.
<br>
main함수에서는 먼저 board에 값을 채워넣는다. 안 익은 토마토만 넣고, 익은 토마토는 큐에 넣는다.
<br>
while Q가 비지... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.