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 |
|---|---|---|---|---|---|---|---|
Java | UTF-8 | 222 | 2.890625 | 3 | [] | no_license | package Abstraction;
public abstract class Rajaram {
int age;
public Rajaram(int a) {
age=a;
}
abstract public void nadi();
public void premagopadi() {
System.out.println("Abstraction class ... age "+age);
}
}
|
C++ | UTF-8 | 831 | 3.1875 | 3 | [] | no_license | #pragma once
#include "../constants.h"
#include <iostream>
using namespace std;
struct Movement
{
unsigned type, o1, o2;
};
bool isChangeInitialized(Movement mv)
{
return mv.o1 != 0;
}
string getMovementString(Movement mv)
{
string t = mv.type == SWAP ? "swap" : "shift";
return t + "(" + to_string(... |
Python | UTF-8 | 698 | 3.03125 | 3 | [] | no_license | class Solution(object):
def isIsomorphic(self, s, t):
"""
:type s: str
:type t: str
:rtype: bool
"""
if len(s) != len(t):
return False
scode_dict = dict()
tcode_dict = dict()
for i in range(len(s)):
if ... |
C# | UTF-8 | 1,317 | 3.640625 | 4 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Exam_3_Kung_Fu_Hall
{
class Hall
{
private int RangeOfFights { get; }
public Hall()
{
RangeOfFights = ChooseRangeOfFights();
va... |
Java | UTF-8 | 81 | 1.8125 | 2 | [] | no_license | package mk.p.factory;
public enum CarType {
SEDAN,
CROSSOVER,
VAN
}
|
C# | UTF-8 | 1,696 | 2.734375 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
namespace TestMe.Presentation.API.Middleware
{
/// <summary>
/// Sample showing how to use custom Middleware rather th... |
Python | UTF-8 | 1,772 | 3.390625 | 3 | [] | no_license | from tkinter import *
ventana= Tk()
ventana.geometry("500x500")
ventana.title("Formularios en Tkinter")
#Encabezado
Encabezado=Label(ventana,text="Formularios en TKinter")
Encabezado.config(bg="white",
fg="darkgray",
font=("Open Sans", 18),
padx=10,
... |
TypeScript | UTF-8 | 1,791 | 3 | 3 | [] | no_license | import * as Yup from 'yup';
interface iSignUp {
name: string;
email: string;
password: string;
}
export const validateSignUp = async (
data: iSignUp,
): Promise<boolean | string[]> => {
try {
const schema = Yup.object().shape({
name: Yup.string().required('Nome obrigatório'),
email: Yup.stri... |
Swift | UTF-8 | 2,590 | 2.765625 | 3 | [] | no_license | //
// StampSelectViewDelegate.swift
// Megaphone
//
// Created by 南 京兵 on 2017/08/16.
// Copyright © 2017年 南 京兵. All rights reserved.
//
import UIKit
// MARK: StampSelectViewDelegate
extension NamingViewController: StampSelectViewDelegate {
// スタンプViewの閉じるボタンが押された時
func stampSelectCloseTapped() {
... |
Java | UTF-8 | 538 | 1.671875 | 2 | [] | no_license | package com.ibucks.bucks.beans;
import org.springframework.data.mongodb.core.convert.MongoCustomConversions;
import java.util.List;
/**
* @Description: 扩展springboot自动装配 MongoCustomConversion类
* @Author: shang
* @CreateDate: 2020/3/26 16:29
* @UpdateUser: shang
* @UpdateDate: 2020/3/26 16:29
* @... |
C++ | UTF-8 | 720 | 2.546875 | 3 | [] | no_license | //#include<conio.h>
#include<iostream>
#include<time.h>
#include<graphics.h>
#include<stdlib.h>
using namespace std;
int main(){
int x1,y1,x0,y0; //Declare the points
cout<<"Enter the points";
cin>>x0;
cin>>y0;
cin>>x1;
cin>>y1;
float m;
int gd= DETECT,gm;
initgraph(&... |
Python | UTF-8 | 925 | 3.53125 | 4 | [] | no_license | class Solution:
def myPow(self, x: float, n: int) -> float:
''' method
most common people will use this method
'''
return x ** n
'''
well I guess the LC would like to see us solve it via BINARY SEARCH
m 是 无符号的 n
https://leetcode.com/problems/... |
Java | UTF-8 | 8,877 | 2.015625 | 2 | [] | no_license | package com.console.controller;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.ResourceBundle;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation... |
JavaScript | UTF-8 | 676 | 2.953125 | 3 | [
"MIT"
] | permissive |
const fs = require('fs');
let myText = "";
fs.readFile('1.txt', (err, data) => {
if(err) throw(err);
myText += data;
fs.readFile('2.txt', (err, data) => {
if(err) throw(err);
myText += data;
fs.readFile('3.txt', (err, data) => {
if(err) throw(err);
myText +=... |
C# | UTF-8 | 5,361 | 3.171875 | 3 | [
"Apache-2.0"
] | permissive | using System;
using System.Globalization;
using Newtonsoft.Json;
namespace Ofl.Serialization.Json.Newtonsoft
{
//////////////////////////////////////////////////
///
/// <author>Nicholas Paldino</author>
/// <created>2013-09-07</created>
/// <summary>Handles the conversion of a Unix
/// times... |
Markdown | UTF-8 | 1,256 | 3.5625 | 4 | [] | no_license | # FizzBuzz
The good old FizzBuzz problem 😀
> If a number is a multiple of 3 then convert it to `Fizz`
>
> If a number is a multiple of 5 then convert it to `Buzz`
>
> If a number is a multiple of both 3 and 5 then convert it to `FizzBuzz`
This is a tiny Gradle project that was built using TDD
FizzBuzz conversion ... |
Java | UTF-8 | 350 | 2.03125 | 2 | [] | no_license | package pageUI;
public class BalanceEnquiryPageUI {
public static final String BALANCE_ENQUIRY_TITLE = "//p[text()='Balance Enquiry Form']";
public static final String BALANCE_ENQUIRY_BTN_SUBMIT = "//input[@name='AccSubmit']";
public static final String BALANCE_ENQUIRY_TITLE_SUCCESS = "//p[text()='Balance Deta... |
Markdown | UTF-8 | 3,941 | 2.625 | 3 | [] | no_license | ---
date: 2020-1-29
layout: default
title: dubbo-adaptive
---
# dubbo-adaptive
一个接口有多个实现类,如何在运行时动态决定,注入哪个实现类
## dubbo
通过生成接口的代理类,然后注入代理类,代理类会通过URL参数,决定使用哪个实现类。
注入一个有多个实现类的接口,由注解adaptive的value值决定,把这个value作为一个参数,从URL里找到对应的参数值,将这个参数值作为key,从容器里找到对应实现类的实例
```java
@SPI("impl1")
public interface SimpleExt {
// @Adap... |
C++ | UTF-8 | 1,466 | 3.0625 | 3 | [] | no_license | #include <stdint.h>
#include <stdio.h>
char A[5][5];
char R[4][32] = {"X won", "O won", "Draw", "Game has not completed"};
const int32_t n = 4;
bool Row(int32_t r, char a) {
for (int32_t i = 0; i < n; i++) {
if ((A[r][i] != a && A[r][i] != 'T') || A[r][i] == '.') return false;
}
return true;
}
boo... |
Java | UTF-8 | 5,478 | 2.3125 | 2 | [] | no_license | package modules.controller;
import modules.dao.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import mod... |
C | UTF-8 | 375 | 2.921875 | 3 | [] | no_license | #include <sys/utsname.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc,char **argv)
{
struct utsname buf;
if(uname(&buf))
{
perror("uname");
exit(1);
}
printf("sysname:%s\n",buf.sysname);
printf("nodename:%s\n",buf.nodename);
printf("release:%s\n",buf.release);
printf("version:%s\n",buf.versio... |
C | UTF-8 | 730 | 3.875 | 4 | [] | no_license | /* File : countup.c *
* By : Conner Higashino *
* login: csh3173 *
* team : Solution *
* Date : January 30th, 2017 */
/* A program to count from 1 to 20, one per line */
#include <stdio.h>
int main()
{
int count... |
PHP | UTF-8 | 610 | 3.671875 | 4 | [] | no_license | <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Belajar PHP</title>
</head>
<body>
<?php
if(is_numeric("guru"))
{
echo "true";
}
else
{
echo "false";
} echo "<br>";
if(is_numeric (123))
{
echo "true";
}
else
{
echo "false";
} echo "<br>... |
Markdown | UTF-8 | 21,224 | 2.859375 | 3 | [] | no_license | # Prepare project
## Introduction
In this series of posts, I'm going to show how to set up the CI/CD environment using AWS and CircleCI.
As a final result, we will get the pipeline that:
* runs tests after each commit;
* builds containers from development and master branches;
* pushes them into the ECR;
* redeploys d... |
TypeScript | UTF-8 | 375 | 2.65625 | 3 | [
"MIT"
] | permissive | import { FC } from 'react';
export interface SwitchProps {
/** labels of object (left/right) */
labels?: object
/** Switch size */
size?: 'small' | 'medium' | 'large';
/** color switch*/
color?: 'primary' | 'secondary';
/**function used when switch is on */
onChange?: (e: object) => void;
}
declare ... |
JavaScript | UTF-8 | 2,134 | 4.59375 | 5 | [] | no_license | // 1- Crie uma função construtora para Terreno, cada terreno deve ter:
// largura, comprimento, area(largura x comprimento)
// 2 crie métodos usando o prototype, eles devem ser:
// - calcularPreco -> que vai ser a area x 1000 reais.
// - mostrarInfos -> que mostrar a area e o preço do terreno.
// 3 - Crie 5 instancia... |
Markdown | UTF-8 | 11,054 | 3.65625 | 4 | [
"MIT"
] | permissive | # Ejercicios básicos resueltos en JAVA.
**1.-** Imprima en pantalla la cadena de caracteres "¡Hola, mundo!" .
Ejercicio resuelto --------------------- [SPOILER](https://github.com/acruma/learn/blob/master/spanish/basic/Ejercicios/java.md#ejercicio-1-)
**2.-** Inicializa una variable (crea una variable y dale un ... |
Java | UTF-8 | 373 | 1.5 | 2 | [
"Apache-2.0"
] | permissive | package com.achur.avalon.api;
public class Constants {
public static final String CLIENT_ID =
"865817182348-j6qlb4275uk3ltv3lmpe77voc0062l4h.apps.googleusercontent.com";
public static final String EMAIL_SCOPE = "https://www.googleapis.com/auth/userinfo.email";
public static final String PROFILE_SCOPE = "h... |
Markdown | UTF-8 | 3,585 | 2.515625 | 3 | [] | no_license | # Docker 笔记
> 重新 build 时 `docker build --no-cache ...`
## 跑 8 个版本 PHP-FPM
> 自己打镜像时源换来换去总有东西装不上, 干脆站在巨人肩膀上, 罢了罢了.
> 用这位[同学](https://github.com/chialab/docker-php)打的[镜像](https://hub.docker.com/r/chialab/php).
跑起来
```sh
docker run -d --name php-fpm54 -p 9054:9000 -v /var/www:/var/www chialab/php:5.4-fpm
docker run -d... |
Markdown | UTF-8 | 1,273 | 2.671875 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | # `fugit`
> `fugit` provides a comprehensive library of `Duration` and `Instant` for the handling of time in embedded systems, doing all it can at compile time.
This library is a heavily inspired of `std::chrono`'s `Duration` from C++ which does all it can at compile time.
## Aims
* `no_std` library with goals of u... |
SQL | UTF-8 | 4,391 | 4.1875 | 4 | [] | no_license | CREATE OR REPLACE TEMP TABLE unit_inspections as (
select occ.VHOST,
occ.PROPERTY_ID,
occ.UNIT_ID,
occ.ID as OCCUPANCY_ID,
occ.MOVE_IN,
occ.MOVE_OUT,
lead(occ.move_in)
... |
Markdown | UTF-8 | 2,817 | 2.75 | 3 | [] | no_license | ---
lastUpdated: "03/26/2020"
title: "Parameters Adjusted by the Rules"
description: "The default adaptive rules lua file adjusts parameters in real time based on individual rule sets for each of the ES Ps listed in Section 3 1 Receivers Managed by Adaptive Rules and takes actions based on the specific responses of rec... |
Rust | UTF-8 | 2,223 | 4.40625 | 4 | [] | no_license | // Declares imports
use rand::Rng;
use std::cmp::Ordering;
use std::io;
fn main() {
println!("Guess the number!");
// Generates a number between 1 and 101 (the second parameter is
// non-inclusive)
let secret_number = rand::thread_rng().gen_range(1, 101);
// Creates an infinite loop
loop {
... |
Markdown | UTF-8 | 2,978 | 3.5625 | 4 | [
"MIT"
] | permissive | ---
layout: post
title: "[프로그래머스] 힙(Heap) - Lv.2 - 더 맵게 (Python) / heapq"
author: Yurim Koo
categories:
- Algorithm
tags:
- 알고리즘
- 프로그래머스
- Python
- Algorithm
- Heap
- Heap Sort
- Python heapq
- Heapq
- Heap Queue
- Priority Queue
- 우선순위 큐
- 파이썬 큐
- 파이썬 힙
- 파이썬 힙 큐
- 파이썬 힙 정렬
comments: t... |
C++ | UTF-8 | 800 | 2.53125 | 3 | [] | no_license | #include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
vector<int> qq;
int lower(int x){
for(int i=0;i<qq.size();i++){
if(qq[i]>=x)return i;
}
return qq.size()-1;
}
int main(){
freopen("ans.txt","r",stdin);
int n,q;
int kase=0;
while(scanf("%d%d",&n,&q)!=EOF){
... |
SQL | UTF-8 | 4,405 | 4.03125 | 4 | [] | no_license | -- Comments in SQL Start with dash-dash --
-- Yes, I copied this verbatim after ensuring that I was, in fact, in the right terminal, running the database, had correctly accessed SQL, and that the database had correctly seeded. It is a copy and paste for the sake of testing. But it worked, so I am moving on.
-- 1.) Ad... |
Java | UTF-8 | 5,816 | 2.953125 | 3 | [] | no_license | package cryptography2;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.util.Random;
public class C2 {
int[] stream;
int[][] keyst... |
Python | UTF-8 | 1,683 | 3.078125 | 3 | [] | no_license | import socket
import pickle
from neuralNetwork import NeuralNetwork
from layer import Layer
from activation_layer import ActivationLayer
from activations import relu, relu_derivative, sigmoid, sigmoid_derivative
import numpy as np
class Server:
def __init__(self):
self.server_socket = None
self.cre... |
TypeScript | UTF-8 | 1,080 | 2.890625 | 3 | [] | no_license | import { Request, Response } from 'express';
import { get } from 'lodash';
/**
* Utiltiy object to standardise the response
* @type {{generateMeta: function, success: function, error: function}}
*/
export const responder = {
generateMeta: (req: Request) => ({
url: get(req, 'url'),
method: get(req, 'metho... |
Java | UTF-8 | 16,386 | 1.828125 | 2 | [] | no_license | package hzyj.guangda.student.activity.order;
import org.apache.http.Header;
import com.baidu.location.BDLocation;
import com.baidu.location.BDLocationListener;
import com.baidu.location.LocationClient;
import com.baidu.location.LocationClientOption;
import com.common.library.llj.adapterhelp.BaseAdapterHelper;
import ... |
C# | UTF-8 | 1,126 | 3.625 | 4 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Lists
{
class Lists
{
static void Main(string[] args)
{
//8 2 2 8 2 2 3 7
var number = Console.ReadLine()
.Split(' ')
... |
Java | UTF-8 | 969 | 2.171875 | 2 | [] | no_license | package com.soft.web;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.interceptor.ServletRequestAware;
import com.opensymphony.xwork2.ActionSupport;
import com.soft.dao.StudentDB;
im... |
Markdown | UTF-8 | 592 | 2.640625 | 3 | [] | no_license | # __Owl Find__

What word are you looking for? Owl Find will help look up words you may not know using the Owlbot API-- great for English language learners and those looking for a simpler dictionary experience!
## Features:
-Large, easy-to-use input box
-Spellchecker
-History list t... |
C | UTF-8 | 2,012 | 2.6875 | 3 | [] | no_license | #include "TM1640.h"
void TM1640_init(unsigned char brightness_level)
{
output_high(DIN);
output_high(SCLK);
TM1640_send_command(auto_address);
TM1640_send_command(brightness_level);
TM1640_clear_display();
} ... |
Java | UTF-8 | 2,705 | 2.359375 | 2 | [] | no_license | package com.square.health.util;
import com.square.health.dto.*;
import com.square.health.model.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Converter {
public static Blogger bloggerDtoToBlogger(BloggerDto bloggerDto) {
Blogger blogger = new Blogger();
blogger.setEmail(... |
Java | UTF-8 | 6,539 | 2.34375 | 2 | [] | no_license | package com.twix_agent;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
public class FormLayout_old extends ViewGroup
{
private int MaxWidth = 0;
float[] EffectiveWidths;
private FormCell[][] CellMatrix;
private int[] mHeight;
private int cell_padding_y;
private int... |
Shell | UTF-8 | 4,986 | 3.265625 | 3 | [] | no_license | #!/bin/sh
# Coloured text
GREEN=$'\e[0;32m'
RED=$'\e[0;31m'
NC=$'\e[0m'
if [ -z "${GITHUB_TOKEN}" ]
then
echo "Enter Github token: "
read GITHUB_TOKEN
fi
if [ -z "${TERRAFORM_TOKEN}" ]
then
echo "Enter Terraform Cloud user token: "
read TERRAFORM_TOKEN
fi
if [ -z "${TERRAFORM_ORGANIZATION_NAME}" ]
then
echo... |
Python | UTF-8 | 795 | 3.140625 | 3 | [] | no_license |
class Element:
tag = ''
def __init__(self, *args):
self.content = []
for arg in args:
self.content.append(arg)
def export(self):
result = []
for element in self.content:
result.append(element.export())
result = " ".join(result)
if (s... |
Java | UTF-8 | 1,141 | 2.6875 | 3 | [
"MIT"
] | permissive | package com.antho.newsreader.view.fragments.adapter;
import com.antho.newsreader.model.popular.Popular;
import java.util.List;
import androidx.recyclerview.widget.DiffUtil;
/** Overrides diffUtil methods to improve software performance **/
class PopularDiffCallback extends DiffUtil.Callback
{
private final List<P... |
Java | UTF-8 | 638 | 2.3125 | 2 | [] | no_license | package com.b1610701.tuvantuyensinh.model;
public class DiemChuan {
private float _1;
private float _2;
private float _3;
public DiemChuan(){}
public DiemChuan(float _1, float _2, float _3){
this._1 = _1;
this._2 = _2;
this._3 = _3;
}
public void set_1(float _1){
... |
Ruby | UTF-8 | 1,794 | 3.453125 | 3 | [] | no_license | #!/usr/bin/ruby
require 'getoptlong'
require './lib/markovchain'
def usage
puts "Overview: Reads text from standard input, creates a markov chain"
puts "(n-gram) model, and outputs words based on that model."
puts
puts "Usage:"
puts __FILE__ + " [options...] [beginning [beginning] [...]]"
puts " --... |
Python | UTF-8 | 171 | 2.8125 | 3 | [] | no_license | from Associator import *
a = Associator(10)
a.put("cat", "Katze")
a.put("mum", "Mutter")
a.put("mat", "Matte")
a.put("nuts", "Nuss")
a.put("house", "Haus")
a.print()
|
Python | UTF-8 | 11,167 | 2.546875 | 3 | [
"MIT"
] | permissive | import numpy as np
import matplotlib.pyplot as plt
from skimage import morphology, transform
from skimage.measure import label
from scipy import ndimage
from scipy.signal import convolve
def resize_and_get_pixel_size(im, x_pixel_size, y_pixel_size, z_pixel_size):
rows, cols, slices = im.shape
# Get the pixel ... |
JavaScript | UTF-8 | 2,621 | 2.84375 | 3 | [] | no_license | const Max = function(
{
selector,
props,
state,
template,
beforeRender = function(){},
afterRender = function(){},
eventBind = function(){}
}) {
// 생성자로 호출할 수 있게만 만들기
if (new.target !== Max) {
return new Max({selector, props, state, template, beforeRender, afterRender, eventBind})
}
th... |
Java | UTF-8 | 541 | 3.515625 | 4 | [] | no_license | package com.fxq.homework.day03.subject04;
public class Outer {
public static A method(){
//把A用Inter代替同理
//方法一
/* A a = new A(){
@Override
public void show() {
System.out.println("HelloWorld");
}
};
return a;*/
//方... |
Shell | UTF-8 | 408 | 3.53125 | 4 | [
"MIT"
] | permissive | #!/bin/bash
project=$1
pushd $project > /dev/null
#All Packages
PACKAGES=$(find . -name '*.go' -print0 | xargs -0 -n1 dirname | sort --unique)
echo '## Packages requireing linting'
for pkg in ${PACKAGES[@]}; do
echo "- [ ] $pkg $(golint $pkg | wc -l)" | grep -v '\s0$'
done
echo ''
echo 'packages passing lint'
for... |
C# | UTF-8 | 1,332 | 3.203125 | 3 | [] | no_license | using System;
using System.Globalization;
namespace uri_1051
{
class Program
{
static void Main(string[] args)
{
double valorSalario;
valorSalario = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);
if (valorSalario >= 0.00 && valorSalario <=... |
Java | UTF-8 | 3,679 | 2.0625 | 2 | [] | no_license | package com.son.videotophoto;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.app.Dialog;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.view.View;
import a... |
Markdown | UTF-8 | 6,457 | 4.34375 | 4 | [] | no_license | # 排序类
排序算法主要有,冒泡,选择,插入,希尔,归并,快速排序,堆排序
## 冒泡
1. 常规版
```javascript
function bubbleSort(arr) {
let len = arr.length;
for (var i = 0; i < len; i++) {
for (var j = 0; j < len - 1 - i; j++) {
if (arr[j] > arr[j + 1]) {
let tmp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = tmp;
}
... |
Markdown | UTF-8 | 432 | 3.171875 | 3 | [
"MIT"
] | permissive | ### Using font-weight on android
:::note
For Android the font. weights MUST align with the used font. So try out which is the regarding font weight to your used font.
:::
```tsx
h1Style: {
fontFamily: 'Nunito-SemiBold',
fontWeight: '300',
},
h2Style: {
fontFamily: 'Nunito-Regular',
... |
Markdown | UTF-8 | 2,172 | 4.0625 | 4 | [] | no_license | #ES6语法实现模板编译
#基础字符串模板
```js
var template = `
<ul>
<% for(var i=0; i < data.supplies.length; i++) { %>
<li><%= data.supplies[i] %></li>
<% } %>
</ul>
`;
```
思路:怎么编译这个模板字符串呢?根本原理可以用ES5语法的循环拼接字符串,这里设置这个循环拼接函数为echo()
将其转换为JavaScript表达式字符串
```js
echo('<ul>');
for(var i=0; i < data.supplies.lengt... |
C | UTF-8 | 709 | 3.6875 | 4 | [] | no_license | /*
Student Info:
UWin ID: 105 167 718
Name: Shail Patel
Lab Section Number:
Use this part to report your on comments on the code
State clearly any valid assumptions
*/
#include <stdio.h>
void DrawHalfPyramid(int rows)
{
for (int i = 1; i <= rows; i++)
{
for (int j = 1; j <= i; j++)
... |
Markdown | UTF-8 | 2,090 | 2.78125 | 3 | [
"MIT"
] | permissive | # Tired of running grunt every time you change something?
We can use a task that watches our changes and triggers the `grunt babel` task for us.
Lets install `$ npm install --save-dev grunt-contrib-watch` and then create `tasks/watch.js`.
```js
module.exports = function (grunt) {
var config = {
watch: {
... |
Java | UTF-8 | 740 | 1.914063 | 2 | [] | no_license | package com.ff.system.vo;
/**
* @Author yuzhongxin
* @Description
* @Create 2017-07-14 1:27
**/
public class TreeVO {
private String id;
private String pId;
private String name;
private Integer checked;
public String getId() {
return id;
}
public void setId(String id) {
... |
Python | UTF-8 | 821 | 2.625 | 3 | [] | no_license | from django.shortcuts import render
import random
# Create your views here.
def index(request):
return render(request,'index.html')
#Template variables
def dinner(request):
menu=["spagetti","hamberger","chicken","sushi","tofu","soup"]
pick=random.choice(menu)
return render(request,'dinner.htm... |
Markdown | UTF-8 | 536 | 2.90625 | 3 | [] | no_license | # Cypress-Basics-Tutorial
Cypress tutorial for beginners, it is working best with tutorial docs available here: https://docs.google.com/document/d/1goqWk9BFzuajmZcH8gd4a7XMa75CmVw3cb1JGuzJxTY/edit?usp=sharing
To install cypress with examples from this repository follow these steps
1. Clone this repository to your PC
... |
C++ | UTF-8 | 8,882 | 3.09375 | 3 | [
"Zlib"
] | permissive | #include "Perlin.h"
namespace Engine {
// Default, unseeded constructor. Initialises the default permutation vector
// (as set out by Perlin)
Perlin::Perlin() : seed(0), octaves(5), persistence(0.25f) {
permutations.resize(512);
// Duplicate first set of values to get to 512
for (int i = 0; i < 256; i++) {
... |
Java | UTF-8 | 602 | 3.296875 | 3 | [] | no_license | package cifrario;
public class StefanoCifrario implements Cifrario {
@Override
public void cripta(String frase) {
System.out.println("cifrato da Stefano " + frase);
String stringaInput = "";
String[] stringaOutput = new String[100];
char Output;
int i, n = 0, num = 2;
stringaInput = frase;
n = stringa... |
Markdown | UTF-8 | 806 | 2.609375 | 3 | [] | no_license | # Astar Notes <small>βeta</small>
## Beautiful A levels notes for all subjects 🌈
Astar Notes contains the most awesome A levels notes compiled over generations of A levels students.
## Tech Stack
- There's not much of a tech stack here 😅
- We are running on [Mkdocs](https://github.com/mkdocs/mkdocs)
- The theme i... |
C# | UTF-8 | 1,898 | 3.4375 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Algorithms.Sorting
{
public class MergeSort
{
protected IComparable[] auxArray = null;
public void Sort(IComparable[] inputArray)
{
int length = inp... |
PHP | UTF-8 | 1,216 | 2.90625 | 3 | [] | no_license | <?php
namespace Oip\RelevantProducts;
class CompareFunctions
{
/**
* @param RelevantSection $a
* @param RelevantSection $b
* @return int
*/
public static function compareCategoriesByWeight($a, $b)
{
return $b->getWeight() - $a->getWeight();
}
/**
* @param Relevant... |
C++ | UTF-8 | 1,042 | 3.03125 | 3 | [
"Apache-2.0"
] | permissive |
#include "CPublisher.h"
void Publisher::call(const char *arg1, int arg2) {
for ( auto entry: subscribers ) { entry.second(arg1, arg2); }
}
void Publisher::clear() {
subscribers.clear();
}
size_t Publisher::getSize() {
return subscribers.size();
}
void Publisher::printSize() {
std::cout << "Subscri... |
Java | UTF-8 | 3,159 | 2.34375 | 2 | [] | no_license | package ch.sircremefresh.pages.departureboard;
import ch.sircremefresh.controls.autocomplete.AutoCompleteController;
import ch.sircremefresh.transport.TransportApiException;
import ch.sircremefresh.transport.TransportService;
import ch.sircremefresh.transport.dto.StationboardDto;
import ch.sircremefresh.transport.dto.... |
C | UTF-8 | 3,748 | 3.125 | 3 | [] | no_license | #include "headers.h"
//invert sort order
int comp(const void* i, const void* j)
{
TreeNode* arg1 = *((TreeNode**)i);
TreeNode* arg2 = *((TreeNode**)j);
return arg2->number - arg1->number;
}
void codding(FILE* input, FILE* output) {
int SIZE_BUF = 512;
unsigned char buf[512] = "";
int readed = 0;
TreeNode** no... |
Java | UTF-8 | 290 | 1.953125 | 2 | [] | no_license | package com.lzh.weatherforecast.bean;
/**
* Created by lzh on 2016/4/12.
*/
public class SideSlipInfo {
public int resourceID;
public String title;
public SideSlipInfo(int resourceID, String title) {
this.resourceID = resourceID;
this.title = title;
}
}
|
Java | UTF-8 | 1,647 | 2.796875 | 3 | [
"BSD-2-Clause"
] | permissive | package hr.fer.zemris.java.hw11.jnotepadpp.localization;
import java.util.Objects;
import javax.swing.AbstractAction;
import javax.swing.Action;
import hr.fer.zemris.java.hw11.jnotepadpp.JNotepadPP;
/**
* Class {@link LocalizableAction} is abstract class and it extends
* {@link AbstractAction}. It doesn't specifi... |
Java | UTF-8 | 725 | 3.1875 | 3 | [] | no_license | package debug.employees;
import java.util.ArrayList;
import java.util.List;
public class Company {
private List<Employee> company;
public Company(List<Employee> company) {
this.company = company;
}
public void addEmployee(Employee e) {
company.add(e);
}
public Employee findE... |
C++ | UTF-8 | 5,242 | 3 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <strstream>
#include <memory>
typedef long long int lint;
struct dp_cache
{
char op;
lint op_pos;
lint cost;
dp_cache(char o, lint pos, lint c)
: op{ o }, op_pos{ pos }, cost{ c }
{}
dp_cache() : op... |
PHP | UTF-8 | 3,599 | 2.890625 | 3 | [] | no_license | <?php
include "header.php";
?>
<div id="content">
<div id="nav">
<h3>Navigation </h3>
<ul>
<li><a href="createUser.php">Create New User</a></li>
</ul>
</div>
<div id="main">
<?php
/***************************** HANDLING CLIENT LOG... |
PHP | UTF-8 | 707 | 2.515625 | 3 | [
"MIT"
] | permissive | <?php
namespace Rossina\Repositories\Transformers;
use League\Fractal\TransformerAbstract;
use Rossina\Etiqueta;
/**
* Class EtiquetaTransformer
* @package namespace Rossina\Repositories/Transformers;
*/
class EtiquetaTransformer extends TransformerAbstract
{
public function transform(Etiqueta $model)
{
... |
JavaScript | UTF-8 | 7,336 | 2.609375 | 3 | [] | no_license | import React, { Component } from "react";
import "./styles/Consultas.css";
class ConsultaPacientes extends Component {
constructor(props) {
super(props);
this.state = {
arrPacientes : [],
arrDomicilios : []
}
}
cargarPacientes = () => {
fetch("/pacientes")
.then((response) => re... |
PHP | UTF-8 | 862 | 2.671875 | 3 | [
"MIT"
] | permissive | <?php
/*
* This file is part of the php-ActiveResource.
* (c) 2010 Konstantin Kudryashov <ever.zet@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace ActiveResource\Resources;
use ActiveResource\Connections\Conn... |
Java | UTF-8 | 688 | 1.914063 | 2 | [] | no_license | package com.zmy.dao.stat;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.ArrayList;
import java... |
Java | UTF-8 | 1,367 | 2.03125 | 2 | [
"Apache-2.0"
] | permissive | package com.dawnlightning.zhai.fragment.imagelist;
import android.os.Bundle;
import com.dawnlightning.zhai.adapter.imagelistadapter.NormalImageListAdaper;
import com.dawnlightning.zhai.base.Actions;
import com.dawnlightning.zhai.bean.ImageListBean;
import com.dawnlightning.zhai.fragment.BaseFragment;
import java.uti... |
Python | UTF-8 | 487 | 2.734375 | 3 | [] | no_license | from django.db import models
# Create your models here.
# las tablas son clases
class Prueba(models.Model):
titulo = models.CharField(max_length=30) #CHARFIELD = TEXTO
subtitulo = models.CharField( max_length=50) #mcchar + tab crea directamente el CharField
cantidad = models.IntegerField() #mint + tab crea... |
Java | UTF-8 | 183 | 2.6875 | 3 | [] | no_license | package abstractfactory.src;
public class Arch extends Weapon{
@Override
void shoot() {
System.out.println("我是具体的武器Arch,继承自Weapon.");
}
}
|
Python | UTF-8 | 1,613 | 2.671875 | 3 | [
"MIT"
] | permissive | from tqdm import tqdm
import ipdb, json, random, csv, torch
def read_file(path, mode='train'):
with open(path) as f:
data = json.load(f)
if mode == 'train':
data = data[mode]
data = [[''.join(j.split()) for j in i] for i in data]
responses = [i[-1] for i in data]
... |
Python | UTF-8 | 276 | 2.703125 | 3 | [] | no_license | #import sys
#input = sys.stdin.readline
def main():
K, S = map(int,input().split())
ans = 0
for i in range(K+1):
for j in range(K+1):
if i+j <= S and S - (i+j) <= K:
ans += 1
print(ans)
if __name__ == '__main__':
main()
|
SQL | UTF-8 | 739 | 2.984375 | 3 | [] | no_license |
create table costumer
(
uuid char(36) primary key not null,
full_name text not null
);
create table session
(
id serial,
costumer_uuid char(36) not null references costumer (uuid) on delete cascade,
from_num_to_num text not null,
ip varchar(15) ... |
Python | UTF-8 | 564 | 3.53125 | 4 | [] | no_license | import sys
from itertools import groupby
from operator import itemgetter
def tokenize_input():
"""Split each line of standard input into a key and a value."""
for line in sys.stdin:
yield line.split('\t')
# produce key-value pairs of word lengths and counts separated by tabs
for word_length, group in ... |
C# | UTF-8 | 1,967 | 3 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProyectoDamasIng
{
//La clase ficha se encarga de guardar los valores de la posición de una ficha en específico así como las distintas direcciones hacia las cuales puede moverse o comer
... |
Java | UTF-8 | 2,254 | 2.0625 | 2 | [
"Apache-2.0",
"LicenseRef-scancode-dco-1.1"
] | permissive | package org.infinispan.client.hotrod.impl.multimap.operations;
import static org.infinispan.client.hotrod.impl.multimap.protocol.MultimapHotRodConstants.REMOVE_ENTRY_MULTIMAP_REQUEST;
import static org.infinispan.client.hotrod.impl.multimap.protocol.MultimapHotRodConstants.REMOVE_ENTRY_MULTIMAP_RESPONSE;
import java.... |
C | UTF-8 | 898 | 3.1875 | 3 | [] | no_license | #include <stdio.h>
#include <pthread.h>
#include <time.h>
#include <sys/times.h>
#include <unistd.h>
void print1();
void print2();
void busy_wait_delay(int seconds);
int main(){
pthread_t thread1, thread2;
pthread_create(&thread1, NULL, print1, NULL);
pthread_create(&thread2, NULL, print2, NULL);
pthread_jo... |
Python | UTF-8 | 1,189 | 2.78125 | 3 | [
"MIT"
] | permissive | from elasticsearch6 import Elasticsearch
class Document(object):
def __init__(self, id, title, abstract, text):
self.id = id
self.title = title
self.abstract = abstract
self.text = text
class Elastic(object):
def __init__(self, url, index):
self.elastic_url... |
Java | UTF-8 | 1,829 | 2.078125 | 2 | [
"MIT"
] | permissive | package com.futao.springbootdemo.foundation.configuration;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.transaction.PlatformTransactionManager;
import javax.annotation.Resource;
import javax.sql.DataSource;
//@Configur... |
PHP | UTF-8 | 1,207 | 2.765625 | 3 | [] | no_license | <?php if (!defined('BASEPATH')) {exit('No direct script access allowed');}
class LineupPlayer extends Document {
protected $player;
protected $position;
protected $order;
public function __construct()
{
parent::__construct();
}
public function getPlayer()
{
if... |
Java | UTF-8 | 422 | 2.203125 | 2 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | package org.cafejojo.schaapi.miningpipeline.usagegraphgenerator.jimple.testclasses.users;
import org.cafejojo.schaapi.miningpipeline.usagegraphgenerator.jimple.testclasses.library.Object1;
public class SimpleTest {
public Object1 test() {
String a = new String("a");
String b = new String("b");
... |
C# | UTF-8 | 1,262 | 2.6875 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using JargeEngine.Graphics;
namespace JargeEngine
{
public class GUIComponent
{
public Vector2 Position = default(Vector2);
public string Name = "";
public bool Visible ... |
SQL | UTF-8 | 809 | 3.0625 | 3 | [] | no_license | DROP DATABASE IF EXISTS tinder_clone;
CREATE DATABASE tinder_clone;
USE tinder_clone;
CREATE TABLE user_account (
id BIGINT NOT NULL AUTO_INCREMENT,
user_email VARCHAR(255) NOT NULL,
user_password VARCHAR(255) NOT NULL,
user_full_name VARCHAR(255) NOT NULL,
user_age INT NOT NULL,
user_avatar VARCHAR(255) NOT N... |
Go | UTF-8 | 993 | 2.671875 | 3 | [] | no_license | package server
import (
"fmt"
"os"
"os/signal"
"github.com/rayhaanbhikha/file_share/packages/utils"
)
const standardPort = "8080"
const dataPort = "8081"
const defaultIPAddress = "0.0.0.0"
func handleErr(err error) {
if err != nil {
fmt.Println(err)
os.Exit(1)
}
}
func Run(filePath string) {
// Validate... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.