language stringclasses 15
values | src_encoding stringclasses 34
values | length_bytes int64 6 7.85M | score float64 1.5 5.69 | int_score int64 2 5 | detected_licenses listlengths 0 160 | license_type stringclasses 2
values | text stringlengths 9 7.85M |
|---|---|---|---|---|---|---|---|
PHP | UTF-8 | 1,290 | 2.671875 | 3 | [] | no_license | <?php
/**
* This file is part of Bamboo CMS Application Framework.
*
* (c) Ahmad Fajar <ahmad.fajar234@yahoo.com>
*
*/
// namespace Bamboo\CoreBundle\Thumbnail;
/**
* Class ThumbnailFactory
*
* @author Ahmad Fajar
* @since 08/02/2014, modified: 14/03/1014 01:26
* @version 1.0.0
* @category CoreB... |
Java | UTF-8 | 2,350 | 2.234375 | 2 | [] | no_license | package com.ao.recyclerview_snapping.fork;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.ao.recyclerview_snap... |
Python | UTF-8 | 7,198 | 2.828125 | 3 | [
"MIT"
] | permissive | from flask import Flask, render_template, request, redirect, session, flash
# the "re" module will let us perform some regular expression operations
import re
# create a regular expression object that we can use run operations on
EMAIL_REGEX = re.compile(r'^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9._-]+\.[a-zA-Z]+$')
# import the Co... |
C# | UTF-8 | 3,789 | 2.90625 | 3 | [] | no_license | using HackerNewsScraper.HackerNewApi;
using HackerNewsScraper.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
namespace HackerNewsScraper.Services
{
public class GetStories
{
pub... |
TypeScript | UTF-8 | 10,273 | 2.78125 | 3 | [
"MIT",
"LicenseRef-scancode-public-domain"
] | permissive | /*!
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
* Licensed under the MIT License.
*/
import { assert } from '@fluidframework/common-utils';
import { copyPropertyIfDefined, fail } from './Common';
import { NodeId, TraitLabel } from './Identifiers';
import { Delta, Forest, isParentedF... |
C | UTF-8 | 1,853 | 3.03125 | 3 | [] | no_license | int randomNum() {
int num;
num = rand() % 10;
return num;
}
void inicializaLista(lista* L) {
int i = 0;
L->disp = 0;
L->prim = -1;
for( ; i < MAX - 1 ; i++)
L->elementos[i].prox = i + 1;
L->elementos[i].prox = -1;
}
lista FLVazia(lista* L) {
int i = 0;
whi... |
SQL | UTF-8 | 6,737 | 4.21875 | 4 | [] | no_license | USE Hotel;
-- QUERY 1
-- Write a query that returns a list of reservations that end in July 2023,
-- including the name of the guest, the room number(s), and the reservation dates.
SELECT
Guest.FirstName,
Guest.LastName,
Room.RoomNumber,
Reservation.CheckInDate,
Reservation.CheckOutDate
FROM Guest
I... |
JavaScript | UTF-8 | 721 | 3.21875 | 3 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | function getFirstSelector(selector) {
return document.querySelector(selector)
}
// function nestedTarget() {
// return document.querySelector('#nested').querySelector('.target')
// }
function nestedTarget() {
return document.getElementById('nested').querySelector('.target')
}
function increaseRankBy(n) {
con... |
JavaScript | UTF-8 | 991 | 2.578125 | 3 | [] | no_license | $(document).ready(function(){
let slides = $(".slider-quote .slides").children(".slide");
let width = $(".slider-quote .slides").width();
let i = slides.length;
let offset = i * width;
let cheki = i-1;
$(".slider-quote .slides").css('width',offset);
for (j=0; j < slides.length... |
PHP | UTF-8 | 2,240 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | <?php
namespace app\index\model;
use think\Model;
use think\Db;
use think\Cache;
use think\Validate;
/**
*PHP是世界上最好的语言
*@param 房间模型
**/
class Room extends Model
{
protected $name = 'room';
//用户自主添加房间并返回房间信息
public function create_room($room_id,$level)
{
$is_have_room_data = $this->is_have_room($room_id);
i... |
Java | UTF-8 | 485 | 1.976563 | 2 | [] | no_license | package org.ng12306.ngsql.parser.ast.stmt;
import org.ng12306.ngsql.parser.ast.ASTNode;
/**
* @author <a href="mailto:wenjie.0617@gmail.com">wuwj</a>
*/
public interface SQLStatement extends ASTNode {
public static enum StmtType {
DML_SELECT,
DML_DELETE,
DML_INSERT,
DML_REPLACE,
... |
C++ | UTF-8 | 3,857 | 3.1875 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <climits>
#define TEMP 1000
using namespace std;
struct Point{
int x, y;
};
bool checkBounds(int x, int y, int xMin, int yMin, int xMax, int yMax){
return xMin <= x && xMax >= x && yMin <= y && yMax >= y;
}
double CalcPosteriorProb(int x,int y... |
C | UTF-8 | 708 | 2.546875 | 3 | [] | no_license | #include "fdf_bonus.h"
void arg_error(void)
{
ft_putstr_fd(ANSI_COLOR_GREEN, 2);
ft_putstr_fd("Usage: ./fdf <filename>.fdf\n", 2);
ft_putstr_fd(ANSI_UNSET_GREEN, 2);
exit(0);
}
void file_error(void)
{
ft_putstr_fd("./fdf : Error reading the map\n", 2);
exit(0);
}
void format_error(char *str)
{
free(str);
ft_... |
Python | UTF-8 | 1,855 | 3.40625 | 3 | [] | no_license | import heapq
from .field import Cell, Field
class PriorityQueue:
def __init__(self):
self.elements = []
def is_empty(self):
return len(self.elements) == 0
def put(self, item, priority):
heapq.heappush(self.elements, (priority, item))
def get(self):
return heapq.heap... |
C# | UTF-8 | 1,117 | 2.59375 | 3 | [] | no_license | using System;
using System.Threading.Tasks;
using BookLibrary.DAL.Models;
using BookLibrary.DAL.Repositories.InterfacesRepositories;
using Microsoft.Extensions.DependencyInjection;
namespace BookLibrary.DAL.UnitOfWork
{
public class UnitOfWork : IUnitOfWork
{
private readonly BookLibraryDbContext _con... |
Java | UTF-8 | 1,873 | 3.296875 | 3 | [] | no_license | package com.javarush.task.task36.task3602;
import java.lang.reflect.Modifier;
import java.util.Collections;
import java.util.List;
/*
Найти класс по описанию
*/
public class Solution {
public static void main(String[] args) {
System.out.println(getExpectedClass());
}
public static Class getExpec... |
Java | UTF-8 | 2,463 | 3.703125 | 4 | [
"MIT"
] | permissive | import java.math.BigInteger;
import java.util.Random;
import java.util.Scanner;
/**
* Class que mostra como criar threads até descobrir qual o limite
* do sistema operacional em um determinado computador para criar threads,
* de acordo com as condições atuais de sobrecarga de tal computador
* (quantidade de aplic... |
Markdown | UTF-8 | 1,025 | 2.6875 | 3 | [] | no_license | # Widget : Crud LIST
## Description
This widget intends to display a list with some content extracted from a CRUD module.
## Attributes
| Parameter | Type | Description |
|---------------|---------------|---------------|
| entityName | String | Name of the entity in the confiiguration files... |
C++ | UTF-8 | 560 | 3.21875 | 3 | [] | no_license | /*
* File Name: student.h
* Program Description: Polymorphism
* Course Name: Workshop in C++
* Assignment Number: 7
* Author: Abraham Murciano
*/
#ifndef student_h
#define student_h
#include <stdlib.h>
#include <string>
using namespace std;
class student {
protected:
// Data
int id;
string nam... |
C++ | UTF-8 | 1,617 | 3.796875 | 4 | [] | no_license | #include <iostream>
#include <string.h>
static const bool debug_mode = true;
/*
Time complexity: O(2)
void replace_char(char *input, unsigned int length)
{
O(1) unsigned int i = 0;
O(1) unsigned int j = 0;
O(n) for (i = 0; i < length; i++)
{
if (input[i] == ' ')
{
O(n) for (j = length; j >... |
TypeScript | UTF-8 | 4,313 | 2.59375 | 3 | [] | no_license | /*
* @Author: your name
* @Date: 2020-03-18 17:41:02
* @LastEditTime: 2020-03-18 17:41:02
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \devui-language-service\language-service\src\complier_metadata.ts
*/
import * as html from './ast';
import * as chars from './chars';... |
SQL | UTF-8 | 367 | 2.96875 | 3 | [
"MIT"
] | permissive | SELECT
ruledarea_level5.aname,
ageometry AS geometrie,
canton AS kanton,
organisation.aname AS betreiber
FROM
awa_stromversorgungssicherheit.supplyscy_rldreas_ruledarea_level5 AS ruledarea_level5
LEFT JOIN awa_stromversorgungssicherheit.supplyscy_rldreas_organisation AS organisation
ON org... |
Markdown | UTF-8 | 2,741 | 2.8125 | 3 | [] | no_license | # Problem
This website can be rendered only by picobrowser, go and catch the flag! [https://2019shell1.picoctf.com/problem/32205/](https://2019shell1.picoctf.com/problem/32205/) or http://2019shell1.picoctf.com:32205
## Hints:
You dont need to download a new web browser
## Solution:
We first try to observe the site:... |
JavaScript | UTF-8 | 1,847 | 2.671875 | 3 | [
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-ecma-no-patent"
] | permissive | // Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.findindex
description: >
Change values during predicate call
info: |
22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] )... |
Markdown | UTF-8 | 1,462 | 2.765625 | 3 | [] | no_license | PD4: czas na wykonanie 31-10-2018 do 7-11-2018
Na wykładzie trzecim omawialiśmy różne zagadnienia związane z percepcją i rolą kolorów na wykresie.
Zadanie: z poprzednich prac domowych PD1-PD3 wybrać pracę innego studenta a następnie pokazać dane z tej pracy domowe za pomocą dwóch wykresów:
A) Wykresu czarnobiałego, ... |
C | UTF-8 | 2,471 | 3.109375 | 3 | [] | no_license | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: ... |
Java | ISO-8859-1 | 4,310 | 3.5625 | 4 | [] | no_license | /**
A class calledImageis provided below. This class can be used to manage a two-dimensional array of pixels.
The basic class structure has been defined for you, with oneinstance variable:pixels,thatstores a set of
hexadecimal color values as a two-dimensional array of Strings, and several helper methods that manipula... |
Python | UTF-8 | 2,056 | 3.171875 | 3 | [] | no_license | # файл camp_cactus.py
import pygame
from cactus import cactus
from const import *
import random
# список врагов
def arr_image():
arr_enemy = [
{
"image": pygame.image.load('Objects/Cactus0.png'),
"height": 50,
"width": 69
},
{
"image": pygame... |
Python | UTF-8 | 7,547 | 3.859375 | 4 | [] | no_license | """
In search.py, you will implement generic search algorithms which are called by
Pacman agents (in searchAgents.py).
"""
import util
import sys
from time import sleep
from game import Directions
n = Directions.NORTH
s = Directions.SOUTH
e = Directions.EAST
w = Directions.WEST
class SearchProblem:
"""
Thi... |
Markdown | UTF-8 | 1,616 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | # ConnectionResponse
- **класс** `ConnectionResponse` (`php\jsoup\ConnectionResponse`)
- **исходники** `php/jsoup/ConnectionResponse.php`
**Описание**
Class ConnectionResponse
---
#### Методы
- `->`[`headers()`](#method-headers)
- `->`[`cookies()`](#method-cookies)
- `->`[`statusCode()`](#method-statuscode) - _Ge... |
Markdown | UTF-8 | 803 | 2.734375 | 3 | [] | no_license | ---
title: "Honest Security"
subtitle: "A guide to security that's collaborative, not adversarial."
version: "1.0"
tenets:
- "The values your organization stands behind **should be well-represented in your security program.**"
- "**A positive working relationship** between the end-user and the security team is incred... |
Python | UTF-8 | 13,041 | 3.515625 | 4 | [] | no_license | from ..classes import cable
from ..classes import district as dt
from ..algorithms import randomize
import copy, random
class Greedy(randomize.Random):
"""
This algorithm connects every house to the battery with the shortest
manhatten distance to the house that is available.
This algorithm does that... |
C | UTF-8 | 243 | 3.125 | 3 | [
"MIT"
] | permissive | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(void) {
float y, y2;
for (float i = 1; i <= 20; i += 1) {
y = exp(i);
}
for (float i = 1; i <= 20; i += 0.1) {
y2 = exp(i);
}
printf("%f %f", y, y2);
return 0;
}
|
Python | UTF-8 | 455 | 2.796875 | 3 | [] | no_license | #!/usr/bin/python
import sys
try:
from bcrypt import hashpw, gensalt
except ImportError:
print "[!] Error importing 'bcrypt': %s" % err
sys.exit()
DEFAULT_ROUNDS = 10
def main():
if len(sys.argv) < 2:
usage()
hashed_password = hashpw(sys.argv[1], gensalt(DEFAULT_ROUNDS))
print "%s" ... |
Python | UTF-8 | 659 | 3.15625 | 3 | [] | no_license | # Introduction of Pandas
# Dependency needed to install file
# !pip install xlrd
# Import required library
import pandas as pd
# Read data from CSV file
csv_path = 'https://s3-api.us-geo.objectstorage.softlayer.net/cf-courses-data/CognitiveClass/PY0101EN/Chapter%204/Datasets/TopSellingAlbums.csv'
df = pd.read_csv(cs... |
Python | UTF-8 | 290 | 3.125 | 3 | [] | no_license | import math
t = int(input())
while t!=0:
n,a,b = map(int, input().split(" "))
total = 0
numSilverPerQuest = a
if a > b:
numSilverPerQuest = math.floor(a/b) * a + (a % b)
min_num_quests = math.ceil(n/numSilverPerQuest)
print(min_num_quests)
t-= 1 |
Java | UTF-8 | 7,163 | 2.03125 | 2 | [] | no_license | package cn.wong.pojo;
import java.util.Date;
public class Kefudenglu {
private Integer id;
private String xingming;
private String shoujihaoma;
private String mima;
private Integer zhuangtai;
private String shenfenzheng;
private Date zuihoudenglu;
private Date zuihouqiandao;
privat... |
TypeScript | UTF-8 | 18,551 | 3 | 3 | [
"MIT"
] | permissive | // IMPORTACIONES
let assert = require("chai").assert;
let path = require("path");
let fs = require("fs");
let fsExtra = require("fs-extra");
let aut = require("../dist/aut/automation");
function remove(ruta) {
let bool = false;
try {
if (fs.existsSync(ruta)) { // Si exite el directorio lo... |
Swift | UTF-8 | 1,751 | 2.765625 | 3 | [] | no_license | import Common
import Firebase
import Foundation
import Framework_BabyPatterns
import Library
struct StorageFacade: Loggable {
let shouldPrintDebugLog = true
private let storageReference = Storage.storage().reference()
typealias DownloadResponseHandler = (_ data: Data?, _ error: Error?) -> Void
func u... |
C# | UTF-8 | 2,305 | 2.796875 | 3 | [] | no_license | using System;
using System.Linq;
using System.Collections.Generic;
using ViceCity.Models.Neghbourhoods.Contracts;
using ViceCity.Models.Players.Contracts;
namespace ViceCity.Models.Neghbourhoods
{
public class GangNeighbourhood : INeighbourhood
{
public void Action(IPlayer mainPlayer, ICollection<IPla... |
JavaScript | UTF-8 | 4,059 | 2.703125 | 3 | [
"MIT"
] | permissive | //insert ride actions here:
//how long to wait, request ride, add location,
//change location, fetch drivers(nearby),
//fetch drivers(all), add to previous rides(mc),
//add to previous rides(driver)
import axios from 'axios';
export const RIDE_ERROR = 'RIDE_ERROR';
export const HOW_LONG = 'HOW_LONG';
export const... |
Java | UTF-8 | 325 | 1.742188 | 2 | [] | no_license | package org.hillhouse.searchdb.models.diskDS;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Data
public class SSTableDataValue {
private List<SSTableDataValueItem> dataValueItem... |
Python | UTF-8 | 82 | 3.21875 | 3 | [] | no_license | letters = list(map(chr, range(97, 123)))
for letter in letters:
print(letter)
|
Java | UTF-8 | 1,234 | 2.0625 | 2 | [] | no_license | package com.gcit.lms;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.mongodb.MongoDbFactory;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.SimpleMongoDbFactory;
i... |
Rust | UTF-8 | 1,225 | 3.09375 | 3 | [
"MIT"
] | permissive | extern crate sitemap;
use sitemap::reader::{SiteMapReader,SiteMapEntity};
use std::fs::{File, write};
fn main() -> std::io::Result<()> {
let mut urls = Vec::new();
let mut sitemaps = Vec::new();
let mut errors = Vec::new();
let file = File::open("sitemap.xml").expect("Unable to open file.");
let p... |
Java | UHC | 671 | 3.078125 | 3 | [] | no_license | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
/*
* InputStream --> Reader --> Memory --> Writer --> OutputStream
*/
public class BridgeClassDemo {
public static void main(String[] args) throws IOException {
System.out.println(" ... |
Markdown | UTF-8 | 1,405 | 3.28125 | 3 | [] | no_license | # 《设计模式的艺术》第1章学习笔记
参考CSDN博客:[史上最全设计模式导学目录](https://blog.csdn.net/LoveLion/article/details/17517213)
## 第1章 从招式与内功谈起——设计模式概述
1. 模式的定义:模式是在特定环境下人们解决某类重复出现问题的一套成功或有效的解决方案。
2. 最早将模式的思想引入软件工程方法学的是1991-1992年以“四人组(Gang of Four,简称GoF,分别是Erich Gamma, Richard Helm, Ralph Johnson和John Vlissides)”自称的四位著名软件工程学者,他们在1994年归纳发表了23种... |
Markdown | UTF-8 | 5,079 | 2.8125 | 3 | [] | no_license | Unit 8: Group Milestone - README Example
===
# ReminderApp
## Table of Contents
1. [Overview](#Overview)
1. [Product Spec](#Product-Spec)
1. [Wireframes](#Wireframes)
## Overview
### Description
Scheduling Application that motivates people who have similar goals and interests to connect, learn, and progress togeth... |
Markdown | UTF-8 | 2,249 | 2.796875 | 3 | [] | no_license | # Nina van Gorkom

*International Standard Name Identifier (ISNI):* 0000 0000 6398 0326
## Biography
Nina van Gorkom was born in 1928 to a family of socialist intellectuals. Her father was a member of the Dutch parliament. She studied at Leyden University and d... |
Java | UTF-8 | 6,587 | 2.078125 | 2 | [
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference",
"MIT",
"LicenseRef-scancode-unknown"
] | 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 ... |
Java | UTF-8 | 545 | 3.75 | 4 | [] | no_license | public class Guessing {
public static void main(String[] args) {
for (int x = 1; x <= 35; x++) {
int guess = x;
if (guess < 20) {
System.out.println("You lose, try again!");
} else if (guess <= 29) {
System.out.println("You are getting closer!");
} else if (gu... |
Python | UTF-8 | 1,467 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | from base.base_train import BaseTrain
from tqdm import tqdm
import numpy as np
import matplotlib.pyplot as plt
class ExampleTrainer(BaseTrain):
def __init__(self, sess, model, data, config,logger, **kwargs):
super().__init__(sess, model, data, config,logger, **kwargs)
def train_epoch(self):
l... |
Python | UTF-8 | 1,709 | 2.6875 | 3 | [] | no_license |
from flask import Flask, request, render_template
import pickle
import numpy as np
import pandas as pd
import random
import sklearn
app = Flask(__name__, template_folder='template')
model = pickle.load(open('model.pkl', 'rb'))
@app.route('/')
def home():
return render_template('index.html... |
Shell | UTF-8 | 2,231 | 4.0625 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env bash
if [ "$1" == "--version" ]; then
echo "3.1.0"
exit 0;
fi
if [ "$1" == "--help" ]; then
echo "eslintme [options] [file.js]
Options:
--help Show this help menu
--version Prints version number"
exit 0;
fi
# figures out the path to eslint_d executable
function findeslintd() {
source="${B... |
JavaScript | UTF-8 | 2,023 | 2.859375 | 3 | [] | no_license | function handlePaddleCollision() {
if (
collideRectCircle(
paddle.x,
paddle.y,
paddle.w,
paddle.h,
ball.pos.x,
ball.pos.y,
ball.rad
)
) {
ball.velocity.y *= -1;
}
}
function handleBlockCollision() {
blocks = blocks
.map(block => {
if (
col... |
Java | UTF-8 | 2,205 | 2.21875 | 2 | [] | no_license | package com.synway.blogserver.service;
import com.synway.blogserver.dao.TypeDao;
import com.synway.blogserver.dao.mapper.TypeMapper;
import com.synway.blogserver.domain.Type;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dat... |
Java | UTF-8 | 982 | 2.796875 | 3 | [] | no_license | package net.intelie.challenges;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
public class EventTest {
@Test
public void thisIsAWarning() throws Exception {
Event event = new Event("some_type", 123L);
//THIS IS A WARNING:
... |
Python | UTF-8 | 1,938 | 2.90625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import h5py
from scipy.integrate import simps
def calculate_ring_integral():
with h5py.File("data.hdf5", "r") as f:
nx = f.attrs['XN']
ny = f.attrs['YN']
nz = f.attrs['ZN']
X = f['X']
Y = f['Y']
Z = f['Z']
ps... |
Java | UTF-8 | 689 | 2.671875 | 3 | [] | no_license | package com.capgemini.JDBC.controller;
import java.util.Scanner;
import com.capgemini.JDBC.beans.UserBean;
import com.capgemini.JDBC.dao.UserDAO;
import com.capgemini.JDBC.factory.UserFactory;
public class UserLogin {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
UserDAO dao ... |
C++ | UTF-8 | 1,267 | 2.828125 | 3 | [] | no_license | #include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
const int GreenLed = 10;
const int YellowLed = 9;
const int RedLed = 8;
int state = 0; // State 0 - Red only, State 1 - Red Yellow, State 2 - Green
// State 3 - Yellow
int light_delay[] = { 2500, 2500, 2500, 2500 };
voi... |
PHP | UTF-8 | 1,434 | 2.953125 | 3 | [] | no_license | <?php
$db = new PDO("mysql:host=localhost;dbname=login", "root", "");
if (isset($_POST['login'])) {
session_start();
$username = $_POST['username'];
$password = $_POST['password'];
$sql = "SELECT * FROM users WHERE username = ? AND password = ?";
$prepare = $db->prepare... |
C | UTF-8 | 715 | 4.375 | 4 | [] | no_license | #include<stdio.h>
main()
{
/*
You already know about the for and while loops but they are entry control loops.
do-while loop is an exit control loop i.e. the condition is checked towards the end of the loop.
Thus no matter if the condition is true or false, the loop will execute atleast once.
... |
Java | UTF-8 | 1,738 | 2.1875 | 2 | [] | no_license | package me.impdevmc.antipridefall;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
import org.bukkit.event.player.AsyncPlayerPreLoginEvent.Result;
import org.bukkit.plugin.java.JavaPl... |
Python | UTF-8 | 7,495 | 3.703125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Script para criação de um dataset de enunciados com as características (monogramas e bigramas)
já extraídas e valores das categorias já convertidos em códigos.
O script só precisa ser executado uma vez, portanto não se deu atenção especial à eficiência.
É preciso fazer o donwload dos segui... |
PHP | UTF-8 | 1,707 | 3.421875 | 3 | [] | no_license | <?php
class RPS {
public $HANDS = array();
private $_playerhand = 0;
private $_computerhand = 0;
public function __construct($rock = 'Rock', $paper = 'Paper', $scissor = 'Scissor') {
$this->HANDS[0] = $rock;
$this->HANDS[1] = $paper;
$this->HANDS[2] = $scissor;
}
public function setPlayerHand($hand) {
... |
Markdown | UTF-8 | 2,780 | 3.078125 | 3 | [] | no_license | # Exercicios-JS
Exercícios Feitos com Javascript, com a intenção de exercitar todos os conteúdos aprendidos. E assim por a mão na massa pois todos sabemos que a melhor forma de aprender é praticar
<br>
## Projetos
<details>
<summary>IMC</summary>
<p> Neste mini projeto foi possível exercitar manipulação de ele... |
C# | UTF-8 | 312 | 2.640625 | 3 | [] | no_license | namespace MVVMPatternInUWP.Core.Interfaces.Calculating
{
public interface ICalculator
{
int Add(int firstValue, int secondValue);
int Sum(int firstValue, int secondValue);
int Mul(int firstValue, int secondValue);
double Div(int firstValue, int secondValue);
}
} |
Java | UTF-8 | 706 | 2.34375 | 2 | [] | no_license | package com.springbootcamp.springsecurity.co;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.FieldDefaults;
import javax.validation.constraints.NotNull;
@Getter
@Setter
@FieldDef... |
PHP | UTF-8 | 3,396 | 2.59375 | 3 | [] | no_license | <?php
namespace App\Controller;
use App\Entity\Accessoire;
use App\Repository\AccessoireRepository;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractContro... |
Python | UTF-8 | 3,911 | 4.375 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
MeetUp 039 - Beginners Python Support Sessions - Wed 04 Dec 2019 - collection types
Repeat of Meetup026
Wednesday sessions are absolute beginner sessions
Learning objectives:
Data types: int float str list tuple dict set
Structure: def if for
@author D Tim C... |
SQL | UTF-8 | 1,356 | 3.546875 | 4 | [] | no_license | -- start standalone
create table restaurant (
id bigint(20) PRIMARY KEY,
name varchar(500) NOT NULL,
cuisines varchar(500) NOT NULL,
cost decimal(6,2) NOT NULL,
currency_name varchar(100) NOT NULL,
currency_symbol varchar(10) NOT NULL,
has_table_booking tinyint(1) NOT NULL,
has_online_d... |
Java | UTF-8 | 2,065 | 1.601563 | 2 | [] | no_license | package com.gwssi.eoms.model.domain.produce.common;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 通知书描述表
* Created by admin on 2017/10/24.
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class GgWjTzsmsb {
private Double rid; // 主键
private String zhuti... |
Markdown | UTF-8 | 1,129 | 2.515625 | 3 | [] | no_license | # Frontend Setup
> Instructions to install dependencies and run frontend development environment.
### Directory
.
├── create-react-app # For installing dependencies, you can delete after install
└── frontend # Actual development environment
├── other files... # Stores App... |
Python | UTF-8 | 3,146 | 3 | 3 | [] | no_license | #!/usr/bin/env python3.6
from sys import argv
from json import load
import numpy as np
import pandas as pd
def cal_cpt(train, feature, features, N):
"""Calculate conditional probability P(X|Y)
"""
n = len(features[feature])
cpt = train.groupby([feature,'class']).size()
for val in features[feature]:... |
Python | UTF-8 | 1,743 | 3.0625 | 3 | [] | no_license | def start():
import main
from main import pygame, gui, width, height, buttonFont, mouse, titleFont, posText, spacebg
green = (0, 255, 0)
dark_green= (0, 200, 0)
blue = (0, 0, 128)
gui.fill((0, 0, 0))
spacebg()
startTitle = titleFont.render("Galactic Survival: Among You", True, gree... |
Java | UTF-8 | 816 | 1.984375 | 2 | [] | no_license | package com.xlz.gray.model;
import com.xlz.commons.base.model.BaseDomain;
import com.xlz.engine.common.config.Level;
public class ApplicationWhitelist extends BaseDomain {
/**
*
*/
private static final long serialVersionUID = 1L;
/** 1为用户号,2为用户名,3为电话号码 */
private Integer whiteListId;
/** 服务或者系统id */
pri... |
C++ | UTF-8 | 1,302 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | #pragma once
#include <QAbstractTableModel>
#include <unordered_map>
namespace app
{
class AssemblyViewModel final : public QAbstractTableModel {
Q_OBJECT
public:
enum class RowType {
Label,
Code,
};
struct Row {
RowType type;
uint32_t address;
QString raw{};
... |
Swift | UTF-8 | 3,697 | 2.734375 | 3 | [] | no_license | //
// ViewController.swift
// tinderClone
//
// Created by Wilson on 2017-02-07.
// Copyright © 2017 com.Wilson. All rights reserved.
//
import UIKit
import CoreData
var currentUser = ""
class ViewController: UIViewController {
@IBOutlet weak var usenameField: UITextField!
@IBOutlet weak var passwordFie... |
Java | UTF-8 | 1,237 | 1.992188 | 2 | [] | no_license | package com.acorn.shoopse.agency.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.s... |
C# | UTF-8 | 2,434 | 2.828125 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using Oracle.DataAccess.Client;
/// <summary>
/// Summary description for OracleConnect
/// </summary>
public class OracleConnect
{
string connectionString;
private OracleConnection connection;
private ... |
Go | UTF-8 | 686 | 3.234375 | 3 | [] | no_license | package maps
import (
"bufio"
"fmt"
"os"
"strings"
)
func WordFreq(input string) map[string]int {
scanner := bufio.NewScanner(strings.NewReader(input))
scanner.Split(bufio.ScanWords)
wordsFreq := make(map[string]int)
for scanner.Scan() {
word := scanner.Text()
wordsFreq[word]++
}
return wordsFreq
}
fun... |
Shell | UTF-8 | 613 | 2.640625 | 3 | [] | no_license | #!/bin/bash
##locahost YUM Repository
##zuozhe cj
##time 20180411
YUM="/application/yum/centos6.6/x86_64/"
mkdir -p $YUM
cd $YUM
##将已经下载好的rpm包放进$YUM目录下
##
yum -y install createrepo
createrepo -pdo /application/yum/centos6.6/x86_64/ /application/yum/centos6.6/x86_64/
##
cd $YUM
python -m SimpleHTTPServer 80 &>/dev/null ... |
TypeScript | UTF-8 | 1,208 | 3.421875 | 3 | [] | no_license | /**
* Injeta um elemento do DOM em uma propriedade.
*
* @param seletor um seletor CSS: id, class.
*
* @returns o elemento a ser injetado.
*/
export function domInjector(seletor: string) {
/**
* Decorator que injeta um elemento do DOM em uma propriedade.
*
* @param target - Em propriedades e... |
Swift | UTF-8 | 579 | 2.8125 | 3 | [] | no_license | //
// DateExtensions.swift
// TandemForecast
//
// Created by Daniel Tombor on 2018. 02. 25..
// Copyright © 2018. danieltmbr. All rights reserved.
//
import Foundation
extension Date {
var localizedDay: String {
let formatter = DateFormatter()
formatter.dateStyle = .medium
formatter.... |
Java | UTF-8 | 1,943 | 1.804688 | 2 | [
"Apache-2.0"
] | permissive | /***
* Copyright (c) 2009 Caelum - www.caelum.com.br/opensource - guilherme.silveira@caelum.com.br
* All rights reserved.
*
* 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://w... |
JavaScript | UTF-8 | 1,187 | 2.71875 | 3 | [] | no_license | /**
* https://randomuser.me/api/?results=4
*/
import React from "react";
const Idol = (props) => {
return (
<div style={styles.container}>
<img src={props.imageUrl} alt={props.name} />
<div style={styles.info}>
<div>Name: {props.name}</div>
<div>Gender: {props.gender}</div>
... |
Java | UTF-8 | 3,450 | 2.578125 | 3 | [] | no_license | package webdriver;
import static org.testng.Assert.assertEquals;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotatio... |
Python | UTF-8 | 1,892 | 2.59375 | 3 | [] | no_license | ###Import the correct python libraries
from sqlalchemy import Boolean, Column, ForeignKey, Integer, String
from sqlalchemy.orm import relationship
from .database import Base
class Detroit(Base):
__tablename__ = "detroit"
###Primary Key is required for the table to populate
Year = Column(Integer, ... |
C++ | UTF-8 | 1,907 | 3.265625 | 3 | [] | no_license | // Assignment 1 - Algorithm 2 (Knuth)
// Tidy Tree Drawing
// Ensure parent is centered around children
// But ignores that tree should occupy minimum width
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string.h>
#include "treedraw.h"
using namespace std;
//Coordinate assignment according to Alg... |
Python | UTF-8 | 1,470 | 3.0625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue May 26 03:19:31 2020
@author: thequietprogrammer
"""
import os, sys
if not os.path.exists('aNames'):
os.mkdir('aNames')
for i in range(164):
# Desse jeito, vamos direto ao arquivo bruto original.
aOld = "../raw.en/englishText_"+str(i*10000)+"_"+str(10000*(... |
JavaScript | UTF-8 | 1,153 | 2.609375 | 3 | [] | no_license | require('dotenv').config();
var sensor = require("node-dht-sensor");
const mongoose=require('mongoose');
const db=process.env.db;
const connect = mongoose
.connect(db, { useFindAndModify: false,useUnifiedTopology:true,useNewUrlParser:true })
.then(() => {
console.log("Mondo db connected....");
})
.catch((err) => c... |
C# | UTF-8 | 8,841 | 3.140625 | 3 | [
"MIT"
] | permissive | using System;
namespace SshNet.Security.Cryptography
{
internal abstract class HashProviderBase : IHashProvider
{
private bool _disposed;
private byte[] _hashValue;
/// <summary>
/// Gets the value of the computed hash code.
/// </summary>
/// <value>
/... |
Swift | UTF-8 | 2,371 | 2.609375 | 3 | [] | no_license | //
// DescribeMissionViewController.swift
// PostMishone
//
// Created by Victor Liang on 2018-10-14.
// Copyright © 2018 Victor Liang. All rights reserved.
//
import UIKit
import Firebase
import MapKit
import CoreLocation
class DescribeMissionViewController: UIViewController {
var ref: DatabaseReference!
... |
C++ | UTF-8 | 5,487 | 2.8125 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;
int pbc_round(double input)
{
int i = input;
if (abs(input - i) >= 0.5)
{
if (input > 0) {i += 1;}
if (input < 0) {i -= 1;}
}
return i;
}
double min_distance(double array[],... |
Python | UTF-8 | 2,410 | 2.609375 | 3 | [] | no_license | from django.shortcuts import render, HttpResponse, redirect
import random
import datetime
#from flask import Flask, render_template, request, redirect, request.session
#app.yourgold = 0
def generate_gold(request, loc):
newgold = 0
winlose = 0
if loc == "farm":
newgold = random.randrange(10,21)
... |
C# | UTF-8 | 7,970 | 2.515625 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Common.Logging;
namespace RobotBlocks.Implementation.SQLServer
{
public class DatabaseGenerator : RobotBlocks.Interfaces.IDatabaseGenerator
{
private static Common.Logging.ILog LOG = Utili... |
C# | UTF-8 | 4,053 | 3.21875 | 3 | [
"MIT"
] | permissive | using System;
using System.Globalization;
using System.IO;
using System.Threading;
using CoenM.ImageHash;
using CoenM.ImageHash.HashAlgorithms;
namespace ImageHashConsoleApplication
{
class Program
{
static Semaphore sem = new(25, 25);
static void Main(string[] args)
{
if ... |
Ruby | UTF-8 | 473 | 2.6875 | 3 | [] | no_license | require 'spec_helper'
RSpec.describe 'Composing Matchers' do
class SomeObject
attr_reader :amount
def initialize(amount)
@amount = amount
end
def *(factor)
@amount *= factor
end
end
describe SomeObject do
let(:instance) { SomeObject.new(1.0) }
describe '#*' do
su... |
Java | UTF-8 | 1,306 | 3.21875 | 3 | [] | no_license | public class RomanToArabian {
static String[] Rome = {"M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"};
static int[] Arab = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1};
public static int romeToArab(String rome){
StringBuffer romeNumber = new... |
Markdown | UTF-8 | 427 | 3.9375 | 4 | [
"MIT"
] | permissive | # Math.sign()
The **`sign()`** method returns the `integer` part of a `number` by removing any fractional digits.
## Syntax
```js
const integer = Math.sign(number);
```
## Usage examples
```js
Math.sign(13.37); // -> 13
Math.sign(42.84); // -> 42
Math.sign(0.123); // -> 0
Math.sign(-0.123); // -> -0
```
---
[... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.