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 |
|---|---|---|---|---|---|---|---|
PHP | UTF-8 | 554 | 2.59375 | 3 | [] | no_license | <?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Product extends Model
{
protected $guarded = [];
// a product belongs to one supplier (restuaraunt)
public function supplier()
{
return $this->belongsTo('App\Supplier');
}
/**
* Return collection of products by... |
Python | UTF-8 | 467 | 3.90625 | 4 | [] | no_license |
def grade_func():
i = 1
for i in range(0,10):
import random
rannum = random.random()
grade = rannum*100
if grade> 89 and grade < 100:
print "score {}; Your grade is A".format(grade)
elif grade > 79 and grade < 90:
print "score {}; Your grade is B".format(grade)
elif grade > 69 and grade < 80:
p... |
JavaScript | UTF-8 | 1,705 | 2.65625 | 3 | [] | no_license | const mongoose = require("mongoose");
const Vote = require("../models/vote");
const Cat = require("../models/cat");
/**
* logs a vote for a pair of cats
* updates vote statistics for the cats
*/
exports.vote = async (req, res, err) => {
const params = req.params;
const vote = new Vote({
_id: new mon... |
Java | GB18030 | 414 | 2.9375 | 3 | [] | no_license | package days20.Singleton;
/**
* Created by Administrator on 2017/6/4.
* ģʽģʽ
* -----------ģʽ֮ʽ---------------
*/
public class SingleDemo1 {
private static SingleDemo1 sin = null;
private SingleDemo1() {
}
public static synchronized SingleDemo1 getInstance() {
if(sin==null)
si... |
Shell | UTF-8 | 445 | 2.921875 | 3 | [
"MIT"
] | permissive | #!/bin/sh -e
pkg-config --exists libudev || {
printf 'udev (or libudev-zero) is required\n'
exit 1
}
export DESTDIR="$1"
rm -rf po
sed -i 's/DocTools//' CMakeLists.txt
sed -i '/add_subdirectory(doc)/d' CMakeLists.txt
cmake -B build \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=... |
Markdown | UTF-8 | 1,029 | 3.046875 | 3 | [] | no_license | # DoubleClickListener for Android
_______________________________________________________________
**Note: I recommend to use `android.view.GestureDetector` instead of this class. GestureDetector provides a smoother user experience.**
A simple double click listener to implement instagram-like double tap behaviour.
It... |
Java | UTF-8 | 617 | 3.515625 | 4 | [] | no_license | import java.util.*;
public class euler2
{
/**
* @param args
*/
public static void main(String[] args)
{
int x = 0;
int sum = 0;
ArrayList nums = new ArrayList();
nums.add(1);
nums.add(2);
System.out.println(nums);
int c = 0;
while (c < 4000000)
{
int a = (Integer) nums.get(x);
i... |
Markdown | UTF-8 | 2,635 | 3.921875 | 4 | [] | no_license | # 计算机算术章节总结
## 整数乘法
1. 无符号整数乘法
- 用寄存器Q, M存储乘数和被乘数,用寄存器A存储积,加上一个一位寄存器C存储进位。注意,这里Q,M,A都是等长度的,(C,A,Q)共同组成了结果。
- 算法:
- 初始:将A,C置0,Q,M中分别放置第一个、第二个乘数。$cnt=0$
- 循环:
- 判断:
- 若Q末位为1,则$(C,A)\gets A+M$
- 若Q末位为0,则pass
- 移位:$(C,A,Q)$共同向右移一位,C用0补齐。
- $cnt\gets cnt+1$
- 当$c... |
TypeScript | UTF-8 | 1,136 | 2.609375 | 3 | [] | no_license | import { orderBy } from "lodash";
import { createSelector } from "reselect";
import { State } from "@client/redux";
import { UserTranslation } from "@common/types";
export enum ChronologicalOrder {
OldestFirst = "oldest-first",
NewestFirst = "newest-first"
}
export const getUserTranslations: (
state: State,
... |
C++ | UTF-8 | 2,598 | 2.578125 | 3 | [] | no_license | #include "ChangeLogItem.h"
namespace PaymentofInternetAccess
{
ChangeLogItem::ChangeLogItem(String^ table_count, String^ change_type)
{
this->table = table_count;
this->change_type = change_type;
primary_key = gcnew Dictionary<String^, String^>();
column_name = gcnew List<String^>();
value = gcne... |
Java | UTF-8 | 9,929 | 1.570313 | 2 | [] | no_license | /*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.loader.plan.exec.internal;
import java.sql.ResultSet;
import... |
Markdown | UTF-8 | 954 | 2.84375 | 3 | [] | no_license | # Lexical Analysis Pipeline
## Description
Analyzes facets from EBI Biosamples to identify pairs of facets to merge. Facets are first split into
groups of facets that contain typos and those that do not. The group of facets with no typos are examined
for merge pairs using fuzzy matching followed by use of lemmatizati... |
Java | UTF-8 | 626 | 2.53125 | 3 | [] | no_license | /**
*
*/
package cn.edu.ecnu.heng.pinduoduo;
import java.util.Scanner;
/**
* @author Heng(LEGION)
*
* @create 2019年3月10日-下午4:13:13
*
* @detail
*/
public class Main2 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in = new Scanner(System.in)... |
Python | UTF-8 | 17,418 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, division
import numpy as np
import collections
import matplotlib.pyplot as py
import matplotlib.gridspec as gridspec
import sys
from scipy.stats.stats import pearsonr
from scipy import stats
from operator import itemgetter
class Book... |
Markdown | UTF-8 | 2,865 | 2.875 | 3 | [] | no_license | # 创建用户并授权使用DRS<a name="drs_08_0012"></a>
如果您需要对您所拥有的DRS进行精细的权限管理,您可以通过[企业管理](https://support.huaweicloud.com/zh-cn/usermanual-em/em-topic_02.html)或[统一身份认证服务](https://support.huaweicloud.com/usermanual-iam/iam_01_0001.html)(Identity and Access Management,简称IAM)实现。
- 通过企业管理实现的具体操作,请您参考[项目管理](https://support.huaweiclo... |
JavaScript | UTF-8 | 2,026 | 2.8125 | 3 | [] | no_license | var camera, scene, renderer;
var geometry, material, mesh;
init();
animate();
function init() {
scene = new THREE.Scene();
group = new THREE.Group();
camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, .1, 1000);
camera.position.set(0,0,100);
camera.lookAt(scen... |
Java | UTF-8 | 5,647 | 2.078125 | 2 | [] | no_license | package org.soptorshi.service.mapper;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Generated;
import org.soptorshi.domain.CommercialBudget;
import org.soptorshi.service.dto.CommercialBudgetDTO;
import org.springframework.stereotype.Component;
@Generated(
value = "org.mapstruct.ap.Map... |
JavaScript | UTF-8 | 1,913 | 2.578125 | 3 | [] | no_license | import {
CHANGE_SHOW_TODOS_TYPE,
CHANGE_TODO_TYPE,
COLLAPSE_TODOS,
CREATE_TODO,
DELETE_TODO,
} from './actions/todos'
import { collapseTodos } from './actionCreators/todos'
const initialState = {
all: [],
active: [],
completed: [],
showTodosType: 'all',
collapseTodos: false,
}
function active(all)... |
Java | UTF-8 | 126 | 1.632813 | 2 | [] | no_license | package com.digital.coffeeshop.constants;
public interface Constants {
boolean TRUE = true;
boolean FALSE = false;
}
|
Markdown | UTF-8 | 3,288 | 3.453125 | 3 | [] | no_license | - [shell中其他值得关注的知识点](#shell%e4%b8%ad%e5%85%b6%e4%bb%96%e5%80%bc%e5%be%97%e5%85%b3%e6%b3%a8%e7%9a%84%e7%9f%a5%e8%af%86%e7%82%b9)
- [1. case语句](#1-case%e8%af%ad%e5%8f%a5)
- [2. 调用shell程序的传参](#2-%e8%b0%83%e7%94%a8shell%e7%a8%8b%e5%ba%8f%e7%9a%84%e4%bc%a0%e5%8f%82)
- [3. while 循环和 case 语言和传参相结合](#3-while-%e5%be%aa%e7... |
C# | UTF-8 | 1,908 | 3.125 | 3 | [
"Apache-2.0"
] | permissive | using System;
using System.Collections.Generic;
namespace Bici
{
class Program
{
static void Main(string[] args)
{
Bici bici1 = new Bici();
bici1.init("Huffy", 8, 12);
//bici1.sube();
bici1.print();
Bici bici2 = new Bici();
bici2.init("PineStar"... |
C++ | UTF-8 | 1,224 | 3.21875 | 3 | [] | no_license | #include <iostream>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <fstream>
void print_usage()
{
std::cout << "usage: gen -n {file_name} -s {1eN}" << std::endl;
exit(1);
}
auto parse_size_file(const char* size)
{
if (!strstr(size, "1e")) print_usage();
auto p = atoi(&(size[2]));
... |
JavaScript | UTF-8 | 6,462 | 2.5625 | 3 | [
"MIT",
"Unlicense"
] | permissive | // v13
const { MessageSelectMenu: MessageMenu, MessageActionRow } = require('discord.js')
module.exports = {
name: 'filters',
category: 'filter',
description: '[Premium] 切換特效',
aliases: [],
premium: true,
run: async (bot, msg, args) => {
var { MessageMenuOption } = bot
try {
if (!bot.player.... |
Java | UTF-8 | 474 | 2.109375 | 2 | [] | no_license | package com.yc.compare.bean;
import java.util.List;
/**
* Created by myflying on 2018/12/5.
*/
public class CountryWrapper {
private String name;
private List<CountryInfo> list;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
... |
Java | UTF-8 | 1,746 | 2.90625 | 3 | [] | no_license | package org.limewire.ui.swing.components;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.JComponent;
import javax.swing.Timer;
/**
* This mouse listener is intended to hide the supplied component after... |
Python | UTF-8 | 881 | 3.515625 | 4 | [] | no_license | """
almost-sorted
"""
def almost_sorted(a):
s = sorted(a)
if s == a:
print("yes")
else:
indices = [i for i in range(len(a)) if s[i] != a[i]]
if len(indices) == 2:
a[indices[0]], a[indices[1]] = a[indices[1]], a[indices[0]]
if s == a:
print("y... |
Python | UTF-8 | 9,241 | 2.96875 | 3 | [] | no_license | #main.py
#This function initialises all required aspects of the vision system and then continually processes the live video
#stream to identify hands, cards and bets. A GUI is then shown on top of the live stream.
#Imports
import imutils
import numpy as np
import cv2
from matplotlib import pyplot as plt
fro... |
Java | UTF-8 | 1,730 | 4.1875 | 4 | [] | no_license |
package hw33;
/**
* Реализует структуру данных "Стэк" на основе одномерного массива.
* @author Егор
*/
public class Stack2 implements StackI{
private int n = 20;
private int[] array = new int[n];
private int length = 0;
/**
* Упорядоченно кладёт новый элемент в стэк (на вершину стэка).
* ... |
JavaScript | UTF-8 | 498 | 3.421875 | 3 | [] | no_license | let insertSort = function(arr) {
if (!arr) throw new Error("new error!");
let len = arr.length;
for (let i = 1; i < len; i++) {
if (arr[i] < arr[i-1]) {
let k = i - 1,
d = arr[i];
arr[i] = arr[i-1];
while(arr[k] > d) {
arr[k--] = a... |
C++ | UTF-8 | 1,768 | 3.0625 | 3 | [] | no_license | #ifndef COLOR_H
#define COLOR_H
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include "bitmap_image.hpp"
using namespace std;
// RGB struct
struct RGB {
int red;
int green;
int blue;
};
// HSV struct
struct HSV {
double hue;
double saturation;
double value... |
TypeScript | UTF-8 | 1,565 | 2.671875 | 3 | [] | no_license | import { IAppAction } from './app-state';
import { Todo } from './todo';
export const ADD_TODO = 'ADD_TODO'
export const REMOVE_TODO = 'REMOVE_TODO'
export const CLEAR_COMPLETED = 'CLEAR_COMPLETED'
export const START_EDIT = 'START_EDIT'
export const TODOS_RETRIEVED = 'TODOS_RETRIEVED'
export const CANCEL_EDIT = 'CANCE... |
TypeScript | UTF-8 | 361 | 2.578125 | 3 | [] | no_license | //
import {
debounce as lodashDebounce
} from "lodash";
export function debounce(duration: number): MethodDecorator {
let decorator = function (target: object, name: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor {
descriptor.value = lodashDebounce(descriptor.value, duration);
retur... |
Swift | UTF-8 | 438 | 2.59375 | 3 | [] | no_license | //
// ToDo.swift
// ToDo
//
// Created by MacBook Air on 28.11.2019.
// Copyright © 2019 MacBook Air. All rights reserved.
//
import UIKit
class ToDo {
var name = ""
var important = false
var priority = 0
var timeForTask = 0.0
var timeLeft = 0.0
var startTimePlanning = Date()
var ... |
Java | UTF-8 | 655 | 3.171875 | 3 | [] | no_license | package domain;
public class IPhone extends CellPhone {
protected String data;
static public final String BRAND = "애플",KIND="아이폰";
public void setData(String data) {
this.data=data+"이라고 문자했다.";
}
public String getData() {
return data;
}
public String toString() {
// 홍길동에게 010번호로 애플 제품 아이폰을 사용해서
... |
C# | UTF-8 | 1,818 | 2.640625 | 3 | [
"MIT"
] | permissive | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Globalization;
namespace Crystal.Themes.Converters;
/// <summary>
/// Converts a String into a Visib... |
Ruby | UTF-8 | 544 | 4.1875 | 4 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | # Write your code here.
def line(deli_array)
string = "The line is currently empty."
if deli_array.length > 0
string = "The line is currently: "
deli_array.each_with_index do |person, i|
string += "#{i + 1}. #{person} "
end
end
puts string.strip
end
def take_a_number(deli, name)
deli.push(name)
puts "W... |
C++ | UTF-8 | 754 | 2.671875 | 3 | [] | no_license | //
// Created by akira on 6/18/17.
//
#ifndef KNOWLEDGEMAP_V2_PREDMAP_H
#define KNOWLEDGEMAP_V2_PREDMAP_H
#include <unordered_map>
#include "Indiv.h"
namespace kri_map{
class PredMap{
private:
//example 2_3_4_ -> True
//map indiv_ids -> T/F
std::unordered_map<std::string, bool> map_;
... |
C++ | UTF-8 | 1,467 | 2.59375 | 3 | [
"MIT"
] | permissive | #include <iomanip>
#include <iostream>
#include <sstream>
#include <string>
#include "CPU_Fault.hpp"
#include "Instructions.hpp"
using namespace std;
CPU::Fault::Fault(const CPU& cpu, const string& msg)
{
stringstream ss;
ss << "CPU Fault: " << msg << '\n';
ss << "\tOpcode: ";
if (cpu... |
Markdown | UTF-8 | 1,521 | 2.703125 | 3 | [
"MIT"
] | permissive | # Fable.Remoting
Fable.Remoting is a [RPC](https://en.wikipedia.org/wiki/Remote_procedure_call) communication layer for Fable and .NET apps featuring [Suave](https://github.com/SuaveIO/suave), [Giraffe](https://github.com/giraffe-fsharp/Giraffe), [Saturn](https://github.com/SaturnFramework/Saturn) or any [Asp.net core... |
Java | UTF-8 | 1,446 | 2.46875 | 2 | [] | no_license | package org.rb.qa.xmlmodel;
import org.rb.mm.interfaceimpl.JaxbXmlParser;
import org.rb.mm.interfaceimpl.SimpleXmlParser;
import org.rb.qa.model.KNBase;
import org.rb.mm.interfaces.IStorage;
/**
* Application scope Xml serializer/deserializer factory
* @author raitis
*/
public class XmlFactory {
... |
Java | WINDOWS-1252 | 517 | 3.234375 | 3 | [
"MIT"
] | permissive | // A+ Computer Science - www.apluscompsci.com
//Name -
//Date -
//Class -
//Lab -
import static java.lang.System.*;
public class StringFirstLetterCheck
{
String wordOne, wordTwo;
public StringFirstLetterCheck()
{
}
public StringFirstLetterCheck(String one, String two)
{
}
public void setWords(String one... |
Java | UTF-8 | 1,348 | 1.828125 | 2 | [] | no_license | package com.ztravel.paygate.api.alipay.model;
/**
* 退款解冻结果:解冻结订单号^冻结订单号^解冻结金额^交易号^处理时间^状 态^描述码
*
* @author dingguangxian
*
*/
public class RefundUnfreezedModel {
private String unfreezeNum;
private String freezeNum;
private long unfreezeAmount;
private String traceNum;
private String transTime;
private St... |
C# | UTF-8 | 1,093 | 2.953125 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RespositoryDemo
{
/// <summary>
/// 所有仓库中相同逻辑实现的地方
/// </summary>
/// <typeparam name="T"></typeparam>
public abstract class BaseRepository<T> : IRespository<T>
{
... |
C# | UTF-8 | 1,314 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Oblqo.Tasks
{
[System.AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = false)]
sealed class AccountFileStateChangeAttribute : Attribute
{
// See the... |
Java | UTF-8 | 502 | 3.15625 | 3 | [] | no_license | package question10;
public class booleancontains {
public static boolean contains(String[] names, String element)
{
for (int Count = 0 ; Count< names.length ; Count++){
if(element == names[Count]){
return true;
}else return false;
}
return fa... |
Rust | UTF-8 | 393 | 3.109375 | 3 | [] | no_license | use std::thread;
// mpsc - multi-producer, single-consumer
// https://doc.rust-lang.org/std/sync/mpsc/
use std::sync::mpsc;
pub fn run() {
// destruct a tuple
let (tx, rx) = mpsc::channel();
// unwrap the Result
thread::spawn(move || {
tx.send(42).unwrap();
});
// recv() is blocking, ... |
Python | UTF-8 | 112 | 2.78125 | 3 | [] | no_license |
class GrupModel(object):
def __init__(self, id,GrupAdi):
self.id: int = id
self.grupadi: str = GrupAdi
|
Markdown | UTF-8 | 6,588 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | # RPZ Zones
## List all RPZ Zones
You may list collection of rpz zones using this action.
```shell
curl --include \
--header "Content-Type: application/json" \
--header "Authorization: Token token=iwwTXK54aahsosrx5JK7hkTe" \
'http://manage.rpzdb.com/api/v1/zones'
```
> The above command returns JSON stru... |
JavaScript | UTF-8 | 542 | 2.546875 | 3 | [] | no_license | //点击当前组件去掉其他组件焦点
function focus(e,that) {
let clickOne = e.currentTarget; // e.currentTarget 是你绑定事件的元素
let class_getmychart = document.getElementsByClassName("getmychart");
for (let i = 0 ; i < class_getmychart.length; i ++){
class_getmychart[i].classList.remove('active');
class_getmychart[i].classList.ad... |
Java | UTF-8 | 1,839 | 2.6875 | 3 | [] | no_license | /**
*
*/
package com.sd.model;
/**
* 附件实体表
* @author elang
*
*/
public class Attachment {
/**主键*/
private int id;
/**关联业务表主键*/
private int fid;
/**附件名称*/
private String fileName;
/**附件存放路径*/
private String filePath;
/**创建时间*/
private String createTime;
/**创建者*/
private int creator;
/**
* 附件类型:0:代... |
Markdown | UTF-8 | 7,270 | 2.5625 | 3 | [] | no_license | {{roughtranslation|time=2011-01-31T20:32:00+00:00}}
「'''「嬌蠻貓娘大橫行」角色CD'''」在2010年6月9日開始由Geneon Universal Entertainment一連發售該系列的[[單曲|單曲]]。
== 概要 ==
*[[電視動畫|電視動畫]]『[[嬌蠻貓娘大橫行|嬌蠻貓娘大橫行]]』的[[角色歌曲|角色歌曲]]系列。全4片。2010年6月9日至同年6月25日發售。每次同時發售2片。
*每片有兩首歌曲和一首[[樂器|Ver.Inst]],其中一首歌曲是主題曲「はっぴぃ にゅう にゃあ」的獨唱版本,沒有參與主題曲歌唱的乙女也有獨唱版本。另一首則是角色歌曲。
=... |
Python | UTF-8 | 816 | 3.375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# url: https://pythonprogramming.net/scatter-plot-matplotlib-tutorial/
# bar charts
import matplotlib.pyplot as plt
days=list(range(1,6))
sleeping = [7,8,6,11,7]
eating = [2,3,4,3,2]
working = [7,8,7,2,2]
playing = [8,5,7,8,13]
plt.plot([],[],color='m', label='Sleeping... |
Go | UTF-8 | 523 | 2.90625 | 3 | [] | no_license | package main
import "fmt"
var total_sol int
var limit uint
var board_size uint
func nqueen_bit(board_size, pos, l, r, depth uint) {
if board_size == depth {
total_sol++
return
}
var new uint
now := pos | l | r
for now < limit {
new = (now + 1) & ^now
nqueen_bit(board_size, pos|new, limit&((l|new)<<1), ... |
C++ | UTF-8 | 1,891 | 3.6875 | 4 | [
"MIT"
] | permissive | /**
* Pen.cpp
*
* Controller for manageing the pen (servo) up and down motion for drawing.
*
* @author Drew Sommer
* @version 1.0.1
* @license MIT (https://mit-license.org)
*/
#include "Pen.h"
#include <Arduino.h>
#include <Servo.h>
/**
* Instantiate the pen with a Servo
* @param pin The servo pin
* @... |
C++ | UHC | 727 | 3.109375 | 3 | [] | no_license | //#include <iostream>
//
////8ܰ γȸ : Ȱ
//
//using namespace std;
//
//int GetNumberOfPeople(int floor, int room)
//{
// if (floor == 0)
// {
// return room;
// }
//
// if (floor == 1)
// {
// return room * (room + 1) * 0.5;
// }
// else {
// int result = 0;
// for (int i = 0; i < room; ++i)
// {
// result += G... |
Ruby | UTF-8 | 445 | 3.6875 | 4 | [] | no_license |
# definition of class Car
class Car
def initialize(speed, comfort)
@rating = speed * comfort
end
# Setting rating from outside is not allowed
def rating
return @rating
end
# Details of how rating is calculated are kept inside the class
end
car_1 = Car.new(4, 5)
# expe... |
Java | UTF-8 | 1,529 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | package com.onaple.itemizer.data.access;
import com.onaple.itemizer.Itemizer;
import com.onaple.itemizer.data.beans.ItemBean;
import com.onaple.itemizer.data.handlers.ConfigurationHandler;
import javax.inject.Inject;
import javax.inject.Singleton;
import java.util.List;
import java.util.Map;
import java.util.Optional... |
Python | UTF-8 | 985 | 3.140625 | 3 | [] | no_license | import sys
sys.path.append('../')
from P36.main import prime_factors_multi
def totient_phi(num):
base = prime_factors_multi(num)
formula = 0 #後ほど式を入れる
for i in range(len(base)):
if formula > 0:
formula *= (base[i][0]-1) * base[i][0] ** (base[i][1]-1)
else:
formula =... |
PHP | UTF-8 | 4,631 | 2.953125 | 3 | [
"MIT"
] | permissive | <?php
class XInputtext extends XyneoField
{
/**
*
* @var integer
*/
protected $size = 20;
/**
*
* @var integer
*/
protected $minLength = 0;
/**
*
* @var integer
*/
protected $maxLength;
/**
*
* @var string
*/
protected $pla... |
Java | UTF-8 | 804 | 2.265625 | 2 | [] | no_license | package models;
import java.sql.Date;
public class Comments {
private int commentId;
private int userId;
private int eventId;
public int getCommentId() {
return commentId;
}
public int getUserId() {
return userId;
}
public int getEventId() {
return eventId;
}
public String getComment() {
return com... |
Python | UTF-8 | 1,254 | 3.578125 | 4 | [] | no_license | import matplotlib.pyplot as plt
x_data = [1.0, 2.0, 3.0]
y_data = [2.0, 4.0, 6.0]
first_w = 1
w = 1 # a random guess: random value
lr = 0.01 # learning rate
# our model forward pass
def forward(x):
return x * w
# Loss function
def loss(x, y):
y_pred = forward(x)
return (y_pred - y) * (y_pred - y)
#... |
JavaScript | UTF-8 | 1,957 | 2.765625 | 3 | [] | no_license | var React = require('react-native');
var {
AsyncStorage
} = React;
var DEVICE_STORAGE_PREFIX = '@Quotail:';
var _parseString = function(value, type) {
if (value === null) {
return null;
}
else if (type === "object") {
return JSON.parse(value);
}
else if (type === "boolean") {
return value === ... |
JavaScript | UTF-8 | 6,484 | 2.796875 | 3 | [] | no_license | import React from 'react';
import { useState } from 'react';
// import styles from './UserForm.module.css/';
const UserForm = () => {
const [firstName, setFirstName ] = useState("");
const [firstError, setFirstError] = useState("");
const [lastName, setLastName ] = useState("");
const [lastError, setLa... |
C | UTF-8 | 17,675 | 3.15625 | 3 | [] | no_license | //Librerias de C
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
//Librerias creadas por nosotros
#include "TDAs/TDA_Mapa/hashmap.h"
#include "TDAs/TDA_Lista/list.h"
#include "Estructuras/structs.h"
#include "grafos.h"
#include "Interfaz/interfaz.h"
//Funcion para mostrar la ... |
Python | UTF-8 | 450 | 3.296875 | 3 | [] | no_license | """
instructions --
- Label the axes. Don't forget that you should always include units in your axis labels. Your yy-axis label is just 'count'. Your xx-axis
label is 'petal length (cm)'. The units are essential!
- Redraw the plot constructed in the above steps using plt.draw(). Like with plt.show(), you do not need t... |
PHP | UTF-8 | 4,136 | 2.515625 | 3 | [] | no_license | <?php
namespace App\Http\Controllers\Shop;
use App\Models\Menu;
use App\Models\MenuCate;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
class MenuController extends BaseController
{
# 菜品首页
public function index(Request... |
Markdown | UTF-8 | 1,382 | 3.25 | 3 | [
"MIT"
] | permissive |
Video processing on GCP cloud function using ffmpeg
I have a website where users upload videos which are stored to cloud storage. These videos could be in any format, hence they are sometimes not compatible with certain devices. Eg: webm videos uploaded from a laptop are not compatible with mobile browsers.
We will c... |
C++ | UTF-8 | 2,742 | 3.5 | 4 | [] | no_license | #ifndef UTILITY_SUPPORT_PROGRESSBAR_HPP
#define UTILITY_SUPPORT_PROGRESSBAR_HPP
#include <chrono>
#include <limits>
#include <string>
#include <vector>
namespace utility::support {
/**
* @brief This class displays a progress on a single line in the terminal showing rates and a bar to show progress
*/
... |
JavaScript | UTF-8 | 1,205 | 2.640625 | 3 | [
"MIT"
] | permissive | // doc const aHandle = await frame.evaluateHandle(() => document.body);
beforeAll(async () => {
await page.goto(`http://localhost:${PORT}`);
})
test('all elements in this example should be available to test', async () => {
const expected = [
"heading",
"paragraph",
"light-theme",
"dark-theme",
... |
Python | UTF-8 | 1,933 | 3.078125 | 3 | [
"MIT"
] | permissive | #!/opt/local/bin/python
"""
Program that shows the program on the right and its abstract syntax tree (ast) on the left.
"""
from __future__ import print_function
import sys, argparse, logging
import astviewer
from PySide import QtGui
logger = logging.getLogger(__name__)
def main():
""" Main program ... |
Python | UTF-8 | 535 | 2.5625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
from imlazy import import_or_install
click = import_or_install('click')
docker = import_or_install('docker')
@click.command()
def dockerlist():
"""
dockerlist
Gets a list of running docker containers and presents them.
"""
client = docker.from_env()
containers = [c.na... |
C++ | UTF-8 | 780 | 2.640625 | 3 | [
"MIT"
] | permissive | #pragma once
#include "PhysicalAction.h"
namespace ample::game::stateMachine::actions
{
class PhysicalApplyAngularImpAction : public PhysicalAction
{
public:
PhysicalApplyAngularImpAction(const std::string &name,
const std::vector<std::string> &bodyNames,
... |
Python | UTF-8 | 114 | 3.609375 | 4 | [] | no_license | #This is an exercise on practicing print formatting
today = "Today is a {}".format('HORRIBLE day')
print(today) |
Markdown | UTF-8 | 4,509 | 3.3125 | 3 | [] | no_license | <!--META--
author: Sean K Smith
created: 2019-05-17T01:26:37Z
edited: 2019-05-17T01:26:37Z
title: Active Learning
subtitle: becomming a better programmer when osmosis is not enough
tags:
- learning
--END-->
Programming did not come naturally to me. In high-school I hung on to the kid nearest to me who seemed to have ... |
Ruby | UTF-8 | 780 | 3.53125 | 4 | [
"MIT"
] | permissive | # See more interesting examples in examples.rb
class MyApp
def call(env)
status_code = 200 # i.e. 'HTTP 200 OK'
headers = {}
headers["Content-Type"] = "text/plain"
lines_of_body = [
"Hi there. You're trying to retrieve the following page: ",
env['PATH_INFO'].inspect,
"\n",
"... |
Markdown | UTF-8 | 8,119 | 2.96875 | 3 | [] | no_license | Power Cycle Script
=======================
Purpose
-------
The purpose of the Power Cycle script is to provide an automated way for
clients to power cycle VM’s.
The script is intended to be used with a scheduled job and configured to power
off and on at set times each day.
Pre-Requisites
--------------
The followi... |
Ruby | UTF-8 | 910 | 3.28125 | 3 | [] | no_license | latest = nil
while true
# seed
if latest.nil?
latest = '0'
end
a = latest.split("")
incrementor = a.last
carry_over = false
# deal with incrementor
if incrementor == '9'
incrementor = 'a'
elsif incrementor == 'z'
incrementor = '0'
carry_over = true
else
incrementor.next!
en... |
C++ | UTF-8 | 1,648 | 3.09375 | 3 | [] | no_license | //
// Created by yuwenyong.vincent on 2019-01-13.
//
#include "net4cxx/net4cxx.h"
using namespace net4cxx;
class Person {
public:
Person() = default;
Person(std::string name, int age, std::string gender, double height)
: _name(std::move(name)), _age(age), _gender(std::move(gender)), _height(heig... |
Markdown | UTF-8 | 8,981 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | ---
layout: post
title: "记一次vpc迁移"
subtitle: "VPC , Docker network ?"
date: 2018-07-23
author: "GiraffeTree"
header-img: "img/post-bg-js-version.jpg"
tags:
- Docker
- 后端
- 日常
---
# 记一次vpc迁移
## 关键词
VPC , Docker network
## 起因
公司新买了几台服务器当海外服,都是在同一个VPC下的,但因为之前还有一台服务器运行在阿里云的经典网络下,并不在... |
C++ | UTF-8 | 3,451 | 2.796875 | 3 | [] | no_license | /*
* record.cpp
*
* Created on: Jun 4, 2018
* Author: mchen
*/
#include "flag.h"
#include "record.h"
#include "util.h"
#include <iostream>
#include <stdlib.h>
#include <vector>
using namespace std;
// Public ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Record::Record(const std::string &s_re... |
SQL | UTF-8 | 211 | 3.28125 | 3 | [
"Apache-2.0"
] | permissive | -- 5. Select the warehouse code and the average value of the boxes in each warehouse.
--
select warehouse,avg(value) as Average_value_of_boxes_per_warehouse from boxes group by warehouse order by warehouse asc; |
Python | UTF-8 | 432 | 3.125 | 3 | [] | no_license | def find_it(seq):
my_dict = {}
num = 0
for i in seq:
my_dict[i] = 0
for i in seq:
try:
while seq[num] == i:
my_dict[i] += 1
if num <= len(seq)-1:
num += 1
else:
break
except ... |
Java | UTF-8 | 1,720 | 2.828125 | 3 | [] | no_license | package com.jing.imageloader.request;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.PriorityBlockingQueue;
import java.util.concurrent.atomic.AtomicInteger;
/**
* author: 陈永镜 .
* date: 2017/6/21 .
* email: jing20071201@qq.com
* <p>
* introduce:
*/
public class RequestQueue {
/**
... |
Java | UTF-8 | 12,085 | 1.507813 | 2 | [] | no_license | // Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: braces fieldsfirst space lnc
package com.google.zxing.client.android.book;
import android.app.Activity;
import android.content.Intent;
import android.os.AsyncTask;
import an... |
Markdown | UTF-8 | 337 | 2.609375 | 3 | [] | no_license | ## 常见数据结构
- 数组(Array)
- 链表(Linked List)
- 堆(Heap)
- 栈(Stack)
- 队列(Queue)
- 树(Tree)
- 图(Map)
- 哈希表(Hash)
## 参考文章
- [准备下次编程面试前你应该知道的数据结构](https://blog.fundebug.com/2018/08/27/code-interview-data-structure/)
- https://www.jianshu.com/p/ec783261165d
|
JavaScript | UTF-8 | 4,606 | 2.734375 | 3 | [] | no_license | var img;
function load() {
var currentElementId = getElementId();
var URL = window.location.href.substring(0, window.location.href.lastIndexOf('/')) + "/";
var foundElement = false;
if (currentElementId == null) {
window.location.href = URL + "index.html";
}
for (var i = 1; i <= elements... |
TypeScript | UTF-8 | 1,096 | 3.484375 | 3 | [
"MIT"
] | permissive | class TopVotedCandidate {
orderedArray: { time: number; voteFor: number }[];
constructor(persons: number[], times: number[]) {
this.orderedArray = [];
persons.forEach((vote, index) => {
const timeOFVote = times[index];
this.orderedArray.push({ time: timeOFVote, voteFor: vote });
});
}
q... |
Java | UTF-8 | 1,892 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | package com.es.singular.cover.zoo.test;
import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;
import com.es.controller.zoo.Zoo;
import com.es.singular.cover.zoo.animals.Chiken;
import com.es.singular.cover.zoo.animals.Dog;
import com.es.singular.cover.zoo.animals.DogType;
import ... |
Shell | UTF-8 | 150 | 3.203125 | 3 | [] | no_license | #!/bin/bash
LOCK_FILE="lock"
if [ -f ${LOCK_FILE} ]; then
echo "ファイルが存在します"
else
echo "ファイルが存在しません"
fi |
C | UTF-8 | 1,085 | 3.984375 | 4 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
struct q {
int value;
struct q *next;
};
struct q *head=NULL,*tail=NULL;
void enqueue(int val)
{
struct q *temp=(struct q*)malloc(sizeof (struct q));
temp->value=val;
temp->next=NULL;
if (head==NULL) {
head=temp;
tail=temp;
... |
Swift | UTF-8 | 3,559 | 3.078125 | 3 | [] | no_license | //
// BaseService.swift
// GitHubRepos
//
// Created by Adrian Ghitun on 22/10/2019.
// Copyright © 2019 Adrian Ghitun. All rights reserved.
//
import Foundation
import Alamofire
/*
Exposing only what matters. Hiding the actual implementation.
Depending upon abstractions not concretions
*/
protocol BaseService... |
TypeScript | UTF-8 | 2,089 | 2.5625 | 3 | [] | no_license | import {inject, injectable} from "inversify";
import "reflect-metadata";
import ClientInterface from "./ClientInterface";
import CONSTANTS from "./app/config/constants";
import LoggerInterface from "./LoggerInterface";
import * as Fetch from "node-fetch";
import RetryLimitReached from "./RetryLimitReached";
@injectabl... |
Java | UTF-8 | 358 | 1.867188 | 2 | [] | no_license | package com.yhren.Dao.Interface;
import com.yhren.Dao.Bean.LeaseCapital;
import java.util.List;
public interface LeaseCapitalMapper {
int deleteByPrimaryKey(Integer capId);
int insert(LeaseCapital record);
LeaseCapital selectByPrimaryKey(Integer capId);
List<LeaseCapital> selectAll();
int upda... |
C | UTF-8 | 3,792 | 3.21875 | 3 | [] | no_license | #ifndef MEMBER_LIST_H_
#define MEMBER_LIST_H_
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "member.h"
#define NO_EVENTS 0
/** Type for defining the member list*/
typedef struct MemberList_t *MemberList;
/**
* memberListCreate: Allocates a new empty member list.
*
* @retu... |
C# | UTF-8 | 2,640 | 3.3125 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
namespace Ex3.Models
{
public class FileModel : IModel
{
private IList<FlightData> DataList;
private int index;
public bool IsAlive { get; private set; }
public FileModel(st... |
PHP | UTF-8 | 220 | 2.578125 | 3 | [] | no_license | <?php
declare(strict_types=1);
namespace Sourcegr\Framework\Http\Router;
interface PredicateCompilerInterface
{
public function runPredicate($callback, RouteMatchInterface $routeMatch);
} |
C# | UTF-8 | 3,808 | 2.65625 | 3 | [
"MIT"
] | permissive | // Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
using Entities;
using Repositories.Contracts;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Threading.Tasks;
namespace Repositories.Secur... |
Python | UTF-8 | 406 | 3.09375 | 3 | [] | no_license | import numpy as np
import pandas as pd
from datetime import datetime
file = pd.read_csv("Docs/N26_Juni.csv")
balance = file["Amount (EUR)"].sum()
print(file)
print("______________________")
print("El balance del mes de ")
file['month'] = pd.DatetimeIndex(file['Date']).month
print(file['month'][0:1])
print(str(file['... |
TypeScript | UTF-8 | 6,527 | 2.875 | 3 | [] | no_license | declare namespace org {
namespace spongepowered {
namespace api {
namespace event {
namespace server {
namespace query {
namespace QueryServerEvent {
// @ts-ignore
interface Basic ... |
Ruby | UTF-8 | 164 | 2.953125 | 3 | [] | no_license | ages = { "Herman"=>32, "Lily"=>30, "Grandpa"=>5843, "Eddie"=>10, "Marilyn"=>22, "Spot"=>237 }
total_age = 0
ages.each do |k, v|
total_age += v
end
p total_age
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.