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
Ruby
UTF-8
646
2.5625
3
[ "MIT" ]
permissive
require "strategy" module AuthStrategies class Manager def initialize(app, &block) @app = app @auth_strategies = StrategyManager.new instance_eval(&block) if block_given? end def register(name, &block) @auth_strategies.register name, &block end def authenticate @a...
C++
UTF-8
701
2.625
3
[]
no_license
#include "stdafx.h" #include "CppUnitTest.h" #include "../PQ12/FileReader.h" using namespace Microsoft::VisualStudio::CppUnitTestFramework; namespace PQ1_UT { TEST_CLASS(FileReaderTest) { public: TEST_METHOD(read_file_content_test) { FileReader fr; std::vector<int> nums; std::string path = "..\\g...
Java
UTF-8
1,436
2.15625
2
[]
no_license
package com.example.service; import com.example.client.BookClient; import com.example.pojo.Book; import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.web.client.Res...
Python
UTF-8
730
3.53125
4
[]
no_license
import random A = { 1:"Rock", 2:"Scissors", 3:"Paper" } c = 0 u = 0 while True: choose = random.randint(1,3) computer = A[choose] print("------------------------\nComputer; {} User; {}\n------------------------".format(c,u)) user = A[int(input("1-Rock 2-Scissors 3-Paper\n;"))] print("Co...
Ruby
UTF-8
11,716
2.578125
3
[]
no_license
require "spec_helper" module InMemory describe LogTimeRepo do before(:each) do @file_wrapper = double @json_store = JsonStore.new(@file_wrapper) data = { "employees": [ { "id": 1, "username": "defaultadmin", "adm...
C++
UTF-8
2,603
3.59375
4
[]
no_license
#include <bits/stdc++.h> using namespace std; bool isoperator(char ch); bool isoperand(char ch); bool ishigh(char ch1, char ch2); bool isopen(char ch); bool isclose(char ch); int getWeight(char ch); int evaluate(string exp); int operation(char op, int a, int b); string intopost(string exp); int main(){ int result; ...
Java
UTF-8
240
2.5
2
[]
no_license
package mine.free.test; public class Test { int a = 0; int b = 0; public static void main(String[] args) throws Exception { final Test t = new Test(); t.a = 1; t.b = 2; System.out.println(t.a); System.out.println(t.b); } }
SQL
UTF-8
2,257
3
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.5.1 -- http://www.phpmyadmin.net -- -- Host: 127.0.0.1 -- Generation Time: Apr 22, 2018 at 10:33 PM -- Server version: 10.1.13-MariaDB -- PHP Version: 7.0.8 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLI...
Java
UTF-8
551
2.921875
3
[]
no_license
package linkedStack; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Employee a =new Employee("a", 1); Employee b =new Employee("b", 2); Employee c =new Employee("c", 3); Employee d =new Employee("d", 4); Employee e =new Employee("e", 5); E...
Java
UTF-8
923
3.109375
3
[]
no_license
package Kattis.com; import java.util.Scanner; public class Trik { public static void main(String args[]){ Scanner sc=new Scanner(System.in); String str=sc.nextLine(); char [] position={'A','B','C'}; for(int i=0;i<str.length();i++){ if(str.charAt(i)=='A'){ ...
JavaScript
UTF-8
1,420
2.59375
3
[]
no_license
import { FETCH_FRIENDS_FAIL, FETCH_FRIENDS_START, FETCH_FRIENDS_SUCCESS, LOGIN_SUCCESS, LOGIN_FAIL, POST_FRIEND_START, POST_FRIEND_SUCCESS, POST_FRIEND_FAIL, DELE_FRIEND_START, DELETE_FRIEND_SUCCESS, DELETE_FRIEND_FAIL } from '../actions'; const initialState = { friends: [], isLoading: false, error: '' }...
Ruby
UTF-8
1,555
3.5
4
[]
no_license
# Author:: Mara von Kroge, Emilie Schuller # 27.11.2017 # TeamChallenger # Tests zur Klasse Stack # Dateien werden angefordert. require 'test/unit' require_relative 'stack_exceptions' # Testklasse wird erstellt. class TestStack < Test::Unit::TestCase # Neues Array wird erstellt. def setup() @stack=Stack.new end...
C++
UTF-8
5,137
2.8125
3
[]
no_license
#pragma once #ifndef Grid2D_H_758B1030_6F18_46B7_9EA5_9E7974186B6E #define Grid2D_H_758B1030_6F18_46B7_9EA5_9E7974186B6E #include <cassert> #include "Math/TVector2.h" #include "CppVersion.h" template< class T > class MappingPolicy { T& getData( T* storage , int sx , int sy , int i , int j ); T const& getData(...
C++
UTF-8
2,857
2.59375
3
[]
no_license
#ifndef __PVX_ENCODE_H__ #define __PVX_ENCODE_H__ #include<vector> #include<string> #include<array> #include<type_traits> #include<string_view> namespace PVX{ namespace Encode{ std::string ToString(const std::vector<unsigned char> & data); std::string ToString(const std::wstring & data); std::wstring ToString(...
Python
UTF-8
1,426
3.09375
3
[]
no_license
from enum import Enum class StructuredViewBase(object): """The base class for lazy views on numpy structured arrays.""" def __init__(self, arr, slice, lazy=None): self.arr = arr self.slice = slice self.lazy = lazy def create_view(cls_name, fields, lazy=True): """Returns a lazy vi...
Ruby
UTF-8
2,032
2.96875
3
[]
no_license
require 'mandrill' class EmailNotifier MANDRILL_SUCCESS_STATUSES = ['sent', 'queued', 'scheduled'] def initialize(user) @user = user end def send(remembrance) begin mandrill = Mandrill::API.new response = mandrill.messages.send build_message(remembrance) log_response(response) r...
Shell
UTF-8
1,230
2.859375
3
[]
no_license
# Maintainer: lorim <lorimz AT gmail DOT com> # Contributor: damir <damir@archlinux.org> # Contributor: Kevin Edmonds <edmondskevin@hotmail.com> pkgname=libmtp-cvs pkgver=20101126 pkgrel=1 pkgdesc="library implementation of the Media Transfer Protocol -- CVS build" arch=("i686" "x86_64") url="http://libmtp.sourceforge...
Markdown
UTF-8
21,312
3.140625
3
[ "MIT" ]
permissive
# rebenchmark [![npm](https://img.shields.io/npm/v/rebenchmark.svg)](https://www.npmjs.com/package/rebenchmark) [Benchmark.js](https://benchmarkjs.com) runner for [Node.js](https://nodejs.org) and browsers with BDD interface (like [Mocha](https://mochajs.org/)). [Online Playground](https://jsfiddle.net/evg656e/hz4co...
Python
UTF-8
4,525
2.859375
3
[]
no_license
import chess import chess.pgn from sklearn.metrics import r2_score from sklearn.metrics import mean_squared_error import numpy as np import time import numpy as np import matplotlib.pyplot as plt plt.style.use('seaborn-deep') import json TRAIN_FILE = 'data/std_train_big.clean.pgn' TEST_FILE = 'data/std_june.clean.pgn...
Java
UTF-8
1,015
1.59375
2
[]
no_license
package com.hxgis.util; import com.hxgis.timer.ParseGrbFileService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.HashMap; import java.util.Map; /** * Creat...
Java
UTF-8
646
3.625
4
[]
no_license
public class SortedMatrix { public void search(int[][] matrix, int n, int key) { int i=0; int j=n-1; while(i<n && j>=0) { if(matrix[i][j] == key) { System.out.println(key + " found at " + i+","+j); return; } if(matrix[i][j]>key) { j--; } else { i++; } } System.ou...
Java
UTF-8
908
1.914063
2
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
permissive
/** * (c) 2014 by Christian Schenk **/ package de.schenk.jrtrace.enginex.testclasses; import de.schenk.jrtrace.annotations.XClass; import de.schenk.jrtrace.annotations.XClassLoaderPolicy; import de.schenk.jrtrace.annotations.XInvokeReturn; import de.schenk.jrtrace.annotations.XInvokeThis; import de.schenk.j...
Java
UTF-8
1,355
3.375
3
[]
no_license
package mypackage; import javax.sound.midi.Soundbank; public class Metods { public static void main(String[] args) { int a = 3; int b = 10; int sum; sum = getSum(a,b); System.out.println(sum); sum = getSum(32342,32423); System.out.println(sum); ...
JavaScript
UTF-8
1,556
3.765625
4
[]
no_license
// write standalone functions implementing bubble sort for arrays function arrayBubbleSort(arr){ // pass in the array to be sorted var len = arr.length; // store the length of the array in a variable to use later var temp; // declare the temp variable that we'll use inside our sorting algorithm while(len != 0){ // ...
Markdown
UTF-8
4,783
3.5625
4
[]
no_license
--- title: "Python Text Adveture: Part 2" kind: activity --- ### User 2 - Add a `current` read-only [`property`][property] to `World` that returns the current Room object. - rename the instance variable `self.current` to `self._current`. The underscore is a message to the programmer that this variable shoul...
Markdown
UTF-8
20,404
2.71875
3
[ "Apache-2.0", "CC0-1.0" ]
permissive
--- linkTitle: Enabling the Terraform Integration Stage title: Enabling the Terraform Integration Stage in the Armory Platform aliases: - /spinnaker/terraform_integration/ - /spinnaker/terraform-configure-integration/ - /docs/spinnaker/terraform-enable-integration/ description: > Learn how to configure the Terr...
Markdown
UTF-8
6,266
4.1875
4
[]
no_license
# 运算 ## 一、赋值运算符(=) - 赋值运算符为变量分配一个值。 ```c++ x = 5; ``` ## 二、算数运算符 ( +, -, *, /, % ) ```c++ x = 1 + 1; x = 1 - 1; x = 1 * 1; x = 1 / 1; x = 1 % 1; ``` ## 三、 复合赋值(+=,-=,* =,/=,%=,>>=,<<=,&=,^=,|=) - 复合赋值运算符通过对其执行操作来修改变量的当前值 ```c++ x += 2; x -= 2; x /= 2; x *= 2; x %= 2; x >>= ...
Java
UTF-8
3,884
2.796875
3
[]
no_license
public class RestaurantLogistics extends Restaurants { private String entreeOne; private String entreeTwo; private String entreeThree; private String drinkOne; private String drinkTwo; private String sideOne; private String sideTwo; private int entreeOnePrice; private int entreeTwo...
PHP
UTF-8
1,401
2.75
3
[]
no_license
<?php namespace Tests\DeeToo\Essentials\Laravel\Eloquent\Types; use DateTime; use DeeToo\Essentials\Laravel\Eloquent\Types\DateTimeType; use Tests\TestCase; /** * Class DateTimeTypeTest * * @package Tests\DeeToo\Essentials\Laravel\Eloquent\Types */ class DateTimeTypeTest extends TestCase { public function te...
C++
UTF-8
1,155
2.90625
3
[]
no_license
#include "UI.h" #include "Game.h" UI::UI(Game* game) { this->game = game; } void UI::Draw() { olc::vf2d healthBarPosition = {60, 8}; olc::vf2d healthBarSize = { static_cast<float>(game->ScreenWidth() - 70) * (game->GetPlayerHealth() / 100), 10.0f }; game->DrawString({10, 1...
Java
UTF-8
1,259
3.140625
3
[]
no_license
package com.kodilla.good.patterns.challenges.food2Door; import java.util.HashMap; import java.util.Map; public class HealthyShop implements Producent{ private ProductsAvaliablity productsAvaliablity = new ProductsAvaliablity(); private Map<String, Integer> listOfProducts = new HashMap<>(); @Override ...
Python
UTF-8
6,398
2.921875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sun Sep 18 19:10:41 2016 @author: mamid """ import numpy as np import pandas as pd import matplotlib.pyplot as plt import math as math import pylab as pl def compute_error_for_graph_given_points(thetha1,x,y): totalError = 0 max_x=np.amax(x) min_x=np.am...
Markdown
UTF-8
1,694
2.6875
3
[]
no_license
# Comentario Lectura 1-2 En este árticulo el autor nos muestra su camino lógico seguido para la creación de un algoritmo recomendador enfocado en la particiáción del Netflix Prize, nos va dando diferentes pasos y cambios que realizó en el diseño durante su desarrollo explicando el porqué de cada paso. Mi primera crít...
Java
UTF-8
3,286
2.125
2
[]
no_license
package com.example.seastec.forumtec; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import andro...
Java
UTF-8
2,452
2.984375
3
[]
no_license
package BackEnd.Graph; import BackEnd.Geometry.Node.Node; import BackEnd.Geometry.Node.NodeType; import BackEnd.Geometry.Point2D; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import java.util.ArrayList; import java.util.List; import static org.junit.jupiter.api.Assertions.assertEquals;...
Java
UTF-8
6,817
2.078125
2
[]
no_license
package papa.dao; import java.sql.Connection; import java.sql.Date; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Timestamp; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import de.ifdag.log.Log; import...
Java
UTF-8
1,203
3.078125
3
[]
no_license
package jTensor; public abstract class TensorOperation{ // Executes operation, derivative inputs should come after output gradient public abstract void execute(Tensor outputTensor, Tensor... inputs); // Gives tensor output dimensions given array of input dimensions (by default identity) // returns null if illeg...
Java
UTF-8
550
1.859375
2
[ "Apache-2.0" ]
permissive
package biz.netcentric.nclabs.groovyconsole.groovy.impl.extension; import biz.netcentric.nclabs.groovyconsole.ScriptExecutionContext; import groovy.lang.Binding; /** * Provides access to object and variable {@link Binding}s * * @author thomas.hartmann@netcentric.biz * @since 11/2015 */ public interface BindingEx...
C
UTF-8
689
2.765625
3
[]
no_license
#include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <math.h> #include <string.h> #define MAX 10000 int gcd(int i, int j) { if(i%j==0) return j; else return gcd(j, i%j); } int main() { #ifndef ONLINE_JUDGE freopen("filename.txt", "r", stdin); #endif //freopen("test.txt", "r...
Python
UTF-8
2,868
3.390625
3
[ "MIT" ]
permissive
class Node: value: str = None def __init__(self, value: str): self.value = value def __repr__(self) -> str: return self.value class Graph: edges: dict = dict() def addChild(self, parent: Node, child: Node, weight=1) -> None: self.edges[(parent, child)] = weight def ...
TypeScript
UTF-8
1,216
2.875
3
[]
no_license
// Types import { IChatData } from "interfaces"; /** Definitions */ const UNITS_IN_MILLISECONDS = { day: 86400000, hour: 3600000, minute: 60000, second: 1000 }; /** Utils */ export const setPeriod = (hour: number, minute: number, second: number) => { if (process.browser) { const now = new Date().getTime(); ...
Python
UTF-8
1,788
2.59375
3
[]
no_license
from morbid import StompFactory from twisted.protocols import basic from twisted.internet import reactor, protocol from twisted.internet.task import LoopingCall from stompservice import StompClientFactory import simplejson as json class MyReceiver(basic.LineReceiver): delimiter = '\0' def connectionMade(self)...
C++
UTF-8
290
2.515625
3
[]
no_license
class Solution { public: int numSub(string s) { int ans=0; int length=0; for(auto i:s){ if(i=='1'){ length++; ans=(ans+length)%1000000007; } else length=0; } return ans; } };
Java
UTF-8
2,315
1.765625
2
[]
no_license
/* * Decompiled with CFR 0.151. * * Could not load the following classes: * android.content.Context */ package com.huawei.hms.hatool; import android.content.Context; import com.huawei.hms.hatool.i; import com.huawei.hms.hatool.l; import com.huawei.hms.hatool.q0; import com.huawei.hms.hatool.x0; import com.huawe...
Java
UTF-8
5,208
2.109375
2
[]
no_license
package com.bishe.aapay.view; import java.util.Date; import java.util.List; import com.bishe.aapay.activity.ConsumeActivity.TimeSelecror; import com.bishe.aapay.activity.R; import com.bishe.aapay.dao.ConsumptionDao; import com.bishe.aapay.dto.Consumption; import com.bishe.aapay.util.AApayDateUtil; import ...
Java
UTF-8
1,325
3.1875
3
[]
no_license
/* * Copyright(c) snowpic.cn 2019-2019.All rights reserved. */ package cn.snowpic.year_2020.month_01.month_01.day_14; import org.junit.Test; import java.util.Arrays; import java.util.HashSet; import java.util.Set; public class GenericTest { /** * test1 * * @author lf * @time 2020-01-14 22...
C#
UTF-8
1,136
3.203125
3
[ "MIT" ]
permissive
namespace NinjaAssassins.Models.Cards { using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; public class Fight : Card { public Fight(string filePath, int rank, int priority) : base(filePath, rank, CardType....
Shell
UTF-8
380
2.625
3
[ "MIT" ]
permissive
#!/bin/bash -ex source $HOME/miniconda/etc/profile.d/conda.sh conda activate test if [ "$USE_CONDA" = "Yes" ]; then # There are no conda packages for PySide2 exit 0 else pip uninstall -q -y pyqt5 sip # Simple solution to avoid failures with the # Qt3D modules pip install -q pyside2==5.12.3 fi ...
Python
UTF-8
5,663
2.625
3
[]
no_license
#!/usr/bin/env python ''' car detection using haar cascades USAGE: facedetect.py [--cascade <cascade_fn>] [--nested-cascade <cascade_fn>] [<video_source>] ''' # Python 2/3 compatibility from __future__ import print_function import numpy as np import cv2 as cv # local modules #from video import ...
C++
UTF-8
929
3.078125
3
[]
no_license
#ifndef __PROJECTILE_H__ #define __PROJECTILE_H__ #include "util/game_util.h" #include "util/texture2d.h" class Projectile { private: Texture2D *m_texture; Vector2 m_position; Rect m_viewport; bool m_active; int m_damage; float m_projectileMoveSpeed; public: ...
C++
UTF-8
3,075
2.71875
3
[]
no_license
#include "SettingState.hpp" #include <cstdint> #include <functional> #include "Utility.hpp" void SettingState::addButtonLabel(Player::Action action, float y, std::string text, State::Context context) { mBindingButtons[action] = std::make_shared<GUI::Button> ( context ); mBindingButtons[action]->setText(text); ...
Java
UTF-8
12,452
1.617188
2
[ "Apache-2.0" ]
permissive
/* * Copyright © 2020 photowey (photowey@gmail.com) * * 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 applicabl...
Java
UTF-8
660
2.859375
3
[]
no_license
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.List; public class ReadCSV1 { public static void main(String ... krishna) throws IOException { try { BufferedReader reader = new BufferedReader(new FileReader(System.getProperty("use...
Java
UTF-8
6,345
2.234375
2
[]
no_license
package log.nginx; import com.alibaba.fastjson.JSON; import com.opencsv.bean.CsvToBeanBuilder; import log.nginx.beans.DataInRequests; import log.nginx.beans.GoaccessRoot; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import java.io.FileInputStream; import java.io.FileNotFoundExcep...
Python
UTF-8
512
3.125
3
[ "MIT" ]
permissive
#!/usr/bin/env python # -*- coding:UTF-8 -*- import threading import time event=threading.Event() def func(): #等待事件,进入等待阻塞状态 print'%s wait for event...'%threading.currentThread().getName() event.wait() #收到事件后进入运行状态 print'%s recv event.'% threading.currentThread().getName() t1=threading.Thread(t...
C
UTF-8
2,761
3.03125
3
[]
no_license
/*----------------------------------------------------------------------------- | File: com.h | | Implements funktionality for converting incoming byte data into | command structure and vice versa | | Note: - |------------------------------------------------------------------------------ | Datatypes: | com_command...
Java
UTF-8
10,249
2.546875
3
[]
no_license
package GUI; import javax.swing.*; import java.awt.*; import java.awt.event.*; public class DonationReport extends JFrame { private JPanel p1 , DonationReportHeader , DonationReport; private JLabel l1 , DonationReportTitle , DonationReportImage; private JButton[] b ,buDonationR; private J...
Java
UTF-8
10,872
1.679688
2
[ "Apache-2.0" ]
permissive
/*- * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =============================================================...
Java
UTF-8
2,847
1.828125
2
[ "Apache-2.0" ]
permissive
/* * Licensed to Elasticsearch B.V. under one or more contributor * license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright * ownership. Elasticsearch B.V. licenses this file to you under * the Apache License, Version 2.0 (the "License"); you may * not u...
C
UTF-8
2,085
2.9375
3
[]
no_license
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_treat_pointer.c :+: :+: :+: ...
Java
UTF-8
808
2.609375
3
[ "MIT" ]
permissive
package guitests.guihandles; import javafx.scene.Node; import javafx.scene.text.Text; import javafx.scene.text.TextFlow; /** * A handler for the {@code ResultDisplay} of the UI */ public class ResultDisplayHandle extends NodeHandle<TextFlow> { public static final String RESULT_DISPLAY_ID = "#resultDisplay"; ...
C#
UTF-8
6,757
3.0625
3
[]
no_license
using System; namespace w5d4m2 { class Program { static void Main(string[] args) { string de6 = "d6"; string twoD6 = "2d6"; string d6Plus4 = "d6+4"; string twoD6plus4 = "2d6+4"; string thirtyFour = "34"; string...
Java
UTF-8
580
2.046875
2
[]
no_license
package com.sujya.prj.auth.common; import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Data; import lombok.Setter; import org.springframework.security.core.GrantedAuthority; import java.util.List; @Data @AllArgsConstructor public class UserContext { @Setter(AccessLevel.NONE) private f...
Java
UTF-8
1,367
1.945313
2
[]
no_license
package com.jornada.client.service; import java.util.ArrayList; import java.util.Date; import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.rpc.RemoteService; import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; import com.jornada.shared.classes.Clientes; import com.jornada.shared.clas...
Markdown
UTF-8
7,321
2.671875
3
[ "MIT" ]
permissive
## Character Generator This is an app that can generate a Dungeons and Dragons-like character. ### Technologies It uses Angular as its client-side framework and BootstrapJS as its CSS library. It also utilizes Laravel, a PHP framework, and lo-dash for array utilities. #### Composer Packages * [Ardent](https://github.co...
Markdown
UTF-8
4,221
3.046875
3
[]
no_license
--- layout: post title: "UIWebView与Javascript交互" date: 2015-12-18 17:12:21 +0800 comments: true categories: --- > 现在越来越多的App使用H5页面作为App的一部分,尤其是一些运营的需求,需要快速上线下线,只能通过网页前端完成。那么网页前端与原生App的交互就显得尤为重要。 ### 原生对网页的调用 iOS原生App对网页前端的调用非常简单,只需要使用 ```objc - (nullable NSString *)stringByEvaluatingJavaScriptFromString:(NSString ...
TypeScript
UTF-8
3,392
2.90625
3
[]
no_license
import * as THREE from 'three'; import RubikModel from './model'; export default class Sprite { private length: number private canvas: HTMLCanvasElement private context: CanvasRenderingContext2D private textures: THREE.Texture[] private cellLength!: number public constructor(length: number) { this...
Markdown
UTF-8
838
2.921875
3
[ "MIT" ]
permissive
--- date: "2022-10-23T20:09:22.405Z" title: "Let's talk about web components (by Brad Frost)" description: "Fantastic rallying cry by Brad Frost" tags: [link, progressiveenhancement, webcomponents] linkTarget: "https://bradfrost.com/blog/post/lets-talk-about-web-components/" --- Brad breaks down the good, bad and ugly ...
JavaScript
UTF-8
11,362
3
3
[]
no_license
console.log("Snake game project"); alert("Welcome to snake game!"); let cnv = document.getElementById('gameCanvas'), ctx = cnv.getContext('2d'), segmentLength = 10, startingSegments = 20, spawn = { x: 0, y:cnv.height/2 }, snakeSpeed = 5, maxApples = 5, appleLife = 500, segmentsPerApple...
Markdown
UTF-8
31,236
3
3
[ "MIT" ]
permissive
# Lab: Add the Notes Feature In this lab, we will take what we have learned so far and add a whole new feature to our application. Specifically, we will add the "Tasting Notes" feature. In addition to exercising some skills we have already learned such as creating models, services, components, and pages, we will also ...
Shell
UTF-8
715
3.03125
3
[]
no_license
#!/usr/bin/zsh while read name mark junk do email=$( dcu-email-address $name) print $name $mark $email { cat <<EOF Your CA116 lab exam 3 mark is $mark. This mark is out of 100. This mark constitutes a third of your continuous assessment mark for the module, which itself constitutes 60% of your mark ove...
JavaScript
UTF-8
6,376
2.578125
3
[]
no_license
import React from 'react'; import axios from 'axios'; class Stock extends React.Component { constructor(props) { super(props) this.onChangeBuyingStock = this.onChangeBuyingStock.bind(this); this.onSubmit = this.onSubmit.bind(this); this.onAmountChange = this.onAmountChange.bind(thi...
Markdown
UTF-8
2,031
2.9375
3
[]
no_license
# Hilfsfunktionen für Contao ## Entwickler ## **Frank Hoppe** ## Simple PHP Cache für Contao ### Information ### Die Cache-Klasse ist eine Anpassung für Contao. Sie basiert auf [Simple PHP Cache](https://github.com/cosenary/Simple-PHP-Cache). ### Installation ### Falls die Klasse in einer Erweiterung angewendet ...
Java
UTF-8
2,010
3.546875
4
[]
no_license
package amm; public class BST implements BinarySearchTree { static class Node implements BinarySearchTree.Node { private int value; private Node left, right; Node(int value) { this.value = value; left = right = null; } @Override public int ...
C#
UTF-8
501
3.21875
3
[ "MIT" ]
permissive
using System; using System.Collections.Generic; using System.Globalization; using System.Text; namespace System { public static partial class Extensions { public static bool IsBetween(this DateTime @this, DateTime minValue, DateTime maxValue) { return minValue.CompareTo(@this)==-1&&@this.CompareTo(maxValue)=...
Python
UTF-8
1,563
2.609375
3
[]
no_license
import matplotlib.pyplot as plt from matplotlib import style import numpy as np import pandas as pd style.use('ggplot') # x,y = np.loadtxt('fitbitodu-export.csv',unpack=True,delimiter=',') #plt.plot(x,y) #plt.bar(x,y) #plt.show() df = pd.read_csv('a_data1.csv') df["|"] = df["|"].apply(lambda x: x....
C#
UTF-8
3,169
2.78125
3
[]
no_license
using Riafco.Entity.Dataflex.Pro.Ressources; using Riafco.Service.Dataflex.Pro.Ressources.Data; using System.Collections.Generic; using System.Linq; namespace Riafco.Service.Dataflex.Pro.Ressources.Assembler { /// <summary> /// The PublicationTheme assembler class. /// </summary> public static class Pu...
C#
UTF-8
3,870
3.296875
3
[ "MIT" ]
permissive
using System; using System.Collections; using System.Collections.Generic; namespace ZeroLevel.HNSW.Services { /// <summary> /// Min element always on top /// </summary> public class MinHeap : IEnumerable<(int, float)> { private readonly List<(int, float)> _elements; public...
Python
UTF-8
63
3.046875
3
[]
no_license
myStr = "hello world" #print(dir(myStr)) print(myStr.title())
Java
UTF-8
568
2.984375
3
[]
no_license
package com.xzw.shuai.patterns.type.create.factory.abstractfactory; /** * @author DELL */ public class Client { public static void main(String[] args) { // 创建意大利风味甜品工厂 ItalyDessertFactory factory = new ItalyDessertFactory(); AmericanDessertFactory americanDessertFactory = new AmericanD...
Java
UTF-8
4,178
2.90625
3
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer", "BSD-3-Clause" ]
permissive
package nl.tno.stormcv.batcher; import java.util.ArrayList; import java.util.List; import java.util.Map; import nl.tno.stormcv.bolt.BatchInputBolt.History; import nl.tno.stormcv.model.CVParticle; /** * A {@link IBatcher} implementation that partitions a set of {@link CVParticle} * items into zero or more ...
Shell
UTF-8
730
3.46875
3
[]
no_license
#!/bin/bash # Author: Rajat Sachdeva # Date Created: 22/06/2019 # Description: This script will add system inventory to database file # Date Modified: 22/06/2019 clear echo echo printing database cat database echo echo Please enter host-name: read host echo # quietly grep grep -q $host ./database if [ $? -eq 0 ...
Java
UTF-8
280
2.34375
2
[]
no_license
package Example1; // Интерфейс DisplayElement содержит всего один метод display(), // который вызывается для отображения визуального элемента public interface DisplayElement { void display(); }
Java
UTF-8
386
2.109375
2
[]
no_license
package dbg.electronics.robodrv.mcu; public enum AdcChannel implements CodifierAware { POWER_VOLTAGE(0), POWER_CURRENT(1), MCU_VOLTAGE(2), POSITION(3); AdcChannel(int code) { this.code = code; } public int getCode() { return code; } private int code; @Overri...
Python
UTF-8
8,663
3.140625
3
[]
no_license
import csv import numpy import scipy import matplotlib.pyplot as plt import seaborn from sklearn import preprocessing from sklearn import neighbors from sklearn.cross_validation import train_test_split from sklearn import metrics import knnplots from sklearn.naive_bayes import GaussianNB from sklearn import cross_va...
Java
UTF-8
2,470
2.921875
3
[]
no_license
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; public class Lottery { public static void main(String[] args) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(in.readLine()); f...
JavaScript
UTF-8
3,794
3.140625
3
[]
no_license
/* --- SETUP VIEW --- This view fills the content section of the page with setup-related fields. Once the user starts the game, it will create a gametype object (currently only one exists) and attempt to start it. If it succeeds, this view creates a game-view and then destroys itself. If not, an error is displayed. ...
Java
UTF-8
669
1.71875
2
[]
no_license
package com.czz.hwy.dao.mission.impl.app; import org.mybatis.spring.SqlSessionTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import com.czz.hwy.base.BaseDaoImpl; import com.czz.hwy.bean.mission.app.ReportDutyApp; import com.czz.hwy.dao.missio...
Markdown
UTF-8
751
2.59375
3
[ "MIT" ]
permissive
## Difference between PFN and PFN-nested In PFN-nested, we use two RE units for head-to-head and tail-to-tail prediction. There is only one RE unit in PFN model and it's for head-to-head prediction. ## Design Choice The head-to-head RE unit takes relation feature as the main feature, shared feature as auxiliary featur...
Python
UTF-8
858
3.90625
4
[]
no_license
# Say you have an array for which the ith element is the price of a given stock on day i. # # If you were only permitted to complete at most one transaction (i.e., buy one and sell one share # of the stock), design an algorithm to find the maximum profit. # # Note that you cannot sell a stock before you buy one. ...
Java
UTF-8
1,190
2.328125
2
[]
no_license
package com.tangshengbo.service; /** * Created by Tangshengbo on 2017/10/30. * 全局异常处理,捕获所有Controller中抛出的异常 */ import com.tangshengbo.core.ResponseGenerator; import com.tangshengbo.core.ResponseMessage; import com.tangshengbo.exception.ServiceException; import org.apache.commons.lang3.exception.ExceptionUtils; imp...
C
UTF-8
837
4.3125
4
[]
no_license
/* Takes an integer input and outputs the number in binary form. Only meant to convert positive integers. */ #include <stdio.h> void printBinary(int decimalNum); void clearKeyboardBuffer(void); int main(int argc, char *argv[]) { int decimalNum; printf("Enter an integer: "); scanf("%d", &decimalNum); ...
Python
UTF-8
568
2.859375
3
[]
no_license
from api.database.db_helper import DBHelper class BaseDao: __db = None def __init__(self): self.__db = DBHelper() def get_users(self): return self.__db.execute_query('SELECT * FROM users') def get_user_by_id(self, id): return self.__db.execute_query(f'SELECT * FROM users WH...
Markdown
UTF-8
3,541
3.25
3
[]
no_license
# Fillactive-Community-App Build a community that reaches out and encourages teenage girls aged 12-17 to change their mindset about physical activity and be able to better their health by staying active and healthy as a long term goal with the help of technology and joining Fillactive ## Fillactive Community App guide...
Python
UTF-8
5,861
2.515625
3
[]
no_license
""" Versioning deployment. Installs the versioning into your (python) project. """ import os, sys import click from flowtool.style import colors, echo, debug from flowtool.files import find_parent_containing, find_subdirs_containing, check_file, append_to_file, make_executable from flowtool.files import cd from flo...
Python
UTF-8
498
3.25
3
[]
no_license
#!/usr/bin/env python from collections import Counter class SummableDict(dict): def __iadd__(self, other): for key, value in other.items(): if key in self: self[key] += value else: self[key] = value return self with open("input") as fd: ...
Python
UTF-8
630
2.5625
3
[]
no_license
from django.db import models # Create your models here. # class Menu(models.Model): # Nonveg = models.CharField(max_length=30) # Veg = models.CharField(max_length=30) # pickles = models.CharField(max_length=35) # price = models.CharField(max_length=5, default="") class NonVeg(models.Model): item = models.CharFiel...
C#
UTF-8
2,306
2.96875
3
[]
no_license
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Model.Models; using Model.Models.Exceptions; namespace Persistencia.Persistence { public class RepositorioTriagem { private static List<Triagem> listaTriagens; static Rep...
C++
UTF-8
1,021
3.03125
3
[]
no_license
#ifndef __BINNINGHELPER_C__ #define __BINNINGHELPER_C__ #include "../../meta/stl.C" struct binningstep { double fMaximum; double fBinsize; }; class binninghelper { public: binninghelper() = default; binninghelper(double minimum, std::vector<binningstep> steps) : fMinimum(minimum), fSteps(steps) {} ...
TypeScript
UTF-8
1,634
2.703125
3
[]
no_license
import { isString, cloneDeep, merge } from 'lodash'; import DC from 'src/types'; import { getConfig } from '../../../config'; export /** * 获取在配置中自定义的图表配置,并支持返回的数据中携带图表配置 * * @param {DC.StaticData} data * @param {DC.ChartConfig} config * @returns {object} */ // eslint-disable-next-line @typescript-eslint/consiste...