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 |
|---|---|---|---|---|---|---|---|
C# | UTF-8 | 1,447 | 3.078125 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NthDimension.Procedural.Quest.Actions
{
public class GoTo : QuestAction
{
int x;
int y;
public GoTo()
{
this.name = "GoTo";
gene... |
Python | UTF-8 | 1,203 | 3.515625 | 4 | [] | no_license | import networkx as nx
import matplotlib.pyplot as plt
graph = [('A', 'B'), ('A', 'F'),
('B', 'C'), ('B', 'I'), ('B', 'G'),
('C', 'D'), ('C', 'I'),
('D', 'E'), ('D', 'H'), ('D', 'G'), ('D', 'I'),
('E', 'F'), ('E', 'H'),
('F', 'A'), ('F', 'G'),
('G', 'B'), ('G... |
Python | UTF-8 | 736 | 3.078125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import numpy as np
import matplotlib.pyplot as plt
get_ipython().run_line_magic('matplotlib', 'inline')
# In[2]:
def f(x):
return x - x**6
# In[3]:
x = np.linspace(0,1,100)
plt.plot(x, f(x))
# In[4]:
z = np.sort(np.random.rand(10))
z[0] = 0
z[-1] = 1
h =... |
Markdown | UTF-8 | 722 | 2.9375 | 3 | [
"MIT"
] | permissive | <h1>PowerTrack Rule Management</h1>
<h2>Ruby Examples</h2>
<p>The following Ruby snippets demonstrate how to perform the following rule-management operations on the PowerTrack Rules API.
<ul>
<li>
Add a rule to a stream</li>
<li>
Delete a rule from a stream</li>
<li>
Retrieve the list of rules for a stream</li... |
Java | UTF-8 | 1,859 | 2.34375 | 2 | [] | no_license | package com.example.jpa.example1;
import com.example.jpa.example1.base.BaseEntity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.*;
import javax.persistence.*;
import java.util.List;
@Entity
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ToString(exclude = "addresses")
public class User e... |
PHP | UTF-8 | 630 | 2.671875 | 3 | [] | no_license | <? echo("<?"); ?>xml version="1.0" encoding="utf-8" <? echo("?>"); ?>
<grammar xmlns="http://www.w3.org/2001/06/grammar" xml:lang="ru-ru" version="1.0" mode="voice" root="root" tag-format="semantics/1.0-literals">
<rule id="root">
<one-of>
<?
$ff = fopen("rab.csv", "r") or die("Ошибка!");
while($dr = fgetcsv($ff, 100... |
Java | UTF-8 | 1,154 | 2.59375 | 3 | [] | no_license | package BeansMetier;
public class Document {
private String libelle_doc;
private String descriptionDoc;
private int idProc;
private int idDoc;
public Document(String libelle_doc, String descriptionDoc,int idProc) {
this.libelle_doc = libelle_doc;
this.descriptionDoc = descripti... |
C# | UTF-8 | 1,291 | 2.625 | 3 | [
"MIT"
] | permissive | using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Storage;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Infrastructure.EfDataAccess
{
public class UnitofWorkManager<TContext> : IUnitofWork where TContext : DbCo... |
Python | UTF-8 | 364 | 3.546875 | 4 | [] | no_license | import datetime
ano = int(input('Digite o ano em que nasceu '))
idade = datetime.datetime.today().year - ano
#print(datetime.datetime.today())
dif = abs(idade - 18)
if idade < 18:
print('Você ainda vai se alistar. Falta(m) {} ano(s)'.format(dif))
elif idade == 18 or 17:
print('Está na hora de se alistar')
els... |
Java | UTF-8 | 1,312 | 2.328125 | 2 | [
"Apache-2.0"
] | permissive | package de.bbcdaas.themehandlerweb.domains;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
/**
*
* @author Robert Illers
*/
@Entity
public class UserEntity implements Serializa... |
C++ | UTF-8 | 819 | 2.921875 | 3 | [
"BSD-2-Clause"
] | permissive | #pragma once
#include <Kernel/VM/PhysicalAddress.h>
#include <Kernel/VM/VMObject.h>
class AnonymousVMObject final : public VMObject {
public:
virtual ~AnonymousVMObject() override;
static NonnullRefPtr<AnonymousVMObject> create_with_size(size_t);
static NonnullRefPtr<AnonymousVMObject> create_for_physica... |
Python | UTF-8 | 3,969 | 3.03125 | 3 | [] | no_license | import numpy as np
import scipy.cluster.hierarchy as sch
import scipy.spatial.distance as dist
import json
from scipy.stats import zscore
from collections import Counter
import networkx as nx
from networkx.readwrite import json_graph
def _linkageMatrix2json(Z, labels):
## function to convert linkage matrix to a json ... |
Python | UTF-8 | 288 | 3.65625 | 4 | [] | no_license | def main():
a = int(input("Please enter the starting height of the hailstone: "))
while a !=1:
print("Hail is currently at height",int(a))
if a %2== 0:
a/=2
else:
a = a*3+1
print("Hail stopped at height 1")
main()
|
PHP | UTF-8 | 6,615 | 2.578125 | 3 | [] | no_license | <?php
/**
* AbstractHandler.php
*
* Licensed under the Apache License, Version 2.0 (the "License"),
* see LICENSE for more details: http://www.apache.org/licenses/LICENSE-2.0.
*
* @author Zhang Yi <loeyae@gmail.com>
* @version 2019-02-25 10:21:17
*/
namespace app\services\handler;
use loeye\service\Handler;
... |
Markdown | UTF-8 | 9,353 | 3.875 | 4 | [] | no_license |
# Python面向对象编程2
---
## 编程语言的特征:
- 继承
- 封装
- 多态
- 如:C++ / Java / Python / Swift / C#
# inheritance 继承 drived 派生
- 概念:
- **继承**是指从已有的类中衍生出新类,新类具有原类的行为,并能扩展新的行为
- **派生**就是从一个已有的衍生(创建)新类,在新类上可以田间新的属性的行为
- 目的:
- **继承**是延续旧类的功能
- **派生**是为了在旧类的基础上添加新的功能
- 作用:
- 用继承派生机制,可以将一些共有功能加在基类中,实现代码的共享
... |
C++ | UTF-8 | 809 | 2.78125 | 3 | [] | no_license | #pragma once
#include "Headers.h"
namespace Compiler
{
class LocalNode
{
int m_dimension;
int m_line;
SymbolCategory m_category;
std::string m_dataType;
std::string m_scope;
std::string m_name;
void* m_value;
LocalNode* m_nextNode;
public:
LocalNode(int line, std::str... |
C | UTF-8 | 1,675 | 3.78125 | 4 | [] | no_license | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define MAX 1000 // I initialize a global variable for the length of the array
int main(){
FILE* fp; // I initialize all the other variables starting from the file pointer pointer
char string[MAX]; // the s... |
Markdown | UTF-8 | 2,849 | 2.546875 | 3 | [] | no_license | # Trading Journal
**Version 1.0.0**
<div align="center">
<a href="#usage"><img src="https://tlc.thinkorswim.com/center/main/navigation/01/icon/img-release-notes" width="200px"></a>
<a href="#usage"><img src="https://upload.wikimedia.org/wikipedia/commons/8/86/Microsoft_Excel_2013_logo.svg" width="200px"></a>... |
JavaScript | UTF-8 | 886 | 3.25 | 3 | [] | no_license | // import de express
const express = require("express");
// definition de notre app
const app = express();
// le port d'écoute de notre serveur
const PORT = 3000;
// définition d'une route '/', la route par défaut.
// lorsqu'un client effectuera une requête sur ce endpoint
// on lui retournera le texte 'Hello World!... |
Java | UTF-8 | 505 | 2.8125 | 3 | [] | no_license | package lexer;
public class StringLexer extends BaseLexer {
private String source;
private int curr;
public StringLexer(String source) {
super(5);
this.source = source;
fillBuffer(buffers[0]);
}
protected void fillBuffer(char[] buffer) {
int j=0;
for (; cu... |
C | UTF-8 | 1,214 | 2.984375 | 3 | [] | no_license | /*
* Tapis.c
*
* Created on: Feb 16, 2020
* Author: zahrof
*/
#include "Tapis.h"
void mktapis(size_t maxsize, tapis * t, ft_event_t * cv, char * str){
t->nom=newcopy(str);
t->allocsize= maxsize;
t->begin=0;
t->sz=0;
t->cv=cv;
t->tab=malloc(maxsize*sizeof(paquet));
}
int empty(tapis * t){ return (t-... |
Python | UTF-8 | 557 | 4.3125 | 4 | [] | no_license | """
Your task is to make two functions, max and min (maximum and minimum in PHP and Python) that take a(n) array/vector of integers list as input and outputs, respectively, the largest and lowest number in that array/vector.
#Examples
maximun([4,6,2,1,9,63,-134,566]) returns 566
minimun([-52, 56, 30, 29, -54, 0, -110... |
PHP | UTF-8 | 770 | 2.53125 | 3 | [] | no_license | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Acelle\Model\Language;
class AddJapaneseLanguage extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if... |
Markdown | UTF-8 | 9,689 | 2.875 | 3 | [] | no_license | ---
title: Working for US companies as a resident in Europe
date: 2022-06-05
---
The goal of this blog post is to prepare EU- and EFTA remote prospective employees in talks with US
employers.
With an increase in the number of companies willing to support remote work there are new
complexities around payroll. When eve... |
Java | UTF-8 | 2,189 | 2.5625 | 3 | [] | no_license | package mlab.dataviz.entities;
import java.io.IOException;
import java.security.GeneralSecurityException;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import mlab.dataviz.util.Formatters;
public class DatastoreTest {
private static SimpleDateFo... |
PHP | UTF-8 | 855 | 2.5625 | 3 | [
"BSD-3-Clause"
] | permissive | <?php
namespace Yoast\PHPUnitPolyfills\Tests\Polyfills;
use PHPUnit\Framework\TestCase;
use Yoast\PHPUnitPolyfills\Polyfills\AssertNumericType;
/**
* Availability test for the functions polyfilled by the AssertNumericType trait.
*
* @covers \Yoast\PHPUnitPolyfills\Polyfills\AssertNumericType
*/
class AssertNumer... |
Python | UTF-8 | 316 | 3.640625 | 4 | [] | no_license | #https://leetcode.com/problems/reverse-words-in-a-string/
"""
Inp: " the sky is blue "
Out: "blue is sky the"
"""
class Solution(object):
def reverseWords(self, s):
"""
:type s: str
:rtype: str
"""
ans = s.split()[::-1]
return ' '.join(ans)
|
Markdown | UTF-8 | 475 | 3 | 3 | [
"MIT"
] | permissive | # A* Path Planner
This is the implementation of the popular A* path planner for the grid-map
context
## Conventions
As this is intended for a gridmap, we exploit the following conventions:
1. maps are represented my `numpy.array`s
2. because of this, data is organized in `[row, col]` order, _not_ `[x,y]` order
-... |
C# | UTF-8 | 717 | 3.15625 | 3 | [] | no_license | public static void BindEnumToCombobox<T>(this ComboBox comboBox, T defaultSelection)
{
var list = Enum.GetValues(typeof(T))
.Cast<T>()
.Select(value => new
{
(Attribute.GetCustomAttribute(value.GetType().GetField(value.ToString()), typeof(DescriptionAttribute)) as DescriptionAttrib... |
Java | UTF-8 | 1,168 | 2.265625 | 2 | [] | no_license | package com.eclubprague.cardashboard.core.views;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.eclubprague.cardashboard.core.R;
import com.eclubprague.cardashboard.core.model.resources.StringResource;
/**
* Created ... |
Java | UTF-8 | 1,692 | 3.75 | 4 | [] | no_license | /**
*
*/
package com.example.colllection.workingDemo;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* @author govindaraju.v
*
*/
public class ArrayListWorkingFlow {
public static void main(String[] args) {
List<Integer> nums = new ArrayList<>(10);
nums.add(1);
nums.add... |
Java | UTF-8 | 366 | 1.96875 | 2 | [] | no_license | package com.example.memberapp.repository;
import com.example.memberapp.model.Member;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface MemberRepository extends JpaRepository<Member, Long> {
Member findByEmail(String email);... |
Markdown | UTF-8 | 12,208 | 3.078125 | 3 | [] | no_license | # 06 | 嗨,别忘了UDP这个小兄弟
如果说 TCP 是网络协议的“大哥”,那么 UDP 可以说是“小兄弟”。这个小兄弟和大哥比,有什么差异呢?
**首先,UDP 是一种“数据报”协议,而 TCP 是一种面向连接的“数据流”协议。**
TCP 可以用日常生活中打电话的场景打比方,前面也多次用到了这样的例子。在这个例子中,拨打号码,接通电话,开始交流,分别对应了 TCP 的三次握手和报文传送。一旦双方的连接建立,那么双方对话时,一定知道彼此是谁。这个时候我们就说,这种对话是有上下文的。
同样的,我们也可以给 UDP 找一个类似的例子,这个例子就是邮寄明信片。在这个例子中,发信方在明信片中填上了接收方的地址和邮编,投递到... |
Java | UTF-8 | 976 | 2.078125 | 2 | [] | no_license | package project.restapi.service;
import project.restapi.domain.models.api.request.CourseAvailableStudentsRequest;
import project.restapi.domain.models.api.request.StudentAddRequest;
import project.restapi.domain.models.api.request.StudentAddToCourseRequest;
import project.restapi.domain.models.api.response.*;
import ... |
C# | UTF-8 | 430 | 3.609375 | 4 | [
"MIT"
] | permissive | using System;
using System.Linq;
class Program
{
static void Main() // 100/100
{
int[] arrays = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
bool same = true;
for (int i = 0; i < arrays.Length - 1; i++)
{
if (arrays[i] == arrays[i + 1])
{
... |
Markdown | UTF-8 | 1,469 | 2.96875 | 3 | [] | no_license | ### 安装方法
1、npm 安装
执行命令:`npm install vuedemo-npm-practice`
2、yarn 安装
执行命令:`yarn add vuedemo-npm-practice`
3、使用 vuedemo-npm-practice.js
### 使用方法
1、组件内部使用
html:
```javascript
<vuedemoNpmPractice :propData="initData"></vuedemoNpmPractice>
```
js:
```javascript
import vuedemoNpmPractice from "vuedemo-npm-practi... |
PHP | UTF-8 | 418 | 2.96875 | 3 | [] | no_license | <?php
function checkEmail($email){
$regex='/^[A-Za-z0-9]+[A-Za-z0-9]*@[A-Za-z0-9]+(\.[A-Za-z0-9]+)$/';
if(preg_match($regex,$email)){
echo "Valid";
}else{
echo "Invalid";
}
}
checkEmail('a@gmail.com');
echo "<br>";
checkEmail('ab@yahoo.com');
echo "<br>";
checkEmail('abc@hotmail.com');... |
PHP | UTF-8 | 552 | 2.640625 | 3 | [] | no_license | <?php
require_once("facebook-sdk/facebook.php");
$config = array(
'appId' => '552609414832678',
'secret' => 'f2c42a5725aa8950eb242c789e47a1d9',
'fileUpload' => false, // optional
'allowSignedRequest' => false, // optional, but should be set to false for non-canvas apps
);
$facebook = new Facebook($co... |
C# | UTF-8 | 1,586 | 3.90625 | 4 | [] | no_license | using DS.BinaryTree;
using System;
using System.Collections.Generic;
using System.Text;
namespace Algorithms.BinaryTree
{
public class Height
{
public static int MaxDepth(TreeNode root)
{
if (root == null || root.value == -1)
{
return 0;
}
... |
Swift | UTF-8 | 663 | 2.890625 | 3 | [] | no_license | //
// CountryListDetailWorker.swift
// CountryList
//
// Created by Z64me on 16/10/2562 BE.
// Copyright (c) 2562 Z64me. All rights reserved.
//
import UIKit
protocol CountryListDetailStoreProtocol {
func getDataCity(sent city_name:String ,_ completion: @escaping (Result<DataCity,Error>) -> Void)
}
class Count... |
Swift | UTF-8 | 9,107 | 3.03125 | 3 | [] | no_license | //
// ContentView.swift
// SwiftUICode
//
// Created by HuangSenhui on 2020/5/4.
// Copyright © 2020 H.Senhui. All rights reserved.
// 1. 卡片动画:
// 通过isShowCard属性,控制背景的偏移、旋转、缩放、动画时间
import SwiftUI
struct ContentView: View {
@State var isShowCard = false
@State var viewState = CGSize.zero
@State ... |
TypeScript | UTF-8 | 1,270 | 2.890625 | 3 | [] | no_license | input.onButtonPressed(Button.A, function () {
WantToPass = 1
})
function ResetLight () {
pins.digitalWritePin(DigitalPin.P2, 0)
pins.digitalWritePin(DigitalPin.P1, 0)
pins.digitalWritePin(DigitalPin.P0, 0)
pins.digitalWritePin(DigitalPin.P8, 0)
pins.digitalWritePin(DigitalPin.P16, 0)
}
function ... |
Java | UTF-8 | 283 | 2.609375 | 3 | [] | no_license | package expression.exceptions;
public class UnexpectedVariableNameException extends IllegalExpressionException {
public UnexpectedVariableNameException(String variableName, int pos) {
super("Unexpected variable name \"" + variableName + "\" at position " + pos);
}
}
|
JavaScript | UTF-8 | 868 | 2.9375 | 3 | [] | no_license | class Space {
constructor(args) {
let currArgs = args || {};
this._id = currArgs._id || null;
this.rows = currArgs.rows || new Range({start:1, end: 50});
this.columns = currArgs.columns || new Range({start:1, end: 50});
this.filled = currArgs.filled || [];
}
toObject() {
... |
Java | UTF-8 | 5,087 | 2.1875 | 2 | [
"BSD-3-Clause"
] | permissive | package gov.nih.nci.evs.restapi.util;
import gov.nih.nci.evs.restapi.bean.*;
import gov.nih.nci.evs.restapi.common.*;
import java.io.*;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.*;
import java.net.HttpURLConnection;
import java.net.MalformedURLExcepti... |
JavaScript | UTF-8 | 459 | 3.390625 | 3 | [
"BSD-2-Clause"
] | permissive | (function () {
'use strict';
let testString = 'this is a test string';
console.log(testString.length);
let strArr = testString.split(' ');
console.log(strArr);
console.log(testString.indexOf('is'));
console.log(testString.lastIndexOf('is'));
console.log(testString.toUpperCase());
... |
Rust | UTF-8 | 1,464 | 2.671875 | 3 | [
"MIT"
] | permissive | use std::error;
use clap;
use crate::config;
use super::executer::{Executer, ExecuterOptions};
pub struct Command<'c> {
config: &'c config::command::Config,
name: &'c str,
no_wait: bool,
}
impl<'c> Command<'c> {
pub fn from_args(config: &'c config::command::Config, args: &'c clap::ArgMatches<'c>) -... |
Swift | UTF-8 | 437 | 2.703125 | 3 | [] | no_license | //
// SupportedCurrenciesEntityList.swift
// Currency Conversion App
//
// Created by kitaharamugirou on 2019/05/25.
// Copyright © 2019 kitaharamugirou. All rights reserved.
//
import Foundation
struct SupportedCurrencyViewModel {
var threeLetter : String //e.g. USD
var countryName : String //e.g. United... |
PHP | UTF-8 | 18,929 | 3.15625 | 3 | [] | no_license | <?php
/**
* Clase NoticiaSeccion
*
* Esta clase hace referencia a la entidad noticia_seccion de la base de datos
* @author aocampo
* @version 1.0
* @since 2017-05-29 09:35:22
*/
Class NoticiaSeccion
{
//Atributos de la clase
private $conexion;
private $auditoria_tabla;
private $nts_id;
private $nts_id_tipo... |
Ruby | UTF-8 | 413 | 2.546875 | 3 | [
"BSD-3-Clause"
] | permissive | class << Time
# MIN = Time.at(0) # 1969-12-31 00:00:00 UTC
MIN = Time.at(-30610224000) # 1000-01-01 00:00:00 UTC
MAX = Time.at(253402300799) # 9999-12-31 23:59:59 UTC
def random(options = {}, m = Propr::Random)
min = (options[:min] || MIN).to_f
max = (options[:max] || MAX).to_f
m.bind(Flo... |
Python | UTF-8 | 3,053 | 2.6875 | 3 | [] | no_license | # encoding=utf-8
"""
Created on 16:47 2017/3/17
@author: Jindong Wang
"""
from sklearn.pipeline import Pipeline
from sklearn import preprocessing
import numpy as np
from sklearn.pipeline import FeatureUnion
import pandas as pd
def gene_feature(data_pd):
# numeric columns
col_binary = ['holiday', 'wor... |
Markdown | UTF-8 | 1,924 | 2.859375 | 3 | [] | no_license | A team of six developers are developing a Ruby on Rails application and their source code is being hosted on the company's own GitLab server. The application will be hosted on Heroku. They have set up a GitLab pipeline for rails (a GitLab runner), which includes three stages:
- build
- test
- deploy
In the build stage... |
Java | UTF-8 | 277 | 2.265625 | 2 | [] | no_license | package com.demoFunction.command.receiver;
/**
* 命令模式_具体执行者
*
* @author popkidorc
*
*/
public class MyCommandSaveReceiver {
private int count = 0;
public void count() {
count++;
System.out.println("==count==" + count);
}
}
|
Python | UTF-8 | 3,869 | 4.34375 | 4 | [] | no_license | # -*- coding: UTF-8 -*-
class SingleNode(object):
"""单链表节点"""
def __init__(self, item):
# elem存放数据元素
self.elem = item
# next存放下一个节点的标识
self.next = None
class SingleLinkList(object):
"""单链表"""
def __init__(self, node=None):
# 初始化单链表,默认值为None,便于创建空链表
sel... |
Python | UTF-8 | 317 | 2.546875 | 3 | [] | no_license | import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv("./data/fuel_consumption.csv")
cdf = df[['ENGINESIZE','CYLINDERS','FUELCONSUMPTION_COMB','CO2EMISSIONS']]
plt.scatter(cdf.FUELCONSUMPTION_COMB, cdf.CO2EMISSIONS, color='blue')
plt.xlabel("FUELCONSUMPTION_COMB")
plt.ylabel("Emission")
plt.show() |
Go | UTF-8 | 2,607 | 2.53125 | 3 | [
"MIT",
"BSD-3-Clause"
] | permissive | package client
import (
"net/http"
"os"
"testing"
"github.com/isfonzar/pagarme-go/internal/transactions"
)
func TestPagarmeClient_CreateTransaction(t *testing.T) {
address := transactions.Address{
Street: "Avenida Brigadeiro Faria Lima",
StreetNumber: "1811",
Neighborhood: "Jardim Paulistano",
... |
JavaScript | UTF-8 | 501 | 2.625 | 3 | [] | no_license | var express = require('express');
var app = express();
app.get('/', function (req, res) {
res.send('Hello World!');
});
app.get('/set/:url', function(req, res) {
res.send("Adding URL: " + req.param.url)
});
app.get('*', function(req, res){
//res.send(req.path);
res.redirect("http://google.com");
});
var server... |
C++ | UTF-8 | 6,364 | 3.265625 | 3 | [] | no_license | #ifndef __WUP__TOPK
#define __WUP__TOPK
#include <exception>
#include <iostream>
#include <cstring>
using std::ostream;
using std::istream;
namespace wup {
template <typename W, typename T>
class TopK {
public:
class TopKException : public std::exception {
public:
TopKException(const char * co... |
Python | UTF-8 | 2,076 | 2.859375 | 3 | [] | no_license | import gym
from gym import spaces
from QLearning.GridWorld.state import State
TRAP_REWARD = -1
GOAL_REWARD = +1
TIMESTEP_REWARD = -0.1
class GridEnv(gym.Env):
def __init__(self, layout_id=0):
super().__init__()
self.state = State(layout_id=layout_id)
self.time = 0
self.end_time = ... |
Markdown | UTF-8 | 7,026 | 3.5625 | 4 | [] | no_license | # 1.2 - Clock App
This next time app we're going to make is going to tell us what time it is! So a little bit more complex than a simple timer, but still utilizing many of the same lifestyle methods.
## Component Starter
To start we need to create a `ClockApp.js` file inside of our timer-apps folder. Your timer-apps... |
JavaScript | UTF-8 | 1,700 | 3.03125 | 3 | [] | no_license | import { patch, createVNode } from "./vdom.js";
/*
const createVButton = props => {
const { text, onclick } = props;
return createVNode("button", { onclick }, [text]);
};
const createVApp = store => {
const { count } = store.state;
return createVNode("div", { class: "container", "data-count": count }, [
... |
Markdown | UTF-8 | 347 | 2.953125 | 3 | [] | no_license | # Data-Wrangling
Data Wrangling is also known as 'data munging', is the process of transforming and mapping data from one "raw" data form into another format with the intent of making it more appropriate and valuable for a variety of downstream purposes such as analytics. A data wrangler is a person who performs these ... |
C | UTF-8 | 1,703 | 2.515625 | 3 | [] | no_license | /*
* gpio.c
*
* Created on: Oct 27, 2017
* Author: user
*/
/*
uint32_t *gpioGMode = (uint32_t*)(GPIOG_BASE+GPIOG_MODE);
uint32_t *gpioGOSPEED = (uint32_t*)(GPIOG_BASE+GPIOG_OSPEED);
uint32_t *gpioGOPupd = (uint32_t*)(GPIOG_BASE+GPIOG_PUPD);
uint32_t *gpioGOType = (uint32_t*)(GPIOG_BASE+GPIOG_OUT_TYPE);
uin... |
Java | UTF-8 | 1,806 | 1.976563 | 2 | [] | no_license | package com.avito.android.messenger.di;
import com.avito.android.analytics.screens.ScreenFlowTrackerProvider;
import com.avito.android.analytics.screens.TimerFactory;
import com.avito.android.analytics.screens.tracker.ScreenTrackerFactory;
import dagger.internal.Factory;
import dagger.internal.Preconditions;
import ja... |
SQL | UTF-8 | 2,671 | 3.546875 | 4 | [] | no_license | --SpoiledBeans table setup
--CREATE TABLE users (
--
-- id serial,
-- username varchar(25) UNIQUE NOT NULL,
-- password varchar(256) NOT NULL,
-- email varchar(256) UNIQUE NOT NULL,
-- firstname varchar(25),
-- lastname varchar(25),
-- bio varchar(256),
--
-- CONSTRAINT user_id
-- PRIMARY KEY (id)
--
--
--);
... |
Markdown | UTF-8 | 1,982 | 2.9375 | 3 | [] | no_license | ---
title: Java线程状态
category: 编程开发
tags: [Java]
---

### NEW
尚未启动的线程的线程状态。
```java
Thread thread = new Thread();
```
### RUNNABLE
已启动,等待CPU调度运行的线程状态。
```java
thread.start();
```
### BLOCKED
线程阻塞等待监视器锁的线程状态。等待进入synchr... |
SQL | UTF-8 | 1,566 | 4.03125 | 4 | [] | no_license | -- Load data into table
LOAD DATA INPATH '/user/w205/hospital_compare/effective_care/effective_care.csv' OVERWRITE INTO TABLE effective_care_raw;
-- Create a temporary table to hold the maximum value of the scores for each measure_id. Some of the scores are above 100
-- or are on different scales, so I want to normali... |
C | UTF-8 | 3,900 | 3.71875 | 4 | [] | no_license | #include "tree.h"
void insertTree(struct nodeAuthor* ptrAuthor, struct book* aBook) {
int lenght = strlen(aBook->author);
for (int i = 0; i < lenght; i++) {
char c = aBook->author[i];
int position = charToIndex(c);
if(position < 0 || position > ALPHA_SIZE)
position = getCus... |
Java | UTF-8 | 1,575 | 2.375 | 2 | [] | no_license | package uk.co.jaspalsvoice.jv.models;
import android.content.ContentValues;
import uk.co.jaspalsvoice.jv.db.DbOpenHelper;
/**
* Created by Ana on 3/21/2016.
*/
public class Medicine {
private String uuid;
private String id;
private String name;
private String dosage;
private String reason;
... |
C# | UTF-8 | 5,346 | 2.828125 | 3 | [] | no_license | using PuntuarCombateMarvel_DAL.Connections;
using PuntuarCombateMarvelUWP_Entities;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PuntuarCombateMarvelUWP_DAL.Lists
{
p... |
Ruby | UTF-8 | 2,081 | 2.515625 | 3 | [
"MIT"
] | permissive | class Message < ApplicationRecord
extend ActiveHash::Associations::ActiveRecordExtensions
UNLIMITED_FORM_AT = Time.zone.parse("1970-01-01 00:00:00")
UNLIMITED_TO_AT = Time.zone.parse("2101-01-01 00:00:00")
belongs_to :twitter_account
belongs_to :category
validates :from_at, presence: true
validates :to... |
Markdown | UTF-8 | 1,992 | 2.8125 | 3 | [] | no_license | ---
layout: post
title: Template Support | Toolbar | ASP.NET | Syncfusion
description: template support
platform: aspnet
control: Toolbar
documentation: ug
---
# Template Support
Templates allows you to insert custom or ASP.NET controls inside the toolbar items. You can also design simple dropdown buttons listing the... |
Java | UTF-8 | 752 | 2.265625 | 2 | [] | no_license | package com.github.cache.hystrix;
import com.netflix.hystrix.HystrixCommand;
import com.netflix.hystrix.HystrixCommandGroupKey;
/**
* 功能描述: 删除缓存
* @author: qinxuewu
* @date: 2019/11/13 16:26
* @since 1.0.0
*/
public class UpdateProductInfoCommand extends HystrixCommand<Boolean> {
private Long productId;
... |
C++ | UTF-8 | 253 | 2.640625 | 3 | [] | no_license | #pragma once
#include <iostream>
class Quest
{
public:
Quest(const std::string question,const std::string answer);
const std::string& getQuestion() const;
const std::string& getAnswer() const;
private:
std::string question;
std::string answer;
};
|
TypeScript | UTF-8 | 2,379 | 2.515625 | 3 | [] | no_license | import { Component, Input, OnInit, Output } from '@angular/core';
import { Pokemon } from '../fight/models/Pokemon';
import { FightService, FightState, Log } from '../fight/fight.service';
import { Observable } from 'rxjs';
import { PokemonService } from '../pokemon/pokemon.service';
import { ActivatedRoute, Router } f... |
Python | UTF-8 | 540 | 3.328125 | 3 | [
"MIT"
] | permissive | # Allowed symbols
SYMBOLS = '⇒⇔¬∧∨⊕()' # TODO?: '∀∃⊢'
class Var:
'''
Variable token: A way to differentiate variables from symbols
'''
def __init__(self, s):
self.s = s
def __repr__(self):
return self.s
def __str__(self):
return self.s
def __eq__(self, other):
... |
TypeScript | UTF-8 | 752 | 2.703125 | 3 | [
"MIT"
] | permissive | import { BaseMetric } from '../base';
import { Recall } from './recall';
import { Specificity } from './specificity';
export class PrevalenceThreshold extends BaseMetric {
name = 'prevalence threshold';
static range: [number, number] = [0, 1];
formula =
'\\frac{\\sqrt{true\\:positive\\:rate \\cdot (1 - true\... |
Markdown | UTF-8 | 1,634 | 3 | 3 | [] | no_license | # Simple Blog
A simple blog.
This project utilizes the latest JavaScript syntax available in NodeJS.
[Live Demo](https://simple-blog-bccpqpmxki.now.sh)
> Note: Deployment is not scaled and database is a free sandbox might take a while to fire up!
## Concepts Covered
- [x] REST API Architecture.
- [x] Promises usi... |
JavaScript | UTF-8 | 3,161 | 2.8125 | 3 | [] | no_license | window.addEventListener('hashchange', function(){
navlinks.style.display = 'none';
setTimeout(function(){
nav.classList.remove('expanded');
}, 50)
isNavbarOpen = false;
});
// navbar feature
var nav = document.querySelector('nav');
var menuBtn = document.querySelector('#menuBtn');
var navl... |
C# | UTF-8 | 346 | 2.609375 | 3 | [] | no_license | using System.Collections;
public class GainCoinsResolver : IResolvable {
public delegate int Count();
private Player player;
private Count count;
public GainCoinsResolver(Player player, Count count) {
this.player = player;
this.count = count;
}
public IEnumerator Resolve() {
yield return player.GainCoi... |
C++ | UTF-8 | 886 | 2.578125 | 3 | [] | no_license | // islands in graph
#include<bits/stdc++.h>
using namespace std;
#define R 5
#define C 5
vector<pair<int,int>>pp={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};
void dfs(int x,int y,int mat[R][C],int visited[R][C])
{
visited[x][y]=1;
for(int i=0;i<8;i++)
{
int newx=x+pp[i].first;
int newy=y+pp[i]... |
Shell | UTF-8 | 1,248 | 3.421875 | 3 | [] | no_license | #!/bin/sh
#
## builds CentOS-7-x86_64-autoinst.iso in ~
## expects ./ks.cfg present
## mucks around a bit; meant to be run in its own VM.
## dependencies
yum install genisoimage isomd5sum syslinux wget
## if not present, grab original centos iso
if [ ! -e CentOS-7-x86_64-Minimal-1804.iso ]
then
wget http://mirrorde... |
Python | UTF-8 | 5,891 | 3.25 | 3 | [] | no_license | class Controller:
filename="./"
def __init__(self, filename):
self.filename = filename
def select(self, id):
f = open(self.filename, "r")
records = f.readlines()
toReturn = []
if(id == ""):
for record in records:
toReturn.append(recor... |
JavaScript | UTF-8 | 322 | 3.546875 | 4 | [] | no_license | function circleArea(input) {
let type = typeof input;
if (type === `number`) {
let r = Number(input);
let S = Math.PI * r * r;
console.log(S.toFixed(2));
} else {
console.log(
`We can not calculate the circle area, because we receive a ${type}.`
);
}
}
circleArea(5);
circleArea("name")... |
Java | UTF-8 | 1,621 | 2.21875 | 2 | [] | no_license | package logging;
import io.restassured.RestAssured;
import io.restassured.response.Response;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import static io.restassured.RestAssured.given;
/**
* Created by Sergio on 12/9/18.
*/
public class ResponseLoginExample {
String consumer... |
Java | UTF-8 | 1,564 | 2.140625 | 2 | [] | no_license | package com.wisdom.controller;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.wisdom.... |
C# | UTF-8 | 1,161 | 2.765625 | 3 | [] | no_license | using UnityEngine;
namespace Assets.Scripts.Units
{
public class InputController : IBehaviourController
{
private readonly Quaternion _forwardDirection;
public bool IsActive => true;
public InputController(Vector3 forwardDirection)
{
_forwardDirection = Quaternion.Euler(forwardDirection);
}
public ... |
Markdown | UTF-8 | 421 | 2.9375 | 3 | [] | no_license | [Divide Two Integers - LeetCode](https://leetcode.com/problems/divide-two-integers/)
# V1
bit 操作 plus加倍法,
不用数学符号完成除操作,本质还是一个一个减被除数,看减了多少次,但是直接减算法效率明显不高O(n),
那么可以使用加倍法快速确定边界(数组扩容也用的这个原理)
提升效率到O(logn);
注意判断负数和被除数是0的情况。
|
Python | UTF-8 | 523 | 3.640625 | 4 | [] | no_license | '''Дано число A (> 1). Вывести наибольшее из целых чисел K, для которых сумма 1 + 1/2 + … + 1/K будет меньше A, и саму эту сумму. '''
def S(A):
if A == 0: return 0
return S(A-1) + 1/A
def f(I, S, K):
s=S
k=K
if i == 1:
return 1.0, 1
if s >= 0:
while s < I:
k += 1
s += 1/k
return s, k... |
PHP | UTF-8 | 1,006 | 2.8125 | 3 | [
"MIT"
] | permissive | <?php
/**
* FuelIgniter
*
* @author Kenji Suzuki https://github.com/kenjis
* @copyright 2012 Kenji Suzuki
* @license MIT License http://opensource.org/licenses/MIT
* @link https://github.com/kenjis/FuelIgniter
*/
class CI_DB
{
private $db = null;
public function get($table = '', $limit = null, $offse... |
Java | UTF-8 | 722 | 2.234375 | 2 | [] | no_license | package javasScriptExecutor;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.remote.RemoteWebDriver;
import io.github.bonigarcia.wdm.WebDriverManager;
public class JsDemoCli... |
Java | UTF-8 | 4,202 | 3.15625 | 3 | [] | no_license | package com.rsanchezg.business.logic;
import com.rsanchezg.business.domain.RomanNumber;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author raasan... |
Java | UTF-8 | 1,619 | 1.773438 | 2 | [] | no_license | package tp.pr5.lang;
public class CmdDic {
public static final String dropHelp = "Usage: DROP | SOLTAR <id>";
public static final String[] dropCommand = {"DROP", "SOLTAR"};
public static final String helpHelp = "Usage: HELP | AYUDA";
public static final String[] helpCommand = {"HELP", "AYUDA"};
public static... |
Markdown | UTF-8 | 4,591 | 3.296875 | 3 | [] | no_license | # APS360
Artificial Intelligence Fundamentals
<br>
<h3>Pneumonia Detetction (Course Project)</h3>
<p>The purpose of this project is to automate the classification of pneumonia given an image of a chest X-ray and detecting the presence of lung opacities. The dataset consists of chest X-rays of children aged 1–5 years ... |
C++ | UTF-8 | 1,753 | 3.375 | 3 | [
"MIT"
] | permissive | #include "storage_manager.hpp"
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "utils/assert.hpp"
namespace opossum {
StorageManager& StorageManager::get() {
static StorageManager _instance;
return _instance;
}
void StorageManager::add_table(const std::string& name, std::share... |
SQL | UTF-8 | 16,609 | 3.203125 | 3 | [
"MIT"
] | permissive | -- phpMyAdmin SQL Dump
-- version 4.9.0.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Nov 20, 2019 at 09:48 AM
-- Server version: 10.3.15-MariaDB
-- PHP Version: 7.3.6
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @O... |
Python | UTF-8 | 3,732 | 3.265625 | 3 | [
"MIT"
] | permissive | # Python 3.5.2 |Anaconda 4.2.0 (64-bit)|
# -*- coding: utf-8 -*-
"""
Last edited: 2017-09-13
Author: Jeremias Knoblauch (J.Knoblauch@warwick.ac.uk)
Forked by: Luke Shirley (L.Shirley@warwick.ac.uk)
Description: Implements class CpModel, the Changepoint model used by the
Bayesian Online CP detection. The objects of th... |
Python | UTF-8 | 1,140 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | import yaml
import argparse
from rf_client import *
# read config
with open("cfg/config.yaml", 'r') as yaml_file:
config = yaml.load(yaml_file)
# rfclient init
rfclient = RFClient(config)
rfclient.datasource = {"id": "6d03b24d-5a29-4004-a27f-3dda48e2eedb"}
rfclient.bands = [{
"number": 0,
... |
Python | UTF-8 | 478 | 2.9375 | 3 | [] | no_license | import sys
from operator import itemgetter
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
def ii(): return int(input())
def mi(): return map(int, input().split())
def lmi(): return list(map(int, input().split()))
def lmif(n): return [list(map(int, input().split())) for _ in range(n)]
def ss(): return input()... |
C# | UTF-8 | 1,694 | 2.515625 | 3 | [] | no_license | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraController : MonoBehaviour {
// VARIABLES
public float zoomSpeed = 4.0f;
public float moveSpeed = 4.0f;
private float verMoveSpeed = 0.0f;
private float horMoveSpeed = 0.0f;
private float zoom = -10.0f;
private... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.