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 | 1,867 | 2.546875 | 3 | [] | no_license | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* manage_tilde.c :+: :+: :+: ... |
Markdown | UTF-8 | 1,589 | 2.96875 | 3 | [
"MIT"
] | permissive | # Containerizing an Express server.
This repository is a step by step guide for setting up and containerizing an express server. This repository also serves as a complementary guide for this [article](https://pogsdotnet.blogspot.com/2018/08/10-steps-to-setup-and-containerize.html).
# Environment Setup
- NodeJS Instal... |
Swift | UTF-8 | 2,172 | 2.78125 | 3 | [] | no_license | //
// Heartbeat.swift
// WuXiaGPS
//
// Created by asdasd on 2017/5/17.
// Copyright © 2017年 WuXia. All rights reserved.
//
import UIKit
class Heartbeat: NSObject {
/// 心跳终止点,超过这个数值就说明心跳停止
let beatEndNum = 3
// static let share = Heartbeat()
private weak var timer:Timer?
let time... |
Java | UTF-8 | 552 | 2.296875 | 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 ultima;
/**
*
* @author aline, hugo, izadora, betania e larissa
* @since 24/11/2017
*/
/**Resultado da seleção... |
JavaScript | UTF-8 | 4,806 | 2.5625 | 3 | [] | no_license | // Logic for the runner, animations and key/events actions
var RunnerLayer = cc.Layer.extend({
_runnerSprite: null,
_runnerSpriteAnimation:null,
_runnerSpriteAnimationJump:null,
_runnerGameOverSprite:null,
_dirtyGameOver: true,
_jumpAction:null,
_runAction:null,
_runnerSpriteFiles:
... |
Swift | UTF-8 | 896 | 2.703125 | 3 | [] | no_license | //
// CardCell.swift
// SGMobileNetworkUsage
//
// Created by Rajkumar Murugesan on 17/8/20.
// Copyright © 2020 Rajkumar M. All rights reserved.
//
import UIKit
class CardCell: UITableViewCell {
@IBOutlet weak var cardView: UIView!
@IBOutlet weak var pictureView: UIImageView!
@IBOutlet weak var tit... |
Java | UTF-8 | 568 | 3.328125 | 3 | [] | no_license | public class solution {
public static int binarySearchHelper(int input[], int start, int end, int element) {
if (start > end) {
return -1;
}
int mid = (start + end) / 2;
if (input[mid] == element) {
return mid;
} else if (input[mid] > element) {
return binarySearchHelper(input, ... |
Markdown | UTF-8 | 292 | 2.5625 | 3 | [] | no_license | ## 题名:[移除元素](https://leetcode-cn.com/problems/remove-element/)
这里采用双指针的方法
循环 `nums` 为快指针
`m` 为慢指针记录新的数组长度
当 `n` 不等于给定值时我们就复制 `n` 到 `nums[m]` 并递增 `m` 直到 `nums` 循环到尾部结束 |
Python | UTF-8 | 9,826 | 3.03125 | 3 | [] | no_license | import numpy as np
from typing import List
from hw1_knn import KNN
# TODO: Information Gain function
def Information_Gain(S, branches):
# S: float
# branches: List[List[int]] num_branches * num_cls
# return: float
raise NotImplementedError
# TODO: implement reduced error prunning function, pruning yo... |
Python | UTF-8 | 285 | 4.1875 | 4 | [] | no_license |
first_name = str(input("Enter your First Name : "))
last_name = str(input("Enter your Last Name: "))
height = float(input("Enter your height: "))
age = int(input("Enter your age : "))
print(f"Ім'я: {first_name} \nПрізвище: {last_name} \nРіст: {height} \nВік: {age}") |
Python | UTF-8 | 4,606 | 2.875 | 3 | [
"MIT"
] | permissive | import csv
import json
import os
import re
import yaml
class Config:
def __init__(self, configfile:str, configformat:str, logger) -> None:
self.logger = logger
self.configfile = configfile
self.configformat = configformat
self._check_configfile()
self._parse_config()
... |
JavaScript | UTF-8 | 4,020 | 3.953125 | 4 | [] | no_license | // Steps to build the game
// Set a random number
// check the number to see if it is above, below, or the same as the number
// display score when checking the button
// reset the game with button
// document.getElementById('message').textContent = 'Correct Number!';
// document.getElementById('number').textContent... |
JavaScript | UTF-8 | 1,237 | 2.515625 | 3 | [] | no_license | const url = new RequestUrlResource()
if (url.getItens().id) {
const id = url.getItens().id
document.querySelector('form').addEventListener('submit', function (e) {
e.preventDefault()
const config = new configClass()
const request = new FetchResource('json', false, {
... |
Python | UTF-8 | 1,042 | 2.9375 | 3 | [] | no_license | #Script Loads table data from a csv file into a Spanner Instance
# csv file is from Github repo for sqkdb
!wget https://raw.githubusercontent.com/amercado-chemistsclub/sqldb_data_servers/master/tech_stocks_history.csv
from google.cloud import spanner
from google.cloud.spanner import Client
import pandas as pd
#Read ... |
C++ | UTF-8 | 3,279 | 2.921875 | 3 | [] | no_license | #include "Utility Objects.h"
int CircleI::getLeft()
{
return m_Position.x - m_Radius;
}
int CircleI::getRight()
{
return m_Position.x + m_Radius;
}
int CircleI::getTop()
{
return m_Position.y - m_Radius;
}
int CircleI::getBottom()
{
return m_Position.y + m_Radius;
}
Vector2I CircleI::getCentre()
{
... |
C | UTF-8 | 230 | 3.65625 | 4 | [] | no_license | #include<stdio.h>
int main()
{
int a,i,b,n;
printf("Enter the number:");
scanf("%d",&a);
printf("Enter the number of multiples");
scanf("%d",&n);
for(i=0;i<=n;i++)
{
b=i*a;
printf("\n%d*%d=%d",a,i,b);
}
return 0;
}
|
C++ | UTF-8 | 552 | 2.578125 | 3 | [] | no_license | #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <math.h>
#define PIE 3.1415926
using namespace std;
int main()
{
char temp[10];
int aa, bb, cas = 1;
while (scanf("%d%s%d", &aa, temp, &bb) && aa + bb)
{
double a = aa, b = bb, angle = atan(b / a);
dou... |
Java | UTF-8 | 1,069 | 1.820313 | 2 | [] | no_license | package com.wisdom.common.activiti.model.vo;
/**
*
* @author shangl
* @description 流程业务中间表
* @date 2017/8/14
*
*/
@SuppressWarnings("unused")
public class ActBusinessVO {
private static final long serialVersionUID = 1L;
private String wsdId;
private String executionId;
p... |
Markdown | UTF-8 | 2,250 | 2.59375 | 3 | [
"LicenseRef-scancode-generic-cla"
] | no_license | ## <a name="understanding-azure-resource-templates-and-resource-groups"></a>Informazioni su modelli di risorse e gruppi di risorse di Azure
La maggior parte delle applicazioni, distribuite ed eseguite da Microsoft Azure, vengono create da una combinazione di tipi diversi di risorse cloud (ad esempio, una o più macchine... |
JavaScript | UTF-8 | 247 | 3.21875 | 3 | [
"MIT"
] | permissive |
export function KgtoLb (kg) {
const lb = 2.205
let resultado = kg*lb
return parseFloat(resultado.toFixed(1))
}
export function LbtoKg (lb) {
const kg = 0.454
let resultado = lb*kg
return parseFloat(resultado.toFixed(1))
} |
C | UTF-8 | 3,126 | 4.3125 | 4 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "stack.h"
#include "ADTErrors.h"
enum
{
CREATE_STACK = 1,
INSERT_DATA,
REMOVE_DATA,
GET_SIZE,
IS_EMPTY,
PRINT,
DESTROY,
EXIT
};
void GetInitValues(size_t *_initialSize, size_t *_BlockSize)
{
printf("Please enter the initial size:");
scanf("... |
JavaScript | UTF-8 | 5,843 | 3.015625 | 3 | [
"MIT"
] | permissive | /*
* JavaScript base32 / base32hex encoder and decoder
* Source https://simplycalc.com/base32-decode.php
*/
/*
* input: 5 times 8-bit characters: 11111111 00000000 11111111 00000000 11111111
* base32: 8 times 5-bit indexes : 11111 11100 00000 01111 11110 00000 00111 11111
*/
const b32c = "ABCDEFGHIJKLMNOPQRSTU... |
JavaScript | UTF-8 | 1,448 | 2.65625 | 3 | [
"MIT"
] | permissive | (function(){
'use strict';
var path = require('path');
var util = require('util');
var jsConf = require('js-conf');
function i18n(options){
options || (options = {});
//the target locale and the fallbacks
if(!options.locales){
this._locales = ['en'];
}
else if(!Array.isArray(options.loc... |
Markdown | UTF-8 | 1,632 | 2.828125 | 3 | [] | no_license | # Homework 1 Assigment -01 HTML CSS Git: Code Refactor
## 01-Homework Repository
This repository is where my first homework assigment for refactoring takes place. As I move along in the course, I hope to have learned how to write better README files.
## Link to GitHub Page
https://robertsantos-dfw.github.io/01-Home... |
Markdown | UTF-8 | 2,314 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | SmartBackup
===========
SmartBackup is a backup mod for Minecraft that backs up the game's world data.
Backup Methods
--------------
There are two different methods of backing up data using SmartBackup. You can
choose between these methods when manually running a backup and the backup
scheduler can be instructed to... |
C# | UTF-8 | 11,747 | 2.578125 | 3 | [] | no_license | using System;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Windows.Forms;
namespace TextEditor
{
public partial class TextEditor : Form
{
private User user;
public TextEditor(User user)
{
InitializeComponent();
this.user... |
Java | UTF-8 | 1,013 | 3.109375 | 3 | [] | no_license | package leetcode.p2545;
import java.util.Arrays;
/**
* Solution
*
* @author heshan
* @date 2023/1/26
*/
public class Solution {
public int[][] sortTheStudents(int[][] score, int k) {
int[] ks = new int[score.length];
for (int i = 0; i < score.length; i++) {
ks[i] = score[i][k];
... |
C++ | UTF-8 | 439 | 2.8125 | 3 | [] | no_license | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
vector<int> v1;
vector<int> ::iterator it;
int main(void)
{
int n,i,j;
while(1)
{
cin >> n;
if(!n)
break;
for(i = 0; i < n; i++)
{
cin >> j;
v1.push_back(j);
}
sort(v1.begin(),v1.end());
for( i = 0; i < n; i++)
... |
TypeScript | UTF-8 | 10,395 | 2.703125 | 3 | [
"MIT"
] | permissive | import "@plumier/testing"
import { RouteAnalyzerFunction, RouteMetadata } from "@plumier/core"
import { JwtAuthFacility } from "@plumier/jwt"
import { cleanupConsole } from "@plumier/testing"
import reflect from "@plumier/reflect"
import Plumier, { domain, RestfulApiFacility, route } from "plumier"
describe("Route An... |
JavaScript | UTF-8 | 2,863 | 2.515625 | 3 | [] | no_license | import React, { Component } from "react";
import API from "../../utils/API";
class Results extends Component {
state = {
savedGame: [],
}
componentDidMount() {
API.savedGame()
.then(savedGame => this.setState({ savedGame: savedGame }))
.catch(err => console.error(e... |
Java | UTF-8 | 6,214 | 2.046875 | 2 | [] | no_license | package com.mycompany.webapp.controller;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.ServletContext;
import... |
Python | UTF-8 | 4,092 | 2.90625 | 3 | [] | no_license | import numpy as np
import pandas as pd
import scipy
import scipy.sparse as sp
import scipy.sparse.linalg
from scipy.sparse import *
from scipy.sparse.linalg import norm
import random
from scipy import linalg
import timeit
import matplotlib.pyplot as plt
from PIL import Image
"""Function computes the CUR... |
Python | UTF-8 | 4,517 | 2.640625 | 3 | [] | no_license | import locale
import time
import traceback
from collections import deque
from dataclasses import dataclass
import telegram
import settings
TELEGRAM_MAX_MESSAGE_LENGTH = 4096
TELEGRAM_PERSONAL_MESSAGE_MAX_RATE = 30 # 30 messages/sec
TELEGRAM_GROUP_MESSAGE_MAX_RATE = 20/60 # 20 messages/min
@dataclass
class Telegr... |
Java | UTF-8 | 7,878 | 2.765625 | 3 | [] | no_license | package finki.ukim.mk.battlesofhistory.db;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;
import java.util.ArrayList;
import java.util.List;
import fink... |
Ruby | UTF-8 | 456 | 3.5 | 4 | [] | no_license | # Reimplment Enumerable#reduce
def reduce(list, initial)
@accumulator = initial
list.each do |value|
@accumulator = yield(@accumulator, value)
end
@accumulator
end
p reduce(5..10, 0) { |sum, element| sum + element }
p reduce(5..10, 1) { |product, n| product * n }
p reduce([1, 2, 3, 4], 0) { |sum, element|... |
C++ | UTF-8 | 2,325 | 2.921875 | 3 | [
"MIT"
] | permissive | //
// Timer.h
// MSO
//
// Created by Erik Frisk on 10/09/15.
// Copyright (c) 2015 Linköping University. All rights reserved.
//
#ifndef _TIMER_H
#define _TIMER_H
#if defined(WIN32) || defined(_WINDOWS_)
#include <ctime>
#else
#include <sys/resource.h>
#endif
class Timer {
#if defined(WIN32) || defined(_WINDOWS_... |
SQL | UTF-8 | 506 | 2.71875 | 3 | [] | no_license | --Group 13
--property_options.sql
--October 19, 2016
--WEBD3201
-- Dropping tables clear out any existing data
DROP TABLE IF EXISTS property_options;
--Creates the table again
CREATE TABLE property_options(
value INT PRIMARY KEY,
property VARCHAR(30) NOT NULL
);
--Inserts rows inside the table
INSERT INTO proper... |
C++ | UTF-8 | 1,642 | 2.953125 | 3 | [] | no_license | //
// Created by jelly on 2020/01/06.
//
#include <iostream>
#include <vector>
#include <cstring>
using namespace std;
vector<int> v;
int a[27][2];
bool check[27];
void goPreorder(int i) {
if (!check[i]) {
v.push_back(i);
check[i] = true;
}
if (a[i][0] && !check[a[i][0]]) {
goPre... |
C# | UTF-8 | 1,748 | 2.515625 | 3 | [] | no_license | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class BasicAttack : Ability {
//public float damage = 10f;
/// <summary>
/// Constructor for Basic Attack, put in the gameobject of the object that basic attack will be added to.
/// </sum... |
C++ | UTF-8 | 704 | 3 | 3 | [
"BSD-2-Clause"
] | permissive | #include <wchar.h>
extern "C" {
size_t wcslen(const wchar_t* str)
{
size_t len = 0;
while (*(str++))
++len;
return len;
}
wchar_t* wcscpy(wchar_t* dest, const wchar_t* src)
{
wchar_t* originalDest = dest;
while ((*dest++ = *src++) != '\0')
;
return originalDest;
}
int wcscmp(... |
TypeScript | UTF-8 | 3,540 | 2.953125 | 3 | [] | no_license | import { getSubjectAvg } from '../components/subject/Subject';
import { IGrade, IUserSubject } from '../@types';
export default class GradeHelper {
public static getDate(grade: IGrade, separator?: string): string {
let date = new Date(grade.date);
if (!date) {
return 'invalid date form... |
JavaScript | UTF-8 | 3,221 | 3.125 | 3 | [
"MIT"
] | permissive | 'use strict';
var currentEventId;
// Call this function when the page loads (the "ready" event)
$(document).ready(function() {
initializePage();
$('.join_class').click(function(){
// AJAX request
$.get("/data", addEvent);
});
});
/*
* Function that is called when the document is ready.
*/
function initial... |
Markdown | UTF-8 | 1,986 | 2.609375 | 3 | [
"MIT"
] | permissive | ---
layout: post
title: Monkey测试
date: 2017-03-07
tags: [Android, Test]
categories: Android
author: JayaTang
description: Monkey测试是Android平台自动化测试的一种手段
---
Monkey测试是Android平台自动化测试的一种手段,通过Monkey程序可以模拟用户触摸屏幕、滑动Trackball、按键等操作来对设备上的程序进行压力测试。
## 基础语法
基础语法如下:
```
$ adb shell monkey [options]
$ adb shell... |
Python | UTF-8 | 1,349 | 3.34375 | 3 | [] | no_license | """
This script adds selected data from a CSV file to an existing TSV-file.
Name: Rebecca Davidsson, student number: 11252138.
"""
import csv
import re
with open("HPI_csv.csv") as tsvfile:
HPI = csv.reader(tsvfile, delimiter=';')
# Skip header
next(HPI)
HPIdata = []
for row in HPI:
HPIdat... |
Markdown | UTF-8 | 4,136 | 3.265625 | 3 | [] | no_license | Salad-Project
=============
Salad Project
Dan Freed
Thomas Selby
CPSC 112
Salad Project
The Salad Project, as we envision it, is an application designed to make it easy for users to design and order healthy salads in an informative and calculated way. We believe that this can be turned into a real business here in ... |
JavaScript | UTF-8 | 385 | 3.234375 | 3 | [] | no_license | let json = "{ bad json }";
try {
let user = json.parse(json); // <--여기서 에러가 발생하므로
alert(user.name); //이 코드는 동작하지 않습니다.
} catch (e) {
//에러가 발생하면 제어 흐름이 catch 문으로 넘어옵니다.
alert("데이터에 에러가 있어 재요청을 시도합니다.");
alert(e.name);
alert(e.message);
} |
TypeScript | UTF-8 | 371 | 2.765625 | 3 | [
"MIT"
] | permissive | import { GraphQLList, GraphQLType, isListType, isNonNullType } from 'graphql';
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function extractListType(type: GraphQLType): GraphQLList<any> | undefined {
if (isListType(type)) {
return type;
}
if (isNonNullType(type)) {
return extrac... |
Ruby | UTF-8 | 120 | 3.484375 | 3 | [] | no_license | puts 'Type some things!'
words = []
puts words
while (thing = gets.chomp) != ''
words.push thing
end
puts words.sort
|
Markdown | UTF-8 | 1,271 | 3.1875 | 3 | [] | no_license | # avl_tree
## Description
This is the C code for an AVL (self-balancing binary) Tree. The code is split into two header files and a test driver function (main.c).
## Topography
The two header files (avl_tree.h and avl_node.h) contain the code for the AVL Tree. The third header file _string_ops.h_ contains some usefu... |
Markdown | UTF-8 | 2,336 | 3.21875 | 3 | [] | no_license | ---
title: Select
book: userguide
chapter: form-components
slug: select
weight: 90
---
A select field will display a list of values in a drop down list to users. Users can select one of the values.

####... |
Python | UTF-8 | 1,188 | 2.84375 | 3 | [] | no_license |
# HAHA
__author__ = 'ahmadauliawiguna'
import numpy as np
import os #import library untuk akses fitur OS
from sklearn.cluster import KMeans
from sklearn.decomposition import PCA
import pylab as pl
cwd = os.getcwd()
raw_data = cwd + "/dataset/seeds_dataset.csv"
dataset = np.loadtxt(raw_data, delimiter=",",dtype=No... |
C++ | UTF-8 | 2,202 | 3.390625 | 3 | [] | no_license | //Function Definitions
#include "pathList.h"
using namespace std;
//Store the path into a Node
PathList::Node::Node(char* p, const int& lineNum){
next = NULL;
path = new char[strlen(p)+1];
strcpy(path,p);
plist = new PostingList(lineNum);
}
//Delete the path
PathList::Node::~Node(){
delete[] path;
delete plist;... |
Java | UTF-8 | 272 | 2.171875 | 2 | [] | no_license | import java.text.SimpleDateFormat;
import java.util.Scanner;
public class test4 {
public static void main(String[] args) {
test3 post =new test3();
post.inserttest3();
System.out.println("" + post.title + ","+ post.description + "," + post.createDate);
}
}
|
Markdown | UTF-8 | 1,729 | 2.609375 | 3 | [
"MIT"
] | permissive | # NFCTagTechnology Class API
Use the NFCTagTechnology to connect to NFC tags and to determine their type.
**NOTE: As of Rhodes version 3.3.3, the [Barcode](barcode-api), [NFC](../rhodes/device-caps#nfc), and [Signature Capture](../rhodes/device-caps#signature-capture) APIs, as well as [Rhom data encryption](../rhode... |
JavaScript | UTF-8 | 1,651 | 2.921875 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | // Just register click handlers when the page is loaded
// Load announcements immediately as well
function loadPage() {
initialLoad();
$("#search").click(function (e) {
e.preventDefault();
var value = $("#contains").val();
search(value);
});
$("#reset").click(function (e) {
e.preventDefault();... |
Ruby | UTF-8 | 467 | 3.53125 | 4 | [] | no_license | class Raindrops
class << self
def convert(number)
response_string = ""
primes = {3 => "Pling", 5 => "Plang", 7 => "Plong"}
primes.each do |prime, response|
if prime_factor?(prime, number)
response_string += response
end
end
response_string = number.to_s if response_string == ""
respons... |
Python | UTF-8 | 6,596 | 3.296875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# coding: utf-8
# # Details - Max Mean Activation
# This notebook complements the [docs](https://luminovo.gitlab.io/public/midnite/latest/visualization.html) and explains the modular max mean activation optimization method in detail.
#
# Max mean activation is an optimization in image space to m... |
Markdown | UTF-8 | 2,028 | 2.625 | 3 | [] | no_license | ---
title: External Scripts
taxonomy:
category: docs
---
### External Scripts
**replication-manager** can automate route changes with popular proxies. however in some edge cases e.g. pacemaker or keepalived, logic like vip or hardware load balancer api calls can be managed through the external scripts option.
##... |
Java | UTF-8 | 1,599 | 2.546875 | 3 | [] | no_license | package org.chronopolis.earth.domain;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import java.time.Instant;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.time.f... |
Python | UTF-8 | 210 | 3.21875 | 3 | [] | no_license | from Point import Point
class Rectangle:
point1=None
point2=None
def __init__(self,p1,p2):
self.point1=p1
self.point2=p2
def __str__(self):
return "["+str(self.point1)+" - "+str(self.point2)+"]" |
C | UTF-8 | 320 | 3.875 | 4 | [] | no_license | // Implement a program that converts degrees in Celsius to Fahrenheit
#include <stdio.h>
#include <cs50.h>
int main (void)
{
// Prompting user for a temperature in C
float C = get_float("C: ");
// Applying formula
float F = ((C * 9) / 5) + 32;
// Printing the result
printf("F: %.1f\n", F);
}
|
Java | UTF-8 | 11,351 | 2.03125 | 2 | [] | no_license | package com.dt.project.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.dt.project.config.JsonData;
import com.dt.project.config.ResponseBase;
import com.dt.project.model.dto.UserDto;
import com.dt.project.exception.LsException;
import com.dt.project.mapper.UserMapper... |
Swift | UTF-8 | 2,178 | 3.375 | 3 | [
"MIT"
] | permissive | //
// DataTransformers.swift
//
//
// Created by Dick Verbunt on 29/12/15.
// Copyright © 2015 E-sites. All rights reserved.
//
import Foundation
/**
Protocol that should be used when writing your own DataTransformer.
*/
public protocol DataTransformer {
/**
Function used when reading from the char... |
JavaScript | UTF-8 | 749 | 2.796875 | 3 | [] | no_license | let i =0;
let slider = document.querySelector('.showcase');
let images = [];
images[0] = '/resources/img/check2.jpg';
images[1] = '/resources/img/check.jpg';
images[2] = '/resources/img/China-online-education.jpg';
function changeImage(){
slider.style.background = `url(${images[i]}) no-repeat center center/cover`;
... |
C | UTF-8 | 3,989 | 2.5625 | 3 | [] | no_license | /*
* \file
* Modbus RTU Master Implement Function 01, 03, 05, 06 Code
*
* \copyright
* Copyright (C) MOXA Inc. All rights reserved.
* This software is distributed under the terms of the
* MOXA License. See the file COPYING-MOXA for details.
*
* \date 2021/06/24
* First release
*
* \author
* Jerry YH Cheng
*/
/********... |
Ruby | UTF-8 | 168 | 2.96875 | 3 | [] | no_license | n = gets.chomp.to_i
a = []
xNumber = 0
1.upto(Math.sqrt(n)) do |i|
if n % i == 0
a << i.to_s + (n/i).to_s
a << (n/i).to_s + i.to_s
end
end
p a.uniq.count
|
Java | UTF-8 | 143 | 2.234375 | 2 | [] | no_license | package model;
public interface Priority {
public String priority();
public void addScores(int i);
public String timeToStart();
}
|
Java | UTF-8 | 469 | 1.835938 | 2 | [] | no_license | package kr.co.jjjcamping.dao;
import java.util.ArrayList;
import kr.co.jjjcamping.dto.CartDto;
import kr.co.jjjcamping.dto.OrderDto;
import kr.co.jjjcamping.dto.ProductDto;
public interface OrderDao {
public ArrayList<CartDto> order_first(String userid);
public void order_second(OrderDto odto);
public String g... |
Ruby | UTF-8 | 3,865 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | #! /usr/bin/ruby
## -*- Mode: ruby -*-
require 'mysql' ;
require 'OpenGIS' ;
include OpenGIS ;
$dbName = 'test' ;
$tbName = 'foo' ;
$locMin = -10000 ;
$locMax = 10000 ;
$sizMin = 1 ;
$sizMax = 10 ;
$objN = 1000000 ;
#$mode = 'create' ;
#$mode = 'drop' ;
#$mode = 'insert' ;
#$mode = 'count' ;
$mode = 'select' ;
#$... |
C# | UTF-8 | 35,471 | 3.015625 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Data;
using System.Globalization;
using System.Linq;
using System.Runtime.Remoting.Messaging;
namespace CodeWarsSolutions
{
public abstract class Task
{
#region https://www.codewars.com/kata/5592e3bd57b... |
Python | UTF-8 | 4,452 | 2.71875 | 3 | [] | no_license | import sys
import pandas as pd
import numpy as np
import utils
def train_of_classificator(training_data, m_norma):
w1 = np.array([[0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0]])
w2 = np.array([[0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0]])
w3 = np.array([[0.... |
PHP | UTF-8 | 704 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | <?php declare(strict_types=1);
// Load composer autoload
require __DIR__ . "/../vendor/autoload.php";
// Use classes
use App\Bot;
// Initialize dotenv
if (file_exists(__DIR__ . "/../.env")) {
// Check if a .env file is in the root directory
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__ . "/..");
} elseif ... |
Rust | UTF-8 | 507 | 3.125 | 3 | [] | no_license |
pub fn solve() {
let c1 = (273025_u32 .. 767253).filter(|&x| is_ok_password(x)).count();
println!("Day 04, part 1: {} ", c1);
}
fn is_ok_password(number : u32) -> bool {
let mut has_repeated_digits = false;
let mut n = number;
loop {
let last_digit = n % 10;
n = n / 10;
if ... |
JavaScript | UTF-8 | 2,411 | 2.578125 | 3 | [] | no_license | const express = require('express');
const router = express.Router();
// User Model
let User = require('../models/user');
//Admin Model
let Admin = require('../models/admin');
// Add Route
router.get('/add', ensureAuthenticated, function(req, res){
res.render('add_user', {
title:'Add User'
});
});
// Add Subm... |
TypeScript | UTF-8 | 462 | 2.53125 | 3 | [
"MIT"
] | permissive | import { Field, ObjectType, ID } from 'type-graphql';
@ObjectType()
export class Hospital {
@Field({ nullable: true })
id: number;
@Field({ nullable: true })
name: string;
@Field({ nullable: true })
address?: string;
}
@ObjectType()
export class GraphDoctorDto {
@Field(() => ID)
id: number;
@Fiel... |
Python | UTF-8 | 959 | 3.609375 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
def hex2str(hex_string):
items = list()
for i in range(0, len(hex_string), 2):
hex2 = hex_string[i] + hex_string[i + 1]
char = chr(int(hex2, 16))
items.append(char)
return ''.join(items)
def str2hex(text):
... |
Python | UTF-8 | 3,615 | 2.9375 | 3 | [
"Apache-2.0"
] | permissive | """
functions for finding files
"""
from datetime import datetime, timedelta
from pathlib import Path
import typing as T
import numpy as np
from .utils import filename2datetime
FILE_FORMATS = [".h5", ".nc"]
def config(path: Path) -> Path:
"""given a path or config filename, return the full path to config file... |
Java | UTF-8 | 405 | 2.546875 | 3 | [] | no_license | package com.example.android.popularmovies;
/**
* Interface that receives clicks from movie trailer list items.
*/
public interface IMovieTrailerListItemClickListener
{
/**
* Called when a movie trailer list item is clicked.
*
* @param clickedItemIndex the index of the movie trailer item in the list that w... |
Markdown | UTF-8 | 1,498 | 2.640625 | 3 | [] | no_license | # Serverless Page to PDF
Highly customizable, ready to deploy serverless AWS API to extract pdf of webpages.
## Installation
```sh
npm install
```
Serverless API Deployment. Make sure before deployment you set your credentials in profile
```sh
npm run deploy
```
### Usage
API serves your POST requests and return... |
Markdown | UTF-8 | 5,291 | 2.609375 | 3 | [] | no_license | ---
description: "Recipe of Speedy Pancakes: Plain"
title: "Recipe of Speedy Pancakes: Plain"
slug: 1967-recipe-of-speedy-pancakes-plain
date: 2021-03-11T07:57:20.302Z
image: https://img-global.cpcdn.com/recipes/f00a784212c35495/680x482cq70/pancakes-plain-recipe-main-photo.jpg
thumbnail: https://img-global.cpcdn.com/re... |
TypeScript | UTF-8 | 2,949 | 2.84375 | 3 | [
"MIT"
] | permissive | import { NextApiRequest, NextApiResponse } from "next";
import _startCase from "lodash/startCase";
import connectDB from "../../config/connectDB";
import { Item, List } from "../../models";
import errorHandler from "../../utils/errorHandler";
import badMethodHandler from "../../utils/badMethodHandler";
// Original tas... |
C++ | UTF-8 | 1,142 | 2.65625 | 3 | [] | no_license | #ifndef PARALLEL_GAME_OF_LIFE_PARALLEL_SIMULATOR_H_
#define PARALLEL_GAME_OF_LIFE_PARALLEL_SIMULATOR_H_
#include <pthread.h>
#include <vector>
#include <iostream>
#include "state.h"
#include "simulator.h"
#include "row_thread.h"
class RowThread;
class ParallelSimulator: public Simulator {
public:
friend class R... |
Java | UTF-8 | 17,631 | 2.25 | 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 com.redoute.datamap.dao.impl;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
impor... |
Java | UTF-8 | 6,765 | 1.734375 | 2 | [] | no_license | package tw.edu.chit.struts.action.teacher;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.ActionForm;
impo... |
Python | UTF-8 | 6,374 | 2.75 | 3 | [
"LicenseRef-scancode-philippe-de-muyter",
"GPL-2.0-only",
"GPL-1.0-or-later"
] | permissive | #!/usr/bin/env python3
import sys
import json
import html
from reportlab.lib.pagesizes import letter
from reportlab.platypus import Frame, Paragraph, Spacer, PageBreak,PageTemplate, BaseDocTemplate
from reportlab.platypus.tableofcontents import TableOfContents
from reportlab.lib.styles import getSampleStyleSheet, Parag... |
Python | UTF-8 | 549 | 2.640625 | 3 | [
"MIT"
] | permissive | import random
for c, k in enumerate([1024,2048,4096,8192,16384,32768,65536]):
file = open("ex3_"+str(c)+".txt", "w")
table = open("tableNew.txt", "r")
file.write(str(k)+"\n")
file.write(str(k)+"\n")
file.write(str(60)+"\n")
file.write(str(1)+"\n")
for line in table.readlines():
file.... |
Java | UTF-8 | 735 | 1.710938 | 2 | [
"Apache-2.0"
] | permissive | package com.qouteall.immersive_portals.mixin.common.portal_generation;
import com.qouteall.immersive_portals.portal.custom_portal_gen.CustomPortalGenManagement;
import net.minecraft.server.management.PlayerList;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spong... |
TypeScript | UTF-8 | 5,729 | 2.53125 | 3 | [] | no_license | import Vue from 'vue'
import Vuex from 'vuex'
import { AppState } from './State'
import { Day } from './classes/Day'
import { Card } from './cards/job-cards'
import { EventCard } from './cards/event-cards'
import { clone } from './utilities'
Vue.use(Vuex)
export default new Vuex.Store({
state: new AppState(),
... |
C# | UTF-8 | 398 | 2.96875 | 3 | [] | no_license | string input = // ...
string pattern = @"(\w{1,3} )?1?\d: (?<line>[^\r\n]+)(\r?\n\s+(?<line>[^\r\n]+))*";
foreach (Match m in Regex.Matches(input, pattern))
{
if(m.Success)
{
string entry = string.Join(Environment.NewLine,
m.Groups["line"].Captures.Ca... |
Ruby | UTF-8 | 848 | 2.5625 | 3 | [] | no_license | class Relationship < ApplicationRecord
belongs_to :follower, class_name: "User"
belongs_to :followed, class_name: "User"
validates :follower_id, presence: true
validates :followed_id, presence: true
validate :followed_is_streamer, :followed_is_not_follower
def favorite
update_attribute(:favorited, true)
en... |
Java | UTF-8 | 10,631 | 1.828125 | 2 | [] | no_license | package net.student.service.impl;
import java.io.InputStream;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.Callable;
import javax.servlet.http.HttpSession;
import org.apache.commons.lang.StringUtils;... |
SQL | UTF-8 | 3,491 | 4.09375 | 4 | [] | no_license | DROP DATABASE IF EXISTS exampledb;
CREATE DATABASE exampledb
DEFAULT CHARACTER SET utf8
DEFAULT COLLATE utf8_general_ci;
CREATE TABLE IF NOT EXISTS `exampledb`.`student` (
`id` INT NOT NULL AUTO_INCREMENT,
`name` VARCHAR(45) NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `name_UNIQUE` (`name` ASC))
ENGINE = InnoD... |
C | UTF-8 | 3,930 | 2.703125 | 3 | [] | no_license | /** Converts an integer to an ASCII string with the given radix.
@file itoa.c
@ingroup misclib
@author Christian Dönges <cd@platypus-projects.de>
@note The master repository for this file is at
<a href="https://github.com/cdoenges/misclib">https://github.com/cdoenges/misclib</a>
LICEN... |
Python | UTF-8 | 17,791 | 3.515625 | 4 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.7.1
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# # Finite Square Well Potentia... |
Java | UTF-8 | 1,650 | 2.703125 | 3 | [
"MIT"
] | permissive | package utils;
import org.junit.Test;
import solvas.rest.utils.JsonListWrapper;
import java.util.Collection;
import static io.github.benas.randombeans.api.EnhancedRandom.random;
import static io.github.benas.randombeans.api.EnhancedRandom.randomCollectionOf;
import static org.junit.Assert.assertEquals;
/**
* Unit ... |
PHP | UTF-8 | 10,707 | 2.78125 | 3 | [] | no_license | <?php
ini_set('display_errors', 1);
ini_set('log_errors', 1);
error_reporting(E_ALL);
function connectionToDB() {
$servername = "localhost";
$username = "root";
$password = "root";
$dbname = "LauraAdrian";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
... |
Markdown | UTF-8 | 786 | 3.671875 | 4 | [] | no_license | ---
title: JavaScript洗牌算法
date: 2020-01-04 08:34:20
tags: JavaScript
categories: 算法
---
#### 洗牌算法
假设有54张扑克牌,按顺序叠放,洗牌之后变成乱序,每张牌的位置随机概率是相同的。
抽象成数组乱序排序,用Math.random生成随机数,使用Fisher–Yates Shuffle的算法,复杂度为O(n)。
这个算法的思想是,数组从后向前遍历,与之前任意元素交换。
使用JavaScript代码实现如下:
```
function shuffle(arr) {
let len = arr.length
let temp
f... |
C | UTF-8 | 355 | 3.71875 | 4 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
size_t getSize(float *);
int main(void){
float array[20];
printf("\nThe number of bytes in the array is %d"
"\nTHe number os bytes returned by getSize function is %d\n", sizeof(array), getSize(array));
return 0;
}
size_t getSize(floa... |
Go | UTF-8 | 984 | 2.828125 | 3 | [] | no_license | package src
import (
"fmt"
"testing"
)
func TestDES(t *testing.T) {
src := []byte("我是一个不知道有多长的明文")
key := []byte("12345678")
str := encryptoDES(src, key)
fmt.Println("加密之后的密文:" + string(str))
str = decryptoDES(str, key)
fmt.Println("解密之后的明文:" + string(str))
}
func Test3DES(t *testing.T) {
src := []byte("我是一... |
Markdown | UTF-8 | 1,848 | 3.0625 | 3 | [] | no_license | title: Baptism
date: 2014-12-11 14:58:31
tags: scripture
---
> 1 And now I speak concerning baptism. Behold, elders, priests, and teachers were baptized; and they were not baptized save they brought forth fruit meet that they were worthy of it.
>
> 2 Neither did they receive any unto baptism save they came forth with... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.