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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
8f4d06d01f70a4228a06802bf67396a9fc4ddd1f | JavaScript | DLeon24/restserver-node | /server/routes/upload.js | UTF-8 | 3,321 | 2.640625 | 3 | [] | no_license | const express = require('express');
const fileUpload = require('express-fileupload');
const app = express();
const User = require('../models/user');
const Product = require('../models/product');
const fs = require('fs');
const path = require('path');
// default options
app.use(fileUpload());
app.put('/upload/:type/:i... | true |
034c0c5f558c1f8b67e0f01ca823bb8deb4feebb | JavaScript | jacob-israel-turner/console-time | /index.js | UTF-8 | 1,836 | 3.140625 | 3 | [] | no_license |
function entry(sort, options){
var max = options.max || 1000;
var interval = options.steps || 10;
var verbose = options.verbose === false ? false : true;
if (typeof sort === 'function'){
if(verbose) printStart(functionName(sort));
var sortResults = generateInputs(max, interval).map(function(item, index){
... | true |
596c5146049573e5aa815d738d55c7fb3c33445e | JavaScript | ryanhinkel/mori-formatter | /type.js | UTF-8 | 671 | 2.6875 | 3 | [] | no_license | const { isCollection, isMap, isVector, isSet, isList } = require('mori')
const getType = data => {
if (isCollection(data)) {
if (isMap(data)) {
return 'hashMap'
} else if (isVector(data)) {
return 'vector'
} else if (isSet(data)) {
return 'set'
} else if (isList(data)) {
retur... | true |
5cf63377cb450bffe2d526f181997369608373f6 | JavaScript | prakharverma01/pv_repo | /src/components/createCrudContent.js | UTF-8 | 532 | 2.609375 | 3 | [] | no_license |
export default function contentDisplay() {
let initial= JSON.parse(localStorage.getItem("localStorageData"));
let data = initial ? initial : [];
let html = "";
for(let i=0;i<data.length;i++)
{
html+="<div class=name-crud>"+"#id:("+i+")."+data[i].nme+"</div>";
... | true |
16ba8a06e85931dae13a288f47872f6387bb2e13 | JavaScript | sharukhraman/tt | /index.js | UTF-8 | 168 | 2.625 | 3 | [] | no_license | function myFunction() {
let nameid = document.getElementById("name");
let value = nameid.value;
document.getElementById("demoj").innerHTML = value;
}
| true |
ace0ee96539c310492d4f4bcda593e6c12785333 | JavaScript | maddymakesgames/Yui | /commands/system/prefix.js | UTF-8 | 1,356 | 2.84375 | 3 | [] | no_license | exports.run = async (client, message, [action, ...value], level) => {
const settings = client.settings.get(message.guild.id);
if(action === 'add') {
settings['prefix'].push(value.join(' '));
client.settings.set(message.guild.id, settings);
message.channel.send(`You have added the prefix ${value} to the list ... | true |
54b8b09917b7760553c5de1de39501df00c5d6cc | JavaScript | Patrick1T2/Uke41 | /oppgave2-2-5.js | UTF-8 | 819 | 2.8125 | 3 | [] | no_license | var kontakter = {}
function nyKontakt(firstname, lastname, phone) {
kontakter[phone] = {
fornavn: firstname,
etternavn: lastname,
telefon: phone
}
}
function f(x) {
return(3*x);
}
function finnAreal(w, h, isRect) {
if (isRect) {
return(w*h);
}
}
function lagDiv(tekst, bredde, bagrunnsfarge, tekstfarge,... | true |
cbe4848ff1f10e4cbaa3ea4ec4a4b23b285a4b69 | JavaScript | DylanSettbon/esgi-javascript | /exercice-1/string.js | UTF-8 | 745 | 3.890625 | 4 | [] | no_license | function jsUcfirst(string)
{
var chaine = "hello world";
console.log(chaine.charAt(0).toUpperCase() + chaine.slice(1));
}
function capitalize(){
var chaine = "hello world";
var tab = chaine.split(" ");
var tab1= [];
for(t of tab){
var a= t.charAt(0).toUpperCase() + t.slice(1).toLowerCase()
tab1.push(a)... | true |
ddae072c892d4ca99a6a02cc72c2aacf0a673321 | JavaScript | jistudio/CityofSeoul | /js/scrollTop.js | UTF-8 | 1,245 | 3.0625 | 3 | [] | no_license | // ------------------ 위로가기 버튼 ---------------------------
$(function(){ //로딩이 끝나면
// [1] #top 화면상에 안보이게 숨기기 - 패턴: 대상.효과
// [2] 스크롤을 내리면 #top이 서서히 나타난다
// 패턴: 이벤트대상(window) / 이벤트 (srcoll) / 이벤트 핸들러(서서히나타난다)
// [3] #top을 클릭하면 서서히 위로 올라간다
$("#top").hide();
... | true |
cf9f566fc1cb7b8d1c50509b0fb5c4a690647e0f | JavaScript | kashimotoxiang/GO | /html/js/websocket.js | UTF-8 | 2,567 | 2.734375 | 3 | [] | no_license | var ws;
function websocketInit() {
ws = new WebSocket("ws://localhost:8181");
ws.binaryType = "arraybuffer";//set the type of received data:array, the default type is bolb
ws.onopen = function (event) {
console.log("Connection Start");
};
ws.onmessage = function (event) {
mReceive(event.data);
};
... | true |
16b77d05ac1e03492232656c137df3b384f82a32 | JavaScript | rpgaggioli/fortunes | /edge.js | UTF-8 | 933 | 2.828125 | 3 | [] | no_license |
module.exports = createEdge;
var computeBreak = require("./computeBreak.js")
function Edge(lSite,rSite) {
this.lSite = lSite;
this.rSite = rSite;
this.lVertex;
this.rVertex;
this.lDone = false;
this.rDone = false;
}
Edge.prototype.updateVert = function(sweepLine){
if(!this.lDone || !this.rD... | true |
270a4cc06907694773e33257749b3835850afc17 | JavaScript | anthfran/eloquent-javascript-v3 | /07_robot/robot.js | UTF-8 | 7,891 | 3.28125 | 3 | [] | no_license | /*
For documentation, see http://eloquentjavascript.net/07_robot.html
*/
const roads = [
"Alice's House-Bob's House", "Alice's House-Cabin",
"Alice's House-Post Office", "Bob's House-Town Hall",
"Daria's House-Ernie's House", "Daria's House-Town Hall",
"Ernie's House-Grete's House", "Grete's House-Farm",
... | true |
bcfaffb6bb4d0af8dcf8bc35b67fab76be942d06 | JavaScript | iamgoangle/json-mock-server | /src/mock/products.js | UTF-8 | 545 | 2.953125 | 3 | [] | no_license | // products.js
var faker = require('faker');
function generateProducts () {
let products = [];
for (var id = 0; id < 50; id++) {
var productName = faker.commerce.productName();
var price = faker.commerce.price();
var qty = faker.finance.amount();
products.push({
"id": id,
"productName... | true |
28131e90938b4a5c98bc92f7959db26724f5e04c | JavaScript | ssfxz/Codewars | /Weight-for-weight.js | UTF-8 | 539 | 3.921875 | 4 | [] | no_license | // https://www.codewars.com/kata/weight-for-weight/
function orderWeight(str) {
const words = str.split(' ').filter(s => s.length != 0);
const value = word => word.split('').map(c => c.charCodeAt(0) - '0'.charCodeAt(0)).reduce((a,b) => a + b);
let wordsSet = new Set();
words.map(word => wordsSet.add({... | true |
b451dea9dfde2d8225b9bdc19df83193ef458940 | JavaScript | justinku28/CS5003_Project_3 | /vis/app.js | UTF-8 | 2,429 | 3.171875 | 3 | [] | no_license | var dataPath = "data/weather.json";
var margin = {top: 20, right: 30, bottom: 30, left: 40},
width = 960 - margin.left - margin.right,
height = 500 - margin.top - margin.bottom;
var width = 960,
height = 500;
var x = d3.scale.ordinal()
.rangeRoundBands([0, width], .1);
var y = d3.scale.linear()
... | true |
f856f961c2f11b686beebaf76e82a5d2873bd037 | JavaScript | sirak201/Movies-App | /server/src/api/movies.js | UTF-8 | 599 | 2.59375 | 3 | [] | no_license | var express = require("express");
var router = express.Router();
var Movie = require("../Models/Movie");
// define the home page route
router.get("/", async (req, res) => {
try {
const addedMovies = await Movie.getMovies();
res.send(addedMovies);
return;
} catch (error) {
res.json(error);
retur... | true |
851273f8055d7bd5e24c03b9489ecf761ba0ea19 | JavaScript | nyoandnuraco/nyoandnuraco | /src/components/SlideNav.js | UTF-8 | 1,945 | 2.640625 | 3 | [
"MIT"
] | permissive | import React, { useContext } from "react";
import styles from "./slidenav.module.css";
import { ProductContext } from "../contexts/ProductContext";
import ProductDetails from "../components/ProductDetails";
import { Link } from 'gatsby';
const SlideNav = () => {
const { products } = useContext(ProductContext);
cons... | true |
7a48192d3108049cc3206c995587769be337a5f5 | JavaScript | JHanek3/CodeWars | /js/break_camelCase.js | UTF-8 | 468 | 4.15625 | 4 | [] | no_license | // Task
// complete the solution so that the function will break up camel casing, using a space between words.
// Task
// Insert a space between camel cased letter camelCasing = camel Casing
function solution(string) {
return string.replace(/[a-z](?=[A-Z])/g, "$& ")
}
console.log(solution("camelCasing"))
console.l... | true |
738015218ad94c45779cdde740bfff8fa4f8b654 | JavaScript | depp/robot-rampage | /src/light.js | UTF-8 | 804 | 2.546875 | 3 | [
"MIT"
] | permissive | /* Copyright 2015 Dietrich Epp.
This file is part of Robot Rampage. The Robot Rampage source
code is distributed under the terms of the MIT license.
See LICENSE.txt for details. */
'use strict';
var param = require('./param');
// Dynamic light class.
function Light() {
this.obj = new THREE.PointLight(0xff... | true |
5fa0a9286aaf9b54878d1a7ddfa7b113e5a2e0c7 | JavaScript | BrianWakhutu/DwhPortal | /Roles/js/tableaufunctions.js | UTF-8 | 4,696 | 2.859375 | 3 | [] | no_license |
window.onload = function(){
var vizDiv = document.getElementById('viz');
var vizURL = "http://192.168.1.15:8000/views/ARTWorkBook/ARTProphylaxisDashboard"
var options ={
width: '1040px',
height: '540px',
hideToolbar: true,
hideTabs: true,
onFirstInteractive: function(){
workbook = v... | true |
63bc85c126d2acee9178a970879abe5554452619 | JavaScript | HAILE-TESFU/ASSIGNMENT-2 | /sumAndMul.js | UTF-8 | 916 | 2.921875 | 3 | [] | no_license | "use strict";
/**
* @param {number} array is
* @returns {number} total
*/
function sumAndMultArray(array){
array=[1,2,3,4];
let sum=0;
// eslint-disable-next-line id-leng... | true |
d9c0c5a8633eab3f975f8b83d04e5f4068973044 | JavaScript | yasinefe/reactjs-cv | /src/service/CvDataService.js | UTF-8 | 1,581 | 2.6875 | 3 | [] | no_license | import cv from "./data/cv.json"
class CvDataService {
get() {
return JSON.parse(JSON.stringify(cv));
}
find(search) {
let newCv = this.get();
if (search) {
newCv.profile = this.filterItems(newCv.profile, search);
this.filterCompositeItems(newCv.technicalSki... | true |
da27cc4de62d8e2472c2411c4bc1cbefb3c01e62 | JavaScript | prodes13/WoL | /src/components/Question/Question.js | UTF-8 | 1,559 | 2.59375 | 3 | [] | no_license | import React from 'react';
import Answer from './Answer';
const Question =(props) => {
// console.log("Received state in component: ", props.savedQuestions);
// retrieving question number and answer, numAns is affected by starting index at 0
const getAnswered = (numAns) => {
if (props.savedQuestions) ... | true |
b1f2ecd55b70758ce955492328753e6f0af84376 | JavaScript | vomoir/keymanager | /main.js | UTF-8 | 4,118 | 3 | 3 | [] | no_license | //Test for browser compatibility
if (window.openDatabase) {
var mydb = openDatabase("db_keys", "0.1", "Key Distribution", 5 * 1024 * 1024);
if (mydb){
mydb.transaction(function (t) {
t.executeSql('CREATE TABLE IF NOT EXISTS tb_keys ("id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, "key_uid" TEXT, "da... | true |
4e56c7ec1fdbe6d286e18eaf85e9a016616134f9 | JavaScript | mmicastres/Projet2020_4 | /screens/Inscription.js | UTF-8 | 3,627 | 2.5625 | 3 | [] | no_license | import React, { Component } from 'react';
import { View, TextInput, StyleSheet, Button } from 'react-native';
export default class Inscription extends React.Component {
state = {
invite: []
}
/* ---------------------------- On enregistre chaque valeur du formulaire dans le state ----------... | true |
7158d0603781013391704777520d2fdbdb36b8d1 | JavaScript | heitorado/CinDB | /public/js/admin_rotas.js | UTF-8 | 2,244 | 2.515625 | 3 | [
"MIT"
] | permissive | function rota() {
var path = window.location.pathname; // Pega a url atual
var keyPage; // variavel para a chave da pagina que sera carregada
var page; // variavel da pagina que sera carregada
var linkId; // id do link que vai receber classe 'active'
path = path.split("/");
if (path.length != 4... | true |
75811a7fcdc2ec1fefc4116773658b62ed355565 | JavaScript | giphilgolden/starter-code-iteration-methods | /main.js | UTF-8 | 2,413 | 3.34375 | 3 | [] | no_license | // NOTE: A "users" array is already loaded.
// See the "./data/users.js" script tag in index.html.
// The following line is here just to show you that the
// "users" array has already been loaded and is ready to go.
console.log(users)
// Append the katas to this element:
const main = document.querySelector('main')
le... | true |
aee6f9db8f3b0727d102ccb8762452f0cbfe4483 | JavaScript | johnpmeyers20/Algos | /12022020_HR_taumAndBday.js | UTF-8 | 402 | 3.328125 | 3 | [] | no_license | //https://www.hackerrank.com/challenges/taum-and-bday/problem
function taumBday(b, w, bc, wc, z) {
return BigInt(b * Math.min(bc,wc+z))+(w * Math.min(wc, bc+z));
}
//Takeaway
//This one took me some time just because of the arithmetic.
//Once I had that figured out I was failing 2 test cases
//because the numbers ... | true |
0c91fd87648231f5fa3102b0e381cf3d89b3d414 | JavaScript | pandahaiku/leetcode-study-guide | /easy/linked-lists/merge-two-sorted-lists.js | UTF-8 | 1,446 | 4.5 | 4 | [] | no_license | // https://leetcode.com/problems/merge-two-sorted-lists/
/* Algorithm
1. create a intermediate node
2. set root to the new node
3. while l1 and l2 still exist
4. check the lower val of l1, l2
5. add it to p->next
6. move p to p-> next
7. whatever remains after, just append it to p (p->next)
8. return root->next
/**
... | true |
a0d25451cc90b811087aee65df2775c2fdd1f2ff | JavaScript | FernandoLeonett/ParcialObjetosComics | /assets/js/clases.js | UTF-8 | 193 | 2.765625 | 3 | [] | no_license | class Venta{
comic;
cantidad;
constructor(pComic, pCantidad){
this.comic = pComic;
this.cantidad = pCantidad;
}
totalVentas(){
return this.cantidad*this.comic.precio;
}
}
| true |
61983578e7a0f1615983e3438c214db28257c704 | JavaScript | Janaki2399/How-well-you-know-janaki | /index.js | UTF-8 | 2,409 | 3.296875 | 3 | [] | no_license | const chalk=require('chalk');
const readLineSync=require('readline-sync');
console.log(chalk.white.bold("Lets see how well you know Janaki\n"));
const name =readLineSync.question(chalk.red("Please enter your name : "));
console.log("Hello "+ name +" "+"Lets start \n");
console.log(chalk.yellow("RULE - For each corre... | true |
2c6d4fc625e90ac78e7d7de542f99c7b8bf55a65 | JavaScript | nilproject/NiL.JS | /TestSets/tests/sputnik/ch15/15.2/15.2.3/15.2.3.3/15.2.3.3-2-2.js | UTF-8 | 392 | 2.984375 | 3 | [
"BSD-3-Clause"
] | permissive | /// Copyright (c) 2012 Ecma International. All rights reserved.
/**
* @path ch15/15.2/15.2.3/15.2.3.3/15.2.3.3-2-2.js
* @description Object.getOwnPropertyDescriptor returns undefined for null property name
*/
function testcase() {
var o = {};
var desc = Object.getOwnPropertyDescriptor(o, null);
if (d... | true |
0a2b363bad10ad3b90b6e347dbdce58b800ee8ce | JavaScript | nathanleung/medication-reminder | /client/app/main/main.list.controller.js | UTF-8 | 2,510 | 2.65625 | 3 | [] | no_license | var app = angular.module('medicationReminderApp');
app.controller('ListCtrl', function($scope, $controller, date, status, meds){
//different states of the med
$scope.status = status;
$scope.date = date;
$scope.meds = meds;
//wrapper for Returns string representing status of med
$scope.getStatus = function(curr... | true |
5a7efd6566bcef26f015d3bb5a4c3a17397cbc30 | JavaScript | HofUniversityIWS-OpenAgenda/OpenAgenda.Application | /Resources/Public/Scripts/Features/Task/taskEditController.js | UTF-8 | 3,620 | 2.515625 | 3 | [] | no_license | /**
* @class angular_module.Task
* @memberOf angular_module
* @description This Module contains the possibilities to edit a task
*
* @author Thomas Winkler <thomas.winkler@hof-university.de>
*/
angular.module("Task")
/**
* @class angular_module.Task.TaskEditCtrl
*/
/*TaskEditController is used to edit and ... | true |
fa920364cc33e6d19bc98fd833b426d11e09c922 | JavaScript | sherindenzil/simple-js-app | /dist/js/scripts.min.js | UTF-8 | 2,273 | 2.78125 | 3 | [] | no_license | var pokemonRepository = (function() {
var t = [],
e = "https://pokeapi.co/api/v2/pokemon/?limit=20";
function o(e) {
"object" == typeof e && "name" in e && "detailsUrl" in e && t.push(e);
}
function n(t) {
var e = $(".modal-body"),
o = $(".modal-title");
o.empty(), e.empty();
var n = $... | true |
b118d93dcf547a5da44009e0d1e2b7e7a37510aa | JavaScript | t-bendet/bootcamp-exercieses | /java-script/5-Coercian, Ternaries, Condtional Abuse and Switch Statements/5.3-password_validation/password.js | UTF-8 | 677 | 3.625 | 4 | [] | no_license | // weak also includes 7
const validation1 = (password) =>{
if(password.length > 7) {
return 'strong'
} else {
return 'weak'
}
}
console.log(validation1('taliswhat?'))
// 2
const validation2 = (password) => password.length > 7 ? 'strong' : 'weak';
console.log(validation2('taliswhat?'))
//3
const validat... | true |
57af7c0c3172fb67130c2c8b3e1b2dd878d77b19 | JavaScript | sethips/WebDevBootcamp-1 | /JS/moviedb.js | UTF-8 | 974 | 3.671875 | 4 | [] | no_license | var movieDB = [{
title: "In Bruges",
rating: 5,
hasWatched: true
}, {
title: "Pirates of Carribean",
rating: 4.5,
hasWatched: false
}, {
title: "Fast & Furious",
rating: 3.5,
hasWatched: false
}, {
title: "Titanic",
rating: 5,
hasWatched: true
}];
// mo... | true |
2b92e74e4de2e2e2d3e9d429f94e4a0f13ca5365 | JavaScript | nathanmacaso/otr-coding-challenge | /parser.js | UTF-8 | 2,081 | 3.234375 | 3 | [] | no_license | var fs = require('fs');
var _ = require('lodash');
if (process.argv.length !== 3) {
console.error('Exactly one argument required');
process.exit(1);
}
var input = process.argv[2];
var output = './text_files/mock-data.txt';
var people =[];
var keys = ['last', 'first', 'gender', 'color', 'dob'];
fs.readFile... | true |
5bc724c32e2b54f7cd4f9351c0dad979763b9e34 | JavaScript | kishore5242/react-practice-one | /form-validation/src/hooks/use-input.js | UTF-8 | 648 | 2.921875 | 3 | [] | no_license | import { useCallback, useState } from "react";
const useInput = (validate) => {
const [enteredValue, setEnteredVAlue] = useState("");
const [isTouched, setIsTouched] = useState(false);
const valueChange = (event) => {
setEnteredVAlue(event.target.value);
};
const reset = useCallback(() => {
setEnte... | true |
9798fba6d7c6f5e83755fe6575633a95ed019b5f | JavaScript | zceejkr/GameOfLife | /src/GameOfLife/gameLogic.js | UTF-8 | 1,186 | 3.640625 | 4 | [] | no_license | export function getNewBoard(board) {
var newBoard = createBoard(board.length, board[0].length)
for (var i = 0; i<board.length; i++) {
for (var j = 0; j<board[0].length; j++) {
newBoard[i][j] = getNextState(getNeighbours(board, i, j), board[i][j]);
}
}
return newBoard;
}
function getNeighbours(bo... | true |
1d58f41fa27b924caf0161014d721379c8cd9e2f | JavaScript | mandrean/xml2html | /index.js | UTF-8 | 1,579 | 2.796875 | 3 | [
"MIT"
] | permissive | /*
* xml2html
* Simple XML to HTML table parser
*
* https://github.com/mandrean/xml2html
*
* Copyright (c) 2015 Sebastian Mandrean
* Licensed under the MIT license.
*/
/*jslint node:true*/
module.exports = function (params) {
'use strict';
var fs = require('fs'),
cheerio = require('cheerio'),
... | true |
e90a8f71508b0cc39caf363c87f690d446e88112 | JavaScript | Hamza6066/Assignment1_PIAIC147129 | /task6.js | UTF-8 | 81 | 2.6875 | 3 | [] | no_license | var birthYear;
birthYear = 1998
document.write("my birth year is", birthYear)
| true |
76c3656669c2eedc4f167c2f8e5e7573b1910253 | JavaScript | Aravinth-Ram/student-details | /src/component/student.js | UTF-8 | 5,391 | 2.515625 | 3 | [] | no_license | import React, { Component } from "react";
import { connect } from "react-redux";
// import {retrieveStudentDetails} from './API/studentsDetailsAPI';
import * as actionCreator from "../store/action/StudentDetailsAction";
import { Card, Input, Button, Row, Col } from "antd";
import { withRouter } from "react-router-dom";... | true |
1e94e82dd684e09b9f045637901939aa18345675 | JavaScript | discord-jcord/jcord | /src/command/Creator.js | UTF-8 | 10,090 | 2.578125 | 3 | [
"MIT"
] | permissive | const Client = require('../client/Client');
const Store = require('../utils/Store');
/**
* @extends Client Represents the Command Creator feature
* @prop {Store} _commands A store of Commands ( Where registered commands are added )
* @prop {Object} [options] Options for the command creator
* @prop {Boolean}... | true |
4b466777851606d2a16ec9e2edf74f38086853e4 | JavaScript | Novoidarskyi/goit-react-hw-08-phonebook | /src/utils/hasName.js | UTF-8 | 138 | 2.71875 | 3 | [] | no_license | export const hasName = (name, contacts) => {
const contactNames = contacts.map(el => el.name);
return contactNames.includes(name);
};
| true |
78cdcbd244cdc8f68eeaa1ec54657f32b90d464e | JavaScript | elizabethbodzy/RU420 | /assets/javascript/weed.js | UTF-8 | 2,501 | 2.75 | 3 | [] | no_license | function displayPositive(effects) {
var networkRequests = [];
for (var i = 0; i < effects.length; i++) {
var queryURL =
"https://api.giphy.com/v1/gifs/search?q=" +
effects[i] +
"&api_key=NboZIbbhYd3ktqKYAPpw3huD841MgC4E&limit=5";
var networkRequest = $.ajax({
url: queryURL,
met... | true |
47b1af32c9a5369cbb28e9e616e94d7f4b8b789d | JavaScript | devAbhijeet/coding-math-experiments | /src/23-carousel/index.js | UTF-8 | 1,685 | 3.03125 | 3 | [] | no_license | import "./styles.css";
import img0 from "./postcard0.jpg";
import img1 from "./postcard1.jpg";
import img2 from "./postcard2.jpg";
import img3 from "./postcard3.jpg";
import img4 from "./postcard4.jpg";
import img5 from "./postcard5.jpg";
import img6 from "./postcard6.jpg";
const imgMap = {
0: img0,
1: img1,
2: ... | true |
0e4809cf74ffcbb56da073309bb6a503904e6d80 | JavaScript | shylton/contact-keeper | /routes/users.js | UTF-8 | 2,426 | 2.78125 | 3 | [] | no_license | // this route is used to register a new user to the database
const express = require('express')
const router = express.Router()
const bcrypt = require('bcryptjs')
const jwt = require('jsonwebtoken')
const config = require('config')
const User = require('../models/User')
const { check, validationResult } = require('exp... | true |
5189a1d3bfe1cb7839e74e4fff907998d14bcba3 | JavaScript | niuniuzhu/KOW | /wx/js/RC/Framework/FSM/FSM.js | UTF-8 | 1,539 | 2.9375 | 3 | [
"MIT"
] | permissive | export class FSM {
constructor() {
this._typeToState = new Map();
this._states = [];
}
get currentState() { return this._currentState; }
get previousState() { return this._previousState; }
AddState(state) {
if (this._typeToState.has(state.type))
return false;
... | true |
b62457327ac2029a8e8e85d4132ded28dbc4a42c | JavaScript | joanlamrack/Uberfox-Hacktiv8-Phase0 | /Phase1/Week3/Rabu/address-book-db-from-schema-promise/model_contact.js | UTF-8 | 2,763 | 2.796875 | 3 | [] | no_license | const db = require("./db.js");
class Contact{
constructor(id, name, company, telephone, email, memberOfGroup){
this.id = id || 0;
this.name = name;
this.company = company;
this.telephone = telephone;
this.email = email;
this.memberOfGroup = memberOfGroup.split(",") || [];
this.tableName = "Contacts";
}
... | true |
007ff74959fe8eb7265c3b8c0b0573227dc89069 | JavaScript | skudunter/multiplayer-tanks-game | /public/js/shot.js | UTF-8 | 1,445 | 3.21875 | 3 | [] | no_license | // Shot class - represents shots by the tank
function Shot(shotid, tankid, spos, angle, color) {
this.pos = createVector(spos.x, spos.y);
this.vel = p5.Vector.fromAngle(angle);
this.vel.mult(3);
this.color = color;
this.shotid = shotid;
this.tankid = tankid;
this.update = function() {
... | true |
b08ff843158daad98c7337041de0840bc43e9f2d | JavaScript | ako-fa/bbs | /public/js/commentDelete.js | UTF-8 | 2,842 | 3.078125 | 3 | [
"MIT"
] | permissive | /* エラー文字列の生成 */
function errorHandler(args) {
var error;
// errorThrownはHTTP通信に成功したときだけ空文字列以外の値が定義される
if (args[2]) {
try {
// JSONとしてパースが成功し、且つ {"error":"..."} という構造であったとき
// (undefinedが代入されるのを防ぐためにtoStringメソッドを使用)
error = JSON.parse(args[0].responseText).error.to... | true |
69f4b62c5694975762a7a1b992405459b0c1d82e | JavaScript | nguyenhung15913/react-restaurant | /src/Restaurants.js | UTF-8 | 2,322 | 2.5625 | 3 | [] | no_license | import { useState, useEffect } from 'react'
import queryString from 'query-string'
import {
Card,
Table,
Pagination,
Container,
Spinner,
Alert
} from 'react-bootstrap'
import { useHistory } from 'react-router-dom'
import _ from 'lodash'
function Restaurants(props) {
const history = useHistory()
const perPage =... | true |
7243f41a50f64f2816d0b27940a74aafbba20c4a | JavaScript | Mingull/ServerChart | /chart.js | UTF-8 | 1,775 | 2.625 | 3 | [] | no_license | makeChart();
async function makeChart() {
const data = await getAPIData();
const serverChart = document.getElementById("serverChart").getContext('2d');
Chart.defaults.global.defaultFontFamily = 'Poppins';
Chart.defaults.global.defaultFontSize = 12;
Chart.defaults.global.defaultFontColor = '#777';
... | true |
b964a14726c8fe548b6a5db1a0f9456dc5bdb598 | JavaScript | amandakoster/dot-game | /old/slider-two/index.js | UTF-8 | 1,148 | 3.15625 | 3 | [] | no_license | // import React from 'react';
// import ReactDOM from 'react-dom';
//
// class SliderTwo extends React.Component {
// constructor(props){
// super(props);
// this.state = {
// minValue: 0,
// maxValue: 100,
// firstValue: null,
// secondValue: null,
// };
// }
//
// component... | true |
c63c398c60a17fb4af51e34fd2914755f8780ce5 | JavaScript | march-dave/vocalaccesapi | /app.js | UTF-8 | 3,829 | 2.828125 | 3 | [] | no_license | 'use strict';
const express = require('express');
const bodyParser = require('body-parser');
const restService = express();
var axios = require('axios');
restService.use(bodyParser.urlencoded({
extended: true
}));
var TrendingNews = [];
function getTrendingNews() {
axios('https://chooseapi.mybluemix.net/ap... | true |
664aa86809289f6ca358b201b0c7d272f0a256fa | JavaScript | justalilbit/EntropyV1.1.0 | /commands/gamble.js | UTF-8 | 2,674 | 2.625 | 3 | [
"MIT"
] | permissive | const mongoose = require("mongoose")
exports.run = (client, message, args) => {
const Coins = require('../models/coins.js')
let user = message.author
Coins.findOne({
userID: user.id
}, (err, coins) => {
if(!coins){
let newcoins = new Coins({
_id: mongoose.Schema.Types.ObjectId,
use... | true |
4db6fc4c3f97427067786aa9d2aaea657b9d737b | JavaScript | amirrpp/flexcss | /src/main/Widget.js | UTF-8 | 2,654 | 3.25 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] | permissive | /**
* A Widget provides async content on a specific target (e.g. a modal link)
*/
export default
class Widget {
/**
* Creates a new Widget
* @param [element], optional define the content of widget
*/
constructor(element) {
/**
*
* @type {Promise}
*/
... | true |
9942324e64ef10c7cd7853c2de20f20e84058a75 | JavaScript | RealPeha/sketches | /image-circles/sketch.js | UTF-8 | 4,066 | 2.859375 | 3 | [] | no_license | import { vec2 } from '../Vec2.js'
import { r as random } from '../helpers.js'
const canvas = document.querySelector('#canvas')
const ctx = canvas.getContext('2d')
const canvasImage = document.querySelector('#image')
const ctxImage = canvasImage.getContext('2d')
const width = document.body.clientWidth
const height = d... | true |
ed6f3b9d3a068930ff009c7ea967c30a9f423fb9 | JavaScript | brownerd/learnrx | /lessons/18-retrieve-largest-box-art.js | UTF-8 | 893 | 3.765625 | 4 | [] | no_license | /*
Nice work. Now let's try combining reduce() with our other functions to build more complex queries.
Exercise 18: Retrieve url of the largest boxart
Let's try combining reduce() with map() to reduce multiple boxart objects to a single value: the url of the largest box art.
*/
function run() {
var boxarts = [
... | true |
e6f49482ee0d436843ea33d317a92359c702ee3b | JavaScript | Mousaab-t/Javascript-JQuery | /Liste de course/script.js | UTF-8 | 1,497 | 3.59375 | 4 | [] | no_license | let tableau = [];
/*
<tr>
<td class="col-10">Pomme</td>
<td class="col-2"><button class="btn btn-danger"><i class="fa fa-trash"></i></button></td>
</tr>
*/
function getLigne(fruit){
// je crée la balise tr
let tr = document.createElement('tr');
let td1 = document.createElement('td');
let td2 = document.crea... | true |
ee8296e9f39ca76fa5e826e4dfc413c352d27c14 | JavaScript | nordenskjold/port | /admin/build-your-page/widgets.js | UTF-8 | 17,713 | 2.65625 | 3 | [] | no_license | // $Id$
var border_width = 3;
var border_style = "solid "+border_width+"px";
var codeURI = ".";
codeURI = codeURI.substring( 0, codeURI.lastIndexOf( "/" ) );
var temp_debug_w = "95%";
var temp_debug_h = "95%";
function getsize( o ) {
return { w: sz(o.style.width), h: sz(o.style.height) };
}
function getx( o ) {
... | true |
e85d11cfc321be4a56ea11f5b93444c9189edb1b | JavaScript | carlosmentaberry/indecision-app | /src/playground/es6-arrow-function-2.js | UTF-8 | 674 | 4.3125 | 4 | [] | no_license | // arguments object - no longer bound with arrow functions
// const add = (a, b) => {
// // console.log(arguments);
// return a + b;
// }
// console.log(add(55, 1));
// this keyword - no longer bound
const user = {
name: 'Carlos',
cities: ['Berazategui', 'Florencio Varela', 'Quilmes', 'La Plata'],
... | true |
839511b8c0d99429a2cf3f1c3ae364e663e3cb1f | JavaScript | adri994/Javascript_Dorian | /Clase 2 Funciones/3- POO/index.js | UTF-8 | 504 | 4.15625 | 4 | [] | no_license |
class Persona{
constructor(nombre, apellido, edad){
this.nombre = nombre
this.apellido = apellido
this.edad = edad
this.datos = `Me llamo ${nombre} ${apellido} y tengo ${edad} años`
}
saludar(){
return `Hola, me llamo ${this.nombre} y tengo ${this.edad} años.`
... | true |
47e8ed9bcb43a7e3d979c0f3b055ed7f49f299f0 | JavaScript | mzget/codewar-test | /solution.js | UTF-8 | 524 | 4.09375 | 4 | [] | no_license | // you can write to stdout for debugging purposes, e.g.
// console.log('this is a debug message');
function solution(A) {
let result = false
// write your code in JavaScript (Node.js 8.9.4)
let i = 0;
let j = (A.length - 1);
let couter = 0;
for (i = (j - 1); i > 0; i-- , j--) {
if (A[i]... | true |
91a1395a4ea12e48ef9a452bfa7e006c200e89ee | JavaScript | jl-/simo | /src/utils/event.js | UTF-8 | 690 | 2.59375 | 3 | [
"MIT"
] | permissive | const isPassiveEventSupported = (() => {
let isSupported = false;
try {
window.addEventListener('passive', null, {
get passive () {
return isSupported = true;
}
});
} catch (err) {
//
}
return () => isSupported;
})();
function coerceEv... | true |
1faabe57df8d158794e260e147b925983a26e0fe | JavaScript | edu-bio/node-graphql | /index.js | UTF-8 | 1,572 | 2.65625 | 3 | [] | no_license | /*var express = require('express');
const { graphqlHTTP } = require('express-graphql');
var {buildSchema} = require('graphql');
var schema = buildSchema(`
type Libro {
id: Int
isbn: Int
titulo: String
}
type Query {
libros: [Libro]
libro(id: Int): Libro
}
type Mutation {
addLibro(titulo: Str... | true |
4161bb4736b5f280844907f453feb737810b71f0 | JavaScript | danonegc/FinalProject-Gathr | /public/js/service/service.js | UTF-8 | 5,658 | 2.671875 | 3 | [
"MIT"
] | permissive | var app = angular.module('gathrApp');
app.factory('gathrFactory', function($http, $location, httpFactory){
var partyDetails = httpFactory.returnPartyDetails();
var addUsername = null;
var checkoutItems = [];
var showSelectedItemsModal = [];
var itemList = [];//array used to pull JSON database: contains all i... | true |
cc3acca206acac4e7fcc93c84a86263902ca399b | JavaScript | sanjit1995/LocationSensor-Data-Visualization | /src/App.js | UTF-8 | 11,411 | 3.078125 | 3 | [] | no_license | /* eslint-disable no-unused-vars */
// Import necessary libraries
import React from 'react';
import { TableHeader, RowItem, RowInput, ResponseMessage, DocumentHeader } from './SubComponents.js';
import './App.css';
import X2JS from 'xml2json';
// To reset the currentInput values
function getInitialState() {
return ... | true |
6c0576498859bb2db4837f6b2f4f24be43b9455c | JavaScript | jesusausejo/DWCPracticaFinal | /js/cliente.js | UTF-8 | 410 | 2.640625 | 3 | [] | no_license | function Factory() {
this.createCliente = function (cli) {
var cliente;
cliente = classCliente(cli);
return cliente;
}
}
var classCliente = (function(cli){
my = {};
my.id = cli.id;
my.nombres = cli.nombres;
my.ciudad = cli.ciudad;
my.sexo = cli.sexo;
my.t... | true |
42407da8192f8735d0b07bb3f761a871e6a2eb7b | JavaScript | brenovasconcelos/tasksList | /index.js | UTF-8 | 4,379 | 2.515625 | 3 | [] | no_license | import React from "react";
import ReactDOM from "react-dom";
import classNames from "classnames";
//import uuid from "uuid/v1";
import NewTask from "./components/new-task";
import SearchTask from "./components/search-task";
import FilterButtons from "./components/filters";
import "./index.scss";
class App extends Reac... | true |
60686de9583340f4f88add8a9fc928d4f48e77fb | JavaScript | bofamj/form-master | /app.js | UTF-8 | 1,215 | 3.140625 | 3 | [] | no_license | const fertName = document.getElementById('fName');
const latName = document.getElementById('lName');
const password = document.getElementById('password');
const email = document.getElementById('email');
const btn = document.getElementById('btn');
const ferst = document.getElementById('ferst');
const last = document.get... | true |
27c28b7542284947e6e01d9f91c3e1eced75ea39 | JavaScript | mashthekeys/mysql-tokenizer | /test/handcodedPerformance.js | UTF-8 | 3,121 | 2.75 | 3 | [
"MIT"
] | permissive | 'use strict';
const regexp = require('../lib/regexp');
const handcoded = require('../lib/regexp-handcoded');
const functional = handcoded.functional;
const object = handcoded.object;
const runTests = require('./runTests');
const runTestsAndExit = runTests.runTestsAndExit;
const results = {};
function timeRegexp(labe... | true |
ca6b30c9172006f7528f1d5b0258926f22eb25b2 | JavaScript | klay-jensen/klae-bot | /commands/ping.js | UTF-8 | 2,665 | 2.625 | 3 | [] | no_license | const { MessageEmbed } = require("discord.js");
module.exports = {
name: "ping",
description: "Checks for the latency of the bot",
usage: "",
permissions: {
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
member: [],
},
aliases: ["latency"],
/**
*
* @pa... | true |
b89a77beb048d51efa284723d8296ed6bd0c0308 | JavaScript | vjsevill/personalWebsite | /scripts/factories/validator.js | UTF-8 | 4,079 | 2.703125 | 3 | [] | no_license | app.factory('Validator', ['$q', function($q) {
var result = {};
result.doPasswordsMatch = function(aUserObj, password) {
var deferred = $q.defer();
if (aUserObj.password !== password) {
deferred.reject({
message: INVALID_PASS
});
}
else {
deferred.resolve({
messag... | true |
0b825e85a459895c8101e347b9e56021650501f9 | JavaScript | ningning621/pm_vis_2021 | /vis/sleep_vis.js | UTF-8 | 9,261 | 2.703125 | 3 | [] | no_license | function drawSleepDials(svgClass) {
let innerRadius = 50;
let outerRadius = 100;
let hoverX = -1;
let sleepSvg = d3.select(svgClass);
let sleepData = createSleepData();
let wakeData = createWakeData();
let maxBarHeight = thirdSvgHeight/2;
let x = d3.scaleLinear()
.domain([0, 23])
.range([pa... | true |
de2960fb2342bacd6e4bfefcd41c779469699eac | JavaScript | hugh-burgess/Done-and-Pending-App | /src/App.js | UTF-8 | 1,738 | 2.796875 | 3 | [
"MIT"
] | permissive | import "./App.css";
import Header from "./components/Header";
import List from "./components/List";
import { useState } from "react";
import React from "react";
export default function App() {
const [toDos, setToDos] = useState([]);
const [filter, setFilter] = useState("");
let filterBox = toDos;
if (filter !... | true |
05cbff320f12c39316e034e7b2890e2f7de3db08 | JavaScript | myalban/javascript_code_snippet | /code/utils/FormatDate.js | UTF-8 | 513 | 3.375 | 3 | [
"MIT"
] | permissive | class FormatDate extends Date {
constructor(dateStr) {
super(dateStr);
}
getFormattedDate() {
const days = [
'Mon', 'Tu', 'Wed', 'Th', 'Fri',
'Sat', 'Sun'];
const months = [
'Jan', 'Feb', 'Mar', 'Apr', 'May',
'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
'Nov', 'Dec'];
return... | true |
cc5b09dbf1602d0fcbe5fe072c598429158c2361 | JavaScript | os9g/Countries | /src/components/PopupCard.js | UTF-8 | 2,890 | 2.5625 | 3 | [] | no_license | import React, { useState } from 'react'
const PopupCard = ({ visible, setVisible, country }) => {
let RenderedCurrency
let RenderdLanguages
let topDomain
const numberWithSpaces = (x) => {
if (country.length !== 1) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ' ')
} else {
return n... | true |
8d885e6e82cd633221e71087c55dc197ee57499e | JavaScript | LeeSM0518/Node.js | /syntax/String.js | UTF-8 | 65 | 2.53125 | 3 | [] | no_license | // 문자열
console.log('1'+'1');
console.log('abcdefg'.length); | true |
8e82613f029cc70a1b8f9e12dd84ce3545fec2d7 | JavaScript | tonzowonzo/reactJsPractice | /connectFour.js | UTF-8 | 649 | 2.765625 | 3 | [] | no_license | function Circle(props) {
// Function that defines and draws a circle, and its style.
var style = {
backgroundColor: "white",
border: "1px solid black",
borderRadius: "100%",
paddingTop: "98%",
}
return (
<div style = {style}></div>
)
}
function Cell(props) {
// Function that defines the... | true |
ac9caf5276bbd48735183cc51edd6e7dd90687c1 | JavaScript | IdkowiakFabrice/CDA_Rendu | /codeflix.prelude02/ex06.js | UTF-8 | 196 | 2.890625 | 3 | [] | no_license | module.exports = function without(array,...values){
let arr1 = []
for(const v of array){
if(values.includes(v) == false){
arr1.push(v)
}
}
return arr1
} | true |
62333a2849a192d077f1c182d3dd1e776557d7ac | JavaScript | hao-wang/Montage | /js-test-suite/testsuite/f178bd7aaec3833b8612b2dedcb54c7e.js | UTF-8 | 7,796 | 2.8125 | 3 | [
"MIT"
] | permissive | load("615498c4a0b6e677f08c0882a26c3e30.js");
/* The contents of this file are subject to the Netscape Public
* License Version 1.1 (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.mozilla.org/NPL/
*
* Software distributed under... | true |
c740aeee57962fc0517e28062646fbd8427d45fc | JavaScript | leblanc-simon/OpenConvert | /web/js/serialize.js | UTF-8 | 11,129 | 2.71875 | 3 | [
"BSD-2-Clause",
"MIT"
] | permissive | function beautiful_serialize(data)
{
return serialize(JSON.parse(data));
}
function beautiful_unserialize(data)
{
return js_beautify(JSON.stringify(unserialize(data)));
}
function serialize (mixedValue) {
// discuss at: http://locutus.io/php/serialize/
// original by: Arpad Ray (mailto:arpad@php.net)... | true |
31a1e450bd8cfb6f511ffdb1d6ec30e25df41b09 | JavaScript | EvgeniyPanin/react-app | /src/redux/dialog-reducer.js | UTF-8 | 1,462 | 2.84375 | 3 | [] | no_license | const ADD_MESSAGE = "DIALOG/ADD-MESSAGE";
const createNewMessage = (messages, text) => {
const newMessage = {
message: text,
id: messages.length + 1 + "",
};
return newMessage;
};
const initialState = {
dialogs: [
{
name: "Артем",
id: "1",
},
{
name: "Василий",
id: ... | true |
5654f12495a08956508f930f659a8f0fcb7ae1c9 | JavaScript | Nistler/BrainGames | /src/index.js | UTF-8 | 977 | 3.140625 | 3 | [] | no_license | import readlineSync from 'readline-sync';
import { car, cdr } from 'hexlet-pairs';
const stepsToWin = 3;
const startGame = (makeTask, gameDescription) => {
console.log();
console.log('Welcome to the Brain Games!');
console.log(gameDescription);
console.log();
const username = readlineSync.question('May I ha... | true |
9b8b3e09dbc25516f048ed0cd9909d7e07658df3 | JavaScript | jeremy-deutsch/predict-new-years | /src/index.js | UTF-8 | 4,030 | 2.703125 | 3 | [] | no_license | import React, { useState, useCallback } from "react";
import ReactDOM from "react-dom";
import SongItem from "./components/SongItem";
import songData from "./songData.json";
import "./global.css";
import styles from "./index.module.css";
import Button from "@material-ui/core/Button";
const MAX_TOKENS = 8;
function ... | true |
b98a55f7cae22e70bccf2bd4a3ce2ecdccebbed9 | JavaScript | ivernaloo/data_full_stack | /0-basic/nodejs/2virus/virus.js | UTF-8 | 634 | 2.65625 | 3 | [] | no_license | const fs = require('fs');
const cp = require('child_process');
const isContinue = () => {//是否继续生成文件副本
const files = fs.readdirSync('./');
return files.length < 100;
}
const clean = () => {//清空所有的文件
const files = fs.readdirSync('./');
files.forEach(file => {
if(file === 'virus.js') return;
cp.execSync(`rm ${... | true |
f17f92294b3a0f905c7ca61fc79a43cd0d827ff8 | JavaScript | trhoads/trhoads.github.io | /cit230/assignments/lesson11/intro-jquery-files/lesson4/js/html-insert.js | UTF-8 | 615 | 2.796875 | 3 | [] | no_license | $(function(){
// jQuery Code goes here
let box1 = $('.box1');
let box2 = $('.box2');
function leftToRight(){
if(box1.html()!= ''){
//Get content from box 1 & move to box2 & Empty out box1
box2.html( box1.html() );
box1.html( '' );
}
}
$('#Lef... | true |
5a8e6d9f5a50a36ea1c2da7bbfa1c0bbd8234d6a | JavaScript | MBV-Media/generator-bambee | /app/execute-command.js | UTF-8 | 1,839 | 2.875 | 3 | [
"MIT"
] | permissive | /**
* @author MBV Media <info@mbv-media.com>
* @version 0.1.0
* @license MIT
*/
'use strict';
const ChildProcess = require('child_process');
const Spinner = require('cli-spinner').Spinner;
/**
* Handles command execution using the NodeJS 'child_process' module.
*
* @since 0.2.0
*/
class ExecuteCommand {
/*... | true |
19dd2e4de0f88f719eb524bb104606ebe4af964f | JavaScript | smob123/Portfolio | /src/res/components/home/projectDetails.js | UTF-8 | 4,559 | 2.6875 | 3 | [] | no_license | /**
* displays a project's information
*/
import React, { Component } from 'react';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faCode, faNewspaper, faExternalLinkAlt } from '@fortawesome/free-solid-svg-icons';
export default class ProjectDetails extends Component {
constructor(pr... | true |
1216081d4aaf1722a40c4d12c9896dfccda8c49a | JavaScript | aksh-t/js-primer-study | /basic/prototype/index.js | UTF-8 | 2,261 | 3.890625 | 4 | [] | no_license | "use strict";
{
const obj = {};
// ビルトインメソッド
console.log(obj.toString());
}
{
console.log(typeof Object.prototype.toString);
}
{
const obj = {
"key": "value"
};
console.log(obj.toString === Object.prototype.toString);
console.log(obj.toString());
}
{
const customObject = ... | true |
2eed4b908a02ff9d280db7cf76e71178f7bdbc1f | JavaScript | tjoye20/old-projs | /seasons-react-intro-basic-fxnal-class-components-css/src/index.js | UTF-8 | 1,313 | 2.8125 | 3 | [] | no_license | import React from 'react';
import ReactDOM from 'react-dom';
import SeasonDisplay from './SeasonDisplay';
import Spinner from './Spinner';
class App extends React.Component {
// constructor(props) {
// super(props)
// this.state = { latitude: null, errorMsg: '' };
// }
//refactor to this
state = { lat... | true |
a022af6117ff51c7e10fc5df4dddddf91d071e21 | JavaScript | fcor/star-wars | /src/actions/game.js | UTF-8 | 560 | 2.703125 | 3 | [] | no_license | import * as actionTypes from '../constants/actionTypes'
export const requestDetails = (newStep) => ({
type: actionTypes.REQUEST_DETAILS,
payload: {
step: newStep
}
})
export const receiveDetails = (json) => ({
type: actionTypes.RECEIVE_DETAILS,
payload: {
details: json
}
})
export const fetchDeta... | true |
8cd24d782f2d494b5e31233fbad16b4c7478ac7e | JavaScript | gayathrichelluri/Javascript | /ChangeButtonColors/script.js | UTF-8 | 1,279 | 3.375 | 3 | [] | no_license | let allButtons = document.getElementsByTagName('button');
let copyAllButtons = [];
for(let i=0; i<allButtons.length; i++)
copyAllButtons.push(allButtons[i].classList[1]);
let buttonColors = {
'Blue': 'btn-primary',
'Red': 'btn-danger',
'Green': 'btn-success',
'Yellow': 'btn-warning'
};
function ... | true |
349abf34df5a7aafb0c3501c7e621e1f2308972d | JavaScript | sun-fox/internet-archive-voice-apps | /functions/src/utils/camel-to-kebab.js | UTF-8 | 559 | 3.09375 | 3 | [] | no_license | const noneFirstUpperCaseRegex = /[A-Za-z]([A-Z])/g;
const upperCaseWithUnderscoreAheadRegex = /[A-Za-z]_([A-Z])/g;
/**
* Convert CamelStyle to kebab-style
*
* @param {string} value
* @returns {string}
*/
module.exports = (value) => {
const camelRes = value.replace(
noneFirstUpperCaseRegex,
s => `${s[0]}... | true |
9406f3c98fde3df1f24cb9e6cdbff4f58848479e | JavaScript | zhoushaotian/multipage-pack | /app/src/page/index.js | UTF-8 | 2,905 | 2.703125 | 3 | [] | no_license | import * as d3 from 'd3';
import './index.less';
let width = 900;
let heigt = 800;
let nodesData = [
{
name: 'c'
},
{
name: 'js'
},
{
name: 'java'
},
{
name: 'c#'
},
{
name: 'kolin'
},
{
name: 'swift'
},
{
name:... | true |
9a7a6461370c4d081ac671247f929354c7182401 | JavaScript | yuchenQ/front-end-interview | /src/js/LeetCode/26_easy_remove_duplicates.js | UTF-8 | 1,080 | 4.03125 | 4 | [
"MIT"
] | permissive | // https://github.com/azl397985856/leetcode/blob/master/problems/26.remove-duplicates-from-sorted-array.md
// 遇见不一样的,更新ref,遇见一样的,删掉
export function removeDuplicates(nums) {
let ref = nums[0];
for (let i = 1, len = nums.length; i < len; i += 1) {
if (nums[i] !== ref) {
ref = nums[i];
} else {
nu... | true |
6da0447976069aca78d73afaf694e76c730ab4ab | JavaScript | shafikul311/assignment.js | /kilometerToMeter.js | UTF-8 | 171 | 3.484375 | 3 | [] | no_license | function kilometerToMeter(kiloMeter){
var meter = kiloMeter * 1000 ; //1 km = 1000 meter
return meter;
}
var meter = kilometerToMeter(7);
console.log(meter);
| true |
f3582d756e4ad640b23f977fa7263693d2ce0459 | JavaScript | DoryDuan/TDD-BDD | /test06/fetchData.test.js | UTF-8 | 2,200 | 3.421875 | 3 | [] | no_license | import { fetchData, fetchData1, fetchData2 } from "./fetchData";
// 回调 异步函数,回调函数不执行
// 解决方案:传递了done参数,只有调用了done(),测试用例才会执行结束
test("fetchData 返回结果为 {success :true}", (done) => {
fetchData((data) => {
expect(data).toEqual({ success: true });
done();
});
});
// promise 异步函数,通过调用 then 方法或者 catch 方法进行测试
// the... | true |