language
stringclasses
15 values
src_encoding
stringclasses
34 values
length_bytes
int64
6
7.85M
score
float64
1.5
5.69
int_score
int64
2
5
detected_licenses
listlengths
0
160
license_type
stringclasses
2 values
text
stringlengths
9
7.85M
C++
UTF-8
907
2.859375
3
[]
no_license
#include <cstdio> #include <vector> #include <cstring> using namespace std; const int MAX = 100; int Table[MAX][MAX]; int result[MAX][MAX]; vector <int> myGraph[MAX]; void DFS(int start, bool check[]) { check[start] = true; printf("start : %d\n", start); for(int j=0; j<myGraph[start].size(); j++) { int node =...
Java
UTF-8
2,541
2.125
2
[]
no_license
package rest; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.security.Key; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import javax.annotation.Priority; import javax.crypto.KeyGenerator; import javax.i...
Markdown
UTF-8
7,763
2.75
3
[ "BSD-3-Clause" ]
permissive
# Machine Learning Model Inference ## Summary This tutorial describes how to use within the ImFusion framework a deep learning model that has been trained independently from Python. The C++ plugin included in this repo will define a demo algorithm that runs such a model in the Suite. ![Screenshot of the demo algorit...
JavaScript
UTF-8
444
3.234375
3
[]
no_license
function Prisoner(index) { this.index = index; this.left = this.right = null; } Prisoner.prototype.release = function() { this.left.right = this.right; this.right.left = this.left; this.left = this.right = null; } Prisoner.prototype.isLonely = function() { return this.left === this.right && ...
Java
UTF-8
1,031
3.296875
3
[]
no_license
package com.company; import java.util.Arrays; public class Main { public static void main(String[] args) { double[] num = {12.3, 32.5, -13.5, 5.6, 9.5, -6.7, 8.3, 2.1, -23.5, 24.6, -12.3, -35.7, -18.4, 32.6, 14.7}; int positive = 0; double summa = 0; boolean negative = false; ...
Ruby
UTF-8
738
2.609375
3
[ "MIT" ]
permissive
class Callapi::Routes::HelperMethodCreator POSTFIX = '_call' def initialize(call_class) @call_class = call_class @call_class_name = call_class.to_s end def create call_class = @call_class Object.send(:define_method, helper_method_name) do |*args| call_class.new(*args) end end de...
Java
UTF-8
603
2.25
2
[]
no_license
package ru.netology; import com.github.javafaker.Faker; import lombok.Value; import java.time.LocalDate; import java.util.Locale; public class DataGenerator { private DataGenerator() { } @Value public static class Registration { private Registration (){} public static UserInfo getReg...
C#
UTF-8
616
2.96875
3
[]
no_license
using Newtonsoft.Json; using System.IO; namespace ShipCollections { public class ShipType { /// <summary> /// 艦種を識別する一意な値です。 /// </summary> public int Id { get; set; } /// <summary> /// 艦船の種類を表す名前です。 /// </summary> public string Name { get; set;...
Python
UTF-8
465
2.8125
3
[]
no_license
#!/usr/bin/python from common import * goal = 'welcome to code jam' mod = 10000 def testcase(x): line = readline() counts = [0] * len(goal) for c in line: for i in xrange(len(goal)): if goal[i] == c: if i > 0: counts[i] = (counts[i] + counts[i - 1])...
Ruby
UTF-8
594
3.484375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'pry' class Artist attr_reader :name, :import @@all = [] def self.all @@all end def self.find_or_create_by_name(import) found_artist = @@all.find{|a| a.name == import} if found_artist found_artist else self.new(import) end end def initialize(name) @name = name @@all << self ...
Java
UTF-8
256
1.804688
2
[]
no_license
package com.yt.pulltorefresh.i; import com.yt.pulltorefresh.recyclerview.BaseAdapterHelper; /** * ACCommonAdapter * 扩展的Adapter接口规范 */ public interface I_Adapter<T> { void bindData(BaseAdapterHelper helper, int position, T item); }
Ruby
UTF-8
162
3.078125
3
[]
no_license
def compute(one, two) first = one.split('') second = two.split('') count = 0 first.zip(second).each {|x, y| count += 1 if x != y } count end
JavaScript
UTF-8
181
3.203125
3
[]
no_license
let order = (str) => { newStr = str.split(""); for (var i = 0; i < newStr.length; i++) { newStr = newStr.sort(); } console.log((newStr = newStr.join(""))); }; order("prem");
Python
UTF-8
2,526
2.546875
3
[]
no_license
# -*- coding: utf-8 -*- import urllib.request as ur import urllib.parse as up import lxml.etree as le import re from faker import Factory # url = 'https://so.csdn.net/so/search/s.do?p={page}&q={keyword}&t=blog&viparticle=&domain=&o=&s=&u=&l=&f=&rbg=0' url = 'https://so.csdn.net/so/search/all' user_agent = Factory.crea...
PHP
UTF-8
1,327
2.828125
3
[]
no_license
<div class="main"> <ul id="content"> <div id="pageContentCenter"> <h2>Il mio Profilo:</h2> <?php $mysqli = database::getInstance()->databaseConnection(); if (!isset($mysqli)) { $mysqli->close(); return false; } ...
Python
UTF-8
1,898
4.09375
4
[]
no_license
''' Problem You receive a credit C at a local store and would like to buy two items. You first walk through the store and create a list L of all available items. From this list you would like to buy two items that add up to the entire value of the credit. The solution you provide will consist of the two integers in...
Java
UTF-8
2,520
2.4375
2
[]
no_license
package com.slack.geekbrainswork.ai.data.api; import java.io.IOException; import okhttp3.Interceptor; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; import okhttp3.logging.HttpLoggingInterceptor; import retrofit2.Retrofit; import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory; import...
C++
WINDOWS-1258
2,462
3
3
[]
no_license
#include "Create.h" Create::Create() { //ctor } void Create::menu() { int opc; do { cout<<"Set instrucciones"<<endl<<endl <<"Que desea hacer?"<<endl <<op_tipoR<<"( Tipo R"<<endl <<op_tipoI<<"( Tipo I"<<endl <<op_tipoJ<<"( Tipo J"<<endl <<op_salir<<"( Sal...
Go
UTF-8
979
3.4375
3
[]
no_license
package main func spiralOrder(matrix [][]int) []int { if len(matrix) == 0 || len(matrix[0]) == 0 { return nil } m, n := len(matrix)-1, len(matrix[0])-1 l, r, t, b := 0, n, 0, m var res []int for l <= r && t <= b { // fmt.Println("l", l, "r", r, "t", t, "b", b) edges := listEdges(matrix, l, r, t, b) res...
Swift
UTF-8
1,118
4.6875
5
[]
no_license
//: [Previous](@previous) import Foundation //: ### Turple //: Declare a constant typle that contains three Int values followed by a String. Use this to represent a date (month, day, year) followed by an emoji or word you might associte with that day let halloween: (month: Int, day: Int, year: Int, means: String) h...
Python
UTF-8
1,127
4.1875
4
[]
no_license
def print_stars(count = 10): print("*"*count) print_stars() print_stars(20) def slice_list(list_to_slice, upper_bound): """Returns slice of list if upper bound is valid""" if (len(list_to_slice) > upper_bound): print('Slicing...') return list_to_slice[:upper_bound] else: print(...
Java
UTF-8
16,130
2.890625
3
[ "Apache-2.0" ]
permissive
package imageRecognition.openCV; import java.awt.Color; import java.awt.Point; import java.awt.image.BufferedImage; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import org.lwjgl.util.vector.Vector3f; import prevAutopilot.SimpleAutopilot; ...
C#
UTF-8
2,304
3.625
4
[ "MIT" ]
permissive
using System; using System.Collections.Generic; using System.Linq; class ThreeInOne { static void Main() { SolveTask1(); SolveTask2(); SolveTask3(); } static void SolveTask1() { int[] points = Console.ReadLine().Split(',').Select(ch => int.Parse(ch)).ToArray(); ...
JavaScript
UTF-8
564
2.734375
3
[]
no_license
$('form').submit(function(e) { e.preventDefault(); this.reset(); }); $('.submit-button').on('click', function() { let title = $('.movie-title').val(); let rating = $('.rating').val(); $('body').append('<ul class="the-list"></ul>'); $('.the-list').eq(-1).append('<li class="new-item">' + title + ' Rating: ' + ra...
Java
UTF-8
3,494
2.5
2
[]
no_license
package ua.training.model.entities; import java.sql.Timestamp; import java.util.Objects; public class TaxReport { private int id; private Taxpayer taxpayer; private Inspector inspector; private TaxReportForm form; private TaxReportType type; private TaxReportStatus status; private String ...
TypeScript
UTF-8
2,243
3.265625
3
[ "MIT" ]
permissive
/** * @class * Resize command for figures. Can be execute/undo/redo via a CommandStack. * * @inheritable * @author Andreas Herz * @extends draw2d.command.Command */ import Command from "./Command"; import Configuration from "../Configuration"; class CommandResize extends Command { private figure: any; ...
Python
UTF-8
1,426
3.203125
3
[ "BSD-3-Clause-Clear" ]
permissive
from typing import Mapping from mediaman.distribution import Bin, Item def fast_serpent(bins: Mapping[str, int], items: Mapping[str, int]): """ Assign a poor distribution of items to bins, very quickly. @param bins Mapping of bin identifier to bin size @param items Mapping of item identifier to ite...
Go
UTF-8
999
2.625
3
[]
no_license
package mysql import ( "fmt" "time" "gorm.io/driver/mysql" "gorm.io/gorm" "gorm.io/gorm/logger" ) var DB = &gorm.DB{} func Init2(user string, password string, host string, db string, connMaxLifetime int, maxIdleConns int, mxOpenConns int) { link := fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8&parseTime=True&loc=...
JavaScript
UTF-8
3,559
4.15625
4
[]
no_license
// This program demonstrates several Array and Object methods and examples of their use with an abstraction of a real-world object // The Tarot Major Arcana is a data-set uniquely appropriate for these examples for several reasons: // Each card has a proper name and a Roman numeral value, a natural key-value pair for...
Swift
UTF-8
20,499
2.65625
3
[]
no_license
// // ExhibitsViewModel.swift // Exhibit Finder // // Created by Kate Duncan-Welke on 8/21/20. // Copyright © 2020 Kate Duncan-Welke. All rights reserved. // import Foundation import UIKit public class ExhibitsViewModel { weak var alertDelegate: AlertDisplayDelegate? weak var exhibitDelegate: ExhibitLo...
Python
UTF-8
4,225
3.34375
3
[ "MIT" ]
permissive
import random from player import Player from evaluator import Evaluator from card import Card from deck import Deck from itertools import combinations evaluator = Evaluator() WORST_SCORE = 7462 class Simon(Player): def bet(self, game_view): score = 0 opponent_score = self.estimate_opponent_scor...
C
UTF-8
441
3.8125
4
[]
no_license
#include <stdio.h> int main () { int n, i, j; int arr[10]; printf ("Enter the number of elements in the array: \t"); scanf ("%d", &n); printf ("The elements are: "); for (i = 0; i < n; i++) { scanf ("%d", &arr[i]); printf("Element you want to search: \t"); scanf("%d",&j); for (i = 0; i < n ; i++) if(arr[i] == j){ print...
Python
UTF-8
389
3.59375
4
[]
no_license
from random import randint class LuckyBall: def __init__(self): self.nums = [] while len(self.nums) < 6: rand_num = randint(1, 69) if rand_num not in self.nums: self.nums.append(rand_num) def __getitem__(self, index): return self.num...
Python
UTF-8
38
2.8125
3
[]
no_license
summa = 102 summa %= 20 print(summa)
Java
UTF-8
7,649
2.265625
2
[]
no_license
package rasa; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilder; import org.w3c.dom.Document; import org.w3c.dom.NodeList; import org.w3c.dom.Node; import org.w3c.dom.Element; import java.io.File; import java.io.IOException; import java.util.*; public class ReadXML { public ...
Java
UTF-8
971
2.828125
3
[ "MIT" ]
permissive
package juice.animation; import juice.animation.easing.EasingType; final public class Key { public interface FrameCallback { void call(int frame, double[] values); } public interface EndCallback { void call(); } //=======================================================...
C#
UTF-8
11,689
2.984375
3
[]
no_license
using System; using System.Threading; using WATKit.Controls; using WATKit.Exceptions; namespace WATKit { /// <summary> /// Provides extension methods for wait operations within the fluent automation api /// </summary> /// <remarks> /// These methods provide support for waiting on an automation control...
Python
UTF-8
113
3.203125
3
[]
no_license
nlista=[1,2,3,4] nlistalen=len(nlista) for i in range(0,nlistalen,1): nlista.append(nlista[i]) print(nlista)
Python
UTF-8
927
3.5625
4
[]
no_license
class Solution: def search(self, nums: List[int], target: int) -> bool: # (0) edge case if len(nums) == 0: return False # (1) two pointers and while loop l = 0 r = len(nums) - 1 while l <= r: mid = l + (r - l) // 2 ...
Python
UTF-8
1,777
2.9375
3
[]
no_license
import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers num_words = 2000 num_tags = 12 num_departments = 4 # 输入 body_input = keras.Input(shape=(None,),name='body') title_input = keras.Input(shape=(None,),name='title') tag_input = keras.Input(shape=(num_tags,),name='tag') # 嵌入点 body_f...
Python
UTF-8
18,802
3.1875
3
[]
no_license
import pdb import time import sys class GameState: """ Blackjack Game state """ def __init__(self, HandType, Value, OppCard): # if you add other members add them to the hash and eq as well self.HandType = HandType # [ "HardFresh", "HardStaleAce", "HardStale", "AceFre...
Python
UTF-8
434
4.28125
4
[]
no_license
# def square(num) # return num * num # print(square(9)) def square(num): return num * num square2 = lambda num: num * num add = lambda a, b: a + b # use when you are passing a function into another function as a parameter # a function without a name for a one time use. Its a single line # Write a lambda that accep...
PHP
UTF-8
328
2.765625
3
[]
no_license
<?php function clear_string($cl_str){ $cl_str = strip_tags($cl_str); // Удаляем HTML и PHP теги $cl_str = mysql_real_escape_string($cl_str); // Экранируем спец.символы $cl_str = trim($cl_str); // Удаление лишних пробелов return $cl_str; } ?>
C#
UTF-8
3,419
3.28125
3
[]
no_license
using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; namespace 动态解打劫房屋问题 { /* 打劫房屋问题 【问题】假设你是一个专业的窃贼,准备沿着一条街打劫房屋。每个房子都存放着特定金额的钱。你面临的唯一约束条件是:相邻的房子装着相互联系的防盗系统,且 当相邻的两个房子同一天被打劫时,该系统会自动报警。 给定一个非负整数列表,表示每个房子中存放...
Python
UTF-8
1,421
3.5
4
[ "MIT" ]
permissive
# # @lc app=leetcode id=142 lang=python3 # # [142] Linked List Cycle II # # @lc code=start # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None # Given a linked list, return the node where the cycle begins. If there is no cycle, return n...
JavaScript
UTF-8
369
2.734375
3
[]
no_license
const animationBar = document.querySelector('.animation-bar') const content = document.querySelector('.content'); document.addEventListener('scroll', function(e) { const percentageDocScrolled = document.documentElement.scrollTop/(content.offsetHeight - document.documentElement.clientHeight) *100 animationBar....
Python
UTF-8
630
3.6875
4
[]
no_license
def maxLista(l): if len(l)==0: return 0 max=0 for i in range (0,len(l)): if l[i]>max: max=l[i] return max def minLista(l): if len(l)==0: return 0 min=l[0] for i in range (0,len(l)): if l[i]<min: min=l[i] return m...
Markdown
UTF-8
3,255
3.359375
3
[]
no_license
# Goal In this tutorial, you will learn Simple thresholding, Adaptive thresholding, Otsu's thresholding etc. You will learn these functions : cv.threshold, cv.adaptiveThreshold etc. https://docs.opencv.org/trunk/d7/d4d/tutorial_py_thresholding.html # Simple Thresholding First argument is the source im...
C++
WINDOWS-1251
5,343
2.859375
3
[]
no_license
#pragma once #include "Tagged.h" namespace Demo { namespace Core { //------------------------------------------------------------ class _DemoExport Controller : public Tagged<Controller> { public: DEFINE_CLASS_SHARED_PTR(Controller) DEFINE_TAGGED //--------------------------------// class traits { public: type...
PHP
UTF-8
987
4.0625
4
[]
no_license
<?php class Solution { static $dp = []; /** * @param Integer $n * @return Integer */ function climbStairs($n) { self::$dp[1] = 1; self::$dp[2] = 2; if (isset(self::$dp[$n])) { return self::$dp[$n]; } self::$dp[$n] = $this->climbStairs($n ...
C++
UTF-8
974
2.59375
3
[]
no_license
#include <iostream> #include <vector> #include <map> #include <set> #include <queue> #include <string> #include <iomanip> #include <algorithm> #include <cmath> #include <stdio.h> using namespace std; #define int long long int MOD = 1000000007; string removeZeros(string T) { reverse(T.begin(...
Java
UTF-8
6,182
2.421875
2
[]
no_license
package com.pj.magic.gui.panels; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.util.List; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.table.TableColumnModel; import org.springframework.beans.factory.annotation.Autowired; import com.pj.ma...
C++
UTF-8
3,171
2.640625
3
[ "Zlib" ]
permissive
#include "NativeMemory.hpp" #include <Main.h> #include <Psapi.h> namespace GTA { using namespace System::Collections::Generic; static MemoryAccess::MemoryAccess() { const uintptr_t patternAddress = FindPattern(EntityPoolOpcodePattern, EntityPoolOpcodeMask); // 3 bytes are opcode and its first argument, so we...
Markdown
UTF-8
150
3.140625
3
[]
no_license
# ML-Python My first python linear regression project for finding demand for bikes in a location based on climate, season, temperature, day, type,etc
Java
UTF-8
4,390
2.609375
3
[]
no_license
package by.bsuir.cinema.controller; import by.bsuir.cinema.entity.user.User; import by.bsuir.cinema.exception.ProjectException; import by.bsuir.cinema.jframe.admin.AdminMenuFrame; import by.bsuir.cinema.jframe.client.SignUpFrame; import by.bsuir.cinema.logic.UserLogic; import by.bsuir.cinema.jframe.client.UserMenuFram...
Java
UTF-8
2,983
2.8125
3
[]
no_license
/* * Copyright (C) 2010 Grupo Integrado de Ingeniería * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This progr...
Python
UTF-8
5,489
2.671875
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from pycompss.api.parameter import FILE_IN, FILE_OUT from pycompss.api.api import compss_wait_on, compss_delete_object from pycompss.api.task import task from ddf_library.utils import create_stage_files, save_stage_file, \ read_stage_file, generate_info, merge_schem...
Java
UTF-8
1,878
3.5625
4
[]
no_license
import java.awt.image.BufferedImage; import java.io.File; import javax.imageio.ImageIO; public class SpriteSheet { public BufferedImage sheet = null; public BufferedImage[][] spriteArray = null; public int sheetCol = 0; public int sheetRow = 0; SpriteSheet() { } Sp...
Java
UTF-8
1,645
1.929688
2
[]
no_license
package com.hapmon.mapreduce.aspects; public class JobDto { private String jobName; private String jobId; private long totalExecutionTime; private long mapperExecutionTime; private long reducerExecutionTime; private String mapperName; private String reducerName; private String ...
PHP
UTF-8
1,226
2.5625
3
[]
no_license
<?php session_start();?> <?php // Tout début du code PHP. Situé en haut de la page web ini_set("display_errors",0);error_reporting(0); ?> <h1>Liste des comediens</h1> <a data-rel="dialog" data-transition="pop" href="index.php?action=addCP">Ajout d'un comédien</a><br/><br/> <ul data-role="listview" class="ui-listvie...
JavaScript
UTF-8
871
2.859375
3
[]
no_license
import React, { Component } from 'react' export default class App extends Component { constructor() { super() this.state = { message: 'Hello World' } } render() { return ( <div> <h2>當前計數: {this.state.message}</h2> <button onClick={e => this.changeTest()}>改變文本</button>...
PHP
UTF-8
2,959
2.671875
3
[]
no_license
<? require_once $_SERVER['DOCUMENT_ROOT' ] . "/src/classes/CCore/globals.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/src/classes/CError/CError.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/src/classes/CRes/CRes.php"; class CStatus { public $id = false; public $entity = false; public $type = false; ...
C#
UTF-8
27,299
2.6875
3
[]
no_license
/*============================================================================================================================== | Author Ignia, LLC | Client Ignia, LLC | Project Topics Library \========================================================================================================...
PHP
UTF-8
1,791
2.875
3
[]
no_license
<?php include('database.txt'); try { $dbh = new PDO('mysql:host='.$server.';port='.$port.';dbname='.$dbname, $user, $pass); } catch (PDOException $e) { print $e->getMessage(); exit; } $boss_id = $_GET['boss_id']; ?> <html> <head> <title>Daniel Order</title> </head> <body bgcolor="white"> ...
PHP
UTF-8
15,352
2.546875
3
[]
no_license
<?php require_once('../classes/db.class.php'); require_once('../classes/ralph.php'); $db = new db_class; // Open up the database connection. if (!$db->connect()) $db->print_last_error(false); if(isset($_POST['submit'])) { /* foreach($_POST as $value){ print "<pre>"; print $value; print "</pre>"; }...
Java
UTF-8
116
1.945313
2
[]
no_license
package com.gorecode.vk.utilities; public interface TimeFormatter { public String format(long timeMillis); }
Markdown
UTF-8
1,945
3.96875
4
[]
no_license
# 1788. Maximize the Beauty of the Garden ## Level Hard ## Description There is a garden of `n` flowers, and each flower has an integer beauty value. The flowers are arranged in a line. You are given an integer array `flowers` of size `n` and each `flowers[i]` represents the beauty of the `i-th` flower. A garden is *...
Python
UTF-8
5,158
3.046875
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Sep 9 13:33:20 2020 @author: mason """ import numpy as np import pandas as pd s = pd.Series([1,3,5,np.nan,6,8]) s df = pd.DataFrame({'A': 1., 'B': pd.Timestamp('20130102'), 'C': pd.Series(1, index = list(range...
Markdown
UTF-8
1,041
2.71875
3
[]
no_license
# Final-project ## Documentation for bachelor degree's final project ### Multi-Dimensional Scaling Method for Tracking Teenager Group Activity on Crowded Place in Real-Time Based on Data Sensor of Mobile Device _**Preliminary**_ <br> we as humans do many activities every day. In the industrial revolution 4.0 and Soci...
Ruby
UTF-8
1,438
2.703125
3
[ "MIT" ]
permissive
module Crufty def self.find_methods(dir, sensitivity) Dir.chdir(RAILS_ROOT) sensitivity = (sensitivity || 1).to_i Dir["#{dir.sub(/\/\Z/, '')}/**/*.rb"].each do |file| methods = [] File.open(file, 'r') do |f| f.each_line do |l| methods.push l[/def ([a-z_\?\.!]+)/, 1] ...
Swift
UTF-8
2,860
2.515625
3
[ "MIT" ]
permissive
// // ListConnectionInteractor.swift // Titan // // Created by Nghia Tran on 11/17/16. // Copyright © 2016 fe. All rights reserved. // import Cocoa import PromiseKit protocol ListConnectionInteractorInput: ListConnectionsControllerOutput { } protocol ListConnectionInteractorOutput { func presentError(_...
Python
UTF-8
1,582
2.859375
3
[]
no_license
# Initialization import time start_time = time.time() import pandas as pd import numpy as np import nltk import string import sklearn np.set_printoptions(threshold=np.nan) emails_df = pd.read_csv("./data/spam.csv", encoding= "ISO-8859-1") emails_df = emails_df.drop(["Unnamed: 2", "Unnamed: 3", "Unnamed: 4"], axis=1...
Markdown
UTF-8
5,303
2.765625
3
[ "MIT" ]
permissive
# 재사용 메커니즘(Reuse Mechanism) 테이블 뷰에서 셀의 수가 많아도 부드러운 스크롤 UI를 구현할 수있음 동작원리 1. 테이블 뷰가 화면에 나타낼 셀 객체를 자신의 데이터 소스에게 요청 2. 데이터 소스는 재사용큐에서 사용 가능한 셀이 있는지 확인 3. 사용 가능한 셀이 있다면 그중 하나를 꺼내 전달, 없으면 새로운 셀 생성 4. tableView(_:cellForRowAt:) 메소드가 셀의 콘텐츠 구성 후 반환(return cell) 하면 테이블 뷰는 셀을 받아 화면에 표시함 5. 테이블 뷰를 스크롤함에 따라 화면을 벗어난 셀은 테이블 뷰에서 제...
Java
UTF-8
288
1.835938
2
[]
no_license
package jstarcraft.gui.ui.list; import javax.swing.JComponent; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicListUI; public class StarListUI extends BasicListUI { public static ComponentUI createUI(JComponent c) { return new StarListUI(); } }
Java
UTF-8
452
3.234375
3
[]
no_license
package com.uday.java8.joda; import java.time.LocalDate; import java.time.Month; import java.time.Period; public class PeriodUsage_43 { public static void main(String args[]){ LocalDate birthDate=LocalDate.of(1994, Month.JUNE,24); LocalDate todayDate=LocalDate.now(); Period period= Perio...
Java
UTF-8
6,982
2.6875
3
[]
no_license
import java.awt.*; import java.awt.event.*; public class calculator extends Frame implements ActionListener { TextField tf; String s1,s2,s3,s4,s5,c; int n; calculator() { Font font1 = new Font("SansSerif", Font.BOLD, 20); tf=new TextField(20); tf.setBounds(10,70,300,50);...
JavaScript
UTF-8
1,175
2.9375
3
[ "MIT" ]
permissive
"use strict"; var Rx = require("rxjs/Rx"); var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest; function get(url) { return Rx.Observable.create(function(observer) { // Make a traditional Ajax request var req = new XMLHttpRequest(); req.open('GET', url); req.onload = funct...
C#
UTF-8
2,716
2.703125
3
[]
no_license
using System; using System.Globalization; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; using System.Printing; namespace Petzold.PrintWithMargins { public class PrintWithMargins : Window { PrintQueue prnqueue; PrintTicket prntkt; Thickness marginPa...
Rust
UTF-8
5,378
2.625
3
[ "Apache-2.0", "MIT" ]
permissive
use std::collections::HashMap; use sage::Idea; use book::word::Word; use model::yaml::seq; use model::yaml::map; use std::borrow::Cow; pub struct Volume { pub complete: bool, pub gist: Vec<(Option<String>, usize, Word)>, buff: Option<HashMap<usize, Idea>> } impl Volume { pub fn new () -> Volum...
PHP
UTF-8
784
2.828125
3
[ "MIT" ]
permissive
<?php namespace WebservicesNl\Connector; use WebservicesNl\Connector\ProtocolAdapter\AdapterInterface; /** * Class BaseConnector. * * Platform connector parent. */ abstract class AbstractConnector implements ConnectorInterface { const PLATFORM_NAME = 'abstract'; /** * @var AdapterInterface */ ...
C++
UTF-8
1,067
3
3
[]
no_license
#pragma once #include <iostream> #include <list> #include <stack> #include <random> #include <chrono> #include <queue> #include <conio.h> using namespace std; struct MyComparator; class GraphNode { friend MyComparator; public: bool visited; private: int **boardState; int h; GraphNode *contiguousNodes[4]; pub...
JavaScript
UTF-8
3,012
2.90625
3
[]
no_license
import GamestateNode from './GamestateNode'; import { fiveInRow } from './ranking'; const max_children = 40; // s0: 4 10: 18 35 const highValue = fiveInRow * 100; /** * * @param {GamestateNode} gamestateNode * @param {integer} ply round number * @param {integer} maxPly number bigger then ply * @param {1 or 2} t...
Python
UTF-8
315
4.5
4
[]
no_license
#利用条件运算符的嵌套来完成此题:学习成绩>=90分的同学用A表示,60-89分之间的用B表示,60分以下的用C表示。 score = int(input('输入成绩:\n')) if score > 90: grade = 'A' elif score >= 60: grade = 'B' else: grade = 'C' print('%d is %s grade'%(score,grade))
Ruby
UTF-8
903
2.828125
3
[]
no_license
require 'json' require 'uri' require 'open-uri' class Search def self.party(query = "", tags = []) return if query.empty? && tags.empty? path = "/search?q=#{query.escaped}" path << "&tags=#{tags.join(",").escaped}" unless tags.empty? (query_api path)['results'].flatten end def self.cats (q...
Java
UTF-8
16,176
2.09375
2
[]
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 UI; /** * * @author camin */ public class Ajout_Exam extends javax.swing.JFrame { /** * Creates new form Param ...
C
UTF-8
1,907
3.4375
3
[]
no_license
#include <stdio.h> #include <stdlib.h> typedef struct score { int num; int de; int cai; int all; }Student; int cmp(const void *a,const void *b) { if((((Student*)b)->all==((Student*)a)->all)) { if((((Student*)b)->de==((Student*)a)->de)) return ((Student*)a)->num-((Student*)b)->num; ...
C++
UTF-8
1,789
3.828125
4
[]
no_license
#include "iostream" #include "fstream" using namespace std; class item { private: string name; int price; int qty; public: item() {} item(string n, int p, int q); friend ostream &operator<<(ostream &out, item &it); friend ofstream &operator<<(ofstream &ofs, item &i); friend ifstrea...
Python
UTF-8
366
3.59375
4
[]
no_license
n, k = map(int, input().split()) result = 0 # 횟수 #N이 K이상이라면 K로 계속 나누기 while n>=k: #N이 K로 나누어 떨어지지 않는다면 1씩 빼기 while n % k !=0: n -=1 result += 1 # K로 나누기 n //= k result +=1 #마지막으로 남은 수에 대해 1씩 빼기 while n>1: n -=1 result +=1 print(result)
Python
UTF-8
1,037
2.75
3
[ "MIT" ]
permissive
import torch import torch.nn as nn from ..functional import (crop_2d, crop_3d) class Crop2d(nn.Module): """ :params torch.Tensor input: Input(B, C, W, H) """ def __init__(self, crop_left: int=0, crop_right: int=0, crop_top: int=0, crop_bot...
TypeScript
UTF-8
18,208
3.015625
3
[ "MIT" ]
permissive
'use strict' import * as stringhelper from "../helpers/string"; import * as textTokenFactory from "../models/textToken"; import * as propertyTokenFactory from "../models/propertyToken"; import { TextStream, TextStreamDirection } from "./textStream"; import { TextToken } from "../models/textToken"; import { PropertyTo...
Java
UTF-8
1,240
2.21875
2
[]
no_license
package com.lagn.mascotas; public class Razas { private int id; private String razaprro; private int Fotoperro; private int boton; private int Likesdados; public Razas(String razaprro, int fotoperro, int numerolikes) { this.razaprro = razaprro; this.Fotoperro = fotoperro; this.Likesdados...
Java
UTF-8
11,391
1.953125
2
[]
no_license
package com.imnu.mm.controller; import java.io.ByteArrayOutputStream; import java.io.DataInputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.net.URL; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util....
Python
UTF-8
12,249
2.71875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
#!/usr/bin/env python import logging from dipy.data import get_sphere from nose.tools import assert_equal import numpy as np from scipy.spatial.distance import (cosine, euclidean, mahalanobis) from scipy.special import logsumexp, softmax import torch from torch.nn.utils.rnn import PackedSequence from dwi_ml.models.di...
Swift
UTF-8
1,726
3.3125
3
[]
no_license
// // content.swift // simpleCarousel // // Created by Hanson on 16/3/19. // Copyright © 2016年 hanson. All rights reserved. // import UIKit class Content { // MARK: - Public API var title = "" var description = "" var numberOfMembers = 0 var numberOfPosts = 0 var featuredImage: UIImage! ...
Python
UTF-8
747
2.515625
3
[]
no_license
from collections import Counter from nltk import tokenize from datastore.table_names import BertTokenizedCluewebDoc, TokenizedCluewebDoc, CluewebDocTF def tokenize_doc_and_save(buffered_saver, doc_id, core_text, tokenize_fn): # tokenize the docs chunks = bert_tokenize(core_text, tokenize_fn) buffered_sa...
Java
UTF-8
2,703
2.703125
3
[ "BSD-3-Clause" ]
permissive
/* * Copyright (c) 2010, Nathan McCrina * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditio...
Python
UTF-8
2,486
2.78125
3
[]
no_license
import sys import socket import json import glob # Create a TCP/IP socket sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # Connect the socket to the port where the server is listening server_address = ('localhost', 10000) print >>sys.stderr, 'connecting to %s port %s' % server_address sock.connect(server_ad...
C++
UTF-8
1,431
3.25
3
[ "MIT" ]
permissive
class Solution { public: int myAtoi(string s) { const int N = s.length(); // Step 1: remove leading whitespaces and save startPos of digits int startPos = 0; while(startPos < N && s[startPos] == ' '){ startPos += 1; } // Step 2...
Java
UTF-8
602
2.3125
2
[]
no_license
package aspects; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import aspects.service.ShapeService; public class AopMain { public static void main(String[] args) { ApplicationContext ctx = new ClassPathXmlApplicationContext("spri...
C++
UTF-8
341
3.125
3
[]
no_license
#pragma once #include <string> #include <iostream> class Enemy { protected: int _hp; std::string _type; public: Enemy(int hp = 0, std::string const & type = "common"); Enemy(Enemy const &); Enemy & operator=(Enemy const &); virtual ~Enemy(); std::string const & getType() const; int getHP() const; virtual void...