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 |
|---|---|---|---|---|---|---|---|
C# | UTF-8 | 849 | 3.59375 | 4 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
public class CoolFunctions
{
public int iterfactorial(int n)
{
int response = 1;
int answer = 1;
Console.Write... |
Markdown | UTF-8 | 3,985 | 2.765625 | 3 | [
"MIT"
] | permissive | ###Validation
[](https://codeclimate.com/github/Resize/Validation)
[](https://codeclimate.com/github/Resize/Validation)
An extensive pack of customizabl... |
Python | UTF-8 | 1,422 | 2.515625 | 3 | [] | no_license | #!/usr/bin/env python
"""\
Flask S3 Example
"""
import sha
import hmac
from uuid import uuid4
from json import dumps
from base64 import b64encode
from datetime import datetime, timedelta
from flask import Flask, render_template, request, jsonify
# Flask application
app = Flask(__name__)
app.config.from_pyfile('confi... |
Python | UTF-8 | 3,597 | 3.5 | 4 | [] | no_license | """
A simple module for sending/receiving data via serial (USB) to the board.
"""
import pdb
import time
import json
## Note:
# The following article can be referenced to help JSON serialize a custom class:
# https://medium.com/python-pandemonium/json-the-python-way-91aac95d4041
def char_sum(s):
return sum(b... |
C++ | UTF-8 | 2,587 | 2.59375 | 3 | [] | no_license |
#ifndef CARCORE_H
#define CARCORE_H
#include <Servo.h>
#include "Arduino.h"
#include <stdint.h>
#include <math.h>
#include "PID.h"
/*****Defines******/
#define END 0
#define Obstacle 1
#define Drive 2
#define turnRight 0
#define turnLeft 1
#define noTurn 2
#define CRUISE_SPEED 1400
#define MIN_SPEED 1450
#define M... |
Markdown | UTF-8 | 5,837 | 3.5625 | 4 | [] | no_license | # 解释器模式
## 需求
通过解释器模式来实现四则运算,如计算 `a+b-c` 的值,具体要求
1. 输入表达式的形式,比如 `a+b+c-d+e`,要求表达式的字母不能重复
2. 再分别输入 `a ,b, c, d, e` 的值
3. 最后求出结果:如图

## 传统解决方案
1. 编写一个方法,接收表达式的形式,然后根据用户输入的数值进行解析,得到结果
2. 问题分析:如果加入新的运算符,比如 * / ( 等等,不利于扩展,另外让一个方法来解析会造成程序结构混乱, 不够清晰.
3. 解决方案:可以考虑使用解释器模式, 即: `表达式 ... |
C# | UTF-8 | 1,413 | 2.625 | 3 | [
"MIT"
] | permissive | /*
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
namespace HTLib2.Bioinfo
{
public partial class Pdb
{
public class Residue
{
public string resName = "";
public int resSeq = -1;... |
Python | UTF-8 | 434 | 4.21875 | 4 | [] | no_license | '''
Accept number of rows and number of columns from user and display below pattern.
input: iRow = 3 iCol=4
output:
1 1 1 1 1
2 2 2 2 2
3 3 3 3 3
'''
def patternc(iRow, iCol):
for i in range(iRow):
for j in range(iCol):
print(i+1,end=" ");
print();
def main():
irow = int(input("Enter... |
Markdown | UTF-8 | 2,962 | 3.703125 | 4 | [] | no_license | # 실행 컨텍스트 생성 과정
<br>
- [실행 컨텍스트 생성 과정](#실행-컨텍스트-생성-과정)
- [예제](#예제)
- [1 활성 객체 생성](#1-활성-객체-생성)
- [2 arguments 객체 생성](#2-arguments-객체-생성)
- [3 스코프 정보 생성](#3-스코프-정보-생성)
- [4 변수 생성](#4-변수-생성)
- [5 this 바인딩](#5-this-바인딩)
- [6 코드 실행](#6-코드-실행)
<br>
## 예제
아래 예제를 통해 생성 과정을 알아본다.
```js
function execute(param1... |
Java | UTF-8 | 2,282 | 2.28125 | 2 | [] | no_license | package glory.controller;
import glory.entity.Chat;
import glory.entity.User;
import glory.service.ChatService;
import glory.service.impl.ChatServiceImpl;
import glory.util.ResponseJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springf... |
C | UTF-8 | 257 | 3.484375 | 3 | [] | no_license | struct ListNode* reverseList(struct ListNode* head) {
if (head == NULL || head->next == NULL)
return head;
struct ListNode *ptr = head;
head = reverseList(ptr->next);
ptr->next->next = ptr;
ptr->next = NULL;
return head;
}
|
Java | UTF-8 | 10,694 | 1.851563 | 2 | [] | no_license | package com.alokomkar.rxmoviedb.moviedetails;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.widget.NestedScrollView;
import android.supp... |
Shell | UTF-8 | 2,539 | 3.15625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env bash
set -x
set -e
set -o pipefail
sudo apt-get install -y axel time
echo "Downloading misc tools"
sudo rm -f /etc/apt/sources.list.d/cassandra.sources.list
echo "deb http://debian.datastax.com/community stable main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list
curl -L http://debian.datas... |
SQL | UTF-8 | 2,506 | 3.203125 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.8.3
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: 15-Abr-2019 às 02:10
-- Versão do servidor: 5.7.21-log
-- versão do PHP: 7.2.9
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CH... |
Java | UTF-8 | 774 | 1.945313 | 2 | [] | no_license | /**
*
*/
package com.jv.web.controller;
import java.util.Locale;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import com.jv.... |
C# | UTF-8 | 2,204 | 2.53125 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using Arash.Membership.Model;
using Arash.Utility.Common;
using Paradiso.Infrastructure.Data;
using Arash.Infrastructure.Data;
namespace Arash.Core.Manager
{
public class MemberManager : IMemberManager
{
private IRepository<Member> _repository... |
Java | UTF-8 | 5,338 | 2.0625 | 2 | [] | no_license | package com.dreamdigitizers.megamelodies.views.classes.fragments.screens;
import android.support.v4.media.MediaBrowserCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import com.dreamdigitizers.androidbaselibrary.views.classes.frag... |
Go | UTF-8 | 281 | 2.875 | 3 | [] | no_license | package core
import "strings"
// 功能:返回没有以符号 - 开头的参数
func excludeOptions(args []string) []string {
ret := make([]string, 0, len(args))
for i := range args {
if !strings.HasPrefix(args[i], "-") {
ret = append(ret, args[i])
}
}
return ret
}
|
PHP | UTF-8 | 2,632 | 2.53125 | 3 | [] | no_license | <?php
namespace Tests\Feature;
use Task_Manager\User;
use Tests\TestCase;
use Illuminate\Support\Facades\Hash;
class UserTest extends TestCase
{
protected $user;
protected $password;
protected $userData;
public function setUp(): void
{
parent::setUp();
$this->password = 'Very se... |
JavaScript | UTF-8 | 1,253 | 3.0625 | 3 | [] | no_license |
function setup(){
createCanvas(400,400);
}
function draw(){
if(mouseIsPressed==true){
background(186, 202, 245,1);
let red = color(255,0,0);
let green = color(0,255,0);
let blue = color(0,0,255);
let black = color(0,0,0);
let white = color(255,255,255);
let yellow = color(255,255,0)... |
Markdown | UTF-8 | 2,774 | 3.640625 | 4 | [
"BSD-3-Clause"
] | permissive | # "Smart Filter" Algorithm
The "Smart Filter" dialog implements a partial assignments algorithm for finding possible filters that can be applied in order to find "interesting" variables.
Informally, the function tries to find variable assignments that cause all other variables to either become dont care variables, or ... |
Swift | UTF-8 | 1,636 | 3.375 | 3 | [] | no_license | //
// Created by Erik Little on 4/5/18.
//
import Foundation
import Kit
/// The point of a game of Builders is for players to construct the best hotel in Pottersville.
///
/// This represents the hotel that the player is building.
///
/// A `Hotel` consists of a number floors. Each floor must have TODO number of card... |
PHP | UTF-8 | 3,224 | 2.5625 | 3 | [] | no_license | <?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\PayementRepository")
*/
class Payement
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length... |
C# | UTF-8 | 1,007 | 2.625 | 3 | [
"MIT"
] | permissive | /* Copyright (c) 2017 ExT (V.Sigalkin) */
using System;
namespace extOSC.Core.Packers
{
public class OSCPackerFloat : OSCPacker<float>
{
#region Public Methods
public override OSCValueType GetPackerType()
{
return OSCValueType.Float;
}
#endregion
... |
Python | UTF-8 | 1,601 | 3.25 | 3 | [] | no_license | import collections
import numpy as np
from typing import List
# Runtime: 32 ms, faster than 93.80% of Python3 online submissions for Find And Replace in String.
# Memory Usage: 14.1 MB, less than 5.06% of Python3 online submissions for Find And Replace in String.
class Solution:
def findReplaceString(self, S: st... |
Shell | UTF-8 | 1,037 | 2.90625 | 3 | [] | no_license | #!@shell@
systemConfig=@systemConfig@
export PATH=@path@/bin/
# Print a greeting.
echo
echo -e "\e[1;32m<<< vpsAdminOS Stage 2 >>>\e[0m"
echo
mkdir -p /proc /sys /dev /tmp /var/log /etc /root /run /nix/var/nix/gcroots
mount -t proc proc /proc
if [ @procHidePid@ ]; then
mount -o remount,rw,hidepid=2 /proc
fi
mount ... |
C++ | UTF-8 | 5,557 | 2.796875 | 3 | [] | no_license | /*
* Robot Navigation Program
* www.robotnav.com
*
* (C) Copyright 2010 - 2014 Lauro Ojeda
*
* 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 3 of the License, or
* (at yo... |
Ruby | UTF-8 | 520 | 2.609375 | 3 | [
"MIT"
] | permissive | class EslintJunitFailure
attr_accessor :line, :severity, :message, :file_path
def initialize(failure:, path: Dir.pwd)
self.file_path = failure.parent.parent.attributes['name'].value.gsub("#{path}/", '')
self.message = failure.attributes['message'].value
failure_text_match = failure_text_regex.match(fai... |
JavaScript | UTF-8 | 17,104 | 2.9375 | 3 | [] | no_license |
window.onload = function(){
//Botones formulario:
btnCancelar = document.getElementById('cancelar');
btnGuardar = document.getElementById('guardar');
btnGestion = document.getElementById('gestion');
//Botones clientes:
btnBaja = document.getElementById("borrarCliente");
//Funci... |
Python | UTF-8 | 2,675 | 3.375 | 3 | [] | no_license | """Casting strategy"""
import spell_data as sd
class CastingStrategy:
"""
Basic implementation of a casting strategy.
Picks a spell and a target to cast it on.
"""
def __init__(self, talents):
self.talents = talents
self.name = "Basic Strategy"
def pick_spell(self, deficit,... |
Java | UTF-8 | 667 | 1.90625 | 2 | [] | no_license | package com.appzoneltd.lastmile.microservice.manualdistribution.dao;
import java.util.List;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
import com.appzoneltd.lastmile.microservice.manualdistri... |
Python | UTF-8 | 545 | 3.296875 | 3 | [
"MIT"
] | permissive | #Import statements
from tkinter import*
#Create root window
mw = Tk()
mw.geometry("300x300")
#Create Radio Button
rb1 = Radiobutton(mw,text = "C")
rb2 = Radiobutton(mw,text = "C++")
rb3 = Radiobutton(mw,text = "Java")
rb4 = Radiobutton(mw,text = "Python")
rb5 = Radiobutton(mw,text = "Perl")
rb1.grid(ro... |
Java | UTF-8 | 2,360 | 3.078125 | 3 | [] | no_license | package com.ym.utils.util;
import java.util.ArrayList;
import java.util.List;
/**
* Description: 微信砍价工具
*
* @author : 唐夏联
* @date : 2018年11月19日
* Company : 上海煜墨信息科技有限公司
* Copyright : Copyright (c) 2018
* @version : 1.0 Modified by 唐夏联 at 2018年11月19日
*/
public class WXBargainUtils {
/**
* ... |
JavaScript | UTF-8 | 857 | 2.734375 | 3 | [
"MIT"
] | permissive | import home from './home';
import menu from './menu';
import contact from './contact';
const nav = () => {
const navbar = document.querySelector('#navbar');
const main = document.querySelector('#content');
const navigation = document.createElement('ul');
navigation.classList.add('list');
navbar.appendChild(... |
SQL | UTF-8 | 637 | 2.859375 | 3 | [] | no_license | set echo off
set feedback on
set verify on
set heading on
/* start C:\Users\evana\Desktop\IS480\practices\outter_join_practice\tables.sql */
drop table loan;
drop table customers;
create table loan(
loanNo varchar2(2),
branch varchar2(2),
amt number(6,2),
primary key(loanNo,branch));
create table customers(
c... |
PHP | UTF-8 | 245 | 3.4375 | 3 | [] | no_license | <?php
$a = 2;
$b = 3;
if ($a < $b):
echo "Zmienna \$a jest mniejsza od \$b";
elseif($a > $b):
echo "Zmienna \$a jest większa od \$b";
else:
echo "Zmienna \$a jest równa \$b";
endif;
?> |
Python | UTF-8 | 567 | 2.71875 | 3 | [] | no_license | import base64
vals = [0xA884DF8AB2FBC902, 0xE0D28ACBFB46461A, 0x6178F0BE4CD508AC, 0x603AD81291B66724, 0xDE5CDDE19279A148, 0x70E60361F80E8EB4]
to_xor = [0xD8BDEEE9C2938E66, 0xD598D291C97F7779, 0x0D32C3E736983BF4, 0x0C428F73FC8F2140, 0xA419A7AFE834F505, 0x4DAB6D008D6DF4F9]
def xor(a,b):
c = 0
for i in range(8):
tmp... |
Python | UTF-8 | 1,193 | 2.828125 | 3 | [] | no_license | from math import *
import numpy as np
from matrix import matrix
from parametricObject import parametricObject
class parametricTorus(parametricObject):
def __init__(self, T=matrix(np.identity(4)), innerRadius=10.0, outerRadius=5.0, color=(255, 255, 255),
reflectance=(0.2, 0.4, 0.4, 1.0),... |
C# | UTF-8 | 394 | 2.578125 | 3 | [
"MIT"
] | permissive | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace BrainFxxkInterpreter
{
public class StdIO : IO
{
public int Read()
{
return Console.ReadKey().KeyChar;
}
public void Write(... |
Java | UTF-8 | 729 | 2.953125 | 3 | [] | no_license | package org.coding.sort;
import java.util.Iterator;
public class SortPage implements Iterator<Row> {
private int allowedPageSize;
private RowBatch rowBatch;
private int addedSize;
public SortPage(int pageSize) {
this.allowedPageSize = (pageSize * 95) / 100;
this.rowBatch = new RowBatch();
}
publ... |
TypeScript | UTF-8 | 2,739 | 3.265625 | 3 | [
"MIT"
] | permissive | type Controller = StructureController;
interface SignDefinition {
username: string;
text: string;
time: number,
datetime: Date;
}
/**
* Claim this structure to take control over the room. The controller structure
* cannot be damaged or destroyed. It can be addressed by `Room.controller`
* property.... |
C | UTF-8 | 2,917 | 4.0625 | 4 | [] | no_license | #include<stdio.h>
#include<stdlib.h>
#define SIZE 5
int next=0;
void take(int *);
void insertatend(int *,int);
void insertatbeg(int *,int);
void insertatpos(int *,int,int);
void display(int *);
void deleteatend(int* );
void deleteatbeg(int *);
void deleteatpos(int *,int);
void deleteatpos(int *,int);
void reverse_dis... |
C | GB18030 | 2,717 | 2.5625 | 3 | [] | no_license | #include "uart2.h"
#include "msg.h"
UART4_MSG_S g_stUart2Msg;
/*ӵPC10 PC11ӿڣUART4
dzʼصUSART*/
void UART2_Configuration(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
USART_InitTypeDef USART_InitStructure;
NVIC_InitTypeDef NVIC_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE );
... |
Swift | UTF-8 | 8,276 | 3.203125 | 3 | [] | no_license | //
// ContentView.swift
// My BMI
//
// Created by Joshua on 2021-03-23.
//
import SwiftUI
struct BMIView: View {
@State var bmi = BMICalculator(height: 0.0, weight: 0.0)
@State var isHeightMetric = true
@State var isWeightMetric = true
@State var isPopoverPresented = false
@State var isCh... |
Python | UTF-8 | 2,541 | 3.484375 | 3 | [] | no_license | class linearQueue:
def __init__(self,size,init=None):
self.size=size
self.init=init
self.front=-1
self.rear=-1
self.storage=[init]*self.size
def enQueue(self,item):
if not self.isFull():
self.rear+=1
self.storage[self.rear]=item
el... |
PHP | UTF-8 | 1,050 | 2.828125 | 3 | [] | no_license | <?php namespace MailTracker;
class Service {
/**
* Database instance.
*
* @var MailTracker\DatabaseInterface
*/
protected $db;
/**
* Construct a new service.
*
* @access public
* @param DatabaseInterface $db
* @return void
*/
public function __construct(DatabaseInterface $db)
{
$this->... |
PHP | UTF-8 | 1,933 | 3.09375 | 3 | [] | no_license | <?php
// process input variables
if (isset($_REQUEST['plist'])) {
if (strip_tags($_REQUEST['plist']) == 1) {
$page = 1;
$title = 'Page 1';
} else if (strip_tags($_REQUEST['plist']) == 2) {
$page = 2;
$title = 'Page 2';
} else {
$title = 'Invalid Selection';
}
}... |
SQL | UTF-8 | 815 | 3.984375 | 4 | [] | no_license | /*
Udacity's certified program > Business Analytics Nanodegree
SQL practice > Lesson 1 : SQL Basics
When you use the BETWEEN operator in SQL, do the results include the values of
your endpoints, or not? Figure out the answer to this important question by
writing a query that displays the order date and gloss_qty data ... |
Shell | UTF-8 | 1,105 | 3.234375 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"CC0-1.0",
"LicenseRef-scancode-public-domain"
] | permissive | VERSION=$1
if [ -z "$VERSION" ]
then
echo $0 version
exit
fi
NAME=`json -f package.json productName`
NAME_ESCAPED=`echo $NAME | sed 's/\ /\\ /'`
VERSION_ESCAPED=`echo $VERSION | sed 's/\ /\\ /'`
DIR=$NAME_ESCAPED-$VERSION_ESCAPED
ARCH=x64
PLATFORM=darwin
json -I -f package.json -e "this.version='${VERSION}'"
./scr... |
SQL | UTF-8 | 45,630 | 3.234375 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | -- Valentina Studio --
-- MySQL dump --
-- ---------------------------------------------------------
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40014 SET @OLD... |
TypeScript | UTF-8 | 316 | 2.703125 | 3 | [
"MIT"
] | permissive | import EventHandler from './EventHandler';
export default class DOMEventHandler implements EventHandler {
addEventListenerToClass(clazz: string, event: string, fn: any) {
const elements: any = document.querySelectorAll(clazz);
for (const element of elements) {
element.addEventListener(event, fn);
}
}
} |
C++ | UTF-8 | 24,677 | 3.203125 | 3 | [] | no_license | #include <iostream>
#include "Interpreter.h"
void Interpreter::type_mismatch_error(Token* token) {
std::string message = "Type mismatch.";
std::string file_path = token->file;
SyntaxError(file_path, token->line, token->column, message).cast();
}
void Interpreter::value_error(Token* token) {
std::strin... |
Python | UTF-8 | 1,431 | 3.4375 | 3 | [] | no_license | # List of disctionaries
favorite_languages_poll = {
'jen':['python', 'ruby'],
'sarah':['c'],
'edward':['ruby', 'perl'],
'phil':["python", "java"],
'chad':["c", 'c++', 'assembly'],
}
for name, languages in favorite_languages_poll.items():
if len(languages) > 1:
print(name.title() + "'s favorite languages are:")... |
PHP | UTF-8 | 1,042 | 2.5625 | 3 | [] | no_license | <?php
/**
* Created by PhpStorm.
* User: dj
* Date: 2018/3/19
* Time: 14:52
*/
class RecommendMod extends CBaseMod {
public $plateList;
/**
* 构造函数
*/
public function __construct () {
parent::__construct('recommend');
$this->plateList = [
[
'id' => 1 ,
'name' => '兼... |
Java | UTF-8 | 8,247 | 2.40625 | 2 | [] | no_license | package org.example;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.Select;
import org.openqa.s... |
Python | UTF-8 | 1,318 | 5 | 5 | [
"Apache-2.0"
] | permissive | # Gerard Hanlon, 30.01.2018
# A program that displays Fibonacci numbers.
def fib(n):
"""This function returns the nth Fibonacci numbers."""
i = 0 # variable i = the first fibonacci number
j = 1 # variable j = the second fibonacci number
n = n - 1 # variable n = n - 1
while n >= 0: # while n is greater than ... |
PHP | UTF-8 | 3,241 | 2.546875 | 3 | [
"MIT"
] | permissive | <?php
/***************************************************************************
* *
* (c) 2004 Vladimir V. Kalynyak, Alexey V. Vinokurov, Ilya M. Shalnev *
* *
* ... |
Java | UHC | 2,393 | 2.234375 | 2 | [] | no_license | package com.example.bluedrop;
import android.app.ActionBar;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class MainA... |
Java | UTF-8 | 2,576 | 2.890625 | 3 | [] | no_license | import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
/**
* BP3 co... |
Python | UTF-8 | 4,263 | 4.28125 | 4 | [] | no_license | """
Preparation for Phone Interview
Answer the questions below, and send them back via email ahead of the phone
interview. At the phone interview, please have your homework in front of you
and be prepared to discuss your answers with the interviewer.
Algorithms
Implement the method nextNum() and a minimal but effect... |
Python | UTF-8 | 11,188 | 3.453125 | 3 | [
"MIT"
] | permissive | import re
import sys
class Student:
"""
representing a single student with references to their wished packages
"""
def __init__(self, number, wishes):
self.number = number
# tuple with one package number per wish (1st wish, 2nd wish...)
self.wishes = wishes
de... |
Java | UTF-8 | 658 | 1.789063 | 2 | [] | no_license | package com.hjy.shop.service;
import com.hjy.shop.dto.PageBean;
import com.hjy.shop.entity.CategorySecond;
import com.hjy.shop.entity.Product;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* Created by admin on 2017/3/9.
*/
public interface CategorySecondService {
List<CategorySec... |
Python | UTF-8 | 1,265 | 3.703125 | 4 | [] | no_license | from graph.incidence_matrix_graph import IncidenceMatrixGraph
class OrientedIncidenceMatrixGraph(IncidenceMatrixGraph):
def insert_edge(self, edge, weight):
'''Add an edge between specified vertices
Args:
edge (list): list of 2 vertex indices to connect
weight (int): Weigh... |
Shell | UTF-8 | 196 | 2.609375 | 3 | [] | no_license | #!/bin/bash
if [ $# -eq 0 ]; then
echo "Usage: divider file"
exit 1
fi
printf '\033]1337;File=inline=1;height=100%%;width=100%%;preserveAspectRatio=0'
printf ":"
base64 < $1
printf '\a\n' |
JavaScript | UTF-8 | 2,405 | 3.6875 | 4 | [] | no_license | function memoize(func) {
var cache = {};
return function (arg) {
if (cache[arg]) {
console.log("캐시결과에서 바로 리턴", arg);
return cache[arg];
}
console.log("본체 실행함.", arg);
return (cache[arg] = func.apply(this, arguments));
};
}
var mult5 = memoize(function (a) {
return a * 5;
});
console... |
SQL | UTF-8 | 431 | 2.875 | 3 | [] | no_license | CREATE TABLE IF NOT EXISTS `user_tasks`
(
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(256) NOT NULL,
`priority` tinyint(1) NOT NULL DEFAULT 1,
`user_id` int(11) NULL,
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`due_date` times... |
Python | UTF-8 | 490 | 2.6875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Jan 6 21:54:02 2020
@author: Jacob
"""
import numpy as np
from motor_control import servoController, safeCleanUp
pwm_array = list(500*np.linspace(0,1)) + list(500*np.linspace(1,0))
motor_list = [16,18,22] # the + , -, and enabler GPIO pins
try:
servo... |
JavaScript | UTF-8 | 605 | 4.15625 | 4 | [] | no_license |
let palindrome = "Sir - Tetris";
const checker = input => {
let word= sanitizer(input);
let isPalindrome = false;
for(let i = 0; i < word.length/2; i++){
console.log(word[i], word[word.length - (i + 1)]);
if(word[i] === word[word.length - (i + 1)]) {
isPalindrome = true
... |
Python | UTF-8 | 2,211 | 3.09375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
File: plot_functions.py.
Author: Christian Vergara Retamal - Joaquín Callejón Guzmán
Email: chrvergararetamal[at]gmail[dot]com
Github: https://github.com/cvergararetamal
Description: Plot functions - Consultoria I
"""
import sys
import math
import pandas as pd
import numpy as np
import mat... |
Markdown | UTF-8 | 14,298 | 3.25 | 3 | [] | no_license | # Assignment: Predict heart disease risk
In this assignment you're going to build an app that can predict the heart disease risk in a group of patients.
The first thing you will need for your app is a data file with patients, their medical info, and their heart disease risk assessment. We're going to use the famous [... |
Markdown | UTF-8 | 5,339 | 3.546875 | 4 | [] | no_license | 三十四
木兰花在将陈万贯推向窗口之际,又道:“博物院中连二接三发生凶杀案,你当然已经知道了,你为什么还按时送货来?”
“那……”陈万贯犹豫了一下,“每次送货之前,博物院中的那人,照例会和我通一个电话,昨天我收到了这个电话,所以今天依期送货来了。”
木兰花的心中,陡地一喜,道:“那电话中的声音,是怎么样的?你快向我形容一下。”
“那是经过声波扭曲的,听来像一个小孩子的聋音。”
木兰花“唔”地一声,心中暗忖,博物院中的这个神秘人物,行事当真小心得可以,即使他在和陈万贯通电话的时候,仍然改变了原来的声音。
要改变一个人的声音,那是十分容易的事情,最简单的方法,便是将所讲的话,先将录... |
Python | UTF-8 | 636 | 3.015625 | 3 | [] | no_license | class Solution:
def countLatticePoints(self, circles: List[List[int]]) -> int:
res = set()
def get_points(x, y, r):
points = []
for x1 in range(x - r, x + r + 1):
diff_y_sqr = r ** 2 - (x1 - x) ** 2
y1 = math.ceil(y - math.sqrt(diff_y_... |
Markdown | UTF-8 | 3,199 | 3.234375 | 3 | [] | no_license | <!--
title: REST
weight: 4706
-->
# REST Trigger
This trigger provides your flogo application the ability to start a flow via REST over HTTP
## Installation
```bash
flogo install github.com/project-flogo/contrib/trigger/rest
```
## Metadata
```json
{
"settings": [
{
"name": "port",
"type": "int",
... |
Python | UTF-8 | 768 | 2.953125 | 3 | [] | no_license | import sys
sys.stdin = open("다솔이의다이아몬드.txt","r")
def dfs(y,x):
for nxt in range(8):
ny = y+dy[nxt]
nx = x+dx[nxt]
if 0<=ny<5 and 0<=nx<x_length and result[ny][nx] == '.':
result[ny][nx] = '#'
for tc in range(int(input())):
data = input()
n = len(data)
x_length = 4*n... |
Markdown | UTF-8 | 2,810 | 2.75 | 3 | [] | no_license | # The Black Pearl
The Black Pearl is a Crew Web Page created for DGS-1 to better equip analysts by reliably directing them to mission critical intelligence resources.

## Stable Executables
In the [master/artifacts](https://gitla... |
SQL | UTF-8 | 1,070 | 3.53125 | 4 | [] | no_license | use world;
-- aggregate Functions
select sum(population) as total_populasi
from city
where CountryCode = 'IDN';
select count(name) as total_city
from city
where CountryCode = 'IDN';
select avg(population) as rata_rata_populasi
from city
where CountryCode = 'IDN';
select min(population) as populasi_terkecil
from cit... |
Shell | UTF-8 | 796 | 2.9375 | 3 | [] | permissive | #!/bin/sh
# Purpose:
# Fifth step in cross-layer alignment.
#
# > cross_thisblock -script=scriptpath
#
# Do one block alignment job, data read from 'blockdat.txt'.
#
# Options:
# -evalalldz ;force evaluation of all maxdz layers
# -abdbg ;make diagnostic images and exit (Z^Z-1)
# -abdbg=k ;make diagnostic images a... |
Python | UTF-8 | 7,008 | 2.6875 | 3 | [
"MIT"
] | permissive | """ Defining the MNSIT dataset"""
from __future__ import absolute_import
import gzip
import os
import sys
import urllib.request
import numpy as np
import tensorflow as tf
from ttools.core.datasets import Dataset
from ttools.utils.utils import image_to_tfexample
class MNIST(Dataset):
# Initing dataset
def ... |
Python | UTF-8 | 453 | 4.1875 | 4 | [] | no_license | # Try running this program.
# Then change it to generate another subplot with the product of y1 and y2.
import numpy as np
import matplotlib.pyplot as plt
plt.figure(1)
t = np.arange(0.0, 5.0, 0.1) # try printing t
print(t)
plt.subplot(3, 1, 1)
y1 = np.exp(-t)
plt.plot(t, y1, 'b') # try 'g' or 'bo' or 'k+'
plt.s... |
Java | UTF-8 | 4,680 | 2.015625 | 2 | [] | no_license | package id.ac.polinema.intentexercise;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.util.Log;
import android.view... |
Shell | UTF-8 | 733 | 2.921875 | 3 | [] | no_license | #!/bin/bash
#
# variables from arguments string in jdl
#
RUN_DIR=$1
INPUT_NAME=$2
ANALYSIS_FILE_NAME=$3
DET_TYPE=$4
echo $RUN_DIR
echo $INPUT_NAME
echo $ANALYSIS_FILE_NAME
echo $DET_TYPE
bash
echo ""
echo "CMSSW on Condor"
echo ""
START_TIME=`/bin/date`
echo "started at $START_TIME"
CMSSWBASE=/home/jengbou/works... |
PHP | UTF-8 | 3,028 | 2.65625 | 3 | [] | no_license | <?php
/**
* Created by PhpStorm.
* User: Aymen
* Date: 01/10/2018
* Time: 15:38
*/
namespace App\Controller\Rest ;
use App\Entity\Tracker;
use Doctrine\ORM\EntityManager;
use FOS\RestBundle\Controller\FOSRestController;
use FOS\RestBundle\Controller\Annotations as Rest;
use FOS\RestBundle\View\View;
use Symfony\C... |
Markdown | UTF-8 | 3,569 | 3.1875 | 3 | [] | no_license | # RU
# Пасьянс «Косынка», или «Клондайк» — старинный карточный пасьянс.
## Правила
Играется одной колодой в 52 карты. Цель игры — разложить карты по мастям в порядке от туза до короля в четыре стопки (их иногда называют базовыми, или «домами»).
Карту можно перекладывать на другую рангом выше, но другого цвета (чёрног... |
Ruby | UTF-8 | 1,539 | 4.0625 | 4 | [] | no_license | # Method: triangle
# Argument: 3 numeric values
# Side effects: None
# Return value: A symbol. :equilateral, :isosceles, :scalene, or :invalid
# Depending on what a triangle made up of sides whose lengths
# are given by the 3 numeric arguments would be.
# Edge cases:
# When the 2 smaller ... |
Java | UTF-8 | 743 | 2.203125 | 2 | [] | no_license | package org.nerdizin.eztrial.web.validator;
import org.nerdizin.eztrial.web.model.common.Pagination;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;
public class PaginationValidator implements Validator {
@Override
public boolean supports(final Class<?> aClass) {
re... |
Markdown | UTF-8 | 6,020 | 2.953125 | 3 | [
"MIT"
] | permissive | # Graph Convolutional Networks
## Notation/Setup
- Inputs
- Node-level features matrix X (NxD)
- Adjacency matrix A (NxN)
- Output
- Node-level output features matrix Z (NxF)
- Foward propagation
- H^(l+1) = f(H^l, A)
- H^(0) = X, H^(L) = Z
- The specific models differ only in how f(⋅,⋅)f(⋅,⋅) is chosen and param... |
PHP | UTF-8 | 1,869 | 2.578125 | 3 | [] | no_license | <?php
if(!isset($_GET["filter"])){
$filter = "";
}else{
$filter = $_GET["filter"];
}
require "Connect_DB.php";
$sql = "SELECT Item_Image, Item_Series, Item_Name, Item_ID
FROM Item_Info
WHERE Item_Series LIKE '%".$filter."%'
";
$result = $conn->query($sql);
$Item_ID = a... |
Markdown | UTF-8 | 1,243 | 3.40625 | 3 | [] | no_license | # KOTLIN :mobile_phone_off:
### **COMO DECLARAR VARIÁVEIS**
- **var** (valor mutável, ComelCase) - Variável que pode ter ser valor alterado durante o código;
- **val** (valor imutável, ComelCase) - Variável que terá somente o valor atribuído (similar ao final em Java);
- **const val** (valor imutável, SNAKE_CASE) - C... |
Java | UTF-8 | 289 | 2.828125 | 3 | [] | no_license | package org.epicp.gamestate;
public enum Direction {
//Do not change order.
NORTH, WEST, EAST, SOUTH;
public boolean isOpposite(Direction otherDirection) {
return ordinal() + otherDirection.ordinal() == 3;
}
public Direction getOpposite() {
return values()[3-ordinal()];
}
}
|
Markdown | UTF-8 | 903 | 3.109375 | 3 | [] | no_license | + Choose a thing/noun of any kind, then write an express server with a GET route that sends back an array of that thing. X
+ Your GET endpoint should be able to check for any query parameters that may have been passed into the url of the request and filter the results based on those query parameters. X
# EXTR... |
C++ | UTF-8 | 24,142 | 2.515625 | 3 | [
"MIT"
] | permissive | #include "TransformationUtility.h"
#include <opencv2/legacy/legacy.hpp>
#include "../Macros.h"
#include <iostream>
#include <../eigen/Eigen/Dense>
#include <../eigen/Eigen/SVD>
using pcl::visualization::PointCloudColorHandlerGenericField;
using pcl::visualization::PointCloudColorHandlerCustom;
//our visualizer... |
Python | UTF-8 | 496 | 2.96875 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
# Created by thpffcj on 2019/9/20.
import pandas as pd
import matplotlib.pyplot as plt
data1 = pd.read_csv("卡纳达气候数据/Alberta/CALGARY_1956_1979.csv", skiprows=18)
data2 = pd.read_csv("卡纳达气候数据/Alberta/CALGARY_1881_2012.csv", skiprows=18)
pd.set_option('display.max_columns', 40)
pd.set_option('dis... |
Python | UTF-8 | 16,314 | 2.765625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import time
import matplotlib.pyplot as plt
SMALL_FONT = 10
LARGE_FONT = 14
FIG_SIZE = (8, 6)
img_specs = {
'mnist' : {
'pix_row' : 1,
'pix_col' : 26,
'img_width' : 28,
'img_height' : 28
},
'cifar' : {
'pix_row' : 1,
'p... |
Java | UTF-8 | 1,515 | 2.125 | 2 | [] | no_license | package com.jov.isaac.is;
import android.content.Intent;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
/**
* Created by shuwei on 15/12/28.
*/
public class MoreActivity extends BaseActivity implements View.OnClickListener{
private View v1,v2,v3;
@Override
protected void on... |
Java | UTF-8 | 900 | 2.640625 | 3 | [
"MIT"
] | permissive | package com.github.mjaroslav.shikimori4java.object;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.val;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@RequiredArgsConstructor
public enum MangaOrder {
ID("id"), RANKED("ranked"), KIND("kind"), POPUL... |
SQL | UTF-8 | 1,787 | 3.59375 | 4 | [] | no_license | --/***************************************************************/
-- Developer: Julie Laursen
--
-- Program #: 8
--
-- File Name: Program 8.sql
--
-- Course: ITSE 1345 Introduction to Oracle SQL and PL/SQL
--
-- Due Date: 3/15
--
-- Instructo... |
Swift | UTF-8 | 1,352 | 2.921875 | 3 | [] | no_license | // ETML
// Auteur : Luca Bohlen
// Date : 12.05.2021
// Description : Ce script gère la liaison avec la base de données pour les magasins.
import Foundation
import FirebaseFirestore
struct Shop{
var id: String
var uid = ""
var name: String
var dateAdded: Date
var shopLocation: String
... |
Markdown | UTF-8 | 1,826 | 3.140625 | 3 | [
"MIT"
] | permissive | # Global User Module
```elixir
defmodule MyApp.Accounts.User do
schema "users" do
field :first_name, :string
field :last_name, :string
field :skype, :string
field :email, :string
field :encrypted_password, :string
end
end
```
This anti-pattern manifests in two ways:
1. Adding fields to `Accou... |
TypeScript | UTF-8 | 8,562 | 2.859375 | 3 | [
"LicenseRef-scancode-generic-cla",
"Apache-2.0"
] | permissive | import {
ConstValue,
FieldDefinition,
FunctionDefinition,
FunctionType,
PropertyAssignment,
SyntaxType,
ThriftStatement,
} from '@creditkarma/thrift-parser'
import { IResolveContext, IResolveResult } from '../types'
import { resolveIdentifierDefinition } from './resolveIdentifierDefinition'... |
Python | UTF-8 | 785 | 3.0625 | 3 | [] | no_license | from string import ascii_lowercase
import sys
def check_recycle(n, m):
n = str(n)
m = str(m)
if len(n) <> len(m):
return 0
t = n + n
if t.find(m) > -1:
return 1
return 0
def process(A, B):
count = 0
for n in range(A,B):
for m in range(n+1, B+1):
val ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.