language stringclasses 15
values | src_encoding stringclasses 34
values | length_bytes int64 6 7.85M | score float64 1.5 5.69 | int_score int64 2 5 | detected_licenses listlengths 0 160 | license_type stringclasses 2
values | text stringlengths 9 7.85M |
|---|---|---|---|---|---|---|---|
Python | UTF-8 | 3,771 | 3.046875 | 3 | [] | no_license | current_r, current_c, current_d = 7, 4, 0
current_room_map = [
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 1],
[1, 0, 0, 0, 1, 1, 1, 1, 0, 1],
[1, 0, 0, 1, 1, 0, 0, 0, 0, 1],
[1, 0, 1, 1, 0, 0, 0, 0, 0, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 1],
[1, 0, 0, 0, 0, 0, 0, 1, 0, 1],
[... |
Markdown | UTF-8 | 12,745 | 3.34375 | 3 | [] | no_license | ---
layout: post
title: "The Benefits of Proof of Work"
author: "Daniel Larimer"
categories: article
---
I have long been of the opinion that proof-of-stake is superior to proof-of-work. Today I would like to challenge my own beliefs against the lessons I have learned from over a year of experience with proof-of-stak... |
C# | UTF-8 | 1,472 | 2.796875 | 3 | [] | no_license | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class Unit : MonoBehaviour{
public int tileX;
public int tileZ;
public TileMap map;
int unitSpeed = 4;
public List<Node> currentPath = null;
void Update() {
if(currentPath != null) {
in... |
Markdown | UTF-8 | 1,779 | 2.859375 | 3 | [
"MIT"
] | permissive | ---
layout: essay
type: essay
title: Closed for maintenance
date: 2016-12-12
labels:
- Github
---
In my ICS 212 class that I took this last semester, we were forced to become familiar with something called SCCS. Simply put, SCCS is one of the predecessors to Github. The only difference is that it's Unix based and i... |
C# | UTF-8 | 469 | 3.171875 | 3 | [
"MIT"
] | permissive | using System.Collections.Generic;
namespace Aoc2018.Day15.Paths
{
public interface IGraph<T>
{
IEnumerable<T> GetVertexes();
IEnumerable<Neighbour<T>> GetNeighbours(T vertex);
}
public struct Neighbour<T>
{
public T Vertex { get; }
public int Distance { get; }
... |
C++ | UTF-8 | 391 | 3.46875 | 3 | [] | no_license | //calcular el diametro y area de un circulo donde se ingrese el radio.
#include <iostream>
using namespace std;
int main(){
int radio{0};
int diametro{0};
int area{0};
cout<<"Ingrese el radio de la circunferencia: "; cin>>radio;
diametro=2*radio;
area=3.14159*(radio*radio);
cout<<"El diamet... |
C++ | UTF-8 | 426 | 2.640625 | 3 | [] | no_license | #ifndef _Creature_H_
#define _Creature_H_
#include<iostream>
#include<string.h>
#include <stdlib.h>
class Creature{
public:
Creature(int whichid);
int getid();
int getdirect();
virtual void updateaction()=0;
virtual int getaction()=0;
virtual void updateage()=0;
virtual int getage()=0;
virtual int ge... |
Java | UTF-8 | 4,112 | 2.6875 | 3 | [] | no_license | package com.lambdaschool.congressdataapiaccess;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.HandlerThread;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import javax.net.ssl.Ht... |
C# | UTF-8 | 2,439 | 2.671875 | 3 | [] | no_license | using CSGProHackathonAPI.Shared.Models;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration.Conventions;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CSGProHackathonAPI.Shared.Data
{
public class Context : DbContext... |
Python | UTF-8 | 1,374 | 2.53125 | 3 | [] | no_license | #including the loss plot
niter = 1000
# losses will also be stored in the log
train_loss = np.zeros(niter)
scratch_train_loss = np.zeros(niter)
test_label= np.zeros(niter)
caffe.set_device(0)
caffe.set_mode_gpu()
# We create a solver that fine-tunes from a previously trained network.
solver = caffe.S... |
C# | UTF-8 | 684 | 2.546875 | 3 | [] | no_license | using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace SuperheroesUniverse.Models
{
public class Planet
{
public Planet()
{
this.Countries = new HashSet<Country>();
this.Fractions = ne... |
JavaScript | UTF-8 | 1,702 | 2.640625 | 3 | [
"MIT"
] | permissive | import { Text } from "@pixi/text";
import { ClientPacket } from "../network/Packets";
import { game } from "../OinkyParty";
import { titleColor } from "../Screen";
import { GameScreen } from "./GameScreen";
class AddCounterPacket extends ClientPacket {
constructor() {
super("counterGame-addCounter");
}... |
Markdown | UTF-8 | 1,011 | 2.640625 | 3 | [
"MIT"
] | permissive | # TG Session - Telegram Session Generator
<a aria-label="npm downloads" href="https://www.npmjs.com/package/tgsession">
<img alt="" src="https://img.shields.io/npm/dw/tgsession.svg?label=NPM%20Downloads&style=for-the-badge&labelColor=000000">
</a>
<a aria-label="License" href="https://github.com/Gowtham2003/tgsess... |
Shell | UTF-8 | 1,769 | 3.34375 | 3 | [] | no_license | #!/bin/bash
setenforce 0
sed -r -i 's/SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config
# using this instead of "rpm -Uvh" to resolve dependencies
function rpm_install() {
package=$(echo $1 | awk -F "/" '{print $NF}')
wget --quiet $1
yum install -y ./$package
rm -f $package
}
release=$(awk -F \: '{p... |
C# | UTF-8 | 829 | 3.34375 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace TweetsieTrailGame
{
class ConsoleInputReader: ITextInputReader
{
public ConsoleInputReader() { }
public void waitForKeyPress()
{
Console.ReadKey(true);
}
public... |
Shell | UTF-8 | 3,687 | 3.203125 | 3 | [] | no_license | #######################################################
# Harry Kim .bashrc file
#######################################################a
FULL_NAME="Harry Kim"
EMAIL="hkim@securitycompass.com"
GIT_BASE="${HOME}"
# On mac we use vim installed with Cellar/Brew
# We also want to change the default Java if present
if [ `e... |
JavaScript | UTF-8 | 7,678 | 2.609375 | 3 | [] | no_license | import React from 'react'
import { Image, Transformation, CloudinaryContext } from 'cloudinary-react'
import { setAnswer, setImageToAsk, setWrongAnswerOptions, setWrongImageOptions } from '../reducers/gameReducer'
import { setMessage } from '../reducers/messageReducer'
import { setScoreFlash } from '../reducers/scoreFl... |
Java | UTF-8 | 1,800 | 2.484375 | 2 | [] | no_license | package com.codingame.game.utils.input;
import com.codingame.game.utils.input.ActionInput;
import com.codingame.game.utils.input.ElementInput;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.lang.reflect.AccessibleObject;
import java.util.List;
import java.util.stream.Collectors;
@JsonIgnor... |
Python | UTF-8 | 484 | 2.546875 | 3 | [] | no_license | def findWarpPathLength(train, test):
maxThetaTrain = -1
maxThetaTest = -1
for i in range(len(train)):
if(maxThetaTrain < abs(train[i])):
maxThetaTrain = abs(train[i])
for i in range(len(test)):
if (maxThetaTest < abs(test[i])):
maxThetaTest = abs(test[i])
m... |
Java | UTF-8 | 362 | 1.632813 | 2 | [] | no_license | package com.pengwl.dubborpc.web;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* Created by SEELE on 2017/3/24.
*/
@SpringBootApplication
public class WebApplication {
public static void main(String [] args){
SpringApplicatio... |
Java | GB18030 | 444 | 3.109375 | 3 | [] | no_license | package shuzu;
public class һЧanݵ㷨 {
public static void main(String[] args) {
int res = f(2,5);
System.out.println(res);
}
private static int f(int a, int n) {
int res=1;
for(int i = 0; i < n; i++) {
res*=a;
}
return res;
}
private static int f1(int a, int n) {
if(n==0) return 1;
int res = a;
int ex = ... |
Java | UTF-8 | 2,044 | 2.078125 | 2 | [] | no_license | package com.example.ajira;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.example.aji... |
Java | UTF-8 | 796 | 3.515625 | 4 | [] | no_license | package ControlFlow;
/**
* Created by LynnTeng on 2019/3/13.
*/
public class SwitchInChar {
public static void main(String[] args) {
char letter = 'C';
switch (letter) {
case 'A':
System.out.println(letter + " is found");
break;
case 'B':
... |
Java | UTF-8 | 3,663 | 2.109375 | 2 | [] | no_license | package pl.app.service;
import hg.common.util.SysProperties;
import hg.common.util.file.FdfsFileInfo;
import hg.service.image.command.image.CreateImageCommand;
import hg.service.image.pojo.dto.ImageDTO;
import hg.service.image.pojo.dto.ImageSpecDTO;
import hg.service.image.pojo.exception.ImageException;
import... |
C++ | UTF-8 | 859 | 2.65625 | 3 | [] | no_license | #include "ai.h"
QList<Ai*> Ai::allAis = QList<Ai*>();
int Ai::selectedAiIndex = 0;
int Ai::getBalance() const
{
return balance;
}
void Ai::setBalance(int value)
{
balance = value;
}
QList<Ai *> Ai::getAllAis()
{
return allAis;
}
int Ai::getSelectedAiIndex()
{
return selectedAiIndex;
}
void Ai::set... |
Java | UTF-8 | 5,503 | 2 | 2 | [] | no_license | package com.cylan.jiafeigou.n.mvp.impl.bind;
import com.cylan.ex.JfgException;
import com.cylan.jiafeigou.cache.db.module.Device;
import com.cylan.jiafeigou.misc.JError;
import com.cylan.jiafeigou.n.base.BaseApplication;
import com.cylan.jiafeigou.n.mvp.contract.bind.SetDeviceAliasContract;
import com.cylan.jiafeigou.... |
Java | UTF-8 | 575 | 2.296875 | 2 | [] | no_license | package com.generic.com;
import org.testng.Assert;
import io.restassured.RestAssured;
import io.restassured.response.Response;
public class DeleteAPI {
public Response deleteData(String url) {
Response response = RestAssured.delete(url);
return response;
}
public void validateStatusCode(Response response, i... |
Ruby | UTF-8 | 1,627 | 3.140625 | 3 | [] | no_license | require_relative 'test_helper'
class EnigmaTest < Minitest::Test
def test_it_exists
enigma = Enigma.new
assert_instance_of Enigma, enigma
end
def test_encrypt_method_returns_hash_with_keys
enigma = Enigma.new
result = enigma.encrypt('hello', '02715', '040895')
assert_equal '02715', result[:k... |
Python | UTF-8 | 3,018 | 4.1875 | 4 | [] | no_license | #!/usr/bin/python3
from typing import List
"""
Task 3 - 62%
An industrial company has N factories, each producing some pollution every month.
The company has decided to reduce its total fume emissions by equipping some
factories with one or more filters.
Every such filter reduces the pollution of a factory by half... |
C# | UTF-8 | 619 | 3.015625 | 3 | [
"MIT"
] | permissive | using System;
namespace DotNetTask.Data
{
public class Owner
{
public string FirstName { get; }
public string LastName { get; }
private Owner(string firstName, string lastName)
{
FirstName = firstName;
LastName = lastName;
}
public stat... |
C | UTF-8 | 156 | 2.90625 | 3 | [] | no_license | #include<stdio.h>
#include<conio.h>
void main()
{
int a=0,b=1,c;
printf("the values are %d%d",a,b);
for(i=3;i=n;i++)
{
c=a+b;
a=b;
b=c;
printf("%d",c);
}
}
|
Shell | UTF-8 | 647 | 3.265625 | 3 | [] | no_license | #!/bin/bash -e
# Take from the trace.vcd file (passed as argument)
# only the lines of outgoing and incoming packets
# (read README.txt for details).
if [ $# != 1 ]; then
echo "Tracan - Trace Analyzer"
echo "Usage:"
echo " tracan <VCDFILE>"
echo ""
exit 1
fi
# VCD symbols as defined in tracan.h
#const... |
C++ | UTF-8 | 1,773 | 2.765625 | 3 | [] | permissive | // This file is part of CAF, the C++ Actor Framework. See the file LICENSE in
// the main distribution directory for license terms and copyright or visit
// https://github.com/actor-framework/actor-framework/blob/master/LICENSE.
#pragma once
#include <cstdint>
#include <limits>
#include <string>
#include "caf/behavi... |
Shell | UTF-8 | 742 | 3.34375 | 3 | [
"BSD-3-Clause"
] | permissive | #!/bin/bash
die_if_error()
{
local err=$?
if [ "$err" != "0" ]; then
echo "$*"
exit $err
fi
}
filerpermission()
{
mkdir -p /data/data
die_if_error "Error creating data dir"
mkdir -p /data/logs
die_if_error "Error creating logs dir"
chown redis:redis /da... |
C++ | UTF-8 | 1,732 | 2.78125 | 3 | [] | no_license | #include <stdio.h>
#include <cstring>
#include <queue>
#include <utility>
using namespace std;
int N;
int arr[101][101];
int visit[101][101];
int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};
void DFS(int x, int y, int cnt)
{
visit[x][y]=0;
arr[x][y]=cnt;
for(int i=0;i<4;i++)
{
int ddx=x+dx[i];
int ddy=y+dy[i];
if(... |
PHP | UTF-8 | 530 | 2.609375 | 3 | [
"MIT"
] | permissive | <?php
namespace Fire\Business\Api;
use Fire\Business\Api;
use Fire\Business\ListResource;
class BankTransferList extends ListResource {
public function __construct(Api $api, $batchId) {
parent::__construct($api);
$this->solution = array(
'batchId' => $batchId,
);
$this->uri = "v1/batches/$batchId/bank... |
JavaScript | UTF-8 | 1,059 | 2.625 | 3 | [] | no_license | var faker = require('faker')
var fs = require('fs')
var execa = require('execa')
var init = `DROP DATABASE IF EXISTS api_development;
CREATE DATABASE api_development;
\\c api_development;
CREATE TABLE entries (
ID SERIAL PRIMARY KEY,
title VARCHAR,
content VARCHAR,
image VARCHAR,
created_at TIMESTAMP witho... |
Python | UTF-8 | 120 | 2.75 | 3 | [] | no_license | def pingsweep(ip_addr):
print('Performing ping sweep with ttl {}'.format(ip_addr))
def set_ttl(ttl):
print(ttl) |
Java | UTF-8 | 4,286 | 2.109375 | 2 | [] | no_license | package com.invenio.domain;
// Generated May 4, 2013 11:37:21 PM by Hibernate Tools 3.4.0.CR1
import java.math.BigDecimal;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
impo... |
Go | UTF-8 | 1,904 | 2.9375 | 3 | [
"MIT"
] | permissive | package kinetic
import (
"testing"
"time"
"github.com/aws/aws-sdk-go/aws"
. "github.com/smartystreets/goconvey/convey"
)
func TestShardIterator(t *testing.T) {
Convey("given a new shard iterator", t, func() {
it := NewShardIterator()
Convey("check that the default shard iterator type is TRIM_HORIZON", fun... |
Ruby | UTF-8 | 1,303 | 2.796875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env ruby
# This script looks for the right Tiled2Unity unitypackage file and packs it into the Tiled2UnityMac solution to be distributed
require 'nokogiri'
require 'FileUtils'
def get_version()
# Open the Info.plist file to find out what version of Tiled2UnityMac we should be building
plist = File.r... |
Java | UTF-8 | 946 | 1.703125 | 2 | [] | no_license | package com.payment.service.impl;
import com.cjy.common.entity.Payment;
import com.payment.Payment8001;
import com.payment.service.PaymentService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.Spring... |
Markdown | UTF-8 | 12,336 | 2.96875 | 3 | [] | no_license | # Runtime
推荐文档:
+ [iOS Runtime详解](https://www.jianshu.com/p/6ebda3cd8052)
+ [Objective-C 的 Runtime](http://www.samirchen.com/objective-c-runtime/)
大神系列文章:
+ [神经病院 Objective-C Runtime 出院第三天——如何正确使用 Runtime](http://halfrost.com/how_to_use_runtime/)
+ [神经病院 Objective-C Runtime 住院第二天——消息发送与转发](http://halfrost.com/obj... |
C# | UTF-8 | 502 | 2.765625 | 3 | [] | no_license | using UnityEngine;
using System.Collections;
/**
* Basic math operations.
*/
public static class MyStaticLibrary {
public static System.Random random = new System.Random();
public static float GetDistance(GameObject a, GameObject b) {
Vector3 directionToB = b.transform.position - a.transform.position;
r... |
Java | UTF-8 | 8,008 | 2.046875 | 2 | [
"MIT"
] | permissive | package com.platypii.baseline.views.tracks;
import android.util.Log;
import com.platypii.baseline.Intents;
import com.platypii.baseline.R;
import com.platypii.baseline.Services;
import com.platypii.baseline.tracks.TrackFile;
import com.platypii.baseline.tracks.TrackMetadata;
import com.platypii.baseline.tracks.TrackSe... |
Java | UTF-8 | 2,321 | 2.140625 | 2 | [] | no_license | /*
* #%L
* Excel Report Format Application
* %%
* Copyright (C) 2016 - 2018 Emu Data Services
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licen... |
Shell | UTF-8 | 406 | 2.609375 | 3 | [
"MIT"
] | permissive | #!/bin/sh
while true; do
sleep 10
flask deploy
if [[ "$?" == "0" ]]; then
echo Deploy success
break
fi
echo Deploy command failed, retrying in 10 secs...
done
# nohup flask build index > /dev/null 2>&1 &
flask build index
# nohup flask build similarity > /dev/null 2>&1 &
flask bui... |
Java | UTF-8 | 186 | 1.59375 | 2 | [] | no_license | package eu.skillguard.web.gui.components;
import com.haulmont.cuba.gui.components.Component;
public interface DirectoryUpload extends Component {
String NAME = "directoryUpload";
} |
Python | UTF-8 | 469 | 3.171875 | 3 | [] | no_license | """
To check whether givan tree is a balanced tree or not
"""
def balance_soltuion(root):
if root is None:
return 0
left = balance_soltuion(root.left)
if left==-1: return -1
right = balance_soltuion(root.right)
if right==-1: return -1
if abs(left - right) > 1: return -1
return m... |
Java | UTF-8 | 3,271 | 3.46875 | 3 | [] | no_license | //Spencer Neveux
// IPI
// CECS 277
// 9/27/18
public class Cookie extends DessertItem {
private int number;
private int pricePerDozen;
private int calories;
private int cost;
/**
* Null Constructor for cookie
*/
public Cookie(){
this("", 0, 0);
}
/**
* Overload... |
Markdown | UTF-8 | 1,941 | 3.390625 | 3 | [
"MIT"
] | permissive | # Creating a new Use Case
A use case represents an action in the system. These use cases orchestrate the flow of data to and from the entities,
and direct those entities to use their enterprise wide business rules to achieve the goals of the use case.
It can be a mutation of the state or a query but not both in a CQRS... |
Java | UTF-8 | 864 | 1.8125 | 2 | [] | no_license | package com.yiziton.dataweb.waybill.vo;
import lombok.Data;
/**
* 仓储枢纽-外发货量 VO
*/
@Data
public class OutDeliveryVolumeVO {
/**
* 外发网点
*/
private String operationOganization;
/**
* 当天外发时间
*/
private String today;
/**
* 当天外发总费用
*/
private String todayOutDeliverCos... |
Java | UTF-8 | 2,162 | 2.171875 | 2 | [] | no_license | package com.ruczajsoftware.workoutrival.config;
import com.arangodb.ArangoDB;
import com.arangodb.ArangoDatabase;
import com.arangodb.entity.CollectionEntity;
import com.arangodb.springframework.annotation.EnableArangoRepositories;
import com.arangodb.springframework.config.ArangoConfiguration;
import org.springframew... |
Markdown | UTF-8 | 5,887 | 3.5 | 4 | [
"MIT"
] | permissive | # Joystick Features
(Note: this post is mainly based off a paper from [this](https://www.chiefdelphi.com/t/joystick-scaling-deadband/355153) forum post.)
Once again, 1257 generally uses Xbox controllers to interact with a robot. One is pictured below.
;
const { Command } = require('commander');
const low = require('lowdb');
const FileSync = require('lowdb/adapters/FileSync');
const program = new Command();
program.version('0.0.1');
const adapter = new FileSync('parallel.json')
const db = low(adapter)
// Set some d... |
C# | UTF-8 | 5,549 | 2.5625 | 3 | [] | no_license | namespace UnitTestsOfCountdown.Tests.BLL
{
using System;
using System.Collections.Generic;
using CountdownBusinessLogic;
using CountdownBusinessLogic.Service;
using CountdownDataBaseLayer;
using CountdownDataBaseLayer.Repo;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using Transfer;
u... |
Java | UTF-8 | 684 | 3.390625 | 3 | [
"MIT"
] | permissive | /**
* Definition for a binary tree node.
* public class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode(int x) { val = x; }
* }
*/
//recursive
public class Solution {
public boolean isValidBST(TreeNode root) {
return isValid(root, null, null);
}
private b... |
Markdown | UTF-8 | 1,958 | 2.890625 | 3 | [] | no_license | Unity gain frequency = $12MHz$
non-inverting amplifier
Calculate closed loop 3-dB bandwidth for the amplifier if the ideal gain is $A_{IDEAL}=10$ (assume $A_0=1_E6$)
$$
A_{CL}={{A_{IDEAL}\over1+{k_n\over A_0}}\over 1+j({fk_n\over B(1+{k_n\over A_0})})}\\
closedloop\ 3dB\ bandwidth={B\over k_n}\\
noninverting\ \ther... |
C# | UTF-8 | 1,200 | 3.140625 | 3 | [
"MIT"
] | permissive | using System;
using System.Numerics;
using System.Runtime.CompilerServices;
namespace Box2D.NetStandard.Common
{
public struct Rot
{
/// Sine and cosine
internal float s;
/// Sine and cosine
internal float c;
/// Initialize from an angle in radians
[MethodImpl(... |
Java | UTF-8 | 1,127 | 2.65625 | 3 | [] | no_license | package edu.byuh.byuhtest.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import edu.byuh.byuhtest.model.Student;
import edu.byuh.byuhtest.repo.StudentRepo;
@Service
public class StudentService {
@Autowired
private Stu... |
Markdown | UTF-8 | 2,559 | 3.75 | 4 | [
"MIT"
] | permissive | # 1366. Rank Teams by Votes
Difficulty: Medium
https://leetcode.com/problems/rank-teams-by-votes/
In a special ranking system, each voter gives a rank from highest to lowest to all teams participated in the competition.
The ordering of teams is decided by who received the most position-one votes. If two or more tea... |
Ruby | UTF-8 | 8,077 | 2.546875 | 3 | [
"MIT"
] | permissive | require "spec_helper"
describe Mongoid::Extensions::ObjectId::Conversions do
let(:object_id) do
BSON::ObjectId.new
end
let(:composite_key) do
"21-jump-street"
end
describe ".convert" do
context "when the class is using object ids" do
context "when provided a single object id" do
... |
Python | UTF-8 | 301 | 3.9375 | 4 | [] | no_license | """
--检测数据类型-- type(数据)
"""
num1 = 1
num2 = 1.1
a = 'hello world'
b = True
print(type(num1))
print(type(num2))
print(type(a))
print(type(b))
c = [10, 20, 30]
d = (10, 20, 30)
e = {10, 20, 30}
f = {'name': 'Tom', 'age': 18}
print(type(c))
print(type(d))
print(type(e))
print(type(f)) |
JavaScript | UTF-8 | 875 | 3.703125 | 4 | [] | no_license | var moviename = "Avengers";
var movierating = 4.5
var movielang = "Eng"
var moviename1 = "Jab We Met";
var movierating1 = 4.7
var movielang1 = "Hindi"
var movies = {
name:'Avengers',
rating:4.5,
lang:'Eng'
}
undefined
typeof(movies)
"object"
movies.name
"Avengers"
movies.rating
4.5
movies.type="Action"
"... |
Python | UTF-8 | 1,041 | 2.71875 | 3 | [] | no_license | from django.db import models
class Categoria(models.Model):
nome = models.CharField(max_length=30, verbose_name="Nome")
class Meta:
vebose_name = "Categoria"
vebose_name_plural = "Categorias"
def _str_(self):
return self.nome
class Produto(models.Model):
LITROS = "LT"
... |
Java | UTF-8 | 1,136 | 4.09375 | 4 | [] | no_license | package Offer;
import java.util.Stack;
public class Offer_04 {
public static void main(String[] args) {
//初始化一个大小为4的队列
Solution solution = new Solution();
solution.push(1);
solution.push(2);
solution.push(3);
solution.push(4);
System.out.println(solution.pop... |
Java | UTF-8 | 558 | 2.28125 | 2 | [] | no_license | package com.nt.test;
import com.nt.dao.EmployeeDao;
import com.nt.dao.EmployeeDaoFactory;
import com.nt.utility.mysql_HibernateUtil;
import com.nt.utility.oracle_HibernateUtil;
public class TwoDBsTest {
public static void main(String[] args) {
EmployeeDao dao=null;
//Get Dao
dao=Em... |
Java | UTF-8 | 360 | 2.609375 | 3 | [] | no_license | package com.snayi.choose;/**
*
*/
/**
* @auther SNAYi
*@describe
* @date 2019/6/26 下午 03:23
*/
public class Title6 {
private float f = 1.0f;
int m =12;
static int n =1;
public static void main(String[] args) {
Title6 title6 = new Title6();
// title6.f = 1.0;
// this.n;
... |
Java | UTF-8 | 1,120 | 2.609375 | 3 | [] | no_license | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package memorama;
import java.io.File;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import jav... |
Java | UTF-8 | 3,218 | 2.375 | 2 | [] | no_license | package com.example.tp1_app2;
import androidx.appcompat.app.AppCompatActivity;
import androidx.constraintlayout.widget.ConstraintLayout;
import android.app.SearchManager;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.... |
Java | UTF-8 | 2,604 | 2.484375 | 2 | [] | no_license | package ir.coursio.notes.model;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.util.Log;
import ir.coursio.notes.AddDrawingActivity;
import ir.coursio.notes.AddNoteActivity;
import ir.coursio.notes.App;
import ir.coursio.notes.model.db.DataContract;
import ir.coursi... |
Java | UTF-8 | 320 | 1.9375 | 2 | [
"Apache-2.0"
] | permissive | package krati.core;
/**
* InvalidStoreConfigException
*
* @author jwu
* @since 06/25, 2011
*
*/
public class InvalidStoreConfigException extends RuntimeException {
private static final long serialVersionUID = 1L;
public InvalidStoreConfigException(String message) {
super(message);
}
}
|
Java | UTF-8 | 445 | 1.632813 | 2 | [] | no_license | package com.example.lettuce;
import io.lettuce.core.RedisClient;
import io.lettuce.core.api.StatefulRedisConnection;
import io.lettuce.core.api.sync.RedisCommands;
import java.util.concurrent.CompletableFuture;
public class RedisCli {
public static RedisClient redisClient = RedisClient
.create("redis://@192.1... |
Markdown | UTF-8 | 6,515 | 2.53125 | 3 | [] | no_license | In `src/serviceworker.js` we need to save access to the service worker registration here. Set `global.registration = registration`.
#### src/servicewroker.js
```js
function registerValidSW(swUrl, config) {
navigator.serviceWorker
.register(swUrl)
.then(registration => {
global.registration = registra... |
Markdown | UTF-8 | 898 | 3.796875 | 4 | [] | no_license | [179.largest-number](https://leetcode.com/problems/largest-number/)
Given a list of non negative integers, arrange them such that they form the largest number.
**Example 1:**
**Input:** `[10,2]`
**Output:** "`210"`
**Example 2:**
**Input:** `[3,30,34,5,9]`
**Output:** "`9534330"`
**Note:** The re... |
Ruby | UTF-8 | 716 | 3.1875 | 3 | [] | no_license | require './lib/transaction.rb'
class Bank
def initialize(transaction_class=Transaction)
@transaction_class = transaction_class
end
def deposit(account, amount)
fail 'You cannot deposit a negative amount' if amount < 0
transaction = @transaction_class.new(amount, DateTime.now)
account.process_transa... |
C# | UTF-8 | 1,123 | 2.828125 | 3 | [] | no_license | using System;
using LiteNetLib;
namespace Exanite.Arpg.Networking.Server
{
/// <summary>
/// Arguments for server PeerDisconnected events
/// </summary>
public class PeerDisconnectedEventArgs : EventArgs
{
private readonly NetPeer peer;
private readonly DisconnectInfo disconnectInf... |
C++ | UTF-8 | 701 | 3.421875 | 3 | [] | no_license | #include "queue.hpp"
#include <iostream>
using namespace std;
void dump_queue(Queue<int>& q) {
cout << "queue dump: ";
while (!q.empty()) {
cout << q.dequeue() << " ";
}
cout << endl;
}
int main(int argc, char* args[]) {
Queue<int> q(3);
q.enqueue(1);
q.enqueue(2);
q.enqueue(... |
PHP | UTF-8 | 1,253 | 2.5625 | 3 | [
"MIT"
] | permissive | <?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\DB;
use App\Courses;
class CoursesController extends Controller
{
public function check() {
if (Session::has('user_id')) {
$courses = DB::select('select * from cou... |
Python | UTF-8 | 9,554 | 2.8125 | 3 | [] | no_license | """
here i'll load my matlab shape ctxt data (r, theta, phi) and try to run it through a siamese network
"""
import numpy as np
import pandas as pd
from scipy.io import loadmat, savemat
def get_shape_data(train_pct):
# total length of data should be 2* (24,000 + 46,000) = 140,000
src = '/home/nripesh/Dr... |
Markdown | UTF-8 | 1,556 | 2.59375 | 3 | [] | no_license | # Asciinate

## Description
fast transformation of grayscale and rgb images into custom ascii letters
support for youtube stream (not all videos are working)
## Usage
0) have python >= 3.6
1) install requirements (virtualenv)
```bash
pip instal... |
C++ | UTF-8 | 1,330 | 2.84375 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
bool reversecompare(int a, int b)
{
return a > b;
}
struct newchar
{
char strng[20];
char newstrng[20];
string final = "";
};
bool newcompare(newchar a, newchar b)
{
return a.final < b.final;
}
int main ()
{
ios::sync_with_st... |
Java | UTF-8 | 2,489 | 1.992188 | 2 | [
"Apache-2.0"
] | permissive | package com.sv.mc.controller;
import com.sv.mc.alipay.AliPayConfig;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.Htt... |
Markdown | UTF-8 | 3,201 | 2.5625 | 3 | [
"CC-BY-4.0",
"MIT"
] | permissive | ---
title: "Предложение Let (Visual Basic) | Microsoft Docs"
ms.date: "2015-07-20"
ms.prod: ".net"
ms.reviewer: ""
ms.suite: ""
ms.technology:
- "devlang-visual-basic"
ms.topic: "article"
f1_keywords:
- "vb.QueryLet"
dev_langs:
- "VB"
helpviewer_keywords:
- "Let - предложение"
- "Let - опер... |
Markdown | UTF-8 | 8,541 | 3.078125 | 3 | [
"Apache-2.0"
] | permissive | # Scaling event based system using containers
This article talks about an approach to scale SQS consumers that are deployed in container-based ecosystem using ECS
# Introduction
In most cases, AWS Lambda can effectively process all the messages in SQS, but you may need to consider using an EC2 instance or ECS servic... |
JavaScript | UTF-8 | 5,197 | 2.546875 | 3 | [] | no_license | function myFunc(){
alert("test");
alert(document.getElementById("Variables1").value);
}
var nPartons = document.getElementById("versusNpartons");
var datumMHT = {
label: "MHT",
fill: false,
lineTension: .1,
backgroundColor: "rgba(75,192,192,0.4)",
... |
Python | UTF-8 | 9,630 | 4.03125 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# # Question 1
# Given a linked list of N nodes such that it may contain a loop. A loop here means that the last node of the link list is connected to the node at position X(1-based index). If the link list does not have any loop, X=0. Remove the loop from the linked list, if it ... |
C++ | UTF-8 | 796 | 2.609375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
int main()
{
int n, arr[20][20], mid, result = 2e9;;
cin >> n;
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
cin >> arr[i][j];
vector<int> v;
mid = n / 2;
for (int i = 0; i < mid; i++) v.push_back(0);... |
Python | UTF-8 | 6,817 | 2.53125 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
"""Collect up the functons used in all the weeks."""
from colorama import Fore
from colorama import Style
import inspect
import os
def test(testResult, name):
if testResult:
print(Fore.GREEN + "✔ " + name + Style.RESET_ALL)
return 1
else:
print(Fore.RED + "✘ " +... |
PHP | UTF-8 | 5,507 | 2.703125 | 3 | [
"MIT"
] | permissive | <?php
namespace App\Models;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Model;
use Laravel\Scout\Searchable;
use App\Traits\Orderable;
use Storage;
//there are a more effective way to stream videos from a content delivery network, AWS has something called cloudfront which would ... |
SQL | UTF-8 | 1,765 | 3.5625 | 4 | [] | no_license | CREATE TABLE WORLD(
WORLD_ID INT PRIMARY KEY NOT NULL,
STATUS VARCHAR(10) NOT NULL
);
CREATE TABLE INSEQNUM(
ID BIGINT PRIMARY KEY NOT NULL,
WORLD_ID INT NOT NULL REFERENCES WORLD(WORLD_ID),
PRIMARY KEY(ID, WORLD_ID)
);
CREATE TABLE OUTSEQNUM(
ID BIGSERIAL NOT NULL,
TYPE INT,
TRUCK_ID INT,
WH_ID INT,
PACKAGE_ID INT,
... |
Markdown | UTF-8 | 1,974 | 3.015625 | 3 | [] | no_license | # CodePath Pre-work - *Simple ToDo*
**Simple Todo** is an android app that allows building a todo list and basic todo items management functionality including adding new items, editing and deleting an existing item.
Submitted by: Aishwarya Pothula
Time spent: 10-12 hours spent in total
##User Stories
The following *... |
JavaScript | UTF-8 | 1,913 | 3 | 3 | [
"MIT"
] | permissive | import React, { PropTypes } from 'react'
import { addIndex, contains, flatten, isEmpty, map } from 'ramda'
// Let's move our game utility functions out to another file to keep
// the board file clean and focused on react
import { getBoard, getWins } from '../utilities/game'
import Square from './square.jsx'
// Ramd... |
Markdown | UTF-8 | 353 | 3.046875 | 3 | [] | permissive | > The correct answer is _r=202.0!_.
> The first thing that is executed is the multiplication as it is enclosed by braces: _5 * 4_ gives _20_.
> As there are no other braces, execution proceeds now from the left to the right.
> First thing we see is a String, _r=_ => thus all further _+_ are interpreted as String ... |
PHP | UTF-8 | 337 | 2.625 | 3 | [] | no_license | <?php
class SessionListener extends RequestListener{
public function run() {
$options = new SessionSecurityOptions();
$options->setExpiredTime(time() + 3600 * 24 * 1); // 1 day
$session = $this->request->getSession();
if(!$session->isStarted()) {
$session->start();
... |
C# | UTF-8 | 1,122 | 2.59375 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Modelo;
using System.Data.SqlClient;
using System.Linq.Expressions;
namespace Controller
{
public class ControllerAutenticacion
{
private PaslumBaseDatoDataContext contexto = new P... |
JavaScript | UTF-8 | 2,467 | 4.125 | 4 | [] | no_license | //object literal
// [] array
//{}
const person={
name:"Colin",
age:30,
student:true,
birthday:function(){
return new Date().getFullYear()-this.age;
}
}
console.log(person.birthday());
//object constructor
class Task{
constructor(name,priority){
this.name=name;
this.pri... |
Ruby | UTF-8 | 395 | 3.515625 | 4 | [] | no_license | # Tags Count Instances Complex Homework Lookup Help
# http://carol-nichols.com/2015/08/07/ruby-occurrence-couting/
# many ways to skin this cat
My solution
def count(array)
array.uniq.map { |x| [x, array.count(x)] }.to_h
end
other solutions
def count(array)
c = Hash.new(0)
array.each { |i| c[i] += 1 }
c
end... |
Java | UTF-8 | 387 | 1.835938 | 2 | [] | no_license | package com.heaptrip.web.model.profile;
public class CommunityInfoModel extends AccountInfoModel {
private CommunityProfileModel communityProfile;
public CommunityProfileModel getCommunityProfile() {
return communityProfile;
}
public void setCommunityProfile(CommunityProfileModel communityPr... |
JavaScript | UTF-8 | 512 | 2.765625 | 3 | [
"CC-BY-4.0"
] | permissive | var side = document.getElementById("side");
var license = document.getElementById("license");
var open = document.getElementById("open-side");
function closeMenu() {
open.innerHTML = ">";
license.style.display = "none";
side.style.width = "0%";
}
open.addEventListener("click", function(e) {
e.preventDefault();... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.