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 |
|---|---|---|---|---|---|---|---|
Python | UTF-8 | 1,444 | 4.53125 | 5 | [] | no_license | class NodeSinglePointer:
def __init__(self, data=None):
self.data = data #passed to make a node
self.next = None #points to the next node
#None means it is at the end
# This def passes data to print() when called
def __str__(self):
return str(self.da... |
PHP | UTF-8 | 417 | 2.984375 | 3 | [] | no_license | <!DOCTYPE html>
<html>
<head>
<title>Print Tags </title>
</head>
<head>
<form action="" method="get">
<p>Enter tags:</p>
<input type="text" name="tags">
<input type="submit">
</form>
</head>
</html>
<?php
if(isset($_GET['tags'])){
$tags = (explode(',',$_GET['tags... |
C++ | UHC | 1,244 | 3.609375 | 4 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int N, M; // , û
vector<int> Height_DDuck; //
int nResult;
int binary_Search(vector<int>& arr, int target, int start, int end)
{
if (start > end)
{
return -1;
}
int mid = (start + end) / 2;
long long total = 0;
for (int... |
Markdown | UTF-8 | 13,484 | 2.84375 | 3 | [] | no_license | # Survial skill 1 : Process Analysis
%% Note lots of new verbiage here at the 0.9 level, needs work. This is long enough that it does not seem to fit into the survival skills 'chapter'... should it stand alone
* Process analysis = Understanding data flow
* learn to see the flow of data for an individual feature or th... |
Markdown | UTF-8 | 26,096 | 2.796875 | 3 | [
"MIT"
] | permissive | # purplepers0n
###### \java\seedu\address\logic\commands\ListAllCommand.java
``` java
/**
* Lists all details of a client, pet, technician or appointment in the address book.
*/
public class ListAllCommand extends Command {
public static final String COMMAND_WORD = "listall";
public static final String MESS... |
Python | UTF-8 | 3,608 | 3.359375 | 3 | [
"MIT"
] | permissive | import time
from .TerminalWrapper import TerminalWrapper
class ProgressBar(object):
def __init__(self,pterminal = None):
self.N_BARS = 10
self.terminalw = TerminalWrapper(pterminal=pterminal)
if not pterminal:
self.terminalw.clear()
self.start_t = self.last_print_t = ti... |
C# | UTF-8 | 493 | 2.546875 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Test2
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Morsning Github!");
Console.WriteLine("and Goodbye");
G... |
C++ | UTF-8 | 969 | 3.734375 | 4 | [] | no_license | #include<iostream>
#include<vector>
using namespace std;
/**
* 剑指offer: 14
* 动态规划:通过计算前几个元素找规律,找到dp数组表示的含义
* 也可以根据dp数组找到规律,使用贪心算法进行优化
*/
// dp solution
int solution(int length){
if(length==2) return 1;
if(length==3) return 2;
vector<int> dp(length+1);
dp[0]=0;
dp[1]=1;
dp[2]=2;
dp[3]=3;
for(int i=4;i<=le... |
C++ | UTF-8 | 461 | 2.765625 | 3 | [] | no_license | #include <bits/stdc++.h>
#include "fila2.hpp"
using namespace std;
int main(){
Queue<int, 10> q;
cout << "Empty? " << q.empty() << '\n';
for(int i = 1; i <= 10; i++) q.push(i);
cout << "Size = " << q.size() << '\n';
cout << "Front = " << q.front() << '\n';
for(int i = 0; i < 5; ++i) q.pop(... |
Go | UTF-8 | 569 | 2.78125 | 3 | [
"BSD-3-Clause",
"MIT"
] | permissive | package playwright
import "strings"
func serializeHeaders(headers map[string]string) []map[string]string {
serialized := make([]map[string]string, 0)
for name, value := range headers {
serialized = append(serialized, map[string]string{
"name": name,
"value": value,
})
}
return serialized
}
func parseH... |
Markdown | UTF-8 | 2,724 | 2.6875 | 3 | [] | no_license | ---
layout: blog
---
# News & Posts
<div class="top">
<p>This page shows the non-academic news and posts, including innovative thoughts and arguments as well as selected travel records. For academic works, visit <a href="Exhibition">Exhibition</a>. Comments are welcomed.</p>
</div>
## Recent Posts
<div class="row">... |
JavaScript | UTF-8 | 2,187 | 2.921875 | 3 | [] | no_license |
function apply (fn, args) {
if (typeof fn !== "function") {
throw new TypeError("Argument 'fn' must be a function.");
}
return fn.apply(undefined, args);
}
out.apply = apply;
function bind (fn) {
var args = [].slice.ca... |
C++ | UTF-8 | 21,203 | 2.59375 | 3 | [] | no_license | #pragma once
// CHARACTERS
// Kunio
const sGame_PaletteDataset SDODGEBALL_A_KUNIO_A[] =
{
{ L"Kunio A", 0x1461bc, 0x1461dc },
{ L"Kunio A Power MAX", 0x1461dc, 0x1461fc },
{ L"Kunio A Select", 0xed0c, 0xed2c },
{ L"Kunio A Portrait", 0xe04c, 0xe06c },
};
const sGame_PaletteDataset SDODGEBALL_A_KUNIO... |
Java | UTF-8 | 76,931 | 1.609375 | 2 | [
"MIT"
] | permissive | package com.concurnas.compiler.bytecode;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.stream.Collectors;
import com.concurnas.compiler.ast.AccessModifier;
import com.concurnas.compiler.ast.AndExpression;
import com.concurnas.compiler.ast.Annotation;
import com.concurna... |
PHP | UTF-8 | 6,476 | 2.71875 | 3 | [] | no_license | <?php
require_once('../classes/Template.php');
require_once("../classes/DB.class.php");
require_once("../classes/Validate.php");
session_start();
$db = new DB();
// Error message if anything is invalid
$errorMsg = "";
//Safe vars
$safeRealName = "";
$safeAddress = "";
$safeZipCode = "";
// Realn... |
JavaScript | UTF-8 | 2,203 | 3.046875 | 3 | [] | no_license | import Point from './Point'
class Line {
constructor(m, inter, center) {
this.m = m
this.inter = inter
this.vertical = ! isFinite(this.m)
this.horizontal = this.m === 0
this.center = center
}
func(x) {
return (
isFinite(this.m) ?
this.m * x + this.inter :
this.inter
... |
PHP | UTF-8 | 1,038 | 4.03125 | 4 | [] | no_license | <?php
class Studente {
public $nome;
public $cognome;
private static $matricola=0;
public $matricolaUtente;
public function __construct($nome, $cognome)
{
$this->nome=$nome;
$this->cognome=$cognome;
self::immatricola();
$this->matricolaUtente=self::$matricola;
... |
C++ | UTF-8 | 5,048 | 2.921875 | 3 | [] | no_license | #include "stdafx.h"
#ifndef UTILS_H
#define UTILS_H
#define PI 3.1415926
template<typename T>
static void flipQuadrants(cv::Mat &source)
{
int hRows = source.rows / 2;
int hCols = source.cols / 2;
for (int y = 0; y < hRows; y++)
{
for (int x = 0; x < hCols; x++)
{
T tl = source.at<T>(... |
Go | UTF-8 | 7,066 | 2.640625 | 3 | [
"BSD-3-Clause-Clear",
"BSD-3-Clause",
"Apache-2.0"
] | permissive | //
// Modified BSD 3-Clause Clear License
//
// Copyright (c) 2019 Insolar Technologies GmbH
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted (subject to the limitations in the disclaimer below) provided that
// the following conditions a... |
Java | UTF-8 | 1,060 | 2.1875 | 2 | [
"Apache-2.0"
] | permissive | package com.taboola.backstage.model.media.campaigns.items;
import java.util.List;
import com.taboola.rest.api.annotations.Required;
public class CampaignItemMassiveCreationOperation {
@Required
private List<Long> campaignIds;
@Required
private List<CampaignItemOperation> items;
private CampaignI... |
C | UTF-8 | 863 | 3.390625 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
* 模拟人工算法,大数加减法.
*
*/
#define MAXLEN 150
void test14011()
{
int R;
char flags;
char res[MAXLEN];
char num[MAXLEN];
memset(res, 0x00, sizeof(res));
memset(num, 0x00, sizeof(num));
while(~scanf("%s %d", num, &R))
{
if (num[0]=='-')
{
flags=... |
Java | UTF-8 | 5,787 | 4.34375 | 4 | [] | no_license | package test.designpatterns;
public class SingletonTest {
public static void main(String[] args){
Singleton s1 = Singleton.getInstance();
Singleton s2 = Singleton.getInstance();
System.out.println(s1);
System.out.println(s2);
System.out.println(s1==s2);
}
}
//经验之谈:一般情况下,不建议使用第 1 种和第 2 种懒汉方式,建议使用第 3 种饿汉方... |
Python | UTF-8 | 610 | 3.296875 | 3 | [] | no_license | # _*_ coding: utf-8 _*_
from PIL import Image,ImageFont,ImageDraw,ImageColor
def image_add_num(image,text):
# 设置字体
font = ImageFont.truetype("arial.ttf",50)
# 设置字体颜色
font_color = ImageColor.colormap.get('red')
# 将字体加到图片上
draw = ImageDraw.Draw(image)
width,height = image.size
... |
SQL | UTF-8 | 2,629,072 | 3.1875 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.6.5.2
-- https://www.phpmyadmin.net/
--
-- Počítač: 127.0.0.1
-- Vytvořeno: Úte 02. kvě 2017, 20:23
-- Verze serveru: 10.1.21-MariaDB
-- Verze PHP: 7.1.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT... |
Swift | UTF-8 | 2,972 | 2.796875 | 3 | [] | no_license | //
// Game.swift
// Killer
//
// Created by qztcm09 on 16/6/22.
// Copyright © 2016年 qztcm09. All rights reserved.
//
import Foundation
class Game: NSObject {
var gameID = arc4random()
var players:NSMutableArray? = []
var isStart = false
var gameState:String = "night"
... |
C | UTF-8 | 83 | 2.515625 | 3 | [] | no_license | #include <stdio.h>
extern "C" void print(unsigned long p) {
printf("%lu\n", p);
} |
C++ | UTF-8 | 1,422 | 3.078125 | 3 | [
"MIT"
] | permissive | #ifndef __TASK_H__
#define __TASK_H__
#include <interfaces/ITask.h>
#include <interfaces/Source.h>
#include <interfaces/Sink.h>
#include <utility>
#include <tuple>
template <typename Input, typename Output, typename State>
class Task : public ITask<State> {
State state;
Source<Input>& input;
Sink<Output>& output;... |
C | UTF-8 | 494 | 2.578125 | 3 | [] | no_license | #include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
int main(int argc,char *argv[])
{
FILE *fp,*fblake;
if(argc==2)
{
fp = fopen(argv[1],"w+");
fblake = fopen(argv[0],"r+");
}
else
{
fp = fopen("happy.tmp","w+");
fblake = fopen("blake.txt","r+");
}
char line[] = "\\----Say Hello to s1081... |
JavaScript | UTF-8 | 2,349 | 2.671875 | 3 | [] | no_license | import React, { useState } from "react";
import { EducationSection } from "./EducationSection";
import uniqid from "uniqid";
export const Education = () => {
const [educationSections, seteducationSections] = useState([]);
const deleteSection = (e) => {
const index = educationSections
.map((section) => s... |
Java | UTF-8 | 984 | 2.28125 | 2 | [] | no_license | package org.mockito.internal;
import static org.junit.Assert.*;
import org.junit.*;
import org.mockito.exceptions.UnfinishedVerificationException;
public class MockitoStateTest {
private MockitoState mockitoState;
@Before
public void setup() {
mockitoState = new MockitoState();
}
@Test... |
Java | MacCentralEurope | 2,784 | 2.765625 | 3 | [] | no_license | package ThreadImport;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List... |
Java | UTF-8 | 1,222 | 2.25 | 2 | [] | no_license | package co.simplon.controller;
import java.util.List;
import javax.inject.Inject;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springfram... |
Python | UTF-8 | 864 | 3.6875 | 4 | [] | no_license |
class JogoDaVelhaTable():
def __init__(self, columns, title):
self.__columns = columns
self.__title = title
def show(self, positions):
right_margin = " " ## 10 spaces
right_column_margin = " %s "
header = right_margin + ' 1 + 2 + 3 '
bar = righ... |
JavaScript | UTF-8 | 501 | 3.1875 | 3 | [] | no_license | document.querySelector('#translate').addEventListener('click',translate);
function translate(){
let input = document.querySelector('.text').value
let output = document.querySelector('.morse')
if(input === ''){
alert('Enter the any text')
}
else{
var url = 'https://api.funtrans... |
Java | UTF-8 | 6,245 | 2.84375 | 3 | [
"MIT"
] | permissive | package seedu.address.logic.commands;
import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import seedu.address.commons.core.Messages;
import seedu.address.commons.core.index.Index;
import seedu.address.logic.commands.exceptions.Comma... |
JavaScript | UTF-8 | 3,475 | 3.015625 | 3 | [] | no_license | // require .env file
require("dotenv").config();
var fs = require('fs');
// keys for twitter and spotify api
var keys = require("./keys.js");
var Twitter = require('twitter');
var client = new Twitter(keys.twitter);
var command = process.argv[2];
var input = JSON.stringify(process.argv[3]);
// Switch statement to c... |
Java | UTF-8 | 544 | 2.234375 | 2 | [] | no_license | package com.fudan.File;
import com.fudan.File.Impl.FileMeta;
import com.fudan.Indexing.Id;
public interface File {
int MOVE_CURR = 0;
int MOVE_HEAD = 1;
int MOVE_TAIL = 2;
Id getFileId();
FileManager getFileManager();
byte[] read(long length);
void write(byte[] b);
default long pos(... |
TypeScript | UTF-8 | 2,146 | 2.78125 | 3 | [] | no_license | import { SkillTemplate, UseCase } from "../general/Skills";
const useCases: UseCase[] = [
{
name: 'prepare meal',
attribute: 'perception',
description: 'you convert ingredients into a homecooked meal, you may cook multiple meals at once if the kitchen has the amenities for it.',
resu... |
Python | UTF-8 | 2,092 | 4 | 4 | [] | no_license | from collections import deque
class Solution(object):
def sortTransformedArray(self, nums, a, b, c):
"""
Given a sorted array of integers nums and integer values a, b and c.
Apply a quadratic function of the form f(x) = ax^2 + b^x + c to each element x in the array.
The returned ar... |
C# | UTF-8 | 1,722 | 2.953125 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace ClusterWave.Scenario.Dynamic
{
class BulletList
{
LinkedList<Bullet> list;
public BulletList()
{
list = ne... |
PHP | UTF-8 | 661 | 3.09375 | 3 | [] | no_license | <?php
namespace CamileApp\Core\Constraints\ValidationForm\Field;
/**
* Class PassField
* @package CamileApp\Core\Constraints\ValidationForm\Field
*/
class PassField extends Field
{
protected $max = 100;
protected $pass;
public function check( $pass)
{
if($this->checkLength($pass))
... |
JavaScript | UTF-8 | 2,658 | 3.40625 | 3 | [] | no_license |
$(document).ready(function() {
var newDiv = $('<div id="msgid"></div>');
$("body").html(newDiv);
$("#msgid").html('<p>Welcome to My site Where All the Code is in a Script file!</p>');
$("body").append('<p><a href="#" id="link1">Calculate life time supply</a></p>');
$("#link1").bi... |
Shell | UTF-8 | 1,568 | 4.3125 | 4 | [] | no_license | #!/bin/bash
# Check to see if the first option is either open or close, then a port number
# ie: magic open 3389
# magic close 3389
# magic list
#
# Init
myPrefix=cdj-tmp
myBlah='Executing: '
# Hey, let's check to see what options were given
case $1 in
list)
myCmd='gcloud compute firewall-rules list'
e... |
C# | UTF-8 | 814 | 2.703125 | 3 | [] | no_license | namespace DocumentSystemName
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
public class Multimedia : Binary, IDocument
{
public long? Length { get; protected set; }
public override void LoadProperty(st... |
C | UTF-8 | 846 | 3.328125 | 3 | [] | no_license | /*
* This module implement a stack for the backTracer function.
* It includes support for push, pop and checking if the stack is empty.
*
* */
#ifndef STACK_H_
#define STACK_H_
/*element structure ,contains the row and column of the cell currently trying to fill with his possible values,
* row and column ... |
Ruby | UTF-8 | 889 | 3.4375 | 3 | [] | no_license | require_relative 'Bike'
class DockingStation
attr_reader :name, :capacity, :bikes
def initialize(name, capacity)
@name = name
@bikes = []
@capacity = capacity
end
def self.create(name, capacity)
@dock = DockingStation.new(name, capacity)
end
def self.instance
@dock
end
def dock... |
Java | UTF-8 | 8,295 | 1.835938 | 2 | [] | no_license | package com.jierong.share.mvp.view.frag;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerV... |
Markdown | UTF-8 | 1,138 | 2.5625 | 3 | [] | no_license | # Mesto.Russia
Mesto.Russia - сайт с фотографиями из разных городов России. На нем возможно поменять данные в графах "имя" и "о себе".
Проект можно увидеть по ссылке: https://anastasia-lamakina.github.io/mesto/.
Я сделала его во время моей учебы в Яндекс.Практикуме.
## Используемые технологии
Сайт использует нижеп... |
Python | UTF-8 | 6,740 | 2.765625 | 3 | [] | no_license | #!/usr/bin/env python3
import os
import pymysql
import sys
import time
class DatabaseInteraction:
def __init__(self):
self.DB_CREDS = {
'host': os.environ.get('SQL_DO_HOST'),
'port': int(os.environ.get('SQL_DO_PORT')),
'user': os.environ.get('SQL_DO_USER'),
... |
C | UTF-8 | 944 | 3.03125 | 3 | [] | no_license | #include <stdio.h>
#include <curses.h>
int main()
{
initscr();
clear();
print();
int ch = getch();
if(ch == 49)
{
guess_main();
}
else if(ch == 50)
{
catch_main();
}
else if(ch == 51)
{
math_main();
}
else if(ch == 'Q'|| ch == 'q')
{
endwin();
}
}
void print()
{
move(5,10);
printw("--... |
C# | UTF-8 | 5,634 | 3.328125 | 3 | [] | no_license | using System.Runtime.InteropServices;
using System.Collections.Generic;
using System.Collections;
using System;
namespace Chunk.Buffer
{
/// <summary>버퍼의 구조체를 관리하는 클래스입니다.</summary>
/// <typeparam name="TStruct">관리할 버퍼의 구조체입니다.</typeparam>
public class SBufferStruct<TStruct>: IList<TStruct> where TStruct ... |
Ruby | UTF-8 | 1,626 | 4.03125 | 4 | [] | no_license |
# bool collinear(float[][] points)
# returns true if all the points in the array lie on the same line
def is_collinear(params)
if params.length == ( 1 | 0 )
return false
elsif params.length == 2
return true
elsif is_horizontal_line(params)
return true
elsif is_vertical_line(params)
return tru... |
C# | UTF-8 | 3,945 | 2.953125 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Ostis.Sctp.Arguments
{
/// <summary>
/// Цепочка итераторов. Это аргумент команды <see cref="Ostis.Sctp.Commands.IterateConstructionsCommand"/>
/// </summary>
... |
Markdown | UTF-8 | 5,820 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | ---
title: spring cloud 网关初识
date: 2020-01-29 19:40
author: xp
categories:
- Java
- Spring Cloud
tags:
- Java
- Spring Cloud
- 微服务
- 网关
---
# spring cloud 网关初识
## 什么是网关
*网关*是一个*抽象层*,出现的原因是*微服务架构*的出现,不同的微服务一般会有不同的网络地址,而外部客户端可能需要调用多个服务的接口才能完成一个业务需求,如果让客户端直接与各个微服务通信,会有以下的问题:
- 客户端会多次请求不同的微服务,增加了客户端... |
C++ | UTF-8 | 3,489 | 3.25 | 3 | [] | no_license | #include "../commheader.h"
#ifndef _CP5_EX_13_4__
#define _CP5_EX_13_4__
class Folder;
// declare of class Message
class Message {
friend class Folder;
friend void swap(Message&, Message&);
public:
explicit Message(const string &str = ""): contents(str) {
cout << "call explicit Message::Message(co... |
TypeScript | UTF-8 | 649 | 2.765625 | 3 | [] | no_license | import jwt, { Secret } from "jsonwebtoken";
export class JWTToken {
constructor(private readonly secret: Secret) {}
public generateToken(
payload: any,
subject: string | undefined,
issuer: string | undefined,
notBefore: string | number | undefined,
expiresIn: string | number | undefined
): s... |
Python | UTF-8 | 835 | 4.25 | 4 | [] | no_license | """
Given a 32-bit signed integer, reverse digits of an integer.
Note:
Assume we are dealing with an environment which could only store integers
within the 32-bit signed integer range: [−231, 231 − 1]. For the purpose of this problem,
assume that your function returns 0 when the reversed integer overflows.
https://... |
Java | UTF-8 | 2,240 | 1.585938 | 2 | [] | no_license | package com.zr.class3.service;
import java.util.List;
import java.util.Map;
import com.zr.class3.model.*;
public interface GeneralService {
public Map get_menu(int id);
public List<FangDong> get_fangdong_all();
// public Map get_fangdong(String id);
public Map search_fangdong(String desc);
public Map add_fang... |
Java | UTF-8 | 928 | 1.835938 | 2 | [] | no_license | package com.jfatty.zcloud.system.service.impl;
import com.jfatty.zcloud.system.entity.IdentityFile;
import com.jfatty.zcloud.system.mapper.IdentityFileMapper;
import com.jfatty.zcloud.system.service.IdentityFileService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4... |
Markdown | UTF-8 | 364 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | # Pipe to New File
`$ echo "Sample data" > ./my-new-file.txt`
# Pipe and Append to File
`$ echo "More Data" >> ./my-new-file.txt`
# Pipe stderr to stdout
`2>&1`
# Silence output
`$ redis-server > /dev/null`
# Silence stderr and stdout
`$ redis-server > /dev/null 2>&1`
# Append to end of file
# possibility 3:
`$ ca... |
Go | UTF-8 | 1,625 | 3.25 | 3 | [] | no_license | package system
import (
"fmt"
"runtime"
"strings"
)
type RuntimeInfo struct {
OS, Arch string
}
func (ri RuntimeInfo) IsDarwin() bool { return ri.OS == "darwin" }
func (ri RuntimeInfo) IsLinux() bool { return ri.OS == "linux" }
var DefaultRuntimeInfoGetter RuntimeInfoGetter
func IsDarwin() bool { return Get()... |
JavaScript | UTF-8 | 5,254 | 2.5625 | 3 | [] | no_license | (function( $ ) {
$.widget("ui.dateTimeQuery",{
options:{
value : null,
hide : false,
date : null,
newImage : false,
label : null,
execute : null,
imageFormat : "all"
},
_create : function(){
var self = this;
options = self.options;
var value = self.element.attr("value");
if(value == "nul... |
Markdown | UTF-8 | 4,211 | 4.03125 | 4 | [] | no_license | # 题目
在 O(n log n) 时间复杂度和常数级空间复杂度下,对链表进行排序。
示例 1:
输入: 4->2->1->3
输出: 1->2->3->4
示例 2:
输入: -1->5->3->4->0
输出: -1->0->3->4->5
* 思路:使用归并排序,由于是链表,可以实现原址排序
1. 使用快慢指针找中点
2. 找到中点后将链表切断为两部分,递归
3. 合并有序链表
* 代码:递归版代码,非O(1)空间复杂度
```C++
/**
* Definition for singly-linked list.
* struct ListNode {
... |
C | UTF-8 | 276 | 3.375 | 3 | [] | no_license | #include<stdio.h>
#include<conio.h>
void main()
{
int i,j,n,count=1;
printf("Enter no. of rows of Floyd's triangle to be shown: ");
scanf("%d",&n);
printf("\n");
for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++) printf("%d\t",count++);
printf("\n");
}
getch();
} |
C++ | UTF-8 | 599 | 3.3125 | 3 | [] | no_license | #include<stdio.h>
#include <string.h>
//void swap(char &a,char &b){
// char temp;
// strcpy(temp,a);
// strcpy(a,b);
// strcpy(b,temp);
//}
void sort(char nama[][100]){
for (int i=0;i<5;i++){
for (int j=0;j<4;j++){
if (strcmp(nama[j],nama[j+1])<0){
char temp[100];
strcpy(temp,nama[j]);
s... |
C++ | UTF-8 | 1,136 | 3.015625 | 3 | [] | no_license |
#ifndef EX1_ARENSTORFPOINT_H
#define EX1_ARENSTORFPOINT_H
#include <string>
#include <math.h>
#include <iostream>
using namespace std;
// moon mass / earth mass.
const long double ALPHA = 0.012299;
// BETA = 1 - ALPHA.
const long double BETA = 0.987701;
/**
* class that represent an arenstorf ... |
Java | UTF-8 | 1,673 | 3.25 | 3 | [] | no_license | package cn.ox0a.algorithm.base;
import com.sun.istack.internal.NotNull;
/**
* @Description 用于比较的基类
* @author leon
* @Date 2020-12-07 15:54
* @Version 1.0
*/
public abstract class Sorter<V extends Comparable<? super V>> implements ISortAscAlgorithm<V> {
/**
* 小于
* @param d1 前
* @param d2 后
... |
JavaScript | UTF-8 | 2,795 | 2.984375 | 3 | [] | no_license | // Starfield
//
// Definition of a Particle for the Starfield demo of JSparkle.
//
(function() {
// Game Alchemist Workspace.
window.ga = window.ga || {};
ga.particles = ga.particles || {} ;
ga.particles.Star = function() {
this.x = 0 ; this.y = 0;
this.fakeZ = 1 ; // trick ... |
Python | UTF-8 | 5,594 | 2.734375 | 3 | [] | no_license | import socket
import sys
import os
import collections
import threading
import time
class ClientHandler(threading.Thread):
def __init__(self, client):
threading.Thread.__init__(self)
self.client = client
def run(self):
#a: server: READY
self.client.send('READY'.encode('UTF-8'))
... |
Python | UTF-8 | 2,975 | 4.09375 | 4 | [] | no_license | # Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
# Complexity Analysis
# Let NN be the length of list A and MM be the length of list B.
# Time complexity : O(N×M).
# For each of the N nodes in list A, we are t... |
Swift | UTF-8 | 501 | 2.6875 | 3 | [] | no_license | //
// Information.swift
// BookRent
//
// Created by 郭瑋 on 2021/9/30.
//
import Foundation
/*class BookInfo:{
let BIbooktitle:String
let BIbookISBN:String
let BIbookauthors:String
let BIbookimage:Data
init(BIbooktitle:String,BIbookISN:String,BIbookauthors:String,BIbookimage:Data... |
C++ | GB18030 | 2,109 | 3.3125 | 3 | [] | no_license | #include<vector>
#include<string>
#include<algorithm>
#include<unordered_map>
using namespace std;
//2020 2-21 15:43
//Runtime: 24 ms, faster than 73.48 % of C++ online submissions for Palindrome Linked List.
//Memory Usage: 12.8 MB, less than 53.45 % of C++ online submissions for Palindrome Linked List.
//Definition... |
C# | UTF-8 | 1,552 | 3.140625 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ChaNiBaaStra.DataModels
{
public class Mod
{
int _mod;
int _min;
public Mod()
{
_mod = 360;
_min = 0;
}
... |
JavaScript | UTF-8 | 441 | 4 | 4 | [] | no_license | // Operadore Aritiméticos
//multiplicação *
console.log(5 * 4)
console.log(2.3 * 3.7)
//divisão /
console.log( 12 / 2)
//soma +
console.log(25 + 36)
//subtração -
console.log(20 - 7)
//resto da divisao %
let remainder
remainder = 11 % 3
console.log(remainder)
//incremento ++
let increment = 0
increment++
consol... |
Shell | UTF-8 | 512 | 3.421875 | 3 | [
"MIT"
] | permissive | #!/bin/bash
echo "Creating directory"
SQLITEDIR=/tmp/sqlitedbs
rm -rf $SQLITEDIR
if [ -a $SQLITEDIR ]
then
echo "Failed to remove $SQLITEDIR"
exit 1
fi
mkdir -p $SQLITEDIR
cd $SQLITEDIR
echo "Removing old DBs"
rm -f test live
echo "Creating DBs"
echo 'create table t1(c1 text);' | sqlite test
echo 'create table t1(c1 ... |
Java | UTF-8 | 620 | 2.890625 | 3 | [] | no_license | package com.example.android.learningjava;
import org.junit.Test;
// Created by wendy on 12/12/2015.
public class CookieTest {
// @Before
// public void setUp() throws Exception {
//
// }
@Test
public void testSetShape() throws Exception {
Cookie ginger = new Cookie("rice");
ginger.s... |
TypeScript | UTF-8 | 2,847 | 2.65625 | 3 | [
"MIT"
] | permissive | import {tokenizeJS} from "@internal/js-parser";
import {AnsiHighlightOptions, HighlightCodeResult} from "./types";
import {ConstJSSourceType} from "@internal/ast";
import {invalidHighlight, reduce} from "./utils";
import {readMarkup} from "@internal/markup";
export default function highlightJS(
{input, path}: AnsiHig... |
C# | UTF-8 | 484 | 2.640625 | 3 | [] | no_license | public class AppContext : DbContext
{
public DbSet<Person> People { get; set; }
public DbSet<Item> Items { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity<Person>().HasMany(p => p.Foods).WithRequired(f => f.Cooked... |
Java | UTF-8 | 2,837 | 1.859375 | 2 | [
"Apache-2.0"
] | permissive | /*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable ... |
Ruby | UTF-8 | 359 | 4.3125 | 4 | [] | no_license | print "I have a secret number (0-9) Can you guess it? Your try: "
count = 0
num = rand(10)
answer = nil
until answer == num
answer = gets.chomp.to_i
count += 1
if answer < num
puts "Too small"
elsif answer > num
puts "Too big"
else
puts "Correct! The number was #{num}"
end
end
puts ... |
Python | UTF-8 | 232 | 3.78125 | 4 | [] | no_license | s = 'У лукоморья 123 дуб зеленый 456'
i = s.find('я')
print(i+1)
print (s.count('у'))
if s.isalpha():
print(' ')
else:
print(s.upper())
if len(s)>4:
print(s.lower())
print (s.replace(s[:1],'О'))
|
C++ | UTF-8 | 2,048 | 2.890625 | 3 | [] | no_license | // 605B - Lazy Student CF# 335 - 1
// Sort MST edges and non-MST edges, Put MST edges as 1-2-3-4-5.... and non-MST as 3-1, 4-1,4-2,.....
#include <bits/stdc++.h>
using namespace std ;
typedef long long int ll ;
int main(){
ll n,m; cin >> n >> m;
vector<pair<ll,ll>> wts_include(m);for(int i=0;i<m;i++)cin >> wts_inclu... |
Python | UTF-8 | 818 | 2.734375 | 3 | [
"MIT"
] | permissive | import numpy as np
from pywt import wavedec, waverec, threshold
def wavelet_transform(x, wavelet="haar", level=2, declevel=2):
# estimate level 2 wavelet coefficients
"""
Args:
x: inputs data
wavelet: type of wavelet
level: level of smoothed
declevel: level of smoothed
... |
Python | UTF-8 | 263 | 3.21875 | 3 | [] | no_license | #!/usr/bin/python3
def weight_average(my_list=[]):
if my_list == []:
return 0
sum = 0
divisor = 0
for i, j in my_list:
sum += (lambda i, j: i * j)(i, j)
for i in my_list:
divisor += i[1]
return(sum/divisor)
|
Java | UTF-8 | 915 | 3.21875 | 3 | [] | no_license | package lesson10dop;
import java.lang.reflect.Field;
public class ToStringOverride {
private static String result = "";
public static String toString(Object object) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
final Class objectClass = object.getClass();
... |
C# | UTF-8 | 13,427 | 3.28125 | 3 | [] | no_license | using System;
using System.Collections;
using System.Collections.Generic;
namespace CSDemo
{
public class BinaryTreeNode<T> where T : IComparable<T>
{
/// <summary>
/// 元数据
/// </summary>
private T data;
public T Data {
get { return data; }
set ... |
C | UTF-8 | 2,714 | 2.515625 | 3 | [] | no_license | /*
* mcu.c
*
* MCU setup utilty routines
*/
#include <asm/io.h>
#include "mcu.h"
/*
* PIO IO base addresses
*/
int pio_port_io_addr[MCU_PORTS] = {
PIO_A_BASE + PIO_PORT_A,
PIO_A_BASE + PIO_PORT_B,
PIO_A_BASE + PIO_PORT_C,
PIO_B_BASE + PIO_PORT_A,
PIO_B_BASE + PIO_PORT_B,
PIO_B_BASE + PIO_PORT_C
};
/*
... |
SQL | UTF-8 | 237 | 2.703125 | 3 | [] | no_license | DROP procedure IF EXISTS `INV_GetImageMapping`;
DELIMITER $$
CREATE PROCEDURE `INV_GetImageMapping`(IN lotID INT)
BEGIN
SELECT id
,file_path
FROM inv_cur_image_mapping
where inv_cur_lots_id = lotID;
END$$
DELIMITER ;
|
Markdown | UTF-8 | 25,266 | 2.578125 | 3 | [
"LicenseRef-scancode-public-domain"
] | permissive | > *The following text is extracted and transformed from the stanstedairport.com privacy policy that was archived on 2018-07-02. Please check the [original snapshot on the Wayback Machine](https://web.archive.org/web/20180702024237id_/https%3A//www.stanstedairport.com/privacy-policy) for the most accurate reproduction.*... |
Java | UTF-8 | 10,694 | 2.4375 | 2 | [
"MIT"
] | permissive | package com.example.HslCommunication.Core.Net;
import android.util.Log;
import com.example.HslCommunication.Core.Types.HslTimeOut;
import com.example.HslCommunication.Core.Types.OperateResult;
import com.example.HslCommunication.Core.Utilities.boolWithBytes;
import com.example.HslCommunication.Core.Utilities.boolWithS... |
C++ | UTF-8 | 736 | 3.109375 | 3 | [
"MIT"
] | permissive | //
// Created by Mark van der Broek on 06/03/2017.
//
/**
* @brief Output operator of the vehicle class
*
* @param [in] os The stream to write to
* @param [in] customer The vehicle to write to the stream
*/
#include "vehicle.ih"
ostream& operator<<(ostream &os, Vehicle const &vehicle)
{
os << vehicle... |
C++ | UTF-8 | 528 | 2.765625 | 3 | [] | no_license | // Math
// There is another solution in "solution" of this problem
class Solution {
public:
int smallestRepunitDivByK(int K) {
int r = 0, digi = 0;
bool flag = true;
do {
flag = false;
for (int i=0; i<=9; ++i)
if ((K * i + r) % 10 == 1) {
... |
Java | UTF-8 | 845 | 1.976563 | 2 | [] | no_license | package com.example.tquan.entity;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
@Component
@PropertySource(value = {"classpath:iam.properties"})
@ConfigurationProperties(prefix ... |
Markdown | UTF-8 | 679 | 3.03125 | 3 | [] | no_license | # SquadMars
A squad mission on planet Mars. Which you move them on an Rectangular area remotely.
Project developed in .Net Core 3.0 as Rest API.
You start with setting Target area borders.
For ex:
To Set Area as (0,0) to (5,5):
https://localhost:44357/squad/SetAreaEndPoint?area=5%205
Then add Rover to your Squad ... |
Markdown | UTF-8 | 1,457 | 3 | 3 | [] | no_license | # Pure Kotlin implementation
## Introduction
In this codelab, you learn about one of the Android Architecture Components, ViewModel:
You use the ViewModel class to store and manage UI-related data in a lifecycle-conscious way. The ViewModel class allows data to survive device-configuration changes such as screen rota... |
JavaScript | UTF-8 | 764 | 2.578125 | 3 | [] | no_license | document.addEventListener("DOMContentLoaded", function (event) {
let info = document.querySelector('.info')
info.addEventListener('click', (event) => {
info.classList.toggle('--hidden')
})
let map = L.map('map', window.MAPsettings)
L.tileLayer('./tiles/{z}/{x}/{y}.png').addTo(map);
map.on('click', f... |
PHP | UTF-8 | 4,170 | 2.515625 | 3 | [
"MIT"
] | permissive | <?php
namespace GeoSot\BaseAdmin\App\Traits\Eloquent;
use GeoSot\BaseAdmin\Helpers\Base;
use Illuminate\Support\Arr;
use Mcamara\LaravelLocalization\Facades\LaravelLocalization;
trait HasRulesOnModel
{
protected $rules = [];
protected $errorMessages = [];
/**
* @param array $mergeRules
*
... |
C++ | GB18030 | 1,488 | 2.859375 | 3 | [] | no_license | #include<stdio.h>
int main()
{
int i = 0 ,sum = 0,psum=0,esum=0;
char a[100];
printf("\n һʮ\n ");
scanf("%s",&a);
printf("\n Ʊʾ\n ");
while( a[i] != 0 )
{
switch(a[i++])
{
case 'a': printf("1010"); psum+=2 ; esum+=2 ; break;
case 'b': printf("1011"); psum+=2 ; esum+=2 ; break;
case 'c'... |
PHP | UTF-8 | 1,365 | 2.875 | 3 | [
"MIT"
] | permissive | <?php
namespace App\Services;
use App\Models\User;
use App\Repositories\UserRepository;
use GuzzleHttp\Exception\ServerException;
class UserService
{
/** @var UserRepository */
private $userRepository;
public function __construct(UserRepository $userRepository)
{
$this->userRepository = $u... |
Python | UTF-8 | 492 | 3.5625 | 4 | [] | no_license | """ Determine car reliability. """
from prac_08.car import Car
import random
class UnreliableCar(Car):
""" Calculate the reliability of a Car object. """
def __init__(self, name, fuel, reliability):
""" Initialise car instance details based on Car parent class. """
super().__init__(name, fuel... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.