language stringclasses 15
values | src_encoding stringclasses 34
values | length_bytes int64 6 7.85M | score float64 1.5 5.69 | int_score int64 2 5 | detected_licenses listlengths 0 160 | license_type stringclasses 2
values | text stringlengths 9 7.85M |
|---|---|---|---|---|---|---|---|
Markdown | UTF-8 | 3,184 | 3.015625 | 3 | [] | no_license | # Mean-Variance模型
## 理论基础:
假设市场上有 n 种风险资产,资产的收益率分别为$r_1,r_2,⋯,r_n$ ,投资者在各风险资产上的配置比例分别为 $ω1,ω2,⋯,ωn$ ,则投资组合的收益率为 $rp=∑_{i=1}^{n}ω_ir_i$ ,其中 $∑_{i=1}^{n}ω_i=1$.
从而,投资组合的期望收益率为
$E(rp)=\sum\limits_{i=1}^{n}ω_iE(r_i)$
方差为
$Var(rp) = ∑\limits_{i=1}^{n}ω_i^2Var(r_i)+∑\limits_{i≠j}ω_iω_jCov(r_i,r_j)$
投资者资产配置的前提是对未来形成预期,... |
TypeScript | UTF-8 | 3,032 | 2.953125 | 3 | [] | no_license | import { Handles, Rect, ResizeHandleInfo, Size } from "./mathUtils";
export class Painter{
private canvasBounds:DOMRect = null;
private flags = {
hasStroke: false,
hasFill: false
};
private mem = {
x:null,
y:null,
w:null,
h:null,
r:null
};
... |
Java | UTF-8 | 3,092 | 2.546875 | 3 | [] | no_license | package socialgossip.server.dataproviders;
import socialgossip.server.core.entities.session.Session;
import socialgossip.server.core.entities.user.User;
import socialgossip.server.core.gateways.session.SessionAlreadyExistsException;
import socialgossip.server.core.gateways.session.SessionNotFoundException;
import soci... |
Python | UTF-8 | 1,706 | 3.0625 | 3 | [
"MIT"
] | permissive | import os.path
import sqlite3
import Scraper
import sys
def create_db():
conn = sqlite3.connect('reellog.db')
c = conn.cursor()
c.execute('''CREATE TABLE reellog
(lure text, body text, location text, species text, level integer, weight real, class text,
unique(lure, body, location, species, level... |
Java | UTF-8 | 3,284 | 2.046875 | 2 | [] | no_license | package com.questionnaire.controllers;
import com.questionnaire.core.Constants;
import com.questionnaire.entity.sessionentity.LoginState;
import com.questionnaire.services.SessionCache;
import com.questionnaire.services.UserService;
import com.questionnaire.services.VkOAuthService;
import com.vk.api.sdk.client.VkApiCl... |
Java | UTF-8 | 3,137 | 2.5 | 2 | [] | no_license | package Control;
import Modelo.Usuario;
import javafx.scene.control.TextField;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.URL;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
impo... |
Java | UTF-8 | 525 | 1.820313 | 2 | [] | no_license | package com.consulting.core.cra.model;
import lombok.*;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import java.time.Month;
/**
* A CRA
* Created by nizaraouissaoui on 21/04/2018.
*/
@Entity
@Getter
@Setter
@NoArgsConstructor
@ToString
@EqualsAndHashCode
... |
Java | UTF-8 | 3,831 | 1.875 | 2 | [] | no_license | package com.alltheducks.enabler.stripes;
import blackboard.admin.data.IAdminObject;
import blackboard.admin.data.course.CourseSite;
import blackboard.admin.persist.course.CourseSiteLoader;
import blackboard.admin.persist.course.CourseSitePersister;
import blackboard.admin.persist.course.impl.CourseSiteDbLoader;
import... |
Java | UTF-8 | 1,585 | 2.421875 | 2 | [] | no_license | package ver0.village.WritingUpload;
import android.content.Context;
import android.graphics.BitmapFactory;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import androidx.recyclerview.widget.RecyclerView;
import com.esafirm.imagepicker.mod... |
Python | UTF-8 | 479 | 3.53125 | 4 | [
"Apache-2.0"
] | permissive | #coding=utf-8
import parent
class SonClass(parent.ParentClass):#继承父类,这里一定要写模块名.类名
'''
在继承中基类的构造(__init__()方法)
不会被自动调用,它需要在其派生类的构造中亲自专门调用
'''
def __init__(self,name):
self.name=name
print "son is inited"
def sum(self,a,b):
print a+b
if(__name__ == ... |
Java | UTF-8 | 2,835 | 2.6875 | 3 | [] | no_license | package edu.andrazpencelj.parkinginljubljana;
import android.util.Log;
/**
* Created by Andraž on 18.11.2013.
*
* parkirišče
*
* mId - id parkirišča
* mName - ime parkirišča
* mCapacity - kapaciteta parkirišča
* mDisabledPersonCapacity - število mest namenjenih invalidom
*
* mLocation - lokacija parkirišča
... |
Java | UTF-8 | 3,619 | 2.203125 | 2 | [] | no_license | package com.nkhoang.gae.utils;
import com.nkhoang.gae.model.Word;
import com.nkhoang.gae.service.LookupService;
import com.nkhoang.gae.utils.web.DownloadUtils;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.junit.Test;
import org.junit.runner.RunWi... |
Python | UTF-8 | 971 | 2.78125 | 3 | [] | no_license | import os
import requests
import datetime
from dotenv import load_dotenv
load_dotenv()
def info_about_user(target_id: str):
ACCESS_TOKEN = os.getenv('VK_ACCESS_TOKEN')
API_VERSION = '5.124'
URL = f'https://api.vk.com/method/users.get?user_ids={target_id}&fields=online,last_seen' \
... |
Ruby | UTF-8 | 1,104 | 3 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | class VentureCapitalist
attr_accessor :name, :total_worth
@@all = []
def initialize(name, total_worth)
@name = name
@total_worth = total_worth
@@all << self
end
def offer_contract(startup, type, investment)
FundingRound.new(startup, self, type, investment)
end
... |
Ruby | UTF-8 | 566 | 3.140625 | 3 | [] | no_license | require 'singleton'
# Components to use
require 'comp1'
require 'comp2'
class Module
def component(id,klass)
module_eval <<-"end_eval"
def init
puts "init: id=#{id}, class=#{klass}"
@#{id.id2name} = #{klass}.new
end
#~ self.init
end_eval
end
end
class MMContainer
include Si... |
Java | UTF-8 | 1,818 | 2.078125 | 2 | [] | no_license | package kafka;
import java.util.UUID;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.event.SpringApplicationEvent;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.sprin... |
Java | UTF-8 | 2,913 | 2.046875 | 2 | [] | no_license | package ru.aplana.renessains.pages;
import org.junit.Assert;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.Select;
import java.util... |
Java | UTF-8 | 1,736 | 2.890625 | 3 | [] | no_license | package com.example.bookapp;
import java.text.DecimalFormat;
public class Book {
private int id;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
private int imgRes;
private String title,author,description;
private double price;
p... |
PHP | UTF-8 | 556 | 3.078125 | 3 | [] | no_license | <?php
class Connection
{
private $servername = "localhost";
private $username = "root";
private $password = "root";
private $dbname = "licenta";
private $conn;
private static $instance = null;
public function __construct()
{
}
public function getConnection(){
return new mysqli($this->servername, $thi... |
PHP | UTF-8 | 9,894 | 2.671875 | 3 | [] | no_license | <?php
/**
* @package phpunk\component
*/
namespace PHPunk\Component;
use PHPunk\cache;
use PHPunk\url_schema;
use PHPunk\Database\schema as db_schema;
/**
* @property object $database Single database schema instance
* @property object $router Single url schema instance
* @property object $cache Single cache ins... |
PHP | UTF-8 | 11,379 | 2.578125 | 3 | [] | no_license | <?php
/**
* 特别处理
* 动态字段/PHP栏目功能处理
*/
/* 创建类别数据表语句 */
$alone_table_sql = "
CREATE TABLE IF NOT EXISTS `__TABLE_NAME__` (
`id` int(11) NOT NULL auto_increment,
`cn_type` varchar(200) collate utf8_general_ci NULL default '',
`en_type` varchar(200) collate utf8_general_ci NULL default '',
`cn_title` varchar(20... |
JavaScript | UTF-8 | 546 | 3.53125 | 4 | [] | no_license | var word = 'OCNP';
var checker = '.'.repeat(word.length);
var text = '';
for (var i = 0; i < 1000; i++) {
var ch = word.charAt(Math.floor(Math.random() * word.length));
text = text + ' ' + ch;
checker = checker.substr(1) + ch;
console.log(checker);
setTimeout("document.getElementById('ochinpo')... |
TypeScript | UTF-8 | 1,205 | 4.15625 | 4 | [] | no_license | /*
https://leetcode.com/problems/sum-of-all-odd-length-subarrays/
Given an array of positive integers arr, calculate the sum of all possible odd-length subarrays.
A subarray is a contiguous subsequence of the array.
Return the sum of all odd-length subarrays of arr.
Example 1:
Input: arr = [1,4,2,5,3]
Output: 58... |
C# | UTF-8 | 2,657 | 2.671875 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using DemoIdentity.Data;
using DemoIdentity.Models;
namespace DemoIdentity.ControllersApi
{
[Route("api/[controller... |
Java | UTF-8 | 1,260 | 2.234375 | 2 | [] | no_license | package vaycent.testbaidumap.Utils;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.util.ArrayList;
import java.util.List;
/**
* Created by vaycent on 2017/6/2.
*/
public class HistroySharePreference {
private final String POI_SEARCH_HISTROY="PoiSearchHistroy";
public ... |
C++ | UTF-8 | 3,186 | 3.109375 | 3 | [
"MIT"
] | permissive | /*
* Copyright (C) 2008 Emweb bvba, Heverlee, Belgium.
*
* See the LICENSE file for terms of use.
*/
#include <Wt/WApplication.h>
#include <Wt/WBreak.h>
#include <Wt/WContainerWidget.h>
#include <Wt/WLineEdit.h>
#include <Wt/WPushButton.h>
#include <Wt/WText.h>
#include <memory>
/*
* A simple hello world applica... |
Go | UTF-8 | 1,533 | 3.0625 | 3 | [] | no_license | /*
Cashcalc 2020
Copyright (C) 2019-2020 Istvan Nemeth
mailto: nemethistvanius@gmail.com
*/
package services
import "testing"
func TestGetMongoDBNameFromURI(t *testing.T) {
testCases := []struct {
input string
expected string
}{
{"mongodb://user:pw@host:port/db", "db"},
{"mongodb://user:pw@host:port/... |
PHP | UTF-8 | 2,273 | 2.671875 | 3 | [] | no_license | <?php
function get_string_between($string, $start, $end){
$string = ' ' . $string;
$ini = strpos($string, $start);
if ($ini == 0) return '';
$ini += strlen($start);
$len = strpos($string, $end, $ini) - $ini;
return substr($string, $ini, $len);
}
function get_post_content($post) {
return get_string_between($po... |
Rust | UTF-8 | 827 | 3.703125 | 4 | [] | no_license | use std::io;
fn check_num(num: i32) {
if num < 0 {
println!("{} is negative", num);
} else if num > 0 {
println!("{} is positive", num);
} else {
println!("Number equals to zero");
}
}
fn main() {
let mut number: i32;
println!("Please enter a number:");
loop {
... |
Markdown | UTF-8 | 4,596 | 2.96875 | 3 | [
"Apache-2.0"
] | permissive | # MockDB (LocalDB)
This is a mock DB that represents a lightweight database that is defined by JSON files. It is used for testing purposes.
## Configuration
In order to configure your root directory (Catalog), please create a Connector Configuration file as
`~/.partiql/plugins/<catalog_name>.ion`, where `<catalog_na... |
Java | UTF-8 | 3,262 | 2.4375 | 2 | [] | no_license | package local.hal.st32.android.itarticlecollection60213;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.EditText;
public class ArticleAddActivity extends AppCompatActivity {
... |
PHP | UTF-8 | 5,709 | 2.90625 | 3 | [] | no_license | <?php
class Product{
private $productID, $productName, $productDescription, $productPrice, $salePrice, $quantity,$image,$isDiscountedProduct;
/*
* To display catalog products
*
*/
public function getAllCatalogProducts(){
$display = "";
$display .= "<div class = ... |
Java | UTF-8 | 714 | 2.171875 | 2 | [] | no_license | package com.linjun.service.impl;
import com.linjun.common.domain.PeopleException;
import com.linjun.dao.SuggestMapper;
import com.linjun.model.Suggest;
import com.linjun.service.SuggestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
publi... |
Java | UTF-8 | 353 | 3.1875 | 3 | [] | no_license | package Day_15.buffer;
public class TestStringBuilder {
public static void main(String[] args) {
String str = "Hello";//定义字符串Hello
str += "World";//将World追加给Hello
//1.创建StringBuilder
//2.调用append追加的方法
//3.调用toString转换回String
System.out.println(str);//打印追加后的str
}
}
|
Java | UTF-8 | 2,203 | 2.046875 | 2 | [] | no_license | package com.example.android.MusicPlayer;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.LayoutInflater;
import a... |
C++ | UTF-8 | 1,370 | 2.78125 | 3 | [] | no_license | //
// Created by Kenji Nomura on 8/22/17.
//
#include "Network.h"
#include <iostream>
#include "common/functions/functions.h"
Network::Network() {}
Network::Network(const std::vector<Eigen::MatrixXd> &Ws, const std::vector<Eigen::MatrixXd> &Bs) :
Ws(Ws), Bs(Bs) {};
void Network::setWeight(const std::vector<Eige... |
Go | UTF-8 | 2,892 | 2.75 | 3 | [] | no_license | package eventsapi
import (
"encoding/json"
"fmt"
"github.com/oklahomer/golack/v2/event"
"github.com/tidwall/gjson"
)
// https://api.slack.com/events-api#callback_field_overview
type outer struct {
Token string `json:"token"`
TeamID string `json:"team_id"`
APIAppID string ... |
Java | UTF-8 | 626 | 2.78125 | 3 | [] | no_license | package com.class33;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
public class Task {
public static void main(String[] args) {
List <String >list=new ArrayList<String>();
list.add("John");
list.add(... |
C# | UTF-8 | 2,312 | 2.875 | 3 | [
"MIT"
] | permissive | using System;
using Xunit.Abstractions;
namespace Cuemon.Extensions.Xunit
{
/// <summary>
/// Represents the base class from which all implementations of unit testing should derive.
/// </summary>
/// <seealso cref="Disposable"/>
/// <seealso cref="ITestOutputHelper"/>
public abstract class Te... |
PHP | UTF-8 | 2,295 | 2.625 | 3 | [] | no_license | <?php
/****************************************************************************
* Copyleft meh. [http://meh.doesntexist.org | meh@paranoici.org] *
* *
* This file is part of miniLOL. A PHP implementation. *
*... |
JavaScript | UTF-8 | 7,336 | 2.953125 | 3 | [] | no_license | (function()
{
var SignaturePad = function(selector)
{
return new SignaturePad.fn.init(selector);
};
SignaturePad.fn = SignaturePad.prototype =
{
signaturepad: "proto-2",
constructor: SignaturePad
};
var init = SignaturePad.fn.init = function(selector)
{
if(typeof selector === "string")
{
var elem... |
Markdown | UTF-8 | 778 | 2.609375 | 3 | [] | no_license | # Detecting face and sending Mail, whatsapp message & launching ec2 instance using Terraform
## Changes to do before running the code:
* Update `phone number` in `sendWhatsApp.py` file.
* Update mail-id (sender and receiver) and password in the FaceRecognition.ipynb file where `sendemail.sendemail ` is used.
... |
Python | UTF-8 | 4,704 | 2.734375 | 3 | [] | no_license | """
@Authors: mikhail-matrosov and Alexey Boyko
@Created August, 20
This script takes image and converts it into engraving, a path that also can
be drawn with a pen or a marker.
"""
import cv2
import numpy as np
from findPaths import *
from plotter import plot_from_file
# PARAMETERS
LINE_THICKNESS =... |
Markdown | UTF-8 | 2,081 | 2.546875 | 3 | [
"MIT"
] | permissive | <br>
<p align="center">
<img alt="to.do" src="public/logo.svg" width="200px">
</p>
<p align="center">
<i>Desafio de ReactJs do <a href="https://rocketseat.com.br/ignite">Ignite</a>, na <a href="https://rocketseat.com.br/">Rocketseat</a>.</i><br>
<div align="center">
<a href="https://"><img src="https://img.s... |
C++ | UTF-8 | 705 | 2.921875 | 3 | [] | no_license | /*
* @Author: tanht
* @Date: 2020-08-30 22:54:20
* @Last Modified by: tanht
* @Last Modified time: 2020-08-31 13:34:00
* @Email: tanht.lavamyth@gmail.com
*/
#include <iostream>
#include <cstring>
using namespace std;
#define AMAX 50
bool marks[AMAX];
int main () {
string s; cin >> s;
int sLen = (int)s.size(... |
JavaScript | UTF-8 | 1,311 | 2.625 | 3 | [] | no_license | import React, { Component } from 'react';
class SignIn extends Component {
constructor(props) {
super(props);
this.state = {
email: '',
password: '',
error: '',
};
this.handleOnChange = this.handleOnChange.bind(this);
this.handleLoginUser = this.handleLoginUser.bind(this);
}
... |
Java | UTF-8 | 669 | 2.78125 | 3 | [] | no_license | package com.mbi;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
class StringValidator implements Validator {
@Override
public <T> void compareWithSchema(JSONObject schema, T object) {
String actualResult = (String) object;
if (actualResult.startsWith("{"... |
Rust | UTF-8 | 1,896 | 2.875 | 3 | [
"MIT",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | use crate::parser::error::Error;
use nom::branch::alt;
use nom::bytes::complete::is_a;
use nom::character::complete::{alpha1, alphanumeric1, multispace0};
use nom::combinator::recognize;
use nom::error::ParseError;
use nom::multi::many0;
use nom::sequence::{delimited, tuple};
use nom::{IResult, Parser};
// > The metri... |
C++ | UTF-8 | 717 | 3.453125 | 3 | [] | no_license | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
//in-order traversal
bool isValidBST(TreeNode* root) {
if(!root)
{
return tru... |
Python | UTF-8 | 5,555 | 2.90625 | 3 | [] | no_license | import numpy as np
import random
from collections import deque
#Funciones auxiliares
def centroPersonal(objNvidia):
(x, y) = objNvidia.Center
# Pasamos el centro a int
x, y = int(x), int(y)
return (x,y)
class Vehiculo:
def __init__(self, objNvidia, idLoop):
# Datos NVIDIA
self.... |
Java | UTF-8 | 21,029 | 1.5 | 2 | [] | no_license | /* 1: */ package com.asinfo.as2.datosbase.controller;
/* 2: */
/* 3: */ import com.asinfo.as2.controller.LanguageController;
/* 4: */ import com.asinfo.as2.controller.PageControllerAS2;
/* 5: */ import com.asinfo.as2.datosbase.servicio.ServicioCategoriaEmpresa;
/* 6: */ import com.as... |
Markdown | UTF-8 | 2,281 | 2.609375 | 3 | [] | no_license | A Flamework library for decoding User Agent strings
===================================================
This library is designed to be used with <a href="https://github.com/exflickr/flamework">Flamework</a>, but works standalone too.
Usage:
# single shot
$ret = useragent_decode($ua);
# when decoding in ... |
Java | UTF-8 | 8,014 | 1.867188 | 2 | [
"Apache-2.0"
] | permissive | /*
* Copyright 2016 Open Networking Foundation
*
* 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 la... |
C# | UTF-8 | 199 | 2.625 | 3 | [] | no_license | class ProviderService
{
public TResult Interact<TResult> (Func<Foobar, TResult> lambdaCode)
{
var x = new Foobar();
Initialize(x); //or whatever
return lambdaCode(x);
}
}
|
C++ | UTF-8 | 6,145 | 2.609375 | 3 | [] | no_license | #include "Application.h"
const int WINDOW_WIDTH = 1920;
const int WINDOW_HEIGHT = 1080;
Application::Application()
:_windowWidth(WINDOW_WIDTH)
,_windowHeight(WINDOW_HEIGHT)
{
glfwInit();
_window = glfwCreateWindow(_windowWidth, _windowHeight, "PBR Application", glfwGetPrimaryMonitor(), NULL);
glfwMakeCon... |
TypeScript | UTF-8 | 3,203 | 2.640625 | 3 | [
"MIT"
] | permissive | import { KeySelector, ParametricKeySelector } from 're-reselect';
import { isPropSelector } from './createPropSelector';
import { arePathsEqual, defaultKeySelector, isCachedSelector } from './helpers';
import {
isComposedKeySelector,
KeySelectorComposer,
} from './createKeySelectorComposer';
const areSelectorsEqua... |
Java | UTF-8 | 397 | 1.953125 | 2 | [] | no_license | package com.ward.services;
import com.ward.entities.CreditCard;
import com.ward.entities.Guest;
import org.springframework.data.repository.CrudRepository;
import java.util.List;
/**
* Created by Troy on 12/6/16.
*/
public interface CreditCardRepository extends CrudRepository<CreditCard,Integer> {
CreditCard fi... |
Python | UTF-8 | 1,549 | 3.875 | 4 | [] | no_license | # Follow up for "Unique Paths":
#
# Now consider if some obstacles are added to the grids. How many unique paths would there be?
#
# An obstacle and empty space is marked as 1 and 0 respectively in the grid.
#
# For example,
# There is one obstacle in the middle of a 3x3 grid as illustrated below.
#
# [
# [... |
PHP | UTF-8 | 371 | 2.5625 | 3 | [
"MIT"
] | permissive | <?php
namespace App\Exceptions;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\HttpException;
class BadRequest extends HttpException
{
public static function invalidRole($role): self
{
return new static(Response::HTTP_BAD_REQUEST,
'Role '.$role.... |
C# | UTF-8 | 6,433 | 2.671875 | 3 | [] | no_license | using MorphAnalysis.HelperClasses;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.Entity;
using System.Data.Entity.Migrations;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namesp... |
Python | UTF-8 | 544 | 3.21875 | 3 | [] | no_license | import unittest
from singleton import Singleton
class TestSingleton(unittest.TestCase):
def setUp(self):
self.singleton_1 = Singleton(10)
self.singleton_2 = Singleton(50)
def test_singleton_data_does_update(self):
self.assertEqual(self.singleton_1.data, 50)
self.assert... |
SQL | UTF-8 | 559 | 3.015625 | 3 | [
"MIT"
] | permissive | .mode csv
.bail on
.echo on
-- drop/create new tables
.open ./data/processed/sf-food-safety.sqlite
.read ./src/dba/schema.sql
-- import the data
.changes on
.import ./data/raw/businesses_plus.csv business
.import ./data/raw/inspections_plus.csv inspection
.import ./data/raw/violations_plus.csv violation
-- index th... |
JavaScript | UTF-8 | 622 | 2.640625 | 3 | [] | no_license | const Discord = require("discord.js");
module.exports.run = async(bot, message, args) => {
let rpsdact = true;
let user2 = message.mentions.members.first();
if(!user2) return message.reply("**User not found!**");
await message.channel.send(`${user2.user.id}, do accept ${message.author.id}'s... |
JavaScript | UTF-8 | 4,262 | 2.828125 | 3 | [
"MIT"
] | permissive | /*
*
* xxxxxxx xxxxxxx
* x:::::x x:::::x
* x:::::x x:::::x
* x:::::xx:::::x
* x::::::::::x
* x::::::::x
* x::::::::x
* x:... |
Java | UTF-8 | 2,616 | 2.375 | 2 | [
"BSD-2-Clause"
] | permissive | /*
* Copyright (c) 2014. Philip DeCamp
* Released under the BSD 2-Clause License
* http://opensource.org/licenses/BSD-2-Clause
*/
package bits.thicket;
import java.util.Random;
/**
* @author decamp
*/
interface RefineFunc {
public void refine( LayoutParams params, Graph src, Graph dst );
pub... |
Swift | UTF-8 | 1,615 | 3.28125 | 3 | [] | no_license | //
// CalculatorLogic.swift
// Calculator
//
// Created by Berta Devant on 19/07/2017.
// Copyright © 2017 Berta Devant. All rights reserved.
//
import Foundation
class CalculatorPresenter {
private let displayer: CalculatorDisplayer
private let calculator: Calculator
init(displayer: CalculatorDi... |
TypeScript | UTF-8 | 1,952 | 2.53125 | 3 | [] | no_license | import { normalizePath, relative } from "../src/normalize";
import { Node } from "../src/Node";
it("normalizePath", () => {
expect(normalizePath(".")).toEqual("");
expect(normalizePath("a/b/c/")).toEqual("a/b/c");
expect(normalizePath("a/b/c")).toEqual("a/b/c");
expect(normalizePath("/a/b/c")).toEqual("/a/b/c"... |
Java | UTF-8 | 707 | 3.53125 | 4 | [] | no_license | import java.util.*;
// find size of k bloomed flowers
class Solution {
public static int kEmptySlots(int[] flowers, int k) {
int N = flowers.length;
TreeSet<Integer> bloomed = new TreeSet();
bloomed.add(0);
bloomed.add(N + 1);
int day = N;
for (int i = N - 1; i >= 0; i--) {
int flower = flowers[i];... |
Python | UTF-8 | 876 | 3.203125 | 3 | [] | no_license | import sys
fp = open(sys.argv[1], 'r')
# for each command line in the workload file, create JSON object and execute GET/POST to API
line = fp.readline()
output = set()
hash_bucket = {}
while line:
uname = line.strip().split(' ')[1].split(',')[1]
if uname[0] != '.':
output.add(uname)
line = fp.readl... |
Markdown | UTF-8 | 1,068 | 2.515625 | 3 | [] | no_license | # Article 47
La mise en conformité des conditions d'aménagement, d'exploitation et de suivi des installations de stockage continuant à recevoir des déchets à la date de publication au Journal officiel de la République française du présent arrêté est obligatoire. L'exploitant doit remettre au préfet au plus tard un an ... |
Python | UTF-8 | 6,994 | 2.8125 | 3 | [] | no_license | """This modules contains entries for the movies and TV serials.
The movie entries are instances of Movie class and TV serials are
instances of TVSerial class.
More entries can be added in this module.
"""
import webbrowser
import media # contains Movie and TVSerial classes
import fresh_tomatoes # contains function... |
Java | UTF-8 | 3,174 | 2.4375 | 2 | [] | no_license | package com.example.workmanagerimplementation.Models;
import android.content.ContentResolver;
import android.database.Cursor;
import android.util.Log;
import com.example.workmanagerimplementation.Models.Pojo.MainMenu;
import com.example.workmanagerimplementation.data.DBHandler;
import com.example.workmanagerimplement... |
Java | UTF-8 | 251 | 2.484375 | 2 | [] | no_license | package com.Tutorial;
import java.util.Scanner;
public class LogicalOps {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int b=50;
while (b>=20) {
System.out.println(b);
b--;
}
}
} |
C# | UTF-8 | 775 | 2.640625 | 3 | [
"MIT"
] | permissive | using GoogleApi.Entities.Common;
using NUnit.Framework;
namespace GoogleApi.UnitTests.Common;
[TestFixture]
public class ViewPortTests
{
[Test]
public void ConstructorTest()
{
var southWest = new Coordinate(1, 1);
var northEast = new Coordinate(2, 2);
var viewPort = new ViewPort(so... |
C++ | UTF-8 | 2,894 | 3.03125 | 3 | [] | no_license | #ifndef UTILS_H
#define UTILS_H
#include <stdio.h>
#define stdmax(a,b) (a>b?a:b)
inline float RandomFloat(float min, float max)
{
float r = (float)rand() / (float)RAND_MAX;
return min + r * (max - min);
}
inline float RandomInt(int min, int max)
{
float r = (float)rand() / (float)RAND_MAX;
return (int)((float... |
TypeScript | UTF-8 | 4,030 | 2.515625 | 3 | [
"MIT"
] | permissive | import t from '../src/readable-ansi'
import chalk from 'chalk'
import { CSI } from './util'
import { wrap as w } from '../src/common'
describe('foreground color', () => {
it('naming colors', () => {
expect(t(CSI + '30m')).toBe(w('黑'))
expect(t(CSI + '31m')).toBe(w(chalk.red('红')))
expect(t(CSI + '32m')).... |
Java | UTF-8 | 731 | 2.484375 | 2 | [] | no_license | package com.academiccourseregistration.core.dao.mapper;
import com.academiccourseregistration.core.api.model.StudentDto;
import com.academiccourseregistration.core.dao.model.Student;
import lombok.experimental.UtilityClass;
@UtilityClass
public class StudentMapper {
public StudentDto toDto(Student entity) {
... |
Java | UTF-8 | 989 | 3.34375 | 3 | [] | no_license | package com.srk.graphs;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.ListIterator;
public class Graph {
int vertices;
LinkedList<Integer>[] dll = null;
public Graph(int v) {
this.vertices = v;
dll = new LinkedList[this.vertices];
for(int i = 0; i<vertices; i++) {
dll[i] = new L... |
C | UTF-8 | 532 | 2.953125 | 3 | [] | no_license | int a;
int b;
int c;
while(true)
{
a = input();
b = input();
c = input();
if (a <= b && a <= c)
{
output(a);
if (b <= c)
{
output(b);
output(c);
}
else
{
output(c);
output(b);
}
}
else if (b <= a && b <= c)
{
output(b);
if (a <= c)
{
output(a... |
Markdown | UTF-8 | 4,403 | 2.859375 | 3 | [
"BSD-4-Clause",
"BSD-2-Clause"
] | permissive | # ECNS
Implementations for registrars and local resolvers for the Ethereum Classic Name Service.
For documentation of the original ENS system, see [docs.ENS.domains](http://docs.ens.domains/).
# Differences between ENS and ECNS
1. ECNS will not burn funds. There is a special `burn` address at the Registrar that will... |
C# | UTF-8 | 489 | 2.984375 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Topdeck {
class Deck {
int deckSize = 0;
Card[] deck;
int Wins { get; set; }
int Losses { get; set; }
public double Winrate { get { return (double)... |
Java | UTF-8 | 4,439 | 2.3125 | 2 | [] | no_license | package com.truedev.application.Service;
import android.app.IntentService;
import android.content.Intent;
import android.os.Binder;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.util.Log;
import com.truedev.application.ImageManager.ImageUtils... |
Java | UTF-8 | 1,016 | 1.945313 | 2 | [] | no_license | package server;
import server.controllers.NoteController;
import server.controllers.UserController;
import server.dao.AccessRightService;
import server.dao.NoteService;
import server.dao.UserService;
import com.google.gson.Gson;
/* Very simple implementation of DI */
public class DI {
public static final DI insta... |
Python | UTF-8 | 2,285 | 2.890625 | 3 | [] | no_license | #! /home/asim/projects/RoverProject/.venv/bin/python
import PySimpleGUI as sg
"""
buttons looks okay, need to find a way to incorporate this into existing system
call button can reflect actual state ie
before clicking : call
on click: calling
on ack : Called
on rover reaching : GO
on GO: call
stations too can sh... |
Markdown | UTF-8 | 5,268 | 2.875 | 3 | [
"Apache-2.0"
] | permissive |
# Dependencies
* [PyTorch](http://pytorch.org/)
* [torchvision](https://github.com/pytorch/vision/)
* [tabulate](https://pypi.python.org/pypi/tabulate/)
# Usage
The code in this repository implements both the curve-finding procedure with examples on the CIFAR-10 datasets.
## Curve Finding
### Training the endpoi... |
Java | UTF-8 | 402 | 2.125 | 2 | [] | no_license | package com.mercacortex.ad_json.model;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class Person {
@SerializedName("contacts")
public List<Contact> contacts;
public Person() {
}
public List<Contact> getContactos() {
return contacts;
}
public voi... |
Java | UTF-8 | 3,256 | 2.890625 | 3 | [
"Apache-2.0"
] | permissive | /**
* Copyright (C) 2009 - present by OpenGamma Inc. and other contributors.
*
* 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
* ... |
PHP | UTF-8 | 7,152 | 2.953125 | 3 | [] | no_license | <?php
class Perfil{
private $pdo;
private $idInstructor;
private $Nombres;
private $Apellidos;
private $TipoDocumento;
private $NumeroDocumento;
private $CorreoElectronico;
private $Usuario;
public function __CONSTRUCT(){
$this->pdo = BasedeDatos::Conectar();
}
... |
Java | UTF-8 | 207 | 2.015625 | 2 | [] | no_license | package com.nilestanner.filtersortpagesample.exceptions;
public class SqlInsertException extends Exception {
public SqlInsertException(String exceptionString) {
super(exceptionString);
}
}
|
Java | UTF-8 | 1,089 | 2.140625 | 2 | [] | no_license | package com.stud.api;
import java.util.List;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.... |
Java | UTF-8 | 268 | 1.835938 | 2 | [] | no_license | package com.xmw.catalina.http;
/**
* @author xmw.
* @date 2018/7/8 10:50.
*/
public abstract class XmwServlet {
public abstract void doGet(XmwRequest request, XmwResponse response);
public abstract void doPost(XmwRequest request, XmwResponse response);
}
|
Python | UTF-8 | 6,619 | 2.671875 | 3 | [] | no_license | import numpy as np
import copy, time
import torch
import torch.optim as optim
import torch.nn as nn
from torchviz import make_dot
from torch.utils.data import Dataset, TensorDataset, DataLoader
from torch.utils.data.dataset import random_split
from torch.autograd import Variable
from mpl_toolkits.mplot3d import Axes3... |
Python | UTF-8 | 1,114 | 3.328125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
#!/usr/bin/env python3
#使用特定欄位名稱-尋找特定欄位
#此範例要找"Invoice Number","Purchase Date"
"""
Created on Thu Sep 21 09:51:09 2017
@author: vizance
"""
import csv
import sys
input_file = sys.argv[1]
output_file = sys.argv[2]
my_columns = ['Invoice Number','Purchase Date']
my_columns_index = []#用來儲存搜尋欄位的ind... |
Shell | UTF-8 | 1,125 | 3.03125 | 3 | [] | no_license | #!/bin/bash
MYSQL_ROOT_USER=root
MYSQL_ROOT_PASSWORD=<root_password>
MYSQL_CI_DATABASE=experchat_ci
ENV_SETTING=ci
ENV_DECRYPTION_PASSWD=<ci_config_decreption_password>
REPO_USERNAME=<common_repo_user>
REPO_PASSWORD=<common_repo_password>
docker stop CONTAINER $(docker ps -q)
docker rm $(docker ps -a -q)
docker rmi $... |
JavaScript | UTF-8 | 1,368 | 3.1875 | 3 | [] | no_license | export default class Circle {
constructor(){
this.element = document.createElement('div');
this.element.className = 'circle';
const body = document.getElementsByTagName('body')[0];
this.isActive = false;
this.element.addEventListener('mousedown', this.onMouseDownHandler.bind... |
Markdown | UTF-8 | 2,030 | 3.09375 | 3 | [
"MIT"
] | permissive | # Getting Started
Everything starts with a [Nx workspace](https://nx.dev).
```bash
npx create-nx-workspace myworkspace
```
**Note:** We recommend the following options when creating your Nx workspace:
- Choose `Apps` preset
- Use `Nx` cli
We find this provides opportunities for broader use cases while also allowin... |
Markdown | UTF-8 | 6,627 | 2.515625 | 3 | [] | no_license | ---
title: iOS与React-Native通信
date: 2017-03-17 09:46:48
tags:
- React Native
- iOS
---
# iOS 与 React Native 通信踩坑小结
公司目前的项目主要使用的 React Native,但是 RN 这么久了还只是在 0.x 徘徊,不可避免有很多缺失的功能需要原生开发,然后嵌入到 RN 中,尤其是一些有我天朝特色的,比如支付宝支付,微信 QQ 等的第三方分享。
集成支付宝支付的时候,需要在原生里面监听支付结束的动作,然后收到支付宝返回的结果参数,再与自家的后端交互确定最终的支付结果,这里不可避免的涉及到 iOS 监听到支付结束,然后... |
C++ | UTF-8 | 4,425 | 3.140625 | 3 | [] | no_license | #pragma once
#ifndef PT_MATH_PLANE_H
#define PT_MATH_PLANE_H
#include "pt/vector.h"
#include "pt/matrix.h"
#include "pt/matrix_operations.h"
namespace pt { namespace math {
// The members of the Plane structure take the form of the general plane equation. They fit into the general plane equation so that Ax + By + Cz... |
Markdown | UTF-8 | 6,435 | 2.78125 | 3 | [] | no_license | # How to setup a project with webpack + react + Eslint & prettier
In this tutorial i will guide you through the steps that will brings to the final result
by explaining the every step in order to obtain this
INSERT MP4 HERE
## initial setup
first let create a new folder
```sh
mkdir MyProject
cd MyProject
```
Now ... |
Java | UTF-8 | 463 | 2.625 | 3 | [] | no_license |
public class Filho extends Pai implements Familia{
private String email;
public Filho(String nome, int idade, String email) {
super(nome, idade);
this.email = email;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
@Overr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.