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 |
|---|---|---|---|---|---|---|---|
JavaScript | UTF-8 | 2,170 | 2.609375 | 3 | [] | no_license |
export const addTic = (tic) => {
return{
type: 'ADD_REQ',
value: tic
}
}
export const fetchReqs = () => {
return dispatch => {
fetch('/api/home')
.then(res => res.json())
.then(response => {
const action = {
type: "FETCH_REQS",
value: response
}
... |
Java | UTF-8 | 644 | 1.578125 | 2 | [] | no_license | package app.zenly.locator.chat;
import java.util.List;
import p389io.reactivex.C12279e;
import p389io.reactivex.functions.Function;
import p389io.reactivex.functions.Predicate;
/* renamed from: app.zenly.locator.chat.p2 */
/* compiled from: lambda */
public final /* synthetic */ class C2194p2 implements Function {
... |
C# | UTF-8 | 2,135 | 3.140625 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace OOPClass
{
public partial class OCP : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
AppEvent myAppEvent... |
Markdown | UTF-8 | 1,786 | 2.71875 | 3 | [] | no_license | Angularjs with amCharts
===
用途為開發較為複雜的HTML5+Angularjs網站使用. 包含的套件如下:
環境套件
* nodejs
* bower
* gulp
函式庫
* Angularjs
* Angular ui-router
* Bootstrap4
* font-awesome
* lodash
* moment
* numeral
* toastr
* ui-bootstrap
* ui-router
* amstock3
## 範本示範內容
1. 專案架構
2. 使用ui-router的view規劃SPA
3. 透過promise取得遠端資料
4. 使用amChart畫chart及... |
Python | UTF-8 | 4,277 | 3.75 | 4 | [] | no_license | # -*- conding:utf-8 -*-
# 编写“计算机类”,属性包括CPU型号,内存大小,硬盘大小。
# 行为包括介绍CPU型号,展示内存大小,展示硬盘大小,综合介绍。
class Computer:
def __init__(self,CPU,internal_storage,hard_disk):
self.CPU=CPU
self.internal_storage=internal_storage
self.hard_disk=hard_disk
def infor_CPU(self):
retu... |
JavaScript | UTF-8 | 18,811 | 2.53125 | 3 | [] | no_license | require(['jquery', 'step-bar', 'layer', 'uploadify'], function ($, stepBar) {
//格式化时间
function formatTime(obj) {
if (obj) {
var year = obj.getFullYear(),
month = parseInt(obj.getMonth()) + 1 > 9 ? parseInt(obj.getMonth()) + 1 : '0' + (parseInt(obj.getMonth()) + 1),
... |
Java | UTF-8 | 4,348 | 2.46875 | 2 | [] | no_license | package com.igo.dao.impl;
import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Example;
import org.hibernate.criterion.MatchMode;
import org.hibernate.criterion.Restrictions;
import com.igo.... |
C++ | UTF-8 | 324 | 2.890625 | 3 | [] | no_license | #include <iostream>
using namespace std;
struct gagat {
double x;
double y;
};
int main()
{
gagat A, B, C, D, O;
cin >> A.x >> A.y;
cin >> B.x >> B.y;
cin >> C.x >> C.y;
O.x = (A.x + C.x)/2;
O.y = (A.y + C.y)/2;
D.x = 2 * O.x - B.x;
D.y = 2 * O.y - B.y;
cout << D.x;
cout << endl << D.y;
system("Pause")... |
C# | UTF-8 | 621 | 3.09375 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Thanos.Common
{
public static class Extensions
{
public static List<T> ReduceByHalf<T>(this List<T> input)
{
var output = new List<T>(input);
int halfOfCount = output.Count(... |
Python | UTF-8 | 5,666 | 2.671875 | 3 | [] | no_license | from scrapy.spider import Spider
from Bookies.items import EventItem2
from Bookies.loaders import EventLoader
from scrapy.contrib.loader.processor import TakeFirst
from scrapy import log
from scrapy.http import Request
import json
take_first = TakeFirst()
#
# The data seems to come with the initial GET request,
# but ... |
Java | UTF-8 | 891 | 2.125 | 2 | [] | no_license | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package es.cemi.appfinal.action;
import javax.servlet.http.HttpSession;
import org.apache.struts2.ServletActionContext;
import com.opensymphony.xwork2.ActionSupport;
import es.cemi.appfinal.util.Constants;
/**
* @a... |
Java | UTF-8 | 3,895 | 2.078125 | 2 | [
"MIT"
] | permissive | /**
* The MIT License (MIT)
*
* Copyright (c) 2016 Caratacus
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, c... |
C# | UTF-8 | 2,073 | 2.90625 | 3 | [
"Apache-2.0"
] | permissive | using Knowledge.Prospector.Data.Entities;
using Knowledge.Prospector.Data.Relationships;
namespace Knowledge.Prospector.Data.Collections
{
/// <summary>
/// Rules used by Entity Graph Builder.
/// </summary>
public static class EntityGraphBuilderRules
{
/// <summary>
/// Add to IEntityGraph all ins... |
Go | UTF-8 | 2,155 | 2.71875 | 3 | [] | no_license | package main
import (
"fmt"
"net/http"
"github.com/gorilla/handlers"
"log"
"github.com/garyburd/redigo/redis"
"os"
"time"
"os/signal"
"syscall"
"strings"
)
var (
Pool *redis.Pool
appSettings AppSettings
)
func init() {
// TODO: proper config file
appSettings = AppSettings{
RedisHost: "[ec2-52-200-201... |
PHP | UTF-8 | 2,185 | 2.53125 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | <?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Login extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->library('form_validation');
$this->load->model('UtilityMethods');
$this->load->model('loginmodel');
}
// Show login page
public ... |
Python | UTF-8 | 613 | 4.15625 | 4 | [] | no_license | # Author: Andrey Maiboroda
# brealxbrealx@gmail.com
# Homework15
# task2
#Write a decorator that takes a list of stop words and\
# replaces them with * inside the decorated function
def stop_words(words: list):
def check_func(func):
def replace(name):
x = func(name)
for word in w... |
Java | UTF-8 | 1,478 | 2.125 | 2 | [] | no_license | package org.hds.mapper;
import org.apache.ibatis.jdbc.SQL;
import org.hds.model.statistic;
public class statisticSqlProvider {
public String insertSelective(statistic record) {
SQL sql = new SQL();
sql.INSERT_INTO("t_statistics");
if (record.getRecordingtime() != null) {
... |
Java | UTF-8 | 945 | 3.21875 | 3 | [] | no_license | /**
* https://leetcode.com/problems/super-ugly-number/description/
*/
public class SuperUglyNumber {
public int nthSuperUglyNumber(int n, int[] primes) {
if (n < 1 || primes == null || primes.length == 0) {
return -1;
}
int[] cursor = new int[primes.length];
int[] uglyNum = new int[n];
i... |
Python | UTF-8 | 3,469 | 2.984375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import asyncio
from lighthouse import LighthouseV1, LighthouseV2
from bleak import discover, BleakClient
from output import output
class LighthouseLocator():
"""Discover lighthouses in the local environment via Bluetooth.
"""
async def discover(self):
"""Discover all potent... |
C++ | WINDOWS-1252 | 844 | 2.8125 | 3 | [] | no_license | #include<stdio.h>
#include<string.h>
int main(void)
{
//printf("how many times do ypu want to try")
int n;
int i=0;
scanf("%d",&n);
char str[100]="scu";
char str1[100];
scanf("%s",str1);
int len;
len = strlen(str1);
if (n<10&&len<=100)
{
printf("YES");
while(i<n)
{
len = strlen(str1);
if (len<=10... |
Java | UTF-8 | 996 | 2.453125 | 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 Modelo;
/**
*
* @author Kami
*/
public class Parentesco_Patologia {
private int id_parentesco_pat;
private String d... |
Markdown | UTF-8 | 1,214 | 2.6875 | 3 | [
"MIT"
] | permissive | # texture.pixelHeight
> --------------------- ------------------------------------------------------------------------------------------
> __Type__ [Number][api.type.Number]
> __Object__ [TextureResourceCanvas][api.type.TextureResourceCanvas]
> __Library__ [graphics.*][api.library.gra... |
C++ | UTF-8 | 9,048 | 2.953125 | 3 | [] | no_license | #define OLC_PGE_APPLICATION
#include "olcPixelGameEngine.h"
#include "olcPGEX_AdditionalColors.h"
#include <iostream>
#include <random>
#include <string>
#include <vector>
class Gear {
private:
// Location of the gear
int x;
int y;
bool bGrabbed;
/*
* Classification of the gear
*
* ... |
Java | UTF-8 | 772 | 2.21875 | 2 | [] | no_license | package com.rpckid.common;
/****************************************************
*
* @Description: 服务器-输出
*
* @Author: DONGWENQI
* @Date: Created in 9:03 AM 2018/11/22
* @Modified By:
****************************************************/
public class MessageOutput {
//输出类型
private String type;
//消息... |
Python | UTF-8 | 2,158 | 4.25 | 4 | [] | no_license | # Design a function that returns # of elements in an array. this array is sorted
# so high level algorithmic description
# we will use the binary search to find the 1st index
# use another binary search to find the 2nd index
# if the first index <= 2nd index: this means that its valid
# - case: first index = 2nd ind... |
Java | UTF-8 | 875 | 3.375 | 3 | [] | no_license | package trees;
public class PathSum3 {
public static void main(String[] args) {
TreeNode root = new TreeNode(10);
root.left = new TreeNode(5);
root.right = new TreeNode(-3);
root.left.left = new TreeNode(3);
root.left.right = new TreeNode(2);
root.left.left = new TreeNode(3);
root.left.right = new TreeN... |
TypeScript | UTF-8 | 125 | 2.921875 | 3 | [] | no_license | /**
* Interface representing heat map data point.
*/
export interface Point {
x: number;
y: number;
value: number;
}
|
C# | UTF-8 | 2,715 | 2.9375 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Healthee.EFModels;
using Healthee.DataModels;
using Healthee.Logging;
using System.Diagnostics;
namespace Healthee.DataAbstraction
{
public class AppointmentDAL : AbstractDAL
{
/// <summary>
/// Adds new... |
Java | UTF-8 | 602 | 2.515625 | 3 | [] | no_license | package Managers;
import Models.User;
import ObjectFactory.UserFactory;
import java.util.ArrayList;
import java.util.List;
public class UserManager extends Manager<User>{
protected UserFactory factory;
protected List<User> collection;
public UserManager(){
super(new ArrayList<User>(){
... |
Java | UTF-8 | 1,183 | 3.109375 | 3 | [] | 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 hw11_recursivatorrejuego;
/**
*
* @author FAMILIA TONATO
*/
public class HW11_RecursivaTorrejuego {
/**
... |
Java | UTF-8 | 5,599 | 2.96875 | 3 | [] | no_license | import java.util.*;
import java.io.*;
public class reduce {
//static int total;
static Pair[] x;
static Pair[] y;
static boolean[] chosen;
static int ans = Integer.MAX_VALUE;
static multiset<Integer> xvals = new multiset<>();
static multiset<Integer> yvals = new multiset<>();
public st... |
Markdown | UTF-8 | 1,441 | 3.421875 | 3 | [] | no_license | ## Problem statement
All of us receive a ton of messages and emails on a daily basis. Collectively, that is a lot of data which can provide useful insights about the messages that each of us gets. What if you could know whether a certain message has brought you good news or bad news before opening the actual message. I... |
Java | UTF-8 | 1,106 | 3.359375 | 3 | [] | no_license | package com.itheima.demo03.LambdaTest;
import java.util.ArrayList;
import java.util.Collections;
/**
* @author shkstart
* @create 2019-11-07 14:59
*/
public class Demo03ComparatorTest {
public static void main(String[] args) {
ArrayList<Person> list = new ArrayList<>();
list.add(new Person("a"... |
Java | UTF-8 | 2,365 | 2.046875 | 2 | [] | no_license | package com.atguigu.servlet;
import java.io.IOException;
import java.sql.SQLException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.atguigu.dao.impl.dao;
import com.atguigu.pojo.Provinc... |
Python | UTF-8 | 160 | 3.25 | 3 | [] | no_license | N = int(input())
d = [int(input()) for _ in range(N)]
d.sort()
print(sum(d))
if 1 < N and sum(d[:-1]) > d[-1]:
print(0)
else:
print(d[-1] - sum(d[:-1])) |
Python | UTF-8 | 840 | 2.9375 | 3 | [] | no_license | from score_libraries import *
def get_book_order(library_order, book_scores):
book_order = {}
scanned_books = set()
for library in library_order:
all_books = set(library.books)
duplicated_books = all_books.intersection(scanned_books)
books_to_scan = list(all_books.difference(dupl... |
C# | UTF-8 | 3,003 | 2.828125 | 3 | [] | no_license | using System;
//TODO make antitheft work with my server
//NOTE: App will check server to see if it should delete itself port 8555
//Server delete response: jazyisawesome
//Server ok response: applepie
//Make the jazy.ia record last successful time of change
namespace Quick_Join_KCISCisco
{
public class KCISCisco... |
Java | UTF-8 | 2,741 | 2.765625 | 3 | [] | no_license | package fr.quintipio.gestionChargeMon.ihm.recettes;
import java.awt.Color;
import java.awt.Toolkit;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.border.EmptyBorder;
import fr.quintipio.gestionChargeMon.entite.Recette;
import javax.swing.JLabel;
import java... |
C++ | UTF-8 | 1,053 | 2.53125 | 3 | [
"MIT"
] | permissive | #include "PCH.h"
#include "ResourceDimension.h"
using namespace std;
using namespace SlimShader;
string SlimShader::ToString(ResourceDimension value)
{
switch (value)
{
case ResourceDimension::Buffer :
return "buffer";
case ResourceDimension::Texture1D :
return "texture1d";
case ResourceDimension::Texture2D ... |
Rust | UTF-8 | 630 | 2.9375 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT",
"Apache-2.0"
] | permissive | //! Common Interrupt interface defintions shared between peipherals.
/// A common interrupt number interface, which returns the associated interrupt
/// of the peripheral.
///
/// Used to unmask / enable the interrupt with [`cortex_m::peripheral::NVIC::unmask()`].
/// This is useful for all `cortex_m::peripheral::INTE... |
TypeScript | UTF-8 | 590 | 2.578125 | 3 | [] | no_license | import { IEntry } from "models/entry";
import { NavigateFn } from "@reach/router";
import { genUrl } from "./genUrl";
export const navigateToEntry = (navigate: NavigateFn, entry: IEntry) => {
navigateToConceptAndLanguage(navigate, entry.concept, entry.language || "");
};
export const navigateToConceptAndLanguage = ... |
Markdown | UTF-8 | 4,933 | 2.859375 | 3 | [] | no_license | ---
title: "PA1_template.Rmd"
output:
html_document:
keep_md: true
---
## Reproducible Research Peer-graded Assignment Course Project 1
## Project Introduction
This assignment makes use of data from a personal activity monitoring device. This device collect data at 5 minute intervals throughout the day. The dat... |
C | UTF-8 | 1,567 | 3.0625 | 3 | [] | no_license | // This file specifies the interface between the inter-processor communication
// code (written by Kiran) and the control code (written by Kier).
#ifndef __COMMS_INTERFACE_H
#define __COMMS_INTERFACE_H
// A structure to hold the setpoints (positions of the levers) sent from the
// RC transmitter via the RC receiver a... |
Java | UTF-8 | 283 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | package com.syberos.learnjava.abstract_factory_pattern;
/**
* Created by toby on 18-3-20.
*/
// 具体产品类 B2
public class ConcreteProductB2 extends AbstractProductB {
@Override
public void method() {
System.out.println("具体产品 B2 的方法");
}
}
|
Python | UTF-8 | 2,932 | 3.171875 | 3 | [] | no_license | import numpy
import matplotlib.pyplot as plt
import pandas as pd
import math
from keras.models import Sequential
from keras.layers import Dense
from keras.layers import LSTM
from sklearn.metrics import mean_squared_error
# convert an array of values into a dataset matrix
def create_data(dataset, look_back=... |
C++ | UTF-8 | 524 | 2.703125 | 3 | [] | no_license | class Solution {
public:
vector<int> singleNumber(vector<int>& nums)
{
int x=0,a=0;
vector<int> res;
for(auto i:nums)
x^=i;
int bitmask=0x00000001;
for(int i=0;i<31;++i)
{
if((x&bitmask)>>i)
break;
else
... |
Java | UTF-8 | 1,180 | 2.3125 | 2 | [] | no_license | package com.jjc.ssoClient.common.bean;
/*
* $Id: Page.java,v 1.1 2012/05/04 00:22:32 hugq Exp $
* Copyright(c) 2000-2007 HC360.COM, All Rights Reserved.
*/
import java.util.List;
/**
* 分页查询结果Bean
* @author hugq
*
*/
public class Page {
/** 查询结果 */
private List<?> lstResult;
/** 分页信息Bean */
private PageBea... |
Java | UTF-8 | 2,495 | 4 | 4 | [] | no_license | package main.java.ladders.BinaryTree;
/**
* 453. Flatten Binary Tree to Linked List
Flatten a binary tree to a fake "linked list" in pre-order traversal.
Here we use the right pointer in TreeNode as the next pointer in ListNode.
Notice
Don't forget to mark the left child of each node to null.
Or you wi... |
C# | UTF-8 | 1,336 | 2.953125 | 3 | [] | no_license | using System.Threading.Tasks;
using System.Net.Http;
using Newtonsoft.Json;
using System.Linq;
using System.IO;
using System;
public class OfflineCityBikeDataFetcher : ICityBikeDataFetcher
{
int bikesAvailable;
bool knownName;
string[] stationList1;
public async Task<int> GetBikeCountInStation(string ... |
C++ | UTF-8 | 3,142 | 2.859375 | 3 | [
"Unlicense"
] | permissive | #ifndef KEYBOARDCONTROLSYSTEM_H
#define KEYBOARDCONTROLSYSTEM_H
#include "../ECS/ECS.h"
#include "../EventBus/EventBus.h"
#include "../Events/KeyPressedEvent.h"
#include "../Events/KeyReleasedEvent.h"
#include "../Components/KeyboardControlledComponent.h"
#include "../Components/RigidBodyComponent.h"
#include "../Comp... |
C++ | UHC | 978 | 3.359375 | 3 | [] | no_license | #include <stdlib.h>
#include <iostream>
#include "mystack.h"
using namespace std;
#define MAXSIZE 10
template<class T>
stack<T>::stack()
{
size = MAXSIZE;
this->buf = new T[size];
}
template<class T>
stack<T>::stack(int size)
{
this->size = size;
this->buf = new T[this->size];
top = -1;
}
template<class T>
void... |
TypeScript | UTF-8 | 11,685 | 3.28125 | 3 | [] | no_license | import os = require('os');
import fs = require('fs');
import path = require('path');
import http = require('http');
import async = require('async');
import log = require('./log');
var pidFile;
export function isInteger(n:number) {
return Number(n) === n && n % 1 === 0;
}
export function isFloat(n:number) {
r... |
Java | UTF-8 | 1,123 | 2.46875 | 2 | [] | no_license | package com.trongdv.enterpise.model;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.io.Serializable;
import java.time.Instant;
@Getter
@Setter
@NoArgsConstructor
public class EmployeeDTO implements Serializable {
private long id;
private String rollNumber;
priva... |
Python | UTF-8 | 2,422 | 2.53125 | 3 | [
"MIT"
] | permissive | # An adaptor to create and update state_collections based on delimited files
import funtool.adaptor
import funtool.group
import funtool.state_collection
import funtool_common_processes.adaptors.tabular
import csv
import os
# Creates new states from each row in the delimited file. Can create duplicates.
def extend_fr... |
SQL | UTF-8 | 2,072 | 3.1875 | 3 | [
"Apache-2.0"
] | permissive | # ************************************************************
# Sequel Pro SQL dump
# Version 4749
#
# http://www.sequelpro.com/
# https://github.com/sequelpro/sequelpro
#
# ************************************************************
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OL... |
Java | UTF-8 | 20,063 | 2.09375 | 2 | [] | no_license | /**
*
* Copyright (c) 2002-2008 The P-Grid Team, All Rights Reserved.
*
* This file is part of the P-Grid package.
* P-Grid homepage: http://www.p-grid.org/
*
* The P-Grid package is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published... |
Go | UTF-8 | 2,909 | 2.515625 | 3 | [] | no_license | package network
import (
MQTT "github.com/eclipse/paho.mqtt.golang"
"fmt"
"strconv"
"time"
"github.com/sirupsen/logrus"
"sync"
"github.com/chikong/ordersystem/model"
"github.com/chikong/ordersystem/manager"
"github.com/garyburd/redigo/redis"
"github.com/chikong/ordersystem/constant"
"github.com/chikong/orde... |
C++ | UTF-8 | 262 | 2.515625 | 3 | [
"MIT"
] | permissive | #include "StarLinkWithTolls.h"
StarLinkWithTolls::StarLinkWithTolls(StarLink* link, TollType toll) :
StarLinkWithReverseLink(link), toll_(toll) {
};
StarLinkWithTolls::~StarLinkWithTolls() {
};
FPType StarLinkWithTolls::getTime() const {
return toll_;
};
|
JavaScript | UTF-8 | 1,389 | 4.5625 | 5 | [] | no_license | //regular function expression
// const calcArea = function (radius) {
// return 3.14 * radius ** 2;
// };
// ARROW function: don't use the function keyword, bit shorter
// when there's only one function parameter, parentheses can be taken away but MORE THAN 1 or NONE = parentheses
// when we have a single return on ... |
Shell | UTF-8 | 198 | 3.265625 | 3 | [] | no_license | #!/usr/bin/env bash
set -e
shift
cmd="$@"
until curl -f http://backend:3001; do
>&2 echo "Server is unavailable - sleeping"
sleep 1
done
>&2 echo "Server is up - executing command"
exec $cmd |
Python | UTF-8 | 599 | 3.578125 | 4 | [] | no_license | # -*- coding:utf-8 -*-
author = 'haibo'
time = '2018-7-28'
"""
内置方法:__getitem__
重定向到字典,返回的是字段的值
"""
class MyGetitem:
def __getitem__(self, key):
if key == 'haibo':
return '90'
elif key == 'dingli':
return '85'
elif key == 'jianguang':
return '99'
... |
JavaScript | UTF-8 | 981 | 2.78125 | 3 | [] | no_license |
function articles(state = [], action) {
switch (action.type) {
case 'LIKE_ARTICLE' :
console.log("Incrementing Likes!!");
return state.map((article, index) => {
if (index === action.index) {
return Object.assign({}, article, {
likes: article.likes... |
JavaScript | UTF-8 | 1,106 | 2.859375 | 3 | [] | no_license | function timeDifference(date1,date2) {
var difference = date1.getTime() - date2.getTime();
var _daysDifference = Math.floor(difference/1000/60/60/24);
difference -= _daysDifference*1000*60*60*24
var _hoursDifference = Math.floor(difference/1000/60/60);
difference -= _hoursDifference*1000*60*60
var _minut... |
C++ | GB18030 | 1,047 | 3.25 | 3 | [] | no_license | // DataStructuresAndAlgorithms.cpp : ̨Ӧóڵ㡣
//
#include "stdafx.h"
int BinarySearch(int *in_aNum, int in_nLen, int in_nTargetNum);
int _tmain(int argc, _TCHAR* argv[])
{
int aNum[] = {1, 2, 3, 4, 5, 6};
int aNum2[] = {1, 2, 3, 4, 5, 6, 7};
int nIndex = BinarySearch(aNum, 6, 4);
printf("nIndex : %d\n", nIndex);
... |
Markdown | UTF-8 | 2,084 | 3.109375 | 3 | [
"MIT"
] | permissive | # React Pagination Component
[![NPM version][npm-image]][npm-url]
[](https://travis-ci.org/amadormf/react-pag)
[![npm download][download-image]][download-url]
[npm-image]: http://img.shields.io/npm/v/react-pag.svg?style=flat-square
[npm-url]:... |
Shell | UTF-8 | 351 | 3.46875 | 3 | [] | no_license | #!/bin/sh
# usage: ask question default
# asking in stderr
ask() {
local ans
echo -n "${1} [${2}]: " >&2
read ans
[ -n "${ans}" ] && echo "${ans}" || echo "${2}"
}
ROOT=$(ask 'rootfs' 'zroot/ROOT')
POOL=$(ask 'pool' $(echo $ROOT|cut -d/ -f1))
INIT=$(ask 'init' '/sbin/init')
cat >vars <<EOF
ROOT="${ROOT}"
POO... |
Go | UTF-8 | 535 | 2.953125 | 3 | [] | no_license | package main
import (
"encoding/asn1"
"fmt"
"os"
)
// func Marshal(val interface{}) ([]byte, error)
// func Unmarshal(val interface{}, b []byte) (rest []byte, err error)
func main() {
val := 13
fmt.Println("Before marshal/unmarshal:", val)
mdata, err := asn1.Marshal(val)
checkError(err)
var n int
_, err1 :... |
Markdown | UTF-8 | 444 | 2.8125 | 3 | [] | no_license | # TestingForms
This web app sets up a simple form that allows a user to enter an id and a username.
This data is then routed to the appropriate method in MainController.java.
Thymeleaf is used to marshall the data to a Greeting object, where it is automagically stored in
fields that correspond to special parameters in... |
JavaScript | UTF-8 | 622 | 3.140625 | 3 | [] | no_license | $(function() {
$("form").submit(function(e) {
e.preventDefault();
var $form = $(this);
var num_1 = +$form.find("#num_1").val();
var num_2 = +$form.find("#num_2").val();
var operator = $form.find("#operator").val();
var result = calculate(operator, num_1, num_2);
$("#result").text(result... |
C++ | UTF-8 | 1,609 | 3.828125 | 4 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
class LISSolution {
public:
int lis(const vector<int>& inputArray) {
if (inputArray.empty()) return 0;
vector<int> log(inputArray.size(), 1);
for (int index = 1; index < inputArray.size(); ++index) {
for(int start=0; ... |
C | UTF-8 | 1,946 | 2.515625 | 3 | [] | no_license | /* tplot.c
=======
Author: R.J.Barnes
*/
/*
(c) 2010 JHU/APL & Others - Please Consult LICENSE.superdarn-rst.3.2-beta-4-g32f7302.txt for more information.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <math.h>
#include "tplot.h"
i... |
Java | UTF-8 | 7,673 | 2.46875 | 2 | [] | no_license | package com.boc.bocsoft.mobile.bocmobile.buss.specializedservice.overseaszone.base;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.TextPaint;
import android.text.style.BackgroundColorSpan;
import android.text.style.ClickableSpan;
import android.text.style.ForegroundColorSpan;
imp... |
JavaScript | UTF-8 | 2,275 | 3.03125 | 3 | [] | no_license | import { useState, useEffect } from "react";
const useStats = statMessages => {
// state
const [scoreTotal, setScoreTotal] = useState(0);
const [neutralTotal, setNeutralTotal] = useState(0);
const [positiveTotal, setPositiveTotal] = useState(0);
const [negativeTotal, setNegativeTotal] = useSta... |
Python | UTF-8 | 538 | 2.546875 | 3 | [] | no_license | import pyrebase
config = {
"apiKey": "AIzaSyD6F67UAfUxa0RjO8sgQtLR9InLifIA578",
"authDomain": "robotani-path-storage.firebaseapp.com",
"databaseURL": "https://robotani-path-storage.firebaseio.com",
"storageBucket": "robotani-path-storage.appspot.com"
}
firebase = pyrebase.initialize_app(config)
db =... |
Java | UTF-8 | 1,204 | 2.0625 | 2 | [] | no_license | package com.usco.esteban.agenda_procesos.app.models.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.usco.esteban.agenda_procesos.app.models.dao.IJu... |
C# | UTF-8 | 3,660 | 3.171875 | 3 | [
"MIT"
] | permissive | using System.IO;
using System.Text;
namespace Gsemac.IO {
public class UnbufferedStreamReader :
TextReader {
// Public members
public static new UnbufferedStreamReader Null => new UnbufferedStreamReader(null);
public Stream BaseStream => stream;
public Encoding CurrentE... |
SQL | UTF-8 | 841 | 4.125 | 4 | [] | no_license | ERROR: type should be string, got "\nhttps://www.hackerrank.com/challenges/what-type-of-triangle/problem\n\nWrite a query identifying the type of each record in the TRIANGLES table using its three side lengths. Output one of the following statements for each record in the table:\n\nEquilateral: It's a triangle with sides of equal length.\nIsosceles: It's a triangle with sides of equal length.\nScalene: It's a triangle with sides of differing lengths.\nNot A Triangle: The given values of A, B, and C don't form a triangle.\n\nSELECT CASE\nWHEN A+B <=C OR A+C<=B OR B+C<=A THEN 'Not A Triangle'\nWHEN A=B AND B=C THEN 'Equilateral'\nWHEN A=B OR B=C OR A=C THEN 'Isosceles'\nELSE 'Scalene'\nEND\nFROM TRIANGLES;\n \n \n OR \n \n SELECT IF(A+B>C AND A+C>B AND B+C>A, IF(A=B AND B=C, 'Equilateral', IF(A=B OR B=C OR A=C, 'Isosceles', 'Scalene')), 'Not A Triangle') FROM TRIANGLES;\n\n \n \n\n\n\n\n" |
C++ | UTF-8 | 230 | 2.796875 | 3 | [] | no_license | #pragma once
#include <cstdint>
union Data {
int32_t i;
float f;
explicit Data(int32_t i) {
this->i = i;
}
explicit Data(float f) {
this->f = f;
}
Data() {
i = -1;
}
};
|
Java | UTF-8 | 126 | 1.585938 | 2 | [] | no_license | package dao;
import modelo.PedidoCliente;
public interface PedidoClienteDAO extends DAO<PedidoCliente, Long>{
}
|
Python | UTF-8 | 1,071 | 3.75 | 4 | [] | no_license | first_name = input("what is your name?")
print("hi", first_name, "that sounds like a nice name.")
place = input("where are you from?")
print("wow I wish I could visit", place, ", it sounds like a great place")
favorite_number = input("what is your favorite number?")
print("did you know your favorite number divided by m... |
Markdown | UTF-8 | 10,249 | 2.5625 | 3 | [
"MIT"
] | permissive | ## Browser & Mobile detection package for Laravel 4.
***
** If you testing the 1.0.*pre releases check out the new readme on the dev-develop-1 branch.**
***
The packages collects and wrap together the best user-agent identifier packages for Laravel, and uses it's strength.
+ Determine **browser** informations.
+ ... |
Java | UTF-8 | 1,728 | 2.15625 | 2 | [] | no_license | package dto;
// Generated 15/06/2015 12:32:14 PM by Hibernate Tools 4.3.1
import javax.persistence.Column;
import javax.persistence.Embeddable;
/**
* CreditosRemesasId generated by hbm2java
*/
@Embeddable
public class CreditosRemesasId implements java.io.Serializable {
private int remesasIdRemesa;
pri... |
Java | UTF-8 | 619 | 2.59375 | 3 | [] | no_license | package org.peontopia.models;
import java.util.Collections;
import java.util.HashSet;
import java.util.Optional;
import java.util.Set;
/**
* Created by axel on 2016-11-10.
*/
public class Tile implements Tile {
int idx;
Set<Peon> peons;
Optional<Building> building = Optional.empty();
Tile(int idx) {
t... |
Java | UTF-8 | 1,111 | 2.453125 | 2 | [] | no_license | package br.mackenzie.ws;
/**
*
* @author Joaquim Pessôa Filho
*
*/
import io.dropwizard.Application;
import io.dropwizard.Configuration;
import io.dropwizard.assets.AssetsBundle;
import io.dropwizard.setup.Bootstrap;
import io.dropwizard.setup.Environment;
public class RestApp extends Application<Configuration> ... |
Swift | UTF-8 | 8,586 | 2.796875 | 3 | [] | no_license | import SpriteKit
class StartScreen: SKScene, ButtonNodeDelegate, SegmentedControlDelegate {
var highScoreLabel = SKLabelCustom(name: Consts.Names.LabelNames.highScore)
var gameManager = GameManager.shared
override init() {
super.init(size: Consts.Graphics.screenResolution)
create... |
Python | UTF-8 | 1,672 | 3.28125 | 3 | [] | no_license | from __future__ import absolute_import, division, print_function
from collections import defaultdict
def explore(file_name):
'''
:param file_name:
:return:
'''
print(file_name)
seg_dict = defaultdict(int) # segment to count
seg_tags = defaultdict(lambda: defaultdict(int)) # segment to... |
Java | UTF-8 | 612 | 2.015625 | 2 | [] | no_license | package containers;
import jade.core.Profile;
import jade.core.ProfileImpl;
import jade.core.Runtime;
import jade.util.leap.Properties;
import jade.wrapper.AgentContainer;
import jade.wrapper.ControllerException;
public class MyMainContainer {
public static void main(String[] args) throws ControllerException {
Ru... |
C++ | UTF-8 | 646 | 3.046875 | 3 | [
"Apache-2.0"
] | permissive | #ifndef __EVENT_H_
#define __EVENT_H_
#include <fstream>
#include "..\Defs.h"
using namespace std;
class Restaurant; //Forward declation
//The base class for all possible events in the system (abstract class)
class Event
{
protected:
int EventTime; //Timestep when this event takes place
int OrderID; //each event is r... |
PHP | UTF-8 | 2,900 | 2.59375 | 3 | [] | no_license | <?php
class RecommendationsCest
{
public function GetRecommendationsWithLimit(ApiTester $I)
{
$I->am('client');
$I->wantTo("get recommendations - limited count");
$I->haveHttpHeader('Content-Type', 'application/json');
$sku ='LO019EMJGZ27';
$limit = 5;
$I->sendP... |
Python | UTF-8 | 5,324 | 3.640625 | 4 | [] | no_license | #Author: Jashanpreet Singh
#Drexel_ID: js4683
#Lab Section: 66
#Purpose: CS172 Homework 2
#Written on: 04/29/2019
from media import Movie, Song, Picture #to import our classes
#dictionary with objects of each class and sorted by the type of object
media = {
'Movies': [
Movie('Movie', 'Batman: The Dark Kni... |
Markdown | UTF-8 | 791 | 3.546875 | 4 | [] | no_license | ## 함수
함수(function)란 하나의 로직을 재실행 할 수 있도록 하는 것으로 코드의 재사용성을 눂여준다.
function 함수명([인자...[,인자]]) {
코드내용
return 반환값
}
1. 함수의 출력
- 출력은 return 이라는 기호를 쓴다.
2. 함수의 입력
- 취지에 따라 출력 값이 달라져야 한다.
```
<script>
//arg는 매개변수, 영어로 parameter
function get_argument(arg) {
return arg*1000;
}
//인자, argument
... |
Swift | UTF-8 | 9,240 | 2.546875 | 3 | [] | no_license | //
// NamesTableViewController.swift
// CoreDataTuto
//
// Created by Mrabti Idriss on 03.12.17.
// Copyright © 2017 Mrabti Idriss. All rights reserved.
//
import UIKit
import CoreData
import SwiftRecord
class ContactsTableViewController: UITableViewController {
var contacts: [[Contact]] = []
var contactS... |
Java | UTF-8 | 2,092 | 2.109375 | 2 | [] | no_license | package com.handsome.projectnz.View.Home.MaterialHandling;
import android.content.Intent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import com.handsome.module_engine.E.BaseTemplate.BaseActivity;
import com.handsome.projectnz.Adapter.Home.MaterialHandling.MaterialIORe... |
Markdown | UTF-8 | 974 | 2.875 | 3 | [] | no_license | # Udacity Restaurant Reviews App
This is the fifth project of Udacity Front-End NanoDegree Programm.
## Project Overview
For the Restaurant Reviews projects, you will incrementally convert a static webpage to a mobile-ready web application.
In Stage One, you will take a static design that lacks accessibility and co... |
Shell | UTF-8 | 168 | 2.796875 | 3 | [] | no_license | #!/bin/bash
if [[ ! $(who) && ! $(netstat -natp | grep -e 3389.*ESTABLISHED) ]]; then
echo "This client is currently not used and will be shut down now."
poweroff
fi
|
Java | UTF-8 | 3,619 | 1.890625 | 2 | [] | no_license | package org.onebusaway.nyc.webapp.actions.admin;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.interceptor.validation.SkipValidation;
import org.onebusaway.users.model.User;
import org.onebusaway.us... |
JavaScript | UTF-8 | 2,894 | 2.96875 | 3 | [] | no_license | mainModule.factory('defaultFactory', function($http) {
var factory = {};
var users = [];
factory.getActivity = function(loc) {
return $http.get("http://terminal2.expedia.com/x/activities/search?location="+ loc +"&apikey=KvTSobGaExiwiazfRdtoMYpNaRhBk2E9")
.then(function(returned_data_from_server){
// consol... |
Python | UTF-8 | 343 | 3.34375 | 3 | [] | no_license | def f(S):
res = [1]
cnt = 1
for i in range(1, len(S)):
if S[i] > S[i-1]:
cnt += 1
else:
cnt = 1
res.append(cnt)
return ' '.join([str(x) for x in res])
T = int(input())
for t in range(1, T + 1):
N = int(input())
S = input()
res = f(S)
prin... |
Java | UTF-8 | 2,619 | 3.140625 | 3 | [] | no_license | package com.meng.juc;
import org.junit.Test;
import java.util.concurrent.*;
public class testxianhaolaing {
/*
* dountwatchdown test
*
* */
@Test
public void test1() throws InterruptedException {
CountDownLatch countDownLatch = new CountDownLatch(3);
/*所有线程都运行完成才继续主线程*/
... |
Python | UTF-8 | 235 | 3.3125 | 3 | [] | no_license | def iterate(iterable):
while True:
for i in iterable:
yield i
def cycle(iterable):
for i in iterate(iterable):
print(i)
def main():
cycle(range(0, 5))
if __name__ == '__main__':
main()
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.