blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 132 | path stringlengths 3 236 | src_encoding stringclasses 29
values | length_bytes int64 8 7.94M | score float64 2.52 5.72 | int_score int64 3 5 | detected_licenses listlengths 0 142 | license_type stringclasses 2
values | text stringlengths 8 7.94M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
655e90f0e2a872a2a5386fed4c8d0b16e702d81a | JavaScript | MVanBoxtel/PHP-JS-forms | /assignment4/assignment4.js | UTF-8 | 5,068 | 3.359375 | 3 | [] | no_license | /*
assignment4.js
This document contains all javascript functions required for validation for assignment4.html
Matthew Van Boxtel, 2015.03.21: Created
*/
// this function is called on load of the page, it simply sets the first name field as the starting cursor field
function focusFirstField()
{
var start = documen... | true |
3bcc5a5ecf79c569ed4eef2f35deaa84cdc64b5f | JavaScript | agessler/scrivito_example_app_js | /prerender/storePrerenderedContent.js | UTF-8 | 2,838 | 2.578125 | 3 | [
"MIT"
] | permissive | const path = require("path");
const fse = require("fs-extra");
const puppeteer = require("puppeteer");
const { extendRedirects } = require("./extendRedirects");
const { reportError } = require("./reportError");
const { startServer } = require("./startServer");
const { storeResult } = require("./storeResult");
const { ... | true |
6f02791b799deea0ab6dd0050d27c31035dc076a | JavaScript | sl8te/keychain | /client/src/pages/account/Account.js | UTF-8 | 6,837 | 2.671875 | 3 | [] | no_license | import React, { Component } from "react";
import { FormErrors } from './FormErrors';
import API from "../../utils/API";
import { Col } from "../../components/Grid";
// const bcrypt = require("bcrypt-nodejs");
class Account extends Component {
constructor (props) {
super(props);
this.state = {
pas... | true |
58de6540f1cc328e6eccd23863bfbf18091ee673 | JavaScript | mudit-choksi/rgit_attn_server | /public/javascripts/update.js | UTF-8 | 1,924 | 2.703125 | 3 | [] | no_license | document
.querySelector('#passchange')
.addEventListener('click', async function (event) {
event.preventDefault();
let form = {};
let formData = new FormData(document.querySelector('#myForm'));
for (let key of formData.keys()) {
form[key] = formData.get(key);
... | true |
4e389a98f51feccbcab69098bff01131e86d2c6f | JavaScript | eviltreehouse/node-raylib | /index.js | UTF-8 | 4,833 | 2.5625 | 3 | [
"Zlib",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-other-permissive"
] | permissive | /**
* node-raylib
*
* https://github.com/robloach/node-raylib
*/
// Find the bindings.
const raylib = require('bindings')('node-raylib')
const {format} = require('util')
raylib.MAX_GAMEPADS = 4
raylib.MAX_GAMEPAD_AXIS = 8
raylib.MAX_GAMEPAD_BUTTONS = 32
raylib.MAX_TOUCH_POINTS = 10
raylib.MAX_KEY_PRESSED_QUEUE = ... | true |
b10b3d3185f99bc4a8b32603523aa478d13d280e | JavaScript | jemtca/CodingBat | /JavaScript/Logic-1/maxMod5.js | UTF-8 | 484 | 3.96875 | 4 | [] | no_license |
// given two int values, return whichever value is larger
// however if the two values have the same remainder when divided by 5, then the return the smaller value
// however, in all cases, if the two values are the same, return 0
const maxMod5 = (a, b) => {
if (a === b) {
return 0;
}
if (a % 5 ==... | true |
fad67fafd69125c6f2341c3bec12f9f49184a63e | JavaScript | ASheikh-io/Hot-Restaurants | /routes/apiRoutes.js | UTF-8 | 874 | 2.6875 | 3 | [] | no_license | var tableData = require("../data/tableData");
var waitinglistData = require("../data/waitinglistData");
var waitinglistData = require("../data/waitinglistData");
module.exports = function(app) {
app.get("/data/tables", function(req, res) {
res.json(tableData);
});
app.get("/data/waitingli... | true |
c079a297cca96d845ef2fec3c6035b28d9991384 | JavaScript | PavelIsaenko/goit-js-hw | /Goit_homework/goit-js-hw-02/js/task-02.js | UTF-8 | 721 | 3.5625 | 4 | [] | no_license | "use strict";
const calculateEngravingPrice = function (message, pricePerWord) {
const calculetSentece = message.split(" ");
console.log(calculetSentece);
let result = 0;
for (const word of calculetSentece) {
result += pricePerWord;
}
return `Total price: ${result}`;
};
console.log(
calculateEngra... | true |
be6e0712cf373c02617128f564f5254979567e9b | JavaScript | kenlapolla/Winter-2021 | /Class 5 - Objects/06_ES6_class.js | UTF-8 | 583 | 3.3125 | 3 | [] | no_license | class Person {
constructor (name = "", job = "") {
this.name = name;
this.job = job;
}
getName () {
return this.name;
}
getJob () {
return this.job;
}
}
class SuperHero extends Person {
constructor(name, heroName, superPower="nothing") {
sup... | true |
741586a8aebe7adb143f99518b8086440c59dede | JavaScript | juansensio/skylab-bootcamp-201807 | /staff/aranzazu-perdomo/arrays-native/scripts/indexOf.test.js | UTF-8 | 425 | 3.03125 | 3 | [] | no_license | 'use strict';
describe('Array.prototype.indexOf', function () {
var beasts;
beforeEach(function () {
beasts = ['ant', 'bison', 'camel', 'duck', 'bison'];
});
it('returns the first index at which a given element can be found in the array, or -1 if it is not present.' , function() {
... | true |
7e4e526b412aa6cfd2f8bb91e90917cdbc7f2add | JavaScript | alyhemani/mean_march_2017 | /Catherine Rossi /be_the_interpreter/interpreter.js | UTF-8 | 1,328 | 4.65625 | 5 | [] | no_license | /**
* Created by Catherine on 3/10/17.
*/
// var hello = "interesting";
// function example() {
// var hello = "hi!";
// console.log(hello);
// }
//declarations get hoisted
var hello;
function example() {
hello = "hi";
console.log(hello);
}
console.log('I adore you!');
// assignments and invocation mai... | true |
97b6ba4fb43bbb6053b31ae2339e16b5bb1e9fd5 | JavaScript | darryd/vanslam_live | /app/assets/javascripts/candidates.js | UTF-8 | 831 | 3.515625 | 4 | [
"MIT"
] | permissive |
function Candidates(compare_f) {
this.candidates = [];
this.compare_f = compare_f
this.add = function(candidate) {
if (this.candidates.length == 0) {
this.candidates.push(candidate);
return;
}
switch (this.compare_f(candidate, this.candidates[0])) {
... | true |
7daec6261c2ae53cc02fed2f2b03791f89726527 | JavaScript | TuringH1/leetcode | /leetcode/633.平方数之和.js | UTF-8 | 765 | 3.625 | 4 | [] | no_license | /**
* 给定一个非负整数 c ,你要判断是否存在两个整数 a 和 b,使得 a2 + b2 = c。
示例1:
输入: 5
输出: True
解释: 1 * 1 + 2 * 2 = 5
示例2:
输入: 3
输出: False
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/sum-of-square-numbers
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
*/
/**
* @param {number} c
* @return {boolean}
*/
var judgeSquareSum = function(... | true |
235a4204f04d2f98dd0ea2881400f9ae44f4f53f | JavaScript | RiaanP/form-backend | /controllers/form.js | UTF-8 | 1,253 | 3.078125 | 3 | [] | no_license | //required a valdation module to check for any errors
const {validationResult}=require('express-validator/check');
const User= require('../model/user');
//function to add data to the database
exports.postData=(req,res,next)=>{
const errors=validationResult(req);
if(!errors.isEmpty()){
const error= new Error('Vali... | true |
a5078c9ae3f5ba885b37e14e162bb4d2c3b672b3 | JavaScript | julianopita/principal | /js/main_2.js | UTF-8 | 3,535 | 3.25 | 3 | [
"MIT"
] | permissive | var xhttp = new XMLHttpRequest();
var timeline = document.getElementById('timeline');
// faz uma requesição do arquivo timeline
function createTimeLine(){
xhttp.onreadystatechange = function(){
if(xhttp.readyState == 4 && this.status == 200){
var text = JSON.parse(`${this.response}`);
... | true |
dc449bcf241fb0061f14b48cb34a12e4e8417e77 | JavaScript | acuellarh/learnyounode-examples | /4.io-asincrono.js | UTF-8 | 1,303 | 3.671875 | 4 | [] | no_license | //## MI PRIMER I/O ASINCRÓNICO! (Ejercicio 4 de 13)
// Escribe un programa que use operación de sistema de archivos asíncrona
// para leer un archivo e imprimir en consola el número de saltos de línea
// ('\n') que contiene. Similar a ejecutar cat file | wc -l.
// El programa recibirá la ruta al archivo como único a... | true |
5298786558611e40a9c4700ea4ac83c04b48252c | JavaScript | antmej/media-player | /app.js | UTF-8 | 6,482 | 2.65625 | 3 | [] | no_license | 'use strict';
// PLAYLIST
var playlist = new Playlist();
// SONGS
var miracle = new Song('The Miracle (Of Joey Ramone)', 'U2', '4:15', 'Songs of Innocence', 'audio/the-miracle-(of joey-ramone).m4a');
var everyBreakingWave = new Song('Every Breaking Wave', 'U2', '4:12', 'Songs of Innocence', 'audio/every-breaking-w... | true |
9863b1863347290ef7ac9ca520ce9d81b22ad644 | JavaScript | echoprotocol/blip-wallet | /app/helpers/validate-password-helper.js | UTF-8 | 864 | 2.78125 | 3 | [
"MIT"
] | permissive | import { MAX_PASSWORD_LENGTH, MIN_PASSWORD_LENGTH } from '../constants/validation-constants';
class ValidatePasswordHelper {
static passwordHints(password) {
const hints = {};
if (!password.length) {
return {
hint1: '',
hint2: '',
hint3: '',
hint4: '',
};
}
const reg = new RegExp(`^[\\... | true |
7313fbfd0f9b6bd60066b59dc34176fbd2698333 | JavaScript | david-okolo/build-for-sdgs | /src/helper/constants.js | UTF-8 | 632 | 3.1875 | 3 | [
"MIT"
] | permissive | /**
* Keep generic string or number constants in a file and export.
* Solves any string based inconsistencies in application code or tests.
*/
const days = 'days';
const weeks = 'weeks';
const months = 'months';
/**
* Returns a dd-mm-yyyy representation of today's date
* @returns {string} - Today's date
*/
cons... | true |
f401448386bc497d0e3f8c56a3f290255f48b2b1 | JavaScript | wiiaboo/codewars | /strings_mix.js | UTF-8 | 1,514 | 3.3125 | 3 | [
"MIT"
] | permissive | /*
https://www.codewars.com/kata/5629db57620258aa9d000014
(c) 2017 Ricardo Constantino <wiiaboo@gmail.com>
*/
function mix(s1, s2) {
let s1Map = getLetters(s1);
let s2Map = getLetters(s2);
let common = filterCommon(s1Map, s2Map);
let s1List = Object.keys(s1Map).map(x => "1:" + s1Map... | true |
1e9a9cbf4cc9fa75685632531ab3db513a648ea6 | JavaScript | petersont/o3d | /samples_webgl/io/actors/spikem.js | UTF-8 | 4,023 | 2.796875 | 3 | [] | no_license | /*
* Copyright 2009, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditio... | true |
26f78ebec6dfb70b93767b00acf5474bc3753bea | JavaScript | LunaWilfredo/CalculadoraJS | /dom.js | UTF-8 | 2,209 | 3.578125 | 4 | [] | no_license | /* Capturando botones*/
const botonNumeros = document.getElementsByName('data-number');
const botonOper = document.getElementsByName('data-opera');
const botonIgual = document.getElementsByName('data-igual')[0];
const botonDelete = document.getElementsByName('data-delete')[0];
var result=document.getElementById(... | true |
adc83c3df83de1316dc6f8df20d51d8f4f62ebbe | JavaScript | junya-takagi/infovis2021 | /W08/bar_chart.js | UTF-8 | 3,608 | 2.8125 | 3 | [] | no_license | d3.csv("https://junya-takagi.github.io/infovis2021/W08/data.csv")
.then(data=>{
data.forEach(d=>{
d.value = Number(d.value)
});
var config = {
parent:"#drawing_redion",
width:512,
height:256,
margin:{top:30,right:10,bottom:10,left:5... | true |
1d9050e824eb374d7dbb50cbb126b6e39fe4fceb | JavaScript | Tracck/Roblox-ping-chrome-extension | /content.js | UTF-8 | 1,974 | 2.90625 | 3 | [] | no_license | function httpGet(theUrl)
{
var xmlHttp = new XMLHttpRequest();
xmlHttp.open( "GET", theUrl, false);
xmlHttp.send( null );
return xmlHttp.responseText;
}
function makeDataArray(data) {
var dict = {};
for (let i = 0; i < data.length; i++) {
dict[data[i].id] = i;
}
return dict;
}... | true |
95c5189c0f7d5fe06855c14beea40205c33cc042 | JavaScript | Daij-Djan/DDEnhancedJSBridge | /DDEnhancedJSBridge/__TO_COPY_INTO_APP__/DDEnhancedJSBridge.js | UTF-8 | 3,032 | 2.9375 | 3 | [
"MIT"
] | permissive | /*
2013 sapient gmbh
This javascript code is part of the DDBridge api. It is used to communicate
data to Objective-C code through a UIWebView/webview.
*/
// Counts the number of objects communicated to the Objective-C code.
// It is used to index data in the DDBridge_objArray.
var DDBridge_objCount = 0;
// Keeps... | true |
d63ab9ccfab62e7018cc4f17480a99304ea2945a | JavaScript | xingmengmeng/nodeBase | /11.react/js/11.focus.js | UTF-8 | 482 | 2.84375 | 3 | [
"MIT"
] | permissive | /**
* 1.为组件增加一个ref属性,则可以通过 this.refs.属性名获取到此DOM元素
* @type {*}
*/
var Focus = React.createClass({
getFocus(event){
this.refs.myText.focus();
},
render(){
return (
<div>
<input ref="myText" type="text"/>
<button onClick={this.getFocus}>获得焦点</butto... | true |
dab6eabfecd4b2c7283b8aac055c10e505f25732 | JavaScript | North101/json-viewer | /extension/src/json-viewer/check-if-json.js | UTF-8 | 395 | 2.75 | 3 | [] | no_license | function getPreWithSource() {
var childNodes = document.body.childNodes;
var pre = childNodes[0];
if (childNodes.length === 1 && pre.tagName === "PRE") {
return pre;
}
return null
}
function checkIfJson(sucessCallback, element) {
var pre = element || getPreWithSource();
if (pre !== null && pre !== ... | true |
94a844b0d862d153ba9d3708e1f8290ba1e220a8 | JavaScript | wsb550951646/MyMaven | /src/main/webapp/js/sysTest.js | UTF-8 | 3,408 | 2.703125 | 3 | [] | no_license | function SysTest() {
}
SysTest.prototype.init = function () {
$(".check_button").click(SysTest.prototype.test);
};
SysTest.prototype.test = function () {
var testid = $(this).attr("id");
var sessionid = new Date().getTime();
if(testid == "testAll")
SysTest.prototype.checkAll(sessionid);
... | true |
d61057ee00fa667d780c60d5fc8c5d8e8e724ebd | JavaScript | bnathyuw/Simple-JS-Synth | /spec/Synth/oscillator-spec.js | UTF-8 | 3,020 | 3 | 3 | [] | no_license | /*global describe: false, beforeEach: false, it: false, spyOn: false, expect: false,
Oscillator: false, jasmine: false, SynthAudioContext: false */
describe("Oscillator", function () {
"use strict";
var frequency,
sampleRate,
amplitude,
oscillator,
waveTable;
describe("fixed frequency and amplitu... | true |
850e649f1f63011fc1e7cc7366ff4b21245425cb | JavaScript | 2HgO/nodeDocker | /index.js | UTF-8 | 535 | 2.546875 | 3 | [] | no_license | // index.js
const express = require('express');
const bodyParser = require('body-parser');
const cors = require('cors');
const config = {
name: 'practice',
port: 3000,
host: '0.0.0.0',
}
const app = express();
app.use(bodyParser.json());
app.use(cors());
app.get('/', (req, res) => {
res.status(200).json({
sta... | true |
ab44dde2a64f1bde0209d0f76c3e33305be8ec31 | JavaScript | xhlin1217/My-Project | /FOR FUN/koto-Tim/script/contact.js | UTF-8 | 1,029 | 2.53125 | 3 | [] | no_license | var map;
function initialize() {
var mapOptions = {
zoom: 10,
center: new google.maps.LatLng(42.8474817, -106.2569397)
};
map = new google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
var marker = new google.maps.Marker({
map: map,
title: "Mi marcador",
... | true |
6585c1c4c7b23592bcb892ac0c5f942b5280c5a1 | JavaScript | EGNKupava/cleverland_evgeny | /JS/js_class_14/script.js | UTF-8 | 2,122 | 3.8125 | 4 | [] | no_license | 'use strict'
// Задание 1 Cделайте цвет диагональных ячеек таблицы красным.
let crossTableEl = document.getElementById('cross-table');
let colorizeTableButton = document.getElementById('colorize-table-button')
colorizeTableButton.addEventListener('click', tableColorizer);
function tableColorizer() {
for (let i = 0; ... | true |
d587a4048591d0a51f0d88f53e3df7fb027cfd21 | JavaScript | fight1991/job-project | /src/view/pages/iExport/declaration/decPage/common/decUtil.js | UTF-8 | 20,702 | 2.78125 | 3 | [] | no_license | import util from '@/common/util'
import {tipsMessage} from './tipsMessages'
import storageHandle from '@/common/storageHandle.js'
// import BigDecimal from 'js-big-decimal'
export default {
// 去重
unique (arr) {
let x = new Set(arr)
return [...x]
},
// 获取今天的日期
getTodayDate () {
let date = new Date... | true |
989a49b82fc6ac8b522acdc7d3ceee49adac9259 | JavaScript | vitorsch/webmoderno-js2020 | /exercicios-js/exercicios2aLista/27(reverseEntriesFromEntries).js | UTF-8 | 443 | 3.734375 | 4 | [] | no_license | function inverte (obj = {} ) {
const newObj = {}
for ( let i in obj) {
newObj[obj[`${i}`]] = i
}
return newObj
}
console.log(inverte({ a: 2, b: 3, c: 4}))
//Ou ainda
function inverter(objeto) {
const paresDeChaveValorInvertidos = Object.entries(objeto)
.map( parChaveValor => parChave... | true |
3d181380a7be5c17368ebf80c7d7468eaab09046 | JavaScript | Elyx0/BlackHole | /js/src/api.js | UTF-8 | 1,171 | 3.328125 | 3 | [] | no_license | var Api = function (word)
{
this.word = word;
this.resolved = false;
this.setup();
};
// Setup query for a term.
Api.prototype.setup = function ()
{
var that = this;
$.getJSON('https://api.keywordmeme.com/v1/fetch?api_token=' + token + '&q=' + this.word, function (data)
{
console.log(da... | true |
447a95fe38fddb44143052677e39ee61c8e0ec34 | JavaScript | future4code/Michelle-Louzada | /semana4/planner/planner/index.js | UTF-8 | 2,038 | 3.203125 | 3 | [] | no_license | function adicionarItem() {
const meuInput = document.getElementById("tarefa")
let valorDoImput = meuInput.value
const diasDaSemana = document.getElementById('dias-semana').value
// const mySelect = document.getElementsByTagName("option")[diasDaSemana].value
if (meuInput.value !== ""... | true |
0adbc9f688465d6511f7146f04425a73b976e4dc | JavaScript | anni11/Learning-js | /iife.js | UTF-8 | 232 | 3.375 | 3 | [] | no_license | /*iife are instantly invoked function expressions*/
// this doesn't work
/*
function () {
console.log('hello');
}();
*/
( function () {
console.log('hello');
} )();
// helpful in controlling variable scope
// edited on github
| true |
afd147abcd9b3fb7500db0891f74c170ba1479e6 | JavaScript | tarasgavr/tarasgavr.github.io | /javascript/js/13/jshome13-14.js | UTF-8 | 968 | 2.53125 | 3 | [
"MIT"
] | permissive | 'use strict'
$(function() {
var testStructure = [
'<div class="wrapper">',
'<form action="action.js" method="post">',
'<p class="title">Тест по программированию</p><ul>',
]
for (var i = 1; i < 4; i++) {
testStructure[i + 3 * i] = '<li>Вопрос №' + i;
for (var j = 1; j < 4; j++) {
testStruct... | true |
0b754346ab9305b541836336302e4a4972fc4a14 | JavaScript | GlauberGuedes/Cubos-Market-Place | /back-end/controladores/perfil.js | UTF-8 | 1,530 | 2.671875 | 3 | [] | no_license | const conexao = require("../conexao");
const bcrypt = require("bcrypt");
const { validarAtualizaçãoDoUsuario } = require("../validacao/usuarios");
const dadosPerfil = (req, res) => {
const { usuario } = req;
res.status(200).json(usuario);
};
const atualizarPerfil = async (req, res) => {
const { nome, nome_loja,... | true |
00b09c63d0a9394ab68c448e6e1f6b3afe9290fd | JavaScript | RoboVermelho/dijkstra | /graph.js | UTF-8 | 2,210 | 2.875 | 3 | [] | no_license | function Edge() {
return {
type : "edge",
destiny : null,
value : 0,
}
}
function Vertex(name) {
return {
type : "vertex",
name : name,
edgeList : []
}
}
function Graph() {
return {
vertexList : [],
addVertex : function(vertex) {
this.vertexList.push(vertex)
},
... | true |
40a12ca7ce01633e307dd6f84e78f523cc756c3b | JavaScript | liufulin90/react-test | /src/components/Counter.js | UTF-8 | 366 | 2.515625 | 3 | [] | no_license | import React, {Component} from 'react'
class Counter extends Component {
constructor (props) {
super(props)
this.state = {
value: this.props.counter
}
console.log(this.props)
}
render () {
return (
<button onClick={this.props.onIncrement}>
Button:{this.props.value}
... | true |
67f596be6657f6e247ce3b8bd4ea78f12fc37f2b | JavaScript | antonioConrado41/cbwabugtracker | /models/users.js | UTF-8 | 2,964 | 2.671875 | 3 | [] | no_license | const db = require('../db')();
const COLLECTION = 'users';
const nodemailer = require("nodemailer");
const senderEmail = process.env.EMAIL;
const senderPassword = process.env.PASSWORD;
module.exports = () => {
const get = async (email = null) => {
try {
if (!email) {
const user... | true |
d56021684f24104e39ef947f4b48fdbfae0f024e | JavaScript | sumitoberoi1/FamilyCalendarAPI | /src/data/user.js | UTF-8 | 2,410 | 2.8125 | 3 | [] | no_license | const mongoCollections = require("../../config/mongoCollections");
const firebase = require("../../config/firebase");
const users = mongoCollections.users;
async function getUserByEmail(email) {
try {
if (!email || typeof email != "string") {
throw "email not vaild";
}
let userCollection = await use... | true |
c135892b36655f8ee80cbe8480037f0a936053a9 | JavaScript | rickmansfield/2node-api-guided-lecture | /api/dogs/dogs-router.js | UTF-8 | 600 | 2.609375 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | const express = require('express')
const Dog = require('./dogs-model')
const router = express.Router()
router.get('/', async (req, res) => {
try {
const data = await Dog.find();
res.status(200).json(data);
} catch (err) {
res.status(500).json({
message: 'Error retrieving the dogs',
});
}
}... | true |
ddb96fb3ee05834160b9b6b77c50f026ebf8df0d | JavaScript | crazycatmax/leetcode | /744_nextGreatestLetter.js | UTF-8 | 1,275 | 4.625 | 5 | [] | no_license | /* 744_nextGreatestLetter 寻找比目标字母大的最小字母
给你一个排序后的字符列表 letters ,列表中只包含小写英文字母。
另给出一个目标字母 target,请你寻找在这一有序列表里比目标字母大的最小字母。
在比较时,字母是依序循环出现的。举个例子:
如果目标字母 target = 'z' 并且字符列表为 letters = ['a', 'b'],则答案返回 'a'
示例:
输入:
letters = ["c", "f", "j"]
target = "a"
输出: "c"
输入:
letters = ["c", "f", "j"]
target = "c"
输出: "f"
输入:
lette... | true |
ea21318169edae8af9997d4efa9a591816bc403f | JavaScript | rapidadress/hetic-p2017 | /exercices/cours-09-canvas-exemple-1/src/js/sparks.class.js | UTF-8 | 2,756 | 2.625 | 3 | [] | no_license | var Sparks = Abstract.extend({
/**
* Init
* @param object options
*/
init: function(options)
{
this.options = options;
this.period = options.period;
this.context = options.context;
this.width = options.width;
this.height = options.height... | true |
d0da08731ea046e98b5bb5d2c21adb22486a51e1 | JavaScript | soberdash/lunch-wheel | /src/client.js | UTF-8 | 4,380 | 2.765625 | 3 | [
"MIT"
] | permissive | /**
* This is prototype. Beware: crappy code ahead.
*/
const WinWheel = require('winwheel')
const randomInt = require('random-int')
const wheelNameEl = document.querySelector('.HeaderWheelName')
const spinButton = document.querySelector('.SpinButton')
const result = document.querySelector('.WheelResult')
const body... | true |
4ec56645d9da4543439594bef0f4a17b7e54bfec | JavaScript | shenxianglong/PACS-VTS | /PACS/pacs/src/pages/Three.js | UTF-8 | 2,266 | 2.75 | 3 | [] | no_license | import React, { Component } from 'react';
import * as THREE from 'three';
class Three extends Component {
componentDidMount() {
this.init()
}
init = () => {
const scene = new THREE.Scene()
const camera = new THREE.PerspectiveCamera( 75, this.mount.clientWidth / this.mount.... | true |
68bcff65c455b5b4b3531543fe70f9209da5e9e1 | JavaScript | hubert94536/Creggslist | /src/accountsApi.js | UTF-8 | 4,111 | 2.5625 | 3 | [] | no_license | import axios from 'axios'
const accountsApi = axios.create({
baseURL: 'localhost',
//baseURL: 'http://192.168.0.23:5000'
})
// creates user and returns id
const createUser = async (name, id, username, email, photo, location) => {
return accountsApi
.post('/accounts', {
params: {
id: id,
... | true |
15cbb19f95c753d9d44f89f74fda1d8f1009651e | JavaScript | ldifederico/Fantasy-League | /public/assets/js/FAQ.js | UTF-8 | 576 | 2.75 | 3 | [
"MIT"
] | permissive | async function updatePoints() {
let data = ({userID: localStorage.getItem("userID")})
let points = await $.ajax({
method: "POST",
url: "/getPoints",
data: data
});
$("#points").text(`Pts: ${points[0].points}`);
};
async function verify() {
let response = await $.ajax({
... | true |
4853787c838a0845262562d417af964ce55516b3 | JavaScript | marco-mascia/boilerplate | /src/main.js | UTF-8 | 864 | 2.5625 | 3 | [] | no_license | import './scss/main.scss';
/*
const arr = [1, 2, 3];
const iAmJavascriptES6 = () => console.log(...arr);
window.iAmJavascriptES6 = iAmJavascriptES6;
*/
const messages = {
header: 'intestazione',
main: 'corpo',
aside: 'lato',
footer: 'piè di pagina'
}
export function init() {
/*
var src = docum... | true |
570a7ed7ac5a0584c755b034bbd89d5f3fa546a9 | JavaScript | scottbeglin/Hot-Cold | /js/app.js | UTF-8 | 4,461 | 3.375 | 3 | [] | no_license | $(document).ready(function () {
// Function to generate the random number for user to pick
function secretNum(min, max) {
var secretNumber = Math.floor(Math.random() * (max - min + 1)) + min;
return secretNumber;
}
var secretNumber = secretNum(1, 100);
console.log("Secret Number: "... | true |
70915612186d73caeec59b2a5334329b2aebad7e | JavaScript | Deivu/Yamato | /src/commands/general/help.js | UTF-8 | 2,857 | 2.6875 | 3 | [] | no_license | const { Command } = require('discord-akairo');
const { MessageEmbed } = require('discord.js');
class Help extends Command {
constructor() {
super('help', {
aliases: ['help'],
channel: 'guild',
args: [{
id: 'input'
}],
description: ... | true |
fb24f2a55a8eb6b58aeae2a242e4a883581c2357 | JavaScript | eslint/eslint | /tests/lib/source-code/token-store.js | UTF-8 | 55,213 | 3.15625 | 3 | [
"MIT"
] | permissive | /**
* @fileoverview Tests for TokenStore class.
* @author Brandon Mills
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const assert = require("chai").assert,
espr... | true |
03ce06dc2274b04c412cd209dd8bf4dff12348b1 | JavaScript | NeryCaballero/algo-js | /01 - Introduction/1.1.js | UTF-8 | 122 | 3.8125 | 4 | [] | no_license | // Exercise 1.1
// Define a variable and display it in the console.
let MyFavColor = "yellow";
console.log(MyFavColor);
| true |
1ede60425db74161d43b48dc3c3fcc0e534f97ba | JavaScript | lucamaral/cucalist | /app/assets/javascripts/utils/makeRating.js | UTF-8 | 773 | 2.59375 | 3 | [] | no_license | App.MakeRating = {
makeRating: function(element, callback, input, magic) {
var cucas = input.cucas;
_.each(element, function(num, key, list){
var myRating = rating(num, 0, 5, function(rating) {
var id = $(num).closest('li').data("id");
var ratingObj = {
'id': id ... | true |
31614f0df23f2eb88ca761c9bbf096c40bf2bfc0 | JavaScript | abbycin/note | /assets/js/login.js | UTF-8 | 1,300 | 2.578125 | 3 | [] | no_license | function showOk(msg) {
$('#myStatus').text('Status');
$('#myModal').html(`<span style="color: green">${msg}</span>`);
$('#modal').modal('show');
setTimeout(function() {
$('#modal').modal('hide');
}, 2000);
}
function showError(msg) {
$('#myStatus').text('Error');
$('#myModal').html(... | true |
e9e02fa9e82cd05d8a81d16da5080eedf7aeece1 | JavaScript | oddporson/lotide | /findKey.js | UTF-8 | 138 | 2.640625 | 3 | [] | no_license | const findKey = (obj, cb) => {
for (let key in obj) {
if (cb(obj[key])) {
return key;
}
}
};
module.exports = findKey;
| true |
2e20773d2046dc65cb935bd5f17b979355d686d8 | JavaScript | badex-ai/calculatorsample | /index.js | UTF-8 | 7,801 | 2.78125 | 3 | [] | no_license |
//-----------------UI Controller
let UIcontroller = (function(){
let domStrings = {
historyOutput: ".calc-output__text",
mainOutput: ".calc-output__output-resultTxt",
numbersBtn:"button button__left",
arithmeticBtn:"button button__right",
equalBtn:".button__equal",
... | true |
6891cf1fa2432c6f8e8f5ff2daa6a9963102eb4f | JavaScript | AVER343/ds-algo | /leetcode/sumTillpoint.js | UTF-8 | 232 | 2.890625 | 3 | [] | no_license | /**
* @param {number[]} nums
* @return {number[]}
*/
var runningSum = function(nums) {
let sumTillPoint = 0
return nums.map(e=>{sumTillPoint=sumTillPoint+e; return sumTillPoint+e})
};
console.log(runningSum([1,2,3,4,56])) | true |
73160b934aec7006d79c640ab5f6d36044b295e8 | JavaScript | woodb/jpl | /tests/index.js | UTF-8 | 2,445 | 3.15625 | 3 | [] | no_license | const test = require("ava");
const fs = require("fs");
const { processJsonBuffer } = require("../src");
const { main } = require("../bin/main");
const VALID_JSON_OBJECT = require("./data/valid.json");
test("processJsonBuffer is a function", t => {
t.is(typeof processJsonBuffer, "function");
});
test("processJsonB... | true |
be4229319b8502303d3d83e23ec5edc14dca5ac3 | JavaScript | sonlh1411/xchw | /j9/threate.js | UTF-8 | 542 | 3.609375 | 4 | [] | no_license | function seatsInTheater(nCols, nRows, col, row) {
if (
nCols < 1 ||
nCols > 1000 ||
nRows < 1 ||
nRows > 1000 ||
!Number.isInteger(nCols) ||
!Number.isInteger(nRows)
) {
console.log("Enter valid Column and Row");
return;
}
if (
col < 1 ||
col > 1000 ||
row < 1 ||
... | true |
b233efa76b408bb051ea5703f9232234da014a0d | JavaScript | zeeeest/react-node-test-app | /client/src/api/api.js | UTF-8 | 503 | 2.546875 | 3 | [] | no_license | const url = 'http://localhost:4000/api/images';
function request(method, url, data) {
return fetch(url, {
method,
body: JSON.stringify(data),
headers: {
'Content-Type': 'application/json; charset=utf-8',
}
})
.then(res => res.json())
.catch(err => con... | true |
a7532ae4385e263aec7ee83acc349f644264bcf5 | JavaScript | AndreCatarino/FlipPhone | /fliphone_react/src/components/Cart.js | UTF-8 | 8,187 | 2.59375 | 3 | [] | no_license | import React, {Component} from 'react';
import axios from "axios";
import {Button, Card, Col, Row} from "react-bootstrap";
class Cart extends Component {
constructor(props) {
super(props);
this.state = {
items: [],
// params necessary for payment post
order_id... | true |
8c7cccb6ef41d02cb1f44eb2df3ff2c0f85f4d99 | JavaScript | andyahn91/react-prime | /lib/performanceTest/createCompareHTML.js | UTF-8 | 3,312 | 2.875 | 3 | [
"MIT"
] | permissive | /**
* Function that returns a string to create an HTML comparison file
* @param {Object} input - Object containing user input from CLI (requires the .port property)
*/
const createCompareHTML = (input) => {
return `<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>React Prime</title>
<style>... | true |
f67d94d310bb71ce1c3fecfe49413a4c7a5231a1 | JavaScript | isaachyoon/Leet_Code | /binaryTreeHeight.js | UTF-8 | 144 | 2.828125 | 3 | [] | no_license | function binaryTreeHeight(root) {
if (!root) {
return 0
}
return Math.max(binaryTreeHeight(root.left), binaryTreeHeight(root.right)) + 1;
} | true |
39e1b17c3146a8e034d371ef124a2d30692cceb1 | JavaScript | RoeJecc/web_project_4 | /src/pages/index.js | UTF-8 | 5,222 | 2.59375 | 3 | [] | no_license | // Imports
import "../styles/index.css"; // add import of the main stylesheets file
import {
deleteModal,
openEditProfileModal,
addModal,
editProfileModal,
addModalPopup,
profileName,
profileOccupation,
profileFormNameInput,
profileFormOccupationInput,
validationForm,
profileAvatar,
avatarModal... | true |
aaa9e6c3dc2ea628e1dbe6251bc221f80b452a2c | JavaScript | philipstubbs13/mini-projects | /wordle-clone-with-react/react-wordle/src/components/Keypad.js | UTF-8 | 571 | 2.71875 | 3 | [] | no_license | import React, { useEffect, useState } from 'react'
export default function Keypad({ usedKeys }) {
const [letters, setLetters] = useState(null);
useEffect(() => {
fetch('http://localhost:3001/letters')
.then(res => res.json())
.then(json => {
setLetters(json)
})
}, [])
... | true |
126c0093b1f02a647890ab5be0af0ae22e1741c2 | JavaScript | Jkwok0714/Snippets | /Minitests/utilTests/messagingSystem/test.js | UTF-8 | 1,401 | 3.890625 | 4 | [] | no_license | /**
* @file The test file that tries out the custom Messenger class
* Created May 2 2018
*/
let Messenger = require('./Messenger.js');
class Component {
constructor (val) {
this.val = val || Math.round(Math.random() * 1000);
}
listenForEvent (eventName, onceOnly = false) {
console.log(`Component ${t... | true |
0a30195d990a90528696b4c0aa5c19d39b62e03e | JavaScript | kamenyanakiev/SoftUni-Programming-Basics | /Exam-Preparation/Exam-09-10-March-2019/05-TennisRanklist.js | UTF-8 | 692 | 3.453125 | 3 | [] | no_license | function tennisRanklist(input) {
let tours = {
won: 0,
w: 2000,
f: 1200,
sF: 720,
totalPoints: 0,
}
for (let i = 2; i < input.length; i++) {
if (input[i] === 'W') {
tours.won++;
tours.totalPoints += tours.w;
} else if (input[i] === 'F') {
tours.totalPoints += tours.f;... | true |
3fceffeb38a672daa7eaccb2dc8c8a97bc212377 | JavaScript | g2minhle/TapTapBugGame | /scripts/bug.js | UTF-8 | 11,164 | 2.984375 | 3 | [] | no_license | var bugManager = {
BUG_WIDTH: 30,
BUG_HEIGHT: 30,
KILL_DISTANCE: 30,
BUG_TYPE: [
{
color: 'black',
score: 5,
speed: {
1: 150,
2: 200,
}
},
{
color: 'red',
score: 3,
... | true |
51439ef36f36303d3f690f0039e92a1a04bc6f34 | JavaScript | HariRox/C24-TankShooter | /sketch.js | UTF-8 | 1,284 | 2.640625 | 3 | [] | no_license | const Engine = Matter.Engine;
const World = Matter.World;
const Bodies = Matter.Bodies;
const Body = Matter.Body;
const Mouse = Matter.Mouse;
const MouseConstraint = Matter.MouseConstraint
const Constraint = Matter.Constraint;
const Composite = Matter.Composite;
const Detector = Matter.Detector;
var engine, world;
var... | true |
6103ad7fb92e945a5020ebde466ebe350a1afbac | JavaScript | desirefoundation/desiresalesportal | /src/components/Login.js | UTF-8 | 4,292 | 2.796875 | 3 | [
"MIT"
] | permissive | /*
This is the Login Component. The whole login page that opens up
Just a simple form that sends a request to firebase.
*/
import React, { Component } from 'react'
import { Redirect } from 'react-router-dom'
import Loader from 'react-loader-spinner'
import firebaseapp from '../firebase'
import logo from '../logo.png'... | true |
ccf899075b8ebb2491a197bc9cad222356b8bb06 | JavaScript | lunchnow/lunch-cli | /bin/commands/getPlaces.js | UTF-8 | 522 | 2.859375 | 3 | [] | no_license | const chalk = require('chalk');
const axios = require('axios');
// const apiUrl;
async function getPlaces() {
try {
const response = await axios.get("https://ec2ffc4c.ngrok.io/places")
const places = response.data.places;
places.forEach(place => {
let color = Math.floor(Math.random()*16777215).t... | true |
fe7baf33a42486c2edd68024ed83753242bef873 | JavaScript | StephenOveson/bamazon | /bamazonManager.js | UTF-8 | 5,014 | 2.671875 | 3 | [] | no_license | let mysql = require('mysql')
let inquirer = require('inquirer')
let connection = mysql.createConnection({
host: 'localhost',
port: 8889,
user: 'root',
password: 'root',
database: 'bamazon_db'
})
connection.connect(function (err) {
if (err) throw err;
start();
})
function start() {
inq... | true |
bb04e1971a715150ef2f53d4da29f11038838e53 | JavaScript | Nirvana37/Nirvana37 | /app.js | UTF-8 | 4,287 | 2.640625 | 3 | [] | no_license | $(function () {
$('.item1').click(function (e) {
e.preventDefault();
$('.item').removeClass('active');
$(this).addClass('active');
$('body').animate({
scrollTop: $('.khoi1').offset().top},1000);
});
$('.item2').click(function (e) {
e.preve... | true |
8d111a84f332fde0a37bd4328b1cb0a3384f7628 | JavaScript | maximesalomon/webapi-iii-challenge | /routes/user-router.js | UTF-8 | 2,572 | 2.609375 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | const express = require('express');
const router = express.Router();
const userDb = require("../data/helpers/userDb");
router.get('/', async (req, res) => {
try {
user = await userDb.get(req.query);
res.status(200).json(user);
} catch (error) {
res.status(500).json({ error: "The users information could... | true |
1a3c3f649f2365d5eb92b5bfed6d57a3a21d752e | JavaScript | vijayarajan2244/Basic-Messanger | /index.js | UTF-8 | 953 | 3 | 3 | [] | no_license | function sendsms(){
value1 = document.getElementById("i1").value;
value2 = document.getElementById("i2").value;
createElement = document.createElement("li");// <li> </li>
if(value1 !==""){
person1 = document.createTextNode(value1);// Hi
createElement.appendChild(person1);// <li> Hi ... | true |
e6d7da4696253273b0249d3ed700210e1f8e8751 | JavaScript | dezrenmikell/plentyOfGit | /db/seeds.js | UTF-8 | 692 | 2.515625 | 3 | [] | no_license | require("dotenv").config();
const mongoose = require("mongoose");
mongoose.connect(process.env.MONGODB_URI);
const User = require("../models/User");
const Stuff = require("../models/Stuff");
const mars = new Stuff({
title: "Fly to Mars",
description: "Earth isn't Red enough. Let's move to a new planet"
});
const ... | true |
1e6829171221ca45848dfb497655614807e67cc6 | JavaScript | liaodehui1/LeetCode | /DP/unique-paths-ii/index.js | UTF-8 | 1,637 | 3.78125 | 4 | [] | no_license | // var uniquePathsWithObstacles = function(obstacleGrid) {
// if (obstacleGrid[0][0] === 1) return 0
// let flag = false, row = obstacleGrid.length, col = obstacleGrid[0].length
// for(let i = 0; i < row; i++) {
// if (obstacleGrid[i][0] === 1) flag = true
// if(flag) obstacleGrid[i][0] = 0
// else ob... | true |
21c63629a048d8a063b3ce23b9d5625c98634407 | JavaScript | Juninhoww2/cursos-starter | /javascript/modulo01/exercise01.js | UTF-8 | 271 | 2.640625 | 3 | [
"MIT"
] | permissive | const endreco = {
rua: "Rua dos Pinheiros",
numero: 1293,
bairro: "Centro",
cidade: "São Paulo",
uf: "SP"
}
console.log(`O usuário mora ${endreco.cidade} / ${endreco.uf}, no bairro ${endreco.bairro}, na rua "${endreco.rua}" com nº ${endreco.numero}`) | true |
ed2f5724711ece730cd2a7835814ee82f78df37a | JavaScript | nqey/sbxt | /src/config/validator.js | UTF-8 | 3,306 | 2.53125 | 3 | [] | no_license | /**
* 示例:
<input type="text" name="项目名" v-qc-validator="validator">
//验证组
validator: {
type: ['required', 'maxLength'],
// 不设使用默认消息
message: {
// required: 'aaa',
// maxLength: 'bbb',
},
// 最大长度验证
maxLength: 2,
// 最小长度验证
minLength: 1,
// 自定义验证器
rules: {
r... | true |
876a9eb90febaa5e1e05051be891bddf7832e8fe | JavaScript | samaromm/react-async-gif-search-lab-recoded-istanbul-2019 | /src/containers/GifListContainer.js | UTF-8 | 1,423 | 2.703125 | 3 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import React from 'react';
import GifList from '../components/GifList';
import GifSearch from '../components/GifSearch';
export default class GifListContainer extends React.Component{
constructor(props) {
super(props);
this.state = {
images: [],
keyWord:""
... | true |
512580a946a5b0128058ec7f8d9d4f055d518bd5 | JavaScript | yoonthe/leetCodeFirstChallenge | /139.单词拆分.js | UTF-8 | 881 | 3.328125 | 3 | [] | no_license | /*
* @lc app=leetcode.cn id=139 lang=javascript
*
* [139] 单词拆分
*/
/**
* @param {string} s
* @param {string[]} wordDict
* @return {boolean}
*/
var wordBreak = function(s, wordDict) {
const wordSet = new Set(wordDict);
const wordsSize = [];
for(let i = 0; i < s.length; i++) {
const word = s.sl... | true |
d0434766ed099a2549e89249b6e2107e864cca5a | JavaScript | FlexAppeal/authorization | /src/index.js | UTF-8 | 3,015 | 3.140625 | 3 | [] | no_license | var actions;
var role;
/**
* Check if the user role is one of the required roles
* @param {string} userRole - Role of the logged user
* @param {string|array} required - Required roles for an action
* @function checkRole
* @return {boolean} - If the user has the required role
*/
const checkRole = (userRole, requi... | true |
28faeb7003209f33bfa06fe784a522287ef7b431 | JavaScript | TranPhamHoangnam/Tutorial-NodeJS | /app/models/post.js | UTF-8 | 2,215 | 2.578125 | 3 | [
"MIT"
] | permissive | // hàm và function để thao tác với bảng
var post_Model = require('../database/data_post');
var q = require("q"); // khai báo promise
// lấy tất cả bài post ra ==> xem dữ liệu
function getAllPost() {
var defer = q.defer();
post_Model.find({ }, function(err, dulieu){
if(err){
defer.reject(e... | true |
21edc63fcfaf454143e16fa04f2a6229fae2562f | JavaScript | a-pyro/covalence-tik-tak-toe | /app.js | UTF-8 | 7,911 | 3.6875 | 4 | [] | no_license | const cells = document.querySelectorAll('.cell');
cells.forEach((element) => element.addEventListener('click', fireOnCells));
// memory-------------
let currentPlayer = 1;
let winForX = 0;
let winForO = 0;
let draws = 0;
let gameTurnsLeft = 9;
// let gameOn = true;
// -------------------
function fireOnCells(event) ... | true |
a6f3db4e0710c95f25ae925c25cfe808bae4d371 | JavaScript | YumingSu/donationsAPI | /routes/donations.js | UTF-8 | 1,479 | 2.796875 | 3 | [] | no_license | import donations from '../models/donations';
import express from 'express';
let router = express.Router();
function getByValue(arr, id) {
var result = arr.filter(function(o) { return o.id == id;} );
return result ? result[0] : null; // or undefined
}
router.home = function(req, res) {
//route to handle a... | true |
5d871238b4f73ed56694933bd8a6fea6d977febd | JavaScript | mzama/TheMagicFlute | /js/main.js | UTF-8 | 624 | 2.890625 | 3 | [] | no_license | function makeTemplate(_title, _description, _type) {
let _template = `
<div class="drink-listing ${_type}">
<div class="drink-listing-line"></div>
<div class="drink-listing-content">
<h3 class="drink-title">${_title}</h3>
<div class="drink-description">
${... | true |
b28dc0b02dc3d39e3d717aae3f6b749d328e38fb | JavaScript | d1b1/legojs-search | /js/router.js | UTF-8 | 1,469 | 2.5625 | 3 | [] | no_license | "use strict";
window.APP = window.APP || {};
APP.Router = Backbone.Router.extend({
routes: {
"brick/new": "create",
"brick/index": "index",
"brick/:id/edit": "edit",
"brick/:id/view": "show"
},
initialize: function (options) {
this.bricks = options.collection;
this.bricks.bind('reset', t... | true |
a87e5baea47870347edba07bda5f8e785e190207 | JavaScript | zyz930713/MES | /system/Profile/MyForm/JFucntions.js | GB18030 | 2,366 | 2.765625 | 3 | [] | no_license | // JavaScript Document
function getParam(jobnumber)
{
with(document.form1)
{
if(thisform.selectedIndex!=0)
{
document.all.paramFrame.src="/Functions/getFormParam.asp?id="+thisform.options[thisform.selectedIndex].value+"&jobnumber="+jobnumber;
}
else
{
document.all.paramhtml1.innerHTML="";
document.... | true |
f536ef90489236566990074c1e724e37316d8272 | JavaScript | maintainer64/goofy-sber | /src/panels/Api/utils.js | UTF-8 | 2,383 | 2.625 | 3 | [] | no_license | import React from "react";
function getWeekDay() {
let date = new Date();
return r(date.getDay());
}
function r(g){
let days = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
return days[(g % days.length)]
}
function getTime(){
let date = new Date();
let hour = date.getHours();
let min... | true |
2354bcfb4e945eee6636f6ed3af62c5975a05a9f | JavaScript | singhamritpal49/law-enforcement-system-FrontEnd | /src/conponents/TicketForm.js | UTF-8 | 3,884 | 2.640625 | 3 | [] | no_license | // import Select from 'react-select';
import React, { Component } from 'react';
import SearchCivilian from './SearchCivilian'
import '../form.css';
class TicketForm extends Component {
state = {
civilian_id: '',
date: '',
time: '',
location: '',
vehicle_license_plate: '',
... | true |
bf7f200c32aef6aae62ad61d35001ca7d0f78c6c | JavaScript | spjmcm/coreasoning | /web_django/web/static/flying.js | UTF-8 | 2,404 | 3.046875 | 3 | [
"MIT"
] | permissive | var width = 0;
var width_rate = 0;
var working = new Array(3);
var pos = new Array(3);
var speed = 0.2;
var interval = 15;
var interval_create = 1000;
var prob = 0.15;
var time = 6000;
var time_var = 2000;
var chars = ['A','B','C','D','E','F'];
$(document).ready(function() {
flying_controller();
document.onkeydown =... | true |
7d97e67fa616527493acec308a8d305678be6829 | JavaScript | geodataeinar/ReactTest | /src/components/Result.js | UTF-8 | 2,867 | 2.53125 | 3 | [] | no_license |
import React, { useState, useEffect } from 'react';
import '../css/result.css';
import DataTable from 'react-data-table-component'; // https://www.npmjs.com/package/react-data-table-component
export default function Result(props) {
//const data = [{ id: 1, title: 'Conan the Barbarian', year: '1982' }, { id: 2,... | true |
99a04d3f0a72d1aecd9ecd36c56eb023fbdc9dc1 | JavaScript | el-work-local-projects/bootstrap-react | /src/components/demos/Text.js | UTF-8 | 4,184 | 2.546875 | 3 | [] | no_license | import React from 'react';
import Form from 'react-bootstrap/Form';
class Text extends React.Component {
constructor(props) {
super(props);
this.state = {
content: ''
};
this.onTextChange = this.onTextChange.bind(this);
}
onTextChange(event) {
this.setState({content: event.target.value});
}
rend... | true |
753994735b60f8ac6cfb798e90c2da535b45ec59 | JavaScript | yinhaiying/reading-notes | /src/pages/chapter-three-栈/exercises/3.3/leetcode682.js | UTF-8 | 1,930 | 4.21875 | 4 | [] | no_license | /*
棒球比赛:
你现在是一场采用特殊赛制棒球比赛的记录员。这场比赛由若干回合组成,过去几回合的得分可能会影响以后几回合的得分。
比赛开始时,记录是空白的。你会得到一个记录操作的字符串列表 ops,其中 ops[i] 是你需要记录的第 i 项操作,ops 遵循下述规则:
整数 x - 表示本回合新获得分数 x
"+" - 表示本回合新获得的得分是前两次得分的总和。题目数据保证记录此操作时前面总是存在两个有效的分数。
"D" - 表示本回合新获得的得分是前一次得分的两倍。题目数据保证记录此操作时前面总是存在一个有效的分数。
"C" - 表示前一次得分无效,将其从记录中移除。题目数据保证记录此操作时前面总是存在一个有效的分数。
请你... | true |
7db03a858f3b49a689b3138ad488505ee1cd43ef | JavaScript | YWebCA/ywca-chapter04 | /spec/array_spec.js | UTF-8 | 3,809 | 3.6875 | 4 | [] | no_license | describe( 'Reversing an Array', function () {
beforeEach( function () {
this.start1 = [ 1 ];
this.copy1 = this.start1.slice(0);
this.end1 = [ 1 ];
this.start2 = [ 1, 2, 3, 4, 5 ];
this.copy2 = this.start2.slice(0);
this.end2 = [ 5, 4, 3, 2, 1 ];
this.start3 = [ 1, 'a', 2, 'b', 3, 'c'... | true |
76f8e018b81a13d03d76729864580906edfc94fb | JavaScript | BrucunZ/randomnameguesser | /script.js | UTF-8 | 1,466 | 2.8125 | 3 | [] | no_license | /*global $*/
$(document).ready(function(
){
var student=["Taufiq","Nat","Kyshon","David","Kedar","Micae","Aldair","Usman","Barry","Mathew"];
var teacher=["David","Josh","Thai","Enrico","Michael"];
var origin=Math.random();
var or2=origin*10;
var num=Math.floor(or2);
var or3=origin*5;
var num2=M... | true |
968b7f245c5c9948a72a5fc59ea69370cd75f1fb | JavaScript | Michael-Kent/jackercon | /awesome/web/resources/JackerConJS/DateView.js | UTF-8 | 1,116 | 2.71875 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | $(function() {
$('.timestamp').each(function(){
var timestamp=$( this ).html();
timestamp=new Date (timestamp);
if(timestamp==undefined)return;
if($(this).hasClass('start')){
console.log(timestamp.toLocaleTimeString());
$( this ).html(timestamp.toLocaleDateString()+'<br>'+timestamp.toLocaleTime... | true |