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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
d0ad73c4d57d4426ee17e8284393719831574c4a | JavaScript | ACRONYM-Group/ACIJS | /ACI.js | UTF-8 | 3,117 | 2.65625 | 3 | [] | no_license | runningInNode = false;
if (typeof window === 'undefined') {
runningInNode = true;
} else {
runningInNode = false;
}
if (runningInNode) {
console.log("Running in Node")
var WebSocket = require('isomorphic-ws');
}
class connection {
constructor(ip, port, connectedCallBack, messageCallback) {
... | true |
ddfef815d377f2e5e054bb808d8c91317bc0955c | JavaScript | nikych/SoftUni-HomeWorks | /JavaScript/03. JavaScript Loops,Arrays,Strings/15.frequentWord.js | UTF-8 | 1,826 | 3.4375 | 3 | [] | no_license | function findMostFreqWord(input){
var punctuation = ['"', "'", ",", ";", ".", "+"];
var inp = input.split(" ");
var finArray = [];
var wordArray = [];
var numArray = [];
for (var i = 0; i < inp.length; i++) {
for (var j = 0; j < punctuation.length; j++) {
while (inp[i].indexO... | true |
fb7baab867499985f2d1a08e16348847ca4248ee | JavaScript | Bugofbook/MyFPLib | /lib/markDownfile/index.js | UTF-8 | 396 | 2.765625 | 3 | [
"MIT"
] | permissive | /**
*separate table-data of Markdown-file into 2-dimentionality Arrays
* @param {String} data
* the String of Table in Markdowm file
* @returns
* return 2-dimentionality Arrays. all row data are 1-dimentionality Array
*/
const separateTableData = data =>
data.split("|\n").map(e =>
e
.slice(1, -1)
... | true |
0961c932eeacd2ef9897e930097a0494d28e2e25 | JavaScript | Csandori/advent2020 | /14.js | UTF-8 | 3,126 | 3.4375 | 3 | [] | no_license | const input = require("./14input");
let data = input.input.split(/[\n\r]/gm).reduce((a, b) => {
if (b.includes("mask")) {
a.push({ mask: b.split(" = ")[1], mems: {} });
} else {
a[a.length - 1].mems[b.split("[")[1].split("]")[0]] = parseInt(
b.split(" = ")[1]
);
}
return a;
}, []);
//console... | true |
cc6f3073453e1eed69ec8984a12c3c1a2720c341 | JavaScript | 2kuba/N220Summer2021 | /labs/lab3/circlesincircles/js/circlesincircles.js | UTF-8 | 368 | 3.796875 | 4 | [] | no_license | //keep track of number of circles and their respective radii
i = 1;
x = 300;
y = 300;
radius = 300;
//create the canvas
function setup() {
createCanvas(800,800);
}
function draw() {
//starting with largest circle, draw the circle and then reduce radii
if ( i <= 30) {
circle(x, y, radius);
... | true |
d5905cc897a10c204bc5263638e5de4be402d76d | JavaScript | NodeJer/user-validate-for-javascript | /user-validate.js | UTF-8 | 749 | 2.53125 | 3 | [] | no_license |
(function(root, $, factory){
if(typeof define === 'function' && define.cmd){
define(function(require, exports, module){
exports.userVerification = factory($);
});
}
else{
root.userVerification = factory($);
}
})(window, window.Zepto||window.jQuery, function($){
function userValidate(usern... | true |
dc8594f077363c966f3e95371938a71c28b13402 | JavaScript | Shb742/GOSHPrevision | /js/Custom/sound.js | UTF-8 | 4,329 | 2.5625 | 3 | [] | no_license | var voices;
var speaking = false;
var speechQue = [];
var onEnd;
var msg;
var mic_active;
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
function loadSpeech(){
try {
onEnd = function(event) {
speaking = false;
stopCurrentAnimation();
robotIdle(true);
if (curTextDiv == humT... | true |
cc8a45f2a58e973fffce3bb18ada5f273682e89b | JavaScript | Dagge1/node3-weather-website | /public/js/index.js | UTF-8 | 1,351 | 3.515625 | 4 | [] | no_license | // front end js
const weatherForm = document.querySelector('form'); // vraća js reprezentaciju tog DOM elementa
const search = document.querySelector('input'); // dohvaćamo sadržaj <input> elementa
const messageOne = document.querySelector('#message-1'); // lokacija za ispis poruka
const messageTwo = document.query... | true |
755c2764735f68625532d119d2cf17893e7f4a5d | JavaScript | rajwinkau/slackbot-exercise | /exercises/exercise2.js | UTF-8 | 1,786 | 3.25 | 3 | [] | no_license | // Set this assignment to true if you do want to use it.
module.exports.ACTIVATE_BOT = true;
module.exports.botScripts = [
{
label: 'kaurchatBot',
prompt: 'I am tired',
handler: function () {
return 'Wake Up!';
},
isReply: true,
isCaseSensitive: false,
isListening: true,
},
// ... | true |
2182d1cf73632be70421122e03be0b9233ae2363 | JavaScript | Alspirid/JS-project-pacman | /scripts/canvas.js | UTF-8 | 7,894 | 2.515625 | 3 | [] | no_license |
let isPaused = true;
let isStart = true;
let isGameOver = false;
let isVolume = true;
const packman = {
x: 50,
y: 100,
pacmouth:320,
pacdir: 0,
pSize: 32,
speed: 15,
};
const enemy = {
x: 150,
y: 200,
speed: 5,
movingTime: 0,
dirX: 0,
dirY: 0,
flash: 0,
ghostEat: false,
};
const powerbal... | true |
96e8a493d238b4c1ab0fa4712fcff5878e2f655a | JavaScript | sawantv02/JavaScript_Samples | /Nodejs/directory.js | UTF-8 | 212 | 2.984375 | 3 | [] | no_license | var fs=require('fs');
if(fs.existsSync("lib")){
console.log("Directory already present!")
}else{
fs.mkdir("lib",function(err){
if(err){
console.log(err);
}else{
console.log("Directory created");
}
});
} | true |
51d3c1f14ff5763fbe54a49a83cb4337e42e9ab6 | JavaScript | jfmherokiller/TwineJavascriptExaimination | /switchthing/switchthing.js | UTF-8 | 704 | 2.6875 | 3 | [] | no_license | /**
* Created by jfmmeyers on 6/14/16.
*/
function createswitch(type, name, ArrayOfCasesAndCodes) {
window[name + '_evalswitch'] = function (casetocheck) {
for (var index = 0; index < ArrayOfCasesAndCodes.length; index++) {
var switchcase = ArrayOfCasesAndCodes[index];
if (casetoc... | true |
c50697402c6c4cfbfe1213458c1cb0ba6228d08b | JavaScript | RafaelRCLima/LearningJavaScript | /objetos/objetoConstante.js | UTF-8 | 867 | 4.3125 | 4 | [] | no_license | // pessoa --> 123 --> {...}
const pessoa = { nome: 'Joao'}
pessoa.nome = 'Pedro'
console.log(pessoa)
// o objeto pessoa não pode ser alterado, mas os atributos do objeto pessoa sim.
// pessoa = {nome: 'Ana'} -->> Nesse caso a atribuicao esta sendo refeita diretamente para pessoa.
/* Quando um objeto é criado ele refer... | true |
a4baf642c35d1b39469379c2fe20dab5ff572e1a | JavaScript | jamesmoops/projectone | /javascript/code.js | UTF-8 | 2,455 | 3.421875 | 3 | [] | no_license | // MAKE SURE you're working in a branch! "git branch" in terminal to check if you're in the master or the branch
// git pull origin master at each session that you begin!
$(document).ready(function () {
// on click
$("#ingedientButton").on("click", function () {
$("#ingredientInput");
populat... | true |
e337b8495b9a2cda9ff87920073e1da625fce8b8 | JavaScript | t-saito/tdd_js_sample | /src/calc.test.js | UTF-8 | 234 | 2.515625 | 3 | [] | no_license | import Calc from './calc';
test('adds 1 + 2 to equal 3', () => {
const calc = new Calc();
expect(calc.sum(1, 2)).toBe(3);
});
test('4-2=2 となる', () => {
const calc = new Calc();
expect(calc.subtract(4, 2)).toBe(2);
});
| true |
823d77ed2fdf98336b686038ad3b83e3b7de9f97 | JavaScript | nandacris/3mat2021-1 | /revisao-js/vetores.js | UTF-8 | 2,723 | 3.921875 | 4 | [] | no_license | let frutas = ['laranja', 'maça', 'banana', 'pera', 'uva', 'mamão']
//Exibir vetor
console.log(frutas)
//Tirar o último elemento do vetor
let UltimaFruta = frutas.pop()
console.log(frutas)
console.log(UltimaFruta)
//Tirar o primeiro elemento do vetor
let PrimeiraFruta = frutas.shift()
console.log(frutas)
console.lo... | true |
bdaa4fdae1904eb64b9f1ad9d78b1d12e1ce88ba | JavaScript | onaumova/TasteBud | /client/components/Search.jsx | UTF-8 | 2,578 | 2.609375 | 3 | [] | no_license | import React, { Component } from "react";
import * as actions from "../actions/actions.js";
import { connect } from "react-redux";
const mapStateToProps = store => ({
input: store.reducers.input,
category: store.reducers.category
});
const mapDispatchToProps = dispatch => {
// create functions that will dispatc... | true |
a5025f1f8330b18a2931b932dce15b4b737a1cdf | JavaScript | FarhanMobashir/problem-solving | /hackerrank/sherlockAndArray.js | UTF-8 | 486 | 4.0625 | 4 | [] | no_license | /*
? Problem Statement : Watson gives Sherlock an array of integers. His challenge is to find an element of the array such that the sum of all elements to the left is equal to the sum of all elements to the right.
* Input : [1,1,4,1,1] -> YES
* Input : [5,6,8,11] -> YES
*/
function balancedSums(arr) {
for (l... | true |
f9a88ba47f1df25df47281e6e2baa36be78e2900 | JavaScript | AndreiShupik/check-log-pass | /index.js | UTF-8 | 1,389 | 2.859375 | 3 | [] | no_license | const emailInput = document.querySelector('#email');
const emailErrorText = document.querySelector('.error-text_email');
const passwordInput = document.querySelector('#password');
const passwordErrorText = document.querySelector('.error-text_password');
const isRequired = value => value
? undefined
: 'Required... | true |
735758534b5ef7ebb3c07a7278ecb0a01924abab | JavaScript | xiolng/wingmeter-nethall | /src/util/util.js | UTF-8 | 255 | 2.640625 | 3 | [] | no_license | export const verificationTime = (callback) =>{
let time = 60
let setTime = ()=>{
if(time >= 1){
setTimeout(()=>{
time -= 1
callback(time)
setTime()
},1000)
}
}
setTime()
if (time <= 0) setTime = null
} | true |
2f2b4c2bbdd4cfb5f5595b67ddb320c2742b903b | JavaScript | Mvcampbell3/interapp | /routes/api/taskRoute.js | UTF-8 | 2,216 | 2.5625 | 3 | [] | no_license | const router = require("express").Router();
const Task = require("../../models/Task");
const User = require("../../models/User");
// Get all of the tasks, regardless of user, this will be removed or gated
router.get("/all", (req, res) => {
Task.find()
.then(result => res.json(result))
.catch(err => res.json(... | true |
1edd7a02f143110a7717fb6815c88aafa7b2ba45 | JavaScript | ValEmpire/snake_multiplayer | /server/src/Game.js | UTF-8 | 8,055 | 2.84375 | 3 | [
"MIT"
] | permissive | const {
GAME_SPEED,
INITIAL_SNAKE_SIZE,
SNAKE_COLORS,
DOT_COLORS,
SNAKE_COLLISIONS,
AUTO_MOVE_DEFAULT,
MAX_PLAYER_NAME_LENGTH,
MAX_PLAYER_MSG_LENGTH
} = require('./constants')
const { randomNum } = require('./utils')
const { Snake } = require('./Snake')
const { Dot } = require('./Dot')
/**
* @class G... | true |
d99c4498262609ef302497b05af400bdb64450e5 | JavaScript | HENRYKC24/Math-Magicians-React-Redux | /src/components/Calculator.js | UTF-8 | 740 | 2.515625 | 3 | [
"MIT"
] | permissive | import React, { useState } from 'react';
import calculate from '../logic/calculate';
import Table from './Table';
const Calculator = () => {
const [state, setState] = useState({
total: 0,
next: null,
operation: null,
});
const handleClick = (data) => {
setState((obj) => {
const newObject =... | true |
d3c1c0e794843491bb8542f1f0dbbb45aa14c1db | JavaScript | alessandroDiPietro/PokemonPokedex-main | /src/App.js | UTF-8 | 3,582 | 3.296875 | 3 | [
"MIT"
] | permissive | import axios from 'axios';
import React, { useState, useEffect } from 'react';
import { Card, Button } from 'react-bootstrap';
import './App.css';
function App() {
const number = 10;
//Object array that contains name and img. It will be populated by the set
const [pokemon, setPokemon] = useState(null);
... | true |
027a11e1857b5532d3a5894076ddce399ced4377 | JavaScript | hkrol1994/nodeBasic | /weather-api/src/routers/weatherRouter.js | UTF-8 | 1,930 | 2.59375 | 3 | [] | no_license | const express = require("express");
const geocode = require("../utils/geocode");
const forecast = require("../utils/forecast");
const Weather = require("../models/weatherModel");
const router = new express.Router();
router.get("/weather/:city", async (req, res) => {
const city = req.params.city;
try {
const {... | true |
5c9650e24aff443f66445749b53d4406a3b07351 | JavaScript | chrisisler/chips | /src/_flatten.js | UTF-8 | 653 | 3.15625 | 3 | [
"MIT"
] | permissive | var _is = require('./util/_is');
var _concat = require('./_concat');
var _reduce = require('./_reduce');
/**
* Returns a copy of `values` flattened to one-dimension (plucked out sub-lists).
*
* @example C.flatten([ 1, [ 2, [ 3 ] ] ]); //=> [ 1, 2, 3 ]
*
* @param {Array[*]} values - A list of values of any type, m... | true |
0045ebb4b3129978d52de6c264e3d2700d27a9f0 | JavaScript | BoazTjallinks/SimpleMuteDiscordBot | /functions/Silence.js | UTF-8 | 1,329 | 2.6875 | 3 | [
"MIT"
] | permissive | function getChannel(client, msg, authorID, guildID) {
let channel = null;
if (authorID === "") {
channel = msg.member.voice.channel;
} else {
client.guilds.cache.forEach(guild => {
if (guild.id == guildID) {
channel = guild... | true |
936cd071a73c5076e0176e3aa45dfc023b95c49b | JavaScript | EugeneScher/Remote | /local_storage/2.js | UTF-8 | 1,051 | 3.1875 | 3 | [] | no_license | let Perm1 = vb('This is text'),
left = vb('.left'),
right = vb('.right'),
LSLength = localStorage.length;
function chechLength() {
if (localStorage.length > 0) {
left.style.display = 'block';
right.style.display = 'block';
} else {
left.style.display = 'none';
right.style.display = 'none';
}
}... | true |
2e85c167d13d5722360d2f3963c5d41a2ac755b6 | JavaScript | shubhamkr75/Weather-Forecaster-React | /src/Components/Display/Display.jsx | UTF-8 | 3,119 | 2.515625 | 3 | [] | no_license | import React, { useState } from "react";
import "./Display.css";
import { makeStyles } from "@material-ui/core/styles";
import Card from "@material-ui/core/Card";
import CardContent from "@material-ui/core/CardContent";
import Typography from "@material-ui/core/Typography";
import Button from "@material-ui/core/Button... | true |
b9db64386216730939f13651344d12d076000af1 | JavaScript | majun1997/WebDesign | /5JS/src/reverse.js | UTF-8 | 668 | 3.625 | 4 | [] | no_license | /**
* @public
* @version 0.0.1
* @todo
* @param {String} input
*/
function reverseString(input)
{
if(input.constructor!=String)
return "error input"
if(input.length<=0)
return "error input"
//bad input!!! then return error
let re=new String()
//create the string used to return
... | true |
2d4a64886e833bdaa7f87b2ac205cc7eb6902443 | JavaScript | cosmoglint/stuff_with_p5 | /1_10print/sketch.js | UTF-8 | 1,512 | 3.328125 | 3 | [] | no_license | var mover = 20;
var movex = 0;
var movey = 0;
var the_array;
function orientation_generator(){
val = random(0,1);
ori = (val < 0.9)? ("backward") : ("forward");
return ori
}
function create_array(width,height){
let arr = new Array(width);
for (let i = 0; i < arr.length; i++){
arr[i] = new Array(h... | true |
79efa0bd24cf67b5a32c72853652adfe127cb3e8 | JavaScript | aritse/boot-camp | /week-05/09-NodeJS/01-Activities/26-Stu_For_Of/index.js | UTF-8 | 107 | 2.8125 | 3 | [] | no_license | const songs = document.querySelectorAll("#songs>li");
for (const song of songs) song.classList.add("red");
| true |
81b12c44a0260657c4c67428352bb77e4c9c3303 | JavaScript | juanka588/visual | /js/game/ship.js | UTF-8 | 494 | 2.84375 | 3 | [] | no_license | function Ship(x, y, z, m) {
this.x = x;
this.y = y;
this.z = z;
this.shape = m;
this.len = 30;
this.speed = 3;
this.headAngle = 0;
this.draw = function () {
push();
specularMaterial(0, 255, 0);
// plane(this.len);
rotateX(radians(90));
rotateZ(radi... | true |
4b3662c6a3e05abb2aee0ebe41a90511b3edde08 | JavaScript | nestauk/svizzle | /packages/tools/dev/src/test.js | UTF-8 | 1,512 | 2.953125 | 3 | [
"MIT"
] | permissive | /**
* @module @svizzle/dev/test
*/
/**
* Return a console.log interceptor
*
* @function
* @return {object}
* @example
describe('tapAppendTo', function () {
let printer;
before(function () {
printer = makePrinter();
printer.init();
});
beforeEach(function () {
printer.reset();
});
after(function () {
... | true |
6cfee1284423834551e224c582453691565bd633 | JavaScript | hguochen/code | /javascript/interviews/square.js | UTF-8 | 4,227 | 4.09375 | 4 | [] | no_license |
// Given two arrays, one of property identifiers (strings, or some other hashable) and one of corresponding values, return an object with each identifier and value matched.
// keys: ["apple", "boat"], values: [1, 2]
// Output: { "apple": 1, "boat": 2 }
// Constaints and assumptions
// - key and values are all same... | true |
7b2e77c63b6b71d6d3ed4d7d7c87d65ba70852ae | JavaScript | Lidemy/mentor-program-3rd-maotengshih | /homeworks/week3/hw1.js | UTF-8 | 181 | 3.203125 | 3 | [] | no_license | function stars(n) {
const result = [];
let temp = '';
for (let i = 0; i < n; i += 1) {
temp += '*';
result.push(temp);
}
return result;
}
module.exports = stars;
| true |
f1bc7a680ac956f8206a4b575a136c5764740a1b | JavaScript | ChiangFamily/starlight | /src/runtime/Table.js | UTF-8 | 3,660 | 2.875 | 3 | [
"MIT"
] | permissive | import { default as LuaError } from './LuaError';
import { type } from './lib/globals';
let count = 0;
let stringLib;
export function registerStringLib(lib) {
stringLib = lib; // Can't import it directly because that'll create a circular dependency. :(
};
export default class Table {
constructor(initialiser) {
... | true |
4abfff375acbda73b96a00821623edf1307101da | JavaScript | Pavelhack/Curency-Exchange | /src/components/InfoRate.js | UTF-8 | 1,055 | 2.75 | 3 | [] | no_license | import React, {useEffect} from 'react';
import {useState} from "react";
import {Demo} from "./InputSubmit"
export const InfoRate = () =>{
const [objectData, setObjectData] = useState({});
const [result, setResult] = useState();
const st1 = objectData.price?.currency;
const st2 = objectData.price... | true |
f3bace69dfac40e8a0dadc9e3e8c8bafceca8cdd | JavaScript | alejandrothornton/Obsidian | /public/app/services/charService.js | UTF-8 | 803 | 2.859375 | 3 | [] | no_license | //CHARACTER SERVICE
angular.module('charService', [])
.factory('Character', function($http) {
//create a new object
var charFactory = {};
//get a single character
charFactory.get = function(id) {
return $http.get('/api/characters/' + id);
};
//get all characters
charFactory.all = function() {
... | true |
efae025538fdb6134b0ecd83215cff1d9b8b509c | JavaScript | aimensasi/Dynos | /front_end/js/image_uploader.js | UTF-8 | 785 | 2.59375 | 3 | [] | no_license | $(document).ready(function(){
var $loadingCover = $('.loading-cover');
var $loadingLogo = $('.loading-logo');
var $coverImage = $('.cover');
var $logoImage = $('.logo');
$('.inputfile').on('change', function(){
var $fileBtn = $(this);
var filePath = $fileBtn.val();
console.log('Cliked');
if ($fileBtn.a... | true |
677cc9c12aa65c045d143d8cffbfdfb623952903 | JavaScript | DavidArb13/API---mongoDB-express | /controllers/Users_Controllers.js | UTF-8 | 3,265 | 2.578125 | 3 | [] | no_license | const express = require('express');
const app = express();
const User = require("./../models/User");
const { errorServer, notFound, Success, troll, exist, updateStatus } = require('./../utils/message');
/**********************
* Endpoint GET:
**********************/
app.get('/dos', function(req, res) {
troll(res... | true |
1d86f53c9c4f21f21b50c18461960ba4380e4da1 | JavaScript | vbagustinus/blog-tdd | /server/test/blog.test.js | UTF-8 | 4,574 | 2.75 | 3 | [] | no_license | const chai = require('chai')
, chaiHttp = require('chai-http')
, expect = require('chai').expect
chai.use(chaiHttp);
// FOR ARTICLE
describe('Testing Article', () => {
it('post / save article', (done) => {
chai.request('http://localhost:3000')
.post('/')
.type('form')
.send({
'title... | true |
50105a5bd8d84ecea554a0c2e790e957bcd672d1 | JavaScript | PakkuDon/project-euler | /src/problem-014-longest-collatz-sequence/index.test.js | UTF-8 | 721 | 3.265625 | 3 | [] | no_license | const longestCollatzSequence = require("./index");
describe("Problem 14: Longest Collatz sequence", () => {
test("returns a number", () => {
expect(longestCollatzSequence(14)).toEqual(expect.any(Number));
});
test("14 returns 9", () => {
expect(longestCollatzSequence(14)).toEqual(9);
});
test("5847... | true |
f7fdbc7dc4483ee4dd6068ce5288d5b67635b662 | JavaScript | JaiminiNayee/hhaccessibility.github.io | /app/public/js/location_tagging.js | UTF-8 | 1,388 | 2.71875 | 3 | [] | no_license | $(document).ready(function() {
function tagToggleClicked() {
var $this = $(this);
var location_tag_id = parseInt($this.data('tag-id'));
var location_id = $this.closest('.row').data('location-id');
var data = {
'_token': csrf_token,
'location_id': location_id,
'location_tag_id': location_tag_id
};
... | true |
210cad378a979b2442228e25e0eecb9157cdc335 | JavaScript | thiccsupreme/Catchall-Generator-Discord-Bot | /index.js | UTF-8 | 3,558 | 2.734375 | 3 | [] | no_license | const Discord = require('discord.js');
const client = new Discord.Client();
const { RichEmbed } = require("discord.js");
const faker = require("faker");
const prefix = '?';
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
});
client.on('message', message => {
let args = message.co... | true |
d9feebfdd540109a34e37a309998b20259212318 | JavaScript | comerc/reactive-bind | /reactive-bind.js | UTF-8 | 6,056 | 2.875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | /**
* Coverts a Date object to a input[type='date'] value
* @type {Function}
* @return formatted value
*/
Date.prototype.toDateInputValue = (function () {
var local = new Date(this);
local.setMinutes(this.getMinutes() - this.getTimezoneOffset());
return local.toJSON().slice(0, 10);
});
Meteor.startup(f... | true |
6c33149b4469a3eb7426d3e9d7fec7c12978844e | JavaScript | Balram531/js-Assignmen-Day-3 | /switch.js | UTF-8 | 362 | 3.3125 | 3 | [] | no_license | var marks=prompt("Enter the marks");
switch(marks/10)
{
case 10:
case 9:document.write("Grade is A");
break;
case 8:document.write("Grade is B");
break;
case 7:document.write("Grade is C");
break;
case 6:document.write("Grade is D");
break;
case 5:document.write("Grade is E");
break;
default:doc... | true |
cd60dd518789f6cd60224d5bb7a35fb37176eb37 | JavaScript | amireh/polly | /client/app/components/radio_group.js | UTF-8 | 1,223 | 2.5625 | 3 | [] | no_license | /** @jsx React.DOM */
var React = require('react');
var RadioButton = require('./radio_button');
module.exports = React.createClass({
getInitialState: function(){
return {
selectedValue: ''
}
},
handleItemSelect: function(value) {
this.setState({selectedValue: value});
this.props.onChang... | true |
f9daa380524f198368e7c535bff48b2d648582d0 | JavaScript | soulcurrymedia/videolog | /create-entries.js | UTF-8 | 1,747 | 2.71875 | 3 | [] | no_license | var fs = require('fs');
var path = require('path');
var yaml = require('js-yaml');
var Mustache = require("mustache");
const shortid = require('shortid');
try {
var startTime = Date.now();
console.log("📖 Create (Scrapbook) Entries v1.0.0\n");
console.log("🔍 Reading templates...");
const gridTemplate =... | true |
e4f9c37799c6f8a3620adb09e1275bc9a3487016 | JavaScript | elena-cz/mvp-starter | /react-client/src/components/AddMovie.jsx | UTF-8 | 710 | 2.65625 | 3 | [] | no_license | import React from 'react';
class AddMovie extends React.Component {
constructor(props) {
super(props);
this.state = {
title: ''
};
this.handleInput = this.handleInput.bind(this);
this.handleSubmit = this.handleSubmit.bind(this);
}
handleInput(e) {
this.setState({
title: e.t... | true |
460b48955e82a7eb24bee77039c3a0c6be20404e | JavaScript | DaniiBlack/react-scratch-map | /src/components/Register.jsx | UTF-8 | 2,010 | 2.6875 | 3 | [] | no_license | import React from 'react';
import '../css/register.css';
class Register extends React.Component {
state = {
firstName: "",
lastName: "",
email: "",
password: "",
confirmPassword: ""
};
nameChange = event => {
this.setState({ name: event.target.value });
... | true |
3d548f862604c2733bb05daff7fb63549fea55ae | JavaScript | tied/DevArtifacts | /master/dbc-work-master/dbc-work-master/phase0/vote_count.js | UTF-8 | 5,909 | 2.875 | 3 | [
"MIT"
] | permissive | //In this challenge you will work with the following JavaScript objects.
//Do not alter these objects here.
// These are the votes cast by each student.
var votes = {
"Alex": { president: "Bob", vicePresident: "Devin", secretary: "Gail", treasurer: "Kerry" },
"Bob": { president: "Mary", vicePresident: "Hermann", s... | true |
1e8f09f941d058b739529b221f4dd1479d0bc76b | JavaScript | react-native-skj/01-starter | /src/screens/SquareScreen.js | UTF-8 | 1,197 | 2.546875 | 3 | [] | no_license | import React, { useReducer } from 'react';
import { StyleSheet, Text, View, FlatList } from 'react-native';
import ColorCounter from '../components/ColorCounter';
const colorHex = () => Math.floor(Math.random() * 256);
const COLORS = ['Red', 'Green', 'Blue'];
const reducer = (state, { type, payload }) => {
const n... | true |
1d705ae57fa6fe63dec8354daf6366b3ed4e4d29 | JavaScript | zoeyyandi/React-todo-list | /src/Input.js | UTF-8 | 1,045 | 2.65625 | 3 | [] | no_license | import React, { Component } from 'react';
class Input extends Component {
handleClick = event => {
event.preventDefault();
const todo = this.textInput.value;
this.props.addTodo(todo);
this.textInput.value = null;
};
handleKeyPress = event => {
if (event.key === 'Enter') {
event.prevent... | true |
5ba4b671c62aacd055b68fa38122ba0e44032ba2 | JavaScript | MatiasCoiman/CursoIngresoJS | /9-Parciales/parcial/siete.js | UTF-8 | 1,346 | 3.25 | 3 | [] | no_license | function Mostrar()
{
var letra;
var numero;
var minimo=999;
var maximo=-9999;
var promedio;
var respuesta="si";
var contador=0;
var letraMax;
var letraMin;
var numeroVocal=0;
var acumuladorVocal=0;
while(respuesta!="no")
{
contador++;
letra=prompt("Ingrese una Letra");
while(!(isNaN(letra)))
{
... | true |
b8fc580e082723efdebcf7280c72228bad07414d | JavaScript | double-salary/MailHaneunGamja | /svelte-app/src/mails/mail/lastWords/lastWords-data.js | UTF-8 | 2,153 | 3.171875 | 3 | [
"CC-BY-4.0",
"LicenseRef-scancode-generic-cla",
"MIT"
] | permissive | export const weatherLastWords = [
"요즘 날씨가 많이 궂은데 감기 조심하시고 좋은 하루 보내세요!",
"건강한 가을 보내시길 바랍니다! 감사합니다.",
"요즘 일교차가 심한데 감기 조심하시고, 좋은 하루 보내세요!",
"날이 추운데 감기 조심하시고, 좋은 하루 보내세요!",
"날이 추운데 건강 조심하시기 바랍니다.",
"날이 무더운데 항상 건강 조심하시고, 좋은 하루 보내세요!",
"여즘 날씨가 무척 궂은데 항상 건강 조심하시고 남은 하루 잘 보내세요!",
"추운 겨울부터 지금까지 항상 좋은 수업 해주셔서 감사... | true |
b3dfebcc3b117105e9e713aeba46534b51ffdb92 | JavaScript | wfwuestc/Todo-List | /src/js/TodoInput.js | UTF-8 | 586 | 2.53125 | 3 | [] | no_license | import React, {Component} from 'react'
import '../css/TodoInput.css'
function submit (props, e) {
if (e.key === 'Enter') {
if (e.target.value.trim() !== '') {
props.onSubmit(e)
}
}
}
function changeTitle (props, e) {
props.onChange(e)
}
export default function (props) {
retur... | true |
64fa56f57969e9b75fdec78c1c2d40a5c25655bf | JavaScript | Rhaxis/4A00EZ61-3002-ecmascript-ekholm-ville | /homework/2020-36/e01-e10/e01.js | UTF-8 | 96 | 3.0625 | 3 | [] | no_license | var tina = { name: 'Tina', age: 20 }
for (var prop in tina) {
console.log(`${tina[prop]}`)
}
| true |
09b86dd7d5011c1b2bee89dd5caf79963db84552 | JavaScript | arnoldjos/burger-builder | /src/store/actions/utility.js | UTF-8 | 1,038 | 2.546875 | 3 | [] | no_license | export const convertFirestoreData = doc => {
const { fields, name } = doc;
let data = {
id: name.split("/").pop()
};
for (let key in fields) {
switch (key) {
case "totalPrice":
data[key] = parseFloat(fields[key].integerValue);
break;
... | true |
0dbf654b44674f6e831193cf4a992376194c8e6a | JavaScript | cpena/migraciones | /appegine/js/migraciones.js | UTF-8 | 1,536 | 2.71875 | 3 | [] | no_license | var map;
var seconds;
var timer;
(function($) {
function createMap(){
var myLatLng = new google.maps.LatLng(-35.675147,-71.542969); //chile
var mapOptions = {
zoom: 4,
center: myLatLng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map($('#map-canvas')[0], mapOptions);
}
f... | true |
3f0bae3941a87727218999602cf838eb170eccae | JavaScript | mannyOE/ziitaBackend | /public/js/chart.js | UTF-8 | 945 | 2.859375 | 3 | [] | no_license | var jsonData = $.ajax({
url: "/plans/" + window.localStorage.getItem("user"),
dataType: "json",
async: false
}).responseText;
var result = $.parseJSON(jsonData);
console.log(result.data);
var chart = document.getElementById("lineChart");
console.log(chart);
function strTochart(input) {
var output =... | true |
3d93c9d291b3aa65297f09fa412c348cef07fe66 | JavaScript | aishacodes/fsopen-blog-server | /utils/list_helper.js | UTF-8 | 1,531 | 3.109375 | 3 | [] | no_license | const dummy = (blogs) => 1;
const totalLikes = (blogs) => {
return blogs.length == 0
? 0
: blogs.reduce((accumulator, blog) => accumulator + blog.likes, 0);
};
const favouriteBlog = (blogs) => {
const highestLikes = Math.max(...blogs.map((blog) => blog.likes));
const fave = blogs.find((blog) => blog.like... | true |
bb60d99e052fb0dcf3ccf8dce4eb9b8273d46643 | JavaScript | Bothees/unitaskr-Automation | /cypress/support/commands.js | UTF-8 | 1,700 | 2.546875 | 3 | [] | no_license | // ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***************************... | true |
cf34a6a73cff9c5c70b6065381e2e5702e35f4bb | JavaScript | ChrisMeyer7088/My-Scheduler | /backend/services/info.js | UTF-8 | 2,605 | 2.734375 | 3 | [] | no_license | const { getAssociatedUser, updateToken } = require('../db/models/token');
function authenticateToken(req, res, next) {
let token = req.header('Authorization')
if(!token) {
res.status(401).json({
type: "info.authenticate",
data: {
message: "Request must have a val... | true |
1f6c68b9981d96616d5aaf47711d3906671f693e | JavaScript | jwagner/gopro-telemetry | /code/setSourceOffset.js | UTF-8 | 681 | 2.78125 | 3 | [
"MIT"
] | permissive | //Check that out time is before next in time, then apply offsets
module.exports = (a, b) => {
const nextStart = b.start.getTime();
const firstCts = a.samples[0].cts;
const firstStart = a.start.getTime();
b.offset = firstCts + nextStart - firstStart;
const aLastSampleIndex = a.samples.length - 1;
//Find wher... | true |
4bf7e8e51d070709dd456b72b875f221d57d5979 | JavaScript | colemanjenkins/admin-page | /src/EditSection.js | UTF-8 | 11,018 | 2.6875 | 3 | [] | no_license | import React, { Component } from 'react';
import * as firebase from 'firebase';
import Form from 'react-bootstrap/Form';
class EditSection extends Component {
constructor(props) {
super(props);
this.state = {
students: null,
teachers: null,
admin: null,
... | true |
a18f953c3e526e87334616262a295797dd5bacee | JavaScript | TSMMark/speedy_keys | /lib/components/game/game_stats_table.jsx | UTF-8 | 1,797 | 2.703125 | 3 | [] | no_license | Components.GameStatsTable = React.createClass({
render: function () {
var currentUserId = this.props.currentUserId
, game = this.props.game
, winnerId = game.props.winnerId
, headers = []
, wpms = []
, completedWords = [];
game.props.players.forEach(function (player, index) {
... | true |
76763d6caa04e19bf65db70e52fa5389c153afdf | JavaScript | jatin711-debug/Assignment-1Jquery-AjaxCallsWithLS | /scripts/mahajaja.js | UTF-8 | 3,328 | 3.09375 | 3 | [] | no_license | //start of doc.
const dataURL = "../JSONdata/A1-JSON.json"
const rawProgramData = [
{term:1,type:"Prog",code:1013,image:"../media/images/Java.jpg"},
{term:1,type:"Tele",code:1564,image:"../media/images/Tele.jfif"},
{term:2,type:"Comm",code:1654,image:"../media/images/Java.jpg"},
{term:2,type:"Syst",cod... | true |
6a0c29394754df66b6767daa3c492d0244e9e42f | JavaScript | 25cdickerson/Lab18CSC160 | /js/table.js | UTF-8 | 5,433 | 3.15625 | 3 | [] | no_license | import * as d3 from "d3";
//employees is the array of data
//target is the selection of the g element to place the graph in
//xscale,yscale are the x and y scales.
var drawPlot = function (
employees,
target,
senorityScale,
salaryScale,
areaScale
) {
target
.selectAll("circle")
.data(... | true |
d0ee52f98a0b688c1990c9d885c1088156f7e43c | JavaScript | rpbouman/xmlazy | /tests/dom/DocumentNode.test.js | UTF-8 | 5,840 | 2.890625 | 3 | [
"MIT"
] | permissive | import * as xmlazy from '../../src/xmlazy.js';
describe('Document Node', () => {
const tagname = 'hello';
const xml = `<${tagname}>`;
let staxStringReader, staxResult, documentNode, elementNode;
beforeAll(() => {
staxStringReader = new xmlazy.StaxStringReader(xml);
documentNode = staxStringReader.b... | true |
f40c16a4e986807a7175d8eb1280a5df17586470 | JavaScript | mahmudul-hasan-bijoy/clip-path | /assets/js/main.js | UTF-8 | 590 | 2.5625 | 3 | [
"MIT"
] | permissive | //Mobile Navigation
function openNav() {
document.getElementById("myNav").style.width = "50%";
}
function closeNav() {
document.getElementById("myNav").style.width = "0%";
}
//COUNTER
$('.counter').counterUp({
delay: 10,
time: 1000
});
//map
var mymap = L.map('mapid').setView([23.76671, 90.42265], 13)... | true |
78d7a0e10c226c4c64b8691fab303d0bf96e5cdb | JavaScript | maxravel/JSsketches | /js/js.js | UTF-8 | 7,715 | 4.21875 | 4 | [] | no_license | // **********************switch statement*******************
// let day=2;
// switch(day){
// case 1: case 2:
// console.log('hard start of week');
// break;
// case 3: case 4:
// console.log('be cool');
// break;
// case 5: case 6: case 7:
// console.log('relax');
// break;
// ... | true |
b4e541bb5ab4821bfe0c7319770e92b5dba2c08d | JavaScript | garronmichael/toyProbs | /src/secretStringFromRandomTriplets.js | UTF-8 | 2,076 | 4.21875 | 4 | [] | no_license | /*
There is a secret string which is unknown to you. Given a collection of random triplets from the string, recover the original string.
A triplet here is defined as a sequence of three letters such that each letter occurs somewhere before the next in the given string.
"whi" is a triplet for the string "whatisup".
... | true |
dd898ba1bd53b14555c3462d580e5dfca01a9b04 | JavaScript | NycolasSF/Sistema_SAR | /public/js/sar.js | UTF-8 | 1,043 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | class Robo {
constructor(connection) {
this.connection = connection;
this.frente = 'comando_robo/FRENTE/';
this.tras = 'comando_robo/TRAS/';
this.virarEsquerda = 'comando_robo/ANTIHORARIO/';
this.virarDireita = 'comando_robo/HORARIO/';
this.stop = 'comando_robo/STOP/'
this.xhttp = new XMLH... | true |
abf8e0de973f330ec4b430ba9439f69110ce7b6e | JavaScript | Salaheddin12/Covid-19-Statistics | /src/componenets/chart.jsx | UTF-8 | 3,006 | 2.703125 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
import { Line } from "react-chartjs-2";
import axios from "axios";
const Chart = ({ query }) => {
const [chartData, setChartData] = useState({});
const [country, setContry] = useState("");
const getLabels = (days_) => {
let dates = days_;
dates = dates.... | true |
d3505dfcf563657e616e67c16d3dd16bbb87bc08 | JavaScript | spqjf12345/madCamp_week3 | /src/components/SetTimer.js | UTF-8 | 4,066 | 3.046875 | 3 | [] | no_license | import React, { Component } from 'react';
import '../style/SetTimer.css';
class SetTimer extends Component {
constructor() {
super();
this.state = {
hours: 0,
minutes: 0,
seconds:0
}
this.hoursInput = React.createRef();
this.minutesInput= React.createRef();
this.secondsInput... | true |
23b28825fa76b07b57ba53d597884337709fd0c4 | JavaScript | satyam0507/recordTest | /linkedList.js | UTF-8 | 752 | 3.953125 | 4 | [] | no_license | function Node(data) {
this.data = data;
this.next = null;
};
function LinkedList() {
// head will be the top of the list
// we'll define it as null for now
this.head = null;
this.length = 0;
this.add = function(data) {
var nodeToAdd = new Node(data),
nodeToCheck = this.... | true |
5640d632c652d5d779c9409ca3cf5ad547707320 | JavaScript | NicoleBlazier/kiwi-hackathon | /my-app/src/search.js | UTF-8 | 5,120 | 2.765625 | 3 | [] | no_license | import * as React from 'react';
import './search.css';
function FlightPrice(props) {
const flight = props.flight;
return (
<div>
{flight.price}
</div>
)
}
function FlightTime(props) {
const flight = props.flight;
let departure = Date(flight.dTime * 1000);
let arriva... | true |
1d7e36b419ab71383a345472959c6e192f4f65a7 | JavaScript | mits254/Toy-Problem | /CodeWar/6kyu/Convert-string-to-camel-case/stringToCamelcase.js | UTF-8 | 291 | 2.765625 | 3 | [] | no_license | function toCamelCase(str){
return str.split(/[\-_]+/).map((i, index) => index === 0 ? i : i[0].toUpperCase()+i.substr(1)
).join('')
}
toCamelCase("The_Stealth_Warrior")
toCamelCase('')
toCamelCase('the_stealth_warrior')
toCamelCase('The-Stealth-Warrior')
toCamelCase('A-B-C') | true |
96dac9560415c4fca8501ecf472ce7b441d1c8e7 | JavaScript | dottori-it/elixir_react_render | /priv/nodejs/HelloWorld.js | UTF-8 | 503 | 2.78125 | 3 | [
"MIT"
] | permissive | import React from 'react'
class HelloWorld extends React.Component {
constructor(props) {
super(props)
this.state = {
inputText: null
}
}
handleInput = (e) => {
e.preventDefault()
this.setState({
inputText: e.target.value
})
}
render() {
const {name, ...p} = this.pr... | true |
aad6940533f63c33b683ea981995811018da473d | JavaScript | tiagoradtke/curso-web-udemy | /Array/06 map01.js | UTF-8 | 473 | 4.40625 | 4 | [] | no_license | /*
Map serve pra trasnformar um array em outro dependendo da ordenação desejada,
o novo array terá a mesma quantidade de elementos do primeiro
*/
const nums = [1,2,3,4,5]
let resultado = nums.map(function(e){
return e*2
})
console.log(resultado,nums)
const soma10 = e => e + 10
const triplo = e => 3 * e
const pa... | true |
f51443b45f613fe794ec1db1cee29eb2d29ddcfd | JavaScript | danieldbf/clarity_ppm | /html/getInitiativeRally/js/utils.js | UTF-8 | 3,386 | 2.734375 | 3 | [] | no_license | function getInitiative() {
var codeInitiative = document.getElementById("initiative").value;
//Check ID Initiative
if(codeInitiative == '' || codeInitiative == null)
{
document.getElementById("validate").style.display= "block";... | true |
ea62f7df9c9338dee7cd58063795db1245e3f74f | JavaScript | nikkieverett/little-web-assignments | /week-3/day-16-multi-toggle-on-click/script.js | UTF-8 | 1,175 | 3.375 | 3 | [
"LicenseRef-scancode-public-domain"
] | permissive | // var bob = document.getElementById('bob');
// var sue = document.getElementById('sue');
// var fred = document.getElementById('fred');
// var jack = document.getElementById('jack');
// var dean = document.getElementById('dean');
//
// bob.addEventListener('click', function(){
// bob.classList.toggle('clicked');
// ... | true |
a91cc4e167afa62c708f68a002de6acb1b30a01c | JavaScript | Estayparadox/Train-Stations | /js/MRT.js | UTF-8 | 1,548 | 2.59375 | 3 | [] | no_license | var pathPlanning = {
dijkstra: function(obj, v0, n, Distance, prev, vn) {
var s = new Array(n);
var mindis = 0,
dis = 0;
var i = 0,
j = 0,
u = 0;
for (i = 0; i < n; i++) {
Distance[i] = obj[v0][i];
s[i] = 0;
if (... | true |
80c5b562306b756f9df7b0cffccc1ea7a0cbef19 | JavaScript | psotresc/Ejercicios | /NatureOfCode/05_Friction/sketch01.js | UTF-8 | 541 | 2.859375 | 3 | [] | no_license | let movers = [];
let mu = 0.1;
function setup() {
createCanvas(400,400);
for(let i = 0;i<10; i++){
movers[i] = new Mover(random(width),200,random(1,3));
}
}
function draw() {
background(0);
for(let mover of movers){
if (mouseIsPressed){
let wind = createVector(0,-2);
mover.applyForce(wi... | true |
5dc787a60138de85b8e54d42bba1f1a67a941c57 | JavaScript | enthusiastick/port_katherine | /app/javascript/react/subApps/eventRegistrar/reducers/token.js | UTF-8 | 479 | 2.65625 | 3 | [] | no_license | import { FETCH_TOKEN, FETCH_TOKEN_SUCCESS } from '../actions/getToken'
let initialState = {
isFetching: false,
item: null
}
const token = (state = initialState, action) => {
switch(action.type) {
case FETCH_TOKEN:
return Object.assign({}, state, { isFetching: true })
case FETCH_TOKEN_SUCCESS:
... | true |
c1b03410c0b9b9493b95c243df1faebb324934cd | JavaScript | emeeme/MyRepository | /app/assets/javascripts/qr_reader.js | UTF-8 | 1,129 | 2.59375 | 3 | [] | no_license | function openQRCamera(node) {
var reader = new FileReader();
reader.onload = function() {
node.value = "";
qrcode.callback = function(res) {
if(res instanceof Error){
alert("QRが読み込めませんでした。もう一度撮影してください。");
} else {
//node.parentNode.... | true |
c72df04d68e69653f311074e2b405828538b298d | JavaScript | noweverywhere/proficiency_test | /question5_exceptional_jquery.js | UTF-8 | 1,167 | 3.203125 | 3 | [] | no_license | /**
* Question 5:
* Extend jQuery to highlight all paragraphs in apage with a light yellow
* background on the condition that the paragraph contains the class "exceptional"
*
* Should the paragraph itself have the class or a child element contained within
* the paragraph have the class?
*
* Please note that ... | true |
167d5385e4e581fbe663174352a1a302c8f836bd | JavaScript | Ashkaari/Idaproject | /app/js/main.js | UTF-8 | 1,336 | 2.671875 | 3 | [] | no_license | $( document ).ready(function() {
$('.send').on('click', function() {
if(validateInputs()) {
$(document).find('.send').text('Платеж выполняется...').addClass('disabled');
}
});
var $cardnums = $(document).find('.payment__card-number');
var $cardname = $(document).find('.payme... | true |
30c5339eb71a2f5b0579edadc8e527b8fe75277d | JavaScript | wangmingquan/leet-code | /src/762.js | UTF-8 | 730 | 3.328125 | 3 | [] | no_license | /**
* @param {number} L
* @param {number} R
* @return {number}
*/
var countPrimeSetBits = function (L, R) {
let zsCount = 0;
let isPrimeNumber = num => {
if (num === 1) {
return false;
}
if (num <= 3) {
return true;
}
let half = Math.ceil(num / 2);
for (let i = 2; i <= half; ... | true |
5db9bb966a1895fe2883728653ca9c1ffa7c0577 | JavaScript | ShyLee/gcu | /schema/ab-products/solutions/compatibility/view-examples/ab-ex-grid-tabs-1.js | UTF-8 | 1,406 | 2.625 | 3 | [] | no_license | // example JavaScript for loading miniConsole from JSON object
// load data from grid in page1 into tabsFrame
/**
* user_form_onload is called after all system_form_onload functions
* store the columns and rows in the tabsFrame
*/
function user_form_onload() {
var cols;
var rows;
var viewFrame = getFrameObject(... | true |
44b9e4f6272f8cfc9788b730e2c86d9e5718fbfb | JavaScript | SephoraM/LS-210-small-problems | /easy5/double-char2.js | UTF-8 | 951 | 4.9375 | 5 | [] | no_license | /* Write a function that takes a string, doubles every consonant character in
the string, and returns the result as a new string. The function should not
double vowels ('a','e','i','o','u'), digits, punctuation, or whitespace. */
const CONSONANTS = /[bcdfghjklmnpqrstvwxyz]/gi;
// string => string
// string => new stri... | true |
af90561eead8344de9c06696fa4e9c946be720ea | JavaScript | nhemnt/competitive | /js/hackerrank/Interview Preparation Kit/Arrays/minimum-swaps-2.js | UTF-8 | 1,858 | 3.4375 | 3 | [] | no_license | // https://www.hackerrank.com/challenges/minimum-swaps-2/problem
'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.stdin.on('end', functio... | true |
998a91bbe9df997bb4824cac65bc4a999df85371 | JavaScript | jpantana/acme_explosives | /src/javascripts/helpers/data/productsData.js | UTF-8 | 934 | 2.609375 | 3 | [] | no_license | import axios from 'axios';
const getProductsForEachType = categoriesWithTypes => new Promise((resolve, reject) => {
axios.get('../db/products.json')
.then((resp) => {
const totalArrayToPrint = [];
const { products } = resp.data;
categoriesWithTypes.forEach((category) => {
const newCateg... | true |
75b1017a2fabc7ab8fc38d9bb565cb171caeb9c5 | JavaScript | ebinxavier/mandelbrot | /src/mandelbrot.js | UTF-8 | 885 | 2.8125 | 3 | [] | no_license | import { complex, abs, add, pow } from "mathjs";
const mandelBrot = (c, MAX_ITERATION) => {
let z = 0;
let n = 0;
while (abs(z) <= 2 && n < MAX_ITERATION) {
z = add(pow(z, 2), c);
n += 1;
}
return n;
};
export const getImage = async (
{ RE_START, RE_END, IM_START, IM_END },
MAX_ITERATION,
DIM
... | true |
093345f7ced9931d8c5e6bb618a01648ed0e1d81 | JavaScript | wpantoja/aula04 | /assincEx02.js | UTF-8 | 223 | 3.75 | 4 | [] | no_license | // Aula 03 -Ex01 - assíncrono
// Condicionais - IF e Operador &&
let dia = "domingo";
if(dia == "domingo") {
console.log("Vou para a praia!");
}
else {
console.log("Chamar amigos para tomar um café em casa");
}
| true |
d8af88f7d2d1acf490cfe6c0c206765945257c4b | JavaScript | andersonbtt/react-counter-example | /src/components/counter/Counter.jsx | UTF-8 | 1,272 | 2.609375 | 3 | [] | no_license | import React, { Component } from 'react';
import CounterButton from './CounterButton';
import ResetButton from './ResetButton';
import CounterDisplay from './CounterDisplay';
import './Counter.css';
class Counter extends Component {
constructor(){
super();
this.state = {
counter : 0
}
this.i... | true |
2700100f5f6be0467c60c34b93bd6486974072f0 | JavaScript | ithamed/algorithm | /Magic Squares/Magic Squares.js | UTF-8 | 1,547 | 4.96875 | 5 | [] | no_license | // 1. define aan array to put the input in it.
// 2. get 9 number as input and turn them in an array of numbers.
// 3. define eight variable for sum of each rows, columns, diagonals.
// 4. write an if statement to see if all the variable above are equal to 15.
// 5. if the if statement is true print this is a magic squ... | true |
20c5822720f126abbf1163a03deaa4ecb82a49d1 | JavaScript | chrisboaks/algorithmsjs | /source/string/TEST/basics.js | UTF-8 | 2,219 | 3.578125 | 4 | [] | no_license | const assert = require('chai').assert;
import {
caesar,
isPalindrome,
reverse,
charCount,
reverseEach
} from '../basics';
describe('Basic string functionality', () => {
describe('caesar', () => {
it('defaults to rot13', () => {
assert.equal(caesar('test phrase'), 'grfg cuenfr');
});
it(... | true |
70b4f3984a0f59196cd0a7e5c2d0714a8122d9d1 | JavaScript | Guepen/1dv403-laborationer | /1-vandalen/birthday/script.js | UTF-8 | 2,431 | 3.546875 | 4 | [] | no_license | "use strict";
window.onload = function(){
var birthday = function(date){
var dayMs = 1000*60*60*24; //en dag i millisekunder
var today = new Date();
var myBirthday = new Date(date.replace(/(\d{4})\.(\d{2})\.(\d{2})/, '$3-$2-$1'));
//om inmatat format är fel
if(... | true |