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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
dccbdf5be18a5d0c3bfdacd016c6450a22518dfd | JavaScript | Arnaud-Adon/unit-test-jest | /__test__/multiplication.test.js | UTF-8 | 330 | 2.75 | 3 | [] | no_license | import multiplication from "../src/multiplication";
describe("multiplication test suite", () => {
it("should return 90 when 10 multiply by 9", () => {
//Arrange
const value = 10;
const multiply = 9;
//Act
const result = multiplication(value, multiply);
// Assert
expect(result).toBe(90);
... | true |
f7c1612304574836a7261324ed00bdaad0a5d6ff | JavaScript | mahydit/equipment-demand-planner | /public/assets/js/admin/dashboard/rental_order.js | UTF-8 | 1,656 | 2.640625 | 3 | [] | no_license |
function showStationsDetails(date)
{
let url = Routing.generate('admin_rent_details_ajax', {
'date': date,
});
$.ajax({
url: url,
type: "GET",
dataType: "JSON",
success: function (data) { // Remove current options
$('#equipment_details').html('');
... | true |
25c39f1f0806241a7db8322ff72016af1170b97a | JavaScript | MaxGunter99/Sprint-Challenge--Testing | /games/games-router.js | UTF-8 | 782 | 2.65625 | 3 | [] | no_license |
//IMPORTS ⬇︎
const express = require( 'express' );
const router = express();
const games = require( './games-model' );
//GET ALL GAMES ⬇︎
router.get( '/' , async ( req , res ) => {
const rows = await games.getAll();
res.status( 200 ).json( rows );
});
//ADD ROUTE ⬇︎
router.post( '/' , ( req , res ) => {
... | true |
a92a2dd47ca2ea126d63c5e0c04202e4848a872d | JavaScript | michalittah/comment-feed | /app/routes.js | UTF-8 | 1,729 | 2.859375 | 3 | [
"MIT"
] | permissive | /**
* Created by Michal on 5/25/16.
*/
var Comment = require('./models/comment');
function getComments(res) {
Comment.find(function (err, comments) {
// if there is an error retrieving, send the error. nothing after res.send(err) will execute
if (err) {
res.send(err);
}
... | true |
067dc795f0c8e8781b17edadd13a64f75b17cc40 | JavaScript | shahafWebiks/WeatherMap | /public/city.js | UTF-8 | 2,885 | 2.890625 | 3 | [] | no_license | class City {
constructor(name = '', coordi = '') {
this.name = name;
this.coordi = coordi;
this.coordiMap = new Map();
}
coordiDraw() {
this.coordiMap.set('Tel Aviv,IL', [32.08, 34.78]);
this.coordiMap.set('New York,US', [40.73, -73.99]);
this.coordiMap.set('... | true |
782b1bdcbab49bbd8f631006c0e80e533b337713 | JavaScript | WellingtonMaia/login-jwt | /src/controllers/UserController.js | UTF-8 | 2,059 | 2.515625 | 3 | [] | no_license | const UserRepository = require('../repositories/UserRepository');
const repository = new UserRepository();
const ValidRequest = require('./validRequest/ValidRequest');
const CheckMailService = require('../services/CheckMailService');
class UserController {
static async index(req, res, next) {
try {
const u... | true |
6354e2d533bb21df0ca47a72e8e798c715085824 | JavaScript | ssam24/Javascript-GeekBook | /Arreglos&Bucles/ejercicio-10/script.js | UTF-8 | 376 | 2.921875 | 3 | [] | no_license | 'use strict'
let arbolitoNavidad = 0;
let cont = 1;
let triangulito ='▲';
let estrella = '★'
let tronco = '|';
arbolitoNavidad = prompt('De qué altura quires tu arbolito?');
console.log(arbolitoNavidad + estrella);
var acc = 0;
for (let i = 0; i < arbolitoNavidad; i++){
acc = acc + triangulito;
console.lo... | true |
a568be6412236c9d3142b0d6c840393cd7cf3774 | JavaScript | cecilioalvarez/escuelaTallerJunio | /Jonathan/spec/008-ParesWhile-spec.js | UTF-8 | 295 | 2.953125 | 3 | [] | no_license | describe("Pares Bucle For", function() {
it("Test suma 5 primeros pares", function() {
var total = 0;
var i=0;
while (i <5) {
console.log(i*2);
total = total + (i*2);
i++;
}
expect(total).toBe(20);
});
});
| true |
077fb8bb442c0582f2294edce956ad6373c3d880 | JavaScript | WonderMimi/P3-DublinBikes | /js/booking.js | UTF-8 | 1,340 | 3 | 3 | [] | no_license | function Form() {
this.init = function () {
displayForm();
validateForm();
cancelForm();
};
const displayForm = function () {
$("#book").on("click", function () {
$("#bookingForm").show();
$name = localStorage.getItem("formName");
$firstname = localStorage.getItem("formFirstname");
});
};
co... | true |
678e586990b8d8bf097fce585de989e8701944f8 | JavaScript | nes11/ToDoList | /test/todolistclass.test.js | UTF-8 | 3,964 | 3.15625 | 3 | [] | no_license | const expect = require('expect.js');
const TodoList = require('../lib/todolistclass')
describe('TodoList Class', () => {
const myTodoList = new TodoList();
it('it gives an object', () => {
expect(myTodoList).to.be.an('object');
});
it('it has add property', () => {
expect(myTodoList).to.have.property... | true |
edc86ba42b16922c368e2af00dc6e2e23262269b | JavaScript | iiian/lodash | /keyMany.js | UTF-8 | 1,236 | 3.140625 | 3 | [
"CC0-1.0",
"MIT"
] | permissive | import reduce from './reduce.js'
/**
* Creates an object composed of keys generated from the results of running
* each element of `collection` thru `iteratee`. The corresponding value of
* each key is an array of all elements which `iteratee` mapped to that key. The
* iteratee is invoked with two arguments: (value... | true |
d269220e6c1b9487a521530640bebe2e96f4ac30 | JavaScript | jeffreyhunter77/minimal-dom | /tests/lib/named-node-map-test.js | UTF-8 | 3,680 | 2.671875 | 3 | [
"MIT"
] | permissive | require('../setup');
var NamedNodeMap = require('../../lib/named-node-map')
, Attr = require('../../lib/attr')
, Element = require('../../lib/element')
;
describe(NamedNodeMap, () => {
prop('elem', function() { return new Element('div'); });
prop('map', function() { return new NamedNodeMap(this.elem); });... | true |
5de63b24fae465ba6ba16ed71cec8dbd9f41e8c3 | JavaScript | hjzy-123/hjzy | /rtpServer/src/main/resources/js/allInfoPage.js | UTF-8 | 700 | 2.546875 | 3 | [
"MIT"
] | permissive | $(function () {
var time;
var start = function(){
time = setInterval(function () {
$.ajax({
type: 'get',
url: '/theia/rtpServer/api/getAllInfo',
dataType: 'json',
data: '',
success: function (data) {
console.log(data)
var tableHtml = template(... | true |
6014bbe2ffd893275e6d9e5152613bdf3a27d167 | JavaScript | abartsev/learn-english | /src/components/List/List.jsx | UTF-8 | 820 | 2.65625 | 3 | [] | no_license | import React, { Component, Fragment } from 'react'
import './list.css'
import Server from '../../server'
const server = new Server()
class List extends Component {
state = {
list:{}
}
componentDidMount() {
server.getList().then(list => {
this.setState({list})
})
}
... | true |
4db7a2fea30084471f7432694c7bcc2417e54265 | JavaScript | sids-silly-songs/w03-graph-algorithms | /lib/breadthFirstSearch.js | UTF-8 | 1,900 | 3.34375 | 3 | [] | no_license | function breadthFirstSearch (graph, start, end) {
// if start and/or end are not provied return false
graph = graph || {}
start = start === undefined ? '' : start
end = end === undefined ? '' : end
const visited = {}
const todo = [start]
let currNode, children
while (todo.length > 0) {
// grab he... | true |
846ac1576980e041ffd17bf9da061834648bd557 | JavaScript | JessicaCP25/FLUJO-DE-CAJA | /forms.js | UTF-8 | 3,123 | 2.9375 | 3 | [] | no_license |
function createInput(id, placeholder = "", type = "text", clase = "") {
const $inputContainer = document.createElement("div");
$inputContainer.setAttribute("class", "mb-3");
const $label = document.createElement("label");
$label.setAttribute("class", "form-label");
$label.setAttribute("for", id);
$label.te... | true |
1220477caadc4164f4d14bef24c26dbe93bf97fe | JavaScript | jkitsao/Road-alert | /js/addIncidents.js | UTF-8 | 875 | 3.0625 | 3 | [] | no_license | const myform = document.getElementById("iform");
const name = document.getElementById("form3");
const description = document.getElementById("form32");
const address = document.getElementById("form8");
// Send POST to API to add store
async function addStore(e) {
e.preventDefault();
const sendBody = {
name: na... | true |
f4683acccaa0949957cf4433aec11f5558278df5 | JavaScript | tcvduc/hackerrank | /DataStructures/LinkedListProblems/8.Merge two sorted linked lists.js | UTF-8 | 2,384 | 3.609375 | 4 | [] | no_license | "use strict";
const fs = require("fs");
process.stdin.resume();
process.stdin.setEncoding("utf-8");
let inputString = "";
let currentLine = 0;
process.stdin.on("data", (inputStdin) => {
inputString += inputStdin;
});
process.on("SIGINT", (_) => {
inputString = inputString
.replace(/\s*$/, "")
.split("\... | true |
ddd8307ba3ea81585ee652f51e523de122162420 | JavaScript | Noble-Webb/empowered_people_app | /src/components/TileDraw.js | UTF-8 | 1,372 | 2.75 | 3 | [] | no_license | import TileSet from '../container/Assets/Tilesets/TileSet.png'
class TileDraw {
constructor(map) {
this.map = map
this.width = this.map.length * 16;
this.height = this.map.length * 16;
this.canvas = document.getElementById("buffer-canvas");
this.tiles = document.getElementById("tile... | true |
80cc0ba9af059ca9545431ba58c2d002ad157259 | JavaScript | tcote19/constructor-example | /programmerConstruct.js | UTF-8 | 818 | 3.5 | 4 | [] | no_license | var inquiry = require("inquirer");
function Programmer(name, position, age, language){
this.name = name;
this.position = position;
this.age = age;
this.language = language;
};
Programmer.prototype.printInfo = function(){
console.log("Name: "+this.name);
console.log("Position: "+this.position);
console.log("Age:... | true |
3437d2b3fc9adfe253d973a90db88da6d00f320a | JavaScript | vihaton/fullstack19 | /osa5/bloglist-frontend/src/components/BlogForm.js | UTF-8 | 1,524 | 2.578125 | 3 | [] | no_license |
import React from 'react'
import { connect } from 'react-redux'
import blogService from '../services/blogs'
import { initBlogs } from '../reducers/blogsReducer'
import { updateNotification } from '../reducers/notificationReducer'
const BlogForm = (props) => {
const addBlog = async (event) => {
event.preventDe... | true |
5b260e68c1c90211b70112d904bce2661a2fb0f0 | JavaScript | bettymakes/learning-javascript-exercises | /02-lesson_exercise-if-else.js | UTF-8 | 3,358 | 4.5625 | 5 | [] | no_license | // Lesson: 2
// Exercises: If/Else Statements
// URL: http://www.teaching-materials.org/javascript/exercises/ifelse.html
// What number's bigger?
function greaterNum(num1, num2) {
if (num1 > num2) {
console.log("The greater number of " + num1 + " and "+ num2 + " is " + num1 + ".");
return num1;
} else if (num2 ... | true |
1f06043d852165778eddaf95c56348413a7bac3d | JavaScript | FrankZTH/OEC-info | /js/donate.js | UTF-8 | 635 | 2.515625 | 3 | [
"MIT"
] | permissive |
function sendAll(form){
debugger;
let moneyText = form.money.value;
let cardText = form.cardNumber.value;
let emailText = form.email.value;
let nameText = form.name.value;
let identityCardText = form.identityCard.value;
let phoneText = form.phone.value;
let donateRef = firebase.database().ref('donate');
... | true |
d544fa3ce506f9bfdceff2ee33b11a92d8b616da | JavaScript | kharleb50/habit-tracker-app | /src/api/appearance.js | UTF-8 | 2,444 | 2.671875 | 3 | [
"MIT"
] | permissive | import { useFirebase } from 'context/firebase-context';
import { useAuth } from 'context/auth-context';
import { getColor } from 'theme';
/**
* Use update theme hook
*
* @returns a function that updates user's theme in the database.
* The function takes as an argument new theme object.
*/
export function useUpda... | true |
d5a008900b5f17eb49d2cafbab47396ff20ae570 | JavaScript | UXFoundry/hashdo | /public/js/lazy.js | UTF-8 | 468 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | /* global data */
function lload(cardId) {
'use strict';
var nodes = window.document.querySelectorAll('#' + cardId + ' [data-src]');
if (nodes.length === undefined) {
nodes = [nodes];
}
var i = 0,
len = nodes.length,
node;
for (i; i < len; i += 1) {
node = nodes[i];
node[node.tagNam... | true |
4e3df8051b755e7718a7131f645e6d51cf78f2ac | JavaScript | mrlhumphreys/jboardgame | /src/vector.js | UTF-8 | 2,326 | 3.53125 | 4 | [
"MIT"
] | permissive | import Direction from './direction';
/** A Vector represented by two points */
class Vector {
/**
* Create a Vector.
* @param {Point} pointA - The origin point.
* @param {Point} pointB - The destination point.
*/
constructor(pointA, pointB) {
/** @member {Point} */
this.pointA = pointA;
/... | true |
3efc7c72a711bfbbeb16f818aac8f351ba67538f | JavaScript | EdwinGarden/NodeJS-Examples | /node-express/routes/dishRouter.js | UTF-8 | 1,814 | 2.90625 | 3 | [] | no_license | // handle endpoint for /dashes and /dishId
const express = require('express');
const bodyParser = require('body-parser');
const dishRouter = express.Router();
dishRouter.use(bodyParser.json());
// can chain all of the operations to the route
// I guess that you can do it all separately as well
dishRouter.route('/'... | true |
bb0d9205f5c493eeeb80a4f343d0688170533371 | JavaScript | Zepoze/terminal-manladag | /terminal-ui.js | UTF-8 | 5,021 | 2.703125 | 3 | [] | no_license | 'use strict';
const fs = require('fs')
const Path = require('path')
const PathDownload = Path.join(__dirname,'Mangas')
const consola = require('consola')
var inquirer = require('inquirer');
function createChapterFolder(source,manga_index,chap) {
let dir
if (!fs.existsSync(dir = `${PathDownload}`)){
... | true |
2bb6d937933828a8276d55ae8951330c15ea3124 | JavaScript | aniruddhanath/webrtc_chat | /client/src/js/stores/MessagesStore.js | UTF-8 | 1,172 | 2.59375 | 3 | [] | no_license | import { EventEmitter } from "events";
import dispatcher from "../dispatcher";
class MessagesStore extends EventEmitter {
constructor() {
super();
this.messages = [];
this.typing = false;
}
all() {
return this.messages;
}
reset() {
this.messages = [];
this.typing = false;
}
pee... | true |
0e78e3e0e654418b1a61e20ba55dedb9b34370c5 | JavaScript | supphawit/PythaAdventure | /client/js/login_google.js | UTF-8 | 911 | 2.65625 | 3 | [] | no_license |
function onSignIn(googleUser) {
var profile = googleUser.getBasicProfile();
console.log('ID: ' + profile.getId()); // Do not send to your backend! Use an ID token instead.
console.log('Name: ' + profile.getName());
console.log('Image URL: ' + profile.getImageUrl());
console.log('Email: ' + profile.getEmail()... | true |
a51aeeca479f80610d3dd3aabfe826324341e20f | JavaScript | pastrybot/superheroes_crud | /client/src/heroes/EditHeroContainer.js | UTF-8 | 3,367 | 2.84375 | 3 | [] | no_license | import React, { Component } from 'react';
import EditHeroForm from './EditHeroForm';
import $ from 'jquery';
import { browserHistory } from 'react-router';
class EditHeroContainer extends Component{
state= {
isFetching: true,
name: undefined,
superPowers: undefined,
universe: undefined,
evil: un... | true |
7848b957993ceb2acdcc3e5d986e1c5d97cf950f | JavaScript | CodingDojoOnline-Nov2016/CandraDavis | /algorithms/chapter3/removeDuplicates.js | UTF-8 | 705 | 4.21875 | 4 | [] | no_license | // Sara is looking to hire an awesome web developer and has received applications from various sources. Her assistant alphabetized them but noticed some duplicates. Given a sorted array, remove duplicate values. Because array elements are already in order, all duplicate values will be grouped together. As with all thes... | true |
1ddfb70c2b4ac15af3103ca338d59cdaa1a0bc78 | JavaScript | ChocolateCircus445/idaddy | /daddy.js | UTF-8 | 1,621 | 3.15625 | 3 | [] | no_license | const responses = ["I\'m daddy", "Haha, nice one, sweetheart!"];
const specialResponse = ["i love you", "i love u", "i wuv you", "i wuv u"];
function send() {
var t = document.getElementById('daddyTextBox');
var tv = t.value;
if (tv != '') {
var hourminute;
t.value = '';
document.getElementById('daddy... | true |
3a0ff521934359863ca9895d2739dfb32cdda113 | JavaScript | buxlabs/pure-utilities | /array/sample.js | UTF-8 | 138 | 2.84375 | 3 | [
"MIT"
] | permissive | function sample (array) {
const index = Math.floor(Math.random() * (array.length - 1))
return array[index]
}
module.exports = sample
| true |
743b064558334da507060f3e5dc1f14a68d63a09 | JavaScript | agustinxmtz/Team-Profile-Generator | /__test__/Engineer.test.js | UTF-8 | 835 | 3.265625 | 3 | [
"MIT"
] | permissive | //tests for the Engineer class. tests object creation and each of the class methods.
const Engineer = require('../lib/Engineer');
test('creates an Engineer object', () => {
const engineer = new Engineer('Creed', 122, 'creed@dunder-mifflin.com', 'creedthoughts');
expect(engineer.name).toEqual(expect.any(String... | true |
866b751c52974c91a9d0b0086ef566e1624534a5 | JavaScript | ihsanannashir/app-restapi | /res.js | UTF-8 | 1,041 | 2.921875 | 3 | [] | no_license | 'use strict';
exports.ok = function(values, res){
var data = {
'status':200,
'values':values
};
res.json(data);
res.end();
}
//[NESTED JSON OBJECT] response for nested data (matakuliah)
exports.nestedMatkul = function (values, res) {
//akumulasi biar jadi single value
const ... | true |
89d1efa747a97906a84177363af6055e12f9f6f6 | JavaScript | jaybee3/my-screeps-testbed | /role.builder.js | UTF-8 | 2,470 | 2.625 | 3 | [] | no_license | var roleBuilder = {
/** @param {Creep} creep **/
run: function(creep) {
if(creep.memory.building && creep.carry.energy == 0) {
creep.memory.building = false;
}
if(!creep.memory.building && creep.carry.energy == creep.carryCapacity) {
creep.memory.buil... | true |
a0707b8887fd0f5496dd9240c737be6ba2062037 | JavaScript | M1chy69/Multi-Guild-Modmail | /commands/remove.js | UTF-8 | 1,339 | 2.6875 | 3 | [] | no_license | const Discord = require('discord.js')
const {
pullAt
} = require('lodash')
module.exports = {
name: "remove",
description: "Remove support roles for modmail",
execute(message, args, client) {
if (!message.member.permissions.has("MANAGE_GUILD")) return;
let role = this.parseRole(message... | true |
5737c758e10600c247bc2aa642915a7119ae56de | JavaScript | pivnicerumihai/weatherapp | /src/components/WeatherContainer.jsx | UTF-8 | 1,634 | 2.796875 | 3 | [] | no_license | import React, { useState } from "react";
import Container from "@material-ui/core/Container"
import WeatherData from "./WeatherData"
import Form from "./Form"
import City from "./City"
import axios from "axios";
const WeatherContainer = (props) => {
const [apiResponse, setApiResponse] = useState({
degree:... | true |
d43b874c56a0b73d952d8c8553a825eaf7462439 | JavaScript | jason1110/Cookbook-App---Frontend | /src/components/AddToCookbookButton.js | UTF-8 | 2,110 | 2.609375 | 3 | [] | no_license | import React, { useState, useEffect } from 'react';
import { StyleSheet,
Text,
View,
Alert,
}
from 'react-native';
import { Button } from 'react-native-elements'
import {LinearGradient} from "expo-linear-gradient"
const baseURL = 'https://cookbook-app-backend.herokuapp.com/'
... | true |
0cac4e8c9dd5cbc4a9640ad5b19626d84f8ec8e6 | JavaScript | CharlieQNguyen/Algo | /leetCode/microsoft/palindromePermutation.js | UTF-8 | 637 | 4.125 | 4 | [] | no_license | /*
266. Palindrome Permutation
Given a string, determine if a permutation of the string could form a palindrome.
Example 1:
Input: "code"
Output: false
Example 2:
Input: "aab"
Output: true
Example 3:
Input: "carerac"
Output: true
*/
str = "code";
function palindrome(st... | true |
2e5528d834cbd1d9cead80f6156cc876a4be4bd8 | JavaScript | bgoonz/UsefulResourceRepo2.0 | /_REPO/FCC/CurriculumExpansion/functional-programming-spreadsheet/index887.js | UTF-8 | 3,408 | 3.421875 | 3 | [
"CC-BY-SA-4.0",
"MIT"
] | permissive | const infixToFunction = {
"+": (x, y) => x + y,
"-": (x, y) => x - y,
"*": (x, y) => x * y,
"/": (x, y) => x / y
};
const infixEval = (str, regex) =>
str.replace(regex, (_, arg1, fn, arg2) =>
infixToFunction[fn](parseFloat(arg1), parseFloat(arg2))
);
const highPrecedence = str => {
const regex = /([... | true |
19deb836a37f28c667f7c98153661817e687a0da | JavaScript | Ellie-Georgieva/SoftUni-Lessons | /Programming-Basics-JS-March-2020/22-Exam/01-Programming Basics Online Exam - 9 and 10 March 2019/05-Fitness-Center.js | UTF-8 | 1,626 | 3.5625 | 4 | [] | no_license | function fitnessCenter(arr) {
let people = Number(arr.shift());
let back = 0;
let chest = 0;
let legs = 0;
let abs = 0;
let proteinShake = 0;
let proteinBar = 0;
let trainingPeople = 0;
let buyingProtein = 0;
for (let i = 1; i <= people; i++) {
let activity = arr.shift()... | true |
cfbe38564ff46d4d39f2a6c2989459e08ab04792 | JavaScript | narasimhareddyprostack/fswd-june-7pm | /JS/function/funreturn1.js | UTF-8 | 236 | 3.15625 | 3 | [] | no_license | function getData() {
return "Hello, GM";
console.log("Hello, GN");
}
let result = getData();
console.log(result);
//console.log(getData());
/*
function return - only one value
and
alway keep your return last statement only.
*/
| true |
737d6827aa61690fa4c393daa3979227e0cb03a3 | JavaScript | michaelsam08/songs | /algorithim_ practice/simpleMap.js | UTF-8 | 163 | 2.953125 | 3 | [] | no_license | const numbs = [1, 5, 4];
bigNums = numbs.map(x => x * 3)(3)[(3, 6, 9)];
const arr1 = ["jones", "jackson", "samara"];
famousMikes = numbs.map(x => "michael" + x);
| true |
a217f6ae3d18b119e0abaef8d1129a37d06564fe | JavaScript | chipbell4/leaflet-checkbox-tree | /js/toggle-arrow.js | UTF-8 | 475 | 2.625 | 3 | [] | no_license | (function() {
/**
* Helper function to toggle arrow state, which is acheived by a class on the parent row
*
* @param {Node} parentRow The parent row of the arrow
*/
L.Control.CheckboxTree.toggleArrow = function(parentRow) {
// remove the expanded class if its there. Otherwise, add it
if(parentRo... | true |
34e1f2ee46113d506df30d7ad8dc7950eb4695bb | JavaScript | siimsepp/pos_size_calc_electron | /app/index.js | UTF-8 | 2,352 | 2.984375 | 3 | [] | no_license | const { ipcRenderer } = require('electron')
document.querySelector('#submit').addEventListener('click', buttonClicked)
document.querySelector('#clear-fields').addEventListener('click', clearFields)
function buttonClicked() {
const risk = document.getElementById('risk')
const portfolio = document.getElementById('p... | true |
38205dd36272c9171ec0134571c72d9acb096a0d | JavaScript | CLCodeLab/code-challenges | /RowSumOddNumbers.js | UTF-8 | 547 | 4.15625 | 4 | [] | no_license | /*
TITLE: ROW SUM ODD NUMBERS
NOTE: Given the triangle of consecutive odd numbers, find the sum of each row:
1
3 5
7 9 11
13 15 17 19
21 23 25 27 29
...
*/
const rowSumOddNumbers = n => {
return Math.pow(n, 3)
}
function runTestSubjects(testSubjects) {... | true |
72830fa55be7293594515ab2fc81260db46aea91 | JavaScript | Say-young/C-lab | /6월30일 - 실습/ex.js | UTF-8 | 1,158 | 2.875 | 3 | [] | no_license | /* 아래로 내려가는 애니메이션 적용 후 요소를 display:none 하고 싶은데 적용이 안 돼요*/
document.getElementById('arrow').addEventListener('click', function () {
document.getElementsByClassName('wrapper')[0].classList.remove('showanimation')
document.getElementsByClassName('wrapper')[0].classList.add('goneanimation')
//시간차로 hidden을 먹여보... | true |
1b7b3bc83c7bc6fde3085da1966530d91a718b63 | JavaScript | yaya-97/WebDev_April | /groepswerk1106/stickman/app.js | UTF-8 | 720 | 3.65625 | 4 | [] | no_license | function moveRight(elem) {
var pos = 0;
clearInterval(id);
id = setInterval(frame, 0.1);
function frame() {
if (pos == 1000) {
clearInterval(id);
flipCharacter(elem);
moveLeft(elem);
} else {
pos++;
elem.style.left = pos + "px";
}
}
}
function flipCharacter(elem)... | true |
9806b1b9bba5944f5642b6f08121029421737af9 | JavaScript | ivze/Testing-7-3-21 | /test/specs/examples/excercise5.e2e.js | UTF-8 | 1,099 | 2.578125 | 3 | [] | no_license |
const ShopPage = require('../../pageobjects/shop.page');
describe('Vintage Hand Bags Shop', () => {
beforeEach(() => {
ShopPage.open();
});
it('should show 4 products by default with search enabled', () => {
expect(ShopPage.searchField).toBeDisplayed();
expect(ShopPage.searchFiel... | true |
2dfe98ad339b5b827005c1e0914a72ade6c824bf | JavaScript | lfarid/LindaWorkbench | /linda/linda_app/static/visualization/visualization_library/charts/columnchart.js | UTF-8 | 4,241 | 2.921875 | 3 | [
"MIT"
] | permissive | /*
* DIMPLE CHART LIBRARY
* DATA FORMAT: [{"column1":"value1", "column2":"value2", ...}, {"column1":"value3", "column2":"value4", ...}, ...]
*
*/
var columnchart = function() {
var chart = null;
var seriesHeaders = [];
var series = [];
function draw(configuration, visualisationContainerID) {
... | true |
eb9029b30e8e09e49e4dd4f0ec0e3e77c3627d9e | JavaScript | JulietKilo2/reactive-checklist | /src/List.js | UTF-8 | 867 | 2.59375 | 3 | [] | no_license | const List = ({ list, handleStatus, deleteItem, handleCount }) => {
return (
<div className="list-container">
<h3 onClick={handleCount}>Let's get to work!</h3>
<ul className="list">
{list.map((item) => {
return (
<div className="item-container" key={item.id}>
... | true |
cb64f385eca9f9fe18172a76d3e75ba1d49722f5 | JavaScript | mrutyunjayamsrit/Practice_codes | /mergeArray.js | UTF-8 | 998 | 3.890625 | 4 | [] | no_license | const mergeArray = (a,b)=>{
let result = [...a,...b];
console.log(result);
let out = result.sort(function(a,b){
return a>b;
})
return out;
}
console.log(mergeArray([2,5,6,9], [1,2,3,29]))
function mergeSortedArray(a,b){
let i=1,j=1;
let aelm = a[0];
let belm = b[0];
let mer... | true |
6d856696e88b0ed82aeb4edf904d79412158482a | JavaScript | yhs2/BasketballReservationApp | /server/controllers/posts.js | UTF-8 | 3,810 | 2.640625 | 3 | [] | no_license | import PostMessage from "../models/postMessage.js";
import mongoose from 'mongoose';
export const getPosts = async (req,res) => {
const { page } = req.query;
try {
const LIMIT = 8;
const startIndex = (Number(page) - 1) * LIMIT;
const total = await PostMessage.countDocuments({});
... | true |
40241a37e99da3afaf0fda7a448c56a8d1c92a9d | JavaScript | sdwfrost/pcg.js | /test/createPcg32.js | UTF-8 | 936 | 2.53125 | 3 | [
"MIT"
] | permissive | import test from 'ava';
import { createPcg32, nextState, prevState, randomInt, randomList } from './../lib';
const randomUint32 = randomInt(0, (2 ** 32) - 1);
const pcg = createPcg32({}, 42, 54);
test('PCG32_XSH_RR: Single integer', (t) => {
// Check for generator immutability and result reproducibility
t.is(ran... | true |
1d8941e73e2ab07303a625451addf61d30c1eb77 | JavaScript | LotanM/sprint1 | /js/utils.js | UTF-8 | 2,339 | 2.78125 | 3 | [] | no_license | 'use strict'
var clicked = new Audio("./audio/click.mp3");
var flagged = new Audio("./audio/flagged.mp3");
var lose = new Audio("./audio/loser.mp3");
var win = new Audio("./audio/win.mp3");
var steppedOnMine = new Audio("./audio/steppedOnMine.mp3");
var minutesLabel = document.querySelector(".minutes");
var se... | true |
75b8731ce2b4339af2b8a28fb55d5cc4a6ef901b | JavaScript | likeastore/site | /public/components/hashids/examples/encrypting_with_custom_hash_length.js | UTF-8 | 359 | 3.5625 | 4 | [
"MIT"
] | permissive |
/* creating class object with hash length of 8 */
var hashids = new Hashids("this is my salt", 8);
/* encrypting several numbers into one hash (length of hash is going to be at least 8) */
var hash = hashids.encrypt(1337, 5);
/* decrypting the same hash */
var numbers = hashids.decrypt(hash);
/* numbers is always a... | true |
5588b5c186073405ec746e9aaceb5f1c5aa4328c | JavaScript | martin431033/MargarineBot | /commands/Fun/Interactions/8ball.js | UTF-8 | 595 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | exports.run = async (client, message, [args]) => {
let response = ["Yes", "Maybe", "No", "Try again later", "Possibly", "Absolutely", "Probably not", "Outcome is looking good", "Outcome not looking good", "The stars say yes"];
message.channel.send(`${response[~~(Math.random() * response.length)]}, ${message.au... | true |
5f91c6aa41b1adc6524239bfdf26507e82ca90b3 | JavaScript | chip-student/javascript-beginner-exercises-tutorial-day-6- | /exercises/21-Looping-with-FizzBuzz/app.js | UTF-8 | 461 | 3.671875 | 4 | [] | no_license | function fizzBuzz() {
// Your code here
for(var i=1; i <= 100; i++)
{
let val_5 = i % 5;
let val_3 = i % 3;
if(val_5 === 0 && val_3 === 0)
{
console.log("FizzBuzz");
}
else if(val_5 === 0)
{
console.log("Buzz")
}else ... | true |
221930f5a930430be656ba0ab7b23088b33109b1 | JavaScript | wang542/DataStructure | /LeetCode/Medium/UniquePaths.js | UTF-8 | 1,527 | 3.453125 | 3 | [] | no_license | /**
* @param {number} m
* @param {number} n
* @return {number}
*/
var uniquePathsRecursion = function (m, n) {
let startN = 0;
let startM = 0;
let res = 0;
var helper = function (currentN, currentM, finishM, finishN) {
if (currentN === finishN && currentM === finishM) {
res += 1;
return;
... | true |
580880ef35a317e22457b6b662d0924e469483d8 | JavaScript | jamesscottbrown/tebio-fit | /tebio-fit/js/summaryTable.js | UTF-8 | 1,283 | 2.5625 | 3 | [
"BSD-3-Clause"
] | permissive | function summaryTable() {
var table = d3.select('#summaryTable').append("table");
table.classed('table', true).classed('table-bordered', true); // apply bootstrap table themeing
var tHead = table.append("thead");
var tBody = table.append("tbody");
var columns = [{"table_column": 1, "display_name":... | true |
6a86357ee586e01c932823dea624d9190719a02c | JavaScript | kids-cademy/atlas.studio | /atlas-studio-ui/script/com/kidscademy/format/RoundFormat.js | UTF-8 | 524 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | $package("com.kidscademy.format");
com.kidscademy.format.RoundFormat = class {
constructor() {
}
format(number) {
if (number == null) {
return null;
}
return Number(number.toFixed(9));
}
parse(value) {
if (value === '') {
retu... | true |
44ffd374f1388f6efadb4b1d76b74100e2065915 | JavaScript | sparticle999/SpaceCompany | /ui/databoundElement.js | UTF-8 | 2,375 | 2.9375 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] | permissive | (function(){
var elementRegister = {};
var autoBindingRegister = [];
function DataBoundElement(valueLambda, id, element) {
if(!id) {
id = null;
}
if(!element) {
element = null;
}
this.id = id;
this.element = element;
this.va... | true |
3983f0f25a34eb37c5da7d95b0876fb2cd6516bc | JavaScript | ttudorandrei/coding-bootcamp | /extras/practice/strings/exercise_4.js | UTF-8 | 387 | 2.6875 | 3 | [] | no_license | import { oneLineTrim } from 'common-tags'
/**
* Write a function that accepts a multi-line
* string as the input and returns a single-line
* string as the output.
*
* Use the tagged template 'oneLineTrim' which
* converts a multi-line string to a single-line
*
* NOTE: use tagged template literals
*/
const... | true |
070ba011c934e8d9363ba56fae0f3c6257a1408c | JavaScript | OlegIv-m/ITMO_VUE | /script/script1.js | UTF-8 | 1,064 | 2.890625 | 3 | [] | no_license | // Javascript Module 3 Exercise 1
/*
1. Реализовать красивую страничку с выводом
информации о товаре (например, страничка
о выводе информации о ноутбуке в интернет
магазине компьютерной техники);
*/
let app = Vue.createApp({});
app.component('vueh1', {
template: `<h1 v-bind:style="{ color: h1Color}" >
{{ itemN... | true |
8e764e17665111c006d8ebac9c2a7a53fe3f894e | JavaScript | swopnalika/javascript-basics | /callbacks.js | UTF-8 | 526 | 3.90625 | 4 | [] | no_license | function sendBackTheSumToPrint ( num1, num2, callback){
let sum = num1 +num2;
callback ( sum);
}
function logTheSum(sum){
console.log ( `sum is ${sum}`)
}
sendBackTheSumToPrint( 10, 20, logTheSum)
function greet(){
console.log( 'hello world');
}
function sayName( name){
console.log( 'hello'+''+name)
}
set... | true |
0080f625f9655f385eca1a710872f5b435c416ef | JavaScript | MarriottLabs/mcom-performance | /ratelist-menu/ratelist-menu_files/WA_marriott_8-10-15.js | UTF-8 | 10,602 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | // JavaScript Document
var ruleTriggered = {}; // Track rules that triggered to only run analytics once
// Convert ruleData Array to Hash with Rule Id as Key for easy access by Rule Id
var ruleData = {};
for (var i = 0; i < ATGSvcs.rules.ruledata.length; i++) {
var objRuleData = ATGSvcs.rules.ruledata[i];
ruleData... | true |
51b27478999968a1cae713ede09481b3b3586a48 | JavaScript | codefellows/seattle-code-201n23 | /class-04/demo/quiz-into-functions.js | UTF-8 | 437 | 3.828125 | 4 | [] | no_license | 'use strict';
// wrap quiz code into functions
let username = prompt('What is your name?');
console.log(`Welcome ${username}.`);
function questionOne() {
let answerOne = prompt('Do I live in Seattle? Please answer \'yes\' or \'no.\'').toLowerCase();
if (answerOne === 'yes' || answerOne === 'y') {
console.lo... | true |
45030fa42395cbf8c8da4a16deaab9cefe7e47ae | JavaScript | gamernoob59/sturdy-rotary-phone | /sketch.js | UTF-8 | 985 | 2.5625 | 3 | [] | no_license | const Engine = Matter.Engine;
const World= Matter.World;
const Bodies = Matter.Bodies;
var ground,divison1
var particles = [];
var plinkos = [];
var divison = [];
var divisonHeight = 300;
function setup(){
createCanvas(480,800);
engine = Engine.create();
world = engine.world;
for (var k ... | true |
5a45163b451b61c0e292e9ca1b3006c7ce5027a2 | JavaScript | DaianaRomero/ReactNative | /App.js | UTF-8 | 3,707 | 2.703125 | 3 | [] | no_license | import { StatusBar } from 'expo-status-bar';
import React, { Component, useState } from 'react';
import axios from 'axios';
import { StyleSheet, Text, View, TextInput, Image, Button, ListItem } from 'react-native';
export default class App extends Component {
state = {
response: [],
estado: null
}
... | true |
d62c26d46003d46eccb029b90dccb7c125eeaf62 | JavaScript | JamesMcGuigan/edgefolio-orm | /src/models/util/UnenumerablePrototype.js | UTF-8 | 4,779 | 2.6875 | 3 | [] | no_license | /**
* @class UnenumerablePrototype
*/
angular.module('edgefolio.models').factory('UnenumerablePrototype', function(ApiFieldGenerator) {
var UnenumerablePrototype = new JS.Class("UnenumerablePrototype", {
/**
* Initialize needs to be defined as a function on UnenumerablePrototype.prototype for the code be... | true |
699931890f8259811da4cddbfa190722c14c19e2 | JavaScript | devesh-venkatesh/devesh-venkatesh.github.io-cocktailBuilder | /myFunc.js | UTF-8 | 4,581 | 3.53125 | 4 | [] | no_license | // cocktails array with cocktail objects
var cocktails = [
{
name: "Manhattan",
ingredients: ["whiskey", "sweet vermouth", "angostura"],
prep: `Two ounces of whiskey<br>
One ounce of sweet vermouth<br>
Two dashes of angostura`
},
{
name: "Gimlet",
ing... | true |
d30e507e2ef713218f4b1b2e8b16dd9a8070df1b | JavaScript | whfkdakf75/cnbc-admin | /app/src/js/util/dataUtil.js | UTF-8 | 1,553 | 3.296875 | 3 | [] | no_license | /**
* 데이터 지원 유틸리티 생성자
* @static
*/
class DATA_UTIL {
static getObjectToUriParameter(data) {
if(_.isObject(data)) {
var uriParameter = '';
for(var key in data) {
if(data.hasOwnProperty(key)) {
uriParameter += key + '=' + data[key] + '&';
}
}
if(uriParameter.... | true |
b228c1e199e58f8d9c7f13f2f00a068f897b2a9d | JavaScript | itmo-web-dev/Homework | /Litvinov/js/course_work/snake.js | UTF-8 | 5,448 | 3.078125 | 3 | [] | no_license | 'use struct';
console.log("in side snake.js");
function Square(obj, context_in, canvas){
this.fill_color=obj.color;
this.x = obj.x;
this.y = obj.y;
this.canvas = canvas;
this.number = 1;
this.side = obj.side;
this._context = context_in;
}
Square.proto... | true |
50b386d85a658f5e7844c68de775d3d1cea4f872 | JavaScript | VaishnaviMehrotra/Online-Women-s-Shoe-Store | /static/js/ui-components.js | UTF-8 | 3,595 | 3.078125 | 3 | [] | no_license | function registerUser()
{
var first_name = document.querySelectorAll("input")[1].value;
var last_name = document.querySelectorAll("input")[2].value;
var phone_number = document.querySelectorAll("input")[3].value;
var email = document.querySelectorAll("input")[4].value;
var first_pwd = document.query... | true |
6d25b27a8cd5901ffb24313fab8a2611fd065c90 | JavaScript | YaseminLi/leetcode | /142.环形链表II.js | UTF-8 | 1,172 | 3.765625 | 4 | [] | no_license | /**
* 给定一个链表,返回链表开始入环的第一个节点。 如果链表无环,则返回 null。
为了表示给定链表中的环,我们使用整数 pos 来表示链表尾连接到链表中的位置(索引从 0 开始)。 如果 pos 是 -1,则在该链表中没有环。注意,pos 仅仅是用于标识环的情况,并不会作为参数传递到函数中。
说明:不允许修改给定的链表。
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/linked-list-cycle-ii
* Definition for singly-linked list.
* function ListNode(val) {
* thi... | true |
02477f675cc7def222d637789b41c5535d24b14e | JavaScript | kaviraj07/freE-Learning | /assets/js/lectures.js | UTF-8 | 467 | 2.890625 | 3 | [] | no_license | let videoLinks = document.querySelectorAll('a.item');
videoLinks.forEach(videoLink => {
videoLink.addEventListener('click', changeVideo)
});
function changeVideo(e) {
let courseName = document.getElementById('courseName').textContent;
let videoPlayer = document.getElementById('video');
let videoTitle ... | true |
386c485d8e5b3158b272116358eba5526f5732ba | JavaScript | bchoubert/jee-restful-cinema-client | /scripts/requester.js | UTF-8 | 673 | 2.796875 | 3 | [] | no_license | function request(url, callback) {
var baseUrl = "http://localhost:8080/cinema/cinema/";
var req = new XMLHttpRequest();
req.open('GET', baseUrl+url, true);
req.onreadystatechange = function (aEvt) {
if(req.readyState == 4)
{
if(req.status == 200)
{
callback(JSON.parse(req.responseText));
}
else... | true |
bfc883c05a6efa7a7c709776be686f67dabcf420 | JavaScript | Marciocarneiro77/exercicios-javascript | /exercicio-02/exercicio-2.js | UTF-8 | 196 | 2.6875 | 3 | [
"MIT"
] | permissive | let trabalhoDeHistoria = 8.0
let trabalhoDeMatematica = 7.0
let trabalhoDeCiencias = 10
let trabalhoDeGeografia = 9.5
let notas = 8.0 + 7.0 + 10 + 9.5
let media = notas/4;
console.log(media); | true |
84bc3bf7345fa1b438b93869f4132287f468ef5c | JavaScript | EliCas5931/FriendFinder | /app/routing/apiRoutes.js | UTF-8 | 1,090 | 2.96875 | 3 | [] | no_license | var friends = require("../data/friend.js");
module.exports = function(app) {
app.get("/api/friends", function(req, res) {
res.json(friends);
});
app.post("/api/friends", function(req, res) {
console.log(req.body.scores);
var newFriend = req.body;
for(var i = 0; i < URLSea... | true |
c25849c6ce3b4823be5b22a906ccaafab1fac2d1 | JavaScript | anamshk/snake-client | /input.js | UTF-8 | 1,023 | 2.828125 | 3 | [] | no_license | let connection;
const stdin = process.stdin;
//emitter.setMaxListeners();
const setupInput = (conn) => {
connection = conn;
const handleUserInput = function() {
stdin.on('data', (key) => {
//process.stdout.write('.');
if (key === '\u0003') {
process.exit();
}
if (key === '\u001... | true |
07e89efd82cd6622ff1fe23838cb3b29ffc6af63 | JavaScript | ankita24/user-management | /src/actions/user.js | UTF-8 | 900 | 2.53125 | 3 | [] | no_license | import {
FETCH_USERS,
FETCH_USERS_ERROR,
FETCH_USERS_SUCCESS,
SET_SELECTED_USERS
} from '../reducers/user';
import { getUser } from '../api';
export const fetchUser = () => {
return dispatch => {
dispatch({
type: FETCH_USERS
});
return getUser()
.then(payload => {
dispatch({... | true |
5a79e25342719e3d31096a32f031c57f7a6fa528 | JavaScript | EAaron-fullsail/Elliott_Aaron_WPF | /Assignments/Week4/Functions_Wacky/js/script.js | UTF-8 | 1,415 | 4.25 | 4 | [] | no_license | /*
<!--
Aaron Elliott
WPF 1409 Section 02
Functions Wacky
10-23-2014
-->
*/
(function(){ // anon function
var weasels = []; //array for the weasels
weasels[0]={"n": "Bob", "hungry": "yes"} // array value one
weasels[1]={"n": "Steve", "hungry": "yes"} // two
weasels[2]={"n": "Danny", "hungry": "no"} //t... | true |
54e9622019d86e50c4ec6332155303c53b8c1707 | JavaScript | celsoernani/Flask-React | /react-series/src/components/App.js | UTF-8 | 1,623 | 2.828125 | 3 | [
"MIT"
] | permissive | import React from 'react';
import PlacarContainer from './PlacarContainer';
export default class App extends React.Component {
constructor() {
super();
this.state = {
partida: {
estadio: null,
data: null,
gols_casa: null,
gols_visitante: null,
},
casa: {
nome: null,
},
visitan... | true |
a9b7ff1c84ebe47df0c98a26796cbf42e3a5cf4d | JavaScript | stvauyeung/new-bloc-jams | /app/scripts/landing.js | UTF-8 | 701 | 2.640625 | 3 | [] | no_license | $(document).ready(function() {
$('.hero-content h3').click( function() {
subText = $(this).text();
$(this).text(subText + '!');
});
var heroOnHover = function() {
$(this).animate({color:'#B27AFF'}, 700);
};
var heroOffHover = function() {
$(this).animate({color:'#FFFFFF'}, 700);
};
$('.h... | true |
03e1b3981cbf4d49efb256d72be2c4f632e0de9b | JavaScript | darwinshy/foodji-frontend | /js/global.js | UTF-8 | 4,495 | 2.640625 | 3 | [] | no_license | // <li><a id="logInOutBtn" href="userlogin.html">Login</a></li>
// <li><a id="signUpProfileBtn" href="usersignup.html">Signup</a></li>
function ready(callbackFunc) {
if (document.readyState !== "loading") {
// Document is already ready, call the callback directly
callbackFunc();
} else if (document.... | true |
c5f572c1690dd7b23294982c2535a5b3cca58086 | JavaScript | stranothus/timeSince | /timeSince.js | UTF-8 | 2,659 | 3.609375 | 4 | [] | no_license | /*
Input the timePosted parameter as
{
year : [year],
month : [month],
day : [day],
hour : [military time hour of the day],
min : [minute of the hour],
sec : [second of the minute]
}
or use the accompanying dateToObj.js file
*/
function timeSince(timePosted) {
var dateNow = new Date();
... | true |
13894ecc29c172cc86df9dc8a583bc61227347e5 | JavaScript | dkuntz811/API_Pets_Weekend5 | /server/public/scripts/favescontroller.js | UTF-8 | 564 | 2.5625 | 3 | [] | no_license | myApp.controller('favesController', ['$scope', '$http', function($scope, $http){
console.log('favesController is working');
$scope.favorites = [];
console.log('$scope.favorites ', $scope.favorites);
$scope.favCount = '';
function getFaves(){
$http.get('/favorites').then(function(response){
if(respo... | true |
2004038860ca1e37e47e75fba5256dfab17391e9 | JavaScript | itanium-R/accountBook | /tools.gs | UTF-8 | 2,852 | 3.3125 | 3 | [] | no_license | // @param {数値}??????
// @return {str}¥???,???-
function parseYenStr(num){
var numInt = parseInt(num,10);
if(isNaN(numInt))return "¥0-";
var numStr = String(numInt);
var yenStr = numStr.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
return ("¥" + yenStr + "-");
}
//--------------------------------------------------... | true |
f9801ac645062d15c71cc1e92b3d8c063305dedc | JavaScript | peshaladushyanthika/React-App | /src/components/createData.component.jsx | UTF-8 | 4,290 | 2.71875 | 3 | [] | no_license | import React, { useState } from 'react';
import Form from 'react-bootstrap/Form';
import Button from 'react-bootstrap/Button';
import axios from 'axios';
const FillForm = () => {
const [name, setName] = useState("");
const [description, setDescription] = useState("");
const [adaptability, setAdap... | true |
bc54df5dfc3afae0e4ff6f4ae95d3e1ac7053b98 | JavaScript | flameltc/leetcode | /796. Rotate String.js | UTF-8 | 355 | 3.53125 | 4 | [] | no_license | /**
* @param {string} A
* @param {string} B
* @return {boolean}
*/
var rotateString = function(A, B) {
if(A.length!=B.length) return false
if(A.length==0) return true
for(var i=0;i<A.length;i++){
A=A.substr(1)+A.substr(0,1)
if(A==B){
return true
}
}
return fal... | true |
6e29e5190e1d58c7919522ad2a52f29cca041fcb | JavaScript | tanevitch/cursoNode | /src/controllers/task.controller.js | UTF-8 | 1,584 | 2.546875 | 3 | [
"MIT"
] | permissive | const model = require('../database/models/index');
const createTask = async (req,res) =>{
const { userId } = req;
const user = await model.User.findByPk(userId);
const { name, description, creationDate, expirationDate } = req.body;
await model.Task.create({ name, description, creationDate, expirationDate, Us... | true |
4196ec412779430dbc487b9c04bbe87532e3bb73 | JavaScript | chen5656/Crime-map-with-public-geocoder | /index.js | UTF-8 | 8,858 | 2.625 | 3 | [] | no_license | var input = document.getElementById("input");
var processor = document.getElementById("processor");
var output = document.getElementById("map");
var geoCodeResult = "Unknown issue of reading data from pdf. Please refresh the main page.";
function showGeocodeResult() {
//show geocoding report
var win = windo... | true |
f255f15e2b3775a33ebd5d17ab9fa9d295c50c8d | JavaScript | kreezire/CS498DataVizFinalProject | /js/bubbles_area.js | UTF-8 | 1,976 | 2.53125 | 3 | [
"MIT"
] | permissive | dataset = {
"children": [
{"area": "North America", 'le' : 78.24},
{"area": "Europe & Central Asia", 'le' : 75.25},
{"area": "East Asia & Pacific", 'le' : 73.79},
{"area": "Latin America & Caribbean", 'le' : 73.66},
{"area": "Middle East & North Africa", 'le' : 71.76},
... | true |
782f34db35b0e822f355a3eaa9a224ebbf8c9b97 | JavaScript | gustavosidoti/c-node-restserver | /middlewares/validar-roles.js | UTF-8 | 1,431 | 3.078125 | 3 | [] | no_license | const { response } = require("express");
const esAdminRole = ( req, res = response, next ) => {
if ( !req.usuario ) { // nos avisa que primero hay que llamar al otro middleware JWT
return res.status(500).json({
msg: 'Se quiere verificar el role sin validar el token primero'
});
}
... | true |
2c91c33ea35f9ed3d820ea1317fdf3a22fccfeb2 | JavaScript | raushanji/nodejs | /server.js | UTF-8 | 855 | 3.015625 | 3 | [] | no_license | // const randomwords = require('random-words');
// console.log(randomwords());
// console.log(randomwords(5));
// var a = require('./sum');
// console.log(a(5,2));
// var b = require('./sub');
// console.log(b(5,1));
// var c = require('./muldiv');
// console.log(c(6,3,'division'));
var fs = require('fs');
// var... | true |
2aede1b13f49e2e84af3e3ae5d1696e1cbc3c055 | JavaScript | talent-path-pipeline/server | /utils/checkPassword.js | UTF-8 | 751 | 2.90625 | 3 | [] | no_license | const bcrypt = require('bcryptjs');
const { getUserPrivate } = require('../db/user');
const ErrorWithHTTPStatus = require('../utils/error.httpStatus.utils');
/**
* Checks if password user passes in is the same as the one stored in the database
* @param {string} email
* @param {string} password
* @returns {Object} U... | true |
fd68c8bad7c8688bc7bf22790b343a1b75585852 | JavaScript | tehcyfer/CyfersMMP210Port | /selfportrait-3-Interactive/sketch.js | UTF-8 | 1,457 | 3.171875 | 3 | [] | no_license | // Cloud Variables
var cloudOne = 200;
var cloudTwo = 150;
var cloudThree = 300;
var cloudFour = 100;
var cloudFive = 500;
var cloudSix = 550;
var cloudSeven = 50;
var CloudWidth = 200;
var CloudHeight = 50;
var s = 10;
function setup() {
createCanvas(500,500);
}
function draw() {
//s... | true |
2876bd2e624d243d21af0007b4707bfa57fa1e03 | JavaScript | FrontEnd-Addiction/Baidu-IFE | /stage03/task40/calendar/js/libs/util.js | UTF-8 | 793 | 3.15625 | 3 | [] | no_license | const isNode = node =>
node && node.nodeType ? true : false
function h (
type = 'div',
props = {},
...children
) {
const el = document.createElement(type)
// set attributes
Object.keys(props).forEach(prop => {
prop.slice(0, 2) === 'on'
? el.addEventListener(prop.slice(2).toLowerCase(), props[p... | true |