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 |
|---|---|---|---|---|---|---|---|
Java | UTF-8 | 6,126 | 1.875 | 2 | [] | no_license | package se.skl.skltpservices.takecare.takecareintegrationcomponent.updatebooking;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import java.math.BigInteger;
import org.junit.Test;
import org.soitoolkit.commons.mule.jaxb.JaxbUtil;... |
JavaScript | UTF-8 | 1,097 | 2.515625 | 3 | [
"MIT"
] | permissive | <script type="text/javascript">
function popUp(path,title) {
var popwin;
if (title!="view") {
leftval=(screen.width)?(screen.width-400)/2:100;
topval=(screen.height)?(screen.height-500)/2:100;
popwin=window.open(path, title, "width=400,height=500,top=" + topval + ",left=" + leftval + ",... |
JavaScript | UTF-8 | 722 | 2.578125 | 3 | [] | no_license | const axios = require('axios');
function validate(array) {
const promises = array.map((item) => axios.get(item.href)
.then((response) => ({
href: item.href,
text: item.text,
file: item.file,
statusText: response.statusText,
status: response.status,
}))
.catch((error) => {
... |
JavaScript | UTF-8 | 482 | 2.9375 | 3 | [
"MIT"
] | permissive | module.exports = function(path, sep){
var bits,
hasLeading;
// allow the user to specify any kind of path: /path/to/share or \path\to\share
if(path.indexOf('/') > -1){
hasLeading = path.charAt(0) === '/';
bits = path.split('/');
}
else {
hasLeading = path.charAt(0) =... |
PHP | UTF-8 | 1,393 | 2.953125 | 3 | [
"Unlicense"
] | permissive | <?php
class ValueRemapper
{
protected static $_inst;
protected $_maps=array();
protected $_cimaps=array();
protected $_curmap=null;
public function __construct()
{
}
static public function getInstance()
{
if(self::$_inst==null)
{
self::$_inst=new ValueRemapper();
}
return self::$_inst;
}
... |
Swift | UTF-8 | 2,887 | 2.828125 | 3 | [] | no_license | //
// ViewController.swift
// Contacts
//
// Created by José Inácio Athayde Ferrarini on 9/10/14.
// Copyright (c) 2014 José Inácio Athayde Ferrarini. All rights reserved.
//
import UIKit
class ViewController: UIViewController, UITextFieldDelegate, SyncServerDelegate {
@IBOutlet weak var ageLabel: UILabel!
@I... |
Java | UTF-8 | 7,760 | 1.914063 | 2 | [
"Apache-2.0"
] | permissive | /*
* Copyright (c) 2021 Oracle and/or its affiliates.
*
* 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 applic... |
Markdown | UTF-8 | 9,824 | 3.234375 | 3 | [
"MIT"
] | permissive |
# Assignment 4
Before working on this assignment please read these instructions fully. In the submission area, you will notice that you can click the link to **Preview the Grading** for each step of the assignment. This is the criteria that will be used for peer grading. Please familiarize yourself with the criteria ... |
Java | UTF-8 | 3,046 | 2.203125 | 2 | [] | no_license | package com.huatu.ztk.backend.mysql.dao;
import com.google.common.collect.Maps;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java... |
Java | UTF-8 | 4,053 | 2.6875 | 3 | [] | no_license | package org.firstinspires.ftc.teamcode;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.DcMotorSimple;
import com.qualcomm.robotcore.hardware.HardwareMap;
import com.qualcomm.robotcore.hardware.Servo;
import org.firstinspires.ftc.robotcore.external.Telemetry;
import static java... |
Java | UHC | 4,205 | 2.875 | 3 | [] | no_license | package com.controller;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.Mod... |
Markdown | UTF-8 | 2,745 | 2.984375 | 3 | [] | no_license | +++
title = "Umlauts again"
date = 2019-03-17
[taxonomies]
tags = ["year of the linux desktop",
"xkb",
"linux",
"sway"]
+++
Since December I am on Linux with my main machine again. I always wanted to do a rant post about the year
of the linux desktop but instead I am posting something useful.
<!-- more -->
I a... |
Markdown | UTF-8 | 13,012 | 3.609375 | 4 | [] | no_license | # Part 1: The Mystery :mag:
This is a _mystery_ lab! That means that solving one task will lead to solving the next task, and the end result will be a **surprise**! Good luck!
## Task 0: Create a Gatsby site
The rest of this lab assumes that you have a Gatsby site set up and that you are in that project directory. R... |
Python | UTF-8 | 293 | 3.125 | 3 | [
"MIT"
] | permissive | import pygame
class Sprite:
def __init__(self, surface, bounds=None):
self.surface = surface
if bounds == None:
bounds = surface.get_rect()
bounds = pygame.Rect(bounds.left, bounds.top, bounds.width, bounds.height)
self.bounds = bounds |
Python | UTF-8 | 1,635 | 2.828125 | 3 | [] | no_license | import sys
sys.setrecursionlimit(4100000)
import math
import logging
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
from itertools import permutations
def resolve():
N = [int(x) for x in sys.stdin.readline().split()][0]
p_list = [int(x) for x in sys.stdin.readline().split()... |
Markdown | UTF-8 | 9,713 | 2.78125 | 3 | [] | no_license | # AzureCredentials
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Metadata** | Pointer to [**ConfigurationMetadata**](ConfigurationMetadata.md) | | [optional]
**Id** | Pointer to **string** | The Dynatrace entity ID of the Azure credentials configurati... |
Markdown | UTF-8 | 751 | 2.6875 | 3 | [
"MIT"
] | permissive | # HAgnostic News
HAgnostic News is an Hacker News reader which is available for the Web and as React Native app (Android / iOS)

From the same codebase you can render apps for the platform Web and nati... |
PHP | UTF-8 | 1,455 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | <?php
namespace app\common\model;
class VipPayLogModel extends BaseModel
{
/**
* 定义别名字段
* @var array
*/
public static $alia = [
'pay_type'=>[
1=>'微信',
2=>'支付宝',
3=>'其他',
],
];
public function getPayTypeAttr($value)
{
re... |
Java | UTF-8 | 903 | 2.03125 | 2 | [] | no_license | package com.fsd.stock.exchange.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import com.fsd.stock.exchange.entity.StockExchange;
@Mapper
public interfa... |
Java | UTF-8 | 544 | 3.015625 | 3 | [] | no_license |
import java.util.Scanner;
public class UVAOJ10963 {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int T=sc.nextInt();
while(T>0) {
int col=sc.nextInt();
int a=sc.nextInt();
int b=sc.nextInt();
int dY=Math.abs(a-b);
boolean flag=true;
for(int i=1; i<col; i++) {
... |
Python | UTF-8 | 1,314 | 3.15625 | 3 | [] | no_license | from math import pi, cos, sin, sqrt, radians
import matplotlib.pyplot as plt
class Particle:
def __init__(self, v0, alfa, x0, y0):
self.v0 = v0
self.alfa = radians(alfa)
self.x = x0
self.y = y0
self.x_ = []
self.y_ = []
self.x_.append(x0)
self.y_.appe... |
Python | UTF-8 | 696 | 3.28125 | 3 | [] | no_license | import time
# Sums from bottom are same as sums from top
# Do partial sums from second to last row, get largest sum when you reach the top.
def largestSum(tri, rowIndex):
for i, val in enumerate(tri[rowIndex]):
tri[rowIndex][i] += max([tri[rowIndex + 1][i], tri[rowIndex + 1][i + 1]])
if rowIndex == 0:
... |
Python | UTF-8 | 984 | 3.296875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Sep 17 20:28:43 2020
@author: Niranch
"""
# Enter your code here. Read input from STDIN. Print output to STDOUT
import sys
inputlist=[]
mydict={}
for line in sys.stdin:
if 'Exit' == line.rstrip():
break
else:
inputlist.append(line.rst... |
Python | UTF-8 | 7,478 | 2.546875 | 3 | [
"MIT"
] | permissive | import webbrowser
import os
import re
# Styles and scripting for the page
# Note the sized up YT vids, with extra parameters (like
# removing related videos) for a more cinematic feel
main_page_head = '''
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Sagar's Top 6 Media</title>
<... |
Markdown | UTF-8 | 799 | 2.546875 | 3 | [] | no_license | # Graph Theory Comprehensive Notes
This repository contains a collection of theorems and sample problems
for the graph theory originally targetting the comprehensive exam at
Arizona State University. Most of the theorems are found in Diestel's
Graph Theory and when a theorem number is mentioned, that number
refers to ... |
Java | UTF-8 | 1,872 | 4.3125 | 4 | [] | no_license | package hw5;
/**
* RPN calculator supporting addition, subtraction and multiplication
* of anything that implements the CalculatorOperand interface
*/
public class RPNCalculator<T extends CalculatorOperand<T>> {
ListStack<T> stack; // the stack holding the operands
/**
* Defines the operations the calc... |
C++ | UTF-8 | 5,519 | 2.734375 | 3 | [] | no_license | #include <string>
#include <cstring>
#include <iostream>
#include <vector>
using namespace std;
class Robot_part{
public:
Robot_part(string part_name, int model_number, double cost, string description, string image_filename, double head_power, double loco_max_power,
int battery_comp, int max_arms, double ar... |
Python | UTF-8 | 166 | 3.140625 | 3 | [] | no_license | # import heap class
from 03-min_heap import MinHeap
min_heap = MinHeap()
print(min_heap.heap_list)
# testing out .add()
min_heap.add(42)
print(min_heap.heap_list)
|
Shell | UTF-8 | 984 | 3.78125 | 4 | [] | no_license | # alias-tips 太慢了, you-shoudle-use 不会展开已有别名
ALIAS_TIPS_BUFFER=''
function init_alias_list() {
typeset -g -A alias_list
(( $#alias_list != 0 )) && return
local k v cmds
for k v (${(kv)aliases}) {
expand_alias cmds ${(z)v}
alias_list[$k]=$cmds
}
}
function _check_alias() {
local... |
C# | UTF-8 | 1,066 | 3.421875 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GOTI
{
class Program
{
static void Main(string[] args)
{
string phrase = "cdefghmnopqrstuvw";
string result = GameOfThrones(phrase)... |
JavaScript | UTF-8 | 359 | 2.53125 | 3 | [] | no_license | const http = require('http');
const through = require('through2');
const uppercaser = through(function(buf, _, next){
this.push(buf.toString().toUpperCase());
next();
});
const port = Number(process.argv[2]);
const server = http.createServer((req, res)=>{
if(req.method === 'POST')
req.pipe(uppercase... |
Java | UTF-8 | 805 | 3.375 | 3 | [] | no_license | package com.wsss.basic.common;
class A {
public static void show() {
System.out.println("Class A show() function");
}
}
class B extends A {
public static void show() {
System.out.println("Class B show() function");
}
}
public class ClassDemo {
public static void... |
Markdown | UTF-8 | 5,064 | 3.921875 | 4 | [
"MIT"
] | permissive | ### Solution
The prize is always undefined!
#### The Problem
The anonymous method we're assigning to the buttons' onclicks has access to variables in the scope
outside of it (this is called a closure). In this case, it has access to btnNum.
When a method accesses a variable outside its scope, it accesses that vari... |
Shell | UTF-8 | 472 | 3.484375 | 3 | [] | no_license | #!/usr/bin/env bash
if [[ $UID != 0 ]]; then
echo "Please run this script with sudo:"
echo "sudo $0 $*"
exit 1
fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
apt update
apt install software-properties-common
apt-add-repository --yes --update ppa:ansible/ansible
apt install ans... |
Markdown | UTF-8 | 1,174 | 3.09375 | 3 | [] | no_license | ---
_id: "luogu-P1082"
title: "P1082 同余方程"
date: 2020-01-05 15:56
update: 2020-01-05 15:56
author: Rainboy
tags:
- exgcd
- 数论
- 同余
- 提高组
- noip
- 2012
catalog: 数论
source:
-
oj: luogu
url: https://www.luogu.com.cn/problem/P1082
---
## 解析
题目地址:[luogu P1082 同余方程](https://www.luo... |
Markdown | UTF-8 | 6,402 | 3.5 | 4 | [] | no_license |
# 如何用余弦定理来进行文本相似度的度量 - Magician的博客 - CSDN博客
2018年06月22日 16:27:00[春雨里de太阳](https://me.csdn.net/qq_16633405)阅读数:612
在做文本分析的时候,**经常会到说将文本转化为对应的向量,之后利用余弦定理来计算文本之间的相似度**。但是最近在面试时,重复上面这句话,却被面试官问到:“什么是余弦定理?”当时就比较懵逼,于是把余弦定理求文本相似度的过程叙述了一遍:“**将样本转化为对应的空间中的两个向量,然后计算两个向量余弦值,之后根据余弦值的大小来判断两个样本相似度有多少**”,但是话音刚落就被面试官否定了,当时感觉自己说的是正... |
Java | UTF-8 | 2,745 | 1.9375 | 2 | [
"MIT"
] | permissive | package edu.wpi.first.gradlerio.simulation;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.Callable;
import javax.inject.Inject;
import org.gradle.api.GradleException;
import org.gradle.api.tasks.AbstractExecTask... |
Java | UTF-8 | 568 | 3.875 | 4 | [] | no_license | public class BasicJava{
//Print 1-255
public void print1To255(){
for(int i=1;i<=255;i++){
System.out.println("print1To255 : "+i);
}
}
//Print odd numbers between 1-255
public void printOddNum1To255(){
for(int i=1;i<=255;i++){
if(i%2 == 1){
System.o... |
Markdown | UTF-8 | 1,280 | 2.609375 | 3 | [] | no_license | # Characters
## Zedek
A convicted murderer. After a questionable jury over his sister's murder, he took the killer's life in cold-blood. Shortly after, he confessed to his village. He feels he must make his own hope in this world as god seems quiet.
## Cahira
A warrior prisoner brought over from the war. Instead of d... |
Shell | UTF-8 | 531 | 3.125 | 3 | [] | no_license | #!/bin/bash
# Bootstrap a vanilla ubuntu machine
# Update the machine
echo "Updating machine"
sudo apt-get update -y
sudo apt-get upgrade -y
# Install core tools
echo "Installing tools"
sudo apt-get install -y vim git tree tmux
# configure git
echo "Configuring git"
git config --global user.name "Toby W"
git confi... |
Java | UTF-8 | 1,657 | 1.976563 | 2 | [] | no_license | package com.general.dto;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import org.jtransfo.NotMapped;
import lombok.Data;
@Data
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public cl... |
Swift | UTF-8 | 523 | 2.671875 | 3 | [] | no_license | //
// SnapImage.swift
// SnapchatClone
//
// Created by Max Miranda on 9/18/18.
// Copyright © 2018 ___MaxAMiranda___. All rights reserved.
//
import UIKit
class SnapImage {
var sender: String
var sentTo: String
var timeSent: Date
var opened: Bool
var image: UIImage
init(sentBy: Strin... |
Markdown | UTF-8 | 12,074 | 3.203125 | 3 | [] | no_license | # Folha de Pagamento

During the first part of the project (AB1) there were some problems that made it impossible to build the system in OOP. During the second part of the project (AB2) the system was made in OOP already following the Model-View-C... |
JavaScript | UTF-8 | 699 | 2.90625 | 3 | [] | no_license | 'use strict'
import axios from 'axios'
import config from './config.json'
setInterval(func, config.interval * 1000)
async function func () {
console.log('Func started: ' + new Date().toLocaleString())
let request = await axios.get(config.get.url)
const data = request.data
console.log('Price: ' + parse(dat... |
Python | UTF-8 | 1,448 | 3.3125 | 3 | [
"Apache-2.0"
] | permissive | import sublime, sublime_plugin
class ExampleCommand(sublime_plugin.TextCommand):
def run(self, edit):
self.view.insert(edit, 0, "Hello, World! xxxxxx\n")
class Rot13Command(sublime_plugin.TextCommand):
def run(self, edit):
for region in self.view.sel():
if not region.empty():
... |
TypeScript | UTF-8 | 10,230 | 2.8125 | 3 | [
"MIT"
] | permissive | // Type definitions for cookie 0.5
// Project: https://github.com/jshttp/cookie
// Definitions by: Pine Mizune <https://github.com/pine>
// Piotr Błażejewicz <https://github.com/peterblazejewicz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* Basic HTTP cookie parser and seri... |
Markdown | UTF-8 | 2,438 | 2.796875 | 3 | [] | no_license | ---
type: post
title: "Baked Chicken & Brussels Sprouts"
author: "USA WEEKEND columnist Jean Carper"
category: lunch
photo: "https://imagesvc.meredithcorp.io/v3/mm/image?url=https%3A%2F%2Fimages.media-allrecipes.com%2Fuserphotos%2F1088675.jpg"
prep_time:
cook_time:
recipe_yield: "8 servings"
rating_value: 3.555555555... |
C++ | GB18030 | 813 | 2.875 | 3 | [] | no_license | #pragma once
class Kernel
{
public:
Kernel( int w, int h );
~Kernel(void);
float getKernelValue(int x,int y )const;
float getTransKernelValue( int x, int y ) const;//תúKERNELֵEROSIONʱõ
void setKernelValue( const float* ptr );
public:
inline bool AssertValid( int x, int y ) const{
if ( x >=0... |
Ruby | UTF-8 | 3,002 | 4.3125 | 4 | [] | no_license | class TowerOfHanoi
# display rules
def show_rules
line_width = 60
puts ""
puts "Welcome to Tower of Hanoi!\n".center line_width
puts "The object of the game is to move all of your disks from the left rod"
puts "to either the middle rod or the right rod - one disk at a time.\n\n"
puts "Here ... |
Java | UTF-8 | 504 | 1.75 | 2 | [] | no_license | public final class acg
{
private final int aw;
private final dEE cQV;
private final int[] cQW;
private final doV cQX;
acg(int paramInt, dEE paramdEE, doV paramdoV, int[] paramArrayOfInt)
{
this.aw = paramInt;
this.cQV = paramdEE;
this.cQW = paramArrayOfInt;
this.cQX = paramdoV;
}
publi... |
JavaScript | UTF-8 | 4,598 | 2.75 | 3 | [
"MIT"
] | permissive | 'use strict';
angular.module('myApp.split', ['ngRoute'])
.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/split', {
templateUrl: 'split/split.template.html',
controller: 'SplitCtrl'
});
}])
.controller('SplitCtrl', function($scope, Friends, Bill) {
$scope.friends = Friends.... |
Python | UTF-8 | 138 | 2.578125 | 3 | [] | no_license | def find_max_min(A):
if min(A)== max(A):
return [len(A)]
else:
return [min(A),max(A)]
find_max_min([2,3,5,7,1,10]) |
Java | UTF-8 | 1,791 | 2.40625 | 2 | [] | no_license | package platform.view;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
import org.springframework.stereotype.Component;
import org.springframework.util.FileCopyUtils;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.lang.r... |
C# | UTF-8 | 2,497 | 2.703125 | 3 | [] | no_license | using CZGL.Roslyn;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using System;
using System.Collections.Generic;
namespace CZGL.RoslynTool
{
public class AttributeTool
{
/// <summary>
/// 构建 AttributeListSyntax
/// </summ... |
Markdown | UTF-8 | 665 | 3.25 | 3 | [] | no_license | # Restaurant-Wait-List-Program
A program that mimics the wait list for a restaurant that I wrote for a school project. You're in charge of a restaurant that has a wait list for it's customers. Customers are given an option of either calling in to place themselves in the waitlist or directly waiting in the restaurant.
... |
Ruby | UTF-8 | 518 | 2.640625 | 3 | [] | no_license | require 'rgeo-geojson'
require 'rgeo'
require 'json'
class Calendar
attr_reader :events
def initialize(events)
@events = events
geocode_events
end
def feature_collection
@feature_collection ||= RGeo::GeoJSON::EntityFactory.
new.
feature_collection(@events.map(&:rgeo_object))
end
... |
Shell | UTF-8 | 487 | 2.859375 | 3 | [] | no_license | #!/bin/bash
curl -sfL https://get.k3s.io | sh -
sudo hostnamectl set-hostname k3s-master
sudo apt-get install -y pkg-config bash-completion
rm -rf ~/.kubectx
git clone https://github.com/ahmetb/kubectx.git ~/.kubectx
COMPDIR=$(pkg-config --variable=completionsdir bash-completion)
sudo ln -sf ~/.kubectx/completion/kube... |
Java | UTF-8 | 1,451 | 2.515625 | 3 | [] | no_license | package com.bayer.salonmanagement.model;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.sql.Time;
import java.util.Date;
import java.util.List;
import java.util.Objects;
... |
Java | UTF-8 | 3,874 | 2.515625 | 3 | [
"BSD-2-Clause",
"BSD-3-Clause"
] | permissive | package org.jzy3d.plot3d.primitives.vbo;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import org.jzy3d.colors.Color;
import org.jzy3d.colors.ColorMapper;
import com.jogamp.opengl.GL;
import com.jogamp.opengl.GL2;
import com.jogamp.opengl.GLException;
import com.jogamp.opengl.util.GLBuffers;
public class Color... |
Java | UTF-8 | 28,274 | 2.03125 | 2 | [] | no_license | package app.visual;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import... |
Java | UTF-8 | 3,979 | 2.578125 | 3 | [] | no_license | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Graphics;
import Math.CoordinateTranslator;
import Math.Point2D;
import Math.PointManager;
import com.badlogic.gdx.G... |
C++ | UTF-8 | 2,422 | 2.6875 | 3 | [] | no_license | //*******************************************************************
//
// License: See top level LICENSE.txt file.
//
// Author: Garrett Potts (gpotts@imagelinks.com)
//
//*************************************************************************
// $Id: rspfColorProperty.cpp 13667 2008-10-02 19:59:55Z gpotts $
#inc... |
Markdown | UTF-8 | 1,580 | 2.984375 | 3 | [] | no_license | # 后台访问权限控制 \|
## 需求 <a id="需求"></a>
* 解决普通用户登录之后直接访问后台具体的视图函数的问题
* 如果是普通用户访问后台的视图函数,直接跳转到项目主页,不再执行后续的逻辑判断
* 后台后续要实现多个视图函数,如果每一个函数内部都去判断用户权限,那么代码重复率高,冗余代码较多
* 所以得有一个统一判断入口,后台模块中,除了登录页面,后台的其他页面都要判断是否具有管理员权限
* 采用的方式为:请求勾子中的 before\_request,来请求之前进行判断
## 代码实现 <a id="代码实现"></a>
*... |
C# | UTF-8 | 2,139 | 2.65625 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace NoIPClient.NoIPApi
{
internal static class UpdateManager
{
public static async Task<UpdateResult> Update(NoIPApiSettings settings)
{
var i... |
Java | UTF-8 | 1,414 | 2.1875 | 2 | [
"Apache-2.0"
] | permissive | /*
* Copyright 2014 Igor Maznitsa (http://www.igormaznitsa.com).
*
* 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 requi... |
JavaScript | UTF-8 | 5,299 | 3.296875 | 3 | [] | no_license | // need to add local storage in this program
class budget {
constructor() {
this.expenseAmount = 0;
this.budgetAmount = 0;
this.balanceAmount = 0;
this.expenseCollection = [];
this.id = 0;
}
showBudget(budget) {
this.budgetAmount = budget;
this.balance... |
PHP | UTF-8 | 2,896 | 2.703125 | 3 | [] | no_license | <?php
namespace App\Services;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cookie;
use Illuminate\Support\Facades\DB;
class OAuthProxy extends Proxy
{
const REFRESH_TOKEN = 'refreshToken';
public function __construct(){
parent::__construct(app());
}
/**
* Attempt to creat... |
Ruby | UTF-8 | 2,236 | 2.625 | 3 | [] | no_license | require 'spec_helper'
describe Table do
let(:retro) { create :retro }
context "setup" do
it "has no seats to begin with" do
retro.seats.count.should eq 0
end
it "has a valid factory" do
retro.should be_valid
end
end
context "creation" do
it "creates the record in the databa... |
Ruby | UTF-8 | 442 | 2.546875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env ruby
require 'little_lisp'
require 'Trollop'
require 'pry'
opts = Trollop.options do
version "v#{LittleLisp::VERSION}"
opt :source_file, 'Path to source file', type: :string
end
file_name = File.expand_path(opts[:source_file])
Trollop.die :source_file, 'must exist' unless File.exist?(file_name)
... |
Python | UTF-8 | 427 | 3.359375 | 3 | [] | no_license | class Father():
def gardening(self):
print("I like gardening")
class Mother():
def cooking(self):
print("I like cooking")
class Child1(Father,Mother):
def art(self):
print("I like art")
class Child2(Father,Mother):
def sports(self):
print("I like sports")
c1 = Child1()... |
Java | UTF-8 | 438 | 1.914063 | 2 | [
"MIT"
] | permissive | package com.onevgo.bookstore.domain;
import lombok.Data;
import java.sql.Date;
import java.util.LinkedHashSet;
import java.util.Set;
@Data
public class Trade {
//Trade 对象对应的 id
private Integer tradeId;
//交易的时间
private Date tradeTime;
//Trade 关联的多个 TradeItem
private Set<TradeIte... |
Java | UTF-8 | 603 | 2.390625 | 2 | [] | no_license | package es.igae.services;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import es.igae.entities.Cliente;
import es.igae.persistence.ClienteDao;
@Service
public class ServicioImpl implements Servicio {
@Autowired
private ClienteDao clienteDao;
@Ove... |
Java | UTF-8 | 288 | 1.742188 | 2 | [] | no_license | package leadme.dao;
import leadme.domain.CourseEnrollment;
import leadme.domain.Tour;
public interface CourseEnrollmentDao {
int courseerolltour(Tour tour);
int coursedetail(CourseEnrollment courseEnrollment);
int coursephotodetail(CourseEnrollment courseEnrollment);
}
|
Go | UTF-8 | 1,277 | 2.921875 | 3 | [] | no_license | package main
import (
"net/http"
"strconv"
"github.com/labstack/echo/v4"
)
type User struct {
Id int `json "id"`
Name string `json "name"`
Age int `json "age"`
}
var users = map[int]*User{}
func getAllUsers(c echo.Context) error {
return c.JSON(http.StatusOK, users)
}
func getUser(c echo.Context) ... |
C# | UTF-8 | 1,256 | 2.65625 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Text;
namespace POCS
{
public class DPDetails
{
private decimal deliveryPointId;
public decimal DeliveryPointId
{
get
{
return deliveryPointId;
}
set
... |
Java | UTF-8 | 694 | 4.21875 | 4 | [] | no_license | //Create Ninja class that extends from the Human class.
public class Ninja extends Human{
public Ninja(){
//Ninja: Set default stealth to 10
this.stealth = 10;
}
//Ninja: Add a method steal(Human) that takes the amount of stealth the ninja has, removes it from the other human's health, and ... |
Markdown | UTF-8 | 8,841 | 2.8125 | 3 | [] | no_license | # INE5416 - Paradigmas de Programação
# Trabalho VI - Programação Lógica - Prolog
# Sistema Especialista para Diagnósticos de Doenças Transmitidas pelo Aedes Aegypti
### Aluno: Daniel de Souza Baulé (16200639)
Realização das consultas ao sistema especialista para cada regra descrita no artigo *"Utilização de Sistema ... |
Java | UTF-8 | 2,067 | 3.515625 | 4 | [] | no_license | package itea.lsn3;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class DZ_Array4_math { //программа для подсчета значения математического выражения, введенного из консоли
public static void main(String[] args) throws IOException {
BufferedReader RL ... |
Java | UTF-8 | 818 | 2 | 2 | [] | no_license | package com.nhb.nb.dataaccess.dao.rate;
import java.util.List;
import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;
import com.nhb.nb.dataaccess.entity.UnitRate;
@Repository
public interface UnitRateDao ext... |
Python | UTF-8 | 815 | 3.640625 | 4 | [] | no_license | '''
Created by Basanta Phuyal
'''
alphabet = "abcdefghijklmnopqrstuvwxyz"
key = int(input("What is your encryption key? (1-9) ")) #key that aids with encryption
user_input= input("Message: ") #stores user's message
mail_input= input("Gmail: ") #stores user's gmail address
pass... |
Java | UTF-8 | 3,778 | 2.1875 | 2 | [] | no_license | package com.example.yu.mhc.adapter;
import android.content.Context;
import android.graphics.Bitmap;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.yu.mhc.R;
import com.example.yu.mhc.bean.W... |
Java | UTF-8 | 2,531 | 2.78125 | 3 | [] | no_license | package restaurant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Required;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class Restaurant {
@Aut... |
Java | UTF-8 | 2,907 | 2.59375 | 3 | [] | no_license | package ie.cex.handlers;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.DatabaseUtils;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util... |
Python | UTF-8 | 172 | 3.625 | 4 | [] | no_license | word = ["av","cs","ef", "gh"]
# word内の3つまでをプリントする
for i in range(3):
print word[i]
# word内の全てをプリントする
for w in word:
print w |
Shell | UTF-8 | 194 | 2.859375 | 3 | [] | no_license | #!/bin/sh
# remove songs NOT matching PATTERN from playlist
pattern="$1"
mpc --format "%position% %artist% %album% %title%" playlist \
| ngrep $pattern \
| awk '{print $1}' \
| mpc del
|
Java | UTF-8 | 795 | 3.546875 | 4 | [] | no_license | package swing2019_11_16;
import javax.swing.*;
import java.awt.*;
public class JFrameDemo extends JFrame {
public JFrameDemo(){
//设置窗口标题
setTitle("Java 第一个GUI程序");
//设置窗口显示尺寸
setSize(400,200);
//设置窗口是否可以关闭
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//创建... |
Python | UTF-8 | 1,047 | 3.84375 | 4 | [] | no_license | def calc_power(x,y):
"""xのy乗を計算する"""
result = x **y
return result
print(calc_power(2,10))
def show_args(*args):
"""位置引数のタプル化の例"""
print("Positional args:",args)
return args
show_args("a","b","c","d","e","f")
def show_kwargs(**kwargs):
"""キーワード引数の辞書化の例"""
print("Keyword args:", kwargs)
return kwargs
show_kwar... |
Java | UTF-8 | 524 | 2.359375 | 2 | [] | no_license | package adrianromanski.restschool.model.event;
import adrianromanski.restschool.model.person.TeacherDTO;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.time.LocalDate;
@Getter
@Setter
@NoArgsConstructor
public class PaymentDTO extends EventDTO {
p... |
Go | UTF-8 | 2,036 | 2.640625 | 3 | [] | no_license | package search
import (
"testing"
"github.com/bx5a/minstrel-server/track"
)
func TestYoutubeEngine_Search(t *testing.T) {
searchEngine := MakeYoutubeEngine()
idList, err := searchEngine.Search("adele", "US", "")
if err != nil {
t.Fatal(err)
}
ids := idList.IDs
if len(ids) == 0 {
t.Errorf("Obtained ID arr... |
TypeScript | UTF-8 | 1,337 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | /**
* Copyright 2020 Angus.Fenying <fenying@litert.org>
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by appli... |
Python | UTF-8 | 1,988 | 2.8125 | 3 | [] | no_license | #!/usr/bin/python
import sys
from itertools import islice
file1 = sys.argv[1]
mydir = sys.argv[2]
njobs = sys.argv[3]
set_1 = set(line.strip() for line in open (file1, 'r'))
#create BC barcode files
output1a = open(mydir+"bar4.txt", "w")
output1b = open(mydir+"bar5.txt", "w")
output1c = open(mydir+"bar6.txt", "w")
... |
Python | UTF-8 | 5,108 | 2.828125 | 3 | [] | no_license | import csv
""" Модуль для работы с csv-файлами"""
from itertools import cycle
"""Создать бесконечный итератор"""
with open('script-for-alice.csv', 'r', encoding='utf8') as csvfile:
""" Читать сценарий, записанный в csv-файле"""
data = csv.DictReader(csvfile, delimiter=';', quotechar=' ')
events = {... |
Java | UTF-8 | 254 | 2.6875 | 3 | [] | no_license | class largest
{
public static void main(String... a)
{
int d,b,c;
d=10;b=30;c=27;
if(d>b && d>c)
System.out.println("a is largest");
else if(b>d && b>c)
System.out.println("b is largest");
else
System.out.println("c is largest");
}
} |
Java | UTF-8 | 788 | 3.140625 | 3 | [] | no_license | import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;
public class Solution {
static void staircase(int n) {
int k = 0;
while (k < n) {
if (n - k - 1 > 0)
System.ou... |
Python | UTF-8 | 2,767 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
__author__ = 'MFC'
__time__ = '18/4/6 23:53'
"""
Python网络爬虫--从入门到实践 P42-44
解析真实地址抓取
http://www.santostang.com/2017/03/02/hello-world/
抓取来必力评论:
"https://api-zero.livere.com/v1/comments/list?callback=jQuery1124025451041961429377_1523032354340&limit=10&repSeq=3871836&reque... |
Java | UTF-8 | 1,411 | 2.84375 | 3 | [] | no_license | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.test.gof.design.patterns.creational;
import com.gof.design.patterns.creational.singleton.Singleton;
import java.util.Date;
import static org.testng.Assert.*;
import org.testng.annotations.AfterClass... |
Shell | UTF-8 | 4,206 | 3.453125 | 3 | [
"MIT"
] | permissive | #!/bin/bash
#set -x
### BEGIN INIT INFO
# Provides: ComprehensiveIT
# Required-Start: $syslog
# Required-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# X-Interactive: true
# Short-Description: Jenkins server
# Description: Start the Jenkins server
# This script will s... |
Java | UTF-8 | 2,925 | 3.609375 | 4 | [] | no_license | package fr.umlv.labfour;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Random;
public class Example1 {
/*
*
*
* 1 - 4) Si l'on ajoute pas un second run, le fait de placer un yield bloquera l'exécution du code
*
* 1 - 5) yield enregistre sur la pile le pointeur de l'opérat... |
C# | UTF-8 | 2,420 | 2.90625 | 3 | [] | no_license | using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Text;
namespace Exercises.Tests
{
[TestClass]
public class NonStartTest
{
[TestMethod]
public void NonStartHelloThereTest()
{
NonStart stringpart = new NonSt... |
JavaScript | UTF-8 | 782 | 3.359375 | 3 | [] | no_license | var Stack = (function(){
function _Stack(){
this._init.apply(this, arguments);
}
_Stack.prototype = {
_init : function(){
this.stack = [];
this.size = 0;
},
push : function(data){
this.stack[this.size++] = data;
},
pop : function(){
if(this.isEmpty()) return -1;
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.