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 |
|---|---|---|---|---|---|---|---|
Markdown | UTF-8 | 452 | 3.5625 | 4 | [
"MIT"
] | permissive | # 191. 位 1 的个数
## 题目
编写一个函数,输入是一个无符号整数(以二进制串的形式),返回其二进制表达式中数字位数为 '1' 的个数(也被称为汉明重量)。
## 题解
### 转换二进制
```js
/**
* @param {number} n - a positive integer
* @return {number}
*/
var hammingWeight = function(n) {
let c = 0;
while (n) {
if (n % 2) c++;
n = Math.floor(n / 2);
}
return c;
};
```
|
C++ | UTF-8 | 608 | 3.265625 | 3 | [] | no_license | #include <iostream>
#include "vector.h"
#include "strlib.h"
#include "console.h"
using namespace std;
char* copyCString(char* str);
unsigned long strlen(char* str);
int main() {
char* str = "hello world";
cout << "Copy of " << str << " is " << copyCString(str) << endl;
return 0;
}
char* copyCString(char... |
C# | UTF-8 | 787 | 2.578125 | 3 | [] | no_license | <Query Kind="Expression">
<Connection>
<ID>9f536fc5-abf6-4d0d-a44e-9b36870cd229</ID>
<Persist>true</Persist>
<Server>.</Server>
<Database>eRestaurant</Database>
</Connection>
</Query>
//Order Clause
from X in Items
orderby X.Description
select X
// also available ascending and descending
from f... |
JavaScript | UTF-8 | 1,861 | 2.796875 | 3 | [] | no_license | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function createDefaultGhost(target) {
return new Proxy(target, {
get: function (obj, prop) {
return function () {
let args = arguments;
return function (defaultData) {
... |
C++ | UTF-8 | 1,036 | 2.71875 | 3 | [] | no_license | // https://www.urionlinejudge.com.br/judge/en/problems/view/1911
#include <bits/stdc++.h>
using namespace std;
bool false_signature(string const &original, string const &checked)
{
size_t i, diffs = 0;
for (i = 0; diffs <= 1 && i < original.size(); ++i) {
if (original[i] != checked[i])
+... |
PHP | UTF-8 | 462 | 2.6875 | 3 | [
"MIT"
] | permissive | <?php
declare(strict_types = 1);
namespace Korobovn\CloudPayments\Message\Traits\ModelField;
trait PeriodInt
{
/** @var int */
protected $period;
/**
* @return int
*/
public function getPeriod(): int
{
return $this->period;
}
/**
* @param int $period
*
*... |
Markdown | UTF-8 | 1,472 | 2.984375 | 3 | [] | no_license | ## Live Version
https://ktran031.github.io/udacity-fend-restaurant-review-app/
# Project Overview: Stage 1
For this Restaurant Reviews app, I converted a static webpage to a mobile-ready web application. In Stage One, I took a static design that lacks accessibility and converted the design to be responsive on differen... |
Python | UTF-8 | 1,092 | 2.90625 | 3 | [] | no_license | import torch
import torch.nn.functional as F
import torch.nn as nn
class QNetwork(nn.Module):
def __init__(self, state_size, action_size, seed, fc1_units=64, fc2_units=32):
super(QNetwork, self).__init__()
self.seed = torch.manual_seed(seed)
'''
self.fc1 = nn.Linear(state_size... |
C# | UTF-8 | 721 | 2.859375 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace RecipeSystem
{
public class XmlSaveLoad
{
public static void SaveFile( object obj, string fullPath)
{
using (StreamWriter writer = new... |
Java | UTF-8 | 2,418 | 2.59375 | 3 | [] | no_license | /**
* @Title: HttpClientUtil.java
* @Package com.sunyuki.ec.group.base.util
* @Description: TODO(用一句话描述该文件做什么)
* @author liuchun
* @date 2015年12月25日 下午5:03:21
* @version V1.0
*/
package com.ec.facilitator.base.util;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
... |
Python | UTF-8 | 11,980 | 3.484375 | 3 | [] | no_license | #!/usr/bin/env python
"""
Author
======
Nicolas Poilvert
Date
====
October 2010
This function reads a Wannier90 output file that stores
a lead matrix (files ending in "_htB.dat", "_htL.dat"
and "_htR.dat") and computes the band structure of the
lead. For this, sub-blocks of the H00 an... |
Markdown | UTF-8 | 52,915 | 3.109375 | 3 | [] | no_license | Self-refinement
===============
At this stage the following three acts should be performed:
A. Refinement of self from all sort of false beliefs, evil thoughts, and
superstitions.
B. Refinement of self from vices and moral indecencies.
C. Quitting all kind of sins and transgressions.
False beliefs and superstition... |
C# | UTF-8 | 1,321 | 2.71875 | 3 | [] | no_license | using UnityEngine;
using System.Collections;
public class Grid : MonoBehaviour {
public static int height=20;
public static int width=10;
public static Transform[,] grid = new Transform[width, height];
public static Vector2 roundVector(Vector2 v)
{
return new Vector2 (Mathf.Round (v.x), Mathf.Round (v.y));
... |
C++ | UTF-8 | 1,257 | 2.890625 | 3 | [] | no_license | #include "../stdafx.h"
#include "CityManager.h"
CityManager::CityManager()
{
}
CityManager* CityManager::GetInstance()
{
if (!s_sharedCityManager)
{
s_sharedCityManager = new CityManager();
s_sharedCityManager->init();
}
return s_sharedCityManager;
}
void CityManager::DestroyInstace()
{
if (s_sharedCityMan... |
Java | UTF-8 | 3,048 | 2.546875 | 3 | [] | no_license | package nl.edm_programming.voodoo;
import org.bukkit.entity.EntityType;
import java.util.Random;
public class Util {
public static EntityType generateRandomMobs(){
Random random = new Random();
int i = random.nextInt(31);
EntityType mob;
switch (i) {
case 1:
... |
PHP | UTF-8 | 943 | 3.0625 | 3 | [] | no_license | <?php namespace Controllers;
use Exception;
use mysqli;
use Services\Service;
class BaseController extends Mysqli{
private string $host='localhost';
private string $user='root';
private string $password='';
private string $database = 'test';
private ?string $port = NULL;
private ?string $socke... |
JavaScript | UTF-8 | 1,847 | 2.65625 | 3 | [] | no_license | 'use strict'
const axios = require('axios')
const fromThousandsNumberToKString = (number = 0) =>
number > 999 ? `${(number / 1000).toFixed(0)}K` : number.toString()
/**
*
* @param {string} subreddit - Subreddit name
* @param {string} time - Posts date timeframe ('day')
* @param {number} limit - Limit posts amou... |
C | UTF-8 | 229 | 2.78125 | 3 | [] | no_license | #include<stdio.h>
int main()
{
int n,i,a,s,d,c=0;
scanf("%d",&n);
a=n;
while(n!=0)
{
s=1;
d=n%10;
for(i=1;i<=d;i++)
s*=i;
c+=s;
n=n/10;
}
if(a==c)
printf("true");
else
printf("false");
}
|
C++ | UTF-8 | 260 | 3.15625 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main() {
int test_arr[6] = {10, 22, 13, 99, 4, 5};
int i, sum = 0;
for(i = 0; i < 6; i++) {
cout << test_arr[i] << endl;
sum = sum + test_arr[i];
}
cout << "The sum is: " << sum;
return 0;
}
|
SQL | UTF-8 | 3,780 | 4.125 | 4 | [] | no_license | SET SERVEROUTPUT ON;
DECLARE
counter NUMBER;
total NUMBER;
--Sales cursor for monthly income from rentals
CURSOR Sales_Cursor IS
SELECT RENTAL.PAYMENTMETHOD, EXTRACT (MONTH FROM RENTAL.RENTDATE)AS MONF, SUM(RENTITEM.RENTFEE)AS ALLRENTS
FROM ALLPO... |
Shell | UTF-8 | 553 | 3.5 | 4 | [] | no_license | #!/usr/bin/env bash
# YOUTRACK_HOME is defined in the dockerfile
SETUP_FILE=$YOUTRACK_HOME/initial-setup-done
EXECUTABLE=$YOUTRACK_HOME/bin/youtrack.sh
# Check if there are any java options, and there are no setup file
if [ -n "$JETBRAINS_YOUTRACK_JVM_OPTIONS" ] && [ ! -f $SETUP_FILE ]; then
echo Setting JVM Opti... |
Markdown | UTF-8 | 2,979 | 3.203125 | 3 | [] | no_license | ---
layout: post
title: "Elasticsearch HTTP Queries with Jest"
date: 2015-04-03 12:35:00 -0600
comments: true
categories: [programming]
tags: [elasticsearch, solr, java, jest, http]
---
Elasticsearch has a robust and expansive java api with one large issue - you cannot use the Elasticsearch HTTP Rest protocol to talk t... |
Java | UTF-8 | 487 | 2.359375 | 2 | [] | no_license | package com.gdufe.kevany.chapter14_type_information.registered_factories.filters;
/**
* @author: kevanyzeng
* @date: 2018/12/3 23:14
* @description:
*/
public class CabinAirFilter extends Filter {
public static class Factory
implements
com.gdufe.kevany.chapter14_type_information.regist... |
C# | UTF-8 | 428 | 2.9375 | 3 | [] | no_license | public static string MyJoin(this IEnumerable<IEnumerable<IEnumerable<string>>> items)
{
return items.SelectMany(x => x.MyJoin());
}
public static string MyJoin(this IEnumerable<IEnumerable<string>> items)
{
return items.SelectMany(x => x.MyJoin(());
}
public static string MyJ... |
Java | UTF-8 | 428 | 1.921875 | 2 | [] | no_license | package com.example.jpademo.entity;
import lombok.Data;
import javax.persistence.*;
/**
* Created by Dangdang on 2017/12/21.
*/
@Entity
@Data
@Table(name = "book", schema = "transactiondemo")
public class BookEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", nullable... |
Shell | UTF-8 | 287 | 2.78125 | 3 | [] | no_license | #Get line of touchpad
ID=$(xinput | grep Touchpad)
#Get id of touchpad
ID=`echo ${ID#*id=} | awk '{print $1}'`
#Set l0 to turn off the touchpad
alias l0="xinput set-prop ${ID} \"Device Enabled\" 0"
#Set l1 to turn on the touchpad
alias l1="xinput set-prop ${ID} \"Device Enabled\" 1"
|
C++ | UTF-8 | 1,679 | 3.296875 | 3 | [] | no_license | #include <stdio.h>
#include <vector>
using namespace std;
char array_info[10][10];
struct pos
{
unsigned int x;
unsigned int y;
};
struct pos_pair
{
pos pos1;
pos pos2;
};
void print_array(unsigned int row,unsigned int column)
{
for(unsigned int i=0;i<row;++i)
{
for(unsigned int j=0;... |
Python | UTF-8 | 1,607 | 3.453125 | 3 | [] | no_license | # 打开文件
f = open("C:\\Users\\14259\Desktop\\temporary\\test.txt")
# 定义一下根目录
dirname = "C:\\Users\\14259\Desktop\\temporary\\"
# 然后使用两个列表分别存储分割之后的内容
boy = []
kefu = []
#需要一个count来给文件命名
count = 1
for each_line in f:
if each_line[0:6] != "======":
# print(each_line.split(":"))
# print(each_line[:6])
... |
Markdown | UTF-8 | 1,479 | 2.984375 | 3 | [] | no_license | # Weather-Application
Node.js command line application built for giving the temperature of the location which you input.
### Prerequisites
To get this project on your local machine, you need to have [Node.js](https://nodejs.org).
### Installing
Install the project by navigating to the weather-application directory... |
JavaScript | UTF-8 | 1,502 | 3.046875 | 3 | [] | no_license | $(document).ready(function() {
var position_1 = 1;
var position_2 = 1;
var winner = 0;
var player1_id = $("tr#player1_strip").attr("player-id");
var player2_id = $("tr#player2_strip").attr("player-id");
var start_time = new Date().getTime();
$(document).on('keyup', function(event) {
var move =... |
Python | UTF-8 | 6,202 | 3.5625 | 4 | [
"MIT"
] | permissive | import unittest
from typing import List
from data_test_search_in_rotated_sorted_array import long_list
class Solution():
def search(self, nums: List[int], target: int) -> int:
if not nums:
return -1
index_left = 0
index_right = len(nums)-1
if nums[index_left] < nums[i... |
PHP | UTF-8 | 435 | 2.625 | 3 | [] | no_license | <?php
// exercice 1 30/03/2020
// ma première action
function test_hook(){
echo '<p class="hello"> Moi comprendre !!</p>';
}
add_action( 'test', 'test_hook');
add_filter( 'the_content', 'display_time_ago' );
// Hook time ago
function display_time_ago ( $content ) {
$content .= "
" . __( '<br>Posté i... |
PHP | UTF-8 | 338 | 2.65625 | 3 | [] | no_license | <?
class SigCheck {
private $tool = '';
public function __construct() {
}
public function init($params) {
if(isset($params['home_dir'])) {
$this->tool = '"'.$params['home_dir'].DIRECTORY_SEPARATOR.'sigcheck.exe"';
} else {
$this->tool = 'sigcheck.exe';
}
}
public function check(... |
Java | UTF-8 | 334 | 1.664063 | 2 | [] | no_license | package com.kirg.referencelinksystem.data.notUsedCurrently;
import com.kirg.referencelinksystem.entity.notUsedCurrently.Customer;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface CustomerRepository extends JpaRepository <Custo... |
Python | UTF-8 | 3,754 | 3.078125 | 3 | [] | no_license |
# Simple reading and writing to a small EEPROM using the MPSSE library and a FT232 in Python
#
# The EEPROM is a 256 byte device located at 0x50 on the bus. It is
# AT24C02 – 2-Wire Bus Serial EEPROM (Atmel)
# 256 bytes / 2 kilobit – 8 bytes / page
# http://www.atmel.com/devices/AT24C02.aspx
#
# Project started from:... |
Markdown | UTF-8 | 3,106 | 3.109375 | 3 | [
"MIT"
] | permissive | ---
title: المسيح في سفر الرؤيا (الجزء الثاني)
date: 19/04/2018
---
`اقرأ رؤيا ١: ١٠-١٨. ماذا يقول المسيح عن نفسه في هذه الفقرة الكتابية؟`
يظهر المسيح في هذه الآيات واقفاً في القسم الأول من المقدس السماوي. وقد كان ظُهُور المسيح في هذا الدور هائلاً للغاية لدرجة أن يوحنا سقط عند قدميه بخوف. والمسيح، الذي يعزي ويطمئن... |
Java | UTF-8 | 23,909 | 1.96875 | 2 | [] | no_license | package com.mark.manager.pojo;
import java.util.ArrayList;
import java.util.List;
public class VproCoursesCoverExample {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table vpro_courses_cover
*
* @mbg.generated Thu Jan 10 23:05:16 CST 2019
*... |
C++ | UTF-8 | 784 | 2.5625 | 3 | [] | no_license | #include "visualizeritem.h"
cuteGraphLib::VisualizerItem::VisualizerItem(std::string name, QGraphicsScene* scene, QObject *parent) :
QObject(parent)
{
this->name = name;
this->scene = scene;
scene->setParent(this);
}
cuteGraphLib::VisualizerItem::~VisualizerItem()
{
delete scene;
}
std::string cu... |
Python | UTF-8 | 5,322 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python
import tornado.ioloop
import tornado.web
# шаблонизатор
loader = tornado.template.Loader(".")
# утилита перегрузки сервера при изменениях кода
from tornado import autoreload
# обработчик вебсокетов
from tornado.websocket import WebSocketHandler
import json
import datetime
import time
import hashli... |
Python | UTF-8 | 566 | 2.875 | 3 | [
"Apache-2.0",
"LLVM-exception",
"NCSA"
] | permissive | """
Test that IntLiteral.p_denoted_value properly decodes all valid Ada integer
literals. Also exercise several erroneous cases that are still accepted by
Libadalang's lexer.
"""
import libadalang as lal
c = lal.AnalysisContext('utf-8')
u = c.get_from_file('foo.ads')
for decl in u.root.findall(lal.NumberDecl):
... |
Python | UTF-8 | 391 | 3.53125 | 4 | [] | no_license | def DecimalToBinary(num):
decimal =0
for i in num:
decimal = decimal*2 + int(digit)
print(decimal)
DecimalToBinary(101)
def BinaryConcatenation(x,y):
binX = str(bin(x))
binX = binX[2:]
binY = str(bin(y))
binY = binY[2:]
binXplusY = binX+binY
binYplusX = bi... |
Python | UTF-8 | 576 | 2.640625 | 3 | [] | no_license | import re
import sys
import os.path
import hashlib
PATH = sys.argv[1]
filemd5 = {}
f = open("duplicate_list", "w")
def visit(arg, dirname, filenames):
for filename in filenames:
sys.stdout.write('.')
if not(os.path.isdir(dirname + "\\" + filename)):
md5 = hashlib.md5(open(dirname + "\\" + filename,'rb... |
C# | UTF-8 | 4,205 | 2.546875 | 3 | [] | no_license | using Backend.Models;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Serialization;
namespace Backend.ViewModels
{
public class... |
Markdown | UTF-8 | 2,580 | 2.515625 | 3 | [] | no_license | ---
short_name: "li:jneurophys_2009"
title: "What response properties do individual neurons need to underlie position and clutter 'invariant' object recognition?"
authors: [Nuo Li, David D. Cox, Davide F. Zoccolan, James J. DiCarlo]
type: journal
venue: "Journal of Neurophysi... |
C# | UTF-8 | 2,390 | 2.671875 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using AuthenticationWebApi.Entities;
using AuthenticationWebApi.Interfaces;
using AuthenticationWebApi.Helpers;
using Microsoft.Extensions.Options;
using AuthenticationWebApi.Models;
namespace AuthenticationWebApi.Services
{
public clas... |
Java | UTF-8 | 12,240 | 2.265625 | 2 | [] | no_license | package com.projects.bookpdf.ui.category;
import android.content.Context;
import android.util.Log;
import android.widget.AbsListView;
import android.widget.GridView;
import androidx.fragment.app.FragmentActivity;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
import androidx.recyclerv... |
Markdown | UTF-8 | 721 | 2.875 | 3 | [] | no_license | # Simple Portfolio
*******************************************
## Overview
This project was designed as a way to showcase the projects I have created over the course of the University of Oregon Coding Bootcamp.
There are three menu items at the top: the home page, a list of the pages I have created, and the contact in... |
PHP | UTF-8 | 2,233 | 2.53125 | 3 | [
"BSD-3-Clause"
] | permissive | <?php
namespace frontend\modules\user\controllers;
use common\models\UserProfile;
use yii\web\NotFoundHttpException;
use frontend\controllers\BehaviorsController;
/**
* ProfileController implements the CRUD actions for UserProfile model.
*/
class ProfileController extends BehaviorsController
{
/**
* Lists... |
TypeScript | UTF-8 | 323 | 2.609375 | 3 | [
"MIT"
] | permissive | export const defer = <P, E>() => {
let internalResolve: (payload: P) => void
let internalReject: (error: E) => void
const promise = new Promise((resolve, reject) => {
internalResolve = resolve
internalReject = reject
})
return {
promise,
resolve: internalResolve,
reject: internalReject
}... |
C++ | GB18030 | 2,083 | 2.765625 | 3 | [] | no_license | #ifndef _CELL_BUFFER_HPP_
#define _CELL_BUFFER_HPP_
#include "Cell.hpp"
class CELLBuffer {
public:
CELLBuffer(int nSize = 8192) {
_nSize = nSize;
_pBuff = new char[nSize];
}
~CELLBuffer(){
if (_pBuff) {
delete[] _pBuff;
_pBuff = nullptr;
}
}
bool push(const char* pData,int nLen) {
//if (_nLast + nL... |
Python | UTF-8 | 1,569 | 3.03125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import click
import decimal
import drawSvg as draw
import math
def drange(x, y, jump):
while x < y:
yield float(x)
x += decimal.Decimal(jump)
@click.command(context_settings={"help_option_names": ["-h", "--help"]})
@click.option(
"--diameter",
"-d",
help="Oute... |
Python | UTF-8 | 378 | 3.640625 | 4 | [] | no_license | def main ():
print ("Enter temperature")
a = input ();
try:
a = float (a)
except ValueError:
print ("Not a number")
return
if a >= -273:
kel = a + 273
print ("Kel", kel)
far = a * (9 / 5) + 32
print ("Faren" , far)
else:
print ("Mi... |
SQL | UTF-8 | 343 | 3.8125 | 4 | [] | no_license | select start_date, min(end_date)
from
(select start_date from projects where start_date not in (select end_date from projects)) as t1,
(select end_date from projects where end_date not in (select start_date from projects)) as t2
where start_date < end_date
group by start_date
order by datediff(min(end_date), st... |
Python | UTF-8 | 2,087 | 2.703125 | 3 | [] | no_license | import inline as inline
import matplotlib
import numpy
import pandas
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import train_test_split
import matplotlib.pyplot as plt
import constants
import spark_interface
import seaborn as sns
import matplotlib.pyplot as plt
sns.set_style("whi... |
PHP | UTF-8 | 6,118 | 2.953125 | 3 | [] | no_license | <?php
//------------------------------------------------------------------------------
// General.Functions.Inc v2.0
//
// (c) Andrew Collington - amnuts@talker.com
// (c) Michael Doig - michael@mike250.com
//------------------------------------------------------------------------------
// general fun... |
Python | UTF-8 | 3,647 | 3.390625 | 3 | [] | no_license | import random
from binascii import unhexlify
from sys import exit
from Crypto.Cipher import AES
'''
pads message to be a multiple of blocksize.
message is a byte array.
'''
def pad(message, blockSize):
if (message is None) or (len(message) == 0):
raise ValueError('message cannot be null or empty')
if t... |
C | UTF-8 | 356 | 2.96875 | 3 | [
"Apache-2.0"
] | permissive | #include<stdio.h>
#include<stdlib.h>
#include<stdarg.h>
void name(int count,...){
va_list ap;
va_start(ap,count);
int a = va_arg(ap,int);
printf("%d ",a);
a = va_arg(ap,int);
printf("%d ",a);
double d = va_arg(ap,double);
printf("%f ",d);
a = va_arg(ap,int);
printf("%d \n",a);
}
int main()
{
name(4,1,2,3.... |
Java | UTF-8 | 2,437 | 2.71875 | 3 | [] | no_license | package com.example.poetryapp;
import android.content.Context;
import android.content.res.AssetManager;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
pu... |
Python | UTF-8 | 2,010 | 2.671875 | 3 | [] | no_license | import unittest
from selenium_tests.pop_tests.pages.main import MainPage
from selenium_tests.pop_tests.pages.search import SearchPage
from selenium_tests.pop_tests.pages.basket import BasketPage
from selenium_tests.pop_tests.pages.login import LoginPage
from selenium_tests.pop_tests.pages.address import AddressPage
fro... |
Swift | UTF-8 | 766 | 3.140625 | 3 | [
"Unlicense"
] | permissive | //
// TextArea.swift
// SelabInventoryHelper
//
// Created by 詹昆宬 on 2021/6/8.
//
import Foundation
import SwiftUI
struct TextArea: View {
private let placeholder: String
@Binding var text: String
init(_ placeholder: String, text: Binding<String>) {
self.placeholder = placeholder
s... |
Go | UTF-8 | 2,052 | 3.078125 | 3 | [] | no_license | package main
import (
"testing"
"reflect"
)
func TestNext(t *testing.T) {
input := "azzzzzzz"
want := "baaaaaaa"
if got := NextInput(input); want != got {
t.Errorf("NextInput(%q) %q, want %q",input,got,want)
}
}
func TestNextValid(t *testing.T) {
inputs := []string{"abcdefgh","ghijklmn"}
wants := []string{... |
Markdown | UTF-8 | 2,414 | 3.203125 | 3 | [] | no_license | ---
date: '2012-06-02 13:10:59'
layout: post
slug: performing-the-refactoring-kata-pairing-with-josh-and-the-pairing-tour
status: publish
title: Performing the Refactoring Kata, pairing with Josh and the pairing tour
wordpress_id: '736'
categories:
- 8th Light
- Apprentice
---
**Preforming the Refactoring Kata**
At t... |
Markdown | UTF-8 | 26,243 | 2.984375 | 3 | [] | no_license | ---
title: "Display"
nodateline: true
weight: 1
---
The *display* module is available on platforms which have the *framebuffer* driver enabled. It allows for controlling the display of your device.
**Available on:** ✅ [CampZone 2020](/docs/badges/campzone-2020/) ✅ [Disobey 2020](/doc... |
Java | UTF-8 | 1,051 | 3.796875 | 4 | [] | no_license | /*
* @author Ariyana Ramos
*/
package org.howard.edu.lsp.exam.question40;
/*
* This is an abstract class defining a hierarchy that can represent Animals. The methods
* define the 2 behaviors: the ability to speak and the ability to move.
*/
public abstract class Animal {
String name;
String phrase;
/*
* T... |
C# | UTF-8 | 3,620 | 2.609375 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Text;
namespace UniTimetable
{
partial class Solver
{
public class Preset
{
string Name_;
List<Criteria> Criteria_;
List<Filter> Filters_;
#region Constructors
... |
Python | UTF-8 | 2,204 | 3.515625 | 4 | [] | no_license | # fit to y(x) = a_1 exp(a2 x) using a nonlinear fitting technique that
# reduces to a multivariate root finding problem
#
# This is very sensitive to our initial guess
#
# M. Zingale (2013-03-10)
import numpy
import numpy.linalg
import pylab
tol = 1.e-5
def fun(a, x, y):
""" the derivatives of our fitting funct... |
Swift | UTF-8 | 763 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive |
import UIKit
class ViewController2: UIViewController {
var textV2: String!
@IBOutlet weak var historyText: UITextView!
override func viewDidLoad() {
super.viewDidLoad()
historyText.editable = false
historyText.scrollEnabled = true
historyText.text ... |
C++ | UTF-8 | 1,942 | 3.28125 | 3 | [
"Apache-2.0"
] | permissive | #include <bits/stdc++.h>
using namespace std;
// Complete the morganAndString function below.
bool compare(string s1, int i,string s2, int j)
{
while(i<s1.size() && j<s2.size())
{
if(s1[i] < s2[j])
return true;
else if(s1[i]> s2[j])
return false;
i++;
j+... |
Java | UTF-8 | 1,106 | 2.46875 | 2 | [] | no_license | package br.com.concretesolutions.animationdojo;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
public class Cena1Fragment extends Fragment implements AnimationFragment{
ViewGroup root;
View view;
... |
C | UTF-8 | 3,668 | 3.09375 | 3 | [] | no_license | /* Generic */
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
#include <semaphore.h>
#include <sched.h>
/* Network */
#include <netdb.h>
#include <sys/socket.h>
#define BUF_SIZE 100
struct arg_struct {
char* host;
char* portnum;
char*... |
Go | UTF-8 | 1,177 | 3.03125 | 3 | [
"MIT"
] | permissive | package wire
import (
"bytes"
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestNewEventBus(t *testing.T) {
eb := NewEventBus()
assert.NotNil(t, eb)
}
func TestSubscribe(t *testing.T) {
eb := NewEventBus()
myChan := make(chan *bytes.Buffer, 10)
assert.NotNil(t, eb.Subscribe("whateverTopic", ... |
Java | UTF-8 | 587 | 2.234375 | 2 | [] | no_license | package com.quarkus.repo;
import com.quarkus.model.User;
import io.quarkus.hibernate.orm.panache.PanacheRepositoryBase;
import javax.enterprise.context.ApplicationScoped;
import javax.transaction.Transactional;
@ApplicationScoped
public class UserRepo implements PanacheRepositoryBase<User,Long> {
public User fi... |
Java | UTF-8 | 3,249 | 4.28125 | 4 | [] | no_license | package com.example.sort.selection;
import java.util.Arrays;
/**
* @author hzq
* @date 2019/6/22 18:10
* @desc 从第一个元素开始,扫描整个待排数组,找到最小的元素放之后再与第一个元素交换位置,
* 然后再从第二个元素开始,继续寻找最小的元素与第二个元素交换位置,依次类推。
*/
public class SelectionSort {
public static void main(String[] args) {
int[] arr = {20,40,30,10,60,50};
... |
SQL | UTF-8 | 233 | 2.828125 | 3 | [] | no_license | -- Retrieves the roles
-- Suitable for Firebird 3.0 and higher
select
trim(trailing from ROLE_NAME) as ROLE_NAME,
COMMENTS
from (
select
RDB$ROLE_NAME as ROLE_NAME,
RDB$DESCRIPTION as COMMENTS
from RDB$ROLES
) roles
|
Java | UTF-8 | 223 | 2.828125 | 3 | [] | no_license | package edu.java.intermediate.exercise1.creation.structural.decorator;
public class Triangulo implements Forma{
@Override
public void mostrar() {
System.out.println("Se ha mostrado un triangulo");
}
}
|
Java | UTF-8 | 1,259 | 3.921875 | 4 | [] | no_license | package com.object;
//부모 클래스, Super, base, Parent 클래스
class Parent{
String name="Taek";
String addr="here";
//생성자
Parent(){
System.out.println("Parent 생성자");
}
String getName() {
return name;
}
String getAddr() {
return addr;
}
}
//자식 클래스, sub, deriv... |
Java | UTF-8 | 4,071 | 2.140625 | 2 | [] | no_license | package com.smartschool.bean;
import java.util.Date;
public class ContactInfoBean {
private long contactInfoId;
private long studentId;
private String firstContactNo;
private String streetNoName1;
private String city;
private String state;
private String country;
private String zipCode;
priva... |
Java | UTF-8 | 549 | 1.992188 | 2 | [] | no_license | package test.com.epam.create;
import com.epam.geometry.create.PointCreator;
import com.epam.geometry.exception.PointCreateException;
import com.epam.geometry.util.Tags;
import org.json.simple.JSONObject;
import org.junit.Test;
public class PointCreatorTest {
@Test(expected = PointCreateException.class)
publi... |
Markdown | UTF-8 | 1,502 | 2.921875 | 3 | [
"MIT"
] | permissive | # Focal Length Analyzer
Simple and quick project to get the focal length of images in a directory and it's subdirectories.
Background was to check which focal length I most commonly work with and use this data point in finding a good suited lens for my travels.
## Usage
### IDE
Set values in `CliConfig` and execute ... |
Java | UTF-8 | 722 | 2.234375 | 2 | [] | no_license | package com.wt.bean.table;
/**
* 地区表对应 island_package
* @author sl
*
*/
public class IslandPackageBean {
private Integer id;
private Integer areaId;//地区id
private Integer islandId;//岛屿id
private String title;//套餐名称
public Integer getId() {
return id;
}
public void setId(Integer id) {
... |
C++ | UTF-8 | 1,150 | 3.1875 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
using namespace std;
int main() {
// 행렬 입력받기
int n, m, i, j, p, q;
scanf_s("%d %d", &n, &m);
string temp;
int before[51][51];
int after[51][51];
for (i = 0; i < n; i++) {
cin >> temp;
for (j = 0; j < m; j++)
bef... |
C++ | UTF-8 | 589 | 2.796875 | 3 | [] | no_license | /*********************************************************************
** Author: Kendal Droddy
** Date: 9/13/18
*********************************************************************/
#ifndef STUDENT_HPP
#define STUDENT_HPP
#include <string>
/*********************************************************************
** ... |
C | UTF-8 | 8,690 | 2.78125 | 3 | [] | no_license | //Projet de RP S5-2016 Nathan URBAIN , Marek Felsöci
//Code source client
#include "../include/q12_client.h"
int main(int argc , char **argv)
{
int sockfd;
socklen_t addrlgn;
struct sockaddr_in6 dest;
//Création du socket
if((sockfd = socket(AF_INET6,SOCK_DGRAM,IPPROTO_UDP)) == -1)
{
perror("socket fail ... |
C# | UTF-8 | 1,491 | 2.9375 | 3 | [
"MIT"
] | permissive | using System;
using System.Collections.Generic;
using System.Linq;
using Shared.Contracts;
namespace Shared.Domains
{
public static class DefaultEvent
{
public static IEvent<T> Create<T>(T result = null, IEnumerable<T> results = null)
where T : class
{
return new Defaul... |
Markdown | UTF-8 | 698 | 2.65625 | 3 | [
"MIT"
] | permissive | ---
title: "Users administration"
permalink: /en/admin-users
excerpt: "Users administration"
redirect_from:
- /theme-setup/
---
{% include base_path %}
Click on the users menu on the left side to open the users administration section
Then click on "New" button
||
|:--:|
|*Users menu*|
... |
Java | UTF-8 | 5,789 | 2.84375 | 3 | [] | no_license | package mps.redundant.dispatcher;
import mps.redundant.Config;
import mps.redundant.gui.MonitorGUI;
import mps.redundant.monitor.Monitor;
import mps.redundant.server.IMpsServer;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Regist... |
JavaScript | UTF-8 | 2,659 | 3.5 | 4 | [] | no_license | $(document).ready(function() {
makePlot();
});
function makePlot() {
d3.csv("data.csv").then(function(data) {
console.log(data);
// make the plot
// STEP 1: set up the chart
var svgWidth = 960;
var svgHeight = 500;
var margin = {
top: 20,
... |
Java | UTF-8 | 893 | 3.40625 | 3 | [] | no_license | package LinkedCollection;
/**
* Created by Alexander on 14.12.2014.
*/
public class App {
public static void main( String[] args ) {
LinkedList linkedList = new LinkedList();
linkedList.add("first something");
linkedList.add("second something");
linkedList.add("i don't know someth... |
Swift | UTF-8 | 5,153 | 3.625 | 4 | [] | no_license | //
// Question Set.swift
// TrueFalseStarter
//
// Created by Siddharth Doshi on 22/12/16.
// Copyright © 2016 Treehouse. All rights reserved.
//
//---------------------------------------------------------------------
/////////////////////////
// Question Set Format //
/////////////////////////
/*
// Question... |
Python | UTF-8 | 245 | 3.734375 | 4 | [] | no_license | #capitalize the string
str='python', 'datascience', 'amazon web services'
s3='|'
s4=s3.join(str)
print(s4)
#string slicing
x='COMPUTER'
x1=x[0:4]
print(x1)
x2=x[0: :2]
print(x2)
x3=x[3:]
print(x3)
x4=x[:-2]
print(x4)
x5=x[-5:-7:-1]
print(x5) |
Java | UTF-8 | 2,600 | 2.234375 | 2 | [] | no_license | package br.com.isalvati.sistemaacademico.services;
import br.com.isalvati.sistemaacademico.PostgresqlContainer;
import br.com.isalvati.sistemaacademico.UtilTest;
import br.com.isalvati.sistemaacademico.entities.SystemUserEntity;
import br.com.isalvati.sistemaacademico.exception.SistemaAcademicoException;
import org.ju... |
JavaScript | UTF-8 | 796 | 3.9375 | 4 | [] | no_license | //high order array methods
const todos = [
{
id: 1,
text: "Take out trash",
isCompleted: true,
},
{
id: 2,
text: "Do laundry",
isCompleted: true,
},
{
id: 3,
text: "Load dishwasher",
isCompleted: false,
},
]
// forEach
//todos.forEach(function (todo) {
// console.lo... |
C# | UTF-8 | 791 | 3.328125 | 3 | [
"MIT"
] | permissive | namespace TaskEmployee
{
class Employee
{
public string Name;
public int Id;
public string Position;
public double Salary;
public Employee()
{
Name = "Joe Doe";
Id = 1;
Position = "Boss";
Salary = 100;
}
... |
Java | UTF-8 | 2,681 | 3.0625 | 3 | [] | no_license | /*
Name: Beier (Benjamin) Liu
Date: 5/17/2018
Remark:
*/
package Percolation;
import edu.princeton.cs.algs4.StdRandom;
import edu.princeton.cs.algs4.StdStats;
import edu.princeton.cs.algs4.WeightedQuickUnionUF;
import java.util.logging.Logger;
import java.util.logging.Level;
import java.text.MessageFormat;
/*=======... |
C++ | UTF-8 | 403 | 3.71875 | 4 | [] | no_license | /* Un número es divible entre otro numero */
#include <iostream>
using namespace std;
int main()
{ int a,b;
cout<<"Ingrese un numero "<<endl;
cin>>a;
cout<<"Ingrese un numero "<<endl;
cin>>b;
if (a%b==0)
{
cout<<"Su numero es divisible entre otro numero";
}
else
{
... |
Python | UTF-8 | 1,111 | 3.34375 | 3 | [] | no_license | class Container:
def __init__(self):
self.content = []
def add(self, value):
self.content.append(value)
def items(self, identifier=None, content=None, priority=None):
if identifier:
return [value for value in self.content if value.identifier == identifier]
elif ... |
C++ | UTF-8 | 1,155 | 3.15625 | 3 | [] | no_license | // =============== BEGIN ASSESSMENT HEADER ================
/// @file User.h
/// @brief assn4
///
/// @author Samuel Rufer [srufe001@ucr.edu]
/// @date November 12, 2014
///
/// @par Plagiarism Section
/// I hereby certify that I have not received assistance on this assignment,
/// or used code, from ANY outside sour... |
JavaScript | UTF-8 | 5,580 | 3.171875 | 3 | [] | no_license | var map;
var toronto = new google.maps.LatLng(43.6532, -79.3832);
var userLocation;
var browserSupportFlag = new Boolean();
function initialize() {
// Creating an infoWindow var;
var marker;
var infoWindow;
// Creating an instance of a Google Map
map = new google.maps.Map(document.getElementById('map'), {
... |
Java | UTF-8 | 480 | 2.109375 | 2 | [
"Apache-2.0"
] | permissive | package com.hs.mail.imap;
import org.springframework.dao.DataAccessException;
public class UnsupportedRightException extends DataAccessException {
private static final long serialVersionUID = 1079894029366919256L;
private char unsupportedRight;
public UnsupportedRightException(char right) {
supe... |
SQL | UTF-8 | 1,427 | 3.5625 | 4 | [] | no_license | -- auto gen by george 2017-12-06 15:25:17
DROP VIEW IF EXISTS v_player_online;
CREATE OR REPLACE VIEW "v_player_online" AS
SELECT s.id,
s.username,
s.real_name,
s.login_time,
s.login_ip,
s.login_ip_dict_code,
s.last_active_time,
s.use_line,
s.last_login_time,
s.last_login_ip,
s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.