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 | 986 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 29 20:13:41 2020
@author: rian-van-den-ander
"""
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.ensemble import RandomForestClassifier
df = pd.read_c... |
Python | UTF-8 | 1,359 | 3.671875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Oct 14 01:52:14 2020
@author: Sourabh
"""
import pandas as pd
file=r'C:\Users\mahesh\Desktop\Python Assign\Data.csv'
df=pd.read_csv(file)
print(df)
print("----------------------------------------------------")
#Find Male Employee
print("MALE EMPLOYEE")
male = df.loc[(df['... |
Java | UTF-8 | 1,395 | 3.515625 | 4 | [] | no_license | package com.pigcanfly.leetcoding.s442;
import java.util.ArrayList;
import java.util.List;
/**
* @author tobbyquinn
* @date 2019/11/29
*/
public class FindAllDuplicatesinanArray {
public List<Integer> findDuplicates(int[] nums) {
int left = 0;
while (left < nums.length) {
if (nums[le... |
Java | UTF-8 | 1,224 | 2.328125 | 2 | [] | no_license | package app.core;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import app.core.login.Logi... |
TypeScript | UTF-8 | 8,240 | 3.609375 | 4 | [] | no_license | import * as _ from "lodash";
export class StringPoc {
public test() {
this.camelCaseFunc();
}
public camelCaseFunc() {
_.camelCase("Foo Bar");
// => 'fooBar'
_.camelCase("--foo-bar--");
// => 'fooBar'
_.camelCase("__FOO_BAR__");
// => 'fooBar'
... |
C# | UTF-8 | 2,752 | 2.90625 | 3 | [
"MIT"
] | permissive | namespace SRF
{
using System.Collections.Generic;
using UnityEngine;
public static class SRFTransformExtensions
{
public static IEnumerable<Transform> GetChildren(this Transform t)
{
var i = 0;
while (i < t.childCount)
{
yield return... |
C++ | UTF-8 | 1,815 | 3.1875 | 3 | [] | no_license | #ifndef _COMPUTER_HPP
#define _COMPUTER_HPP
#include "player.hpp"
class Computer : public Player
{
public:
int x;
int y;
int xPiece;
int yPiece;
bool makeMove(int x, int y, Board* board){return false;}
bool select(int x, int y, Board* board){return false;}
void makeMove(s... |
Java | UTF-8 | 511 | 3.578125 | 4 | [] | no_license | package objects_classes_methods.labs;
import java.awt.*;
/**
* Objects, Classes and Methods Exercise 4:
*
* Demonstrate method overloading with at least three overloaded methods.
*
*/
class Overload{
public void makePost(String text){
//Makes a post containing only text.
}
public void mak... |
C++ | UTF-8 | 2,056 | 2.765625 | 3 | [] | no_license | #include <algorithm>
#include "truck.h"
#include "MPRNG.h"
#include <iostream>
using namespace std;
extern MPRNG mprng;
Truck::Truck( Printer & prt, NameServer & nameServer, BottlingPlant & plant, unsigned int numVendingMachines, unsigned int maxStockPerFlavour ) :
printer(prt),
nameServer(nameServer),
... |
Python | UTF-8 | 3,524 | 3.125 | 3 | [
"MIT"
] | permissive | from abc import ABCMeta, abstractmethod
import numpy as np
class LossFunction:
__metaclass__ = ABCMeta
@abstractmethod
def __init__(self, **kwargs):
pass
@abstractmethod
def loss(self, edges_batch, distance_info):
return 0.
@abstractmethod
def loss_gradient(self, edges_... |
C# | UTF-8 | 451 | 2.84375 | 3 | [] | no_license | public void UpdateCategory(Category category)
{
using (var Context = new AppDbContext())
{
Context.Entry(category).State = System.Data.Entity.EntityState.Modified;
Context.SaveChanges();
}
}
-> you use two different `DbContext`'s together (which can cause problems with change tracking)!
**Solution:... |
Java | UTF-8 | 1,682 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | package com.github.TKnudsen.infoVis.view.painters.string;
import com.github.TKnudsen.infoVis.view.frames.SVGFrame;
import com.github.TKnudsen.infoVis.view.frames.SVGFrameTools;
import com.github.TKnudsen.infoVis.view.painters.grid.Grid2DPainterPainter;
import com.github.TKnudsen.infoVis.view.painters.string.Strin... |
TypeScript | UTF-8 | 269 | 3.109375 | 3 | [
"MIT"
] | permissive | function toStringSet(thing: unknown): Set<string> {
const set = new Set<string>();
if (Array.isArray(thing)) {
for (const item of thing) {
if (typeof item === 'string') {
set.add(item);
}
}
}
return set;
}
export { toStringSet };
|
Java | UTF-8 | 491 | 2.28125 | 2 | [
"MIT"
] | permissive | package com.projectx.sdk.user.impl;
public class LoginCredentials {
String login;
String password;
public LoginCredentials() {
}
public LoginCredentials(String login, String password ) {
setLogin( login );
setPassword( password );
}
public String getLogin() {
return login;
}
public void setLogin(St... |
Python | UTF-8 | 682 | 4 | 4 | [] | no_license | # Iterative Apprach
def gcdIter(a, b):
'''
a, b: positive integers
returns: a positive integer, the greatest common divisor of a & b.
'''
# Your code here
min = 0
if a < b:
min = a
max = b
else:
min = b
max = a
for i in range(min,0,... |
C# | UTF-8 | 963 | 2.9375 | 3 | [] | no_license | using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using System.Linq;
namespace HelloWorldFromDB
{
public class HelloWorldRepositoryContext : DbContext
{
public DbSet<Messages> Messages { get; set; }
public HelloWorldRepositoryContext(DbContextOptions<HelloWorldR... |
Markdown | UTF-8 | 6,897 | 2.609375 | 3 | [] | no_license | tags: read
title: 《RESTful Web APIs中文版》-目录
### 第1 章 网上冲浪 1
场景1 :广告牌 2
资源和表述 2
可寻址性 3
场景2 :主页 3
短会话(Short Session) 5
自描述消息(self-descriptive message) 5
场景3 :链接 6
标准方法 8
场景4 :表单和重定向 9
应用状态(Application State) 11
资源状态(resource state) 12
连通性(connectedness) 13
与众不同的Web 14
Web API 落后于Web 15
语义挑战... |
Java | UTF-8 | 4,712 | 2.859375 | 3 | [
"Unlicense"
] | permissive | package training.concurrency.ex_3.cache;
import net.jcip.annotations.ThreadSafe;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ExecutionException;
import static ... |
C# | UTF-8 | 18,245 | 2.71875 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
namespace PbrResourceUtils.Model
{
public static class SegmentedCylinder
{
//All directions are assumed to be normalized
public class Segment
{
... |
PHP | UTF-8 | 12,192 | 2.59375 | 3 | [] | no_license | <?php
$currentLocation = "";
// ---------------------------------------------------------------------------------------------------------------------
// Here comes your script for loading from the database.
// ------------------------------------------------------------------------------------------------------... |
Markdown | UTF-8 | 9,006 | 3.53125 | 4 | [] | no_license | # 第824期 | 为什么会有「法币」制度?
> 罗辑思维
2019-10-07
上周,我们有一期节目讨论了银行和国家之间的关系。银行并不是自由市场竞争的参与者,恰恰相反,它是国家赋予了特权的垄断经营者。没有国家撑腰,根本就没有现代银行。那你说自由市场竞争里的金融业什么样呢?就是中国传统的钱庄票号的样子。在现代银行的面前,它们根本就没有丝毫竞争力。
那今天,我们再来聊聊货币,为什么国家也要把货币牢牢控制在自己手里?
有一个词,叫「法币」,法定货币的意思。你拿到了这种货币,国家不承诺一定会兑换成多少黄金或者实物,这张纸的背后只有一样东西,那就是国家的信用。现在的美元是法币,人民币也是法币。
很多人就说了,这种法币制度不好,肯定... |
Go | UTF-8 | 2,914 | 3.015625 | 3 | [] | no_license | package builder
import (
"bytes"
"image"
"image/color"
"image/draw"
"image/gif"
"io"
"os"
)
type MatrixToken uint32
const (
WALL MatrixToken = 1 << iota
PATH
BORDER
START
END
)
type MazeImageMatrix struct {
M [][]MatrixToken
I *MazeImageBuilder
}
func (i MazeImageMatrix) Has(x, y int, t MatrixToken) ... |
Go | UTF-8 | 3,914 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive | package xchacha20poly1305
import (
"bytes"
"encoding/hex"
"testing"
)
func toHex(bits []byte) string {
return hex.EncodeToString(bits)
}
func fromHex(bits string) []byte {
b, err := hex.DecodeString(bits)
if err != nil {
panic(err)
}
return b
}
func TestHChaCha20(t *testing.T) {
for i, v := range hChaCha... |
Java | UTF-8 | 622 | 2.046875 | 2 | [] | no_license | package com.github.guilhermesgb.steward.mvi.customer.schema;
import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.OnConflictStrategy;
import android.arch.persistence.room.Query;
import java.util.List;
import io.reactivex.Single;
@Dao
public inte... |
Python | UTF-8 | 1,225 | 2.921875 | 3 | [] | no_license | import numpy as np
# functions to create elementary matrices for gaussian elimination row ops
size = 5
u = np.random.uniform(-1, 1, size=(size, 1)) + np.random.uniform(-1, 1, size=(size, 1)) * 1j
v = np.random.uniform(-1, 1, size=(size, 1)) + np.random.uniform(-1, 1, size=(size, 1)) * 1j
A = np.eye(size) - u @ v.T
#... |
Python | UTF-8 | 800 | 2.53125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python3
# config_exceptions.py
class ConfigError(Exception):
def __init__(self, message='Invalid configuration for environment variable conversion'):
super(ConfigError, self).__init__(message)
class PythonConfigError(ConfigError):
def __init__(self, message='Invalid Python configuration f... |
Markdown | UTF-8 | 11,021 | 2.765625 | 3 | [
"MIT"
] | permissive | title: CodePush
date: 2016-03-23 11:24:22
tags: [iOS,ReactNative]
---
## 简介
[CodePush](http://codepush.tools)是提供给 React Native 和 Cordova 开发者直接部署移动应用更新给用户设备的云服务。CodePush 作为一个中央仓库,开发者可以推送更新到 (JS, HTML, CSS and images),应用可以从客户端 SDKs 里面查询更新。CodePush 可以让应用有更多的可确定性,也可以让你直接接触用户群。在修复一些小问题和添加新特性的时候,不需要经过二进制打包,可以直接推送代码进行实时更新。
[... |
Python | UTF-8 | 2,626 | 3.15625 | 3 | [] | no_license | import os
import re
#Divido el texto por oraciones
def div_oraciones(x):
return x.split('.')
#Me quedo solo con las oraciones con números, que son los que tienen datos
def numeros(x):
L =[]
for i in x:
if any(map(str.isdigit, i)):
L.append(i)
return(L)
#Uno los va... |
C++ | UTF-8 | 388 | 2.546875 | 3 | [] | no_license | #ifndef GL_CYLINDER_H
#define GL_CYLINDER_H
#include "Mesh.h"
/* A mesh that represents a cylinder. The level of detail/smoothness
* can be specified in the constructor. */
class Cylinder : public Mesh
{
public:
Cylinder(float height, float radius, int numSegments);
virtual ~Cylinder();
TexCoord computeTexCoor... |
Markdown | UTF-8 | 1,072 | 2.578125 | 3 | [] | no_license | ---
layout: page
title: About
---
# About
Roboism is a podcast about robots, technology, and feminism, but mostly robots.
### Hosts
Alex and Savannah work out of the same co-working space. In the summer of 2015, they discovered a mutual love of robots, and figured the world ought to know. Thus, we have Roboism.
Sh... |
SQL | UTF-8 | 6,862 | 3.0625 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 21-04-2019 a las 17:26:54
-- Versión de PHP: 7.3.4
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=... |
SQL | UTF-8 | 807 | 3.625 | 4 | [] | no_license | --This query joins on the address Base plus data we loaded with a polygon shape stored in the myshapes table
--This isn't necessary for the discovery tool to work. It is just an example of how to do a spatial join using the Addressbase data
SELECT pt.*, py.*
FROM os_address.addressbase pt
JOIN os_address.myshapes py
... |
TypeScript | UTF-8 | 1,287 | 2.765625 | 3 | [] | no_license | // 在此处添加您的代码
enum PIN {
P0 = 3,
P1 = 2,
P2 = 1,
P8 = 18,
//P9 = 10,
P12 = 20,
P13 = 23,
P14 = 22,
P15 = 21,
};
//color=#6699CC
//% weight=10 color=#378CE1 icon="\uf101" block="URM09 Trig"
namespace trig {
//%block="get %pin pin ultrasonic sensor range units(cm)"
export fu... |
Python | UTF-8 | 123 | 2.828125 | 3 | [] | no_license |
def is_subset(lst1, lst2):
for i in lst1:
if i not in lst2:
return False
break
else:
return True
|
C# | UTF-8 | 5,256 | 2.609375 | 3 | [
"MIT"
] | permissive | using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;
using RecipeApp.Shared.Models;
using RecipeApp.Shared.Settings;
using RecipeApp.UI.WPF.Models;
using RecipeApp.UI.WPF.Settings;
namespace RecipeApp.UI.WPF.Services
{
public class RecipeService: IRecipeService
... |
Python | UTF-8 | 283 | 2.84375 | 3 | [] | no_license | import cv2
import imutils
img = cv2.imread("image.png")
cv2.imshow("origin", img)
#rotate 45도
rotated = imutils.rotate(img, 45)
cv2.imshow("rotate 45", rotated)
#rotate bound 45도
rotated = imutils.rotate_bound(img, 45)
cv2.imshow("rotate bound 45", rotated)
cv2.waitKey(0)
|
Java | UTF-8 | 2,592 | 2.28125 | 2 | [] | no_license | package pages;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.ExpectedConditions;
import java.util.List;
import java.util.logging.Logger;
public class SearchPage extends Page {
private static final Logger log = Logger.getLogger(String.valu... |
Python | UTF-8 | 284 | 2.65625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import math
import sys
import collections
last = (4, 6)
for i in xrange(1):
print 0 + last[0], 0 + last[1]
print -3 + last[0], 0 + last[1]
print -3 + last[0], -4 + last[1]
print -2 + last[0], -1 + last[1]
last = (2 + last[0], 4 + last[1])
|
Python | UTF-8 | 530 | 2.9375 | 3 | [] | no_license | import json
import requests
from binascii import unhexlify
encrypted_flag = requests.get(f'http://aes.cryptohack.org/block_cipher_starter/encrypt_flag/')
ciphertext = json.loads(encrypted_flag.content)['ciphertext']
print("Ciphertext : {}".format(ciphertext))
plaintext_hex = requests.get(f'http://aes.cryptohack.o... |
C++ | UTF-8 | 3,445 | 3.265625 | 3 | [] | no_license | class max_heap {
vector<int> index; // id -> index into values
vector<pair<int, int>> values; // first is the height, second is id
int size;
void swap_node(int index1, int index2) {
swap(index[values[index1].second], index[values[index2].second]);
swap(values[index1], values[index2]... |
Markdown | UTF-8 | 893 | 2.671875 | 3 | [] | no_license | # flutter-web-example project
## Architecture
Bloc architecture is used for flutter-web-example. Bloc architecture separates the view (main_page.dart) from the business logic (model/letter_creator.dart) through a bloc class (bloc/letter_bloc.dart) that is inherited in child widgets through a provider pattern. A stream... |
JavaScript | UTF-8 | 1,138 | 3.765625 | 4 | [] | no_license | /**
* @param {ListNode} l1
* @param {ListNode} l2
* @return {ListNode}
*/
function ListNode(val) {
this.val = val;
this.next = null;
}
const mergeTwoLists = function (l1, l2) {
let new_node;
if (l1 && l2) {
if (l1.val < l2.val) {
new_node = l1;
l1 = l1.next
}... |
Ruby | UTF-8 | 631 | 3.390625 | 3 | [] | no_license | class PhoneNumber
attr_reader :number
def initialize(value)
clean_number(value)
end
def area_code
@number[0..2]
end
def to_s
"(#{area_code}) #{@number[3..5]}-#{@number[6..9]}"
end
private
def clean_number(value)
@number = value.to_s
remove_non_digits
pop_one_off_eleven_digi... |
Shell | UTF-8 | 766 | 3.484375 | 3 | [] | no_license | #!/bin/bash
pushd ${0%/*}
ZOTONIC_SRC=${ZOTONIC_SRC:=/home/kaos/zotonic}
# /path/to/zotonic/modules/<mod>/scomps/scomp_<mod>_scomp_name.erl
for f in `find $ZOTONIC_SRC/modules -name scomp_\*`
do
read -r mod scomp <<EOF
`echo $f | sed -e 's,.*/mod_\([^/]*\).*/scomp_\1_\(.*\).erl,mod_\1 \2,'`
EOF
echo mod: $mo... |
JavaScript | UTF-8 | 326 | 3.203125 | 3 | [
"Apache-2.0"
] | permissive | timer = null; // stores ID of interval timer
function delayMsg() {
if (timer === null) {
timer = setInterval(rudy, 1000);
} else {
clearInterval(timer);
timer = null;
}
}
function rudy() { // called each time the timer goes off
document.getElementById("output").innerHTML += "Rud... |
Python | UTF-8 | 16,841 | 3.171875 | 3 | [] | no_license | # imports
import pandas
import numpy
import matplotlib.pyplot as plt
from pip._vendor.distlib.compat import raw_input
import sklearn.model_selection
def perceptron(x, t, maxepochs, beta): # perceptron function
w = numpy.random.randn(len(x[0]), 1) # filling the w by random numbers
flag = True # initializing... |
C# | UTF-8 | 1,609 | 2.578125 | 3 | [] | no_license | using Microsoft.Kinect;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Numerics;
using System.Xml.Serialization;
namespace Kinect_ing_Pepper.Models
{
public class BodyFrameWrapper
{
public System.Numerics.Vector4 FloorCl... |
JavaScript | UTF-8 | 4,328 | 2.515625 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | /*
Copyright 2019 Adobe Inc. All rights reserved.
This file is licensed to you 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 law or ... |
C++ | UTF-8 | 1,892 | 2.78125 | 3 | [] | no_license | #pragma once
#include "input_layer.h"
namespace tiny_cnn {
class layers {
public:
layers() { add(std::make_shared<input_layer>()); }
layers(const layers& rhs) { construct(rhs); }
layers& operator = (const layers& rhs) {
layers_.clear();
construct(rhs);
return *this;
}
/**** input new_tail to la... |
JavaScript | UTF-8 | 1,500 | 3.046875 | 3 | [
"MIT"
] | permissive | /*
存储localstorage时候最好是封装一个自己的键值,在这个值里存储自己的内容对象,封装一个方法针对自己对象进行操作。避免冲突也会在开发中更方便。
*/
export default (function mystorage () {
let ms = 'mystorage'
let storage = window.localStorage
if (!window.localStorage) {
alert('浏览器支持localstorage')
return false
}
let set = function (key, value) {
// 存储
let my... |
Python | UTF-8 | 1,157 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python
import sys
if len(sys.argv[1:]) < 2:
sys.stderr.write("ERROR: missing argument\nUsage:\nparse_csv_tree.py <tree.csv> <tree.new.csv>\n\n")
sys.exit(1)
it,ot = sys.argv[1:]
f = open(it,'r')
f = f.readlines()
o = open(ot,'w')
dic_h = {}
c = 0
for branch in f:
branch = branch.split(',')
dic_... |
Java | UTF-8 | 683 | 1.703125 | 2 | [] | no_license | package com.shoniz.saledistributemobility.data.sharedpref.api;
import com.shoniz.saledistributemobility.data.api.retrofit.ApiException;
import com.shoniz.saledistributemobility.data.model.order.OrderDetailEntity;
import com.shoniz.saledistributemobility.data.model.order.OrderEntity;
import com.shoniz.saledistributemob... |
Ruby | UTF-8 | 276 | 3.296875 | 3 | [] | no_license | puts "What is your email?"
email = gets.chomp
File.read('email-list.txt').each_line do |l|
if l.include? email
l.slice! email
l.slice! "name: "
l.slice! "email: "
puts "Hello " + l.capitalize
exit
end
end
puts "Your email address is not on the list." |
C# | UTF-8 | 1,098 | 3.328125 | 3 | [] | no_license | using System;
namespace Mankind
{
class Program
{
static void Main(string[] args)
{
string[] singleStudent = Console.ReadLine().Split();
string firstStudentName = singleStudent[0];
string lastStudentName = singleStudent[1];
string facultyNumber =... |
C# | UTF-8 | 1,807 | 2.640625 | 3 | [] | no_license | namespace EGift.Services.Merchants.Extensions
{
using System;
using System.Data;
using EGift.Services.Merchants.Messages;
using EGift.Services.Merchants.Models;
public static class DataTableExtension
{
public static GetAllMerchantResponse AsGetAllMerchantResponse(this DataTabl... |
Swift | UTF-8 | 3,306 | 2.890625 | 3 | [] | no_license | //
// JSONHelper.swift
// What to Pack
//
// Created by MoXiafang on 3/12/16.
// Copyright © 2016 Momo. All rights reserved.
//
import Foundation
import SwiftyJSON
class JSONHelper: NSObject {
static let sharedInstance = JSONHelper()
func jsonParsingFromFile() {
var mainJSON: JS... |
JavaScript | UTF-8 | 6,044 | 2.578125 | 3 | [] | no_license | var io = require('socket.io')(3000);
var Firebase = require('firebase');
var p2p = require('socket.io-p2p-server').Server;
//we use peer ti peer to peer connection
io.use(p2p);
//we get a reference to our database
var reference = new Firebase('https://webtogocameroon.firebaseio.com/');
io.on('connection', function(soc... |
Markdown | UTF-8 | 962 | 3.1875 | 3 | [] | no_license | # IntegralFunction
**Задача**
Реализуйте метод, выполняющий численное интегрирование заданной функции на заданном интервале по формуле левых прямоугольников.
**Подробнее**
Функция задана объектом, реализующим интерфейс java.util.function.DoubleUnaryOperator. Его метод applyAsDouble() принимает значение аргумента и ... |
Markdown | UTF-8 | 831 | 2.65625 | 3 | [
"MIT"
] | permissive | ---
layout: post
microblog: true
audio:
photo:
date: 2018-08-02 18:44:38 +0100
guid: http://lukas.micro.blog/2018/08/02/you-have-never.html
---
You have never created a machine-readable API specification with OpenAPI because you didn't know how to start?! Lucky for you, I've written a practical tutorial that does a l... |
Python | UTF-8 | 1,587 | 2.96875 | 3 | [] | no_license | import numpy as np
from math import exp
def init_network():
layers=list()
input_layer=np.array([[-1.0,1.0],[1.0,1.0]])
hidden_layer=np.array([[1.0,1.0],[-1.0,1.0]])
layers.append(input_layer)
layers.append(hidden_layer)
return layers
def forward_prop(network,inputs,activator):
outputs=list()
for layer in netw... |
Markdown | UTF-8 | 3,401 | 4.03125 | 4 | [] | no_license | ###07-08
#函数
##函数参数
```
<script type="text/javascript">
// 自定义函数后的括号里面写参数
function show(name){
alert('Hi'+name);
}
// 调用函数,把括号里面的值传到参数里面去
show('Jo');
</script>
```
###css函数
* 修改样式时直接调用css函数即可
```
// obj接收修改的元素 attr接收修改元素的属性 value接收修改的具体值
function css(obj,attr,value){
// 注意此处必须用中括号,不能用点,用点必须有该属性
o... |
JavaScript | UTF-8 | 5,330 | 2.53125 | 3 | [] | no_license | import React from 'react'
import "./src/css/home.css"
import FetchApi from "../../../utils/FetchAPI";
import AuthService from "../../../handlers/prof/AuthService";
export default class HomeIndex extends React.Component {
constructor() {
super();
this.state = {
topic: "",
que... |
Java | UTF-8 | 1,188 | 2.6875 | 3 | [] | no_license | package be.vdab.oefenen;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
public class IsbnTest {
@Test
public void nummerMet13CijfersMetCorrectControleGetalIsOK() {
new Isbn(9786541237853L);
}
@Test
public void nummerVeranderenNaarToString() {
long nummer = 9786541237853L;... |
PHP | UTF-8 | 265 | 2.921875 | 3 | [
"Apache-2.0",
"CC-BY-3.0"
] | permissive | <?php
/**
* Gets the timestamp of the first sample from rrd file.
*
* @phpstub
*
* @param string $file
* @param int $raaindex
*
* @return int Integer number of unix timestamp, false if some error occurs.
*/
function rrd_first($file, $raaindex = false)
{
} |
Python | UTF-8 | 451 | 2.53125 | 3 | [] | no_license | def estaDisponivel(listaMaquinas):
for maquina in listaMaquinas:
if (maquina.emFuncionamento == False):
return maquina
return False
def temTarefa(listaFuncionarios):
for funcionario in listaFuncionarios:
if(funcionario.getTamanho() != 0):
return {
... |
Java | UTF-8 | 231 | 2.0625 | 2 | [] | no_license | package rozprochy.rok2012.lab1.zad4.fsm;
public class AbstractState implements State {
@Override
public void onBegin() {
// do nothing
}
@Override
public void onEnd() {
// do nothing
}
}
|
Python | UTF-8 | 139 | 3.5625 | 4 | [] | no_license | def dec_to_bin(number):
if number < 2:
return str(number)
else:
return dec_to_bin(number/2) + dec_to_bin(number%2)
|
C++ | UTF-8 | 1,056 | 2.8125 | 3 | [] | no_license | #include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
double a,v,l,d,w,t,t1;
double fun( double a,double b,double c )
{
double del=b*b-4*a*c;
if ( del<0 ) return 0;
return ( -b+sqrt(del) )/(2*a);
}
int main()
{
cin>>a>>v;
cin>>l>>d>>w;
cout<<fixed<<setprecision(12);
... |
JavaScript | UTF-8 | 1,134 | 2.53125 | 3 | [] | no_license | import { useEffect } from 'preact/hooks'
import isBrowser from '../../utils/isBrowser'
const scrollingElement = isBrowser ? window.document.scrollingElement : {}
export const getCallbackArgs = () => ({
windowHeight: scrollingElement.offsetHeight || 0,
scrollTop: scrollingElement.scrollTop || 0,
scrollLeft: sc... |
Python | UTF-8 | 1,140 | 2.53125 | 3 | [] | no_license | import asyncio
from asyncio import ensure_future
from typing import Iterator, AsyncIterator
from .sensor import TemperaturesSource, Temperature
class NoActiveDisksError(Exception):
pass
class DiskError(Exception):
pass
class Disk:
def __init__(self, device_name: str, **kwargs):
super().__init... |
Markdown | UTF-8 | 2,788 | 3 | 3 | [] | no_license | ---
author: [Alfresco Documentation, Alfresco Documentation]
audience:
---
# Configuring external authentication
Use these instructions to configure external authentication using the configuration properties in the Admin Console.
1. Open the Admin Console.
2. In the Directories section, click **Directory Managem... |
Java | UTF-8 | 1,299 | 1.921875 | 2 | [] | no_license | package com.spboot.ang.component;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigure... |
C++ | UTF-8 | 1,006 | 2.765625 | 3 | [] | no_license | //
// Created by bytedance on 2021/11/20.
//
#include "simple_decoder.h"
#include <vector>
#include <cassert>
int main()
{
{
// can create wav file from path
const char* path = "/Users/bytedance/Downloads/2_114_下雨天_bip_1.wav";
SimpleWavDecoder* decoder = SD_createFromFile(path);
as... |
Java | UTF-8 | 4,890 | 1.976563 | 2 | [] | no_license | package com.adpanshi.cashloan.business.cr.controller;
import com.adpanshi.cashloan.business.core.common.context.Constant;
import com.adpanshi.cashloan.business.core.common.util.JsonUtil;
import com.adpanshi.cashloan.business.core.common.util.RdPage;
import com.adpanshi.cashloan.business.core.common.util.ServletUtils;
... |
Ruby | UTF-8 | 524 | 3.25 | 3 | [] | no_license | require 'pry'
types = ['beam']
# Start of user-program interaction
puts 'Welcome to reinforced concrete constructions calculator!'
puts 'What kind of element You want to calculate?'
puts 'As for now, I can help You with: beams (BEAM)'
print 'I want to calculate: '
str = gets.chomp.downcase
until types.include?(str) |... |
PHP | UTF-8 | 486 | 2.53125 | 3 | [
"MIT"
] | permissive | <?php
namespace Fuel\Migrations;
class Add_category_id_to_videokes
{
public function up()
{
\DBUtil::add_fields('videokes', array(
'category_id' => array('constraint' => 11, 'type' => 'int'),
));
// $cate = \Model_Category::find("first");
//
// $vis = \Model_Videoke::find("all");
//
// foreach ($vis as... |
PHP | UTF-8 | 443 | 3.59375 | 4 | [] | no_license | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Class4: PHP enter</title>
</head>
<body>
<?php
$input = 'dragon';
$words['money'] = "Money is not omnipotent, but having no money makes one impotent";
$words['dragon'] = "Chinese dragon";
$words['car'] = "BMW";
... |
Python | UTF-8 | 5,397 | 2.515625 | 3 | [
"BSD-3-Clause",
"Zlib",
"MIT",
"Apache-2.0"
] | permissive | import sys
import numpy as np
b: np.bool_
u8: np.uint64
i8: np.int64
f8: np.float64
c8: np.complex64
c16: np.complex128
m: np.timedelta64
U: np.str_
S: np.bytes_
V: np.void
reveal_type(c8.real) # E: {float32}
reveal_type(c8.imag) # E: {float32}
reveal_type(c8.real.real) # E: {float32}
reveal_type(c8.real.imag) #... |
Markdown | UTF-8 | 2,674 | 3.375 | 3 | [] | no_license | # What is a domain?
Until now, we have accessed our deployed applications using IP addresses. An IP address is a reference to a unique location. For us, these locations have been servers we've rented off DigitalOcean.
Now, asking our users to remember IP addresses for our application is unreasonable. We must give the... |
Swift | UTF-8 | 1,786 | 2.546875 | 3 | [] | no_license | //
// MainViewController.swift
// Luumen
//
// Created by Michael Zanussi on 3/3/16.
// Copyright © 2016 Michael Zanussi. All rights reserved.
//
import UIKit
class MainViewController: UIViewController {
@IBOutlet weak var titleItem: UINavigationItem!
override func viewDidLoad() {
super.view... |
Shell | UTF-8 | 2,094 | 3.65625 | 4 | [
"Apache-2.0"
] | permissive | #!/bin/bash
#
### BEGIN INIT INFO
# Provides: portal
# Required-Start: $remote_fs $syslog $mysql
# Required-Stop: $remote_fs $syslog
# Should-Start: $network $time
# Should-Stop: $network $time
# Default-Start: 3 4 5
# Default-Stop: 0 2 1 6
# Short-Description: Start and stop the To... |
Java | UTF-8 | 6,466 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | /*
* Cuelib library for manipulating cue sheets.
* Copyright (C) 2007-2008 Jan-Willem van den Broek
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the L... |
Java | UTF-8 | 2,532 | 2.328125 | 2 | [] | no_license | /**
* 项目名:jaf-core <br>
* 包名:com.jaf.web.dto.system <br>
* 文件名:SysDictionaryGroup.java <br>
* 版本信息:TODO <br>
* 作者:赵增斌 E-mail:zhaozengbin@gmail.com QQ:4415599 weibo:http://weibo.com/zhaozengbin<br>
* 日期:2013-7-23-下午5:04:40<br>
* Copyright (c) 2013 赵增斌-版权所有<br>
*
*/
package com.jaf.web.dto.system;
import java.u... |
C# | UTF-8 | 9,314 | 2.6875 | 3 | [
"LicenseRef-scancode-generic-cla",
"MIT"
] | permissive | // Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Coyote.IO;
namespace Microsoft.Coyote.SystematicTesting.Strategies
{
/// <summary>
/// A priority-based probabilistic scheduling strategy.
/// </su... |
Java | UTF-8 | 4,173 | 2.078125 | 2 | [] | no_license | package com.example.chatappdemo;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import a... |
C++ | UTF-8 | 366 | 2.515625 | 3 | [] | no_license | #ifndef MATERIAL_HPP
#define MATERIAL_HPP
#include <glm/glm.hpp>
class Texture;
struct Material {
const Texture* baseColor = nullptr;
const Texture* metallicRoughness = nullptr;
const Texture* normal = nullptr;
glm::vec4 baseColorFactor = glm::vec4(1.f);
float metallicFactor = 1.f;
float roug... |
PHP | UTF-8 | 767 | 2.515625 | 3 | [
"MIT"
] | permissive | <?php declare(strict_types = 1);
namespace Floweye\Client\Entity;
class ProcessDiscussionCreateEntity extends AbstractBodyEntity
{
public const TYPE_NORMAL = 'normal';
public const TYPE_SYSTEM = 'system';
public static function create(string $comment): self
{
$self = new self();
$self->body['comment'] = $co... |
C++ | UTF-8 | 779 | 3.3125 | 3 | [] | no_license | // Problem is to find the longest palindromic substring and return that substring.
string longestPalindrome(string A) {
int n = A.length(), res = 1, start = 0, end = 0;
bool dp[n][n];
string s;
int j;
for(int i = 0; i<n; i++)
dp[i][i] = true;
for(int l = 2; l <= n; l++){
for(int ... |
Java | UTF-8 | 2,536 | 2.359375 | 2 | [] | no_license | package controller;
import model.Product;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import service.... |
JavaScript | UTF-8 | 1,764 | 3.15625 | 3 | [
"LicenseRef-scancode-public-domain"
] | permissive | //jshint esversion: 6
/*
Author: Anthony Noel
Future Development:
-Make it so the area around the anchor tags arent clickable, just the anchor tag
-Add a panel of images
-Fix where the page jumps during scrolling (FIXED)
-Arrange the rest of the content of the page well
*/
const hamburger = document.querySelector("a[... |
C++ | UTF-8 | 11,569 | 2.671875 | 3 | [] | no_license | //
// Copyright 2011 Ettus Research LLC
// Copyright 2018 Ettus Research, a National Instruments Company
//
// SPDX-License-Identifier: GPL-3.0-or-later
//
#pragma once
#include <uhd/config.hpp>
#include <boost/date_time/posix_time/posix_time_types.hpp>
#include <boost/optional.hpp>
#include <iomanip>
#include <iostr... |
Java | UTF-8 | 2,110 | 2.390625 | 2 | [] | no_license | package ru.runa.gpd.ui.custom;
import com.google.common.collect.Lists;
import java.util.Arrays;
import java.util.List;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
//
// Based on org.eclipse.core.internal.resources.OS
//
public abstract class FileNameChecker extends KeyAdapter {
... |
Java | UTF-8 | 2,541 | 2.625 | 3 | [] | no_license | package edu.cmu.deiis.annotator;
/**This annotator class will display sorted answers based upon confidence
* It will display answertext the assigned confidence, score and actual score.
*/
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import org.apache.uima.analy... |
Java | UTF-8 | 1,366 | 2.25 | 2 | [] | no_license | package com.yeahmobi.datasystem.query.jersey;
/**
* Created by yangxu on 5/5/14.
*/
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.log4j.Logger... |
Java | UTF-8 | 684 | 3.578125 | 4 | [] | no_license | package PredicateExamples;
public class Employee {
public String name;
public String designation;
public double salary;
public String city;
Employee(String name, String designation, double salary, String city) {
this.name = name;
this.designation = designation;
this.salary = salary;
this.city = city;
}
... |
Java | UTF-8 | 3,403 | 2.203125 | 2 | [] | no_license | package jp.groupsession.v2.prj.prj200;
import java.util.List;
import jp.groupsession.v2.prj.prj080.Prj080ParamModel;
import org.apache.struts.util.LabelValueBean;
/**
* <br>[機 能] プロジェクト管理 個人設定 プロジェクトメイン初期値設定画面のフォーム
* <br>[解 説]
* <br>[備 考]
*
* @author JTS
*/
public class Prj200ParamModel extend... |
JavaScript | UTF-8 | 1,049 | 3.828125 | 4 | [
"CC0-1.0"
] | permissive | /**
* Generates random characters
*
* @param allowedTypes iterable of classes
* @param maxLevel max character level
* @returns Character type children (ex. Magician, Bowman, etc)
*/
export function* characterGenerator(allowedTypes, maxLevel) {
// TODO: write logic here
const randomIndex = Math.floor(Math.rand... |
Go | UTF-8 | 533 | 3.328125 | 3 | [] | no_license | package tree
func levelOrder(root *Node) (res [][]int) {
var levelorder func(root []*Node)
levelorder = func(roots []*Node) {
var nodes []*Node
var nodeVals []int
if len(roots) == 0 {
return
}
for _, node := range roots {
if node != nil {
nodeVals = append(nodeVals, node.Val)
for _, n := ran... |
PHP | UTF-8 | 556 | 2.9375 | 3 | [
"MIT"
] | permissive | <?php
namespace DemoApp;
use ValueObjects\Exception\InvalidNativeArgumentException;
use ValueObjects\StringLiteral\StringLiteral;
class ProductSKU extends StringLiteral
{
protected $value;
public function __construct($value = '')
{
if (!is_string($value)) {
throw new InvalidNativeArgu... |
C | UTF-8 | 963 | 3.03125 | 3 | [] | no_license | #include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
void handleSig()
{
printf("child is killed baba");
}
int main()
{
pid_t forkPid = fork();
int status;
// signal(SIGCHLD, &handleSig);
// printf(" Process: %d \n ", getpid());
if (forkPid ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.