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 | 143 | 3.171875 | 3 | [
"MIT"
] | permissive | <?php
$nums =range(0,10);
//print_r($nums);
foreach($nums as $chave => &$valor){
$valor *= 10;
echo $valor."\n";
}
print_r($nums);
?> |
JavaScript | UTF-8 | 3,702 | 2.546875 | 3 | [] | no_license | const _ = require('lodash');
const Q = require('q');
const Queue = require('./queue.model');
//membuat function
exports.index = function (req, res) {
// http://localhost:5000/api/queues?page=1&limit=10
let page = Number(req.query.page) || 1,
limit = Number(req.query.limit) || 10,
skip = (page -... |
Python | UTF-8 | 181 | 4.125 | 4 | [] | no_license | 55.Write a program to calculate product of digits of a number.
SOL:
n=int(input("Enter any number:"))
s=1
while n!=0:
i=n%10
s=s*i
n=int(n/10)
print("Sum of numbers is :",s)
|
Java | UTF-8 | 667 | 2.859375 | 3 | [] | no_license | package game;
import java.util.ArrayList;
public class Monster extends Creature{
private String name;
private int serial;
private int id;
private ArrayList<CreatureAction> creatureaction = null;
public Monster(){
}
public void setID(int room, int _serial){
id = room;
serial =... |
JavaScript | UTF-8 | 3,086 | 2.671875 | 3 | [] | no_license | import {Point} from '../src/Point';
import {PointVisibilityMapRouteOptimizer} from '../src/PointVisibilityMapRouteOptimizer'
describe("PointVisibilityMapRouteOptimizer.optimize", function() {
it("does no optimization if no points are visible to each other", function() {
const route = [
new Poi... |
JavaScript | UTF-8 | 6,299 | 2.65625 | 3 | [] | no_license | import {
runnerObject,
isJuniorOrOlder
} from "../helpers/runnerHelper";
import {
nationObject,
unknownNation
} from "../helpers/nationHelper";
import {
relayResultObject,
individualResultObject
} from "../helpers/resultHelper";
import {
individualEntryObject
} from "../helpers/entryHelper";
import {
ev... |
PHP | UTF-8 | 6,648 | 3.203125 | 3 | [] | no_license | <?php
require_once(__DIR__."/../data/TaskDBContext.php");
/**
* Handles Tasks operations.
*
* @author Yesid Perea
**/
class Task
{
private $id;
private $description;
private $userId;
private $messages;
private $error;
private $tas... |
Python | UTF-8 | 2,832 | 4.375 | 4 | [] | no_license | '''
the Question:
Binary Search Tree is a node-based binary tree data structure which has the following properties:
The left subtree of a node contains only nodes with keys lesser than the node's key.
The right subtree of a node contains only nodes with keys greater than the node’s key.
The left and right... |
C++ | UTF-8 | 1,209 | 2.921875 | 3 | [] | no_license | #pragma once
#include "Window.h"
#include <functional>
#include <vector>
class InputManager
{
public:
// Was a key pressed?
static bool GetKeyPressed(char key);
// Is a key held down?
static bool GetKeyDown(char key);
static int GetMouseX();
static int GetMouseY();
static float GetMouseXDelta();
static fl... |
C++ | UTF-8 | 2,878 | 3.203125 | 3 | [] | no_license | #include "computer1.h"
#include "game.h"
#include "map.h"
#include <cstdlib>
#include <iostream>
using namespace std;
/**
*
*/
Computer1::Computer1()
{
xPoint = 0;
yPoint = 0;
xVelocity = 0;
yVelocity = 0;
carNumber = 0;
}
void Computer1::createLoc(Game& game)
{
int tofind;
if (carNumb... |
C++ | UTF-8 | 5,905 | 3.59375 | 4 | [] | no_license | #include <iostream>
#include <cstring>
#include "postfixGenerator.h"
#include "myStack.h"
using namespace std;
postfixGenerator::postfixGenerator()
{
//Setting infix and postfix strings to empty expressions.
infix = "";
postfix = "";
}
void postfixGenerator::getInfix(string x)
{
//F... |
Java | UTF-8 | 1,900 | 2.359375 | 2 | [] | no_license | package it.trackerchallenge.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframew... |
Python | UTF-8 | 1,939 | 3.25 | 3 | [] | no_license | from tkinter import *
import game as g
import tkinter.messagebox
class MainGame:
"""class with "start game" window"""
def __init__(self):
self._window_config()
def _window_config(self):
root = Tk()
root.title("made by Sakevich")
root.geometry('300x200')
... |
Markdown | UTF-8 | 4,311 | 3.296875 | 3 | [] | no_license | OK Coders: Lesson 4 Exercises
====
Complete all homework assignments before coming to the next class or as otherwise instructed.
## Create an express app for bootstrap practice
**Create a new express app**
Similar to the previous homework assignment, create a new Express web application. Do not reuse previous expre... |
Ruby | UTF-8 | 1,095 | 4.25 | 4 | [] | no_license | a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
# output array
a.each {|x| puts x}
# output only if greater than 5
a.each {|x| puts x if x > 5}
# odd numbers only
a.each {|x| puts x if x % 2 != 0}
# append 11 to end of array
a.push 11 ## or can use a << 11
# prepend 0 to beginning of array
a.unshift 0
# remove 11 and append 3
a.p... |
Python | UTF-8 | 586 | 3.125 | 3 | [] | no_license | import os
import matplotlib.pyplot as plt
class RunningAverageMeter(object):
"""Computes and stores the average and current value"""
def __init__(self, momentum=0.99):
self.momentum = momentum
self.reset()
def reset(self):
self.val = None
self.avg = 0
def update(self,... |
Python | UTF-8 | 2,072 | 2.703125 | 3 | [] | no_license | import numpy
import cv2
from matplotlib import pyplot
from matplotlib.widgets import Button, Slider
import sys
sys.path.append("../library/")
import image_correction as ic
if len(sys.argv) != 2:
# http://stackoverflow.com/questions/2949974/how-to-exit-a-program-sys-stderr-write-or-print
sys.exit("Error: Num argume... |
C++ | UTF-8 | 1,021 | 3.203125 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
void printPath(vector<int>& path){
for(int i=0;i<path.size();i++){
cout<<path[i];
}
cout<<endl;
}
bool safe(int x,int y,vector<vector<bool> >& visited){
if(x>=0&&x<=visited.size()-1&&y>=0&&y<=visited[0].size()&&!visited[x][y]){
r... |
Ruby | UTF-8 | 817 | 2.609375 | 3 | [
"MIT"
] | permissive | require 'basilico/event_handler.rb'
module Basilico
extend self
EVENTS = %w{start interrupt interrupt_over reset resume end break_end every}
def handlers
@event_handlers ||= []
end
def add_handler(klass)
handlers << klass
end
def run_all(event, *vars)
options = parse_variables(vars.flatt... |
JavaScript | UTF-8 | 1,166 | 3.546875 | 4 | [] | no_license | /**
* @param {number[][]} triangle
* @return {number}
*/
var minimumTotal = function(triangle) {
if (!triangle || !triangle[0]) {
return 0;
}
let min = triangle[0][0];
for (let i = 1; i < triangle.length; i++) {
let length = triangle[i].length;
min = Infinity;
for (le... |
Markdown | UTF-8 | 9,717 | 2.53125 | 3 | [] | no_license | # IbookerEditorAndroidK
书客编辑器安卓Kotlin版。
>作者:邹峰立,微博:zrunker,邮箱:zrunker@yahoo.com,微信公众号:书客创作,个人平台:[www.ibooker.cc](www.ibooker.cc)。
>本文选自[书客创作](www.ibooker.cc)平台第131篇文章。[阅读原文](http://www.ibooker.cc/article/131/detail) , [书客编辑器安卓Kotlin版 - 体验版下载](https://www.pgyer.com/LPzU)
 addToppingMethod(topping string) Pizza {
return Pizza{
toppings: append(pizza.toppings, topping),
}
}
func (pizza Pizza) PublicAddToppingMethod(topping string) Pizza {
return Pizza{
toppings: append(pizza.toppings, topping),
}
}
func ... |
Java | ISO-8859-1 | 1,919 | 3.125 | 3 | [] | no_license | package controller;
import java.util.concurrent.Semaphore;
public class Threads extends Thread{
private int sld;
private int cod;
private int val;
private int cont;
private Semaphore [] sqDep;
private Conta conta[];
private int pos;
private static int transac;
public Threads(int pos, int cod, int... |
JavaScript | UTF-8 | 1,320 | 3.796875 | 4 | [] | no_license | var letters = [
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
"R",
"S",
"T",
"U",
"V",
"W",
"X",
"Y",
"Z"
];
var wins = 0;
var losses = 0;
var computerPick;
var humanPick;
var guess = [];
var guessLeft = 9;
guessGame();
f... |
Java | UTF-8 | 205 | 2.015625 | 2 | [] | no_license |
package archivos.pilas;
import mis.clases.Comprobante;
public interface IPila {
public void apilar(Comprobante item);
public Comprobante desapilar();
public boolean estaVacia();
}
|
TypeScript | UTF-8 | 539 | 3.390625 | 3 | [] | no_license | // https://leetcode-cn.com/problems/unique-binary-search-trees/
let temp: Array<number> = []
export function numTrees(n: number): number {
temp = new Array(n+1).fill(0)
return count(1, n)
};
function count(start: number, end: number): number {
if (start > end) {
return 1
}
if (temp[end-start]) {
re... |
C# | UTF-8 | 586 | 2.78125 | 3 | [] | no_license | using System;
using System.Collections;
using System.Collections.Generic;
using System.Web;
namespace WpfApp1
{
class program
{
static void Main(string[] args)
{
string w = Console.ReadLine();
Console.WriteLine(w + 's');
Console.ReadLine();
... |
JavaScript | UTF-8 | 511 | 2.5625 | 3 | [] | no_license | import express from 'express';
const server = express();
let port = 8080;
let host = "localhost";
server.use(express.static('.'));
// Basic Response with a message
server.get(['/echo','/echo/:message'], (req,res) => {
let messageReceived = req.params.message || "No Message Received";
console.info("Message R... |
Markdown | UTF-8 | 3,175 | 2.78125 | 3 | [
"MIT"
] | permissive | ---
slug: contest-entries-get-creative-with-gingerbread
title: "Contest entries get creative with gingerbread"
date: January 01 2020
---
<p>There are gingerbread bakers and gingerbread artists.</p>
<p>And then there are gingerbread overachievers.</p>
<p>
The group representing Focus the Region, the annual teach-in... |
Python | UTF-8 | 2,294 | 2.515625 | 3 | [
"MIT"
] | permissive | @testModuleNameCodeCoverage.AddMethodTesting
@testModuleNameCodeCoverage.AddPropertyTesting
class testClassName(unittest.TestCase):
###################################
# Tests of class methods #
###################################
def testmethod_name(self):
# Tests the method_name met... |
Java | UTF-8 | 503 | 2.015625 | 2 | [
"MIT"
] | permissive | package kr.pe.nuti.home.api.pack.todo.domain;
import kr.pe.nuti.home.api.core.annotation.TrackLog;
import kr.pe.nuti.home.api.pack.todo.enumeration.TodoState;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
@Data
@Entity(name = "todo_item")
@TrackLog... |
Markdown | UTF-8 | 602 | 2.59375 | 3 | [] | no_license | # Lecture 12
*29/10/2019*
## Pipelined Control
- Control signals are derived from instruction
- Start with execution stage
### Design
- If a sequence has many dependencies, it may need to forward data.
- Forwarding implies reading ALU operands from a source other than the register file.
### When to forward
- Data ... |
C# | UTF-8 | 3,989 | 2.5625 | 3 | [
"MIT"
] | permissive | using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Windows.Forms;
using TestGenerator.business;
using TestGenerator.data.model;
using TestGenerator.DataAccessLayer;
using static System.Windows.Forms.ListViewItem;
namespace TestGenerator.presentation
{
public ... |
Java | UTF-8 | 368 | 2.828125 | 3 | [] | no_license | package interfaceSegregationPrinciple.withUsePrinciple;
/**
* Created by h.elahi on Dec, 2020
*/
public class SmartPhone implements PublicTechnology,SpecialTechnology {
@Override
public void GPS() {
System.out.println("SmartPhone has GPS");
}
@Override
public void Radio() {
Syst... |
C++ | UTF-8 | 13,395 | 2.703125 | 3 | [] | no_license | /*** Included Header Files ***/
#include "CoreProject.h"
#include "CoreObject.h"
#include "CoreAttribute.h"
#include "CoreMetaProject.h"
#include "CoreMetaObject.h"
// --------------------------- Private CoreProject Functions ---------------------------
CoreProject::CoreProject(CoreMetaProject* &coreMeta... |
C# | UTF-8 | 10,076 | 3.015625 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using FastMember;
using Semicolon.Attributes;
using Semicolon.Binding;
using Semicolon.Exceptions;
using Semicolon.Extensions;
// ReSharper disable ArgumentsStyleLiteral
namespace Semicolon
{
/// <summa... |
Java | MacCentralEurope | 9,010 | 2.546875 | 3 | [] | no_license | package projetsystemC;
import java.awt.Color;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.Font;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Vector;
import javax.swin... |
Java | UTF-8 | 5,647 | 1.976563 | 2 | [
"CC-PDDC",
"CC0-1.0",
"CC-BY-3.0",
"LicenseRef-scancode-unknown-license-reference",
"LGPL-2.1-only",
"LicenseRef-scancode-other-permissive",
"CDDL-1.0",
"GCC-exception-3.1",
"MIT",
"EPL-1.0",
"Classpath-exception-2.0",
"BSD-3-Clause",
"GPL-2.0-only",
"Apache-2.0",
"LicenseRef-scancode-pu... | 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 ... |
Python | UTF-8 | 339 | 2.78125 | 3 | [] | no_license | from PIL import Image
import os, sys
import kmeans
try:
filename = sys.argv[1]
except IndexError:
filename = raw_input("Enter a filename: ")
try:
img = Image.open(filename)
except IOError:
print "Unable to read file - check spelling."
sys.exit()
bw = img.convert('L')
k = raw_input("enter a k value: ")
km... |
SQL | UTF-8 | 2,533 | 3.28125 | 3 | [] | no_license | /* Процедура удаления старых записей из таблицы DWH.BCL_STOREDBLOB и очистки ТП */
create or replace procedure DWH.STORED_DEL_VAL_p
as
begin
delete from DWH.STOREDBLOB where created < add_months(sysdate, -12*6); -- удаляет старые данные старше 6 лет с момента запуска;
commit;
execute immediate 'alter table DWH... |
C# | UTF-8 | 4,610 | 2.59375 | 3 | [] | no_license | namespace Cq.Miniserver
{
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Threading;
public class Server
{
private TcpListener listener;
private Queue<string> logQ... |
Markdown | UTF-8 | 748 | 2.515625 | 3 | [] | no_license | # Motivação
Atualmente, não há nenhuma forma de saber de antemão quais refeições estarão disponíveis nos restaurantes universitários. Estudantes gostariam de ter uma forma simples e rápida de acessar o cardápio do dia, sem precisar pegar a fila do RU (sem sequer saber se gosta ou não da comida do dia).
Além disso... |
Java | UTF-8 | 2,689 | 2.171875 | 2 | [] | no_license | package br.com.rtools.relatorios.dao;
import br.com.rtools.principal.DB;
import br.com.rtools.utilitarios.Debugs;
import java.util.ArrayList;
import java.util.List;
import java.util.Vector;
import javax.persistence.Query;
public class RelatorioFechamentoBaileDao extends DB {
public List<Vector> listaEventoBaile(... |
TypeScript | UTF-8 | 455 | 2.96875 | 3 | [] | no_license | export interface IDeviceTypeReducer {
deviceType: string
}
const initState: IDeviceTypeReducer = { deviceType: "iPhone" }
export const deviceTypeReducer = (state: IDeviceTypeReducer = initState, action: any) => {
switch (action.type) {
case "SET_DEVICE_TYPE":
case "INIT_APP":
retur... |
Python | UTF-8 | 1,049 | 3.6875 | 4 | [] | no_license | # 백준 10971 외판원 순회2
# 앞서서 풀었던 35_2 [차이를 최대로]와 같이 순열 알고리즘으로 풀 수 있을 것으로 예상됨
# + 두 도시 사이에 길이 없는 경우(0)에도 return 해야 함
n = 3
a = [[0, 10, 15],[5, 0, 9],[6, 13, 0]]
picked = []
result =[]
def sum(a, n, picked):
add = 0
for i in range(n):
add += a[picked[i][0], picked[i][1]]
return add
def dfs(a, iD, jD, picked, n):
# ... |
Java | UTF-8 | 2,187 | 2.953125 | 3 | [] | no_license | package com.example.tarasantoshchuk.translator.history.translations;
import android.os.Parcel;
import android.os.Parcelable;
import java.io.Serializable;
import java.util.LinkedList;
public class TranslationHistory implements Serializable, Parcelable{
private static final int MAX_SIZE = 50;
private LinkedLi... |
TypeScript | UTF-8 | 2,052 | 2.9375 | 3 | [] | no_license | function click(x: number, y: number);
function gesture(duration: number, ...points);
function sleep(ms: number);
function toast(msg: string);
function exit();
interface Point {
x: number;
y: number;
}
//app
interface Intent {
action: string;//android.intent.action.
packageName: string;
classNam... |
PHP | UTF-8 | 1,694 | 2.640625 | 3 | [] | no_license | <?php
namespace App\Libs;
use GuzzleHttp\Client;
use Illuminate\Support\Facades\Log;
/**
* 用户相关接口请求
*/
class User extends Base
{
public $client;
protected $error = null;
protected function __construct()
{
$this->client = (new Client());
}
/**
* 设置错误信息
... |
Python | UTF-8 | 6,486 | 2.890625 | 3 | [] | no_license | import pygame
import argparse
import sys
import json
import pytuio as tuio
screenwidth = 800
screenheight = 600
fullscreen_width = 0
fullscreen_height = 0
config = json.load(open("config.json"))
def init_tuio(args):
tracking = tuio.Tracking(args.ip,args.port)
print("loaded profiles:", tracking.profiles.keys()... |
JavaScript | UTF-8 | 1,157 | 2.546875 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | import React from "react";
class Card extends React.Component {
render() {
let {card} = this.props;
let imgUrl = card.getImgUrl();
let isRaised = card.getIsRaised();
let isPlayable = card.getIsPlayable();
let style = card.getStyle();
let styles = {};
... |
Java | TIS-620 | 1,496 | 2.09375 | 2 | [] | no_license | package selenium.facebook.begin.tests;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.testng.Assert;
import org.testng.annotations.*;
import selenium.automation.utilities.FirefoxUtil;
import selenium.facebook.elements.*;
public class fbLoginSimp... |
Python | UTF-8 | 1,784 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | """Controller for sharing Omada API coordinators between platforms."""
from functools import partial
from tplink_omada_client.devices import OmadaSwitch, OmadaSwitchPortDetails
from tplink_omada_client.omadasiteclient import OmadaSiteClient
from homeassistant.core import HomeAssistant
from .coordinator import Omada... |
C++ | UTF-8 | 759 | 2.828125 | 3 | [] | no_license |
#include "DifferentialEvolution/DifferentialEvolution.h"
double Griewangk(const std::vector<double> &x){
double sum1 = 0.0;
double prod1 = 1.0;
for (auto i = 0; i < x.size(); ++i){
sum1 += pow(x[i], 2);
prod1 *= cos(x[i]/sqrt(i+1));
}
auto f = sum1/4000.0 - prod1 + 1;
return f;... |
Python | UTF-8 | 516 | 2.625 | 3 | [] | no_license | from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait as WD
from selenium.webdriver.common.by import By
WaitTime = 15
def answered(d,Question_Num): # here d is the driver and the second parameter is Question number
WaitFor = WD(d,WaitTime)
answer_... |
SQL | UHC | 2,830 | 4.5 | 4 | [] | no_license | --join2
(1) oracle;
select buyer_id, buyer_name, prod_id, prod_name
from prod, buyer
where prod.prod_buyer = buyer.buyer_id;
join2 Ǽ ϴ sql
--1 :
select count(*)
from
(select buyer_id, buyer_name, prod_id, prod_name
from prod, buyer
where prod.prod_buyer = buyer.buyer_id); --ĥ : inline-view ʿѰ Ȯض
--2... |
Java | UTF-8 | 1,674 | 2.375 | 2 | [] | no_license | package com.mcdonalds.app.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import com.ensighten.Ensighten;
public class PagerIndicatorGroup extends RadioGroup {
private final Context mContext;
public PagerIndicatorG... |
JavaScript | UTF-8 | 2,158 | 3.359375 | 3 | [] | no_license | "using strict"
class Book {
constructor(img, name, author, genre, year, rating)
{
this._img = img;
this._name = name;
this._author = author;
this._genre = genre;
this._year = year;
this._rating = rating;
}
getImg(){
return this._img;
}
g... |
PHP | UTF-8 | 1,460 | 2.84375 | 3 | [
"BSD-3-Clause",
"MIT"
] | permissive | <?php
namespace SerBinario\SAD\Bundle\UserBundle\RN;
use SerBinario\SAD\Bundle\UserBundle\DAO\UserDAO;
use SerBinario\SAD\Bundle\UserBundle\Entity\User;
/**
* Description of UserRN
*
* @author andrey
*/
class UserRN
{
/**
*
* @var type
*/
private $userDAO;
/**
*
* @para... |
Java | UTF-8 | 1,997 | 2.8125 | 3 | [] | no_license | /**
*
*/
package servidor.lock.deadlock.impl;
import java.lang.Thread.State;
import java.util.Set;
import servidor.lock.deadlock.PrevencionDeadLock;
import servidor.transaccion.FabricaTransactionManager;
import servidor.transaccion.Transaccion;
import servidor.transaccion.TransactionManager;
/**
* ... |
Python | UTF-8 | 387 | 3.296875 | 3 | [
"Apache-2.0"
] | permissive | class C1(object):
__slots__ = "s1";
class C2(C1):
__slots__ = "s2";
class C3(C2):
pass
o1 = C1()
o2 = C2()
o3 = C3()
print o1.__slots__ # prints s1
print o2.__slots__ # prints s2
print o3.__slots__ # prints s2
o1.s1 = 11
o2.s1 = 21
o2.s2 = 22
o3.s1 = 31
o3.s2 = 32
o3.a = 5
import copy
p3 = copy... |
C# | UTF-8 | 803 | 3.765625 | 4 | [] | no_license | using System;
using System.Collections.Generic;
namespace Framework.Patterns.Container
{
/// <summary>
/// Extension methods for <see cref="IEnumerable{T}"/>
/// </summary>
public static class EnumerableExtensions
{
/// <summary>
/// Runs a for each loop on each item of an <see cre... |
TypeScript | UTF-8 | 852 | 2.875 | 3 | [] | no_license | export const UrlGetLocationInfo = "https://api.weather.gov/points/";//following lat and lon
export const Locations = {
WASHINGTON:"Washington",
MINNEAPOLIS:"Minneapolis",
MIAMI: "Miami",
SEATTLE: "Seattle"
}
export interface ILocationInfo {
id: string;
city: string;
geo: string;
}
export... |
Swift | UTF-8 | 5,642 | 2.546875 | 3 | [] | no_license | //
// UIDraggableView.swift
// Friends List Cleaner
//
// Created by Simen Johannessen on 15/10/14.
// Copyright (c) 2014 Simen Johannessen. All rights reserved.
//
import Foundation
import UIKit
import Photos
func d2r(degrees : Double) -> Double {
return degrees * M_PI / 180.0
}
protocol DraggableDelegate {... |
C# | UTF-8 | 817 | 2.515625 | 3 | [] | no_license | using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using EF.Data;
using System.Data.Entity.ModelConfiguration.Configuration;
using System;
namespace EF.Data.Mapping
{
public class AttachmentMap : EntityTypeConfiguration<Attachment>
{
public AttachmentMap()... |
C++ | UTF-8 | 759 | 3.078125 | 3 | [] | no_license | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
int binarysearch(int arr[], int n, int key){
int s = 0;
int e = n;
while(s<=e){
int mid = (s+e)/2;
if (arr[mid]==key){
return mid;
}
else if(arr[mid]>key){
e = mid-1;
return... |
Markdown | UTF-8 | 7,236 | 3 | 3 | [] | no_license | # Enoncé
L'objectif de cet exercice est de manipuler une liste simplement
chainée de cellules contenant un entier. Une liste sera ici
représentée par un pointeur vers sa première cellule, la tête de
liste.
On fournit ici la structure de donnée représentant une cellule, un
programme de test (`main`) ainsi que les prot... |
C# | UTF-8 | 2,352 | 2.78125 | 3 | [
"MIT"
] | permissive | using System;
using System.Collections.ObjectModel;
using System.Linq;
using System.Net.Http;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace RealWorldStocks.Core.Models
{
public class YahooStocksService
{
public async Task<ObservableCollection<StockSnapshot>> Ge... |
Java | UTF-8 | 305 | 1.835938 | 2 | [] | no_license | package com.green.bank.model;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class LoanModel {
String accountNo;
int loanAmount;
String status;
String fName;
String lName;
String address;
String email;
}
|
Python | UTF-8 | 2,356 | 2.984375 | 3 | [
"Apache-2.0"
] | permissive | #coding:utf-8
import sys
sys.path.append('../')
import numpy as np
from StableDog import preprocessing
data = np.array([[ 3, -1.5, 2, -5.4],
[ 0, 4, -0.3, 2.1],
[ 1, 3.3, -1.9, -4.3]])
print(data)
# 均值移除
data_standardized = preprocessing.meanRemoval(data, True)
print("\n均值移除后数据:... |
JavaScript | UTF-8 | 2,231 | 3.375 | 3 | [] | no_license | $(document).ready(function(){
$("button").on("click", getWeatherData);
})
function getWeatherData(){
var zip = $(".zipcode").val();
$.ajax({
url: "https://api.openweathermap.org/data/2.5/forecast",
method: "GET",
data: {
APPID: "e41600df5a54dc35fc4a1b2fd4b91136",
... |
SQL | UTF-8 | 281 | 2.515625 | 3 | [] | no_license | CREATE DATABASE Players;
USE Players;
CREATE TABLE Players(
Username varchar(20) PRIMARY KEY,
Password varchar(20) NOT NULL,
ID float,
Email varchar(50),
Name varchar(20),
Score int
);
Insert into Players Values ('test','pass',1,'mas2g2@mail.missouri.edu','Test',0);
SELECT * FROM Players;
|
PHP | UTF-8 | 1,338 | 3.09375 | 3 | [] | no_license | <?php
/**
*
*
* @link ${GITHUB_URL} Source code
*/
namespace Sta\Entity;
abstract class AbstractQueryResult
{
public function __construct(array $initialData = array())
{
foreach ($initialData as $attr => $value) {
$this->set($attr, $value);
}
}
public functio... |
C++ | UTF-8 | 2,652 | 3.09375 | 3 | [] | no_license | #include "Vector.h"
#include "Vertex.h"
#include <vector>
#include <string>
#include <iostream>
#include <limits>
#include <assert.h>
#ifndef FACE_H
#define FACE_H
class Line{
public:
Line(){
m_StartPoint[3] = 1;
}
~Line(){;}
Vector4f getPoint(float _t) const{
Vector4f ret = m_StartPoint + m_Direction * ... |
Java | UTF-8 | 1,117 | 2.296875 | 2 | [] | no_license | package com.yl.myokgodemo.activity;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import com.yl.myokgodemo.R;
import com.yl.myokgodemo.global.App;
/**
* Description: 所以界面的基类
* Copyright : Copyright (c) 2017
* Author : yl
* Date : 2017/9/30
*/
p... |
C# | UTF-8 | 932 | 2.90625 | 3 | [] | no_license | static void Main(string[] args)
{
var path = Directory.EnumerateFiles(@"C:\Program Files (x86)\Stuff\Noodles", "*.config", SearchOption.AllDirectories);
foreach (var xmlfile in path)
{
var doc = XDocument.Load(xmlfile );
var endpointsToUpdate = doc
.Descendants("... |
Markdown | UTF-8 | 617 | 2.765625 | 3 | [] | no_license | # Dasher3D
Once a colleague of mine thought aloud "How would a 3D Boulder Dash game look like?". I thought to give a try...
To test, install .apk file (in Installable file folder) to your Android device. Then play with Daydream, Cardboard, or by just looking around with Magic Window option.
Object of the game: Find a... |
Markdown | UTF-8 | 723 | 2.59375 | 3 | [
"MIT"
] | permissive | ---
tags :
- JavaScript
---
[[Object.defineProperty]]
1. Proxy 的优势如下: Proxy 可以直接监听对象而非属性; Proxy 可以直接监听数组的变化;
Proxy 有多达 13 种拦截方法,不限于 apply、ownKeys、deleteProperty、has等等是Object.defineProperty 不具备的;
Proxy返回的是一个新对象,我们可以只操作新的对象达到目的,而Object.defineProperty 只能遍历对象属性直接修改;
Proxy 作为新标准将受到浏览器厂商重点持续的性能优化,也就是传说中的 新标准的性能红... |
Java | UTF-8 | 179 | 1.789063 | 2 | [] | no_license | package filepanel;
import java.awt.event.MouseEvent;
/**
* Created by andrey on 3/26/16.
*/
public interface FileViewPanel {
void createPanel();
void updatePanel();
}
|
C# | UTF-8 | 3,111 | 2.578125 | 3 | [] | no_license | using UnityEngine;
using System.Collections;
using System.Collections.Generic;
// 이벤트의 베이스 클래스.
public class EventBase {
protected GameObject data_holder;
// ================================================================ //
public EventBase() {}
public virtual void initialize() {}
public virtual void sta... |
JavaScript | UTF-8 | 985 | 3.078125 | 3 | [] | no_license | //create scene
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
const renderer = new THREE.WebGLRenderer();
renderer.setPixelRatio(window.devicePixelRatio);
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendCh... |
C++ | UTF-8 | 15,230 | 2.8125 | 3 | [] | no_license |
#include "TcpWebServer.h"
void main()
{
WSAData wsaData;
if (NO_ERROR != WSAStartup(MAKEWORD(2, 2), &wsaData))
{
cout << "Time Server: Error at WSAStartup()\n";
return;
}
SOCKET listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (INVALID_SOCKET == listenSocket)
{
cout << "Time Server: Error a... |
JavaScript | UTF-8 | 1,011 | 2.828125 | 3 | [] | no_license | export default function reducer(state={
markets: [],
fetching: false,
fetched: false,
error: null
}, action) {
switch(action.type) {
case "FETCH_MARKETS": {
return {...state, fetching: true}
}
case "FETCH_MARKETS_REJECTED": {
return {...state, fetching: false, error: action.payload}
}
case "FETCH_... |
JavaScript | UTF-8 | 2,058 | 2.671875 | 3 | [
"MIT"
] | permissive | var CONSTANT = require('./util').CONSTANT;
function User(socket) {
this.socket = socket;
this.id = socket.id;
this.name = 'rename';
this.rooms = {};
this.current = null;
}
// user life cycle management
User.prototype.setName = function(name) {
var cleanName = name.replace(/[^a-z0-9\s]/gi,'');
if (cleanName ... |
C# | UTF-8 | 1,566 | 2.53125 | 3 | [] | no_license | using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web.Http.Controllers;
using System.Web.Http.Filters;
using System.Web.Http.ModelBinding;
public sealed class ValidateActionParameters_WebApiActionFilterAttribute : ActionFilterAttribute
{
public override voi... |
Python | UTF-8 | 3,879 | 2.859375 | 3 | [
"MIT"
] | permissive | import numpy as np
import cv2
import matplotlib
import matplotlib.pyplot as plt
import urllib
def Box_Character(img):
# Import Photo
# path = r'Z:\caseyduncan\Casey Duncan\CSM Grad School Work\2019\Fall\CSCI 575B - Machine Learning\ML Project\Data\Data - Equations\eqn_test3.jpg'
# img = cv2.imread(path)
gray = cv2... |
Java | UTF-8 | 14,670 | 1.914063 | 2 | [
"Apache-2.0"
] | permissive | import com.kitfox.svg.SVGDiagram;
import com.kitfox.svg.SVGException;
import com.kitfox.svg.SVGUniverse;
import org.lwjgl.glg2d.GLGraphics2D;
import org.lwjgl.glg2d.GLUtils;
import org.lwjgl.glg2d.bridge.Lwjgl3GL2;
import org.lwjgl.opengl.GL;
import org.lwjgl.opengl.awt.AWTGLCanvas;
import org.lwjgl.opengl.awt.GLData;
... |
Python | UTF-8 | 1,735 | 3.296875 | 3 | [] | no_license | """This module content the Movie class definition
"""
import webbrowser
class Movie():
"""This class provides a way to store movie related information
This class was made to populate the fresh_tomatoes web page.
Every movie will have the basic information of the movie,
including a poster... |
C# | UTF-8 | 2,802 | 2.640625 | 3 | [] | no_license |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Trapper : Piece
{
public int minimumRange = 3;
public override List<Vector2Int> MoveLocations(Vector2Int gridPoint)
{
int usableMovementPoints;
List<Vector2Int> locations = new List<Vector2Int>();
... |
Python | UTF-8 | 3,755 | 3.75 | 4 | [
"MIT"
] | permissive | # This Script for generating Tables
# Steps:
# [1] Get The Table Title
# [2] Get The Table Cells width
# [3] Get The Table Column Names
# [4] Get The Table Cells Data
# ==========================================================
# Import Print Function
from __future__ import print_function
def ... |
Markdown | UTF-8 | 6,293 | 3.5625 | 4 | [] | no_license | 相信下面的代码很眼熟吧
```javascript
const a = '23333';
if (a === '23333' || a === '33333' || a === '43333' || a === '53333') {
console.log(1);
}
```
如果a的值有更多可能呢?或许可以这样写:
```javascript
const a = '23333';
const compare = ['23333', '33333', '43333', '53333']
if (compare.includes(a)) {
console.log(1);
}
```
有没有觉得好多了?实际... |
PHP | UTF-8 | 1,313 | 2.65625 | 3 | [] | no_license | <?php
session_start();
require("config.php");
$req =$bdd->prepare('SELECT * FROM users WHERE email= :email');
$req->execute(array(
'email' => $_POST['email']));
$result =$req->fetch();
if($result){
header('Location:index.php?error=1');
}
else{
if(isset($_POST['password']) AND $_POST['password'] == ... |
Java | UTF-8 | 79 | 1.90625 | 2 | [] | no_license | package prototype;
public interface MailSender {
void send(Mail mail);
}
|
Go | UTF-8 | 2,365 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | package keeper_test
import (
"testing"
"github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/stretchr/testify/require"
)
func TestGetLastTokenizeShareRecordId(t *testing.T) {
_, app, ctx := createTestInput(t)
lastTokenizeShareRecordID := app.StakingKeeper.GetLastTokenizeShareRecordID(ctx)
require.Equal(t,... |
Python | UTF-8 | 8,412 | 2.65625 | 3 | [] | no_license | import numpy
import torch
import torch.nn as nn
class ActorCriticDiscrete(nn.Module):
def __init__(self, hyperParameters):
super(ActorCriticDiscrete, self).__init__()
self.__device = hyperParameters.device
# actor mean range -1 to 1
self.__actorNet = nn.Sequential(
... |
C# | UTF-8 | 689 | 3.5 | 4 | [] | no_license | class ProductComparer : IEqualityComparer<Product>
{
public bool Equals(Product x, Product y)
{
if (ReferenceEquals(x, y)) return true;
if (ReferenceEquals(x, null) || ReferenceEquals(y, null)) return false;
return x.Code == y.Code && (x.Name.Equals(... |
C++ | UTF-8 | 3,002 | 3.453125 | 3 | [] | no_license | //#include <iostream>
//#include <string>
//#include <vector>
//#include <queue>
//
//using namespace std;
//
//struct TreeNode
//{
// int val;
// TreeNode* left;
// TreeNode* right;
// TreeNode(int x) : val(x), left(nullptr), right(nullptr)
// {
//
// }
//};
//
//void inorderTraversal(TreeNode* root,... |
JavaScript | UTF-8 | 1,207 | 2.5625 | 3 | [
"Unlicense"
] | permissive | const fs = require("fs");
const path = require("path");
const chalk = require("chalk");
const { newsFragmentsUserConfig } = require("../config");
const { checkFragmentsFolder } = require("../helpers");
const availableFragmentTypes = newsFragmentsUserConfig.fragmentsTypes.map(
function (el) {
return el.extension... |
Ruby | UTF-8 | 1,920 | 3.171875 | 3 | [] | no_license | #!/usr/bin/ruby
$dir = 'models'
$models = []
def file_to_obj(filename)
ret = {}
ret[:model] = {}
char = filename.scan(/[0-9][[0-9]*_]+[0-9]+.res$/)[0].split('_')
ret[:model][:neuron]=filename.scan(/\[.*\]/)[0][1..-2].split('_').map(&:to_i)
ret[:model][:eta] = char[-2].to_f / 10.0
ret[:model][:momentom] =... |
JavaScript | UTF-8 | 631 | 2.546875 | 3 | [] | no_license | const baseUrl = 'http://localhost:8080/api/v1'
export const getAllSongs = () => {
return fetch(baseUrl + '/playlist')
.then(res => res.json())
.catch(error => console.error(error));
}
export const postNewSong = (song) => {
return fetch(baseUrl + '/playlist', {
method: 'POST',
headers: {
'Con... |
Java | UTF-8 | 1,086 | 1.976563 | 2 | [
"MIT"
] | permissive | package oith.ws.dom.hcm.prl;
import oith.ws.dom.hcm.core.Period;
import javax.validation.constraints.NotNull;
import org.springframework.data.mongodb.core.mapping.Document;
import oith.ws.dom.core.AbstDocProcessAudit;
import oith.ws.dom.core.User;
import oith.ws.dom.hcm.pmis.Emp;
import org.springframework.dat... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.