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 | 86 | 3.140625 | 3 | [] | no_license | #!/usr/bin/python
#range function
listofevennum=range(0,400,2)
print listofevennum
|
Python | UTF-8 | 2,882 | 3.265625 | 3 | [] | no_license | import random
"""
# randomContractions.py
Implementation of Karger's algorithm. http://en.wikipedia.org/wiki/Karger's_algorithm
"""
def importGraph(filename = 'kargerAdj.txt'):
"""Imports pairs of endpoints into an adjancey list graph representation.
Keep track of both edges and vertices."""
f = open(fi... |
Markdown | UTF-8 | 541 | 2.609375 | 3 | [] | no_license | # Text-Mining-Analytics-Using-R
**Data used for this project:** News group data comes along with the 'tm' Package.
**Create Document Term matrix:** Create a Corpus dataset by grouping all the data which you want to classify.
**Data Preprocessing:** Clean the data by removing punctuations or any extra characters.
**... |
Java | UTF-8 | 10,909 | 2.28125 | 2 | [] | no_license | package ufm.universalfinancemanager.addeditbudget;
import android.support.annotation.Nullable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.inject.Inject;
import ufm.universalfinancemanager.db.TransactionDataSource;
import ufm.universalfinancemanager.db.UserDataSource;
impo... |
C++ | UTF-8 | 417 | 2.5625 | 3 | [] | no_license | #include "../include/movop.h"
#include "iostream"
void MovOp::Apply(Memory &mem) {
// mem.SetReg(mem.registers[op1_], op2_->Get(mem));
op1_->Set(mem, op2_->Get(mem));
mem.Push(op2_->Get(mem));
}
MovOp::~MovOp() {
std::cout << "delete - op1_ " << op1_ << std::endl;
delete op1_;
delete op2_;
std::cout << ... |
PHP | UTF-8 | 9,394 | 2.828125 | 3 | [] | no_license | <?php
namespace DkanTools\Command;
use DkanTools\Util\Util;
/**
* This is project's console commands configuration for Robo task runner.
*
* @see http://robo.li/
*/
class RestoreCommands extends \Robo\Tasks
{
/**
* Restore files and database.
*
* A command that creates a DKAN site from a db du... |
PHP | UTF-8 | 9,755 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* This class controls acount registration on the system.
*
* @author Al Zziwa <azziwa@gmail.com>
* @version 1.1.0
* @copyright TMIS
* @created 01/08/2015
*/
class Register extends CI_Controller
{
# Constructor to set some default ... |
Shell | UTF-8 | 610 | 2.921875 | 3 | [] | no_license | #!/bin/bash
#set -e
sudo -k
# Just because, clearing some variables that are shared between other scripts.
unset account_password
unset git_fullname
unset git_email
. init/banner.sh
. init/check.sh
. init/input.sh
# Initializing apt-get
sudo apt update
sudo apt upgrade -y
# Installing various applications...
sudo... |
C++ | UTF-8 | 1,109 | 3.640625 | 4 | [] | no_license | // Copyright (c) 2020 Ryan Walsh All rights reserved
//
// Created by Ryan Walsh
// Created on December 9 2020
// this program tells you if the year entered is a leap year
#include <iostream>
#include <string>
int main() {
// this program tells you if the year entered is a leap year
std::string year_string;
... |
Java | UTF-8 | 646 | 2.1875 | 2 | [] | no_license | package br.com.letscode.Request;
import br.com.letscode.entities.Aluno;
import br.com.letscode.entities.Curso;
import br.com.letscode.repository.CursoRepository;
import lombok.Getter;
import java.sql.Date;
import java.util.Optional;
@Getter
public class AlunoRequest {
private Long ra;
private String nome;
... |
PHP | UTF-8 | 1,415 | 2.75 | 3 | [] | no_license | <?php
require_once("library.php");
function sendMessage($message) {
if(strlen($message) > 1000) {
$message = substr($message, 0, 2000) . "-";
}
if(!checkSession()) {
return array("success" => false,
"message" => "Session not created");
}
$g_id = $_SESSION["group_... |
C | UTF-8 | 205 | 2.859375 | 3 | [] | no_license | #include<stdio.h>
main()
{
int a,i,max=0;
scanf("%d",&a);
int ar[a];
for(i=0;i<a;i++){
scanf("%d",&ar[i]);
if(i==0){
max=ar[i];}
if(ar[i]<max)
{
max=ar[i];
}
}
printf("%d",max);
}
|
PHP | UTF-8 | 986 | 3.34375 | 3 | [
"MIT"
] | permissive | <?php
namespace Userv\Connection;
use Userv\Server;
/**
* This class represent a connection with a unique client
*/
class Connection implements ConnectionInterface
{
public $connection;
public $server;
/**
* {@inheritdoc}
*/
public function setServer(Server $server)
{
$this-... |
C++ | UTF-8 | 862 | 2.921875 | 3 | [] | no_license | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <climits>
#include <iterator>
using namespace std;
using ivec = vector<long long int>;
ivec read_array() {
auto n = 0ul;
cin >> n;
auto arr = ivec(n);
for (auto i = 0; i < n; ++i) {
cin >> arr[i];
}
return ... |
C++ | UTF-8 | 1,222 | 3.078125 | 3 | [
"MIT"
] | permissive | #include<stdio.h>
#include<limits.h>
#include<list>
using namespace std;
int V;
list<int> *adj;
int *color, *tf, time;
list<int> sortedlist;
void dfsvisit(int u)
{
color[u] = 1;
time = time + 1;
list<int>::iterator i;
for(i = adj[u].begin(); i != adj[u].end(); i++) {
int v = *i;
if(... |
Java | WINDOWS-1250 | 8,419 | 2.296875 | 2 | [] | no_license | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* DoctorWindow.java
*
* Created on 2012-01-05, 13:55:38
*/
package gui;
import sildent.Config;
import utilities.User;
import javax.swing.border.BevelBorder;
import javax.swing.border.LineBorder;
import java.awt... |
Shell | UTF-8 | 263 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env bash
### List of passed in variables
# $1 - Path name to working directory
# $2 - Base name of fit.
# $3 - Photometry file.
# $4 - Calcsfh parameter file.
echo "Passed in quantities ${1}, ${2}, ${3}, and ${4}"
./scripts/ProcessDAv.py $1 $2 $3 $4
|
PHP | UTF-8 | 608 | 2.8125 | 3 | [] | no_license | <?php
/*
路径生成器
提供文件或文件夹的存储路径
更新记录:
2016-04-12 创建
*/
class PathBuilder
{
function __construct()
{
}
/*
返回上传路径:
示例:D:\wamp\www\HttpUploader6.1\upload\
*/
function getRoot()
{
$path = getcwd();// D:\wamp\www\HttpUploader6.1
$path = realpath($path);//规范化路径 up6.1/upload/
$path = PathTool::comb... |
C++ | UTF-8 | 959 | 4.0625 | 4 | [] | no_license | /*
* Implement an algorithm to find the nth to last element of a singly linked list.
*/
#include <iostream>
using namespace std;
typedef struct node {
int data;
struct node *next;
}LinkList;
LinkList* createLinkList(int a[], int n) {
LinkList *head, *p, *q;
for(int i = 0; i < n; ++i){
q = new LinkLi... |
C++ | UTF-8 | 820 | 3.015625 | 3 | [] | no_license | #include "Elevator.h"
#include <iostream>
#include <cstdlib> //srand, rand
#include <chrono>
#include <vector>
#include <cmath>
#include <string>
#include <random>
using namespace std;
//Elevator::Elevator(){
//
//};
// num_elevators = times this program is being run?
// 3 variables
// access * 2
// ... |
C++ | UTF-8 | 19,071 | 2.96875 | 3 | [] | no_license | // Agent.cc
#include <iostream>
#include <fstream>
#include <list>
#include <string>
#include <string.h>
#include "Agent.h"
using namespace std;
Agent::Agent ()
{
} // end Agent constructor
Agent::~Agent ()
{
ofstream outputFile;
//cout << "X: " << curLoc.X << " Y: " << curLoc.Y << endl;
if (normalExit == 0)
... |
Python | UTF-8 | 4,941 | 3.1875 | 3 | [] | no_license | import pygame
import imgui
from Framework.Vector import vec2
from GameObject import GameObject
from Tilemap import TileTypes
class PlayerTilemapFree(GameObject):
def __init__(self, tilePosition, sprite, animationFrames, tilemap):
super().__init__( vec2( 0, 0 ), sprite, animationFrames[0] )
self.an... |
SQL | UTF-8 | 184 | 3.265625 | 3 | [
"Apache-2.0",
"PostgreSQL",
"BSD-3-Clause",
"MIT"
] | permissive | select sum(cnt1), sum(sum2)
from (
select o_orderdate, count(distinct o_orderpriority), count(distinct o_orderkey) cnt1, sum(o_totalprice) sum2
from orders group by o_orderdate
) a |
Python | UTF-8 | 341 | 3.484375 | 3 | [
"MIT"
] | permissive | list_a = [ 5 , 4 , 2 , 1 , 3 ]
length = len(list_a)
for i in range(length -1 ):
smallest = i
for j in range(i+ 1 , length):
if list_a[j] < list_a[smallest]:
smallest = j
tmp = list_a[smallest]
list_a[smallest] = list_a[i]
list_a[i] = tmp
... |
Java | UTF-8 | 2,132 | 2.0625 | 2 | [] | no_license | package com.eagle.qa.testcases;
import org.openqa.selenium.By;
import org.openqa.selenium.support.ui.Select;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import... |
Python | UTF-8 | 126 | 3.046875 | 3 | [] | no_license | n=[3,2,3,4,5,6]
s=0
d=1
for i in range(len(n)):
f=i+n[i]
if f%3==0:
s=s+(n[i]**2)
print(n[i])
print(s) |
PHP | UTF-8 | 1,662 | 2.53125 | 3 | [] | no_license | <?php
session_start();
$con = mysqli_connect('localhost', 'root', 'nitrr2020mca');
mysqli_select_db($con, 'studentsdb');
$email=$_POST['email_login'];
$pass=$_POST['pass_login'];
$password="#@nit";
for ($i = 0; $i < strlen($pass); $i++){
$password=$password.ord($pass[$i]);
}
$password=$password."@#";
$sql =... |
TypeScript | UTF-8 | 1,547 | 2.890625 | 3 | [] | no_license | import * as fs from "fs";
import * as os from "os";
import { assert } from "chai";
import { isArray, isString } from "util";
import { IActualResult } from "./actual-result";
import { IExpectedResult, linesMatch } from "./expected-result";
export class ExpectedSuccess implements IExpectedResult
{
public lines(): s... |
PHP | UTF-8 | 4,076 | 2.640625 | 3 | [
"MIT"
] | permissive | <?php
use App\Models\Kriteria;
class Helper
{
public static function applyClass($user) {
return "call from helper to " . $user;
}
public static function bobotTransform($data)
{
$listBobot = array();
foreach ($data as $d){
array_push($listBobot, $d->pivot->bobot);
... |
C# | UTF-8 | 611 | 3.15625 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Lab1OOP
{
abstract class Shape { //абстрактный класс
protected int width, height; //инкапсуляция - можем изменять данные в дочерник классах
public Shape(int a, int b)
... |
Java | UTF-8 | 1,248 | 3.734375 | 4 | [] | no_license | package com.sparta.jm.sorters;
public class Quicksort implements Sorter {
@Override
public int[] getSortedArray(int[] array1) {
return quickSort(array1,0,array1.length-1);
}
public int[] quickSort(int[] array1, int low_index, int high_index) {
int i = low_index;
int j = high_in... |
Shell | UTF-8 | 2,214 | 2.96875 | 3 | [
"BSD-2-Clause",
"MIT",
"GPL-2.0-or-later",
"GPL-1.0-or-later",
"GPL-2.0-only",
"GPL-3.0-only",
"FSFAP",
"GPL-3.0-or-later",
"Autoconf-exception-3.0",
"LicenseRef-scancode-other-copyleft"
] | permissive | #! /bin/sh
# Copyright (C) 2003-2013 Free Software Foundation, Inc.
#
# 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, or (at your option)
# any later version.
#
# This program ... |
Java | UTF-8 | 423 | 3.03125 | 3 | [] | no_license | package sortowanie;
import tablice.TabHelper;
public class InsertSort {
public static void sort(int[] tab) {
for (int i = 1; i < tab.length; i++) {
int j = i; // fragment [0, ..., i - 1] jest już posortowany
int temp = tab[j];
while (j > 0 && tab[j - 1] > temp) ... |
C++ | UTF-8 | 2,018 | 3.65625 | 4 | [
"Apache-2.0"
] | permissive | #include "ArrayUtil/RView.hpp"
#include <array>
#include <cstdint>
#include <iostream>
using namespace ArrayUtil;
static constexpr size_t testSize = 3;
template <typename T, typename Owner>
bool RunTests(std::string const& testName, T& view, Owner& owner)
{
// check data
if (!(owner[0] == *view.begin() && o... |
Shell | UTF-8 | 1,801 | 3.75 | 4 | [] | no_license | #!/bin/bash
# description: Tools for React.js / Node.js - docker, docker-compose sysadmin (MERM stack)
# Environment settings
INSTALL_DIR=`echo $0 | sed 's/tools\.sh//g'`
DOCKERCOMPOSE_BIN=`which docker-compose` ;
DOCKER_BIN=`which docker` ;
#SH_BIN =`which sh` ;
set -x
removeAllFromDocker() {
echo "Stop all cont... |
Python | UTF-8 | 414 | 3.765625 | 4 | [] | no_license |
def append_length(lst=[]):
lst.append(len(lst))
return lst
print(append_length([1, 2])) # [1, 2, 2]
print(append_length()) # [0]
print(append_length()) # [0, 1]
def fact(x, cache={0: 1}):
print(f" fact({x})")
if x not in cache:
cache[x] = x * fact(x - 1)
return cache[x]
print(f"fact(5)... |
Python | UTF-8 | 3,997 | 2.578125 | 3 | [
"MIT"
] | permissive | import logging
import torch
import pandas as pd
from torch.utils.data import DataLoader, Dataset
import torch
from functools import partial
logging.basicConfig(level=logging.INFO)
# BAD: this should not be global
# tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased")
def get_dataloader(tokenizer, data_p... |
TypeScript | UTF-8 | 2,458 | 2.515625 | 3 | [
"BSD-3-Clause"
] | permissive | /*
Language: YAML
Author: Stefan Wienert <stwienert@gmail.com>
Requires: ruby.js
Description: YAML (Yet Another Markdown Language)
Category: config
*/
import { LanguageDef } from '../types';
import { BACKSLASH_ESCAPE, UNDERSCORE_IDENT_RE, HASH_COMMENT_MODE, C_NUMBER_MODE } from '../common';
const LITERALS = 'true fal... |
Markdown | UTF-8 | 7,256 | 3.015625 | 3 | [] | no_license | # So you want to delete your old tweets
Great! The setup process may seem like a lot of steps, but it's not that hard and should only take you 15-20 minutes. Unfortunately, that's the trade-off of doing things yourself instead of letting a service to do it for you. It's mostly just filling out forms and clicking butto... |
Java | UTF-8 | 7,950 | 2.3125 | 2 | [] | no_license | /*******************************************************************************
* Copyright (c) 2009, 2017 Mountainminds GmbH & Co. KG and Contributors
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this... |
Ruby | UTF-8 | 4,726 | 3.375 | 3 | [
"MIT"
] | permissive | require 'json'
require 'erubis'
module Jaspion
module Kilza
# Represents an program language
module Language
# Array with all Class classes
attr_accessor :classes
# Name used to represent the first generated class
attr_accessor :base_name
# JSON that will be used to generate o... |
Java | UTF-8 | 1,141 | 2.109375 | 2 | [
"Apache-2.0"
] | permissive | package com.springsource.insight.plugin.webflow;
import static org.junit.Assert.assertNotNull;
import org.junit.Test;
import com.springsource.insight.collection.OperationCollectionAspectSupport;
import com.springsource.insight.collection.OperationCollectionAspectTestSupport;
import com.springsource.insight.i... |
C# | UTF-8 | 2,305 | 3.484375 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace snake
{
struct Position
{
public int X;
public int Y;
public Position(int x,int y)
{
this.X = x;
this.Y = y;
... |
PHP | UTF-8 | 4,727 | 2.859375 | 3 | [] | no_license | <?php
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;
require 'vendor/autoload.php';
$app = new \Slim\App;
//$app = new \Slim\App(['settings' => ['displayErrorDetails' => true]]);
function getDB()
{
$dbhost = "pajaros.com";
$dbname = "pajaros";
... |
Markdown | UTF-8 | 7,074 | 3.109375 | 3 | [
"Apache-2.0",
"MIT"
] | permissive |
<div style="text-align:center"><img src="https://raw.githubusercontent.com/sopra-fs21-group-4/client/master/src/image/logo/doyouevenmeme.png"/></div>
[toc]
# Project-Description
In this game players submit titles for images and gifs that are collected from a specified Subreddit. A normal game flow looks something lik... |
JavaScript | UTF-8 | 286 | 2.609375 | 3 | [
"MIT"
] | permissive | export function formatAmount(value) {
Intl.NumberFormat('pt-BR', { style: 'currency', currency: 'BRL' }).format(value)
return value
}
export function formatDate(date) {
const splittedDate = date.split("-")
return `${splittedDate[2]}/${splittedDate[1]}/${splittedDate[0]}`
} |
C | UTF-8 | 2,246 | 3.09375 | 3 | [
"MIT"
] | permissive | #define NADA 0
#define NUMERO 1
#define INCORRECTO 2
#define FIN 3
#define CONTEO 0
#define ALMACEN 1
typedef struct entrada
{
int cont, max, acc, size;
char estado, op;
} VEC_IN;
void eval_est(VEC_IN *v, char c, int *in_min)
{
switch (v->estado)
{
case NADA:
if (c >= '0' && c <= '9')
{
... |
C++ | UTF-8 | 3,099 | 2.578125 | 3 | [] | no_license | //
// Created by sttony on 5/16/23.
//
#include <QVBoxLayout>
#include <QFileDialog>
#include "MainWindow.h"
#include "CNoteBook.h"
void MainWindow::contextMenuEvent(QContextMenuEvent *event) {
QMainWindow::contextMenuEvent(event);
}
MainWindow::MainWindow() {
auto *widget = new QWidget;
setCentralWidge... |
PHP | UTF-8 | 1,313 | 3 | 3 | [
"MIT"
] | permissive | <?php
namespace HMorm;
class Log
{
private static $path = '';
public function __construct($setPath = "")
{
self::$path = self::$path ? self::$path : ($setPath ? $setPath : "./runtime/log/");
}
public static function setLogPath($path)
{
self::$path = $path;
}
public funct... |
C++ | UTF-8 | 876 | 3.1875 | 3 | [
"MIT"
] | permissive | //
// Created by 정현민 on 2021/03/31.
//
#include "string_handler.h"
std::vector<std::string> StringHandler::SplitString(const std::string &original_string,
char delimiter) {
std::vector<std::string> sub_strings;
std::stringstream string_stream(original_string);
... |
SQL | UTF-8 | 3,936 | 3.203125 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 5.0.3
-- https://www.phpmyadmin.net/
--
-- Máy chủ: localhost
-- Thời gian đã tạo: Th10 30, 2020 lúc 07:35 AM
-- Phiên bản máy phục vụ: 10.4.14-MariaDB
-- Phiên bản PHP: 7.2.34
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHA... |
Markdown | UTF-8 | 1,060 | 2.515625 | 3 | [
"MIT"
] | permissive | <p align="center"><img src="https://raw.githubusercontent.com/Gamecrafter/PocketMine-Plugins/master/SkinTools/images/icon.png?raw=true"/></p>
#SkinTools
Skins have never been this fun to mess around with!
###Commands:
Main command: **skintools**, **st**
|Sub-command|Description|
|-----------|-----------|
|**file**|Sa... |
Markdown | UTF-8 | 1,382 | 2.84375 | 3 | [] | no_license | # Article 38
I. - Pour l'application des articles 33 à 37 :
1° Les fonctions qui ne sont pas exercées à temps plein sont prises en compte à concurrence des services réellement effectués ;
2° Une même période ne peut donner lieu à prise en compte qu'une seule fois ;
3° Les demandes de classement en application du pr... |
C++ | UTF-8 | 22,972 | 2.53125 | 3 | [
"MIT"
] | permissive | #include "Context.hpp"
#include <iostream>
#include <stdexcept>
#include "UtilsOpenCL.hpp"
#include "../pch.hpp"
bool print_info = false;
/**
* _kernels uses pointers, which makes the wrapper more lightweight.
* As soon as vector that holds original instances is reloacted
* the pointers are obsolete.
*/
const s... |
C | UTF-8 | 524 | 2.953125 | 3 | [] | no_license | #include<stdio.h>
#include<stdlib.h>
#include<fcntl.h>
#include<unistd.h>
int main(){
int fd=open("a.txt",O_RDONLY);
if(fd==-1) perror("opena"),exit(-1);
int fd1=open("b.txt",O_CREAT|O_RDWR|O_TRUNC,0666);//新建文件时有权限屏蔽
if(fd1==-1) perror("openb"),exit(-1);
char buf[4096]={};
while(1){
... |
C | UTF-8 | 1,350 | 2.765625 | 3 | [] | no_license | #include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <time.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/socket.h>
#include "func.h"
#ifdef DEBUG
#define BYTES
#endif
#define SERVER_SOCKET_IP "192.168.40.185"
#define SERV... |
Java | UTF-8 | 2,528 | 2.515625 | 3 | [
"MIT"
] | permissive | package net.dumbcode.test;
import net.dumbcode.hwkengine.display.DisplayManager;
import net.dumbcode.hwkengine.entities.Camera;
import net.dumbcode.hwkengine.entities.Entity;
import net.dumbcode.hwkengine.entities.Light;
import net.dumbcode.hwkengine.model.RawModel;
import net.dumbcode.hwkengine.model.TexturedModel;
i... |
Python | UTF-8 | 8,521 | 3.15625 | 3 | [] | no_license | import pygame
import tweepy
import random
#user:TrumpPong
#password:FUPgdpp100t
auth = tweepy.OAuthHandler("VOrDwufgnBfc9Pg7MU0NNJnhg", "U34un9TLQjiC0vSZT5ACkYIG8anlNibZSsEq5QCjZP4fsIk4SR")
auth.set_access_token("747244855550582784-NY7T1r6SfVQ8lEMtUPXfsr8IBtysolN","9h8fYzJEWMVnvpCAyJzLs8du17X7H170lAc1PdywnX3II")
api ... |
PHP | UTF-8 | 360 | 2.578125 | 3 | [] | no_license | <?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class DriverLocation extends Model
{
public function driver()
{
return $this->hasOne('App\Driver','driver_id');
}
// Once Relationship defined I can access $ride = DriverLocation::fine(1)->ride();
// The above line will return ... |
PHP | UTF-8 | 1,271 | 2.65625 | 3 | [] | no_license | <?php
require_once "includes/config.php";
require_once "lib/password.php";
?>
<form method='post'>
<input type="text" name="username" placeholder="username"> <br />
<input type="password" name="password" placeholder="password"> <br />
<input type="submit" value="login" name="submit">
</form>
<div id="hel... |
C++ | UTF-8 | 5,844 | 2.609375 | 3 | [] | no_license | #ifndef __CUDA_DRAW__
#define __CUDA_DRAW__
#include <glog/logging.h>
#include <opencv2/opencv.hpp>
namespace cudraw {
// Utilities
// Support U8C3 images only
uint8_t* allocateImage(size_t width, size_t height);
uint8_t* uploadImage(size_t width, size_t height, uint8_t* img);
void uploadImage(size_t width, size_... |
C# | UTF-8 | 743 | 2.875 | 3 | [] | no_license | using SettlersOfValgard.resource;
namespace SettlersOfValgard.command
{
public static class StockPileCommands
{
public static void StockPile(Command command)
{
if (command.Args.Count == 0)
{
var isEmpty = true;
foreach ((... |
Python | UTF-8 | 2,227 | 3.15625 | 3 | [] | no_license | import requests
import re
from bs4 import BeautifulSoup
class Parser:
"""
URLにアクセスして、パソコンの情報を含んだデータをかえす(仮)
"""
URL = "http://www.lenovo.com/jp/ja/notebooks/thinkpad/e-series/E495/p/22TP2TEE495"
@staticmethod
def _getSoupFromURL(url: int):
"""
urlのリンク先のsoupを返す
parameter... |
C++ | UTF-8 | 1,460 | 2.765625 | 3 | [] | no_license | /* Edmonds-Karp O(VE^2) time
O(E) memory
*/
#include<bits/stdc++.h>
using namespace std;
const int maxN=1e3+10;
int n,st,fn,m;
bool mark[maxN];
int cap[maxN][maxN],parent[maxN];
vector<int> g[maxN],path;
#define PB push_back
void input()
{
cin>>n>>m;
cin>>st>>fn;
for(int i=1;i<=m;i++)
... |
JavaScript | UTF-8 | 1,921 | 3.671875 | 4 | [] | no_license | /*
Created By: Kris Kuchinka
* Start Date: 2016.02.26
* Submission Date:
* Document Purpose: This is an external JavaScript file
* written for the "JavaPic" assignment at PDX Code Guild.
*/
function externalJs() {
console.log("Your external JS is connected properly.");
} // End of start funtion
// Create functi... |
PHP | UTF-8 | 636 | 3.484375 | 3 | [] | no_license | <html>
<head>
<title>AoC 2018 DAY02</title>
</head>
<body>
<?php
$input = file("input\day02.txt");
$two = 0;
$three = 0;
foreach($input as $element)
{
$lul = str_split($element);
sort($lul);
for($i = 0; $i < (count($lul) - 2); $i++)
{
if($lul[$i] == $lul[$i+1] && $lul[$i] !=... |
JavaScript | UTF-8 | 7,435 | 2.71875 | 3 | [] | no_license | function Llanta(){
var material = new THREE.MeshStandardMaterial( { color: 0x000000, metalness: 0.5, roughness: 0.2 });
var material2 = new THREE.MeshStandardMaterial( { color: 0x7A7A7A, metalness: 0.5, roughness: 0.2 } );
var geoLlanta = new THREE.CylinderGeometry( 2, 2, 2, 32 );
var Llanta = new THREE.M... |
C | UTF-8 | 3,519 | 3.421875 | 3 | [] | no_license | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* rot_min.c :+: :+: :+: ... |
Java | UTF-8 | 1,569 | 1.625 | 2 | [] | no_license | package androidx.preference;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import androidx.annotation.NonNull;
@Deprecated
/* renamed from: androidx.preference.c reason: case insensitive filesystem */
public class C0149c extends n {
private EditText i;
private CharSequen... |
Python | UTF-8 | 360 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Dec 8 10:50:58 2019
@author: Divy Pandya
"""
import numpy as np
# Moore-Penrose Pseudoinverse
def MPP(A):
u, s, vh = np.linalg.svd(A)
sinv = 1./s
Dinv = np.diag(sinv)
Dinv = np.concatenate((Dinv, np.zeros((A.shape[1], A.shape[0] - s.shape[0]))), axis = 1)
... |
Markdown | UTF-8 | 814 | 2.65625 | 3 | [] | no_license | # Article 4
Peuvent se présenter à la consultation prévue à l'article 1er du présent arrêté les organisations syndicales de fonctionnaires mentionnées au quatrième alinéa de l'article 14 de la loi du 11 janvier 1984 susvisée.
Si aucune de ces organisations syndicales ne présente de candidature ou si le nombre de vota... |
Python | UTF-8 | 2,004 | 2.890625 | 3 | [] | no_license | import torch
from torch.utils.checkpoint import checkpoint
from torch import nn
#from my_checkpoint import MyCheckpointFunction, mycheckpoint
from clean_checkpoint import MyCheckpointFunction, mycheckpoint
class Test1(nn.Module):
def __init__(self):
super(Test1, self).__init__()
def bottleneck(self, i... |
Java | UTF-8 | 1,771 | 2.171875 | 2 | [] | no_license | package cn.dogoo.club.pojo;
import java.util.Date;
import java.util.List;
/**
* 学生参加活动
*
* @author Dogoo
*
*/
public class ClubActUser {
private String cauUid;
private String caUid;
private String userId;
private String userUid;
private String userName;
private Integer cauScore;// 参加活动获得的基础分数
private I... |
Java | UTF-8 | 2,585 | 2.140625 | 2 | [] | no_license | package com.retail.biocare.adapter;
import android.app.Dialog;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.Bu... |
Swift | UTF-8 | 1,656 | 2.859375 | 3 | [] | no_license | //
// NewsTableViewController.swift
// NewsRxSwift
//
// Created by Ivan Ivanov on 5/9/21.
//
import UIKit
import RxCocoa
import RxSwift
class NewsTableViewController: UITableViewController {
let disposeBag = DisposeBag()
private var articles = [Article]()
override func viewDidLoad() {
... |
Python | UTF-8 | 7,627 | 3.15625 | 3 | [
"MIT"
] | permissive | import csv
import pdb
from sklearn.metrics import accuracy_score, precision_score, recall_score, classification_report, confusion_matrix
import numpy as np
class AverageMeter(object):
"""Computes and stores the average and current value"""
def __init__(self):
self.reset()
def reset(self):
... |
Markdown | UTF-8 | 455 | 2.765625 | 3 | [] | no_license | # ExifData
Extracting exif data from .JPG file outputting creation date and GPS Information using Python3
# Usage :
./Exifdata.py <imageName.jpg> optional ouput Exif data file
# Output
Checks for Exif data in JPEG file and outputs Exif data to file: <imageName>_ExifData.txt
Extracts GPS Coordinates and translates ... |
C# | UTF-8 | 8,053 | 2.515625 | 3 | [] | no_license | using System;
using System.Drawing;
using ch = ConsoleHelper.Console;
namespace ConsoleHelper
{
public class Demo
{
public static void Run()
{
var dx = ch.GetUniqueRandoms(3, 77, 345, 788, 432);
dx = ch.GetUniqueRandoms(3, 77, 345, 788, 432);
dx = ch.GetUniq... |
Java | UTF-8 | 2,155 | 2.765625 | 3 | [] | no_license | package zedly.zenchantments.enchantments;
import org.bukkit.entity.Entity;
import org.bukkit.entity.MushroomCow;
import org.bukkit.entity.Player;
import org.bukkit.entity.Sheep;
import org.bukkit.event.player.PlayerEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.Player... |
JavaScript | UTF-8 | 957 | 2.953125 | 3 | [] | no_license | import React from "react";
class ExerciseOneInput extends React.Component {
constructor(props) {
super(props);
this.handleChange = this.handleChange.bind(this);
this.handleCheckboxChange = this.handleCheckboxChange.bind(this);
}
handleCheckboxChange(ev) {
let divisor;
if (ev.targe... |
Markdown | UTF-8 | 2,692 | 2.5625 | 3 | [] | no_license | ---
author: cyoasu
date: 2015-10-01 11:58:09+00:00
draft: false
title: 'JACKA THE MUSICAL: The AFUO encourages you to come and witness this production'
type: post
url: /culture/jacka-the-musical-the-afuo-encourages-you-to-come-and-witness-this-production/
categories:
- Culture
---
![Australian Federation of Ukrainian ... |
Java | UTF-8 | 1,078 | 2.90625 | 3 | [
"MIT"
] | permissive | package <missing>;
public class GlobalMembers
{
public static void Main()
{
int n;
int i;
int j = 0;
int k = 0;
int l;
String tempVar = ConsoleInput.scanfRead();
if (tempVar != null)
{
n = Integer.parseInt(tempVar);
}
//C++ TO JAVA CONVERTER TODO TASK: Java does not allow declaring typ... |
Java | UTF-8 | 805 | 2.140625 | 2 | [] | no_license | package hu.myprojects.flighttracker.controller;
import hu.myprojects.flighttracker.dao.FlightRepository;
import hu.myprojects.flighttracker.domain.Flight;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.spr... |
Java | UTF-8 | 2,000 | 2.53125 | 3 | [] | no_license | package base;
import org.openqa.selenium.WebDriver;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
p... |
Python | UTF-8 | 444 | 3.875 | 4 | [] | no_license | walk_in_min = int(input())
count_walk_in_day = int(input())
calories_per_day = int(input())
calories_burn = count_walk_in_day * walk_in_min * 5
total_calories = calories_per_day - calories_burn
if calories_burn >= total_calories / 2:
print(f"Yes, the walk for your cat is enough. Burned calories per day: {... |
TypeScript | UTF-8 | 964 | 3.0625 | 3 | [
"MIT"
] | permissive | import Message from "../../interfaces/Message";
import State from "../../interfaces/State";
import { CREATE_MESSAGE, GET_MESSAGES_FOR_CHANNEL, SET_FETCHING_MSGS } from "../types";
const initState: State["message"] = {
messages: [],
loading: true,
};
type Actions =
| {
type: typeof CREATE_MESSAGE;
}
... |
Python | UTF-8 | 1,224 | 3.328125 | 3 | [
"MIT"
] | permissive | from . import constants
from .decorators import DebugDecorator
class Utilities:
@staticmethod
@DebugDecorator()
def get_shift_by_direction(direction_index):
""" Function return shift depending on direction.
Args:
direction_index(int): index specified direction
... |
Python | UTF-8 | 2,960 | 3.9375 | 4 | [] | no_license | """
文件操作
打开 open(文件名,打开方式)
默认以只读形式打开文件
f 只读,默认值
w 只写,若文件存在,覆盖原文件,若文件不存在,自动创建
a 追加
r+ 读写,若文件不存在,抛出异常
w+ 读写,若文件存在,覆盖原文件,若文件不存在,自动创建
a+ 读写,若文件存在,在文件指针指向末尾追加,若不存在,自动创建
注意:频繁移动文件指针会影响文件读写效率,所以一般使用无+号的三个参数
读 read()
分行读 readline()
写 write()
关闭... |
TypeScript | UTF-8 | 273 | 2.546875 | 3 | [] | no_license | import {EventRequestTypes} from '../request.types.enum';
export function getCommandTypeFromText(text: string): EventRequestTypes {
if (!text) {
console.log('No body');
return;
}
return (text.toLowerCase().slice(0, text.indexOf(' '))) as EventRequestTypes;
}
|
JavaScript | UTF-8 | 390 | 3.90625 | 4 | [] | no_license | const triple_steps = (n) => {
if (n == 0 || n == 1) return 1
if (n < 0) return 0
let res = new Array(n + 1).fill(-1)
res[0] = 1
res[1] = 1
res[2] = 2
for (let i = 3; i <= n; i++) {
res[i] = res[i - 1] + res[i - 2] + res[i - 3]
}
return res[res.length - 1]
}
console.log(trip... |
PHP | UTF-8 | 2,906 | 2.515625 | 3 | [] | no_license | <?php
namespace app\controllers;
use app\models\forms\CopyForm;
use app\services\ClientLetterSearch;
use Yii;
use yii\data\ArrayDataProvider;
use yii\filters\AccessControl;
use yii\web\Controller;
use yii\web\Response;
use yii\filters\VerbFilter;
use app\models\LoginForm;
use app\models\ContactForm;
class SiteContro... |
Python | UTF-8 | 2,740 | 4.09375 | 4 | [] | no_license | # --- Day 1: Report Repair ---
# After saving Christmas five years in a row, you've decided to take a
# vacation at a nice resort on a tropical island. Surely, Christmas will go on
# without you.
# The tropical island has its own currency and is entirely cash-only. The gold
# coins used there have a little picture of... |
Ruby | UTF-8 | 559 | 3.28125 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | class Hash
def keys_of(*args)
map {|key, value| args.include?(value) ? key : nil }.compact
end
end
class Hash
def keys_of(*arguments)
array = []
self.each do |key, value|
arguments.each do |i|
if i == value
array.push(key)
end
end
end
retur... |
Java | UTF-8 | 2,245 | 3.65625 | 4 | [] | no_license | public class TraitsInJava {
public interface Coffee {
// getter for val basePrice
double basePrice();
// implementation of Coffee.price to be used for calls to super.price in mixin
static double price$(Coffee c) {
return c.basePrice();
}
// default implementation of method price... |
JavaScript | UTF-8 | 2,302 | 2.6875 | 3 | [] | no_license | import DCast from 'dcast'
import randomWords from 'random-words'
import chalk from 'chalk'
const FULL_USAGE = `
The cast command is a general-purpose tool for sending data over the dWeb
according to a secret passphrase. You choose a phrase (try to make it hard-ish
to guess!) and then share the phrase with your r... |
Java | UTF-8 | 1,193 | 2.328125 | 2 | [] | no_license | package ru.yaal.project.hhapi.loader.cache;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
public class MemoryStorageTest {
@Test
public void testSave() throws Exception {
int lifeTimeMin = 10;
ICache storage = new MemoryCache(li... |
Python | UTF-8 | 1,068 | 3.03125 | 3 | [] | no_license | class Subsir:
def __init__(self, index, subsir, lungime):
self.index = index
self.subsir = subsir
self.lungime = lungime
### CITIRE DATE ###
lungime_sir = int(raw_input())
sir = [float(x) for x in raw_input().split()]
### PRELUCRARE DATE ###
if all(sir[i] < 0 for i in range(len(sir))): ###... |
JavaScript | UTF-8 | 593 | 2.5625 | 3 | [
"MIT"
] | permissive | import { ACTION_TYPE_MON_AN } from "../actions/monAn";
const list = {
listMonAn : []
}
const monAn = (state = list, action) => {
switch(action.type){
case ACTION_TYPE_MON_AN.FETCH_ALL_MON_AN :
return {
...state ,
listMonAn : [...action.payload]
... |
SQL | UTF-8 | 1,491 | 2.9375 | 3 | [] | no_license |
PROMPT =====================================================================================
PROMPT *** Run *** ========== Scripts /Sql/BARS/View/CHECK_42A.sql =========*** Run *** ====
PROMPT =====================================================================================
PROMPT *** Create view CHEC... |
Go | UTF-8 | 2,648 | 3.328125 | 3 | [] | no_license | package model
import (
"encoding/json"
"fmt"
"github.com/zxccl0518/go_study/chatroom/common/message"
"github.com/garyburd/redigo/redis"
)
// 我们在服务器启动后,就初始化一个userDao的实例,
// 把它做成全局的,在需要和redis操作时,就直接使用即可
var (
MyUserDao *UserDao
)
// 定义一个结构体,完成对User 结构体的各种操作
type UserDao struct {
pool *redis.Pool
}
// 使用工厂模式,创... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.