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 | 2,422 | 2.84375 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Printing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using System.Security.Cryptography;
namespace WindowsFor... |
Java | UTF-8 | 174 | 1.828125 | 2 | [
"MIT"
] | permissive | package cd.belhanda.imbishavideostream.Adapters;
import cd.belhanda.imbishavideostream.Modele.Chanson;
public interface itemClick {
void onItemClick(Chanson chanson);
} |
JavaScript | UTF-8 | 5,808 | 2.640625 | 3 | [] | no_license | const db = require('../../database/models');
const { validationResult } = require('express-validator')
class Operation{
constructor(userId, typeId, concept, mount, date) {
this.userId = userId,
this.typeId = typeId,
this.concept = concept,
this.mount = mount,
this.date = date... |
Python | UTF-8 | 3,407 | 2.734375 | 3 | [] | no_license | from django import template
from django.conf import settings
register = template.Library()
@register.tag
def session_value(parser, token):
"""
For each template tag the template parser encounters, it calls a Python function with the tag
contents and the parser object itself. This function is responsible f... |
PHP | UTF-8 | 912 | 2.921875 | 3 | [] | no_license | <?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Validator;
use App\Services\Weather\OpenWeatherApiService;
class WeatherController extends Controller
{
protected $weatherService;
public function __construct(OpenWeatherApiService $weatherService)
{
$this->weatherService... |
PHP | UTF-8 | 932 | 2.796875 | 3 | [
"BSD-3-Clause",
"MIT"
] | permissive | <?php
namespace AppBundle\Entity;
/*chemin permettant d'identifier cette classe et permet de l'utiliser plus tard*/
use Doctrine\ORM\Mapping as ORM;
/* utilisation dans le fichier de la classe mapping
'as' permet d'utiliser @ORM au lieu d'@Mapping, le nom de la classe*/
/**
* @ORM\Entity
* @ORM\Table(name="guide"... |
Python | UTF-8 | 3,888 | 2.546875 | 3 | [
"LicenseRef-scancode-public-domain"
] | permissive | # -*- coding: utf-8 -*-
from gluon import current
from gluon.http import HTTP
import csv
import ntpath
import os
class Importer(object):
""" Importer class to import the prepop data """
# -------------------------------------------------------------------------
def __init__(self, filename=None):
... |
C | UTF-8 | 4,577 | 2.921875 | 3 | [
"WTFPL"
] | permissive | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <getopt.h>
typedef int (*nmsql_callback)(void *, const int, const char *const *,
const char *const *);
extern void hs_init(int *, char ***);
extern void hs_exit();
extern int exec(const char *ir, nmsql_callback callback... |
Python | UTF-8 | 817 | 2.609375 | 3 | [] | no_license | # CS390Z - Introduction to Data Minining - Fall 2021
# Instructor: Thyago Mota
# Description: A Simple Web Scraper
import json
import re
import os
import requests
from bs4 import BeautifulSoup
# definitions/parameters
DATA_FOLDER = '../data'
JSON_FILE_NAME = 'covid_testing_denver.json'
BASE_URL = 'https://covidchec... |
C | UTF-8 | 302 | 3.625 | 4 | [] | no_license | #include<stdio.h>
int main()
{
int arr[3][3];
for (int i=0;i<3;i++)
{
for (int j=0;j<3;j++)
{
printf(" Enter Array of arr[%d][%d]:-",i,j);
scanf("%d",&arr[i][j]);
}
}
for (int i=0;i<3;i++)
{
for (int j=0;j<3;j++)
{
printf(" Array of arr[%d][%d]:- %d\n",i,j,arr[i][j]);
}
}
} |
Python | UTF-8 | 1,843 | 2.65625 | 3 | [] | no_license | import os, sys, random, struct, os.path, shutil, binascii
import pgpy
import pyAesCrypt
from typing import ValuesView
from hashlib import new
from struct import pack
from Crypto.Cipher import DES
from bitstring import ConstBitStream
from pgpy.constants import PubKeyAlgorithm, KeyFlags, HashAlgorithm, SymmetricK... |
PHP | UTF-8 | 2,442 | 3.421875 | 3 | [] | no_license | <!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="utf-8">
<title>Operações com exception em PHP.</title>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" type="text/css" href="css/style.css" media="screen,projection">
</head>
<body>
<?php
function myException($ex... |
Java | UTF-8 | 51,997 | 2.5 | 2 | [] | no_license | package edu.princeton.cs.roasolver;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Formatter;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;
impo... |
Java | UTF-8 | 1,297 | 2.171875 | 2 | [] | no_license | package com.neueda.tinyurl.entity;
import java.sql.Timestamp;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import lombok.ToString;
/**
* This is entity... |
Swift | UTF-8 | 659 | 2.734375 | 3 | [] | no_license | //
// AEFontType.swift
// SampleAgentExpo
//
// Created by Sriram, Krishnan on 3/20/17.
// Copyright © 2017 Sriram, Krishnan. All rights reserved.
//
import Foundation
import UIKit
class AEFontType {
var fontType: String!
var font: AEFont!
init(fontType: String, font: AEFont) {
self.fontT... |
Python | UTF-8 | 85 | 3.078125 | 3 | [] | no_license | a, b = int(input()), int(input())
my_range = range(a, b + 1)
print(*tuple(my_range))
|
JavaScript | UTF-8 | 1,042 | 3.046875 | 3 | [] | no_license | window.onload = () => {
var gridSize = { x:32, y:32 };
var grid = Array.from(Array(gridSize.x), () => new Array(gridSize.y));
for (let x = 0; x < gridSize.x; x++) for (let y = 0; y < gridSize.y; y++) grid[x][y] = new Cell({ x:x, y:y }, (Math.floor(Math.random()*10) < 3) ? 'wall' : 'floor');
grid.forEac... |
Go | UTF-8 | 2,263 | 2.8125 | 3 | [
"AGPL-3.0-only",
"Apache-2.0"
] | permissive | package registry
import (
"testing"
"github.com/replicatedhq/kots/pkg/kotsutil"
"github.com/replicatedhq/kots/pkg/registry/types"
)
func Test_shouldGarbageCollectImages(t *testing.T) {
type args struct {
isKurl bool
kurlRegistryHost string
installParams kotsutil.InstallationParams
registrySe... |
Java | UTF-8 | 1,597 | 1.953125 | 2 | [] | no_license | /*
* Copyright (C) 2014 The Android Open Source Project
*
* 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 app... |
Java | UTF-8 | 9,281 | 2.390625 | 2 | [] | no_license | package ru.betnews.service.news;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import ru.betnews.criteria.NewsCriteria;
import ru.betnews.dao.BetDao;
import ru.betnews.dao.CommentDao;
import ru.betnews.dao.NewsDao;
import ru.betnews.dao.OutcomeDao;
impo... |
Java | UTF-8 | 2,592 | 2.5 | 2 | [] | no_license | package uk.org.cse.stockimport.imputation.walls;
import java.util.Map;
import java.util.Set;
import org.joda.time.DateTime;
import uk.org.cse.nhm.energycalculator.api.types.WallConstructionType;
import uk.org.cse.nhm.energycalculator.api.types.WallInsulationType;
import uk.org.cse.nhm.energycalculator.api.types.Regi... |
Python | UTF-8 | 1,332 | 3.234375 | 3 | [] | no_license | #And this is the third solution, don't quite understand it, but I have figured out the math/code
from time import clock
def convertBase(n,base):
base10 = n
digitLoc=0
converted={}
while base**(digitLoc+1) < base10:
digitLoc += 1
while digitLoc >= 0:
converted.update({digitLoc:... |
Python | UTF-8 | 3,386 | 3.421875 | 3 | [] | no_license | #! python3
import re
import pyperclip
# HOWTO
# create a regex for phone numbers
# create a regex for email addressed
# get the text off the clipboard
# extract email/phone numbers from this list
# copy the extracted email/phone to the clipboard
phone_regex = re.compile(r''
r'(' #... |
JavaScript | UTF-8 | 2,228 | 3.265625 | 3 | [] | no_license | function randomRgbColor() { //随机生成RGB颜色
var r = Math.floor(Math.random() * 256); //随机生成256以内r值
var g = Math.floor(Math.random() * 256); //随机生成256以内g值
var b = Math.floor(Math.random() * 256); //随机生成256以内b值
return "rgb(" + r + "," + g + "," + b + ")"; //返回rgb(r,g,b)格式颜色
}
window.onload = function () {
... |
C# | UTF-8 | 2,895 | 3.125 | 3 | [] | no_license | using Sample.Items;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Sample
{
public partial class Form1 : Form
{
... |
C# | UTF-8 | 1,030 | 3.125 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WindowsFormsApplication1
{
public class TileNode
{
private Tile _tile;
private TileNode _next;
private double _x;
private double _y;
public Til... |
Python | UTF-8 | 1,159 | 2.8125 | 3 | [] | no_license | import pytest
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.events import EventFiringWebDriver, AbstractEventListener
class MyList... |
C | UTF-8 | 381 | 2.984375 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc,char **argv){
char str1[100], str2[100];
char str3[200] = {0};
printf("Enter first text: ");
gets(str1);
printf("Enter second text: ");
gets(str2);
strcat(str3,str1);
strcat(str3, str2);
pr... |
JavaScript | UTF-8 | 2,000 | 2.984375 | 3 | [] | no_license | var assert = require('assert');
var Hero = require('../hero.js');
var Food = require('../food.js');
var Task = require('../task.js');
describe('Hero', function() {
var hero;
var foodA;
var foodB;
var taskA;
var taskB;
var taskC;
beforeEach( function() {
hero = new Hero( 'Link', 100, 'Apple' );
foodA = ne... |
Python | UTF-8 | 155 | 3.515625 | 4 | [] | no_license | #!/usr/bin/env python3
hungry = True
x = 'Feed the bear now!' if hungry else 'Do not feed the bear.' # must have both if and else statements
print(x)
|
PHP | UTF-8 | 876 | 2.640625 | 3 | [] | no_license | <?php
namespace Etcpasswd\OAuthBundle\Provider\Token;
/**
*
* @author Marcel Beerta <marcel@etcpasswd.de>
*/
interface TokenResponseInterface
{
/**
* Return the username attached to this token
*
* @return string
*/
function getUsername();
/**
* Return the access token which... |
JavaScript | UTF-8 | 738 | 3.796875 | 4 | [] | no_license | /*
* Variabel yang dapat diakses dari seluruh script disebut dengan “globally scoped”,
* sementara variabel yang hanya diakses hanya pada fungsi tertentu disebut dengan “locally scoped”.
* Perlu kita perhatikan, jika kita lupa menuliskan keyword let, const, atau var pada script ketika membuat sebuah variabel,
* maka ... |
C++ | UTF-8 | 2,552 | 2.9375 | 3 | [] | no_license | #include <GL/glut.h> // GLUT, include glu.h and gl.h
#include <iostream>
using namespace std;
void reshape(int width, int height){
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, width, height, 0, 0, 1);
glMatrixMode(GL_MODELVIEW);
}
//Incremental
void l... |
SQL | UTF-8 | 3,104 | 3.4375 | 3 | [] | no_license | SET SERVEROUTPUT ON
SET SERVEROUTPUT OFF
--UNDEFINE p_test
DECLARE
--v_test NUMBER(5) := &p_test;
--v_test2 VARCHAR(40) := '&p_test2';
v_cod departments.department_id%TYPE := &p_cod;
v_location_id departments.location_id%TYPE;
BEGIN
--v_test := v_test + 25;
DBMS_OUTPUT.PUT_LINE('Test' || ' ' || v_test || ' ' || v_te... |
Python | UTF-8 | 3,452 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
#
# Copyright 2019 Google Inc.
#
# 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 ... |
Markdown | UTF-8 | 3,362 | 3.375 | 3 | [] | no_license | # Static Driver
A dynamic web application for powering the dynamic features of static web sites.
## Background
Most modern web sites are dynamic. When you request a URL, a web server passes your request to a
web application that queries a database and dynamically generates a web page and then sends it to
you.
That... |
Shell | UTF-8 | 471 | 3.34375 | 3 | [] | no_license | #!/usr/bin/env bash
REPOSITORYNAME=order-management-service
BRANCHNAME=temp-production
USERNAME=username
PASSWORD=password
# Remove the existing directory
if [ -d "$REPOSITORYNAME" ]; then
printf '%s\n' "Removing DIrectory ($REPOSITORYNAME)"
rm -rf "$REPOSITORYNAME"
fi
# Clone the repository
git clone -b $... |
Python | UTF-8 | 1,366 | 2.9375 | 3 | [] | no_license | from bs4 import BeautifulSoup
import requests
response = requests.get("https://news.ycombinator.com/news")
yc_web_page = response.text
soup = BeautifulSoup(yc_web_page, "html.parser")
articles = soup.find_all(name="a", class_="storylink")
article_texts = []
articles_links = []
for article_tag in articles:
text = ... |
JavaScript | UTF-8 | 552 | 4.21875 | 4 | [] | no_license | /*
Exercício 1
-----------
A função insertion cria elementos no DOM e para isso recebe três argumentos, o elemento, o ID de um elemento
já existente no seu HTML e o texto que será inserido no elemento criado.
*/
function insereElementoDeTexto(elemento,id,texto){
const elementoNovo = document.createEle... |
Java | UTF-8 | 1,024 | 2.53125 | 3 | [] | no_license | package com.and1droid.ecohack;
import diewald_shapeFile.files.dbf.DBF_File;
import diewald_shapeFile.files.shp.SHP_File;
import diewald_shapeFile.files.shp.shapeTypes.ShpPolygon;
import diewald_shapeFile.files.shx.SHX_File;
import diewald_shapeFile.shapeFile.ShapeFile;
public class ShapeFileReaderTest {
private ... |
C | UTF-8 | 1,191 | 3.71875 | 4 | [
"MS-PL"
] | permissive | // Based off: http://stackoverflow.com/questions/3536153/c-dynamically-growing-array
#include "array.h"
// Intializes an array with specfied size, meant to hold type struct PidChangeTracker
void InitalizeArray(Array *a, size_t initialSize) {
a->array = (struct PidChangeTracker *)malloc(initialSize * sizeof(struct Pi... |
Java | UTF-8 | 4,433 | 2.21875 | 2 | [] | no_license | package com.example.fickhd.view;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ProgressBar;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.R... |
PHP | UTF-8 | 1,746 | 2.890625 | 3 | [] | no_license | <?php
if(isset($_POST['submit'])) {
// echo "<pre>";
// print_r($_FILES['file_upload']);
// echo "<pre>";
$upload_errors = array(
UPLOAD_ERR_OK => "There is no error",
UPLOAD_ERR_INI_SIZE => "The uploaded file exceeds the upload_max_filesize directive in php.ini",
UPLOAD_ERR_FORM_SIZE => "The uploaded... |
PHP | UTF-8 | 1,268 | 2.625 | 3 | [] | no_license | <?php
namespace Qihucms\PublishVideoPro\Requests;
use Illuminate\Foundation\Http\FormRequest;
class ShortVideoRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
... |
Python | UTF-8 | 1,080 | 2.71875 | 3 | [] | no_license | import cv2
import face_recognition
img1 = face_recognition.load_image_file('obama.jpg')
img1 = cv2.cvtColor(img1, cv2.COLOR_BGR2RGB)
img1Test = face_recognition.load_image_file('obama2.jpg')
img1Test = cv2.cvtColor(img1Test, cv2.COLOR_BGR2RGB)
face = face_recognition.face_locations(img1)[0]
print(face)
enco... |
Python | UTF-8 | 4,692 | 2.53125 | 3 | [] | no_license | # This Python file uses the following encoding: utf-8
import sys
import os
from numpy.linalg import inv
from strings import hill_txt
from PyQt5.QtWidgets import (QWidget, QMessageBox, QCheckBox, QLabel, QSpinBox, QComboBox, QPlainTextEdit, QLineEdit, QHBoxLayout, QVBoxLayout, QGridLayout,QPushButton, QApplication, QFra... |
C++ | UHC | 1,198 | 2.890625 | 3 | [] | no_license | #include <iostream>
#include <fstream>
using namespace std;
int main(void)
{
ifstream fp;
fp.open("input.txt");
int t = 0,i,j,n=0;
int arr[101] = { 0 };
int count[101] = { 0 };
int a, b, temp = 0;
int cnt=1,cnt1=0,max=0;
fp >> t;
for (i = 0; i < t; i++)
{
fp >> n;
for (j = 0; j < 101; j++) {
count[j]... |
Java | UTF-8 | 360 | 2.984375 | 3 | [] | no_license | package com.bit.test;
import java.util.Arrays;
public class Test10{
public static void main(String[] args) {
int[] arr= {1, 7, 2, 9, 6};
Arrays.sort(arr);
int[] newarr=new int[arr.length];
int k=0;
for(int i=0;i<arr.length-1;++i) {
if(arr[i] != arr[i+1]) {
newarr[k++]=arr[i];
}
}
Sys... |
JavaScript | UTF-8 | 8,086 | 2.671875 | 3 | [] | no_license | /*!
* Datadaan
* Datavisualisation
* https://datadaan.nl
* @author Daan van der Zwaag
* @version 1.0.5
* Copyright 2017. MIT licensed.
*/
(function(){ 'use strict';
var svg = d3.select('#area1'),
margin = {top: 20, right: 20, bottom: 110, left: 40},
margin2 = {top: 430, right: 20, bottom: 30, left: 40}... |
Markdown | UTF-8 | 1,382 | 2.921875 | 3 | [
"CC-BY-4.0"
] | permissive | ## markdown
markdown is a lightweight markup language with plain text formatting syntax. Its design allows it to be converted to many output formats, but the original tool by the same name only supports HTML.

## Rmarkdown
Extend the markdown concept to run `R` code.

F... |
TypeScript | UTF-8 | 1,666 | 2.84375 | 3 | [
"MIT"
] | permissive | import { IMessageSerializer } from '@/interfaces/IMessageSerializer';
import { IMessage } from '@/interfaces/IMessage';
import messageTypeCache from './MessageTypeCache';
import { Message } from './Message';
/**
* Represents the MessageConstructor class.
*/
export default class MessageConstructor {
private readonl... |
Markdown | UTF-8 | 5,900 | 2.5625 | 3 | [] | no_license | ---
description: "How to Make Any-night-of-the-week Duck Tacos, Radish-Lime Salad, Cumin-Roasted Squash"
title: "How to Make Any-night-of-the-week Duck Tacos, Radish-Lime Salad, Cumin-Roasted Squash"
slug: 80-how-to-make-any-night-of-the-week-duck-tacos-radish-lime-salad-cumin-roasted-squash
date: 2020-04-24T11:02:56.3... |
TypeScript | UTF-8 | 1,070 | 2.671875 | 3 | [
"MIT"
] | permissive | import { Request, Response } from "express";
import { validateRequest } from "src/core/validator";
import { Task } from "src/models/task";
/**
* @api {get} /tasks Get Tasks
* @apiName GetTasks
* @apiGroup Tasks
*
* @apiSuccessExample Success-Response:
* HTTP/1.1 200 OK
* [
* {
* "id": 1,
* ... |
Java | UTF-8 | 1,693 | 4.21875 | 4 | [] | no_license | /* Java revision work sheet 2
* This is for revision learning OOP
* This program will random select a value between 0 and 9
* The user(s) will then attempt to guess that number
* 16/09/2019
*/
package javaHNDOOP;
// Importing required modules
import java.util.Scanner;
// New public class
public class BasicGues... |
Python | UTF-8 | 1,005 | 3.34375 | 3 | [] | no_license | class Solution:
def matrixReshape(self, mat: List[List[int]], r: int, c: int) -> List[List[int]]:
m, n = len(mat), len(mat[0]) #Get dimensions.
if m * n != r * c: #If total number of elements do not match, cannot reshape so return mat.
... |
Python | UTF-8 | 265 | 3.6875 | 4 | [] | no_license | str = input().strip()
count = [0 for item in range(26)]
for char in str:
if(char.isalpha()):
count[ord(char.lower())-97] += 1
flag=True
for el in count:
if(el == 0):
flag=False
break
if(flag):
print("YES")
else:
print("NO")
|
Java | UTF-8 | 2,268 | 2.109375 | 2 | [] | no_license | package com.qshogun.uiPackage;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.CacheLookup;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.How;
import static com.qshogun.uiPackage.Help.*;
public class FlightFinderPage {
... |
Python | UTF-8 | 1,833 | 2.84375 | 3 | [] | no_license | #!/home/codetc/anaconda3/bin/python
###########################################
# Name: robot.py #
# Author: Matas Lauzadis #
# Description: NASA 2020 Lunabotics Code #
###########################################
import socket # for sending data
import time # for sleeping
i... |
C++ | UTF-8 | 2,998 | 2.890625 | 3 | [] | no_license | #ifndef TEXTQUERY_H_INCLUDED
#define TEXTQUERY_H_INCLUDED
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <set>
#include <memory>
#include <sstream>
#include <algorithm>
using std::string;
using std::vector;
using std::shared_ptr;
using std::weak_ptr;
using std::make_shared;
using std... |
C# | UTF-8 | 1,184 | 2.890625 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Phase_1
{
class SolveLinearSwapGreedy : ISolve
{
public delegate void InfoDelegate(Suduku CurrentSuduku, int ProcessedCount);
public event InfoDelegate InfoEvent;
... |
JavaScript | UTF-8 | 1,084 | 4.75 | 5 | [] | no_license | var callFriend = function(){
var friend = 'Jake';
function callF(number){
return 'Calling ' + friend + ' at ' + number;
}
return callF;
};
//Above you're given a callFriend function that returns
//another function.
//Do what you need to do in order to call your function and
//get 'Calling Jake at 435-21... |
C++ | UTF-8 | 3,218 | 3.109375 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0",
"BSD-2-Clause"
] | permissive | #ifndef I_CPPTEST_TEST_H
#define I_CPPTEST_TEST_H
#include "Exception.h"
#include "TestDisplay.h"
#include <typeinfo>
#if TYPEINFO_IN_STD
using std::type_info;
#endif
#include <vector>
namespace CPPTest
{
class TestBase
{
public:
TestBase() : m_pException(0) { }
virtual ~TestBase() { delete m_pE... |
C++ | UTF-8 | 148 | 2.75 | 3 | [] | no_license | int sumList( int theList[], int size )
{
int sum = 0;
int i = 0;
while( i < size ) {
sum += theList[ i ];
i += 1;
}
return sum;
}
|
Markdown | UTF-8 | 5,719 | 2.75 | 3 | [] | no_license | 11장. 합성과 유연한 설계
=====
강의자의 강의 인트로(?)입니다.
* 11장에서 합성과 믹스인을 말하는 이유도 앞으로 펼쳐질 포인터의 포인터 연산이 언어문법으로 어떻게 제공되는지를 이해시키는 기반이 됩니다.
* 11장은 상속의 조합 폭발과 합성을 가르친다기보다는 그저 데코레이터 패턴을 가르치는 장에 가깝습니다.
- - -
## 목차
1. [참고](#참고)
* [관련자료](#관련자료)
* [책의 목차](#책의-목차)
2. [요약](#요약)
* [객체지향의 본질](#객체지향의-본질)
* [상속과 확장](#상속과-확장)
* [나쁜 확장과 좋은 확장](#... |
Java | UTF-8 | 719 | 2.21875 | 2 | [] | no_license | package net.wavyway._02_security.oauth2;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.web.authentication.logout.LogoutHandler;
import org.springframework.stereotype.Component;
import javax.servlet.h... |
Java | UTF-8 | 2,546 | 2.40625 | 2 | [] | no_license | package com.mdx.example;
import com.github.pagehelper.PageHelper;
import com.mdx.dao.StudentDao;
import com.mdx.entity.Student;
import com.mdx.utils.MyBatisUtils;
import org.apache.ibatis.session.SqlSession;
import org.junit.Test;
import java.util.List;
import java.util.Map;
public class StudentTest {
@Test
... |
C++ | UTF-8 | 878 | 2.875 | 3 | [] | no_license | 锘�#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <sstream>
#include <algorithm>
using namespace std;
int main(){
string s1("hello");
s1.length();
string s2 = s1.substr(2, 3);
string s3;
s3.assign(s1, 2, 3);
int loc = s1.find("lo");
if (loc == (s... |
C++ | UTF-8 | 2,534 | 2.921875 | 3 | [] | no_license | /*------------- Mars.h
*/
/***************************************************************
*
***************************************************************/
#pragma once
/*************************************************************/
/* 1. Standard types for AES cryptography source code */
typedef un... |
C# | UTF-8 | 2,728 | 3.375 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using System.Diagnostics;
namespace IntIntKeyedCollection
{
class Program
{
static void Main(string[] args)
{
... |
Go | UTF-8 | 3,388 | 3.015625 | 3 | [
"BSD-3-Clause",
"CC-BY-4.0",
"LicenseRef-scancode-google-patent-license-golang"
] | permissive | // errorcheck -0 -m -l
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test escape analysis when assigning to indirections.
package escape
var sink interface{}
type ConstPtr struct {
p *int
c ConstPt... |
Python | UTF-8 | 1,071 | 2.84375 | 3 | [] | no_license | from socket import *
import struct
# 小端(3 --> 0x0003,低位内存地址对应小数据) 大端(3 --> 0x3000)
# ! 表示按照网络大端方式组织
# 后面的内容可以认为是占位符的使用
# H:两个字节长度
# 8:表示后面最近内容的个数
# s:bytes 多个字节
# b:byte 1个字节
# struct.pack('!H8sb5sb', 1, )
# struct.unpack()
# 服务器端
ss = socket(AF_INET, SOCK_STREAM)
'''
1.创建套接字SOCK_STREAM
2.绑定ip和port
3.服务器端开始监听端口liste... |
Ruby | UTF-8 | 611 | 3.5 | 4 | [] | no_license | class Bob
def hey(inputRemark)
remark = Remark.new(inputRemark)
if remark.yell?
return "Whoa, chill out!"
elsif remark.question?
return "Sure."
elsif remark.silence?
return "Fine. Be that way!"
else
return "Whatever."
end
end
end
class Remark <... |
Python | UTF-8 | 99 | 3.546875 | 4 | [] | no_license | sum=0
squ=0
n=100
for i in range(1,n+1):
sum=sum+i
squ=squ+i**2
dif=sum**2-squ
print(dif)
|
Shell | UTF-8 | 952 | 3.0625 | 3 | [] | no_license | #!/bin/bash
#set -eo pipefail
source ../config/cluster.config
source ../config/kubernetes.config
source ../config/utils.sh
announce "Deleting Conjur Followers."
set_namespace $CONJUR_NAMESPACE_NAME
echo "Deleting Follower pods."
$CLI delete deployment/conjur-follower --force=true
$CLI delete svc/conjur-follower --... |
Markdown | UTF-8 | 7,660 | 2.953125 | 3 | [
"MIT"
] | permissive | # Trakko Generation Language DSL Specification (TGL DSL)
| schema version | specification | status |
| :------------: | :-----------: | :------: |
| Arakesh | **below** | proposed |
## **1. About the project**
The Trakko Generation Language (in short TGL) is a markup DSL inspired by JSON and Groovy. It ... |
Markdown | UTF-8 | 11,372 | 3.4375 | 3 | [] | no_license | ---
title: 构建一个基于 Redux 的 react 应用
created: 2018/05/21
description: 构建一个基于 Redux 的 react 应用
author: lanqy
---
# 构建一个基于 Redux 的 react 应用
在这篇文章里,我们将深入理解以及学习为什么开发React应用的时候,使用Redux这么重要。我也将一步一步教你如何创建你的第一个Redux应用,包括怎样使用<a href="https://github.com/stormpath/stormpath-sdk-react">Stormpath React SDK </a>于<a href="https://storm... |
Python | UTF-8 | 5,844 | 3.140625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
******************************************************************************************************************************
Project: Network Intrusion Detection using Artificial Neural Network(ANN) Discovery
Program Name: PYTHON_NID_ANN_12052019.01.00
Author: Richard Kessler
Date Cre... |
Python | UTF-8 | 3,213 | 2.71875 | 3 | [] | no_license | import logging
from urlparse import urljoin
from urllib import urlencode
from Cookie import SimpleCookie
import tornado.httpclient
import json
from simple_notification import notify
class HTTPClient(object):
def __init__(self, http_client=None):
self.http_client = http_client if http_client else \
... |
Markdown | UTF-8 | 13,474 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | Kurl.sh
====================================
Kurl is a Kubernetes installer for airgapped and online clusters.
Kurl relies on `kubeadm` to bring up the Kubernetes control plane, but there are a variety of tasks a system administrator must perform both before and after running kubeadm init in order to have a productio... |
C++ | UTF-8 | 691 | 3.0625 | 3 | [] | no_license | /*
* Copyright (c) 2018
* Carick Wienke <carick dot wienke at gmail dot com>
*/
#pragma once
#include "Direction.hpp"
enum class Orientation : bool
{
Horizontal,
Vertical
};
Orientation perpendicular( Orientation orientation );
class Edge
{
public:
static Edge fromDirection( Direction side );
... |
C | UTF-8 | 146 | 2.78125 | 3 | [] | no_license | #include<stdio.h>
void main()
{
int a[3][3]={1,2,3,4,5,6,7,8,9};
int b[6]={1,2,3,4,5,6};
printf("%d\n",*(b+1));
printf("%d\n",*(*(a+2)+1));
}
|
C# | UTF-8 | 842 | 2.75 | 3 | [] | no_license | public static IQueryable<TResult> Select<TSource, TResult>(this IQueryable<TSource> source, IEnumerable<string> columns)
{
// the x in x => ...
var par = Expression.Parameter(typeof(TSource), "x");
// "Bindings" (the Col1 = x.Col1 inside the x => new { Col1 = x.Col1 })
var binds ... |
Markdown | UTF-8 | 2,485 | 3.484375 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | **Elementary**
Simple tab control.
```jsx
const { Tabs, TabPage } = require('precise-ui');
<Tabs>
<TabPage header="First">
First content.
</TabPage>
<TabPage header="Second">
Second content.
</TabPage>
<TabPage header="Third">
Third content.
</TabPage>
<TabPage header="Last">
Final cont... |
C++ | UTF-8 | 1,594 | 3.03125 | 3 | [] | no_license | // C++ traditional way
#include <cassert>
#include <cstddef>
//include boost thread
#include <boost/thread/thread.hpp>
int shared_i = 0;
void do_inc() {
for (std::size_t i = 0; i < 30000; ++i) {
// do some work
// ......
const int i_snapshot = ++ shared_i;
// do some work with i_snapshot
// ...... |
JavaScript | UTF-8 | 3,550 | 2.625 | 3 | [] | no_license | let request = require('request');
let fs = require('fs');
module.exports = {
pwd: function(done) {
// if(cmd === 'pwd'){
// cmd = process.cwd();
// }
done(process.cwd())
//process.stdout.write(process.cwd());
// process.stdout.write('\nprompt > ');
},
... |
C | UTF-8 | 2,744 | 3.34375 | 3 | [] | no_license | #include "library2.h"
int main(int argc, char **argv){
int pkt_numero, i;
float tiempo_primera_llegada, tiempo_corriendo, tiempo, tiemposistema;
FILE*t_entre_llegadas; // fichero para almacenar el Tiempo entre llegadas.
FILE*t_en_sistema; // fichero para almacenar el Tiempo en el sistema.
t_entre_llega... |
Python | UTF-8 | 471 | 2.875 | 3 | [] | no_license | import sys
from progressbar import AnimatedMarker, Bar, BouncingBar, Counter, ETA, Percentage, ProgressBar, ReverseBar, RotatingMarker, SimpleProgress, Timer
class Progress:
def __init__(self, max):
self.max = max;
self.widgets = ['Queueing', Percentage(), Bar()]
self.index = 0
def start(self):
self.pbar = P... |
JavaScript | UTF-8 | 824 | 3.21875 | 3 | [] | no_license | const Snub = require('../snub.js');
// create multiple snub instances, and listen on each.
const snub1 = new Snub();
snub1.on('hello', (payload) => {
console.log('Recieved Instance 1 => ', payload);
});
const snub2 = new Snub();
snub2.on('hello', (payload) => {
console.log('Recieved Instance 2 => ', payload);
});... |
TypeScript | UTF-8 | 829 | 2.78125 | 3 | [] | no_license | export interface FieldUiState {
id: string;
expand: boolean;
}
export interface Size {
width: number;
height: number;
}
export interface Template {
name: string;
image: string | null;
size: Size;
fontName: 'NotoSansCJKjp';
fields: Field[];
}
interface BaseField {
id: string;
name: string;
sam... |
JavaScript | UTF-8 | 3,594 | 2.546875 | 3 | [] | no_license | //функция обновления при загрузке страницы
$(document).ready(function () {
update_content();
})
//функция добавления курса для отслеживания
function LoadVal(){
var ajaxRequest;
try{
ajaxRequest = new XMLHttpRequest();
}
catch (e){
try{
ajaxRequest ... |
C# | UTF-8 | 801 | 3.265625 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ClassObjectsStep223
{
public class Program
{
static void Main(string[] args)
{
Math math = new Math();
Console.WriteLine(" What numbe... |
Java | UTF-8 | 8,100 | 2.03125 | 2 | [
"Apache-2.0"
] | permissive | /**
* Copyright 2016 SPeCS.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writi... |
JavaScript | UTF-8 | 1,858 | 3.109375 | 3 | [] | no_license | import { invariant } from "../../../lib/unit";
const SPACE = " ";
const ENTER = `
`;
export const LEFT_BRACKET = "{";
const RIGHT_BARCKET = "}";
const END = ";";
class Grammar {
constructor() {
this._index = 0;
this._stack = [];
}
parse(input) {
this._input = input;
}
_parseSentence() {
let... |
C++ | UTF-8 | 1,055 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | #include "LightSensor.hpp"
const unsigned int LightSensor::CONNECTION_ATTEMPT_DELAY = 500;
const unsigned int LightSensor::CONNECTION_TIMEOUT = 5000;
LightSensor::LightSensor(uint8_t sdaPin, uint8_t sclPin) {
Serial.print("\nConnecting to BH1750FVI");
lightSensor = new BH1750FVI(BH1750_DEFAULT_I2CADDR, BH175... |
SQL | UTF-8 | 562 | 4.125 | 4 | [] | no_license | -- Write your MySQL query statement below
-- First Solution
SELECT
DISTINCT
A.num ConsecutiveNums
FROM
Logs A
JOIN
Logs B
ON
A.id+1 = B.id
JOIN
Logs C
ON
B.id+1 = C.id
AND
A.num = B.num
AND
B.num = C.num
-- Second Solution
SELECT
DISTINCT
A.num ConsecutiveNums
FROM
... |
Java | UTF-8 | 552 | 2.171875 | 2 | [] | no_license | package com.dobybros.chat.services;
import com.dobybros.chat.data.Authorization;
public interface AuthorizationService {
/**
* 从登陆服务器保存一个Authorization对象
*
* @param session
*/
public void saveAuthorization(Authorization session);
/**
* 通过authorizationCode验证并消费Authorization对象。
*
* @param userId
* ... |
Java | UTF-8 | 3,158 | 2.8125 | 3 | [] | no_license | package com.project.tutorial.abstractdemo.coffemachine;
public class Maxim extends CoffeeDispensor{
public Maxim() {
super();
}
public void getHotAmericano(){
setMilk(0);
setCoffeeBean(10);
setWater(100);
setTemp(80);
setTeaPowder(0);
setS... |
Shell | UTF-8 | 2,361 | 3.59375 | 4 | [] | no_license | #!/bin/bash
echo -e "\033[1;94m🔧 Setting up MacPorts"
curl -LO https://raw.githubusercontent.com/GiovanniBussi/macports-ci/master/macports-ci
source ./macports-ci install
echo -e "\033[1;94m⬇️ Installing GitHub CLI"
sudo port install gh
echo -e "\033[1;94m😀 Authenticating GitHub CLI"
echo $TOKEN >> token.txt
gh au... |
Java | UTF-8 | 4,623 | 1.59375 | 2 | [] | no_license | package com.tencent.mm.plugin.sns.ui;
import android.annotation.TargetApi;
import android.content.Context;
import android.text.SpannableStringBuilder;
import android.util.AttributeSet;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.L... |
Java | UTF-8 | 1,637 | 1.921875 | 2 | [] | no_license | /*
* Copyright (c)
* 2019. THE BODY SHOP INTERNATIONAL LIMITED.
* All rights reserved.
*/
package uk.co.thebodyshop.core.search.solrfacetsearch.provider.impl;
import java.util.Objects;
import de.hybris.platform.core.model.product.ProductModel;
import de.hybris.platform.solrfacetsearch.config.IndexedProperty;
imp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.