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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
47b9da5002c7f2543de6029c05e18c66e9ead546 | JavaScript | wp3416906469/Chorme | /date-format.js | UTF-8 | 1,318 | 3.078125 | 3 | [] | no_license | /* eslint-disable */
Date.prototype.format = function(pattern) {
let pad = function(source, length) {
let pre = '',
negative = source < 0,
string = String(Math.abs(source));
if (string.length < length) {
pre = new Array(length - string.length + 1).join('0');
}
return (negative ? '-... | true |
ab8ef0d5f292c3cf897526bbada5cf8ffeed5512 | JavaScript | rfcosta85/webModerno | /05-funcoes/exercicios/27-medindoCrianças.js | UTF-8 | 1,384 | 3.671875 | 4 | [] | no_license | function growth(kid1, kid2, kidAverage1, kidAverage2)
{
if(kid1 == kid2)
{
if(kidAverage1 > kidAverage2)
{
return 'A criança 1 ultrapassará a criança 2 em 1 ano.'
}else if(kidAverage1 < kidAverage2)
{
return 'A criança 2 ultrapassará a criança 1 em 1 ... | true |
55b872fe356145ac5788815f5336be260667692d | JavaScript | tavriaforever/dropdown-ui | /src/modules/events.js | UTF-8 | 1,955 | 3.25 | 3 | [
"MIT"
] | permissive | /**
* Модуль для кроссбраузерной подписки на DOM события
* - Современные браузеры - addEventListener/removeEventListener
* - IE8 - attachEvent/detachEvent
*
* Пример использования:
* var func = function() { alert('Ничоси');
* addEvent(elem, 'click', func});
* removeEvent(elem, 'click', func });
*/
var isSuppo... | true |
0c552ec6e12168745fe7ccaeb70852935902f7c3 | JavaScript | Q42/OculusUnrift | /static/js/cursor.js | UTF-8 | 1,583 | 3.0625 | 3 | [] | no_license |
var Cursor = function (x,y,fontSizeInPixels, widthInChars, heightInLines, charDelay) {
var self = this;
self.x = x;
self.y = y;
self.currentIndex = 0;
self.charDelay = charDelay || 50;
self.text = "";
self._pause = false;
function _outputText(text) {
// Clear the canvas
hud.clearRect(x, y, wi... | true |
ff9bcfe9e4f4ba7e636d9bb8de21cb3a62cc8e4a | JavaScript | loomnugget/lab-11-12-express-api | /claudia-lab/router/fruit-router.js | UTF-8 | 1,465 | 2.765625 | 3 | [] | no_license | 'use strict';
//creating the fruit Router
const Router = require('express').Router;
const jsonParser = require('body-parser').json();
const debug = require('debug')('fruit:server');
//app modules
const Fruit = require('../model/fruit.js');
//module constants
const fruitRouter = new Router();
//posts a created list
... | true |
ee9191bb84d9082ef6f58425f49790b5a2c8e4e0 | JavaScript | NinjAdina/oo-balls | /array-sketch.js | UTF-8 | 896 | 3.6875 | 4 | [] | no_license | var ballpit = [];
var updateAndDisplay = function(ball) {
ball.update();
ball.display();
};
setup = function() {
createCanvas(600, 400);
};
draw = function () {
background(100);
ballpit.forEach(updateAndDisplay);
//iterateFunctionally(ballpit);
//iterateWithWhileLoop(ballpit);
//iterateWithForLoop(ba... | true |
0ea77197548e250a161f0fa34f6d0d63dfb1918a | JavaScript | mattgstevens/hdwallet-interface | /example/derive-leaf-wallets.js | UTF-8 | 909 | 2.609375 | 3 | [] | no_license | // @flow
const bip39 = require('bip39')
const wallet = require('../src/wallet')
// $FlowIgnore: process.env key might be nil, but then we report the error
const orgRootHD = wallet.fromMnemonic(process.env.HDWALLET_MNEMONIC)
//
// Setup
//
const department0 = orgRootHD.derive("m/0'")
const department0Children = [
d... | true |
cac05566540ff9efe9979ab469373938df1f3027 | JavaScript | cloud-garden/cloud-garden.github.io | /js/getCurrentStateTopPage.js | UTF-8 | 2,851 | 2.71875 | 3 | [] | no_license | $(function(){
getPhoto();
setInterval(function(){
getPhoto();
},5000);
});
function getPhoto() {
var sendData = {user:"user1"};
$.getJSON("http://54.199.139.148/cloud_garden_server/api/getCurrentState", sendData, function(json){
var date = new Date(parseInt(json.date));
console.log(date);
$("#photo-view"... | true |
7288ce137969689fb4ca34dd2d08ba1fd58f7dbc | JavaScript | Enpas/js-burger | /js/script.js | UTF-8 | 2,551 | 3.28125 | 3 | [] | no_license | // dichiaro le variabili references
var priceElement = document.getElementById("price");
var nameUser = document.getElementById('name');
var ingredients = document.getElementsByClassName("ingredient-checkbox");
var button = document.getElementById('button');
var coupon = document.getElementById('coupon');
// dichiaro ... | true |
1ed8301435be5da55e289681e35ca886767a4066 | JavaScript | ByronLian/algorithm-javascript | /Leetcode/shortest-distance-to-a-character.js | UTF-8 | 1,031 | 3.5625 | 4 | [
"MIT"
] | permissive | // https://leetcode.com/problems/shortest-distance-to-a-character/
// Runtime: 80 ms, faster than 86.46% of JavaScript online submissions for Shortest Distance to a Character.
// Memory Usage: 38 MB, less than 58.95% of JavaScript online submissions for Shortest Distance to a Character.
/*
* @param {string} S
* @par... | true |
0e1e56b8b12ba1c3a812117e16e1935632eec91f | JavaScript | DmitryDor/JS_LESSON | /codeWars/index.js | UTF-8 | 13,818 | 4.21875 | 4 | [] | no_license | class Ball {
constructor(ballType) {
if (ballType) {
this.ballType = ballType
} else {
this.ballType = 'regular'
}
}
}
// 1 //В этом простом упражнении вы создадите программу, которая будет принимать два списка целых чисел a и b. Каждый список будет состоять из... | true |
16833206b40b1922c5ce125cfc0ff215199e58eb | JavaScript | kirantrainings/MEAN-STACK-BootcampJava0616 | /MyAssignment/assignment-3/index.js | UTF-8 | 601 | 3.84375 | 4 | [] | no_license | function countA(){
var sentence = "South America, North America, Asia";
var count = (sentence.match(/A/g)).length;
console.log(count);
}
function reverseString(){
var sentence = "South America, North America, Asia";
var reverse = sentence.split(" ").reverse().join(" ");
... | true |
9b4c04caccced54b933ddd0178176c1b7f9b69e6 | JavaScript | VladislavGudkov/BCIT_COURSES | /COMP_2015_Javascript/lab3/practice.js | UTF-8 | 3,428 | 3.53125 | 4 | [] | no_license | function welcomeVisitorToTheSite() {
// example welcome code
var username = prompt('Hello, what is your name?');
alert('Welcome to the site, ' + username + '!');
}
//window.onload = welcomeVisitorToTheSite();
function alertName(first, last) { // parameters are first and last
/*
Note: the variables called 'f... | true |
9e5d7a14816838d482e245bcc6b04767dfaceaf4 | JavaScript | lennym/choma | /index.js | UTF-8 | 1,280 | 2.9375 | 3 | [
"MIT"
] | permissive | 'use strict';
const Mocha = require('mocha');
const seedrandom = require('seedrandom');
const color = require('chalk');
const run = Mocha.prototype.run;
const each = Mocha.Suite.prototype.eachTest;
const prng = (function() {
const seed = process.env.CHOMA_SEED || createSeed(10);
console.log(`${color.grey('choma'... | true |
e238076fe384b75eb0b42e8c9e9e22e9982eb617 | JavaScript | JohnKearney2020/javascript | /EventListeners/learn-calculator/calculator/test.js | UTF-8 | 394 | 3.84375 | 4 | [] | no_license | // acronym - take letters and use reduce to create an acronym
function acronym(arr) {
return arr.reduce(((acc, currentElem) => acc + currentElem.slice(0,1)), '')
}
console.log(acronym(['very', 'important', 'person']))
// function acronym(arr) {
// return arr.reduce(((x, y) => x + y.slice(0, 1)), '').toUp... | true |
f1658dda6934a745f89b439e97eb4ffe9133359b | JavaScript | alice-lips/alice-lips.github.io | /resources/js/blink.js | UTF-8 | 620 | 2.78125 | 3 | [] | no_license | function start_blink() {
var a = document.getElementsByClassName('navigate-right')[0];
var b = document.getElementsByClassName('navigate-left')[0];
if (a !== null && b !== null) {
var doit = function() {
if (a.className.indexOf(' enabled') > 0) {
a.style.opacity = '1.0';
} else if (b.class... | true |
73c637500f93fa6668314c8a8bb46638be76d20b | JavaScript | Keyjey101/v-ede-ne-eva-eStore | /controllers/typeController.js | UTF-8 | 1,234 | 2.59375 | 3 | [] | no_license | const {Type} = require('../models/models')
const ApiError = require('../handlers/ApiError')
class TypeController {
//-----------------------------------CREATE----------------------------------//
async create(req, res){
const {name} = req.body
const type = await Type.create({name})
... | true |
ff9a66df69335fb2391fa18ca257a4a56d5ae2bf | JavaScript | hoangtd0904/FutureAcademy | /tut02/app.js | UTF-8 | 625 | 3.546875 | 4 | [] | no_license | let a = prompt("Enter age: ");
if(a == 0){
console.log("Tuổi không hợp lệ");
}
if(a < 0){
console.log("Số âm ");
} else{
console.log("Số dương và ");
if(a < 16){
console.log("Chưa đủ tuổi nhậu");
} else if(a > 16 && a < 18){
console.log("Đủ tuổi nhậu");
}
else{
con... | true |
d86b5cc3498bcb7701f1b66a759690756cc7fc03 | JavaScript | RockWu1108/web3-http | /app.js | UTF-8 | 2,722 | 2.6875 | 3 | [] | no_license | const express = require('express');
const app = express();
const path = require('path');
const ejs = require('ejs');
const bodyParser = require('body-parser');
const mongoose = require('mongoose');
const Employee = require('./models/employee');
//connect to mongoose
mongoose.connect("mongodb://localhost:27017/mydata... | true |
e8867ce808af23e1da189543d4cf64d18afcb2b6 | JavaScript | khoapham12397/kmp-react-project | /src/Example.js | UTF-8 | 1,624 | 3 | 3 | [] | no_license | import React from 'react';
export class Example extends React.Component{
constructor(props){
super(props);
this.act = 0; this.curR = 0; this.curC=1000;
this.keysPressed = new Map();
for(let i=37;i<41;i++) this.keysPressed.set(i,false);
this.state= {
r : 0,c: 1000
}
//alert(this.act);
//this.doOneth... | true |
ec72ee204d50621e4fa6fa4d5f3eeff9eedccb98 | JavaScript | qwe258722/answerstar | /src/parsers/gapfill.js | UTF-8 | 1,500 | 2.5625 | 3 | [
"MIT"
] | permissive | // @ts-check
/**
* @param {Element} elem
*/
function parse (elem) {
try {
// @ts-ignore
const type = elem.dataNode._type
if (type === 'gapfill') {
const id = elem.id.substr(3) // div${id}
const tmp = document.createElement('div')
tmp.innerHTML = elem.querySelector('.div_title_question... | true |
428ffbbcdcc785bbb8188b7659baee60a19f6750 | JavaScript | stupidehorizon/practice | /flight_ticket_booking/index.js | UTF-8 | 1,341 | 2.6875 | 3 | [] | no_license | const FlightInfo = require('./flight_info.js');
const FlightBookService = require('./flight_book_service.js');
// test1
const person1 = {
type: 'REWARD'
};
const itinerary1 = {
from: 'xian',
to: 'chengdu',
date: '20160410SUM'
};
// test2
const person2 = {
type: 'REGULAR'
};
const itinerary2 = {
from: 'c... | true |
0f4caad3293a17e0d5fabb7b53511446441de217 | JavaScript | obiora22/NodeSchool-Excercises | /learnyounode/http_json_api_server.js | UTF-8 | 985 | 2.84375 | 3 | [] | no_license | const http = require('http');
const url = require('url');
const server = http.createServer((req, res) => {
var url_obj = url.parse(req.url, true);
var timestamp = url_obj.query.iso;
var result = '';
// console.log(url_obj)
if (req.method === 'GET' ) {
switch (url_obj.pathname) {
case '/api/parsetim... | true |
6dfe767a14832a910c1f84710bd931ec06515617 | JavaScript | Keepsite/couch-cushion | /test/fields/bool.js | UTF-8 | 2,147 | 2.6875 | 3 | [] | no_license | 'use strict';
var Bool = require('../../src/fields/bool');
describe('BoolField', function() {
it('should construct', function(done) {
var field = new Bool();
field.should.have.property('get');
field.should.have.property('set');
field.should.have.property('options');
field... | true |
da7ef24239dc48fda69b7037760888a7ccb7afb8 | JavaScript | future4code/Felipe-Moura | /semana3/condicionais/index.js | UTF-8 | 9,424 | 4.03125 | 4 | [] | no_license | /* Exercício Interpretação de Código */
//Exercício 1
/* O código pede para o usuário digitar um número,
após a digitação desse número e o converte o que foi digitado para um número,
realiza a comparação para saber se o numero é par ou impar.
Caso seja par mostra a mensagem "Passou no teste" e caso seja ímpar... | true |
3485c47cc94c753f1bfdb2ec560d42682b47126e | JavaScript | Anantm007/D3-chart-dashboard | /app.js | UTF-8 | 2,908 | 3.234375 | 3 | [] | no_license | // Dummy data
const DUMMY_DATA = [
{ id: "d1", region: "USA", value: 10 },
{ id: "d2", region: "India", value: 12 },
{ id: "d3", region: "China", value: 11 },
{ id: "d4", region: "Germany", value: 6 },
];
// Chart dimensions and constants
const MARGINS = { top: 20, bottom: 10 };
const CHART_WIDTH = 600;
const ... | true |
f66a0b7fd31d2444f9ac59014af61879182242f6 | JavaScript | cienciascontic/simphet | /scenery/js/layers/LayerBoundary.js | UTF-8 | 2,443 | 2.8125 | 3 | [
"MIT"
] | permissive | // Copyright 2002-2013, University of Colorado
/**
* A conceptual boundary between layers, where it is optional to have information about a previous or next layer.
*
* @author Jonathan Olson <olsonsjc@gmail.com>
*/
define( function( require ) {
'use strict';
var scenery = require( 'SCENERY/scenery' );
... | true |
e7030cd87f372a7cf0e893e6b777f2402d786f14 | JavaScript | dayanidan007/mongoose-expenses | /dist/main.js | UTF-8 | 594 | 2.515625 | 3 | [] | no_license |
let expense = new ExpenseManger()
let renderer = new Renderer()
$('#render').on('click', async function () {
let data = await expense.getExpenses()
console.log(data)
renderer.renderExpenses(data)
})
$('#add').on('click', async function () {
const item = $('#item').val()
const amount = $('#amount'... | true |
04205e1b81fd31c50c8cab8fd868e67082400a6a | JavaScript | jeryqwq/Fundamentals-of-Compiling | /src/parser/util/Exception.js | UTF-8 | 205 | 2.515625 | 3 | [] | no_license | module.exports = class ParseException extends Error {
constructor(msg) {
super(msg)
}
static fromToken(token) {
return new ParseException(`Syntax Error , unexpected token in ${token}`)
}
}
| true |
ce4cc0e6a733d439d7e07b702644c17bea0e0ba1 | JavaScript | maxrenton/spring-boot-test-project | /src/main/webapp/js/script.js | UTF-8 | 2,371 | 3.265625 | 3 | [] | no_license | function getAllEmployees() {
$.ajax({
type: "GET",
url: "http://localhost:8080/employees",
dataType: "json", // data type of response
success: render,
error: function(jqXHR, textStatus, errorThrown) {
console.log(jqXHR, textStatus, errorThrown);
alert(... | true |
710effdca6c3b20b4cc5271dfb92ae145bc4a828 | JavaScript | linkqwd/weather-app | /src/scripts/Services/Utils.js | UTF-8 | 292 | 2.65625 | 3 | [] | no_license | export default class Utils {
static getTimeFromEpoch(
arg,
params = { hour: 'numeric', minute: 'numeric', hour12: false }
) {
const date = new Date(arg * 1000);
return date.toLocaleString('en-GB', params);
// https://learn.javascript.ru/intl#intl-datetimeformat
}
}
| true |
ce3fa6fc971c0c66b3091a4fe8ed29c3928236f2 | JavaScript | joshuamg41/lomoli | /pages/prueba.js | UTF-8 | 2,537 | 3.203125 | 3 | [] | no_license | import React, { useState, useEffect } from 'react';
import emailjs from 'emailjs-com';
const prueba = () => {
function sendEmail(e) {
e.preventDefault();
emailjs.sendForm('pruebas', 'template_07kp3eb', e.target, 'user_qAr5BuiH5kTLY6BG2owHe')
.then((result) => {
console.log(res... | true |
9f69a5cb10a906bdc0c0e3721ad870ad56b2051b | JavaScript | Elevationacademy/week-3-yarinamrani | /day-3/main.js | UTF-8 | 3,277 | 3.90625 | 4 | [] | no_license |
// // class Animal {
// // constructor(name, numLegs) {
// // this.name = name
// // this.numLegs = numLegs
// // }
// // }
// // const cat = new Animal("Puss", 4)
// // console.log("Hi , my name is " + cat.name + "i have " + cat.numLegs + " legs")
// // this = {}
// // this.name = "Puss"
// // this... | true |
1bcc37007c53ea8e6512178d12ddfce6feae8a2d | JavaScript | isoundy000/zen-3d | /build/zen3d.canvas2d.js | UTF-8 | 8,380 | 2.625 | 3 | [
"MIT"
] | permissive | (function() {
/**
* Canvas2D
*/
var Canvas2D = function(width, height) {
Canvas2D.superClass.constructor.call(this);
this.type = zen3d.OBJECT_TYPE.CANVAS2D;
this.geometry = new zen3d.Geometry();
this.geometry.vertexSize = 5;
this.geometry.vertexFormat = {
... | true |
06d27a2337a202ea35192c3ad2a65ade30de5777 | JavaScript | nick13jaremek/sql-hotel | /lib/managers/Stat.js | UTF-8 | 1,472 | 2.515625 | 3 | [] | no_license | /**
* Created by nickjaremek on 11/12/15.
*/
'use strict';
const errors = require('restify-errors');
function countRooms(dbHandler, callback) {
dbHandler.stat.count_number_of_items_in_rooms(function(error, countResult) {
if (error) {
return callback(new errors.BadRequestError(error.message
|| 'Co... | true |
7cfa527cdc381af79af61eb5769c3545b2aa9469 | JavaScript | kidder514/foodYouMiss | /app/reducers/userState.js | UTF-8 | 2,220 | 2.734375 | 3 | [] | no_license |
var initialUserState = {
userId: "",
avatarUrl: "",
userName: "",
email:"",
firstName: "",
lastName: "",
coordinate:[],
token: "",
userAddress:{},
currentAddress:{},
likes:[],
settings:{},
order:{},
currentPage:"",
isLoggedIn: false,
hasAddress: false,
rememberLogin: fals... | true |
58da2f145625a23bc59f2142b8443b1125416507 | JavaScript | ibra987654321/beeinfo-vue | /src/js/script.js | UTF-8 | 1,378 | 3.078125 | 3 | [
"MIT"
] | permissive | export const slider_show = (function() {
class SlideShow {
constructor(startIndex, element) {
this.startIndex = startIndex;
this.currentIndex = this.startIndex;
this.element = element;
this.slides = this.element.querySelectorAll(".slide");
this.setActiveSlide();
this.next();
... | true |
b1c6a93617e5f16ba99f9cf5d64c5473f01bfe6b | JavaScript | Big-Tunas/Bluefin-Mortgage-Service | /client/helpers/dollarFormat.js | UTF-8 | 301 | 2.84375 | 3 | [] | no_license | // takes a number and outputs pretty dollar format string
const dollarFormat = (number) => {
const formatter = new Intl.NumberFormat(('en-US'), {
style: 'decimal',
currency: 'USD',
maximumFractionDigits: 0,
});
return `$${formatter.format(number)}`;
};
export default dollarFormat;
| true |
b4acff4e1f9ed3dc825b6f8c2c567393e783c312 | JavaScript | cosminonnet/tp-docker-app | /index.js | UTF-8 | 592 | 2.578125 | 3 | [] | no_license | var express = require('express');
var RequestSender = require('./RequestSender.js');
// Constants
var DEFAULT_PORT = 3000;
var PORT = process.env.PORT || DEFAULT_PORT;
// App
var app = express();
app.get('/method', function (req, res) {
RequestSender
.send({
host: 'localhost',
port... | true |
c4f2887a93e6055b8427ba83f98d257ef9457e87 | JavaScript | cross1469/cryptoCurrency | /src/Redux/Reducers/coinDetailReducer.js | UTF-8 | 665 | 2.515625 | 3 | [] | no_license | import {
MARKET_PRICE_VALUE_HANDLE,
USDT_PRICE_VALUE_HANDLE,
COIN_PRICE_VALUE_HANDLE,
} from "../Actions/actionType";
const initialState = {
marketPrice: 0,
usdtQty: "",
coinQty: "",
};
export default function coinDetailReducer(state = initialState, action) {
switch (action.type) {
case MARKET_PRICE... | true |
ce3328fba8ff5a5d84393096ddd0587e834949c5 | JavaScript | mariyamihova/JS-Fundamentals | /JS Syntax - Lab/05StringOfNumbers.js | UTF-8 | 152 | 3.40625 | 3 | [] | no_license | function concatenateNums(n) {
let str='';
for(let i=1;i<=n;i++)
{
str+=i;
}
return str;
}
console.log(concatenateNums(22)); | true |
388f403801b90e3b86c4c8dbd97109a25d40c3ed | JavaScript | almedinhodzic/Froom | /frontend/src/components/profiles/profile/EducationForSingleProfile.jsx | UTF-8 | 610 | 2.578125 | 3 | [
"MIT"
] | permissive | import React from "react";
import moment from "moment";
// Education information for profile of any user. Simple table that show user's finished school and date of graduation. If user still studying or user did not provide any date of graduation, still studying is default.
const EducationForSingleProfile = ({ educatio... | true |
34c632ba0ab81518a97a130d7a72eea6681077a8 | JavaScript | kika75/hyf-homework | /javascript/javascript1/week2/WeatherWear/Weather_Wear.js | UTF-8 | 683 | 3.34375 | 3 | [] | no_license |
function matchClothesToWeather(temperature){
var temperature=0;
if ((temperature <=-20) && (temperature===0)){
matchClothesToWeather="wooly coat, warm hat and gloves";
}else if
((temperature >0) && (temperature <10)){
matchClothesToWeather="jacket, sweater and boots";
... | true |
b043355035ec326e59536f5f8b75e93a2497210c | JavaScript | Lasiorhine/inspiration-board | /src/components/Card.js | UTF-8 | 1,849 | 2.765625 | 3 | [] | no_license | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import axios from 'axios';
import emoji from 'emoji-dictionary';
import './Card.css';
class Card extends Component {
constructor(props) {
super();
this.state = {
cardId: props.cardID,
cardWorden: props.cardText,
... | true |
63ca623e66f2ef5c1592a05e4d07f0fb335c9c9a | JavaScript | santiagosemhan/el-cubo | /utils/Names.js | UTF-8 | 293 | 2.78125 | 3 | [] | no_license | const getCharacterName = (character) => {
if (character && typeof character === 'string') {
return character.split(' ')
.slice(-1)
.join(' ')
.trim()
.toLowerCase()
}
return null;
};
export default {
getCharacterName,
} | true |
9c46cc63cc04b3a53ce2d63998c7dddbda80fe1a | JavaScript | carol8421/web-sfm | /src/webmatcher/tracking.js | UTF-8 | 5,547 | 3.03125 | 3 | [] | no_license | 'use strict';
var _ = require('underscore');
//========================================================
exports.ConnectivityGraph = ConnectivityGraph;
exports.ConnectivityNode = ConnectivityNode;
exports.VisibilityGraph = VisibilityGraph;
/**
* @param {TwoViewMatches[]} matchTable
* @param pointTable
* @returns ... | true |
849c64ee4c392685b2350ef8074d69c9d006d4d6 | JavaScript | hapijs/cryptiles | /test/index.js | UTF-8 | 2,609 | 2.640625 | 3 | [
"BSD-3-Clause"
] | permissive | 'use strict';
const Code = require('@hapi/code');
const Cryptiles = require('..');
const Lab = require('@hapi/lab');
const internals = {};
const { describe, it } = exports.lab = Lab.script();
const expect = Code.expect;
describe('randomString()', () => {
it('should generate the right length string', () => {... | true |
4904c83ece37c415cf3adef7226dd30ab1b7a669 | JavaScript | itboos/today | /base/accumulation/ajax/ajax.js | UTF-8 | 2,968 | 2.65625 | 3 | [] | no_license | function ajax(type='GET', url='', data={}, _header, async=true){
//设置请求头,默认为 application/x-www-form-urlencoded
const header=_header || "application/x-www-form-urlencoded";
return new Promise((resolve, reject) => { //定义一个promise
type = type.toUpperCase();
let requestObj;
if (window.XMLHttpRequest) {
request... | true |
57b175db151f2d881b060183f84380dfd1f04291 | JavaScript | VicOhPNW/pig-dice | /js/scripts.js | UTF-8 | 1,602 | 3.4375 | 3 | [
"MIT"
] | permissive | // business logic
function Player(name, score) {
this.name = name;
this.score = [];
}
// user interface
$(document).ready(function(){
// set player starting score
var player1Start = 0;
var player2Start = 0;
// disply player score number
$("#player1-score").append(player1Start);
$("#player2-score").ap... | true |
e40c65837877820da7e75d4df695e30090948097 | JavaScript | Fantazer21/typical-arrays-problems | /src/index.js | UTF-8 | 793 | 3.484375 | 3 | [
"MIT"
] | permissive |
exports.min = function min (array) {
if (array == undefined|| array.length === 0) {
return 0;
}else {
var minimum = array[0]
for (var i = 0; i <= array.length; i++) {
if (array[i] <= minimum) {
minimum = array[i];
}
}return minimum;
}
}
exports.max = function max (array) {
if (array == undefined... | true |
0c319eac4dbd87b5fb2e1effdce933e2d0e69209 | JavaScript | efodi/moeshoprunner.github.io | /algorithms/js/recursion.js | UTF-8 | 1,513 | 4.09375 | 4 | [] | no_license | 'use strict';
(() => {
// const fibonacci = (num) => {
// console.log('invoked');
// if (num > 100) return false;
// num = fibonacci(num + 1);
// return num;
// };
//
// fibonacci(1);
const factorial = n => {
if ( n === 1 ) {
return 1;
}
... | true |
602f9c48f7c68a779fe0abd3f422cb8f8138484e | JavaScript | facebook/facebook-business-sdk-codegen | /templates/nodejs/src/exceptions.js | UTF-8 | 2,892 | 2.75 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-facebook-software-license"
] | permissive | /**
* Copyright (c) 2017-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
// request-promise error types
const REQUEST_ERROR = 'RequestError';
const STATUS_CODE_ERROR = 'Status... | true |
2d28f8b11d7a967ef0696f04d0451605425b4980 | JavaScript | NickoMas/test | /task_mac/js/script.js | UTF-8 | 1,638 | 3.25 | 3 | [] | no_license | "use strict"
const mainInput = document.querySelector(".enterMAC");
const inputReg = /[a-za-я\d:]+/ig;
const validateInput = function (event) {
let input = event.target.value;
const transliterate = function (value) {//e.data
//input is latin -> terminate function
if(/\w/gi.test(value)) {
return;
}
let... | true |
4e0f61c2da15e3a7112c2c7b18788edd0f4dacba | JavaScript | Chad1dahc/scope_and_closures | /src/ex_2.js | UTF-8 | 226 | 3.59375 | 4 | [] | no_license | let j
function foo() {
function bar(a) {
j = 3 // changing the `i` in the enclosing scope's for-loop
console.log( a + j )
}
for (let i=0; i<10; i++) {
bar( i * 2 ) // oops, infinite loop ahead!
}
}
foo()
| true |
40f0c3b8a1415e21c5fbe9ef8355a100934056db | JavaScript | Tahlil/BrainJackMac | /ActivityTracker.js | UTF-8 | 10,448 | 2.546875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"CC0-1.0"
] | permissive | const ioHook = require('iohook');
const monitor = require('./active-window');
const request = require('request');
const config = require('./config');
const browserHistory = require('./browserHistory');
module.exports = class ActivityTracker {
constructor(userId) {
this.activeWindowList = [];
... | true |
f40cc36907f46efb6c6e7e804f09a10a85d2b874 | JavaScript | vedranjaic/promc | /promc-web/src/js/localization.js | UTF-8 | 12,162 | 2.65625 | 3 | [] | no_license | // --- [ l10n.js ]
// On first load set language in cookie to 'hr'
// setCookie("promcLocale", "hr");
// Change language on dropdown
$('#lang-hr').click(function() {
setCookie("promcLocale", $(this).text().toLowerCase(), 365);
location.reload();
});
$('#lang-en').click(function() {
setCookie("promcLocale", $(this).t... | true |
784d5bbf307d39ad188c64fa36a01f51f50c3b7b | JavaScript | thefinancialclinic/dynamicFieldsLWC | /force-app/main/default/lwc/multiEditTable/multiEditTable.js | UTF-8 | 1,397 | 2.515625 | 3 | [
"MIT"
] | permissive | import { LightningElement, track, api } from 'lwc';
export default class MultiEditTable extends LightningElement {
@api columnList;
@api title
columns;
@track rows = [{ uuid: this.createUUID() }];
connectedCallback() {
let cleanedColumnList = this.columnList[0] === '\\' ? this.columnList.... | true |
01450c6f8c4f3195cff8406b732eb65b2a5a14af | JavaScript | watemei/p2pvps-server2 | /src/modules/users/controller.js | UTF-8 | 6,933 | 2.8125 | 3 | [
"MIT"
] | permissive | const User = require('../../models/users')
/**
* @api {post} /api/users Create a new user
* @apiPermission none
* @apiVersion 1.0.1
* @apiName CreateUser
* @apiGroup Users
*
* @apiExample Example usage:
* curl -H "Content-Type: application/json" -X POST -d '{ "user": { "username": "testuser", "password": "test... | true |
a28c7e001bc4d00fbf24314a318cdb2d890d2941 | JavaScript | winnemucca/easyCoderBytes | /arrays/main.js | UTF-8 | 1,432 | 3.671875 | 4 | [] | no_license | var hotel = {
name: 'quay',
rooms: 40,
booked: 25,
checkAvailability: function(){
return this.rooms - this.booked;
}
};
// var elName = document.getElementById('hotelName');
// elName.textContent = hotel.name;
// var elRooms =document.getElementById('rooms');
// elRooms.textContent =hotel.checkAvailability();
... | true |
8d9726df3ef343d50a5fc543cafc14113ef697fd | JavaScript | martinboykov/Training_2018-2019 | /Javascript/__FUNDAMENTALS/_Data_Structures_and_Algorithms/JavaScript_Algorithms_and_Data_Structures_Masterclass/26.Graphs/graphs.unweighted.directed.js | UTF-8 | 6,694 | 3.640625 | 4 | [] | no_license | // -------------------------
// UNWEIGHTED, DIRECTED GRAPH
// -------------------------
// DEFINITION
// ----------
// Data structure consisting of nodes(vertices) and edges
// Similar to Linked lists, trees, but withou values in the nodes
// TYPES
// -----
// Directed/Undirected - directions assigned to distanced be... | true |
749d628d75aec39faf8611698dd25cd3c73e7bc3 | JavaScript | Tanzorr/PetProjrctFront | /src/front_validator/index..js | UTF-8 | 299 | 2.796875 | 3 | [] | no_license | const Errors = [];
export let chekPassword = (pass1, pass2) => {
if (pass1 !== pass2) {
Errors.push("Password not equal");
return
} else if (pass1.lenght < 5) {
Errors.push("Password have to have more then 5 letters");
return;
}
}
export default Errors; | true |
06048fabd2b2fcb3f42f9fcb606df08a114bf741 | JavaScript | johnconlon/unbounce-static-hosting | /dist/sundae-universal-landing-page/u/sundae-universal-landing-u-main.js | UTF-8 | 2,751 | 2.53125 | 3 | [] | no_license | (function() {
function qs(key) {
key = key.replace(/[*+?^$.\[\]{}()|\\\/]/g, "\\$&"); // escape RegEx meta chars
var match = location.search.match(new RegExp("[?&]"+key+"=([^&]+)(&|$)"));
return match && decodeURIComponent(match[1].replace(/\+/g, " "));
}
function isNumber(n) {
return !isNaN(parseFloat(n)) ... | true |
4cf784840ec3392944b5e27f01a9badfb9a7ec28 | JavaScript | MilutinRadonjic/urlshortener | /index.js | UTF-8 | 2,089 | 2.65625 | 3 | [] | no_license | // connect to database
var mongo = require('./config/mongo.js');
// include Express js
var express = require('express');
var app = module.exports = express();
// include body-parser
var bodyParser = require('body-parser');
app.use(bodyParser.json());
// include cors
var cors = require('cors');
app.use(cors());
// i... | true |
0805da616761b99ffdbd221a6e54d2ba1798c857 | JavaScript | 779102260/branch-name-lint | /test.js | UTF-8 | 4,454 | 2.515625 | 3 | [
"MIT"
] | permissive | /* eslint-disable global-require */
const test = require('ava');
const sinon = require('sinon');
const BranchNameLint = require('.');
test('See that constructor have default options', (t) => {
const branchNameLint = new BranchNameLint();
t.truthy(branchNameLint.options);
t.is(branchNameLint.options.prefixes[0], ... | true |
5ae88c438940e270a633564cdd36fe1cfe9dc67c | JavaScript | rjrahul/granthapi | /routes/books.js | UTF-8 | 6,740 | 2.53125 | 3 | [] | no_license | "use strict";
/**
* Created by RJ on 3/15/15.
*
* Contains implementation for /religions/:religion/books and
* /religions/:religion/books/:bookId endpoints
*/
var express = require("express");
var logger = require("winston");
var router = express.Router({mergeParams: true});
var Db = require("../lib/Db.js")();
var... | true |
8932f7220dfae7530c642277804ba92ba1e9d822 | JavaScript | listentorick/SOL | /body.js | UTF-8 | 419 | 2.6875 | 3 | [] | no_license | var Body = function(c) {
this.name = c.name;
this.pos = Vector.create([c.x,c.y]);
this.acc = Vector.create([0,0]);
this.v = Vector.create([c.vx,c.vy]);
this.mass = c.mass;
this.radius = c.radius;
this.color = c.color;
}
Body.prototype = {
getX: function() {
return this.p... | true |
c732768a55de033dd7b36fa42ded73a0105a5152 | JavaScript | zigcccc/ForwardWebsite | /JS/Src/PageInteractions/HideEmptyParagraphs.js | UTF-8 | 327 | 2.859375 | 3 | [] | no_license | const hideEmptyParagraphs = function (paragraphs) {
paragraphs = Array.from(paragraphs)
for (let paragraph of paragraphs) {
let cond = paragraph.innerText.length > 1 ? true : false;
if(!cond && paragraph.innerHTML == ' '){
paragraph.style.display = 'none';
}
}
}
export default hideEmptyPar... | true |
5594c76ca4709452dec57cf4c80fe26ca48cf16d | JavaScript | Sushmeet/training | /expressMiddlewareTesting/express-in-action/1.http-server.js | UTF-8 | 480 | 2.890625 | 3 | [] | no_license | /*
Express is build up on Node's http module
Request ---> Request Handler ---> Response
*/
const http = require('http');
function requestHandler(req, res) {
if (req.url === '/home') {
console.log('req url', req.url);
res.end('home page')
} else if (req.url === '/about') {
console.... | true |
f95a012e338e525111e8cd14e189085b6dd74a62 | JavaScript | muse/Cubilors | /src/js/Event.js | UTF-8 | 1,038 | 2.78125 | 3 | [] | no_license | /*
* Event.js
* Copyright (C) 2015 Mirko van der Waal.
* Distributed under terms of the MIT license.
*/
/* Globally track the keydown events made which will then trigger events. */
window.addEventListener("keydown", function(e){
/* Here the code will be saved which is bound to a visual key. */
var cod... | true |
df8d13a82f149181a0ad00f4a050101f61e51f63 | JavaScript | s-sirchia/RicercaCompetenze | /ricerca_competenze/viewProjects/scriptProjects.js | UTF-8 | 414 | 2.625 | 3 | [] | no_license |
function checkProject(event){
var idprogetto;
var progetti = document.getElementsByName('proj');
for (i = 0; i < progetti.length; i++) {
if (progetti[i].checked == true) {
idprogetto = progetti[i].value;
}
}
if(idprogetto == null){
//window.location.replace("updateProj.php?idprogetto="+idp... | true |
4c3878158b94f78cf18799a346eca45fc07805f5 | JavaScript | aayushibansal2001/Navigate-the-Mars-Rover-Project | /Javascript files/Single destination/scriptSingleDestination.js | UTF-8 | 10,563 | 3.25 | 3 | [] | no_license | var maxRows = 15; //It denotes the total number of rows
var maxCols = 35; //It denotes the total number of columns
var source = [7, 10]; //It points to the source cell
var destination = [5, 20]; //It points to the destination cell
var movingSrc = false; //whether the source is moving or not
var movingDest = false; ////... | true |
601e60e5b222f1125f0df90da1fef8ff384a03d5 | JavaScript | Yuliyahedz/goit-js-hw-01 | /js/task-5.js | UTF-8 | 946 | 3.484375 | 3 | [] | no_license | let country = prompt(`В какую страну доставить товар?`);
let price;
let message;
if (country === null) {
console.log(message = `Отмена заказа`); }
else {
country = country.toUpperCase()
switch (country) {
case `КИТАЙ`:
price = 100;
break;
case `ЧИЛИ`: ... | true |
d0891197aadde0d08bd21899162d8cc326493303 | JavaScript | hanyang-4141/MyProject | /JS/答题/miniprogram/pages/measure/measure.js | UTF-8 | 4,237 | 2.53125 | 3 | [] | no_license | // pages/liangcheng/liangcheng.js
Page({
/**
* 页面的初始数据
*/
data: {
chuanshu_kind: ['电流mA', '电流A', '电压V'],
kind_index: 0,
ma_l: 4,
ma_h: 20,
liangcheng_l: null,
liangcheng_h: null,
current_value: null,
current_ma: null,
xishu_k: null,
xishu_b: null
},
king_change(e... | true |
a0f0e813966361eabcd20dc82608d72bb895eea1 | JavaScript | gagaprince/canvasApiDemo | /src/js/canvasApi.js | UTF-8 | 3,159 | 3.265625 | 3 | [] | no_license | /*
* 这是一个使用canvasApi的画图工具
* */
function DrawUtil(){
if(!(this instanceof DrawUtil)){
return new DrawUtil();
}else{
this.init();
}
}
DrawUtil.prototype={
canvas:null,
ctx:null,
width:0,
height:0,
init:function(){
this.canvas = document.getElementBy... | true |
c3f3b7940b1a950e1db4c738b4f7d98a2a0de8da | JavaScript | icemilk0122/ld29 | /src/GameState.js | UTF-8 | 9,238 | 2.734375 | 3 | [
"MIT"
] | permissive | var GameState = function(game) {
this.name = 'game';
};
GameState.prototype.create = function() {
G.setupStage();
this.resetGame();
this.game.input.keyboard.addKeyCapture([
Phaser.Keyboard.LEFT,
Phaser.Keyboard.RIGHT,
Phaser.Keyboard.UP,
Phaser.Keyboard.DOWN,
P... | true |
47d4d0cdda515e41b9cb4b10bdd4889967536dfc | JavaScript | darlanebrown/React-currency | /src/App.js | UTF-8 | 1,227 | 2.6875 | 3 | [] | no_license | import React, { Component } from 'react';
import './App.css';
import BarChart from './components/BarChart/BarChart';
import Nav from './components/Nav/Nav';
class App extends Component {
state = {
data: []
}
componentDidMount() {
fetch('https://api.exchangeratesapi.io/latest')
... | true |
292ccfe902b43aa1316a39a44e5688d777e8ef1e | JavaScript | hand-mabu/the-way-forward-react | /hzero-exercise/xiongling/account-management/app.js | UTF-8 | 1,961 | 2.625 | 3 | [] | no_license | /*
* @Description:
* @Date: 2019-08-12 21:44:31
* @Author: barret<ling.xiong@hand-china.com>
* @Copyright: Copyright (c) 2019, Hand
*/
let express = require("express"); // 加载express狗构造函数
let app = express(); // 生成创建服务的实例
let bodyParser = require("body-parser"); // 获取post请求参数
let users = require("./src/assets/json... | true |
2ee50cb74ef24a1eb5aa4313f8a214a5f942e116 | JavaScript | petert37/nodejs-homework | /middlewares/auth/loginMW.js | UTF-8 | 958 | 2.859375 | 3 | [] | no_license | /*
* Checks the username and password. If they are correct, signs in the user.
*/
const requireOption = require('../requireOption');
const wrapAsync = require('../wrapAsyncMW');
module.exports = (objectRepository) => wrapAsync(async (req, res, next) => {
const UserModel = requireOption(objectRepository, "UserMode... | true |
647eb98360d2d84921188d5dc1b2471b614280d2 | JavaScript | slbccfl/hackerrank | /javascript/two-pluses/solution.js | UTF-8 | 3,345 | 3.234375 | 3 | [] | no_license | 'use strict';
const fs = require('fs');
process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
// SLB: making rows and columns global variables since they are of common interest the functions in the solution
var rows;
var columns;
process.stdin.on('data', inputStdin =... | true |
22471416cea57f4bceafc6f5beefbad55718854d | JavaScript | robtoloy/naturetrak | /src/Countdown.js | UTF-8 | 930 | 2.9375 | 3 | [] | no_license | import React, { Component } from 'react'
import './App.css'
let countDownDate = new Date("Jan 1, 2018 00:00:00").getTime();
let x = setInterval(() => {
let now = new Date().getTime();
let distance = countDownDate - now;
let days = Math.floor(distance / (1000 * 60 * 60 * 24));
let hours = Math.floor((distan... | true |
a395152ba0da9ac90fa8ae76e319769d9c801fdb | JavaScript | EldhoseKuriakose/college-details | /controllers/student.controller.js | UTF-8 | 889 | 2.6875 | 3 | [] | no_license | //Require student model
const Student = require('../models/student.model');
//Creating student details
module.exports.createStudent = async function(req, res) {
try {
if(await req.body) {
let students = await Student.create({
studentId: req.body.studentId,
stude... | true |
c7b5e66fe27caa228de65b39e7cccbd1039341f0 | JavaScript | xzxldl55/rxjs-base | /aboutJS/quickSort.js | UTF-8 | 1,808 | 4.25 | 4 | [] | no_license | const quickSort = function (arr) {
const length = arr.length
if (length <= 1) return arr
const midIndex = Math.floor(length / 2)
const midValue = arr.splice(midIndex, 1)
const leftArr = []
const rightArr = []
arr.forEach(v => {
if (v < midValue) leftArr.push(v)
else rightArr... | true |
d691c8a44de454a43eefd9ad6cb53a8c46202840 | JavaScript | brentrobbins/graphene-modal | /src/js/cookie-example.js | UTF-8 | 1,140 | 3.09375 | 3 | [
"MIT"
] | permissive | // Fire the Cookie fucntion when the `graphene--modal-open` class is clicked
var classname = document.getElementsByClassName("graphene--modal-open");
for(i=0;i<classname.length;i++){
classname[i].addEventListener('click', function(e) {
// Trigger the cookie funcation when the open modal link/button has been... | true |
b26368c9b2576bc0bb24c058bbbe6a380a67d96a | JavaScript | moraesvic/davinci | /api/ChildProcess.js | UTF-8 | 540 | 2.59375 | 3 | [] | no_license | const ChildProcess = require("child_process");
function callback(err, stdout, stderr)
{
if(err) {
console.log(`Error. Process returned code ${err.code}`);
throw "Process exited with error code!";
}
return [err, stdout, stderr];
}
function chpr(cmd, args)
{
return new Promise( (resolve, reject) => {
ChildPr... | true |
0807f6f174ad880a6b71f909b57d2d1890a8065e | JavaScript | milosbunijevac/creditAppTakeHomeMilosB | /src/fetchCall/fetchCall.test.js | UTF-8 | 1,189 | 2.671875 | 3 | [
"MIT"
] | permissive | import mockFetch from "./fetchCall.js";
describe("Mock fetch call", () => {
describe("Positive tests", () => {
it("should return a successful message when user has adequate scores", async () => {
const testValue = await mockFetch(20000, 110000, 640);
expect(testValue).toBe("Success");
});
});
... | true |
fd53817eb4a08c08c7757a314c11a980f8701003 | JavaScript | noracurcio/Gym-Buff-Workout-Tracker | /routes/api-routes.js | UTF-8 | 1,090 | 2.515625 | 3 | [] | no_license |
const express = require('express')
const Workout = require('../models/workout')
const app = express()
//get last workout
app.get("/api/workouts/", function({ body }, res){
Workout.find()
.then(dbWorkout => {
res.json(dbWorkout)
}).catch(err => {
res.json(err)
... | true |
d80fbf66263c259a185cdb7b35c1c2ca14396415 | JavaScript | benzomedia/pornbookclub | /app/reducers/actors.js | UTF-8 | 816 | 2.625 | 3 | [] | no_license | /**
* Created by Benzo Media.
* http://www.benzomedia.com
* User: Oren Reuveni
* Date: 13/08/2016
* Time: 16:15
*/
import * as types from '../constants/actionTypes'
const defaultState = {
actors:[],
isLoading: false
}
function actors(state = defaultState, action){
switch(action.type){
case... | true |
2d845c8705487c60a22b1f20446d701023159e10 | JavaScript | zeakian/yelp | /middleware/index.js | UTF-8 | 1,220 | 2.765625 | 3 | [] | no_license | // **************************
// Middleware
// **************************
var Place = require("../models/place"),
Review = require("../models/review");
var middlewareObj = {};
// Check if user is logged in, if yes, allow them to access the page, else redirect to login form
middlewareObj.isLoggedIn = function(req,... | true |
e841af15d21ac9be980658a6fbbefe0b555a3549 | JavaScript | Mensro/P5 | /card.js | UTF-8 | 2,219 | 3.078125 | 3 | [] | no_license | function main() {
let cart = getProduct();
console.log(cart);
const elem = document.getElementById("showProduct");
console.log(elem);
if (cart === null) {
const panierVide = `
<div>
<div>Le panier est vide</div>
</div>
`;
elem.innerHTML = panierVide;
} else {
let panierHtml = ""... | true |
19b326a50975062401766a322f6838ec1c5dcc21 | JavaScript | stefanlazarevic/jseasy | /src/js/Array/array_union.js | UTF-8 | 735 | 3.09375 | 3 | [
"MIT"
] | permissive | const array_unique = require('./array_unique');
const array_flatten = require('./array_flatten');
const to_array = require('../Convertor/to_array');
/**
* Computes the union of the passed-in arrays or values:
* the list of unique items, in order, that are present in one or more of the arrays.
*
* @memberof module:... | true |
0e51c3419532ef8eda380d78ab70e04f67f35db8 | JavaScript | anascann/dice-roller-app | /App.js | UTF-8 | 2,064 | 2.734375 | 3 | [] | no_license | /**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow strict-local
*/
import React,{useState} from 'react';
import {
SafeAreaView,
StyleSheet,
ScrollView,
View,
Text,
StatusBar,
TouchableOpacity,
Touchable,
Image
} from 'react-native';
import DiceOne fro... | true |
2d4f9f8fa3aee419ba5c2445bd59e301d0a25c57 | JavaScript | YasminZanonBarg/JavaScript | /3- expressões e operadores/aula_8.js | UTF-8 | 433 | 4.59375 | 5 | [] | no_license | // Operadores lógicos (logical operators)
// - 2 valores booleanos, quando verificados,
// resultará em verdadeiro ou falso
let pao = true
let queijo = true
// AND && (tem que ser os dois true, pra dar verdadeiro)
console.log(pao && queijo)
// OR || (se um dos dois ser true, da verdadeiro)
console.log(pao || queijo... | true |
c7889e2b5a57fda7803dd1ff4c0e442fa116d282 | JavaScript | myfCode/blog | /寻找字符串出现次数最多的字符.js | UTF-8 | 1,680 | 3.953125 | 4 | [] | no_license |
/**
* 寻找字符串中出现次数最多的字符
* @param {String} str
*
* 利用对象key值的唯一性
* 字符串的每个字符,都在obj里加一个属性,如果再次出现obj[key]就加1
* 然后找出属性的值最大的
*/
//只能查到最多的一个,比如说最多有两个的可能就不能完全显示
let findMostTimesStr1 = function (str) {
if (typeof str !== 'string') {
throw new Error('params must be string')
}
let obj = {},
... | true |
d6cde1770e6f957d4ed5dbdd56210267a16301ac | JavaScript | bradbautista/dsa-recursion | /recursion-practice.js | UTF-8 | 9,790 | 4.53125 | 5 | [] | no_license | // For each of these exercises, without using any code, you are expected to identify the following:
// What is the input to the program?
// What is the output of the program?
// What is the input to each recursive call?
// What is the output of each recursive call?
// Start each problem by understandi... | true |
f8af323bfc8bb05274fb70af3839a187e21f855f | JavaScript | jaketrent/hello-alt | /lib/candidate-list.js | UTF-8 | 695 | 2.515625 | 3 | [] | no_license | import React from 'react'
import CandidateItem from './candidate-item'
export default class CandidateList extends React.Component {
hasCandidates() {
return this.props.candidates.length > 0
}
renderCandidate(candidate, i) {
return <CandidateItem key={i} candidate={candidate} />
}
renderCandidates(ca... | true |
db3956714764c224ac9b60a5a5e1c88ea0d8d0b5 | JavaScript | Jeyveen7/had-to-share-plugin | /gulp/tasks/release.js | UTF-8 | 1,040 | 2.515625 | 3 | [
"MIT"
] | permissive | var gulp = require('gulp');
var bump = require('gulp-bump');
var semver = require('semver');
var bumpTypes = ['major', 'minor', 'patch'];
for (var index in bumpTypes) {
var type = bumpTypes[index]; // patch / minor / major
// closure to hold on to 'type', as the task callback is deferred
(function(type) ... | true |
172922a196cee73d676b58e863f61c9c9e4d5539 | JavaScript | yangx7/Card | /src/components/card.js | UTF-8 | 328 | 2.53125 | 3 | [] | no_license | import React, { useState } from "react";
function Card(props) {
const [isFlipped, setIsFlipped] = useState(false);
const cardClass = `card${isFlipped ? " is__flipped" : ""}`;
return (
<div className={cardClass} onClick={() => setIsFlipped(!isFlipped)}>
{props.children}
</div>
);
}
export defaul... | true |
a08b361d6620da53c85bf55f9f7721aaaec9075a | JavaScript | johntheagent2/NekoBun | /commands/ban.js | UTF-8 | 874 | 2.53125 | 3 | [] | no_license | const { Message } = require("discord.js");
module.exports = {
name: "ban",
description: "this command ban a member",
execute(client, message, args) {
const member = message.mentions.users.first();
if (
message.member.roles.cache.has("813671956334641185") || //bot
message.member.roles.cache.ha... | true |
f038d2b08a700fecf697ed99fcf83f79cf8fc90d | JavaScript | paulalain/treesinparis | /tests/unit/services/open-data-paris-trees-service-test.js | UTF-8 | 2,450 | 2.53125 | 3 | [
"MIT"
] | permissive | import { moduleFor, test } from 'ember-qunit';
moduleFor('service:open-data-paris-trees-service', 'Unit | Service | open data paris trees', {
// Specify the other units that are required for this test.
// needs: ['service:foo']
});
test('service should return 50 rows', function(assert) {
var service = this.subj... | true |
78630676961d3130836fc63ba242a1a31027e2c3 | JavaScript | aminge/weekend-1-challenge-full-stack | /public/scripts/clientapp.js | UTF-8 | 3,082 | 3.15625 | 3 | [] | no_license | $(document).ready(function() {
loadEmployees();
updateTotal();
$('#employeeForm').on('submit', submitEmployee);
$('body').on('click', '.change-active-status', function() {
if ($(this).hasClass('active')) {
deactivateEmployee($(this));
} else if ($(this).hasClass('inactive')) {
activateEmployee($(this))... | true |