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 | 3,212 | 4.75 | 5 | [
"MIT"
] | permissive | # Lesson 2 - Types
#
# Most languages are "strictly typed" which means
# a variable can only hold one type of information.
# Basic types called primitive types. While the available primitive types
# can vary from language to language they are usually whole numbers, floating
# point numbers, boolean numbers, and *strin... |
C++ | UTF-8 | 1,091 | 2.5625 | 3 | [
"MIT"
] | permissive | #include "PatternFinder.hpp"
#include "ObjectsStore.hpp"
#include "EngineClasses.hpp"
// This class contains the class which allows the generator access to global objects list.
class FUObjectItem
{
public:
UObject* Object;
int32_t Flags;
int32_t ClusterIndex;
int32_t SerialNumber;
};
class TUObjectArray
{
publi... |
C++ | UTF-8 | 4,502 | 2.609375 | 3 | [
"BSD-3-Clause"
] | permissive | #include "../utils.h"
#include "../plugin.h"
#include <libgfx/utility.h>
#include "render.h"
#include <fstream>
#include <cmath>
namespace CG {
class LSystem2D : public Plugin
{
public:
img::EasyImage image(const ini::Configuration &conf)
{
int size;
img::Color bgColor;
s... |
Shell | UTF-8 | 403 | 3.109375 | 3 | [
"MIT"
] | permissive | #!/sbin/busybox sh
internal_sd="/data/media/0"
bak_dir=${internal_sd}/_appbak
echo "NOTICE: This tool should only be used to restore data after a Wipe."
echo "Your existing app/data will be overwritten!"
# Check for backup file
if [ ! -e ${bak_dir}/bak.tar.gz ]; then
echo Backup file not found. Exiting.
exit -1
fi... |
Java | UTF-8 | 675 | 3.375 | 3 | [] | no_license | package practice.ch15;
import confuse.ch15.FiveTuple;
class SixTuple<A, B, C, D, E, F> extends FiveTuple<A, B, C, D, E> {
public final F sixth;
public SixTuple(A a, B b, C c, D d, E e, F f) {
super(a, b, c, d, e);
sixth = f;
}
public String toString() {
return "(" + first + ", ... |
Java | UTF-8 | 1,099 | 2.046875 | 2 | [
"MIT",
"LicenseRef-scancode-unicode",
"Apache-2.0"
] | permissive | /*
* Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by app... |
Markdown | UTF-8 | 2,454 | 2.953125 | 3 | [
"MIT"
] | permissive | # Blockchain Data
Blockchain has the potential to change the way that the world approaches data. Develop Blockchain skills by understanding the data model behind Blockchain by developing your own simplified private blockchain.
## Getting Started
These instructions will get you a copy of the project up and running on... |
Ruby | UTF-8 | 1,802 | 2.75 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #define API for the data set
module SwitchBoard
class AbstractDataset
attr_accessor :persistance
def set_persistance(persistance)
@persistance = persistance
end
#Returns the next Model/ID that is available from the dataset
def get_next(limit = 1)
raise "#{__method__} not implemented... |
C | UTF-8 | 2,037 | 2.625 | 3 | [
"MIT"
] | permissive | #include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/uaccess.h>
#define DEVICE_NAME "textlandslide"
// mknod DEVICE_NAME c major minor
// The license type
MODULE_LICENSE("GPL");
// The author -- visible when you use modinfo
MODULE_AUTHOR("Surbhit Awa... |
C# | UTF-8 | 709 | 2.546875 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Web;
namespace ORM.Entities
{
/// <summary>
/// This ORM entity represents a question which stores in the database.
/// </summary>
public class Question
{
pub... |
Markdown | UTF-8 | 3,209 | 3.109375 | 3 | [] | no_license | # ResponsiveDrawerDojoWidget
A Responsive Drawer Dojo Widget to be used with the ArcGIS JS API.
This Widget was designed to be used w/ an app that uses a full-width MapView or SceneView.
## Demos:
- Left-side drawer w/ header: https://chipdenton.github.io/ResponsiveDrawerDojoWidget/Demo/
- Left-side drawer w/o header... |
SQL | UTF-8 | 793 | 3.28125 | 3 | [] | no_license | create table users (
id bigserial primary key,
email text not null unique
);
create table vacation_requests (
id bigserial primary key,
user_id bigint not null references users(id),
vacation_type text not null check (vacation_type in ('Yearly')),
start_date date not null,
end... |
Java | UTF-8 | 238 | 2.0625 | 2 | [] | no_license | /**
*
*/
package br.com.alura.designpatterns.cap6;
import java.util.Calendar;
/**
* @author eltonf
*
*/
public class CalendarSistema implements Relogio {
@Override
public Calendar hoje() {
return Calendar.getInstance();
}
}
|
Java | UTF-8 | 16,402 | 2.171875 | 2 | [
"Apache-2.0"
] | permissive | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you ... |
C++ | UTF-8 | 356 | 2.625 | 3 | [] | no_license | #include<stdio.h>
void nhap(int a[],int &n)
{
scanf("%d",&n);
for(int i=0;i<n;i++)
scanf("%d",&a[i]);
}
int so(int a)
{
if(a%2==0) return 1;
return 0;
}
int kq(int a[],int n)
{
for(int i=0;i<n-1;i++)
{
if(so(a[i])==so(a[i+1])) return i+1;
}
return -1;
}
int main()
{
int a[101],n;
nhap(a,n);
int ans=kq(a,... |
Java | UTF-8 | 4,747 | 2.4375 | 2 | [] | no_license | /*
This file is part of the BlueJ program.
Copyright (C) 1999-2009,2010,2013,2016 Michael Kolling and John Rosenberg
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of t... |
Java | UTF-8 | 3,583 | 2.25 | 2 | [] | no_license | /*
* 所有权归603实验室所有
*/
package edu.hdu.lab.services.impl;
import edu.hdu.lab.mapper.LifeMapper;
import edu.hdu.lab.pojo.Life;
import edu.hdu.lab.pojo.LifeExample;
import edu.hdu.lab.services.LifeService;
import edu.hdu.lab.utils.Constants;
import edu.hdu.lab.utils.LocationUtils;
import edu.hdu.lab.utils.WebUtils;
im... |
TypeScript | UTF-8 | 2,183 | 2.78125 | 3 | [] | no_license | import { TOGGLE_SHOW_FILTER } from "./demo.actions";
import { UPDATE_FOOD } from "./demo.actions";
//Do NOT Delete this import
import { DemoActions, DemoActionTypes } from "./demo.actions.creator";
import { DemoState, initialDemoState } from "./store";
//Change import in demos.modules.ts to use this:
// import { demo... |
Go | UTF-8 | 463 | 3.265625 | 3 | [] | no_license | package main
import "fmt"
func main(){
var nilai32 int32 = 128
var nilai64 int64 = int64(nilai32)
//overflow
var nilai8 int8 = int8(nilai32)
fmt.Println(nilai32)
fmt.Println(nilai64)
fmt.Println(nilai8)
//String Conversion
var kata = "ABC"
//Automatically set to byte because the ascii number < 128,... |
Java | UTF-8 | 3,575 | 2.21875 | 2 | [
"Apache-2.0"
] | permissive | /**
*
*/
package com.ouchat.xmpplistener;
import org.jivesoftware.smack.PacketListener;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smackx.carbons.Carbon;
import org.jivesoftware.smackx.carbons.CarbonManager;
import org.jivesoftware.sm... |
Python | UTF-8 | 5,141 | 3.03125 | 3 | [] | no_license | import gensim
import gensim.downloader as api
from sklearn.cluster import DBSCAN, KMeans
import numpy
import time
class Model:
def __init__(self, data_path):
start = time.time()
# https://radimrehurek.com/gensim/models/word2vec.html
print("Loading model", data_path)
# https://githu... |
Java | UTF-8 | 1,242 | 2.65625 | 3 | [
"MIT"
] | permissive | package cn.bearever.mingbase.chain.core;
import android.content.Context;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
/**
* 异步链的包装类,用来控制调用者可以访问的方法,主要目的是执行了`error*`方法之后就只能执行`go*`方法。
*
* @author : luoming luomingbear@163.com
* @date : 2019/8... |
Java | UTF-8 | 2,192 | 2.203125 | 2 | [
"Apache-2.0"
] | permissive | /*
* (C) Copyright IBM Corp. 2020, 2023.
*
* 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 law or agreed t... |
Java | UTF-8 | 775 | 2.125 | 2 | [] | no_license | package com.mysoft.sc;
import com.serotonin.messaging.OutgoingRequestMessage;
import com.serotonin.util.queue.ByteQueue;
/**
* 生成请求数据帧类(网络协议部分)
* @author yangfan ej
*
*/
public class ScIpSerialMessageRequest extends ScIpSerialMessage implements OutgoingRequestMessage,ScIncomingRequestMessage{
public static ScIpS... |
Markdown | UTF-8 | 5,334 | 3.15625 | 3 | [] | no_license | summary: demo
id: 20200212-02-杨金月
0ries: webpage
tags:
status: Published
authors: 杨金月
Feedback Link: http://www.sctu.edu.cn
# JS实现3D旋转相册
3D旋转相册是通过perspective属性的盒子1产生向网页内部的延伸感,并让装有图片沿z轴平移后的盒子2在拥有perspective属性的盒子1内凭借transform属性产生的3d效果沿盒子2y轴旋转转动来实现的。
## 1.属性介绍
### 1) perspective属性:
多少像素的3D元素是从视图的perspective属性定义。这个属性允许你... |
Go | UTF-8 | 2,522 | 3.21875 | 3 | [
"MIT"
] | permissive | package game
import (
"pacman/dir"
)
type gameStruct struct {
game Game
icon rune
colour Colour
location dir.Location
direction dir.Direction
points int
start dir.Location
}
// NewElement gameStruct instance
func NewElement(game Game, icon rune, loc dir.Location, dir dir.Direction, point... |
C++ | UTF-8 | 2,364 | 3.28125 | 3 | [] | no_license | #include <iostream>
using namespace std;
#include "MessageBus.hpp"
MessageBus g_bus;
const string Topic = "Drive";
const string CallBackTopic = "DriveOk";
//TEST CODE
struct Subject{
Subject(){
g_bus.Attach([this]{DriveOk();},CallBackTopic);
}
void SendReq(const string& topic){
g_bus.Send... |
Java | UTF-8 | 975 | 2.125 | 2 | [] | no_license | package com.example.michaelbabenkov.popularmovies.ui.settings;
import android.app.Fragment;
import android.os.Bundle;
import android.view.Menu;
import com.example.michaelbabenkov.popularmovies.R;
import com.example.michaelbabenkov.popularmovies.ui.base.SinglePaneActivity;
/**
* Created by michaelbabenkov on 13/07/1... |
JavaScript | UTF-8 | 5,714 | 2.6875 | 3 | [] | no_license | // --- NAV-class function ----
$(function(){
$("a").each(function(){
if ($(this).attr("href") === window.location.pathname){
$(this).addClass("active");
}
});
});
let hamb = document.getElementById('hamburger');
let links = document.querySelector('.links');
let itemHTML = document.getElementById('... |
Java | UTF-8 | 5,544 | 1.859375 | 2 | [
"Apache-2.0"
] | permissive | package io.quarkus.maven;
import java.lang.reflect.Method;
import java.nio.file.Path;
import java.util.List;
import java.util.Properties;
import java.util.function.Consumer;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.anno... |
Python | UTF-8 | 4,389 | 2.828125 | 3 | [] | no_license | from __future__ import division
__author__ = 'Venkatesh'
import math
from optimizers.decs import Decisions
from models.model import Model
class DTLZ1(Model):
no_decisions = 10
no_objectives = 2
decisions = []
name = "DTLZ1"
def __init__(self,decs=10,objs=2):
self.no_decisions = decs
... |
Markdown | UTF-8 | 2,268 | 3 | 3 | [] | no_license | # SLACK-HACK
A product using SLACK and hosted in AWS and Heroku to display unread messages of different channels in a single webpage.
## Description
The product involves the Authorization - access via SLACK to get involved into the database and get the information about the messages and workspace involved... |
Python | UTF-8 | 786 | 2.703125 | 3 | [] | no_license | import sqlite3
import os
import pandas as pd
db_location = r'C:\Users\c110846\Documents\salesforce_db'
#change to db location directory
os.chdir(db_location)
#connect to db
conn = sqlite3.connect('salesforce.db')
#create a datafrae from a query
df = pd.read_sql_query('''
SELECT * from sqlite_master where ty... |
Go | UTF-8 | 1,036 | 2.796875 | 3 | [
"MIT"
] | permissive | package service
import (
"context"
"github.com/karta0898098/iam/pkg/app/identity/entity"
)
type loggingMiddleware struct {
next IdentityService `json:"-"`
}
// LoggingMiddleware takes a logger as a dependency
// and returns a ServiceMiddleware.
func LoggingMiddleware() Middleware {
return func(next IdentityServ... |
C++ | UTF-8 | 1,106 | 2.578125 | 3 | [
"BSD-2-Clause",
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | /*
* This file is part of the source code of the software program
* Vampire. It is protected by applicable
* copyright laws.
*
* This source code is distributed under the licence found here
* https://vprover.github.io/license.html
* and in the source directory
*/
/**
* @file NameArray.hpp
* Defines ordered im... |
PHP | UTF-8 | 272 | 2.546875 | 3 | [
"MIT"
] | permissive | <?php
namespace App\Http\Controllers;
//From request import request
use Illuminate\Http\Request;
//El "extends" es el método para heredar en php
class RegistroController extends Controller
{
//
function index(Request $req) {
return "Conejito";
}
}
|
C# | UTF-8 | 809 | 3.125 | 3 | [
"MIT"
] | permissive | using System;
namespace BinarySerialization
{
/// <summary>
/// Provides the <see cref="BinarySerializer" /> with information used to serialize the decorated member.
/// </summary>
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
public sealed class FieldOrderAttribute : At... |
Markdown | UTF-8 | 16,691 | 2.65625 | 3 | [] | no_license | # Distributed street level image image processing
[](http://www.repostatus.org/#wip)
[ или более поздняя
**Объем оперативной памяти:** от 2 Гб
**Браузеры:** Safari, Google Chrome, Opera, Yandex.Browser, Mozilla Firefox, любой другой браузер, совмести... |
Java | UTF-8 | 1,354 | 2.78125 | 3 | [
"Apache-2.0"
] | permissive | package com.userzrq.threadLimit;
import com.sun.org.apache.bcel.internal.generic.NEW;
import javax.xml.ws.Service;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
public class Demo01 {
static Semaphore semaphore = new Semaphore(5);
public static void main(String[] args) {
... |
Python | UTF-8 | 842 | 3.6875 | 4 | [] | no_license | from scipy import stats
import pandas as pd
import matplotlib.pyplot as plt
# reads csv file and stores data in pandas data frame
weather = pd.read_csv("../data/weather.csv")
# gets columns to be used as x and y values for linear model
temperature = weather['temperature']
days = weather['days']
# fits a linear model... |
Java | UTF-8 | 3,376 | 1.921875 | 2 | [] | no_license | package com.yeahwap.netgame.domain.pojo;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* Create on 2012-10-10 16:0... |
C++ | UTF-8 | 588 | 2.875 | 3 | [] | no_license | #include <iostream>
#include <cmath>
using namespace std;
int max_index(const float* s)
{
int tmp = s[0] > s[1] ? 0 : 1;
return s[tmp] > s[2] ? tmp : 2;
}
const char TAG[3] = {'W', 'T', 'L'};
int main()
{
float score[3][3];
for (int i = 0; i < 3; ++i)
{
for (int j = 0; j < 3; ++j)
... |
PHP | UTF-8 | 3,270 | 3.953125 | 4 | [] | no_license | <?php
/*
Today we learn
*What is PHP
Once upon a time developer called personal Home page, but actually PHP is a server-side scripting language.
that is used to develop Static websites or Dynamic websites or Web applications
*How to run
... |
SQL | UTF-8 | 1,394 | 3.15625 | 3 | [] | no_license | CREATE TABLE "cast_movie_junction" (
"rec_key" SERIAL NOT NULL,
"movie_id" integer NOT NULL,
"character" varchar(30) NOT NULL,
"order" integer NOT NULL,
"actor_id" integer NOT NULL,
CONSTRAINT "pk_cast_movie_junction" PRIMARY KEY ("rec_key")
);
CREATE TABLE "actors" (
"actor_id" integer NOT... |
Java | UTF-8 | 2,689 | 2.09375 | 2 | [] | no_license | package com.zqkh.healthy.context.appservice.impl.domain.repository.mappers.dmo;
import java.util.Date;
public class ProgramResultDmo {
private String id;
private String familymemberId;
private String programId;
private Date startTime;
private Date endTime;
private Integer insistDay;
... |
Markdown | UTF-8 | 3,567 | 2.921875 | 3 | [] | no_license | # vue项目
## 项目使用的技术栈 Vue+Vuex+Router+Vant
## 项目位置(https://github.com/PieceCat/smile)
## 配置环境
### git操作
1. 打开git `mkdir vue`(项目名称)
2. `git config --global user.name xxx`
3. `git config --global user.email xxx@xx.com`
4. `git init`
## vue-cli配置
5. 打开vscode ctrl + ~ 打开控制台
6. 先检查npm版本,推荐5.x以上版本 `npm -v`
7. 全局安装vue-cli... |
C# | UTF-8 | 2,128 | 2.546875 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SGE.Cagravol.Application.ServiceModel
{
public class ResultModel : IResultModel
{
public bool Success { get; set; }
public string Message { get; set; }
public s... |
C++ | UTF-8 | 3,553 | 2.703125 | 3 | [] | no_license | #include "Money_public.h"
Money_public::Money_public() : Money(1,1,1,1,1,1,1,1,1,1,1,1) { }
Money_public::Money_public(double gg1000, double gg500, double gg200,
double gg100, double gg50, double gg20,
double gg10, double gg5, double gg2,
double gg1, double cc50, double cc10) : Money(gg1000,... |
PHP | UTF-8 | 2,585 | 2.59375 | 3 | [] | no_license | <?php
namespace App\Http\Controllers\Admin;
use App\Role;
use Illuminate\Http\Request;
class RoleController extends BaseAdminController
{
/**
*
*/
public function __construct()
{
parent::__construct();
}
/**
* @param Request $request
* @return \Illuminate\Contracts\Vi... |
Java | UTF-8 | 4,032 | 2.25 | 2 | [
"Apache-2.0",
"EPL-1.0",
"MIT",
"BSD-3-Clause"
] | permissive | /*
Copyright (C) 2013-2021 Expedia Inc.
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 law or agreed to in wri... |
C++ | IBM866 | 2,560 | 2.5625 | 3 | [] | no_license | #ifndef __MISC_INCLUDE__
#define __MISC_INCLUDE__
#include <types.h>
#include <math.h>
////////////////////////////////////////////////////////////////////////////////
///Swap
////////////////////////////////////////////////////////////////////////////////
template <class Type>
void swap (Type& v1,Type& v2)
{
T... |
Markdown | UTF-8 | 4,440 | 2.734375 | 3 | [] | no_license | ---
layout: post
title: 一些面试题
tags: code interview
---
已经有一段时间没有面试了,感觉最近有些颓废,整理一些自己的面试问题啥的。
Q: css 如何实现水平垂直居中
送分题,先从这道题开始
Q: 如何实现 dark mode
很多种方式,可以 css variables, 或者 dymaic load 都行,随便聊聊。进一步还可以探讨下 css methodologies ,讨论下 atomic css, css modules 啥的,还是看情况吧。
Q: 手写去重
暴力解也行,基本送分题
Q: 如何检测浏览器的性能。空闲的时候做一些事情
大概从 `setTim... |
Markdown | UTF-8 | 1,554 | 4.09375 | 4 | [
"MIT"
] | permissive | # 题目
## 反转字符串中的单词
### 来源:
[力扣-反转字符串中的单词](https://leetcode.cn/problems/reverse-words-in-a-string/description/)
### 题目内容
给你一个字符串 `s` ,请你反转字符串中 **单词** 的顺序。
**单词** 是由非空格字符组成的字符串。`s` 中使用至少一个空格将字符串中的 **单词** 分隔开。
返回 **单词** 顺序颠倒且 **单词** 之间用单个空格连接的结果字符串。
**注意:** 输入字符串
`s`中可能会存在前导空格、尾随空格或者单词间的多个空格。返回的结果字符串中,单词间应当仅用单个空格分隔... |
C++ | UTF-8 | 695 | 3.1875 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <vector>
#include <list>
#include <set>
#include <string>
#include <boost/array.hpp>
struct println {
template<typename T>
void operator()(const T& t) const {
std::cout << t << ", ";
}
};
template<class Cont>
void print_all(const Cont& c)
{
std::for_each(c.begin... |
Shell | UTF-8 | 541 | 3.421875 | 3 | [] | no_license | #!/usr/bin/env bash
# Jordan Justen : this file is public domain
source "$(cd "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" && pwd)"/menv
if [[ -f "$MESA_BUILD_DIR/build.ninja" ]]; then
NINJA=1
else
NINJA=0
fi
if [[ "$NINJA" -ne 0 ]]; then
nice -n 20 ninja -C "$MESA_BUILD_DIR" "$@" && \
ninj... |
Python | UTF-8 | 546 | 3.296875 | 3 | [] | no_license | import sys
read = sys.stdin.readline
# n = int(read())
n,r,c = map(int,read().rstrip().split())
# 2^n 의 행렬 count 먹이기
def count(n,r,c):
if n == 0:
return 0
idx = 2**(n-1)
k = idx ** 2
# A,B,C,D 0을 할지, 1을 할지 열로 검증
res = k if c >= idx else 0
# 2를 더할지, 더하지 않을지 행으로 **바로** 검증
res += 2*k ... |
Java | UTF-8 | 2,000 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | package com.tolsma.pieter.turf.gui.panel;
import java.awt.Color;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import javax.swing.*;
import com.tolsma.pieter.turf.database.BillManager;
import com.tolsma.pieter.turf.database.ItemManage... |
Python | UTF-8 | 641 | 2.96875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import pymysql
connector = pymysql.connect("localhost", "root", "password", "food_nutrition", charset='utf8')
# 连接时,加入charset='utf8',可以在输出时正确显示中文
cursor = connector.cursor()
cursor.execute("select * from food")
data = cursor.fetchall()
for row in data:
#for colum... |
C# | UTF-8 | 802 | 3.421875 | 3 | [] | no_license | using System;
using System.Collections.Generic;
namespace Planner
{
class City
{
/*
Name of the city.
The mayor of the city.
Year the city was established.
A collection of all of the buildings in the city.
A method to add a building to the city. Yay!
*/
... |
PHP | UTF-8 | 1,671 | 2.625 | 3 | [] | no_license | <?php
/**
* @copyright: Copyright © 2017 Firebear Studio GmbH. All rights reserved.
* @author : Firebear Studio <fbeardev@gmail.com>
*/
namespace Firebear\ImportExport\Api\Data;
/**
* Interface ImportInterface
*
* @package Firebear\ImportExport\Api\Data
*/
interface ImportInterface extends AbstractInterface
... |
Python | UTF-8 | 698 | 2.828125 | 3 | [] | no_license | import shapefile
import matplotlib.pyplot as plt
import csv
def plot(sf):
plt.figure()
for shape in sf.shapeRecords():
x = [i[0] for i in shape.shape.points[:]]
y = [i[1] for i in shape.shape.points[:]]
plt.plot(x,y)
plt.show()
def fieldsnrecords(sf):
print 0
records = sf.records()
print 1
fields = sf.fi... |
Java | UTF-8 | 1,295 | 1.921875 | 2 | [] | no_license | package gov.nih.nlm.meme.web;
import javax.servlet.http.*;
import org.apache.struts.action.*;
public class MappingActionForm
extends ActionForm {
private String host;
private int mapsetId;
private String midService;
private String port;
private String pageDirection;
public String getHost() {
ret... |
C++ | UTF-8 | 1,799 | 2.9375 | 3 | [] | no_license | #ifndef NGTK_LABEL_H_
#define NGTK_LABEL_H_
#include "gtk_misc.h"
namespace nodeGtk {
class NodeGtkLabel: public NodeGtkMisc {
public:
static v8::Persistent<v8::FunctionTemplate> constructor_template;
/**
* Constructor. Creates a new Label, which will wrap a new GtkLabel
*/
NodeGtkLabel(gchar ... |
C++ | UTF-8 | 774 | 2.890625 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
bool binarysearch(vector<int>v, int x)
{
int l=0, h=v.size()-1, m;
if(v[l]==x || v[h]==x)
return true;
while(l<=h)
{
m=(l+h)/2;
if(x > v[m])
l=m+1;
else if(x < v[m])
h=m-1;
else return true;
}
... |
C++ | UTF-8 | 496 | 3.078125 | 3 | [] | no_license | #ifndef EVENT_H
#define EVENT_H
#include <string>
#include "Date.h"
class Event : public Date
{
private:
int eventID;
std::string description;
public:
// Constructor
Event(int d, int m, int y, int ID, std::string desc) : Date(d,m,y)
{
eventID = ID... |
Go | UTF-8 | 1,635 | 3.25 | 3 | [
"Apache-2.0"
] | permissive | package main
import (
"encoding/json"
"fmt"
"os"
"reflect"
"testing"
"time"
"github.com/gohugoio/hugo/resources/page"
)
var expected *PageEntry
func setUp() {
myDate, _ := time.Parse(time.RFC3339, "2015-12-09T22:15:11+01:00")
expected = &PageEntry{
Type: "page",
Section: "",
Content: ... |
Python | UTF-8 | 2,763 | 2.8125 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
# Copyright 2017, IBM.
#
# This source code is licensed under the Apache License, Version 2.0 found in
# the LICENSE.txt file in the root directory of this source tree.
"""
Composite gate, a container for a sequence of unitary gates.
"""
import warnings
from qiskit.exceptions import QiskitErro... |
C# | UTF-8 | 845 | 2.71875 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ApiCrawlerTuTV.Model {
public class Actor : IComparable<Actor> {
public int id { get; set; }
public int tvDbId { get; set; }
public String name { get; set... |
Java | UTF-8 | 768 | 2.703125 | 3 | [] | no_license | package com.koo_proto.v0;
import java.util.ArrayList;
import java.util.UUID;
public class RestaurantOrder {
private UUID mRestaurantID;
private ArrayList<UUID> mOrderedDishIDs;
public RestaurantOrder(UUID restaurantID) {
mRestaurantID = restaurantID;
mOrderedDishIDs = new ArrayList<UUID>();
}
public UUI... |
C++ | UTF-8 | 3,940 | 2.578125 | 3 | [
"MIT"
] | permissive |
/*
* IMPORTANT: The SD Card is powered from the peripheral voltage regulator so it can be shut down when the system is sleeping (when only the RTC is running)
* The SD Card will not work properly when the peripheral power supply is OFF.
*
* The Settings file will be looked for on initialisation and read if found
... |
Python | UTF-8 | 20,981 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | import math
import numpy
import random
import typing
from collections import deque
from typing import List
import stock_exchange # circular dependency!
from experts.obscure_expert import ObscureExpert
from framework.period import Period
from framework.portfolio import Portfolio
from framework.stock_market_data import ... |
Java | UTF-8 | 2,010 | 2.09375 | 2 | [] | no_license | package com.zjkj.wxy.core.web.controller;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMa... |
Python | UTF-8 | 288 | 4.0625 | 4 | [
"MIT"
] | permissive | '''write a function that prints values in reverse way but with three positions skipped'''
def reverse_3_skip(alist):
temp_list = []
for i in range(len(alist)-1, 0, 3):
temp_list.append(alist[i])
return temp_list
reverse = reverse_3_skip([4,2,5,3,6,1,2,6,8,6,9])
print(reverse) |
JavaScript | UTF-8 | 2,543 | 2.53125 | 3 | [] | no_license | javascript: (function() {
var fPrefix = "[YT] ";
var videoId = getYTId();
var videoId_tag = " ([vid-" + videoId + "])";
var videoTitle_raw = document.querySelector("h1.title").innerText.trim();
var videoTitle_clean = cleanString(videoTitle_raw);
var videoCreator_raw = document.querySelector("div#text-container.y... |
Ruby | UTF-8 | 1,845 | 2.609375 | 3 | [
"MIT"
] | permissive | # Simple example of a server for sending notifications through postgresql that can be listened for.
module CelluloidIOPGListener
module Examples
class Server
include Celluloid
include Celluloid::IO
include Celluloid::Internals::Logger
prepend CelluloidIOPGListener::Initialization::Argumen... |
Java | UTF-8 | 4,173 | 1.960938 | 2 | [] | no_license | package com.welian.service;
import com.welian.beans.cloudevent.admin.AdminReq;
import com.welian.beans.cloudevent.admin.AdminResp;
import com.welian.beans.cloudevent.user.UserResp;
import com.welian.commodity.beans.Liquidation;
import com.welian.commodity.beans.LiquidationBean;
import com.welian.mapper.EventOrderMappe... |
Markdown | UTF-8 | 46 | 2.828125 | 3 | [
"CC0-1.0"
] | permissive | # Stackable Beds
Makes beds stackable upto 64. |
C++ | UTF-8 | 2,907 | 3.296875 | 3 | [] | no_license | #include<iostream>
#include <string.h>
using namespace std;
void DFS(int step, char* string, int length, int book[], char result[])
{
if(step == length)
{
for(int i=0; i<length; i++)
{
cout << result[i];
}
cout << endl;
return;
}
for(int i=0; i<length; i++)
{
if(book[i] == 0)
{
... |
Java | UTF-8 | 1,011 | 2.78125 | 3 | [] | no_license | package classes;
import interfaces.Visitable;
import interfaces.Classifiable;
public class Church extends Node implements Classifiable, Visitable{
private String openingHours;
private String rank;
public String getOpeningHours() {
return openingHours;
}
private String closingHours;
... |
C# | UTF-8 | 2,469 | 2.546875 | 3 | [] | no_license | //
// Copyright (C) 2017 Fluendo S.A.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program i... |
TypeScript | UTF-8 | 2,745 | 2.5625 | 3 | [
"MIT"
] | permissive | import * as monaco from "monaco-editor";
import path from "path";
import { parseConfigFileTextToJson } from "typescript";
const extToLang: {
[key: string]: "json" | "javascript" | "typescript" | "html";
} = {
".js": "javascript",
".ts": "typescript",
".tsx": "typescript",
".json": "json",
".svelte": "html"... |
C# | UTF-8 | 966 | 3.453125 | 3 | [] | no_license | using Plugin.Connectivity;
using System;
using System.Collections.Generic;
using System.Text;
namespace Memory_Game_App.Classes
{
public static class StringExtensions
{
public static int ToInteger(this string numberString)
{
int result = 0;
if (int.TryParse(numberString... |
C++ | UTF-8 | 250 | 2.53125 | 3 | [] | no_license | #pragma once
#include <string>
#include <iostream>
struct InfoProduct
{
std::string m_product_name = {};
std::string m_product_color = {};
int m_price = 0;
};
std::ostream& operator << (std::ostream& out, const InfoProduct& data);
|
PHP | UTF-8 | 1,697 | 2.921875 | 3 | [
"MIT"
] | permissive | <?php
/*
* This file is part of Zippy.
*
* (c) Alchemy <info@alchemy.fr>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Zippy\ProcessBuilder;
use Symfony\Component\Process\Process;
class ProcessBuilder implem... |
Python | UTF-8 | 691 | 3.046875 | 3 | [
"MIT"
] | permissive | import concurrent.futures
import logging
import time
import numpy as np
class MyThreads(object):
def thread_function(self, args):
name1, name2 = args
print(name1, name2)
name = name1 + "-" + name2
logging.info("Thread %s: starting", name)
time.sleep(2)
logging.info("Thread %s: fi... |
JavaScript | UTF-8 | 1,639 | 3.125 | 3 | [] | no_license | var fs = require('fs-extra');
var string = 'render_zone',
dir = process.argv[2],
zoneArray = [];
var readDir = function(dir){
fs.readdir(dir,function(error, dirContent){
if(!error){
var files = dirContent;
//On checke la liste du contenu du répertoire
for (var i = files.length - 1; ... |
Markdown | UTF-8 | 6,523 | 3.5625 | 4 | [
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | ---
id: debug-a-zio-application
title: "Tutorial: How to Debug a ZIO Application?"
sidebar_label: "Debugging a ZIO Application"
---
## Introduction
Writing applications using functional programming helps us to write a base code that is less error-prone and more predictable. However, we often make mistakes when develo... |
Markdown | UTF-8 | 1,110 | 2.546875 | 3 | [
"CC-BY-4.0",
"MIT"
] | permissive | ---
title: ''RaiseEvent' ya se ha declarado'
ms.date: 07/20/2015
f1_keywords:
- vbc31129
- bc31129
helpviewer_keywords:
- BC31129
ms.assetid: 6e5c89fc-ca1d-4e8f-bf04-8af3e8b03a4b
ms.openlocfilehash: ec6078cf8b3dc75b9f8a426059c1699f3e5989fd
ms.sourcegitcommit: 3d5d33f384eeba41b2dff79d096f47ccc8d8f03d
m... |
C++ | UTF-8 | 463 | 3.28125 | 3 | [] | no_license | /**
*
* https://leetcode.com/problems/to-lower-case/
* Runtime: 0 ms, faster than 100.00% of C++ online submissions for To Lower Case.
* Memory Usage: 8.2 MB, less than 58.97% of C++ online submissions for To Lower Case.
*
*/
class Solution {
public:
string toLowerCase(string str) {
for (char& lette... |
Markdown | UTF-8 | 690 | 3.234375 | 3 | [] | no_license | # PythonGeometryObject2D
In this practice, i make my own distribution to print some 2D Geometry Object
Which have feature to prints
--
1. Square
2. Rectangle
3. Right Triangle
4. Equilateral Triangle
Installation
--
Run the following to install:
pip install geometryobject
Usage
--
import geometyobject as obj2d;<br>... |
C# | UTF-8 | 6,643 | 2.78125 | 3 | [
"MIT"
] | permissive | // Author:
// jjennings <jaredljennings@gmail.com>
//
// Copyright (c) 2012 jjennings
// Robert Nordan
//
// 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... |
PHP | UTF-8 | 318 | 2.875 | 3 | [
"MIT"
] | permissive | <?php
echo "Socket Server running on localhost:8001" . PHP_EOL;
$socket = stream_socket_server('tcp://localhost:8001');
$conn = stream_socket_accept($socket);
$wait = rand(1, 5);
sleep($wait);
fwrite($conn, "Socket Server Response after $wait seconds\n");
fclose($conn);
echo "Socket Server stopped" . PHP_EOL;
|
Java | UTF-8 | 1,296 | 4.0625 | 4 | [] | no_license | package com.revature.classbasics;
public class ControlStatements {
public static void main(String[] args) {
// int[row][col] ??
int[][] twoD = new int[4][5]; // Arrays are NOT dynamically sized
// FOR EACH ("enhanced for loops") - at runtime, get converted behind the scenes to a regular
// for loop use... |
Swift | UTF-8 | 852 | 2.9375 | 3 | [] | no_license | //
// ServerManager.swift
// VKHackathon2019
//
// Created by Михаил Луцкий on 29/09/2019.
// Copyright © 2019 Mikhail Lutskii. All rights reserved.
//
import Foundation
import Alamofire
import ObjectMapper
class ServerManager {
static func getList(emoji: String, r: @escaping(_ trips: [TripObject]) -> Vo... |
C# | UTF-8 | 2,961 | 2.671875 | 3 | [] | no_license | //using Lib.Finder;
//using Lib.Models;
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using System.Threading.Tasks;
//using System.Windows.Forms;
//namespace ManualControl
//{
// class ProgramPlayer
// {
// History mapHistory;
// public Action MapU... |
C | UTF-8 | 1,368 | 2.84375 | 3 | [] | no_license | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* node_add.c :+: :+: :+: ... |
SQL | UTF-8 | 2,009 | 3.0625 | 3 | [
"MIT"
] | permissive | -- phpMyAdmin SQL Dump
-- version 4.9.0.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Mar 20, 2021 at 07:37 AM
-- Server version: 10.4.6-MariaDB
-- PHP Version: 7.2.22
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @O... |
JavaScript | UTF-8 | 12,154 | 2.828125 | 3 | [
"MIT"
] | permissive |
/**
* Service base class
* Return output usable in a REST service but also usable via js API
*
* @constructor
*
*/
function apiService() {
'use strict';
/*jshint validthis: true */
var service = this;
/**
* trace errors to console
* @var {Boolean}
*/
this.trace = false;
... |
Java | UTF-8 | 1,361 | 2.765625 | 3 | [] | no_license | package org.densyakun.bukkit.animalcrossing.menumanager;
import java.util.UUID;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.densyakun.bukkit.animalcrossing.playermanager.PlayerData;
import org.densyakun.bukkit.animalcrossing.playermanager.P... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.