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 |
|---|---|---|---|---|---|---|---|
Java | UTF-8 | 738 | 3.09375 | 3 | [] | no_license | package graph;
import java.util.Comparator;
public class Edge {
int startIndex;
int endIndex;
int weight;
public Edge(int startIndex, int endIndex, int weight) {
this.startIndex = startIndex;
this.endIndex = endIndex;
this.weight = weight;
}
public int getWeight() {... |
Python | UTF-8 | 4,370 | 2.8125 | 3 | [] | no_license | import statistics
import numpy as np
import simpy
import random
import matplotlib.pyplot as plt
from tabulate import tabulate
random.seed(123)
interarrival_frequency = [
[5, 1],
[6, 3],
[7, 6],
[8, 7],
[9, 9],
[10, 10],
[11, 11],
[12, 11],
[13, 1... |
Markdown | UTF-8 | 1,381 | 2.890625 | 3 | [
"MIT"
] | permissive | # BrainRust: an x86_64 BrainFuck JIT in Rust
BrainRust is an interpreter and JIT for the [BrainFuck][bf] programming language. The interpreter is
available on all platforms supported by Rust, while the JIT is for x86_64 only. It performs high-level
optimizations that provide a 3x increase in performance for both JIT a... |
Python | UTF-8 | 310 | 3.015625 | 3 | [] | no_license | #!/usr/bin/env python
import sys
lines = sys.stdin.readlines()
if 0 < len(lines):
m = int(lines[0].split()[4])
p = 0
i = 0
while i < len(lines):
if m < int(lines[i].split()[4]):
p = i
m = int(lines[i].split()[4])
i = i + 1
print " ".join(lines[p].split()[5:])
|
PHP | UTF-8 | 2,311 | 2.578125 | 3 | [
"MIT"
] | permissive | <?php
namespace Feft\AddressBundle\Tests;
use Feft\AddressBundle\Entity\Country;
use Feft\AddressBundle\Entity\Locality;
use Feft\AddressBundle\Entity\Region;
class RegionTest extends \PHPUnit_Framework_TestCase
{
public function testSettersAndGetters()
{
$region = new Region();
$region->set... |
Swift | UTF-8 | 3,237 | 2.9375 | 3 | [
"Apache-2.0"
] | permissive | //
// File.swift
// FlatbufferSwift
//
// Created by Veasna Sreng on 2/14/17.
//
//
import Foundation
// Data extension helper
extension Data {
public func get<T>(at: Int, withType: T.Type) -> T? {
let numberOfByte = at + MemoryLayout<T>.stride
if count <= numberOfByte || numberOfByte < 1... |
Swift | UTF-8 | 2,503 | 2.84375 | 3 | [
"MIT"
] | permissive | //
// DistinctTests.swift
// DBBBuilder-Demo-OSXTests
//
// Created by Dennis Birch on 3/5/19.
// Copyright © 2019 Dennis Birch. All rights reserved.
//
import XCTest
@testable import DBBBuilder
class DistinctTests: XCTestCase {
var dbManager: DBBManager?
override func setUp() {
super.setUp(... |
Python | UTF-8 | 3,313 | 2.90625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Fri May 05 19:26:13 2017
@author: YANGz1J
"""
import smtplib
from email.mime.text import MIMEText
from email.utils import formataddr
from email.mime.multipart import MIMEMultipart
my_sender='networkexperiment0@163.com' # 发件人邮箱账号
my_pass = 'qwer1234' ... |
Python | UTF-8 | 4,491 | 2.53125 | 3 | [] | no_license | #!/usr/bin/python
# encoding=utf-8
from utils import *
from FuncWindow import CFuncWindow, CRegisterDlg, CForgotPassword
class CMainWindow(gtk.Window):
def __init__(self):
super(CMainWindow, self).__init__(gtk.WINDOW_TOPLEVEL)
self.fixed = gtk.Fixed()
self.func_fixed = gtk.Fixed()
... |
Markdown | UTF-8 | 3,672 | 3.15625 | 3 | [
"MIT"
] | permissive | # Console
This is a **Repl** (read-execute-print-loop) cross-platform text-based console for the *Pyro* system.
Note that it starts with a local Server. Then it creates and connects a Peer to the server. The Peer is then used to connect to other Peers.
This includes when running the app as a sole process. In this ca... |
Java | UTF-8 | 1,692 | 2.21875 | 2 | [] | no_license | package Selinium;
import org.openqa.selenium.Alert;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Alerthandling {
public static void main(String[] args) throws InterruptedE... |
JavaScript | UTF-8 | 1,368 | 3 | 3 | [] | no_license | import * as actionTypes from './actions';
const initilState = {
counter: 0,
results: []
}
const reducer = (state = initilState, action) => {
if (action.type === 'INCREMENT') {
let newState = Object.assign({}, state);
newState.counter = state.counter + 1;
return newState;
}
... |
Python | UTF-8 | 1,175 | 3.21875 | 3 | [
"MIT"
] | permissive | """
This module contains the interface for the class that stores the prototypes of some baseline. This class can be used
to compare the prototypes obtained at the end of the online 'Seqclu' algorithm, where the number of identical
prototypes divided by the total number of prototypes can be used as evaluatio... |
Markdown | UTF-8 | 20,965 | 3 | 3 | [
"MIT"
] | permissive | ---
title: "[Day24] JS: javascript blackjack game"
preview: "javascript OOP"
permalink: "/articles/2019-03-26-js_blackjack"
date: 2019-03-26 09:56:00
layout: post
tags:
- "note"
- "front-end"
- "javascript"
comments: true
---
本篇會使用`jQuery` + `ES6`寫撲克牌小遊戲21點。一起來玩玩看吧!
<!-- more -->
<[點我進入網頁版完成品](../publ... |
C++ | UTF-8 | 5,787 | 2.703125 | 3 | [
"MIT"
] | permissive | #include <string>
#include <networkit/auxiliary/Log.hpp>
#include <networkit/dynamics/GraphDifference.hpp>
namespace NetworKit {
GraphDifference::GraphDifference(const Graph &G1, const Graph &G2) : G1(&G1), G2(&G2) {
if (G1.isDirected() != G2.isDirected()) {
throw std::runtime_error("Error, either both o... |
Python | UTF-8 | 240 | 2.65625 | 3 | [
"MIT"
] | permissive | def ResponseMaker(status, message, contentName = False, content = False):
response = {}
response["status"] = status
response["message"] = message
if(contentName and content):
response[contentName] = content
return response |
C# | UTF-8 | 935 | 2.5625 | 3 | [
"MIT"
] | permissive | using Native.Csharp.App.Gameplay.CharacterUtil.Classes.Template;
using Native.Csharp.App.Gameplay.CharacterUtil.Skills;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Native.Csharp.App.Gameplay.CharacterUtil.Classes
{
/// <summary>
... |
C++ | UTF-8 | 556 | 2.625 | 3 | [] | no_license | #ifndef FLOOR_H
#define FLOOR_H
#include <QGraphicsPixmapItem>
/*!
\class Floor
\brief The Floor class represents floor in the game.
Floor class defines floor object in the game. Floor is set during initialization of the levels.
It is not set through all of the level, so the player can fall.
*/
class Floor :... |
Java | UTF-8 | 775 | 2.59375 | 3 | [] | no_license | package cn.mccreefei.dao;
import cn.mccreefei.model.User;
import org.apache.ibatis.annotations.Param;
/**
* 用户dao接口
*/
public interface UserDAO {
/**
* 以用户名和密码查询用户
* @param name
* @param password
* @return 存在返回该用户对象,不存在返回null
*/
public User queryUser(@Param("name") String name,@Para... |
C | UTF-8 | 854 | 3.9375 | 4 | [] | no_license | /*
* Programmer : Josh Booth Date : Mar 22 , 2019
* Instructor : Professor Hou Class : ENGR 120 - 03
*
* Approximates the value of e
*/
#include <stdio.h> /* Includes printf, scanf */
#include <math.h> /* Includes fabs, exp */
/* Threshold for the allowed difference between actual value and approximated
... |
Java | UTF-8 | 4,253 | 2.25 | 2 | [] | no_license | package org.mira.companion.Fragments;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.ToggleButton;
import android.util.Log;... |
C# | UTF-8 | 3,612 | 2.84375 | 3 | [] | no_license |
using System;
using System.Drawing;
using System.Runtime.CompilerServices;
namespace Game.Components
{
public static class BodyComponentExtensions
{
public static BodyComponent StrengthInit(this BodyComponent component, int strength)
{
component.Strength = strength;
r... |
Python | UTF-8 | 2,531 | 2.546875 | 3 | [
"MIT"
] | permissive | # Created by Haorui Chen
# Updated by 05/15/2020
import time
import json
import random
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By # find by name, id, ..
from selenium.webdriver.support import expected_conditions as EC
def get_p... |
Markdown | UTF-8 | 537 | 2.546875 | 3 | [] | no_license | # Entities
##❯ Primitives
Basic type is a data type provided by a programming language as a basic building block.
References:
http://en.wikipedia.org/wiki/Primitive_data_type
##❯ Objects
Particular instance of a class where the object can be a combination of variables, functions, and data structures.
Reference... |
C++ | UTF-8 | 7,676 | 2.953125 | 3 | [
"MIT"
] | permissive | /// @file
/// @author David Pilger <dpilger26@gmail.com>
/// [GitHub Repository](https://github.com/dpilger26/NumCpp)
/// @version 1.1
///
/// @section License
/// Copyright 2019 David Pilger
///
/// Permission is hereby granted, free of charge, to any person obtaining a copy of this
/// software and associated documen... |
Python | UTF-8 | 528 | 2.609375 | 3 | [] | no_license | import requests
import json
import matplotlib.pyplot as plt
# Question 1
rv = []
profile_urls = [
'https://geosci.uchicago.edu/~kite/doc/geos28600_2020_lab_3/GEOS_38600_Lab_2_Profile_1.txt',
'https://geosci.uchicago.edu/~kite/doc/geos28600_2020_lab_3/GEOS_38600_Lab_2_Profile_2.txt',
'https://geosci.uchic... |
Python | UTF-8 | 1,728 | 4.125 | 4 | [] | no_license | """
使用方法:KMP
判断是不是双生词
1.S与S'长度相同
2.将S首尾相接绕成环,再选一个位置切开,顺时针或逆时针能够得到S'
给定一批仅由英文小写字母组成的字符串,询问他们之中是否存在双生词
input:
首先给出测试组数t,表示一共有多少组数据
对于每组数据,第一行为一个整数n,表示一共有多少个字符串。接下来n行,每行一个字符串
output:
对于每组数据,若存在双生词,输出Yeah。若不存在,输出Sad
示例:
3
2
helloworld
hdlrowolle
2
helloworld
worldhello
2
abcde
acbde
output:
Yeah
Yeah
Sad
1
2
helloworld
... |
Java | UTF-8 | 562 | 2.078125 | 2 | [] | no_license | package vgomes.marvelheroes.datastorage.helper;
import android.util.Log;
import io.realm.DynamicRealm;
import io.realm.RealmMigration;
import io.realm.RealmSchema;
import vgomes.marvelheroes.datastorage.consts.DataStorageConstants;
/**
* Created by victorgomes on 28/06/17.
*/
public class Migration implements Rea... |
C# | UTF-8 | 1,116 | 2.578125 | 3 | [] | no_license | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MusicController : MonoBehaviour {
public List<AudioSource> musicTracks = new List<AudioSource>();
// Use this for initialization
void Start () {
foreach(AudioSource track in musicTracks)
{
... |
JavaScript | UTF-8 | 406 | 2.796875 | 3 | [
"MIT"
] | permissive | //Fade Out Elements while scrolling
//Created by @snkrsnkampa
//Link this '.js' file from your html file
//Add the class .fade-out to the elements you want to fade-out
$(window).scroll(function(){
$(".fade-out").css("opacity", 1 - $(window).scrollTop() / 800); //Decrese the value from '800' to fade-out fast and vice-... |
Java | UTF-8 | 4,255 | 2.1875 | 2 | [] | no_license | package com.example.ettimadai;
import androidx.appcompat.app.AppCompatActivity;
import android.app.ActionBar;
import android.content.pm.ActivityInfo;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.MediaController;
import android.widget.... |
Python | UTF-8 | 187 | 3.3125 | 3 | [] | no_license | #BOJ_10870
def fibonacci(n):
if n==0:
ans=0
elif n==1:
ans=1
else:
ans= fibonacci(n-2) + fibonacci(n-1)
return ans
print(fibonacci(int(input()))) |
C | UTF-8 | 4,530 | 3.03125 | 3 | [] | no_license | /*
** PERSONAL PROJECT, 2019
** gomoku
** File description:
** gomoku swap2 rule
*/
#include <stdlib.h>
#include <stdio.h>
#include "../include/gomoku.h"
#include "../include/my.h"
static int p2_choice(data **game)
{
char *entry = NULL;
size_t buf = 0;
int nb[3] = {1, 2, 3};
my_putstr("\n");
my_p... |
Markdown | UTF-8 | 5,715 | 3.71875 | 4 | [] | no_license | ##<a name="create-client"></a>Create a Client Connection
Create a client connection by creating a `WindowsAzure.MobileServiceClient` object. Replace `appUrl` with the URL to your Mobile App.
```
var client = WindowsAzure.MobileServiceClient(appUrl);
```
##<a name="table-reference"></a>Work with Tables
To access or... |
PHP | UTF-8 | 619 | 2.671875 | 3 | [] | no_license | <?php
session_start();
?>
<html>
<style type ="text/css">
p{
text-align : center;
}
h1{
text-align : center;
}
</style>
<body>
<?php
if($_POST["q1"] == "b" ){ $_SESSION["score"]++; }
if($_POST["q2"] == "a" ){ $_SESSION["score"]++ ;}
if($_POST["q3"] == "a" ){ $_SESSION["score"]++... |
C | UTF-8 | 296 | 3.4375 | 3 | [] | no_license | //compile: gcc ex_1-6.c
//run: ./a.out
//Exercise 1-6: Verify that the expression getchar() != EOF is 0 or 1.
#include <stdio.h>
int main(){
int c;
while(c = (getchar() != EOF))
printf("(getchar() != EOF) == %d\n", c);
//after EOF detected
printf("(getchar() == EOF) == %d", c);
}
|
Java | WINDOWS-1252 | 3,213 | 2.171875 | 2 | [] | no_license | /**
* ATReference Copyright 2011 Rockefeller Archive Center
* All rights reserved.
*
* This software is free. You can redistribute it and / or modify it under the terms of the Educational Community License (ECL)
* version 1.0 (http://www.opensource.org/licenses/ecl1.php)
*
* This software is distributed in the... |
PHP | UTF-8 | 1,942 | 2.765625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | <?php
declare(strict_types=1);
namespace WoohooLabs\Worm\Examples\Infrastructure\Model;
use WoohooLabs\Worm\Examples\Domain\Course;
use WoohooLabs\Worm\Examples\Domain\SchoolClass;
use WoohooLabs\Worm\Model\AbstractModel;
use WoohooLabs\Worm\Model\Relationship\RelationshipInterface;
class ClassModel extends Abstrac... |
Java | UTF-8 | 123 | 1.929688 | 2 | [] | no_license | package org.automation.dojo;
/**
* Created by Sanja on 03.11.2014.
*/
public interface Dice {
int next(int max);
}
|
C | UTF-8 | 642 | 2.734375 | 3 | [] | no_license | /*************************************************************************//**
@file queue.h
@brief Software Library to make work with a queue
@author Marcos Darino (MD)
******************************************************************************/
#ifndef QUEUE_H_
#define QUEUE_H_
#include "os.h... |
TypeScript | UTF-8 | 445 | 3.1875 | 3 | [] | no_license | export function sdkInsertAt<T>(array: T[], index: number, newItem: T): T[] {
return [...array.slice(0, index), newItem, ...array.slice(index)];
}
export function sdkRemoveAt<T>(array: T[], index: number): T[] {
return [...array.slice(0, index), ...array.slice(index + 1)];
}
export function sdkReplaceAt<T>(array: ... |
C++ | UTF-8 | 211 | 2.96875 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main() {
int input;
cin >> input;
if (input % 2 == 0)
cout << "Is your name even steven?" << endl;
if (input % 2 == 1)
cout << "You are an odd ball!"<<endl;
} |
JavaScript | UTF-8 | 7,939 | 2.90625 | 3 | [] | no_license | // App constants
const HIDDEN_CLASS = 'hidden';
const TWITCH_API_URL = 'https://api.twitch.tv/kraken/search/streams';
const CLIENT_ID = 'rnol6rl7vokxusycd1dk7rqbddb2nw';
const LIMIT = 10;
// App controls
const loader = document.getElementById('loader');
const welcomeElement = document.getElementById('welcome_msg');
co... |
JavaScript | UTF-8 | 2,357 | 2.59375 | 3 | [
"MIT"
] | permissive | /*eslint-disable*/
import '../sass/styles.sass';
window.onload = () => {
const recordButton = document.querySelector('#record');
const raffleButton = document.querySelector('#raffle');
const playbackButton = document.querySelector('#playback');
const video = document.getElementById('video');
const url = '/r... |
Java | UTF-8 | 2,438 | 4.125 | 4 | [] | no_license | package com.hybeecodes.interviewprep.CTCI.arrays_strings;
// Cracking The Coding Interview > Arrays And Strings//
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
// IS Unique
public class IsUnique {
public static void main(String[] args) {
boolean isUni... |
Python | UTF-8 | 8,928 | 2.546875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# This sample demonstrates handling intents from an Alexa skill using the Alexa Skills Kit SDK for Python.
# Please visit https://alexa.design/cookbook for additional examples on implementing slots, dialog management,
# session persistence, api calls, and more.
# This sample is built using the ... |
C++ | UTF-8 | 7,264 | 3.640625 | 4 | [] | no_license | //#include, using etc
#include "Game.h"
#include <iostream>
#include <conio.h>
#include <ctime>
using namespace std;
// Default Constructor
Game::Game()
{
}
// Constructor passing in the player type
Game::Game(int playertype)
{
// create a new human and ai object
human = new Human(playertype);
ai = new AI(playert... |
C# | UTF-8 | 8,176 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | //-----------------------------------------------------------------------
// <copyright author="Muhammad Haroon">
// Texticize
// Codeplex Project: http://texticize.codeplex.com/
// Copyright (c) Muhammad Haroon, http://www.softwarerockstar.com/
// Released under Apache License Version 2.0, ht... |
Java | UTF-8 | 1,456 | 2.0625 | 2 | [
"Apache-2.0"
] | permissive | package io.izenecloud.msgpack;
import java.io.IOException;
import org.apache.hadoop.mapreduce.JobContext;
import org.apache.hadoop.mapreduce.OutputCommitter;
import org.apache.hadoop.mapreduce.OutputFormat;
import org.apache.hadoop.mapreduce.RecordWriter;
import org.apache.hadoop.mapreduce.TaskAttemptContext;
public... |
Python | UTF-8 | 495 | 3.03125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Thu Jul 11 01:04:18 2019
@author: Inki
"""
import threading
class StoppableThread(threading.Thread):
"""Thread class with a stop() method. The thread itself has to check
regularly for the stopped() condition."""
def __init__(self):
super(StoppableThread, sel... |
JavaScript | UTF-8 | 3,021 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | (function(SBCOM) {
SBCOM.core = (function() {
// dependencies
var sandbox = SBCOM.sandbox;
// end of dependencies
// private properties and methods
var modules = {};
// end of private properties an... |
Java | UTF-8 | 1,821 | 2.140625 | 2 | [] | no_license | package com.catDog.mpadoption;
public class Mpadoption {
private long num;
private String userId;
private String nickName;
private int adoptionListNum;
private int adoptionNum;
private int speciesSort;
private String status;
private String adoptionSubject;
private String adoptionCreted;
privat... |
Python | UTF-8 | 134 | 3.5 | 4 | [] | no_license | while True:
n=input()
if n.isdigit():
print("n=%s"%n)
break
else:
print('is not a number')
|
C++ | UTF-8 | 4,516 | 3.796875 | 4 | [] | no_license | #include "std_lib_facilities.h"
#include <fstream>
#include <string>
#include <iomanip>
#include <vector>
int min(int x, int y, int z) // Function that calculates the minimum of 3 numbers.
{
return min(min(x, y), z);
}
int levenshtein_distance(string s1, string s2) // Function that calcu... |
JavaScript | UTF-8 | 2,293 | 2.9375 | 3 | [] | no_license | import {START_GAME, END_GAME} from './gameInfo';
import {getNumberOfLines} from './score';
const INCREMENT_CURRENT_LEVEL = 'INCREMENT_CURRENT_LEVEL';
const INCREMENT_STARTING_LEVEL = 'INCREMENT_STARTING_LEVEL';
const initialState = {
current: 0,
starting: 0,
};
export default function(state = initialState, acti... |
Java | UTF-8 | 6,128 | 2.21875 | 2 | [
"Apache-2.0"
] | permissive | package com.t3hh4xx0r.openhuesdk.sdk;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.graphics.SweepGradient;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.vie... |
JavaScript | UTF-8 | 3,254 | 2.578125 | 3 | [] | no_license | function validateSearch(num) {
var search = document.getElementById("searchbar-input-" + num).value;
console.log("search = " + search);
var params = {
"search": search
}
getSearchResults(params);
sessionStorage.setItem("view", "Search");
loadContent();
return false;
}
function getSearchResults(para... |
Java | UTF-8 | 271 | 1.726563 | 2 | [] | no_license | package edu.teco.ecqels.lang.op;
import edu.teco.ecqels.lang.window.Duration;
/**
*
* @author Michael Jacoby
* @organization Karlsruhe Institute of Technology, Germany www.kit.edu
* @email michael.jacoby@student.kit.edu
*/
public interface OpRefreshable {
public Duration getDuration();
}
|
Java | UTF-8 | 414 | 2.03125 | 2 | [
"MIT"
] | permissive | package voogasalad_GucciGames.gameplayer.scenes;
import javafx.event.Event;
import javafx.event.EventHandler;
import javafx.event.EventType;
public interface GameSceneInterface {
public <T extends Event> void addEventHandler(EventType<T> eventType, EventHandler<T> eventHandler);
public <T extends Event> void addE... |
Java | UTF-8 | 9,585 | 2.5 | 2 | [] | no_license | package sky.housecommon;
public class InstantaneousConsumption implements Timed,Comparable<InstantaneousConsumption>
{
private final long time;
private final PricingPeriod pricingPeriod;
private final double blueDayOffPeakHourTotal;
private final double blueDayPeakHourTotal;
private final d... |
C++ | UTF-8 | 1,125 | 2.59375 | 3 | [] | no_license | #include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
#define INF 0x3f3f3f3;
int map[110][110],dis[110],visited[110];
void Dijkstra(int n,int x)
{
int i,p,j,min;
for (i=1;i<=n;i++)
{
dis[i]=map[1][i];
visited[i]=0;
}
visited[x]=1;
for (i=1;i<=n;i++)
{
... |
Java | UTF-8 | 160 | 1.515625 | 2 | [] | no_license | package com.ltao.service;
/**
* Created by ltao on 2017/10/25.
*/
public interface EhCacheService {
public String getTimestamp(String param, int num);
}
|
Java | UTF-8 | 191 | 2.375 | 2 | [] | no_license | package grupp03.calculatorApplication.calculator.model;
/**
* Created by August on 2016-09-27.
*/
public interface ExpressionCalculatorStrategy<T> {
T calculate(String expression);
}
|
Markdown | UTF-8 | 5,938 | 3.625 | 4 | [] | no_license | #### 原文地址
[嗨,你真的懂this吗?](https://juejin.im/post/5c96d0c751882511c832ff7b)
#### this的绑定规则
1. 默认绑定
2. 隐式绑定
3. 硬绑定
4. new绑定
#### 默认绑定
在不能应用其他绑定规则的时候使用默认规则,通常是独立函数调用
```js
function sayHi() {
console.log('hello',this.name);
}
var name = 'Ybettelau';
sayHi();
```
#### 隐式绑定
函数调用实在某个对象上触发的,既调用位置上存在上下文对象。形式xxx.function()... |
PHP | UTF-8 | 1,797 | 2.515625 | 3 | [] | no_license | <?php
namespace Metinet\AppBundle\Menu;
use Knp\Menu\FactoryInterface;
use Symfony\Component\DependencyInjection\ContainerAware;
class Builder extends ContainerAware
{
public function mainMenu(FactoryInterface $factory, array $options)
{
$menu = $factory->createItem('root');
$menu->setChildre... |
C# | UTF-8 | 1,602 | 2.875 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HappyTrip.Model.Entities.Log;
using System.IO;
using System.Web;
namespace HappyTripFileLogger
{
public class FileLogger : ILogger
{
string logFile = "TextLog.txt";
public FileLogger()
{
}
public FileLogger(obje... |
C++ | UTF-8 | 1,629 | 3.734375 | 4 | [
"MIT"
] | permissive | /**
* Demonstrate usage std::async.
*/
#include <iostream>
#include <future>
int main()
{
auto sleep = []() -> int {
std::this_thread::sleep_for(std::chrono::seconds(1));
return 1;
};
// this spawns and execute on a new thread
auto f = std::async(std::launch::async, sleep);
std:... |
Java | UTF-8 | 798 | 2.3125 | 2 | [] | no_license | package com.epidial.utils;
import org.apache.tomcat.util.codec.binary.Base64;
/**
* @ CreateDate : Create in 11:17 2019/5/5
* @ Explain :
* @ UpdateDate : Update in
* @ Author : Eestill
*/
public class CodeUtils {
public static String encodeStr(String plainText){
byte[] b=plainText.getBytes();
... |
Python | UTF-8 | 2,605 | 2.578125 | 3 | [] | no_license | # Author: Mikita Sazanovich
import itertools
import os
import configuration
def run_experiment(config, update_params, tag):
generated_config = config.copy()
for field_path, field_value in update_params.items():
field_parts = field_path.split('/')
config_scope = generated_config
for index, field in en... |
Python | UTF-8 | 1,392 | 3.71875 | 4 | [] | no_license | # 댓글에서 추첨해서 1명이 치킨, 3명이 커피.
# 20명이 댓글을 달았다. 아이데는 1 ~ 20 이라고 가정.
# 무작위로 추첨하고 중복으로 당첨은 불가능.
# ramdom 모듈의 shuffle 과 sample을 활용.
# 치킨 당첨자는 그냥 int
# 커피 당첨자는 list
from random import *
# random 안에 shuffle 과 sample이 있다.
lst = list(range(1, 21))
print(lst)
shuffle(lst) # lst에 있는 것의 순서를 섞는다.
print(lst)
winner =... |
Shell | UTF-8 | 857 | 3.3125 | 3 | [] | no_license | #!/bin/bash
# Install nvidia-docker2.
if ! dpkg-query -W nvidia-docker2; then
# Purge nvidia-docker if it exists.
docker volume ls -q -f driver=nvidia-docker | xargs -r -I{} -n1 docker ps -q -a -f volume={} | xargs -r docker rm -f
sudo apt-get purge -y nvidia-docker
sudo apt-get install -y nvidia-modprobe
#... |
JavaScript | UTF-8 | 1,403 | 2.96875 | 3 | [] | no_license | /* Creamos un objeto MediaPlayer */
function MediaPlayer(config) {
this.media = config.el;
this.plugins = config.plugins || [];
this._initPlugins();
}
/* Función que inicializa los plugins */
MediaPlayer.prototype._initPlugins = function() {
/* Creamos un objeto que tiene la función play, pause y dos propiedad... |
C++ | UTF-8 | 1,211 | 2.6875 | 3 | [] | no_license | #ifndef SHADER_H
#define SHADER_H
#include "GLinclude.h"
#include <string>
class Shader
{
public:
// program ID
unsigned int ID;
// constructor, generates the shader
Shader(const char* vertexPath, const char* fragmentPath);
// -------------------------------------------------------------------... |
JavaScript | UTF-8 | 97 | 3.03125 | 3 | [] | no_license | let sum = 1;
for (let i = 1; i < 51; i++) {
if (i % 3 === 0 || i % 5 === 0) console.log(i);
} |
Java | UTF-8 | 198 | 2.578125 | 3 | [] | no_license | package OOP_Inheritance;
public class Vehicle {
public void engine() {
System.out.println("Vehicle ----- engine");
}
public void start() {
System.out.println("Vehicle ----- start");
}
}
|
Markdown | UTF-8 | 1,488 | 3.21875 | 3 | [] | no_license | Audio and video
------------------------------
Audio and video in javascript, are, surpringsingly easy. Sort of.
Audio
------------------------------
In order to use audio in javascript one needs to have the audio loaded in at runtime, or via an audio tag.
Either way, one needs to be using the correct format for th... |
Markdown | UTF-8 | 1,491 | 3.1875 | 3 | [] | no_license | # Charge.js Example
This directory is a brief example of a [Charge.js](https://charge.js.org/) site using the [@now/static-build](https://zeit.co/docs/v2/deployments/official-builders/static-build-now-static-build) Builder.
## Initializing this Example
To get started with Charge.js on Now, you can use the [Now CLI](... |
Markdown | UTF-8 | 2,856 | 2.984375 | 3 | [] | no_license | # Generative Art Workshop (IAP 2021)
[](https://gke2.mybinder.org/v2/gh/gvarnavi/generative-art-iap-binder-env/main?urlpath=git-pull%3Frepo%3Dhttps%253A%252F%252Fgithub.com%252Fgvarnavi%252Fgenerative-art-iap%26urlpath%3Dtree%252Fgenerative-art-iap%252F%26branch%3Dmaster) ... |
TypeScript | UTF-8 | 165 | 2.5625 | 3 | [] | no_license | interface LcuGameSessionData {
gameData: GameData;
phase: string;
}
interface GameData {
gameId: number;
queue: Queue;
}
interface Queue {
id: number;
}
|
Java | UTF-8 | 320 | 2.140625 | 2 | [] | no_license | package weatherreporter.dataclasses;
/**
* Created by Ravi on 1/12/2015.
*/
public class AllData {
public AllWeatherData mAllWeatherData;
public AllForecastData mAllForecastData;
public AllData() {
mAllWeatherData = new AllWeatherData();
mAllForecastData = new AllForecastData();
}
}
|
Java | UTF-8 | 3,332 | 3.8125 | 4 | [] | no_license | package M9D12;
import java.util.Scanner;
/**
* 企业发放的奖金根据利润提成
* @version 1.0
* @author 孔德成
*/
/*
Python if 逻辑
if (profit > 100) {
// 高于100万元时,超过100万元的部分按1%提成;
bonus += (profit-100)*(1.0/100);
}else if (profit>60 && profit <=100) {
if (profit > 100) {
... |
Python | UTF-8 | 7,914 | 2.78125 | 3 | [
"MIT"
] | permissive | import os
import glob
import click
import pickle
import zipfile
import datetime
import pandas as pd
@click.command()
@click.option('--redmine_instance', help='Path to pickled Redmine API instance')
@click.option('--issue', help='Path to pickled Redmine issue')
@click.option('--work_dir', help='Path to Redmine issue w... |
Java | UTF-8 | 1,969 | 4.0625 | 4 | [] | no_license | package com.swj.ics.ThreadSimple;
import java.util.concurrent.TimeUnit;
/**
* Created by swj on 2018/1/1.\
* 中断:其他线程通过调用该线程的interrupt方法对其进行中断操作。
* 线程通过检查自身是否被中断来进行响应。线程通过isInterrupted方法来进行判断
*/
public class InterruptedDemo {
public static void main(String[] args) throws InterruptedException {
Thr... |
C++ | UTF-8 | 583 | 2.671875 | 3 | [] | no_license | #include "Arch/x86/Keyboard.h"
#include <ncurses.h>
bool Arch::x86::Keyboard::getState(Core::Keyboard::Key key) const {
switch (key) {
case Core::Keyboard::UP:
return _currentKey == KEY_UP;
case Core::Keyboard::DOWN:
return _currentKey == KEY_DOWN;
case Core::Keyboa... |
C++ | UTF-8 | 1,868 | 3.109375 | 3 | [] | no_license | #include <fstream>
#include <iostream>
#include <utility>
#include <vector>
#include <limits.h>
#include <algorithm>
using std::cout;
using std::vector;
using std::ifstream;
using std::pair;
using std::min;
using std::max;
using std::sort;
class Dsu {
private:
vector<long long> parent;
publi... |
Java | UTF-8 | 499 | 1.835938 | 2 | [] | no_license | package com.wanlai.kafkatest;
import com.wanlai.kafkatest.kafka.KafkaProducer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class TestController {
... |
Markdown | UTF-8 | 1,065 | 4.25 | 4 | [] | no_license | # Reversing an Array
Write a function arrayToList that builds up a list structure like the one shown when given [1, 2, 3] as argument. Also write a listToArray function that produces an array from a list. Then add a helper function prepend, which takes an element and a list and creates a new list that adds the element... |
PHP | UTF-8 | 566 | 4.4375 | 4 | [] | no_license | <?php
/*
* A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
*
* Find the largest palindrome made from the product of two 3-digit numbers.
*/
function maxpalindrome(){
$palindrome = array();
for($i=100; $i<=999; $i++){
for($j=99... |
Java | UTF-8 | 11,510 | 1.734375 | 2 | [] | no_license | /*
* Decompiled with CFR 0_124.
*
* Could not load the following classes:
* javax.servlet.http.HttpServletRequest
* javax.servlet.http.HttpSession
* org.hibernate.HibernateException
* org.hibernate.Query
* org.hibernate.Session
* org.hibernate.SessionFactory
* org.springframework.beans.factory.annotat... |
PHP | UTF-8 | 4,565 | 2.765625 | 3 | [] | no_license | <?php
namespace App\Command;
use App\Entity\InstagramAccount;
use App\Entity\User;
use App\Entity\VkAccount;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Compon... |
Python | UTF-8 | 2,251 | 3.953125 | 4 | [
"Unlicense"
] | permissive | """
CHANGE
Change calculator
Port by Dave LeCompte
"""
PAGE_WIDTH = 64
def print_centered(msg):
spaces = " " * ((PAGE_WIDTH - len(msg)) // 2)
print(spaces + msg)
def print_header(title):
print_centered(title)
print_centered("CREATIVE COMPUTING MORRISTOWN, NEW JERSEY")
print()
print()
... |
Java | UHC | 818 | 3.796875 | 4 | [] | no_license | package day4;
import java.util.Scanner;
public class Home {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Է"); // ̸ ϵ ̵
System.out.println("̸ :");
String name = sc.next();
System.out.println("e-mail : ");
String email = sc.next();
System.out.print... |
C# | UTF-8 | 1,883 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | namespace NUnitRetrying.Environment
{
using log4net;
using NUnit.Framework;
using System;
using System.Configuration;
/// <summary>
/// Environment Configuration
/// </summary>
public static class Configuration
{
/// <summary>
/// The logger instance.
/// </... |
Python | UTF-8 | 9,483 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive |
import math
import torch
import warnings
import itertools
import numbers
from torch.nn.modules import Module
from torch.nn.parameter import Parameter
from torch.nn.utils.rnn import PackedSequence
from torch.nn import init
_VF = torch._C._VariableFunctions
_rnn_impls = {
'LSTM': _VF.lstm,
'GRU': _VF.gru,
... |
C++ | UTF-8 | 1,179 | 3.15625 | 3 | [] | no_license | #include <iostream>
#include <stdlib.h>
#include <math.h>
#include <time.h>
using namespace std;
bool check_prime(int n){
for(int i=2;i<n;i++){
if(n%i==0){
return false;
}
}
return true;
}
int find_prims(int* &prim,int a,int b){
int primes_num=0;
for(int ... |
Java | UTF-8 | 6,554 | 1.875 | 2 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive | package org.w3c.wai.accessdb.rest.resources;
import java.util.List;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.... |
Java | UTF-8 | 2,127 | 2.390625 | 2 | [] | no_license | package org.ymdroid.rnb.event;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import org.ymdroid.rnb.R;
import java.util.ArrayList;
/**
* Created by yj on 16. 5. 22..
*/... |
Markdown | UTF-8 | 5,884 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | [AmniXtension](../../index.md) / [com.amnix.xtension.extensions](../index.md) / [kotlin.String](./index.md)
### Extensions for kotlin.String
| Name | Summary |
|---|---|
| [append](append.md) | `fun `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`.append(other: `[`String`](https://... |
Markdown | UTF-8 | 11,137 | 3.203125 | 3 | [] | no_license | ---
title: Python 虚拟环境全知道
date: 2018-01-09
tags: ["python", "pyenv", "virtualenv", "docker"]
keywords: ["python", "pyenv", "virtualenv", "docker", "虚拟"]
slug: python-virtualenv-all-know
gitcomment: true
bigimg: [{src: "/img/posts/photo-1500644970114-4ff3c3dfb61f.jpeg", desc: "Reach for the End."}]
category: "python"
--... |
Java | UTF-8 | 2,480 | 2.015625 | 2 | [
"Apache-2.0"
] | permissive | /*
* 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/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distribut... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.