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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
041e849366afdd44f4cfdbc9965e9c55843444e8 | JavaScript | Digits88/cisco | /heartbeat/js/heartbeat.js | UTF-8 | 4,354 | 2.765625 | 3 | [] | no_license | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
(function(window, document, $) {
$(window).load(function() {
var c = document.getElementById('canvas'),
ctx = c.getContext('2d'),
cw = c.width = 300,
ch = ... | true |
76269487a75c834af279c42048d35d8a1e19b175 | JavaScript | kaitlynnprescott/Classes | /CS546/Labs/Lab2/index.js | UTF-8 | 877 | 3.234375 | 3 | [] | no_license | /************************************************************************************
* Name : index.js
* Author : Kaitlynn Prescott
* Date : Feb 2, 2017
* Description : CS-564 Lab 2: Modules and Basic Node
* Pledge : I pledge my honor that I have abided by the Stevens honor system.
******... | true |
f2ff6f7fb0ea79303355993c3b02a6a930926976 | JavaScript | Captain-Turk/react-1-afternoon | /src/components/Topics/FilterString.js | UTF-8 | 1,393 | 3.171875 | 3 | [] | no_license | import React, {Component} from 'react'
class FilterString extends Component{
constructor(){
super()
this.state = {
unfilteredArray: ['Honda', 'Toyota', 'Mazda', 'Subaru', 'Nissan', 'Acura','Lexus', 'Infinity'],
filterdArray:[],
userInput: ''
}
... | true |
c272a62c1bd337f425390239a4d9a65aa9e9f5b7 | JavaScript | isti2623/javascript-problem-solving | /41-triangle-area2.js | UTF-8 | 705 | 4.5625 | 5 | [] | no_license | // Find the area of a triangle where lengths of the three of its sides are 5, 6, 7
// herons formula states that the area of a triangle whose side have lenghts a, b, c
// area = Math.sqrt(s*((s-a)(s-b)(s-c))) a= side1, b = side2, c = side 3
// here s is semiperimeter of the triangle. rule of getting semiPerimeter
// ... | true |
869f2df5387b77fa80ea7b43962cbfb7c77f80b4 | JavaScript | smashdevcode/padnug-using-js-in-an-aspnet-world | /src/aspnetcore/04-client-side-modules/MusicCatalog/MusicCatalog/Scripts/albums.js | UTF-8 | 1,088 | 2.734375 | 3 | [] | no_license |
function getAlbumsHtml(albums) {
let html = '';
if (albums.length > 0) {
const albumsHtml = albums.map((album) => `
<div class="column is-half">
<div class="box">
<div class="columns">
<div class="column">
<figure class="image is-square">
... | true |
a29f8448d8c4af51aa55f3c448e3bd6ea62f9241 | JavaScript | pdehaan/fxa-notification-server | /lib/db/mem.js | UTF-8 | 878 | 2.71875 | 3 | [] | no_license | var db = []
function match(event, filter) {
var filterNames = Object.keys(filter)
for (var i = 0; i < filterNames.length; i++) {
var name = filterNames[i]
if (event[name] && event[name] === filter[name]) {
continue
}
else {
return false
}
}
return true
}
module.exports = {
ap... | true |
8ab7504cf8365e0d7891d4c2b65631defc1a92f2 | JavaScript | jeffleu/coding-challenges | /cracking-coding-interview/ch06-math-and-logic-puzzles.js | UTF-8 | 6,050 | 3.296875 | 3 | [] | no_license | /************************************************************************
6.1: THE HEAVY PILL
You have 20 bottles of pills. 19 bottles have 1.0 gram pills, but one
has pills of weight 1.1 grams. Given a scale that provides an exact
measurement, how would you find the heavy bottle? You can only use the
sca... | true |
276de24c06dae538ffbe8e1628df9f062d246b56 | JavaScript | Noguik06/colegio | /sistemaColegio/WebContent/resources/universales/js/validaciones.js | UTF-8 | 15,300 | 2.578125 | 3 | [] | no_license | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
var popupStatusP = 0
//Variable que guarda los valores iniciales de los campos.
var variableChange = 0;
//Variable para guardar los valores temporales de las letras
var variableLetras = null
//Variable para guardar ... | true |
a719873775f3156893beb64f0627d4eb1f2b14f7 | JavaScript | ericdleon/DTDb | /js/main.js | UTF-8 | 2,408 | 3.0625 | 3 | [] | no_license | function isEmpty(obj) {
return Object.keys(obj).length === 0;
}
$(document).ready(function() {
$(document).on('click', '.compare', function() {
var id = $(this).attr('rel');
var size_class = $('.card_check').length;
var pro1 = $('#card_one').val();
var pro2 = $('#card_two').val(... | true |
21c05c8d36d83c98c8d8caf8e668adf4418f6e16 | JavaScript | ecr007/Ajax-en-TinyMCE | /ejemplo.js | UTF-8 | 831 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | tinyMCE.init({
mode : "textareas",
theme : "advanced"
});
function ajaxLoad() {
var ed = tinyMCE.get('content');
// Do you ajax call here, window.setTimeout fakes ajax call
ed.setProgressState(1); // Show progress
window.setTimeout(function() {
ed.setProgressState(0); // Hide progress
... | true |
5fdc49699ef1b27d6e4eb2242cda20f885ab2327 | JavaScript | ZiPengYe/leetcode | /#167 Two Sum II - Input array is sorted.js | UTF-8 | 415 | 3.421875 | 3 | [
"MIT"
] | permissive | /**
* @param {number[]} numbers
* @param {number} target
* @return {number[]}
*/
const twoSum = (numbers, target) => {
let [left, right] = [0, numbers.length - 1];
while (left < right) {
const total = numbers[left] + numbers[right];
if (total === target) {
return [left + 1, right + 1];
} else ... | true |
13010c144f6494ce9ff21e0419f7f2175b999b93 | JavaScript | Shifty-eyed-llama/july_2020_algos | /week_1/group_4.js | UTF-8 | 5,380 | 4.125 | 4 | [] | no_license | function parensValid(string){
var count = 0;
for (var i = 0; i < string.length; i++){
if (string[i] === "(") {
count++
console.log(count)
} else if (string[i] === ")") {
count--
console.log(count)
}
// EARLY EXIT
if (count <... | true |
8db9d5237e38b560fe638c96593fefe85933bc2b | JavaScript | tomsonkan/411_wk1_day2 | /src/BeerCard.js | UTF-8 | 506 | 2.875 | 3 | [] | no_license | import React, { Component } from 'react';
class BeerCard extends Component {
state = {
isLiked: false
}
//opposite of blackButton for handleLiked function
handleLiked = () => {
this.setState({isLiked: !this.state.isLiked})
}
render() {
return <div>
The beer {this.props.beer}
<bu... | true |
9d33787aba4ce7d1fc9693193c4ba9848e02126c | JavaScript | alanpucci/CursoIngresoJS | /2-InstruccionIf/jsInstruccionIF-06.js | UTF-8 | 510 | 4.0625 | 4 | [] | no_license | /*
Alan Pucci
Al ingresar una edad debemos informar si la persona es mayor de edad (mas de 18 años) o adolescente
(entre 13 y 17 años) o niño (menor a 13 años).*/
function mostrar()
{
//Declaracion de variable
var edad;
//Inicializacion
edad = txtIdEdad.value;
//Parseo
edad = parseInt(edad);
//Condicional
... | true |
ebbae60468202f1480f991deee33cd98320ee1c7 | JavaScript | AgathaLynn/slack-fccbot | /controllers/actions.js | UTF-8 | 1,681 | 2.578125 | 3 | [
"MIT"
] | permissive | var express = require('express');
var router = express.Router();
var data = require('../models/access.js');
var format = require('../views/message/responses.js');
router.post('/', function(req, res) {
// turn payload into an object, please
var request_info = JSON.parse(req.body.payload);
// check verification ... | true |
265cb0b4f6e834830c42ba7a3507afc30f2819fe | JavaScript | aobin/redux-chat1 | /test/server/core_spec.js | UTF-8 | 1,332 | 2.625 | 3 | [] | no_license | /**
* Created by aobin on 10/8/2016.
*/
import {expect} from "chai";
import {v1} from "uuid";
import {fromJS,Map,List} from "immutable";
import {addRoom,removeRoom} from "../../src/server/core.js";
describe("rooms", ()=>{
it("添加room",()=>
{
let firstRoom = {name:"first room",id:v1(),owner:"aobin1"};... | true |
b7bf470b433a78adb50eb2e20fde76500f74d5aa | JavaScript | arunlodhi/designer | /src/dom-utils/dom-utils.js | UTF-8 | 5,201 | 2.640625 | 3 | [] | no_license | /**
* @license
* Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be f... | true |
211913164410a656346fc7b84724cb7cbd9a3213 | JavaScript | thechutrain/bamazon | /lib/queries/testing.js | UTF-8 | 355 | 2.515625 | 3 | [] | no_license | var Query = require("./queries");
require("console.table");
// Get all products
Query.getAllProducts().then((productsArray)=>{
console.table(productsArray);
}, (err)=> {console.log(err)})
// Get individual Product
Query.checkProduct(22).then((productObj)=>{
console.log(productObj);
}, (err)=> {console.log(err)})
... | true |
b3f502552d0451b0ffb3b57e034b587087069207 | JavaScript | TrilochanSahoo/Expense-Tracker | /src/components/Expense/Expenses.js | UTF-8 | 1,193 | 2.5625 | 3 | [] | no_license | import React, { useState } from 'react'
import ExpenseItem from './ExpenseItem'
import Card from '../UI/Card'
import ExpenseFilterYear from './ExpenseFilterYear'
import ExpenseChart from './ExpenseChart'
import './Expenses.css'
const Expenses = (props)=>{
const [filterYear,setFilterYear] = useState('2021')
fu... | true |
0520aa3d35a7e0ee00cd80055b0d22becd2bede5 | JavaScript | tvu20/pokesearch | /src/components/UI/ChartBar.js | UTF-8 | 860 | 2.703125 | 3 | [] | no_license | import './ChartBar.css';
// const MAX_STAT = 255;
const MAX_STAT = 150;
const ChartBar = props => {
let barFillHeight = '0%';
barFillHeight = Math.round((props.value / MAX_STAT) * 100) + '%';
const calculateLabel = () => {
if (props.label === 'hp') return 'HP';
else if (props.label === 'attack') retur... | true |
2cf12a92f12152a42223710866738501a3b15a8c | JavaScript | thinkful-ei-leopard/benjamin-matthew-dayTwo | /Obj_init_and_methods.js | UTF-8 | 134 | 3.046875 | 3 | [] | no_license | const loaf = {flour: 300, water: 210, hydration:(210 / 300 * 100)};
console.log(loaf.flour, loaf.water);
console.log(loaf.hydration); | true |
389713b30fdb8f4f0f93a4b86c5b194bc0aa204d | JavaScript | chulander/chutils | /test/safe.test.js | UTF-8 | 14,753 | 2.53125 | 3 | [
"MIT"
] | permissive | 'use strict'
/* eslint-disable no-unused-vars */
/* eslint-disable no-unused-expressions */
require('mocha')
const path = require('path')
const chai = require('chai')
const capitalize = require('capitalize')
const expect = chai.expect
const {
safe: {
assign,
get
}
} = require(path.resolve(__d... | true |
f1eae3755f66601530088b406c166f4567db7a72 | JavaScript | BBANG-GEUL/BBANG | /SPA/assets/js/user.js | UTF-8 | 2,025 | 2.5625 | 3 | [] | no_license | var user = {
auth:{
info:{}
},
onLoadEvent: function(){
//1. # hash data , basic function
var hashData = window.location.hash;
//2. except for #
var strBase64 = hashData.substr(1);
//3. decoding from hash to string
var decodedData = atob(strBase64);
//4. string -> object
var objData = $.parseJSON(d... | true |
f79b7fb4826969ca5e55cdddb316654f014b167c | JavaScript | ifpb/lp2-solutions | /ecma/function-sum/iago.vital/function-sum.js | UTF-8 | 164 | 3.703125 | 4 | [] | no_license | let x = 5
let y = 2
function soma(x,y){
x = parseInt(x)
y = parseInt(y)
let soma = x + y;
soma = parseInt(soma);
return soma;
}
console.log(soma(x,y)); | true |
a7d8dfb2459e3c11241c07738db0daf4e89cc543 | JavaScript | Alisalucy/node | /Context.js | UTF-8 | 1,550 | 3.03125 | 3 | [] | no_license | // 扩展模块
// 为req增加一个query属性,该属性中保存的就是用户get提交过来的数据
// 为req增加一个pathname
// 为res增加一个rander函数
var fs = require('fs');
var mime = require('mime');
var _ = require('underscore');
var url = require('url');
// 让当前模块对外暴露一个函数,通过这个函数将index.js中的req,res传递过来
module.exports = function(req,res){
var objurl = url.parse(req.ur... | true |
085eff04a22d3e2754c5838955080a57683b4f22 | JavaScript | sca4cs/My-Portfolio | /src/components/About.js | UTF-8 | 965 | 2.625 | 3 | [] | no_license | import React from "react";
import portfolioPic from "../assets/Cypress-photo-3.png";
const About = () => {
return (
<div className="about">
<img src={portfolioPic} className="portfolio-pic" alt="Shannon Atkinson"/>
<h3>About Shannon</h3>
<p>
Shannon has alway... | true |
605c083668b63aef63fc6756eb972dd229421ef8 | JavaScript | puiutucutu/js-functions | /src/list/reduce.js | UTF-8 | 558 | 2.90625 | 3 | [] | no_license | import { uncurry } from "./uncurry";
/**
* reduce :: ((a -> b) -> a) -> a -> [b] -> a
*
* @param {function(accumulator: T): function(currentValue: U)} reducer
* @return {function(accumulatorInitialValue: T): function(xs: U[]): (T|*)}
* @example
*
* reduce
* (acc => curr => acc + curr)
* (0)
* ([1, 2, 3... | true |
45803083cbd3716695f29eb1a353fa358c5b8eea | JavaScript | rocketgene/javascript-10 | /client/src/components/update-course.js | UTF-8 | 5,227 | 2.59375 | 3 | [
"MIT"
] | permissive | import React, {useState, useEffect, useContext} from 'react';
import { Link, useHistory } from 'react-router-dom';
import Data from '../Data';
import Context from '../Context'
import ErrorsDisplay from './errors-display';
import Forbidden from './forbidden'
export default function UpdateCourse({match}) {
//states... | true |
4dbc61a148a6c91d41a6d478acbdd78467a45f8b | JavaScript | Charlene76140/monportfolio | /src/professionnal/listprofessionnal/Listprofessionnal.js | UTF-8 | 1,011 | 2.53125 | 3 | [] | no_license | //I import the JSON file
import portfolio from '../../data/professionnal.json'
function Listprofessionnal () {
return (
<div>
{/* I browse the JSON array and for each object found I create a section */}
{portfolio.map((data) => {
return (
<div cl... | true |
c9b02993ded04dbc4d3f2f71aeba5d1686791eb0 | JavaScript | kbrowngithub/Project3 | /config/passport.js | UTF-8 | 1,767 | 2.734375 | 3 | [] | no_license | var passport = require("passport");
var LocalStrategy = require("passport-local").Strategy;
const bcrypt = require('bcryptjs');
var db = require("../models");
// Telling passport we want to use a Local Strategy. In other words, we want login with a username/email and password
passport.use(new LocalStrategy(
// Our u... | true |
c3c75578939a1aedbbc3f47b8c16f4d1b073cd96 | JavaScript | OpenDAWN/wavesjs-ui-basic | /shapes/Marker.js | UTF-8 | 2,615 | 2.859375 | 3 | [] | no_license | 'use strict'
function Marker(options) {
BaseShape.call(this, options);
}
Marker.prototype = Object.create(BaseShape.prototype);
Marker.prototype.constructor = Marker;
Marker.prototype.getClassName = function() {
return 'marker';
}
Marker.prototype._getAccessorList = function() {
return { x: 0, color: '#... | true |
9732464a0a9ee7a8ce78b05d86b3ce0a955ed00b | JavaScript | justiniv/txt2anime | /assets/js/Pub03252019.js | UTF-8 | 316,162 | 2.71875 | 3 | [] | no_license | $(function(){
// container is the DOM element;
// userText is the textbox
var container = $("#container");
var signal = $("#signal");
var price = $("#price");
var estimation = $("#expp");
var company = $("#company");
var exchange = $("#exchange");
var plano = $("#plano");
var capturer = new CCa... | true |
9ea65e6f0e309422213557289e41ae3ac81d4f61 | JavaScript | AAI-USZ/FixJS | /input/50/before/ead84418bb3c66e2abf8322d020cbb2820bac0b5_0_1.js | UTF-8 | 219 | 2.796875 | 3 | [
"MIT"
] | permissive | function (message) {
// Pretty message.
var console = console || {error: function() {}};
console.error(message); // See expand stacktrace for original error location.
throw message; // Stop execution
} | true |
7a2596d1a60acf3e06ad042f160f90397fd49d8f | JavaScript | MattMurn/Algo_Practice | /completed/chainAdd.js | UTF-8 | 693 | 3.375 | 3 | [] | no_license | add = x => {
let total = 0;
let f = y => {
// console.log(add(x+y))
total += y;
return f;
}
f = () => {
// console.log(x)
return total;
}
return f;
}
module.exports = add;
console.log(ad... | true |
f3a00130a5022a3b35570f9c3b7b9e3c8db97bac | JavaScript | CSCI-49900-Fall-2020/project-trainSE | /models/AIModel.js | UTF-8 | 958 | 2.578125 | 3 | [] | no_license | const mongoose = require("mongoose");
const Schema = mongoose.Schema;
const AISchema = new Schema({
resourceTitle: String,
resourceLink: String,
resourceType: String,
threadTitle: String,
threadLink: String,
repository: String,
repositoryLink: String,
difficultyLevel: String,
disciplineTitle: String,... | true |
27048b29afdcfb3f58debf8cff3801e167c550b3 | JavaScript | hskahlon/react-mern-app | /frontend/src/components/list-all.js | UTF-8 | 1,601 | 2.84375 | 3 | [] | no_license | import React, { useState, useEffect } from 'react';
import RectangleDataService from '../services/RectangleDataService'
const ListAll = props => {
const [rectangles, setRectangles] = useState([]);
useEffect(() => {
retriveRectangles();
}, []);
const retriveRectangles = () => {
Rect... | true |
e80140ba2c243291e3a38f8740202650abb7ef6d | JavaScript | MGelein/zgzy-dataparser | /parse.js | UTF-8 | 7,397 | 3.125 | 3 | [
"MIT"
] | permissive | //This holds the URL of the html MARKUS save file
let htmlFile = "";
//This holds the URL of the csv file
let csvFile = "";
//This holds the URL of the output file
let outputFile = "";
//Parse the command line arguments
if (process.argv.length < 4) {
print("There were too few arguments supplied to the utility. Abor... | true |
3fb2a27dd9106261ba5275da0634f8a54c232836 | JavaScript | tfeuerst/GFU-HTML5 | /assets/js/geolocation.js | UTF-8 | 620 | 3.1875 | 3 | [] | no_license | /**
* Geolocation Example
*/
// IIFE
!(function () {
'use strict';
// declaration
let
outputLat = document.querySelector('#latitude'),
outputLon = document.querySelector('#longitude');
// methods
function onWindowLoad(){
console.dir(navigator.geolocation);
navigator.geolocat... | true |
a62293f4ed48372017b55d3ea4a28889589ebe23 | JavaScript | tanazimmer/Project2 | /static/js/pie_obama.js | UTF-8 | 1,679 | 3.015625 | 3 | [] | no_license | // set the dimensions and margins of the graph
var width = 1000
height = 800
margin = 60
// The radius of the pieplot
var radius = Math.min(width, height) / 2 - margin
// append the svg object to the div called 'mapper'
var svg = d3.select("#obama")
.append("svg")
.attr("width", width)
.attr("height... | true |
8831eb9ddc818e869e2b92d8b13eeb43d5c70e55 | JavaScript | ChristoDai/DRzuanjie | /darry ring/brand culture/brand culture/js/culture.js | UTF-8 | 5,356 | 2.921875 | 3 | [] | no_license |
// 功能1 : 根据图片的个数.添加小圆点 ,并且第一个小圆点变红
//1.1 获取元素
var ul = document.querySelector('.box ul');
var ulis = ul.children; // 图片的个数
var ol = document.querySelector('.box ol');
//1.2 遍历图片的个数
for (var i = 0; i < ulis.length ; i++) {
//1.3 创建添加小圆点
//1.3.1... | true |
ea8cc67509bed7223b0c46eb7f4f2b02d2702314 | JavaScript | Hau-Do/setup-redux-and-middleware | /src/redux/reducer.js | UTF-8 | 563 | 2.734375 | 3 | [] | no_license | import { DECREMENT, INCREMENT } from "./actionConstant";
const initialState = {
count: 0
};
export const reducer = (state = initialState, action) => {
console.log('2. reducer - action: ', action);
switch(action.type){
case DECREMENT:
return {
...state,
count: state.count - 1,... | true |
f1faa840f96e061565485e68552cbf64b3ef8563 | JavaScript | dgarciajyz/healthyPork-server | /.history/service/NitrogenoMonoxidoCarbonoService_20191009124849.js | UTF-8 | 1,385 | 2.609375 | 3 | [] | no_license | 'use strict';
/**
* Eliminado de datos de No2Co.
* Eliminado un dato de No2Co en la base de datos.
*
* idNo2Underscoreco Integer Id del dato de No2Co
* returns String
**/
module.exports.deleteNo2Co = function(req, res, next) {
//Parameters
console.log(req);
res.send({
message: 'This is the m... | true |
35efa4701bff8025ccd38410852c76ac9aae2b14 | JavaScript | SamuraiRanderson/P3-Classic-Arcade-Game-Clone | /js/app.js | UTF-8 | 6,760 | 3.609375 | 4 | [] | no_license | var gameOver = false;
var tileHeight = 83; // Game tile height //
var tileWidth = 101; // Game tile width //
var leftLimit = 0; // x axis "Left" limit of canvas //
var rightLimit= 400; // x axis "Right" limit of canvas //
var upLimit = 80; // y axis "Up" limit of canvas //
var downLimit = 400; // y axis "Down" limit of... | true |
985ac947c0e996ae3699a157b63fe23ee47eba75 | JavaScript | potentialize/data_science_labs | /streams/read-from/array-stream.js | UTF-8 | 662 | 2.875 | 3 | [] | no_license | const { Readable } = require('stream')
const wait = require('../../helpers/wait')
const block = require('../../helpers/block')
// stream elements in array
class ArrayStream extends Readable {
constructor (data) {
super({
objectMode: true,
})
this.data = data // array
this.index = 0
}
// ... | true |
bac62bc0fc0c0ad700f79c8034c927b0a722c1be | JavaScript | OjasThanawala/PoC-for-Unified-Payments-System-USA | /UPUSA UI/upusa_ui/src/services/UserService.js | UTF-8 | 2,624 | 2.828125 | 3 | [] | no_license | /*Connects to the server running the UPUSA application and thereby performs relevant transactions.*/
export default class UserService {
static oneInstance = null;
static getInstance() {
if (UserService.oneInstance === null) {
UserService.oneInstance = new UserService();
}
return this.oneInstance;
};
//... | true |
bceae2c0209bb839c0056be375e38e141cd40cec | JavaScript | tlapfai/cs50_network | /network/static/network/index.js | UTF-8 | 4,230 | 2.78125 | 3 | [] | no_license | function post() {
const $body = document.querySelector('#input-area').value;
fetch('/new_post', {
method: 'POST',
body: JSON.stringify({
body: $body
})
});
//.then(response => response.json())
// .then(result => {
// console.log(result);
// });
}
fun... | true |
f93b1fe8fb69d416474d8b0a0dfed1f1da7085be | JavaScript | udayskai/Node_Repo | /Node_Assignment1/backend/index.js | UTF-8 | 3,001 | 2.90625 | 3 | [] | no_license |
const express= require('express') //import express module after install from "npm i express"
const app =express(); //know we create app by calling express as a function .
const port = process.env.NODE_ENV|| 4700;
app.use(express.json());
const songsNames=[
{id:1,Name:" Lagdi Lahore di",... | true |
811761af85996ef3a37cc58021cfa65b424b0a09 | JavaScript | Shoaib-Ahmed993/React-Series | /src/components/Hello.js | UTF-8 | 366 | 2.53125 | 3 | [] | no_license | import React from 'react'
// With JSX
// const Hello = () =>{
// return(
// <div className='Hello'>
// <h1>Hello Shoaib</h1>
// </div>
// )
// }
// Without JSX
const Hello = ()=>{
return(
React.createElement('div', {className: 'Hello'}, React.createElement('h1', null, '... | true |
9124f4414e5dcebc0c2f8361d36305648ec0ad20 | JavaScript | codercpf/tp312 | /Public/js/basic.js | UTF-8 | 430 | 2.65625 | 3 | [] | no_license | /**
* Created by Administrator on 2015/8/30.
*/
//alert("我被调用了!");
function sub(){
alert('你好');
var uname = document.myform.username;
var upass = document.myform.password;
var oc = document.myform.code1;
if(uname.value=='' || upass.value=='' || oc.value=='')
{
alert('用户名、密码、验证码都不能为空')... | true |
1570b3f63a640bc35d8a2a4e4576626be02aa8ac | JavaScript | saintlee/topology | /src/components/_node.js | UTF-8 | 1,579 | 2.515625 | 3 | [] | no_license | import _tip from './_tip';
import { radiusArea } from './_setting_area';
import { legendSys, radiusSys } from './_setting_sys';
/**
* 节点
* @param {*} data 数据
* @param {*} vis svg视图
*/
export default function (data, vis, type) {
// 创建node集合
let node = vis.selectAll('g.node')
.data(data.nodes); // UPDATE
... | true |
7db6eb0d041868b30e207fdf7bd1844c5390b434 | JavaScript | CaliCastle/calififi-wordpress-theme | /src/js/core.js | UTF-8 | 1,312 | 2.828125 | 3 | [] | no_license | import Vue from 'vue';
/**
* Bootstrap Vue
* @type {VueConstructor}
*/
window.Vue = Vue;
new Vue({
el: '#main',
data() {
return {
since: {
year: 2016,
month: 10,
day: 13
},
count: {
days: 0,
... | true |
7d4d69efd89cf5bf2c2a790016c05001bd2f84d8 | JavaScript | jcharfauros/Giphy-API | /script.js | UTF-8 | 2,506 | 3.015625 | 3 | [] | no_license | const baseURL = 'https://api.giphy.com/v1/gifs/search';
const randomURL = 'https://api.giphy.com/v1/gifs/random';
const randomStickerURL = 'https://api.giphy.com/v1/stickers/random';
const apiKey = 'jGkvhmeGrWFh4XDMnBzj5sjxbasRgVbo';
const displayFetch = document.getElementById('display-fetch');
const displayFetch2 = ... | true |
ffe49f4eb1f7eff32d8a6f44e4f082ebbf262f77 | JavaScript | ShenJinXiang/live | /source/nodejs/lessons/lesson3/pc01.js | UTF-8 | 244 | 2.546875 | 3 | [] | no_license | let http = require('http');
let url = 'http://www.shenjinxiang.com/js/main.js';
http.get(url, function (res) {
let data = '';
res.on('data', function (chunk) {
data += chunk;
});
res.on('end', function () {
console.log(data);
});
});
| true |
7c260cf390bfd7f5838c98291bb0e53e770b1b43 | JavaScript | JoeOst/news-report | /web/public/js/closePage.js | UTF-8 | 1,074 | 2.703125 | 3 | [
"BSD-3-Clause",
"MIT"
] | permissive | function Unloader(){
var o = this;
this.unload = function(evt)
{
var message = "Вы уверены, что хотите закрыть страницу?";
if (typeof evt == "undefined") {
evt = window.event;
}
if (evt) {
evt.returnValue = message;
}
return message;
... | true |
4a2a06fe930718941f573c60ab006fd2b1ae1690 | JavaScript | redeyes2015/junkcodes | /adventofcode/2015/day_22.js | UTF-8 | 4,208 | 3.1875 | 3 | [] | no_license | 'use strict';
const bossDamage = 10;
const bossInitHP = 71;
const playerInitHP = 50;
const playerInitMana = 500;
const theField = {
playerHP: playerInitHP,
playerMana: playerInitMana,
playerArmor: 0,
playerCostMana: 0,
bossHP: bossInitHP,
bossDamage: bossDamage,
history: [],
activeEffect: []
};
const... | true |
646db1f44fa6a92bb4b7edff9253e46f5afd981c | JavaScript | stdAlexTikhonov/dash_game | /src/predator.js | UTF-8 | 4,861 | 2.75 | 3 | [] | no_license | import {
EMPTY, PLAYER, UP, DOWN,
RIGHT, LEFT,
SCISSORS, ROCK, FOOD, ELECTRON, ORANGE_DISK, ORANGE_DISK_QUANTITY
} from "./constants";
import sprite3 from "./assets/images/sprite3.png";
import electron from "./assets/images/electron.png";
import { Player } from "./player";
export class Predator {
con... | true |
31d05f3f0d1a9cb0bab9d71210d88f0122962809 | JavaScript | BoraALAP/ersoy_web2018 | /dev/script/main.js | UTF-8 | 5,836 | 2.546875 | 3 | [
"MIT"
] | permissive | const app = {};
app.result = [];
app.imageCreater = (classes = "img_box",url,description, alt_des, collection = "moon") => {
const $img_container = $(".img_container");
let markup = `
<div class="${classes}">
<img class="img" alt="${alt_des}" src="assets/img/${url}.jpeg"/>
<di... | true |
2791a4b3c7549f5a7144012880c1a765391e6eb0 | JavaScript | astak16/Study-JS | /第三课/倒计时/js/main.js | UTF-8 | 1,213 | 3.359375 | 3 | [] | no_license |
var span = document.getElementsByTagName('span')
var input = document.getElementsByTagName('input')
var id
input[0].addEventListener('click',function () {
switch (this.value){
case '启动':
id = setInterval(updateTime,1000)
this.value = '取消'
break;
case '取消':
... | true |
aec8c9b37d135d659d9f2f0aa4d92e9a06a49272 | JavaScript | chengjingfeng/orange-wechat-barrage-system | /Utils/XML.js | UTF-8 | 1,052 | 2.65625 | 3 | [] | no_license | var xml2js = require('xml2js');
/**
*
* 解析xml数据为json格式
* @param {String} xmlstr
*/
function XmlToJson(xmlstr){
return new Promise((resolve,reject) => {
const parseString = xml2js.parseString;
parseString(xmlstr,(err,reslut) => {
if(err){
reject(err);
}e... | true |
b29484820d9eb3a3766bef00f3e2b05321cdd90f | JavaScript | Armando101/Curso-Java-Script | /31_JSParaReact/5_React/lib/react/src/React.js | UTF-8 | 694 | 2.828125 | 3 | [] | no_license | class Component {
constructor(props = {}, state = {}) {
this.props = props;
this.state = state;
}
update() {}
#updater() {
this.update(this.render());
this.componentDidUpdate();
}
/**
* Se manda a llamar antes que ser renderice el componente
*/
componentWilMount() {
}
/*... | true |
4e485b013062920fe87582ff166ed286555b01bc | JavaScript | thomthom/london-underground-travelnews | /src/LondonUndergroundTravelNews.gadget/js/updater.js | UTF-8 | 2,926 | 2.625 | 3 | [] | no_license | function updateCheck()
{
try
{
var http_request = new XMLHttpRequest(); // IE7 http request
// Error handle
if (!http_request) {
update_status('ERROR: new XMLHttpRequest()');
return false;
}
http_request.onreadystatechange = function() { updateHttp(http_request); };
http_request... | true |
943fa1654fb681f8b4f2c93ee43dd616081b0a5b | JavaScript | honcho-developer/COHORT2-LIVESCORE | /src/components/SideBar.js | UTF-8 | 493 | 2.5625 | 3 | [] | no_license | import React from "react";
// setting the props passed from app.js
const SideBar = props => {
// filtering the dublicated league name
const leaguename = [];
if (leaguename.includes(props.leagueName) ) {
return false;
}
else {
leaguename.push(props.leagueName);
}
// displaying the result
ret... | true |
42717a1050659ff78e1147e6c91b66af92cb27c1 | JavaScript | roloe25/testbuilder | /detectNetwork.js | UTF-8 | 3,127 | 3.671875 | 4 | [] | no_license | // Given a credit card number, this function should return a string with the
// name of a network, like 'MasterCard' or 'American Express'
// Example: detectNetwork('343456789012345') should return 'American Express'
// How can you tell one card network from another? Easy!
// There are two indicators:
// 1. The firs... | true |
febeb746187c995a412920f0bf2fc53bce1d9a4a | JavaScript | digideskio/js-ipfs-in-the-browser | /src/content-script.js | UTF-8 | 812 | 2.6875 | 3 | [
"MIT"
] | permissive | /* global browser, cloneInto */
console.log('declared a public ipfs object!')
const myPort = browser.runtime.connect({name: 'port-from-cs'})
const makeCall = (method, args, cb) => {
const listener = (m) => {
let { err, res } = m
if (res.on !== undefined) {
console.log('I think I got a stream')
c... | true |
4dd002e28dde83144dc1a8096601a8a12c9f37b1 | JavaScript | bibabooo/utils | /src/numtwo.js | UTF-8 | 300 | 2.6875 | 3 | [] | no_license | /**
* [numtwo 个位数字两位显示的处理]
*
* @param {Number} num [数字]
* @returns {String} [格式化后的数字]
*/
function numtwo(num) {
let numStr = num.toString();
return numStr.length === 1 ? (0 + numStr) : numStr;
}
export default numtwo;
| true |
f5b87fdc921bf0c33ad3201dcf5f4071c1d37c36 | JavaScript | jorgeld/filomax_pro | /js/imagenesBackground.js | UTF-8 | 576 | 2.734375 | 3 | [] | no_license | $(document).ready( function(){
var image_array= [
'url("./images/fondos/fachada.jpg',
'url("./images/fondos/img4.jpg',
'url("./images/fondos/bombilla.jpg',
'url("./images/fondos/img6.jpg',
'url("./images/fondos/img7.jpg'];
var image_index = 0;
var change_image = funct... | true |
90f66f8dc5c72991688945d17608255bd6f637bc | JavaScript | pluslicy/hande_crud | /src/store/saga.js | UTF-8 | 724 | 2.515625 | 3 | [] | no_license | // import { delay } from 'redux-saga'
import { call,takeEvery } from 'redux-saga/effects'
import axios from 'axios'
// 定义常量
import {
COMMIT_EDU
} from './action'
function saveEdu(param){
let url = 'http://127.0.0.1:8888/edu';
return axios.post(url,param);
}
export function* commitEdu(action) {
console.log('..... | true |
9f4d9e7c0384253dc7db09dd495b63694d6d272e | JavaScript | aya240/my-tasks | /pro13/js/j.js | UTF-8 | 3,862 | 3.484375 | 3 | [] | no_license | //first div
function add() //first function add two numbers
{
"use strict";
var num1 = document.getElementById("n1"),
num2 = document.getElementById("n2");
var d = Number(num1.value) + Number(num2.value);
if (isNaN(num1.value) || isNaN(num2.value))
{
document.getElementByI... | true |
1c3b11c595e08475b31796e7c33ceab1aad141c2 | JavaScript | perguth/pt2 | /views/send-file.js | UTF-8 | 698 | 3.046875 | 3 | [] | no_license | const html = require('choo/html')
const TITLE = 'pt2 - Send the file'
module.exports = view
function view (state, emit) {
if (state.title !== TITLE) emit(state.events.DOMTITLECHANGE, TITLE)
return html`
<body>
<p>Woow, you added file. So cool!</p>
<p>Please copy the following message and send it... | true |
6ffd9cb352cdcbd2141b04d5e6f47508e33c9341 | JavaScript | coderaiser/putout | /packages/plugin-tape/lib/convert-equal-to-ok/fixture/expected-fix.js | UTF-8 | 105 | 2.6875 | 3 | [
"MIT"
] | permissive | const expected = true;
t.ok(result);
const expectedString = 'hello';
t.equal(result, expectedString);
| true |
e2bbbc66f467c416a8f21aaafb653c3a0785efbb | JavaScript | HernandezJosze/Learning-HTML | /MiPaginaWeb/js/menu.js | UTF-8 | 179 | 2.53125 | 3 | [] | no_license | let btnMenu = document.getElementById("btn-menu");
let niv = document.getElementById("nav");
btnMenu.addEventListener("click", function(){
niv.classList.toggle("mostrar");
}); | true |
77caa10972df6ba6024057ba2dc102ad846e82d3 | JavaScript | ViniciusSararoli/Age-Sex-Javascript | /scriptex2.js | UTF-8 | 867 | 3.265625 | 3 | [
"MIT"
] | permissive | function verificacao() {
var data = new Date()
var anoAtual = data.getFullYear()
var anoNascimento = document.getElementById('anoNascimento')
var msgAlerta = document.getElementById('alerta')
var sexo = document.getElementsByName('sexo')
var imagem = document.getElementById('imagem')
if (anoNascimento... | true |
aefa7aa9f5a2bd76a7fb53c5a4f34b5ba0a85314 | JavaScript | DSRoden/Functions | /app.js | UTF-8 | 3,689 | 4.71875 | 5 | [] | no_license |
var prompt = require('sync-prompt').prompt;
//Incrementing Function
function increment(x) {
x++
return x;
}
var z = increment(3);
console.log(z);
var z = increment(7);
console.log(z);
var z = increment(9);
console.log(z);
var z = increment(12);
console.log(z);
// Squaring Function
function square(x) {
... | true |
31e964970c2c87111c64ad08d226600133c2148c | JavaScript | sarthyparty/forumapp_front | /src/QuestionDetail.js | UTF-8 | 5,686 | 2.640625 | 3 | [] | no_license |
import { Component } from'react';
import {convertDateTimeToString} from './ConvertDateTime'
import {url} from './ApiUrl'
class QuestionDetail extends Component {
constructor (){
super();
this.handleChangeEmail = this.handleChangeEmail.bind(this);
this.handleChangeContent = this.handleCha... | true |
e4870cd5ca07f915bf05ae7c8c1bb1f1ad18d85d | JavaScript | stnby/Kernel-Bot | /events/guildMemberRemove.js | UTF-8 | 613 | 2.546875 | 3 | [
"MIT"
] | permissive | // guildMemberRemove Event
const Discord = require("discord.js");
const settings = require("../settings.json");
module.exports = member => {
const logChannel = member.guild.channels.find("name", settings.logChannelName);
const embed = new Discord.RichEmbed()
.setAuthor(`${member.user.tag} (${member.user.id})`, me... | true |
6b6040e16201d99d6f539f6865be642cf83eb02f | JavaScript | ericafenyo/wild-movies | /src/data/Mapper.js | UTF-8 | 3,034 | 2.984375 | 3 | [
"MIT"
] | permissive | /**
* @license
* Copyright (C) 2019 Eric Afenyo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... | true |
175e9664e934b0202d58ce8488178f1de313b8fa | JavaScript | adrianpabloguerrero/INTERCONNECTION-NETWORKS | /slotMemoria.js | UTF-8 | 558 | 2.515625 | 3 | [] | no_license | class SlotMemoria {
constructor (id,nroEtapas){
this.id=id;
this.nroEtapas = nroEtapas;
this.puerto = new Puerto (this.getId() + "m");
this.mensaje = 0;
}
getId() {
var dir = this.id.toString(2);
while (dir.length<this.nroEtapas)
dir = '0'+dir;
return dir;
}
getMensaje (... | true |
db62f0858334b67d83c065c183f7de8054e4258a | JavaScript | iparkgood/codewars | /6kyu/toCamelCase.js | UTF-8 | 700 | 3.5 | 4 | [] | no_license | function toCamelCase(str) {
if (str === "") return "";
const words = str.replace(/(-|_)/g, " ").split(" ");
return words
.map((word, idx) =>
idx === 0 ? word : word[0].toUpperCase() + word.slice(1)
)
.join("");
}
console.log(toCamelCase(""));
// '', "An empty string was provided but not retur... | true |
c5e17782c9502b267af17fb32ab4985c000ec227 | JavaScript | jethanh/Front-end | /client/src/components/RegistrationForm.js | UTF-8 | 1,989 | 2.625 | 3 | [
"MIT"
] | permissive | //This component is a form used for creating a new pair of login credentials for a user that does not have an account yet
//form should have validation visible to user
//Form inputs should include:
//username
//password
//submit button
//This component is a form used for creating new login credentials for
// a user w... | true |
177e897c3024f3d4e6cf4c703b8d6d36fd1a544b | JavaScript | benkeen/table-indexer | /prototype.tableindexer-uncompressed.js | UTF-8 | 3,136 | 3.171875 | 3 | [] | no_license | /**
* Table Indexer
* ~~~~~~~~~~~~~
*
* A Prototype extension that changes the tab index for tabulated data between horizontal and
* vertical. In other words, when the user clicks the "tab" key, the next selected field is
* either the table cell *beneath* the current selected field or to the *right* of the next
... | true |
0572a3ac62710864a4d5e08967a990af34c458c3 | JavaScript | tommyyearginjr/p5_tutorial_coding_train | /2.2/p5/empty-example/sketch.js | UTF-8 | 294 | 3.15625 | 3 | [] | no_license | // var circX;
var circX = 150;
function setup() {
createCanvas(600, 400);
print('2.2');
// circX = 50;
}
function draw() {
background('yellow');
fill(255, 209, 204);
stroke('black');
ellipse(circX, 20, 20);
circX += 5;
noStroke();
fill('black');
text('2.2', 100, 300);
} | true |
7db27fdd73847c1be04116533931fd01b3f182f3 | JavaScript | 90secs/P4D | /Drawing 2.0/drawing2.js | UTF-8 | 2,671 | 3.171875 | 3 | [] | no_license | function setup() {
var cnv = createCanvas(400, 400);
//cnv.center();
}
function draw() {
//setup mouse input and colors
var x = mouseX;
var y = mouseY;
background(255 - x);
var color1 = color(113, 76, 254);
var color2 = color(239, 79, 166);
var color3 = color(144, 238, 2);
... | true |
6779c74675b58a5630d0b32939482f8ad5acb9f5 | JavaScript | akash-karwande/Program-practics | /example.js | UTF-8 | 167 | 2.828125 | 3 | [] | no_license | var date = new Date();
Date.parse(date);
console.log(date.toISOString());
var day = date.getDay();
var year = date.getFullYear();
console.log(day);
console.log(year);
| true |
fa95673d223cd89dab1d175068d56cbed9b2e37f | JavaScript | uncloudy/js_sandbox_pre | /02_variable/index.js | UTF-8 | 194 | 4.03125 | 4 | [
"MIT"
] | permissive | // variable : something can be changed
// a = 87;
// b = a - 7;
// console.log(b);
// 1. creat variable
// 2. initialize
// 3. use
let a = 87;
let b = a - 7;
a = 4;
console.log(b, a); //80 4
| true |
01e2ac8ffdeed6b4e9ae03dfd29e81ddf93c7377 | JavaScript | jferle/EKGI-WS19-akwiChangeProcess | /AKWI_website/js/modalDeleteFaculty.js | UTF-8 | 1,319 | 2.8125 | 3 | [
"MIT"
] | permissive |
// get Elemets: modal, button to open modal, button to close modal, form in the modal, hidden input elements message and data of the formular
var mdf = document.getElementById("modalDeleteFaculty");
var bdf = document.getElementById("btnDeleteFaculty");
var cdf = document.getElementById("closeDeleteFaculty");
var sdf ... | true |
eada84f044233cd9c0b3dfeade0906da4fbae1c6 | JavaScript | bi342k/Assignment2_PIAIC133739 | /Task9.js | UTF-8 | 312 | 3.8125 | 4 | [] | no_license | let yourCharacter = prompt('Enter character between A~Z or a~z').toLowerCase();
if (yourCharacter==='a' ||
yourCharacter==='e' ||
yourCharacter==='i' ||
yourCharacter==='o' ||
yourCharacter==='u')
{
document.write('<h1>It is VOWEL</h1>');
}
else{
document.write('<h1>FALSE</h1>');
}
| true |
8646e15555530cd13ef24171af367e1e74af6c8e | JavaScript | YasminTeles/ClinicAll | /src/reducers/appointmentReducer.js | UTF-8 | 1,247 | 2.75 | 3 | [
"MIT"
] | permissive | const initialState = {
doctor: {},
user: {},
doctors: [],
keyWords: "",
pain: 0,
humanBody: [],
annotations: [],
}
export const appointmentReducer = (state = initialState, action) => {
switch (action.type) {
case "ADD_DOCTOR":
return {
...state,
doctor: action.doctor,
}
... | true |
c436fb85e763ce167bcea235c21bacf5cac7dc77 | JavaScript | hovavo/Noodelify | /examples/Vibrate/script.js | UTF-8 | 1,996 | 2.53125 | 3 | [] | no_license | view.pause();
var parts = 9;
var volume = 1;
var level = 0;
var noo = new Noodle();
noo.loadSVG('../assets/dude3.svg', function () {
noo.position = view.center;
noo.stretchStart = 15;
noo.stretchEnd = 30;
divide();
view.play();
});
var rightSpeaker = speaker();
function speaker() {
// project.currentSt... | true |
fe195727c5955c6cacc6fc60e7d95449bfc0a8ed | JavaScript | nnupoor-zz/Leetcode-2 | /Leetcode/ES6/422.js | UTF-8 | 351 | 2.984375 | 3 | [] | no_license | var validWordSquare = function(words) {
if(!words.length || words.length !== words[0].length) return false;
for(let i = 0; i < words.length; ++i) {
let word = words[i];
for(let j = 0; j < word.length; ++j) {
if(!words[j] || !words[j][i] || words[j][i] !== word[j]) return false;
... | true |
0c0f31086c25bb680d06a73a39d4751925b378c3 | JavaScript | RugMar/js-train-price | /clock.js | UTF-8 | 277 | 3.109375 | 3 | [] | no_license | var data = new Date();
var ora = data.getHours();
var minuti = data.getMinutes();
var secondi = data.getSeconds();
document.getElementById("ore").innerHTML = ora;
document.getElementById("minuti").innerHTML = minuti;
document.getElementById("secondi").innerHTML = secondi;
| true |
3243a9d10bfa09be2b449249cf94dd76f65b217b | JavaScript | WBittner/League-Workout-Counter | /Workouts.js | UTF-8 | 1,397 | 2.921875 | 3 | [] | no_license | /**
* List of workouts
* To add a workout all that needs to be done is create a property with key as name and value as a
* function to calculate the workout on the exports object, then the backend will be able to accept
* the key as one of the indices of the workout array.
*/
module.exports = {
Pushups: getB... | true |
a36594d5d60c6a8edd9435b89135e451aeeb95ac | JavaScript | Darshanmesta/mulup | /controller/controller.js | UTF-8 | 1,369 | 2.515625 | 3 | [] | no_license | const multer=require('multer')
const path=require('path')
let Product=require('../model/model')
const storage= multer.diskStorage({
destination:(req,file,callback)=>{
callback(null,'uploads')
},
filename:(req,file,callback)=>{
callback(null,'Doc-'+Date.now()+path.extname(file.originalname))
... | true |
d5f139cec9dda2690980c84d1ca3171d1b53b6d6 | JavaScript | cshahabedin/Alphas-Eyewear-Test-Website | /script.js | UTF-8 | 2,732 | 2.515625 | 3 | [] | no_license | // Web Store sample objects
var AlphaIce = {
Picture_url: '<img src=https://cdn.shopify.com/s/files/1/0946/9912/products/right_9814645a-d2c7-433f-b0e2-8d249782b76d_1024x1024.jpg?v=1442899238.jpg>',
Title: "<b>Ice Edition</b>",
Author: "Alpha One",
ReleaseDate: 2015,
Category: "sunglasses",
Selling_points: '... | true |
c682c8c936ce148ad33cc8b574d89626715bbfe7 | JavaScript | athirasomanathan/todoserver | /todo.js | UTF-8 | 790 | 2.90625 | 3 | [] | no_license | function addTodo(todo){
console.log(todo);
}
let todos=[{id:0, name:"todo0", desc:"todo0 desc"},
{id:1, name:"todo1", desc:"todo1 desc"},
{id:2, name:"todo2", desc:"todo2 desc"},
{id:3, name:"todo3", desc:"todo3 desc"},
]
function addTodo(id){
todos.push({name:"todo1",desc:"todo1 desc"});
return todos;
}
fu... | true |
719e6fb3e4c94958c1fdcad4e422138b5e256bb3 | JavaScript | wecode-bootcamp-korea/17-2nd-Ourbnb-frontend | /src/Pages/Detailpage/Component/Dropdown.js | UTF-8 | 1,700 | 2.578125 | 3 | [] | no_license | import React, { useState } from 'react';
import styled from 'styled-components';
const Dropdown = props => {
const { maxPeople } = props;
const [count, setCount] = useState(1);
const handleIncrement = () => {
setCount(count + 1);
};
const handleDecrement = () => {
if (count > 1) {
setCount(cou... | true |
9e955e011427ae40850b7b6e406dc256c4d327d5 | JavaScript | Inukares/Leetcode-Questions | /Trees/Kth-Smallest-Element-in-a-BST.js | UTF-8 | 700 | 3.953125 | 4 | [] | no_license | /**
* Definition for a binary tree node.
* function TreeNode(val) {
* this.val = val;
* this.left = this.right = null;
* }
*/
/**
* @param {TreeNode} root
* @param {number} k
* @return {number}
*/
var kthSmallest = function(root, k) {
if(!root) return null
const sortedTree = sort(root, []);
... | true |
c24605915502625bc850525bcb252ed84b33ea47 | JavaScript | PaceCS/strings | /lowerCamelCase.js | UTF-8 | 1,934 | 4.84375 | 5 | [] | no_license | // The input to lowerCamelCase will be a string
// It will log the string as well as the string converted to lower camel case
function lowerCamelCase(inString) {
// First log the user's string
console.log();
// You will first separate the words by using the split method
const arr = inString.split(' ');... | true |
3174bd6615b9b9fd547a2ceecbd13781dd5644cf | JavaScript | jbnilles/galactic | /__tests__/calculator.test.js | UTF-8 | 2,544 | 3.234375 | 3 | [
"MIT"
] | permissive | import Calculator from '../src/calculator.js'
describe('Calculator', () => {
let calc;
beforeEach(() => {
calc = new Calculator(1,1,1, 'United_States');
calc.earthYears = 100;
});
test('should correctly calculate years on mercury given earth years', () => {
expect(calc.calcMercury()).toEqual(4... | true |
6df50d07e51678c7dd62a4110a0b729253a39305 | JavaScript | sumincy/MapleStory-RPG | /特殊/east_350130200.js | UTF-8 | 3,853 | 2.59375 | 3 | [] | no_license | // 全局变量
var status = -1; // status: 当前聊天交互轮数
var selectionLog = new Array(); // 记录每一轮的选择
var Message = "Message";
// 开头
function start() {
action(1, 0, 0);
}
function action(mode, type, selection) {
if (status == 0 && mode == 0) {
cm.dispose();
return;
}
if (cm.getInfoQuest(33990) == "check1=1;check2=1;check3... | true |
1bbe7760efad3b7c2c984f7476ba3306ab44735c | JavaScript | Sean12697/SW_Portfolios | /ArithmeticTaskRunner.js | UTF-8 | 1,227 | 3.671875 | 4 | [] | no_license | class ArithmeticTaskRunner {
constructor() {
this.tasks = [];
}
addNegationTask() {
this.tasks.push(x => -x);
}
addAdditionTask(y) {
this.tasks.push(x => x + y);
}
addMultiplicationTask(y) {
this.tasks.push(x => x * y);
}
get taskCount() {
retu... | true |