language stringclasses 15
values | src_encoding stringclasses 34
values | length_bytes int64 6 7.85M | score float64 1.5 5.69 | int_score int64 2 5 | detected_licenses listlengths 0 160 | license_type stringclasses 2
values | text stringlengths 9 7.85M |
|---|---|---|---|---|---|---|---|
Python | UTF-8 | 763 | 2.859375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
#-------------------------------------------------------------------------------
# Name: модуль1
# Purpose:
#
# Author: Prapor
#
# Created: 19.10.2017
# Copyright: (c) Prapor 2017
# Licence: <your licence>
#-------------------------------------------... |
PHP | UTF-8 | 556 | 2.640625 | 3 | [] | no_license | <?php
declare(strict_types=1);
use Prooph\EventSourcing\AggregateChanged;
use Ramsey\Uuid\Uuid;
class BalanceCreated extends AggregateChanged
{
public static function forUser(UUid $balanceUuid, Uuid $userId, int $amount = 0) :self
{
return self::occur($balanceUuid->toString(), ['user' => $userId->to... |
Java | UTF-8 | 6,257 | 1.921875 | 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 net.torabipour.ChatHubBot.model.botStructure.stateHandler;
import com.pengrad.telegrambot.TelegramBot;
import com.pengrad.tele... |
Markdown | UTF-8 | 7,913 | 3.40625 | 3 | [] | no_license | ## Алгоритм
Пусть дан массив из $n$ чисел, и требуется с предподсчётом за $O(n \\log
n)$ отвечать на запрос "минимум на отрезке" за $O(1)$ в онлайне.
### Предподсчёт
Для этого сделаем следующий предподсчёт: в массиве для каждого
подотрезка, длина которого является степенью 2, найдём минимум
в нём. Таким обазом мы хо... |
Python | UTF-8 | 226 | 2.859375 | 3 | [] | no_license | def char_ frequency(str1):
dict={}
for n in str1:
keys=dict.keys()
if n in keys:
dict[n]+=str1
else:
dict[n]=str1
return dict
print (char.frequency('google.com'))
|
Markdown | UTF-8 | 36,614 | 3.40625 | 3 | [] | no_license | Divide and Conquer - Classification Using Decision Trees and Rules
================
Emma Grossman
4/19/2021
Decision Trees and rule learners make complex decisions form sets of
simple choices. The result is logical structures that require little
statistical knowledge, which is very useful for business strategy and
pro... |
SQL | UTF-8 | 644 | 3.71875 | 4 | [] | no_license | DROP TABLE StationNeighbour;
CREATE TABLE StationNeighbour(
stationNeighbourId int AUTO_INCREMENT,
stationID1 varchar(20),
stationID2 varchar(20),
lineID int,
PRIMARY KEY (stationNeighbourId)
);
ALTER TABLE StationNeighbour ADD FOREIGN KEY StationNeighbour_St... |
C# | UTF-8 | 5,206 | 2.875 | 3 | [] | no_license | using MandelbrotDrawer.MandelbrotCalcServiceReference;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.Linq;
using System.ServiceModel;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MandelbrotDrawer
{
interna... |
Shell | UTF-8 | 339 | 2.703125 | 3 | [
"BSD-2-Clause"
] | permissive | #! /bin/bash
# This runs browser-sync, watching this directory for changes. You should
# simply point your web browser to http://localhost:3000/.
docker kill browser-sync
docker rm browser-sync
docker run \
-dt \
--name browser-sync \
-p 3000:3000 \
-p 3001:3001 \
-v $(pwd):/source \
-w /source \
browse... |
Java | MacCentralEurope | 975 | 2.796875 | 3 | [] | no_license | package PTUCharacterCreator.Moves;
import PTUCharacterCreator.Move;
public class Substitute extends Move {
{
name = "Substitute";
effect = "The user loses 1/4 of their maximum Hit Points. This Hit Point loss cannot be prevented in any way. The user creates an Illusory Substitute Coat, which has Hit Points equal to... |
Java | UTF-8 | 1,304 | 3.015625 | 3 | [] | no_license |
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
public class CalculatorTest {
Calculator calculator;
@BeforeEach
public void setUp(){
calculator = new Calculator();
}
@Test
public void addNumberTest(){
... |
Markdown | UTF-8 | 476 | 2.671875 | 3 | [] | no_license | # What I Learned Today
February 2021
## 1/31/2021
Including the last day of January since that is when I decided to formally keep track of "what I learned today".
Linear Algebra review: Learned the formal representation of Real vector spaces as the set of all n-tuples with Real valued components and how to represent ... |
Java | UTF-8 | 777 | 2.109375 | 2 | [] | no_license | package com.example.exercisesqlite;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import androidx.appcompat.app.AppCompatActivity;
public class MainActivity extends AppCompatActivity {
Button btnadd;
@Override
protected void onCreate(Bu... |
Swift | UTF-8 | 3,342 | 2.78125 | 3 | [] | no_license | //
// GraphButton.swift
// TonikAnalytics
//
// Created by Wesley Espinoza on 10/8/19.
// Copyright © 2019 HazeWritesCode. All rights reserved.
//
import Foundation
import UIKit
class GraphButton: UIButton{
var socialLabel = UILabel()
var mainCounter: Int = 0 {
didSet {
if mainCounter... |
Swift | UTF-8 | 3,007 | 3.4375 | 3 | [
"MIT"
] | permissive | //
import SwiftUI
struct SightComponent: Shape {
let angle: Angle
func path(in rect: CGRect) -> Path {
Path { path in
let radius: CGFloat = min(rect.size.width, rect.size.height) / 2
path.addArc(
center: CGPoint(x: radius, y: radius),
radius: radius,
startAngle: angle / 2... |
C | UTF-8 | 453 | 3.640625 | 4 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
int ToNumber(char *a)
{
if (*a < 'A') return *a - '0';
else return *a - 'A' + 10;
}
int main()
{
char a, b, c;
int n;
int x,y,z;
scanf("%c%c%c", &a, &b, &c);
x = ToNumber(&a);
y = ToNumber(&b);
z = ToNumber(&c);
n = x * 16 * 16 + y * 16 + z;
if (x == 0 && y == 0) printf... |
Markdown | UTF-8 | 2,900 | 3.140625 | 3 | [] | no_license | ---
title: "簡單方法判斷自己是不是老了"
subtitle: "無關年齡,而在於心"
description: "幾天前,我看到一篇文寫:「當你對新技術嗤之以鼻,認為都只是噱頭時,你就已經老了。」當時我如被人搧了後腦杓般,內心震了一下..."
excerpt: "幾天前,我看到一篇文寫:「當你對新技術嗤之以鼻,認為都只是噱頭時,你就已經老了。」當時我如被人搧了後腦杓般,內心震了一下..."
date: 2021-12-13
author: "Siddharam|西打藍"
cover: ""
image: ""
tags: [""]
... |
Java | UTF-8 | 5,650 | 2.484375 | 2 | [] | no_license | package cn.cote.controller;
import cn.cote.myutils.WebData;
import cn.cote.pojo.User;
import cn.cote.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframewo... |
Python | UTF-8 | 89 | 2.9375 | 3 | [] | no_license | set_A={1,2,3,4}
set_B={'a','b','c','d'}
print(set_A|set_B)
print(set_A.union(set_B))
|
JavaScript | UTF-8 | 373 | 2.796875 | 3 | [
"MIT"
] | permissive | import { Component } from 'react'
function * generatorMethod () {
yield 1
}
async function fooBar () {
for (let val of generatorMethod()) {
return val
}
}
export default class Index extends Component {
async otherMethod () {
await fooBar()
}
render () {
const foo = new Map([['cats', 'dogs']])... |
PHP | UTF-8 | 753 | 3.796875 | 4 | [
"MIT"
] | permissive | <?php
class Solution {
//暴力法
function findOcurrences($text, $first, $second) {
if (empty($text)) {
return [];
}
$arr = explode(' ', $text);
$count = count($arr);
$out = [];
for ($i=0;$i<$count;$i++) {
if (empty($arr[$i])) {
... |
PHP | UTF-8 | 3,722 | 2.75 | 3 | [
"MIT"
] | permissive | <?php
class Audio extends Eloquent {
protected $table = 'audio';
public function artists()
{
return $this->belongsTo('Artist', 'artist');
}
public static function isValid($id, $data)
{
$validator = Validator::make($data, [
'track' => 'required|max:32|unique:audio,track,' . $id,
'... |
Markdown | UTF-8 | 2,545 | 2.8125 | 3 | [] | no_license | # Quick Analysis - Coffee Chain in US:
# 📝Problem Statement
* To help Coffee Chains in the US.
* This Coffee Chain is planning to invest in Online & Offline marketing campaigns for its products in different States.
* We are asked to figure out which products are worth spending the dominant share of the marketing budg... |
JavaScript | UTF-8 | 360 | 3.03125 | 3 | [] | no_license | 'use strict';
const button = document.querySelectorAll('.button');
const body = document.querySelector('body');
function click2 (event) {
if (body.classList.contains('body')){
body.classList.remove('body');
} else {
body.classList.add('body');
}
}
for (let i= 0; i<button.length; i++){
button[... |
PHP | UTF-8 | 3,580 | 2.78125 | 3 | [] | no_license | <?php
/**
* QRReferralLink class definition.
*
* @package Klaviyo for SUMO.
*/
namespace EmpireArtist\KlaviyoSumo\Subscribers;
defined( 'ABSPATH' ) || exit;
use QRcode;
use WP_User;
use EmpireArtist\KlaviyoSumo\Interfaces\HasActions;
use EmpireArtist\KlaviyoSumo\Interfaces\HasFilters;
use function EmpireArtist\Kl... |
JavaScript | UTF-8 | 2,709 | 3.859375 | 4 | [] | no_license | //Vous demandez au client le type de Jeep
// Sport 33290$
// SportS 37240$
// Havane 39235).
// Vous demandez ensuite le terme (24, 48, 60 ou 84) mois.
// Vous demandez la couleur, si c’est rouge ou vert, ajoutez 1399$ au prix du véhicule.
// Vous demandez si la transmission est manuelle (0$), automatique (1500$) ou... |
C++ | UTF-8 | 1,373 | 3.59375 | 4 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
class User {
public:
void setfName(string fName) {
f_name = fName;
}
string getfName() {
return f_name;
}
void setlName(string lName) {
l_name = lName;
}
string getlName() {
return l_name;
}
void setID(int ID1)... |
C# | UTF-8 | 1,629 | 3.109375 | 3 | [] | no_license | using System;
namespace NeuralNetwork.Matrix
{
public class MatrixMath
{
public static Matrix Add(Matrix a, Matrix b)
{
throw new NotImplementedException();
}
public static void Copy(Matrix source, Matrix target)
{
throw new NotImplementedExcept... |
Java | UTF-8 | 402 | 3.53125 | 4 | [] | no_license | //inner class
interface Annoyinner1 {
void eat();
}
//child class
class fruits1 {
public static void main(String[] args) {
//created method
Annoyinner1 obj = new Annoyinner1()
{
//refer to parent class object
public void eat() {
System.out.printl... |
Python | UTF-8 | 529 | 3 | 3 | [
"BSD-2-Clause"
] | permissive | # -*- coding: utf-8 -*-
# Original project https://github.com/zacharyvoase/slugify
"""A generic slugifier utility (currently only for Latin-based scripts)."""
import re
import unicodedata
__version__ = '0.0.1'
def slugify(string):
"""
Slugify a unicode string.
Example:
>>> slugify(u"Héllø W... |
C++ | UTF-8 | 3,212 | 2.578125 | 3 | [] | no_license | #include "precomp.h"
#include "audiomenu.h"
#define AUDIOMENU_MUSICONOFF 0
#define AUDIOMENU_MUSICVOLUME 1
#define AUDIOMENU_SOUNDONOFF 2
#define AUDIOMENU_SOUNDVOLUME 3
AudioMenu::AudioMenu() :
Menu(MenuId::AudioMenu, "Audio")
{
_items.push_back(MenuItem(AUDIOMENU_MUSICONOFF, ""));
_items.push_back(Me... |
Markdown | UTF-8 | 746 | 2.71875 | 3 | [
"MIT"
] | permissive | # my-first-webpage
#### This application will show the basics of HTML and the different languages we are going to be learning.
#### By Jesse White, Nick Reeder, and Eric Roragen-Eggers
## Technologies Used
* _HTML_
* _CSS_
* _VS Code_
## Description
This is the first web page that we created in class and have been upda... |
TypeScript | UTF-8 | 1,308 | 2.609375 | 3 | [] | no_license | import logger from "redux-logger";
import reduxThunk from "redux-thunk";
import { state } from "./utility";
import { applyMiddleware, Store, createStore, compose } from "redux";
const saveToLocalStorage = (state: any) => {
try {
const serializedState = JSON.stringify(state);
localStorage.setItem("state", ser... |
Python | UTF-8 | 759 | 2.9375 | 3 | [] | no_license | '''
Using python's request library, retrieve the HTML of the website you created
that now lives online at <your-gh-username>.github.io/<your-repo-name>
BONUS: extend your python program so that it reads your original HTML file
and returns True if the HTML from the response is the same as the
the contents... |
Java | UTF-8 | 2,024 | 2.46875 | 2 | [
"ISC"
] | permissive | /**
* SPDX-License-Identifier: ISC
* Copyright © 2014-2019 Bitmark. All rights reserved.
* Use of this source code is governed by an ISC
* license that can be found in the LICENSE file.
*/
package com.bitmark.cryptography.crypto.key;
import com.bitmark.cryptography.crypto.Box;
import java.util.Objects;
import s... |
JavaScript | UTF-8 | 498 | 3.625 | 4 | [] | no_license | const events = require('events');
const util = require('util');
let Person = function (name) {
this.name = name;
}
util.inherits(Person, events.EventEmitter);
let james = new Person('James');
let mary = new Person('Mary');
let ryu = new Person('Ryu');
let people = [james, mary, ryu];
people.forEach(function (pe... |
Markdown | UTF-8 | 600 | 2.53125 | 3 | [] | no_license | ## scpf - Copy folders over ssh like a crazy maniac.
>Copying files from server to client in *nix is often done with scp or sftp.
>
>However most ppl knows that if they are going to download the whole webfolder it would take about 1 hour ++
>
> This is what i aim to solve with scpf
>
### Requirements ###
* Bash
* ... |
C++ | UTF-8 | 825 | 2.796875 | 3 | [
"MIT"
] | permissive | #include <bits/stdc++.h>
using namespace std;
int main()
{
vector<int> nums = {0,1,0,3,12};
vector<int>temp;
//temp.
int cntInd = 0;
for(auto i : nums)
{
if(i != 0)
{
cntInd++;
temp.push_back(i);
}
//else
}
//cout<... |
Markdown | UTF-8 | 2,082 | 3.34375 | 3 | [] | no_license | ---
title: JQuery-03事件绑定与插件
date: 2019-10-27 22:06:15
tags:
- JQuery
categories:
- 前端
- JQuery
---
<center>
引言:
JQuery的事件绑定与插件
</center>
<!--more-->
-----
# 事件绑定
1. JQuery标准的绑定方式
`jqObj.事件方法(回调函数)`
```js
//鼠标点击,进入,离开,可以链式编程
$("button").click(function () {
alert(1);
}).mouseover(function () {
alert("鼠标... |
Ruby | UTF-8 | 1,524 | 2.96875 | 3 | [] | no_license | require('rspec')
require('artists')
require('albums')
describe(Artists) do
before() do
Artists.clear()
end
describe('#name') do
it("returns the name of the artist") do
test_art = Artists.new("Bob")
expect(test_art.name()).to(eq("Bob"))
end
end
describe('#id') do
it("returns the ... |
JavaScript | UTF-8 | 3,884 | 2.765625 | 3 | [] | no_license | var questions = [{
question: "1. How many teams played the 2007 T20 World Cup?",
choices: ["8","10","12","14"],
correctAnswer: 2
},
{
question: "2. Who bowled the first ball at the inaugural T20 World Cup?",
choices: ["Shaun Pollock","Makhaya Ntini","Ravi Rampaul","Morne Morkel"],
correctAnswer: 0
},
... |
TypeScript | UTF-8 | 560 | 3.203125 | 3 | [
"MIT"
] | permissive | /*!
* Determine if an element is in the viewport
* (c) 2017 Chris Ferdinandi, MIT License, https://gomakethings.com
* @param {Node} elem The element
* @return {Boolean} Returns true if element is in the viewport
*/
export const isInViewport = (elem) => {
const distance = elem.getBoundingClientRect();
... |
PHP | UTF-8 | 1,383 | 2.953125 | 3 | [] | no_license | <?php namespace Utils;
class Criterio
{
public $coluna;
public $operacao;
public $valor;
public $colunapropriedade;
public $valorpropriedade;
public $juncao;
public $condicaojuncao;
public function Or($coluna, $operacao, $valor, $colunapropriedade = true, $valorpropriedade = false... |
Java | UTF-8 | 262 | 2.71875 | 3 | [] | no_license |
public class Grub extends Creature {
public Grub(Animation left, Animation right,
Animation deadLeft, Animation deadRight)
{
super(left, right, deadLeft, deadRight);
}
public float getMaxSpeed() {
return 0.05f;
}
}
|
C | UTF-8 | 2,487 | 2.53125 | 3 | [] | no_license | /*
* MRMGenParams.h
*
* INTEL CORPORATION PROPRIETARY INFORMATION
* This software is supplied under the terms of a license agreement or
* nondisclosure agreement with Intel Corporation and may not be copied
* or disclosed except in accordance with the terms of that agreement.
*
* Copyright... |
JavaScript | UTF-8 | 883 | 2.671875 | 3 | [] | no_license | import {useState} from 'react';
import Visualization from './Visualization'
import * as htmlToImage from 'html-to-image';
const HtmlToImage = ({data, saveAs, }) =>{
const [time, setTime] = useState(0)
const exportAsPicture = () => {
var t0 = performance.now()
var data = document.getElementsByClassN... |
JavaScript | UTF-8 | 616 | 3.671875 | 4 | [] | no_license | console.log("prototype");
function Parents(name) {
this.name = name;
}
Parents.prototype.sayName = function() {
console.log(`sayName: ${this.name}`);
};
Parents.prototype.doSomthing = function() {
console.log(`doSomthings: ${this.name}`);
};
function Child(name, parentName) {
Parents.call(this,... |
Java | UTF-8 | 5,130 | 2.390625 | 2 | [] | no_license | package Controleurs;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.util.ArrayList;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import GestionnairesMetier.GestionnaireDemande;
import Metier.Demande;
import Models.... |
C++ | UTF-8 | 14,884 | 3.25 | 3 | [
"MIT"
] | permissive |
#ifndef SQL_EXPRESSIONS
#define SQL_EXPRESSIONS
#include "MyDB_AttType.h"
#include "MyDB_Catalog.h"
#include <unordered_map>
#include <string>
#include <vector>
// create a smart pointer for database tables
using namespace std;
class ExprTree;
typedef shared_ptr <ExprTree> ExprTreePtr;
enum Type {BOOL_TYPE, NUMERIC_... |
Markdown | UTF-8 | 599 | 2.890625 | 3 | [] | no_license | A simple url encoder and decoder written in Python 3.
## urlencode
Use it on a file:
```sh
python /path/from/root/to/urlencode/dir/urlencode my_file.txt
```
Or with a pipe:
```sh
pbpaste | python /path/from/root/to/urlencode/dir/urlencode
```
Install by adding
```sh
export PATH="/path/from/root/to/urlencode/dir:... |
Java | UTF-8 | 8,229 | 1.914063 | 2 | [] | no_license | package com.coffeetime.warkop;
import android.annotation.SuppressLint;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.NonNull;
import android.support.annotation.Nulla... |
Shell | UTF-8 | 836 | 2.875 | 3 | [
"BSD-3-Clause"
] | permissive | #!/bin/sh -xe
plugin=`find . -name 'eventlog.so' | head -n 1`
if [ -z "$plugin" ]; then
echo "Unable to find the eventlog plugin"
exit 1
fi
ln -fs "$srcdir/../../src/test/dns.pcap" dns.pcap-dist
ln -fs "$srcdir/../../src/test/dns6.pcap" dns6.pcap-dist
ln -fs "$srcdir/../../src/test/dnso1tcp.pcap" dnso1tcp.pca... |
Markdown | UTF-8 | 6,708 | 2.875 | 3 | [
"MIT"
] | permissive | ---
layout: post
permalink: blog/blog54/
categories: [Data Science, Extra]
---
 Photo by [Campaign Creators](https://unsplash.com/@campaign_creators?utm_source=medium&utm_medium=referral) on [Unsplash](https://unsplash.com?utm_source=medium&utm_med... |
PHP | UTF-8 | 1,279 | 2.546875 | 3 | [
"MIT"
] | permissive | <?php
namespace Stu\Orm\Entity;
interface TradeTransactionInterface
{
public function getId(): int;
public function getWantedCommodityId(): int;
public function setWantedCommodityId(int $wantedCommodityId): TradeTransactionInterface;
public function getWantedCommodityCount(): int;
public funct... |
PHP | UTF-8 | 3,244 | 2.765625 | 3 | [] | no_license | <?php
require_once 'app/models/kayttaja.php';
class BaseController{
public static function get_user_logged_in(){
if(isset($_SESSION['kayttaja'])){
$tunnus = $_SESSION['kayttaja'];
return Kayttaja::haeTunnuksella($tunnus);
}else{
return null;
}... |
Shell | UTF-8 | 1,242 | 3.609375 | 4 | [] | no_license | #!/bin/bash
if [ $# -lt 1 ]; then
echo ""
echo "[DESCRIPTION]"
echo "Put device into kDFU mode using pwnediBSS"
echo ""
echo "[USAGE]"
echo "./enterkdfu <device IP>"
echo ""
echo "[EXAMPLE]"
echo "./enterkdfu 192.168.1.88"
echo ""
exit
fi
if [ $# -gt 1 ]; then
echo "[ERR... |
Java | UTF-8 | 16,240 | 1.945313 | 2 | [] | no_license | /*
* Copyright 2000,2005 wingS development team.
*
* This file is part of wingS (http://wingsframework.org).
*
* wingS is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1
... |
Markdown | UTF-8 | 729 | 2.53125 | 3 | [] | no_license | ---
layout: page
title: Work
permalink: /portfolio/
bodyClass: work
---
Below is a sampling of work that will cross several disciplines: Visual, interaction, branding, research, and UI design.
<ul class="work-list">
{% for work in site.work reversed %}
<li>
<h5>{{ work.name }}: {{ work.involvement }}</h5>
... |
JavaScript | UTF-8 | 625 | 2.609375 | 3 | [] | no_license | var Utils = (function () {
function Utils() { }
Utils._isFirefox = null;
Utils._firefoxUrlBase = undefined;
Utils.platform = function platform() {
if(Utils._isFirefox == null) {
Utils._isFirefox = !!($.browser.mozilla);
}
if(Utils._isFirefox) {
return 'fir... |
Go | UTF-8 | 4,164 | 2.8125 | 3 | [
"MIT"
] | permissive | package handler_test
import (
"bytes"
"net/http"
"testing"
"github.com/suzuki-shunsuke/go-graylog/v8/testutil"
)
func TestHandleGetInput(t *testing.T) {
server, client, err := testutil.GetServerAndClient()
if err != nil {
t.Fatal(err)
}
defer server.Close()
input := testutil.Input()
if _, err := server.A... |
Java | UTF-8 | 1,407 | 2.5625 | 3 | [] | no_license | package pl.coderslab.web;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
@WebServle... |
PHP | UTF-8 | 2,223 | 2.703125 | 3 | [] | no_license | <?php
/**
* Good (Gif oriented object drawing)
*
* @version 1.0
* @author franckysolo <franckysolo@gmail.com>
*/
namespace Good\Gd\Transformation;
use Good\Gd\Resource;
use Good\Gd\Transformation;
use Good\Gd\LayerList;
use Good\Gd\Layer;
/**
* The merge transformation class
*
* @author francky... |
C++ | UTF-8 | 1,328 | 2.6875 | 3 | [] | no_license | // CF1248D1.cpp
#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 550;
char str[MAX_N];
int n, val;
pair<int, int> answer;
int calc()
{
int cnt = 0, min_pos = -1, min_val = n;
for (int i = 1; i <= n; i++)
{
if (str[i] == '(')
cnt++;
else
cnt--;
... |
C++ | UTF-8 | 1,067 | 3.5625 | 4 | [] | no_license | #include <array>
#include <string>
using namespace std;
// GradeBook class definition
class GradeBook
{
public:
//contants --number of students who took the test
static const size_t students = 10; // number of students
GradeBook() {};
// GradeBook(const std::string &, const std::array< int, students > &);
void se... |
JavaScript | UTF-8 | 2,124 | 3.34375 | 3 | [] | no_license | const inquirer = require("inquirer");
const generateChoices = require("../generateChoices");
const { validateAnswerLength } = require("../questionValidators")
const addEmployee = async (db) => {
allRoles = await db.selectAllFromTable("role")
const newEmployeeQs = [
{
type: "input",
message: "What... |
JavaScript | UTF-8 | 133 | 2.5625 | 3 | [
"MIT"
] | permissive | function getFlag(flag){
const index = process.argv.indexOf(flag) + 1
return process.argv[index]
}
module.exports = getFlag
|
Python | UTF-8 | 2,392 | 2.953125 | 3 | [] | no_license | from typing import *
import torch
class MaxTripletLoss(torch.nn.Module): # TODO
def __init__(self, margin: float):
super(MaxTripletLoss, self).__init__()
self.margin = margin
def forward(self, s_pos: torch.Tensor, s_neg: torch.Tensor) -> torch.Tensor:
"""
Computes the max tr... |
Java | UTF-8 | 900 | 1.945313 | 2 | [] | no_license | package com.example.liquibaseDemo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.jdbc.core.JdbcTemplate;... |
C# | UTF-8 | 468 | 2.875 | 3 | [] | no_license | using System;
namespace Enums {
public enum SpriteNames {
Astronaut, AlienDrone, AlienKing, AlienGunner, Bullet, Blast, MedKit, Laser, RapidFire, Shotgun, Bounce
}
static class SpriteNamesMethods {
public static string GetString(this SpriteNames spriteName) {
if (spriteName ==... |
Java | UTF-8 | 2,910 | 2.671875 | 3 | [] | no_license | package com.cheekymammoth.ui;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.math.Rectangle;
import com.cheekymammoth.graphics.CMSprite;
public class SpriteMenuIcon extends MenuIcon {
private boolean isSpriteCentered;
private float spriteOffsetX;
protected CMSprite sprite;
protected C... |
JavaScript | UTF-8 | 1,990 | 3.96875 | 4 | [
"MIT"
] | permissive | // 基本类型,表示独一无二的值
const s1 = Symbol();
console.log(s1);
const s2 = Symbol();
// s1 !== s2
const s3 = Symbol('jack');
console.log(s3.toString());
console.log(Boolean(s3));
console.log(!s3);
const s4 = Symbol('name');
const info = {
[s4]: 'leo',
age: 18,
sex: 'male'
}
console.log(info);
info[s4] = 'tim';
c... |
PHP | UTF-8 | 4,925 | 2.65625 | 3 | [] | no_license | <?php
class EntregaController extends BaseController {
protected $entrega;
public function __construct(Entrega $entrega)
{
$this->entrega = $entrega;
}
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$entrega = DB::table('entrega')
->join('u... |
Java | UTF-8 | 3,987 | 2.609375 | 3 | [] | no_license | package com.passkey;
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.security.KeyStore;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.cert.Certificate;
import java.s... |
Python | UTF-8 | 832 | 2.890625 | 3 | [] | no_license | def lps(pat,M,lps1):
len1 = 0
lps1[0] = 0
i = 1
while i < M:
if pat[i] == pat[len1]:
len1 += 1
lps1[i] = len1
i += 1
else:
if len1 != 0:
len1 = lps1[len1 - 1]
else:
lps1[i] = 0
i += 1
def kmp(pat,text,list1):
M = len(pat)
N = len(text)
lps1 = [0] * M
j = 0
l... |
C | UTF-8 | 950 | 2.984375 | 3 | [] | no_license | #ifndef LANGANT_VIEW_H
#define LANGANT_VIEW_H
/*
* If adding new colors, note:
* 1. 0 is not assignable
* 2. add the following line to view.c:
* init_pair(####, COLOR_BLACK, COLOR_****);
* where #### is the name of the macro and **** is the color of the background
* 3. There is a maximum number of c... |
Shell | UTF-8 | 5,635 | 3.453125 | 3 | [
"Apache-2.0"
] | permissive | #!/bin/bash
#
# Copyright 2013 Jérôme Gasperi
#
# Licensed under the Apache License, version 2.0 (the "License");
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
Markdown | UTF-8 | 1,725 | 3.421875 | 3 | [] | no_license | # 第一次使用时建构 (Construct On First Use)
##目的
确保对象只在第一次使用到的时候才进行初始化,特别是全局的静态对象。
##别名
延迟建构或求值 (Lazy construction/evaluation)
##动机
静态对象必须在被使用前进行建构,如果考虑不周,也可能在它的初始化程中访问到全局静态对象。
```
struct Bar {
Bar () {
cout << "Bar::Bar()\n";
}
void f () {
cout << "Bar::f()\n";
}
};
struct Foo {
Foo () {
bar_.f ();
}... |
PHP | UTF-8 | 3,859 | 3.25 | 3 | [
"MIT"
] | permissive | <?php
namespace Smoren\MultiCurl;
use RuntimeException;
/**
* MultiCurl wrapper for making parallel HTTP requests
* @author <ofigate@gmail.com> Smoren
*/
class MultiCurl
{
/**
* @var int max parallel connections count
*/
protected $maxConnections;
/**
* @var array<int, mixed> common CUR... |
TypeScript | UTF-8 | 7,035 | 2.734375 | 3 | [
"ISC"
] | permissive | import { GlobalProvider } from '../code/globalprovider';
import { isNumber, isBoolean, isArray, isObject, isFunction } from '../code/utils';
/**
* The support method for server side rendering method of components. Just import, but never call directly. The TypeScript compiler uses this function.
*
* It's a def... |
Python | UTF-8 | 2,562 | 2.734375 | 3 | [
"BSD-3-Clause"
] | permissive | import numpy as np
import astropy.units as u
from astropy.coordinates import SkyCoord
from astropy.wcs.utils import pixel_to_skycoord
import warnings
def build_plotting_moc(moc, wcs):
# Get the WCS cdelt giving the deg.px^(-1) resolution.
cdelt = wcs.wcs.cdelt
# Convert in rad.px^(-1)
cdelt = np.abs(... |
Python | UTF-8 | 99 | 3.3125 | 3 | [] | no_license | arr = [1,2,3,4,5]
print arr[2:]
print arr[-1::-1]
print arr[:-2]
for k in range(1,5):
print k
|
JavaScript | UTF-8 | 983 | 2.78125 | 3 | [] | no_license | const { Given, When, Then } = require('cucumber');
const assert = require('assert').strict;
const restHelper = require('../util/resthelper');
Given('un contacto {}', (x) => {
this.result = JSON.parse(x);
});
When('envio una solicitud POST a {}', async (path) => {
//console.log(`${process.env.SERVICE_URL}${path... |
Java | UTF-8 | 173 | 1.742188 | 2 | [
"Apache-2.0"
] | permissive | package com.mycompany;
public interface ApiPath {
String PATH_CUSTOMER = "/customer",
ID = "id",
PATH_CUSTOMER_ID = "/customer/{" + ID + "}";
}
|
Python | UTF-8 | 836 | 2.890625 | 3 | [
"BSD-2-Clause"
] | permissive | import logging
from kafka import KafkaConsumer
from kafka.errors import KafkaError
def are_kafka_settings_valid(brokers, topics):
"""
Check to see if the broker(s) and topics exist.
:param brokers: The broker names.
:return: True if they exist.
"""
try:
consumer = KafkaConsumer(boots... |
Markdown | UTF-8 | 7,680 | 2.625 | 3 | [] | no_license | # Kubernetes dynamic hostpath provisioner
This is a Persistent Volume Claim (PVC) provisioner for Kubernetes. It dynamically provisions hostPath volumes to provide storage for PVCs. Please see [Original README](#original-readme) for more information.
## Test environment
- IBM Cloud Private 3.1 (uses Kubernetes 1.11.... |
Python | UTF-8 | 563 | 3.15625 | 3 | [] | no_license | # Example One --> Timer
from microbit import *
currentDisplay = 0
def startTimer():
global currentDisplay
while currentDisplay > 0:
display.show(str(currentDisplay))
currentDisplay += -1;
sleep(1000)
if currentDisplay == 0:
display.show(Image.HAPPY);
while True:
... |
Python | UTF-8 | 807 | 2.71875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python2
# -*- coding: utf8 -*-
#
# Copyright (c) 2014 unfoldingWord
# http://creativecommons.org/licenses/MIT/
# See LICENSE file for details.
#
# Contributors:
# Jesse Griffin <jesse@distantshores.org>
#
'''
Returns version number of specified language.
'''
import os
import sys
import json
import... |
Java | UTF-8 | 1,814 | 2.84375 | 3 | [] | no_license | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.tsg.recharge;
/**
*
* @author user
*/
public class LuhnAlgoImplValidateCreditCard {
public static boolean Check(String LZ_CardNumber) {
int sum = 0;
boolean alternate = false;
... |
Java | UTF-8 | 1,079 | 2.0625 | 2 | [] | no_license | package com.jrtp.ies.dc.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import co... |
JavaScript | UTF-8 | 965 | 2.609375 | 3 | [] | no_license |
var zurag = [
"url(1.jpg)",
"url(2.jpg)",
"url(3.jpg)",
"url(4.jpg)",
"url(5.jpg)",
"url(6.jpg)",
"url(7.jpg)"
];
i = 0;
document.querySelector("button").addEventListener("click",
function(){
... |
Shell | UTF-8 | 364 | 2.5625 | 3 | [] | no_license | #!----------------------------------------------------------------------------
#!
#! changeAsetup.sh
#!
#! change Asetup default version
#!
#! Usage:
#! source changeAsetup.sh <version>
#!
#! History:
#! 27Apr15: A. De Silva, First version
#!
#!---------------------------------------------------------------------... |
TypeScript | UTF-8 | 25,027 | 3.328125 | 3 | [] | no_license | /**
* Converts object properties to Mongoose enum (string array)
*
* @param {any} obj
* @returns {string[]}
*/
function obj2enum(obj: any): string[] {
let arr: string[] = []
for (let key in obj) {
arr.push(obj[key])
}
return arr
}
/***************************
* UPLOAD IMAGE PROCESSING *
**********... |
Markdown | UTF-8 | 4,435 | 3 | 3 | [] | no_license | ---
title: 'Nuclear Throne: a case study in player feedback'
author: Malcolm
layout: post
redirect_from: wp/nuclear-throne-a-case-study-in-player-feedback/165/
categories:
- blog
tags:
- games
- analysis
---
Nuclear Throne, an early access retro-styled action game from [Vlambeer][1], has held my attention since ... |
Java | UTF-8 | 1,857 | 2.15625 | 2 | [] | no_license | package com.icbc.api;
import org.junit.Test;
import static org.junit.Assert.*;
import com.icbc.api.request.B2cPassfreePaymentPayRequestV3;
import com.icbc.api.request.B2cPassfreePaymentPayRequestV3.B2cPassfreePaymentPayRequestV3Biz;
import com.icbc.api.response.B2cPassfreePaymentPayResponseV3;
public class B2cPassfre... |
C# | UTF-8 | 2,191 | 3.046875 | 3 | [] | no_license | using System;
using System.Linq;
using System.Windows.Input;
using Prism.Commands;
using Prism.Mvvm;
namespace HQF.Tutorial.JsonFormater.ViewModels
{
public class ViewAViewModel : BindableBase
{
public ViewAViewModel()
{
// This command will be executed when the selection of the Li... |
TypeScript | UTF-8 | 1,824 | 3.140625 | 3 | [
"MIT"
] | permissive | import lineReader from 'line-reader'
type Reader = typeof lineReader.open extends (file, cb: (err, reader: infer P) => void) => void ? P : never
const createReader = (filename: string): Promise<Reader> =>
new Promise((resolve, reject) => {
lineReader.open(filename, (err, reader) => {
if... |
Go | UTF-8 | 3,787 | 2.828125 | 3 | [] | no_license | package main
import (
"context"
"fmt"
"io"
"log"
"net"
"strconv"
"time"
"github.com/andreasatle/grpc-go-course/greet/greetpb"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/reflection"
)
// server implements the GreetServiceServer interface.
// This is confusing, sin... |
C++ | UTF-8 | 548 | 3.203125 | 3 | [] | no_license | //author @Nishant
/*
Compact matrix and vector types:
a. Using the cv::Mat33f and cv::Vec3f objects (respectively), create a 3 × 3
matrix and 3-row vector.
b. Can you multiply them together directly? If not, why not?
*/
#include <opencv2/opencv.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int m... |
JavaScript | UTF-8 | 874 | 2.65625 | 3 | [] | no_license | var http = require("http");
var fs = require("fs");
var data = [
{
EmpNo: 101,
EmpName: "ABC"
},
{
EmpNo: 102,
EmpName: "CDS"
},
{
EmpNo: 103,
EmpName: "CDCDF"
}
];
var server = http.createServer(function(request, response) {
// response.writeHead(200,{'Content-Type':' text/html'})... |
Java | UTF-8 | 221 | 1.898438 | 2 | [] | no_license | package com.syntax.class21;
public class ProgLanguageTest {
public static void main(String[] args) {
Java java=new Java("Java", "instance, local, static","Parameterized and non argument");
java.details();
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.