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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
48792452281b95794d324d7207b95dfbeed3f5cc | JavaScript | doubaozia/pedograph | /index.js | UTF-8 | 3,803 | 2.90625 | 3 | [] | no_license | 'use strict';
const chalk = require('chalk');
const DEFAULT_FORMAT = ':datetime :method :url :ip';
const SYS_FORMAT = ':datetime';
const utils = {
wrap(text) {
return `[${text}]`;
},
checkText(text) {
return typeof text === 'object' ? JSON.stringify(text) : text;
},
fillZero(num) {
return num <... | true |
91a99f58211fa5123b6a8d841039e54dc961ed79 | JavaScript | esony/cloud9-demos | /user-generator/scripts/script.js | UTF-8 | 837 | 2.84375 | 3 | [] | no_license | const url = "https://randomuser.me/api";
$("#next-btn").css("cursor", "pointer");
$("#next-btn").click(() => {
newUser();
});
function newUser() {
$.getJSON(url)
.done((data) => {
console.log(data);
let fullname = data.results[0].name.first + " " + data.results[0].name.last;
$("#n... | true |
c4a5e47831d767ea84f50387e17fb04fa9e01b54 | JavaScript | davidflack/Sprint-Challenge-React-Wars | /starwars/src/App.js | UTF-8 | 3,422 | 3.21875 | 3 | [] | no_license | import React, { Component } from 'react';
import './App.css';
import CharacterProfile from './components/CharacterProfile'
import Button from './components/Button';
class App extends Component {
constructor() {
super();
this.state = {
starwarsChars: [],
displayedCharacter: {},
previous: '',
... | true |
5e0c6aaa6b1020112682ec0d3a98a46e06c9eb42 | JavaScript | pratyushranjan2/NodeJS-Chat-App | /public/js/chat.js | UTF-8 | 3,982 | 2.71875 | 3 | [] | no_license | const socket = io();
// socket.on('countUpdated', (count) => {
// console.log('Count updated to ' + count)
// })
const messageForm = document.querySelector('#messageForm');
const messageTextField = messageForm.querySelector('input');
const sendButton = messageForm.querySelector('button');
const sendLocationbutton... | true |
9af234bcdb62b9b491fd31e43e54dc525b1bf7fc | JavaScript | furgerf/TrainingLogSever | /test/database.test.js | UTF-8 | 2,159 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | // load modules
var mongoose = require("mongoose"),
expect = require("expect.js"),
// create mongoose stuff
Schema = mongoose.Schema,
testSchema = new Schema({
foo: String,
bar: Number,
}),
Test = mongoose.model('Test', testSchema),
testObject;
// establish db connection
mongoose.c... | true |
5cee1daad4763e28c5cae212300e1f54f4d3fc81 | JavaScript | n0bisuke/201808_techcamp | /day2/server.js | UTF-8 | 568 | 2.609375 | 3 | [] | no_license | 'use strict'
const http = require('http');
const PORT = 4000;
http.createServer((req, res) => {
console.log(req.url);
res.writeHead(200, {'Content-Type': 'text/html; charset=UTF-8'});
if(req.url === '/golgo'){
res.end('ごるごさんおはようございます。\n');
}else if(req.url === '/ted'){
res.end('10kgやせた... | true |
c3100235cedde92224cc7e84c684d7d7ad3df7d7 | JavaScript | green-fox-academy/-COLA-LIAN | /week-01/day-03/quote-swap.js | UTF-8 | 707 | 4 | 4 | [] | no_license | 'use strict';
// Accidentally I messed up this quote from Richard Feynman.
// Two words are out of place
// Your task is to fix it by swapping the right words with code
// Also, log the sentence to the console with spaces in between.
// Create a function called quoteSwap().
const words = ["What", "I", "do", "create,"... | true |
01b94b0c5a5e176d033e01c6027f444b67108a6b | JavaScript | numsu/advent-of-code-2019 | /day4.js | UTF-8 | 781 | 3.453125 | 3 | [] | no_license | const data = '183564-657474'.split('-')
const digitsToArr = digits => (
[...('' + digits)]
)
const checkAdjacentNumbers = digits => {
let previous = ''
for (const c of digitsToArr(digits)) {
if (previous == c) {
return true
}
previous = c
}
return false
}
const checkIncreasingNumbers = digits => {
let... | true |
484d2ad288dd9d2224b30721203c0a486e167db1 | JavaScript | matiscava/ReactDesafio11 | /src/components/Login.js | UTF-8 | 3,233 | 2.71875 | 3 | [] | no_license | import React, { useState, useEffect } from 'react';
import db from "../firebase";
import { onSnapshot , collection } from "firebase/firestore";
const Login = () => {
const [userList, setUserList] = useState([]);
const [userLog, setUserLog] = useState({});
const [registro, setRegistro] = useState(false)
... | true |
e013259107bd9d58444c89f21c639cefe9e78809 | JavaScript | afoster44/student-workbook | /src/reflections/wk4/morning-challenges.js | UTF-8 | 946 | 4.40625 | 4 | [] | no_license | //write a function that accepts a single string and returns the
// letter that occurs the most
function letterOccurance(str) {
let checker = str.split('')
let bigLetters = {}
let greatest = {
letter: '',
value: 0
}
checker.forEach(c => {
//so here it actually checks if bigL... | true |
fa35da8235ea36c0dbdf09140cf702976b812d22 | JavaScript | valentinacuello/MetaPata-Refugio | /js/animaciones/indexAnimations.js | UTF-8 | 2,256 | 2.65625 | 3 | [] | no_license |
//Animaciones
const heroAnimation = () => {
setTimeout(() => {
$(".home-title").css({
"transform": "translateX(0px)"
}).animate({
opacity: 1
});
}, 200);
setTimeout(() => {
$(".home-subtitle").css({
"transform": "translateX(0px)"
... | true |
b4a4442467a37c6c207a97258acbac684f18330c | JavaScript | TishoAngelov/TelerikAcademy | /JavaScript/1. Fundamentals/08. Strings/Strings/02. CheckBrackets/index.js | UTF-8 | 657 | 3.84375 | 4 | [] | no_license | var expression1 = '((a+b)/5-d)',
expression2 = ')(a+b))';
function areBracketsCorrect(expression) {
'use strict';
var bracketsCount = 0,
i;
for (i = 0; i < expression.length; i += 1) {
if (expression[i] === '(') {
bracketsCount += 1;
} else if (expression[i] === ')... | true |
675f088d9764dc77a98a02bcb5a77f89bc6aa23d | JavaScript | lexoye/frontend-bootcamp | /webtask/ejerciciojava.js | UTF-8 | 646 | 3.90625 | 4 | [] | no_license |
var balance = 1000;
function imprimirBalance(balance) {
// Imprimir balance
console.log('Este es tu saldo');
}
function retirarDinero(balance) {
// Solo puede retirar dinero si es menor que el balance
if (balance < 1000) {
console.log('Puedes retirar '+ balance + 'pesos');
}
}
function transfe... | true |
d079bb3ad180d4d8e4ed62f11efe0ce1b347a52c | JavaScript | houyuhui420/TWS-online-bootcamp | /tasks/task4-collection-calculate-camp/practices/filter/two_collections_practice_2.js | UTF-8 | 266 | 2.671875 | 3 | [] | no_license | 'use strict';
function choose_no_common_elements(collection_a, collection_b) {
//在这里写入代码
var arr = collection_a.filter( (value) => {
return collection_b.indexOf(value) < 0;
});
return arr;
}
module.exports = choose_no_common_elements;
| true |
982d4197181eb5262de54413a95fb6a88ef6164b | JavaScript | peternamkoong/nkg-graphics | /backend/routes/users.js | UTF-8 | 5,948 | 2.5625 | 3 | [] | no_license | const router = require("express").Router();
const { useRef } = require("react");
let User = require("../models/users.model");
var fs = require("fs");
router.route("/").get((request, response) => {
User.find()
.then((users) => response.json(users))
.catch((err) => response.status(400).json("Error: "... | true |
b68c9feb21b6378d95ecc94d38ad62c2a7e92e6f | JavaScript | liamkande/MyReads-ReactApp | /src/App.js | UTF-8 | 1,737 | 2.609375 | 3 | [] | no_license | import React, { Component } from 'react'
import { Route } from 'react-router-dom'
import * as BooksAPI from './utils/BooksAPI'
import './App.css'
import BookList from './components/BookList'
import Search from './components/Search'
import { Link } from 'react-router-dom'
class App extends Component {
state = { book... | true |
5a6be98308f1cd1646892d91ba9ec2eb05b6a13c | JavaScript | MaksymilianWojcik/orliker-api | /models/user.js | UTF-8 | 3,207 | 2.546875 | 3 | [] | no_license | const Joi = require('joi');
const mongoose = require('mongoose');
const jwt = require('jsonwebtoken');
const config = require('config');
mongoose.set('useCreateIndex', true);
const userSchema = new mongoose.Schema({
email: {
type: String,
unique: true,
required: true,
minlength: 5,
maxlength: 50... | true |
ef518a9a8441f1916eb9bf45c074503d29fe111f | JavaScript | ravinalamada/onja-express-food | /script.js | UTF-8 | 3,904 | 3.125 | 3 | [] | no_license |
// REFERENCES
const modalInner = document.querySelector('.modal-inner');
const modalOuter = document.querySelector('.modal-outer');
const addOrderBtn = document.querySelector('.add-order');
const sel = document.querySelector('.select-form');
const detailBtn = document.querySelector('.details')
const deleteBtn = docume... | true |
2e0d7c1f1e12b0dedf039e397a55940763dbd846 | JavaScript | Denismr7/react-search-products | /src/helpers/helpers.js | UTF-8 | 295 | 2.765625 | 3 | [] | no_license | export const getUserInfo = (userData, id) => {
return userData.filter(user => user.userId === id)
}
export const getItemInfo = (productsArray, propertyToFind, valueToFind) => {
const array = productsArray.filter(product => product[propertyToFind] === valueToFind);
return array[0]
} | true |
70344b9bc7a6aa7b13df92e1192df19713277292 | JavaScript | Thaothantien/nguyentrungthao-fundamental-c4e53 | /session9/btSession9/b7.js | UTF-8 | 657 | 3.0625 | 3 | [] | no_license | const database = {}
const divA = document.getElementById("div")
const getUser = async () => {
const respone = await fetch("http://quotes.rest/qod.json")
const db = await respone.json()
db.contents.quotes
console.log(db.contents.quotes)
for(let i=0;i<db.contents.quotes.length;i++){
... | true |
12184f901e3cab85b7a4e361009af952efa7a043 | JavaScript | lewnelson/node-userapi | /app/Framework/Controller.js | UTF-8 | 2,517 | 2.75 | 3 | [
"MIT"
] | permissive | 'use strict';
const RequestResponseAware = require('./RequestResponseAware.js');
/**
* All controller classes should extend from the controller
*/
module.exports = class Controller extends RequestResponseAware {
/**
* Set all routes on the controller
*
* @param {array} routes Array of Route objects
... | true |
cebdadc5113c09909db630f8b0390be004864fae | JavaScript | Rakers1024/student-grade-mange-mongdb | /routes/index.js | UTF-8 | 4,238 | 2.5625 | 3 | [] | no_license | /**
* @author 卓志诚
* @time 2020.05.12
*/
const express = require('express');
const router = express.Router();
const mongo = require("mongodb");
/**
* 方便注册页面
* @param html 接口与页面同名
* @param json 页面数据
*/
function regRouter(html, json){
router.get('/'+html, function(req, res, next) {
res.render(html, json);
... | true |
31ad45d26b79f20d8421376a96ec69d3a1c697ae | JavaScript | euphmat/Random-imgur | /script.js | UTF-8 | 1,358 | 3.65625 | 4 | [] | no_license | //■変数
var l = 5; //文字列の長さ
var ran = ""; //ランダム文字列を格納する変数
var picstr = ""; //最終的に表示する文字列
var c = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
var cl = c.length;
var width; //画像の横サイズを格納
var height; //画像の縦サイズを格納
var img = new Image(); //サイズ取得用の画像を格納
//■URL先に画像がある場合表示、ない場合リロード
function re... | true |
fa92ed29fe1ebf83a669e06d2ccf603c55c0a446 | JavaScript | DrYerzinia/Web-Bluetooth-Terminal | /js/main.js | UTF-8 | 4,950 | 3.109375 | 3 | [
"MIT"
] | permissive | // UI elements.
const deviceNameLabel = document.getElementById('device-name');
const connectButton = document.getElementById('connect');
const disconnectButton = document.getElementById('disconnect');
const terminalContainer = document.getElementById('terminal');
const sendForm = document.getElementById('send-form');
... | true |
a3e147428df7b7bef5338467908e942c2fcf892e | JavaScript | trohalska/FullStack-ucode | /sprint03/t07/js/houseBuilder.js | UTF-8 | 571 | 2.921875 | 3 | [
"MIT"
] | permissive | 'use strict';
class HouseBlueprint {
address = null;
date = new Date();
description = null;
owner = null;
size = null;
_averageBuildSpeed = 0.5;
roomCount = null;
getDaysToBuild () {
return this.size / this._averageBuildSpeed;
}
}
class HouseBuilder extends HouseBlueprint{
... | true |
97bc83b19c7932b07f44965f9cda40c9abd50734 | JavaScript | gabrielmarquesdev10/JavaScript-Exercicios | /Desafio-004.js | UTF-8 | 367 | 4.15625 | 4 | [] | no_license | const division = (dividendo, divisor) => {
let result = Math.floor(dividendo / divisor);
console.log("Resultado: " + result);
console.log("Resto: " + dividendo % divisor);
}
division(11, 4);
function divisao(dividendo, divisor) {
console.log("Resultado: " + Math.floor(dividendo / divisor));
console.log(`Re... | true |
9fee6904b6f66c8c2039c7746194ef4a2bec64e9 | JavaScript | antarikshray/neutron | /js/map.js | UTF-8 | 3,209 | 2.65625 | 3 | [] | no_license | var tilesDb = {
getItem: function (key) {
return localforage.getItem(key);
},
saveTiles: function (tileUrls) {
var self = this;
var promises = [];
for (var i = 0; i < tileUrls.length; i++) {
var tileUrl = tileUrls[i];
(function (i, tileUrl) {
... | true |
e80db2e451b2af80ae169a8d181898372a2d3c22 | JavaScript | Mizu-cmd/MCSM | /resources/app/js/renderer_createserver.js | UTF-8 | 1,500 | 2.515625 | 3 | [
"MIT"
] | permissive | var fs = require('fs');
var http = require('http');
const { remote } = require('electron');
const app = remote.app;
let documents = app.getPath('documents') + '/MCSM/';
$(document).ready(function() {
})
$(document).ready(function() {
const $valueSpan = $('.min-ram-span');
const $value = $('#min-ram');
$... | true |
c1f282a8c52905a543154c0d0924cb9f5dbdb1a2 | JavaScript | rawntech/orbit-core | /src/lib/pattern-matcher.js | UTF-8 | 1,610 | 3.34375 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | function getPath(object, path) {
return path.reduce((reference, property) => {
return reference && reference[property];
}, object);
}
class ValueMatcher {
constructor(path, value) {
this.path = path;
this.value = value;
}
matches(object) {
const value = getPath(object, this.path);
return... | true |
bab51ae94c64a326919f8ab8071cb5cdcd8858b8 | JavaScript | kaidoooo/test | /main.js | UTF-8 | 1,158 | 2.953125 | 3 | [] | no_license | //$(document).ready(function(){
//$('.Box').on('click', function(){
//alert('押されたよ');
//console.log('押されたよ!');
//});
// $('#js').on('click',function(){
//var elem = '<a =href="#">次ページ</a>';
//$("#js").html(elem);
//$("#js").text(elem);
//$("#js").css("color","#ff0");
//$("#js").show(4000); //hid... | true |
a9829073da03ba9fe61a3db0f2b2bb9be53efacb | JavaScript | chungchi300/headfirst-js-for-leetcode | /12.integer-to-roman.js | UTF-8 | 1,032 | 3.328125 | 3 | [
"MIT"
] | permissive | const charMappings = [
{
"0": "",
"1": "I",
"2": "II",
"3": "III",
"4": "IV",
"5": "V",
"6": "VI",
"7": "VII",
"8": "VIII",
"9": "IX",
},
{
"0": "",
"1": "X",
"2": "XX",
"3": "XXX",
"4": "XL",
"5": "L",
"6": "LX",
"7": "LXX",
"8": "LXXX",... | true |
75fa57d824c58de4e91b5efbf4a4ef3bf3479854 | JavaScript | t-1000-t/PracticeExercisesJS | /Module9/PrExJs4/main.js | UTF-8 | 402 | 2.9375 | 3 | [] | no_license | const refs = {
input: document.querySelectorAll('input'),
result: document.querySelector('.result'),
btn: document.querySelector('.btn'),
};
function hendlerBtnClick(event) {
event.preventDefault();
const resultInput = [...refs.input].filter(e => e.checked === true).map(e => e.value);
refs.result.textCont... | true |
cb561b74559646afa9e6e8d7a21aabaa6ec8befd | JavaScript | jsknoweb/javaScriptBasicsMosh | /2. Basic/1_primitiveTypeDynamic.js | UTF-8 | 782 | 3.90625 | 4 | [] | no_license |
// Primitive Types in JavaScript
let name = 'Jose';
console.log(name);
console.log(typeof name);
// Dot Notation
name = 30.45;
console.log(name);
console.log(typeof name);
console.log('-----------------');
// 5 Types of Primitives
let aName = 'Jose' // String
let age = 30; // Number
let height = 1.73 // Number
let... | true |
1b8db8981322edbf470f52ad197afe610a5f6dfd | JavaScript | badari78/ColorGame | /colorGame.js | UTF-8 | 2,916 | 3.703125 | 4 | [] | no_license | var numbColors = 6;
var colors = generateRandomColor(numbColors);
var pickedColor = pickColor();
var squares = document.querySelectorAll(".square");
var rgbColorHeading = document.getElementById("rgbColor");
var message = document.getElementById("message");
rgbColorHeading.textContent = pickedColor;
var newColorBtn = d... | true |
d7129e75cfb66f90625f676c418557200adfcc8a | JavaScript | markers920/ant-simulation | /Agent.js | UTF-8 | 12,694 | 2.59375 | 3 | [] | no_license |
var AGENT_DEFAULT_SIZE = 5
var POSITION_HISTORY_LENGTH = 10
//var FOOD_EATEN_PER_CYCLE = 0.05
//var FOOD_DELIVERED_PER_CYCLE = 0.1
//var MAXIMUM_FOOD_LEVEL = 1
var MAXIMUM_COMMUNICATION_DISTANCE = 15
var HOME = new Map([
['x', 0.0],
['y', 0.0]])
//the auto regressive coefficients used for the 'rando... | true |
95355013bcd973229739db2161833d301d6ec36b | JavaScript | AlMarley/StudyJavaScript | /aula7/pratica08.js | UTF-8 | 737 | 4.375 | 4 | [] | no_license | //Marley Torres Win tem 25 yaers, pesa 84kg
//tem 1.72 de altura e seu IMC é de x
const nome = `Marley`;
const sobrenome = `Torres Win`;
let idade = 25;
let peso = 75; //Em Kg.
const altura = 1.72; //Em Metros.
let imc;
let anoAtual = 2020;
let anoNascimento;
imc = peso/(altura*altura);
anoNascimento = -1*(idade - a... | true |
003eea0e59bf20d29d55d0aac7d849442b715efb | JavaScript | tonioloewald/bindinator.js | /source/uuid.js | UTF-8 | 7,000 | 3.3125 | 3 | [
"BSD-3-Clause"
] | permissive | /**
# uuid
Random and non-random unique ids. All generated using `crypto.getRandomValues`, i.e. a
[cryptographically strong random number generator](https://developer.mozilla.org/en-US/docs/Web/API/Crypto)
import {uuid, unique, randId, now36, id} from 'path/to/uuid.js'
// () => crypto.randomUUID()
const ... | true |
37a5896d3c6b48bbfca79a4ede81d0ba9206fa7a | JavaScript | Anthbs/cordova-plugin-background-geolocation | /example/SampleApp/www/js/index.js | UTF-8 | 13,285 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you ... | true |
bff10f39b64ad6ffc6336b15e8bd5fe0658fc295 | JavaScript | behuamuh/yandex-algoritms | /b/lesson4/b/solution.js | UTF-8 | 660 | 2.640625 | 3 | [] | no_license | const fs = require('fs');
const path = require('path');
const strToArray = str => str
.split(' ')
.filter(Boolean);
const inFile = path.join(__dirname, 'input.txt');
const outFile = path.join(__dirname, 'output.txt');
const params = fs.readFileSync(inFile, { encoding: 'utf8' });
fs.writeFileSync(outFile, '');
c... | true |
4de505bed79fe02765082fce439170a9b3a35e5f | JavaScript | tgreaves/keyteki | /test/server/cards/05-DT/Chronophage.spec.js | UTF-8 | 3,576 | 2.515625 | 3 | [
"AGPL-3.0-only"
] | permissive | describe('Chronophage', function () {
describe("Chronophage's ability", function () {
beforeEach(function () {
this.setupTest({
player1: {
amber: 1,
house: 'logos',
inPlay: ['chronophage'],
hand: ['de... | true |
3cd5fb1c6d7779bfe8ba324453db18524192a132 | JavaScript | mbaranyshyn/JS-homework | /Super Hard/4.1/script.js | UTF-8 | 444 | 3.46875 | 3 | [] | no_license | var data = [12, 345, 4, 546, 122, 84, 98, 64, 9, 1, 3223, 455, 23, 234, 213];
function sortBubble(data) {
for (i = 0; i < data.length - 1; i++) {
for (j = 0; j < data.length; j++) {
if (data[j] < data[j + 1]) {
var x = data[j]
var y = data[j + 1]
... | true |
6485d5c602b4223f8b6779047df6c188c88e2bc9 | JavaScript | keshakesha/node_angular | /node/clique-lab-api/helpers/faculty_helper.js | UTF-8 | 842 | 2.78125 | 3 | [] | no_license | var Faculty = require("./../models/Faculty");
var faculty_helper = {};
/*
* get_all_faculty is used to fetch all faculty data
*
* @return status 0 - If any internal error occured while fetching faculty data, with error
* status 1 - If faculty data found, with faculty object
* status 2 - If facu... | true |
47357add931e42d90d8302f853ae6aac00432138 | JavaScript | rafiqulislam21/Librarian | /librarian.js | UTF-8 | 1,630 | 3.453125 | 3 | [] | no_license | var library = [
{ title: "Norse Mythology", year: "2017", author: "Neil Gaiman", publisher: "W. W. Norton & Company" },
{ title: "The Old Man and the Sea", year: "1952", author: "Ernest Hemingway", publisher: "Charles Scribner's Sons" },
{ title: "Mythos: A Retelling of the Myths of Ancient Greece", year: "1981",... | true |
a5fff311dddf128fec11a9f165005c25c356bb01 | JavaScript | ThanushaJ/coding-bootcamp | /CodeKataStrings/74.js | UTF-8 | 706 | 3.3125 | 3 | [] | no_license | const readline = require('readline');
const inputValue = readline.createInterface({input:process.stdin});
inputValue.on("line",(data)=>{console.log(reverseWithOutVowels(data))});
var reversedString = [];
function reverseWithOutVowels(data){
var lengthOfString = data.length;
if(1<lengthOfString<100000){
var spli... | true |
06ac2abd8d84695a64e4b74f4660eed87cf04b23 | JavaScript | MaryEhb/frontEndMentor-article-preview-component | /script.js | UTF-8 | 228 | 2.515625 | 3 | [] | no_license | /********variables************/
const btn = document.querySelector('.share-btn');
const parent = document.querySelector('.info-wrap');
btn.addEventListener('click', function (){
parent.classList.toggle('clicked');
}); | true |
d6a612eb1a9031936500143753df730175f88415 | JavaScript | deliquescentlicorice/silent-disco | /webApp/public/js/app.js | UTF-8 | 1,724 | 2.84375 | 3 | [
"CC0-1.0",
"MIT"
] | permissive | $(function() {
var audioSelect = document.querySelector('select#audioSource');
var gotMediaDevices = function(devices) {
for (var i = 0; i !== devices.length; ++i) {
var sourceInfo = devices[i];
if (sourceInfo.kind === 'audio') {
var option = document.createElem... | true |
44b14da50f6c1e614de585ea71171782f8aa49a1 | JavaScript | cweet-dreams/HW-JS-9 | /js/script.js | UTF-8 | 4,299 | 4.25 | 4 | [] | no_license | //Замыкание. Задачи
//1
getBigName(userName);
function getBigName(name) {
console.log(name);
name = name + '';
console.log(name);
return name.toUpperCase()
}
var userName = 'Ivan';
//данный код выводит undefined, потому что на момент вызова функции, переменная userName не объявлена;
//2
function tes... | true |
9ffdc8bf8922a424fbb92a8380d9671957caf8c2 | JavaScript | slaviqueue/exercism.io | /isogram/isogram.js | UTF-8 | 434 | 3.453125 | 3 | [] | no_license | const isUnique = (char, word) => {
const arr = ar(word);
const count = arr.filter(el => el === char);
return count > 1 ? false : true;
}
const ar = (string) => string.split('');
class Izogram {
constructor(word) {
this.word = word;
}
isIsogram() {
const arr = ar(this.word);
let is = true;
... | true |
c18cc237b135129e384218b478ef00a1b8a2fd9a | JavaScript | Valentyn-Maltsev/Currency-converter-React- | /src/components/inputContainer/inputContainer.js | UTF-8 | 3,996 | 2.578125 | 3 | [] | no_license | import React, {Component} from 'react';
import InputSection from "../inputSection";
import './inputContainer.scss';
import ExchangeService from "../../services/exchangeService";
export default class InputContainer extends Component {
constructor() {
super();
this.exchangeService = new ExchangeServ... | true |
8124801ce3ff824053cce89ec4586f526e811838 | JavaScript | HRNYC32-Ubran-Journey/project-cat-walk | /src/components/qa/subcomponents/ContainerQuestionEntryItem.jsx | UTF-8 | 3,002 | 2.578125 | 3 | [] | no_license | import React, { useState } from 'react';
import AnswerListEntryItem from './AnswerListEntryItem';
import AnswerModal from './AnswerModal.jsx'
import { Grid, Typography } from '@material-ui/core';
export default function ContainerQuestionEntryItem({ questionItem, answers,loadMoreAnswersClicked, dataBack, answersToRend... | true |
48e19a5ba77f03d2342910a863d658645588cda5 | JavaScript | joma74/acc-natours | /config/helpers.js | UTF-8 | 1,417 | 3.140625 | 3 | [
"MIT"
] | permissive | const path = require("path")
const _root = path.resolve(__dirname, "..")
const _rootRel = path.relative(".", "..")
/**
* Joins the path of args with this "./.." as root
* @param {...string} args
* @returns {string} an absolute path
*/
function rootAbs(...args) {
args = Array.prototype.slice.call(arguments, 0)
... | true |
e69d353ee7d2383862b7735d8013b487a6bbb478 | JavaScript | NicolasChang/JavaScriptHK | /JS01/7.String/main.js | UTF-8 | 394 | 3.3125 | 3 | [] | no_license | let thisH1 = document.getElementsByTagName("h1")[0];
thisH1.addEventListener("click", showAlert);
function showAlert() {
alert("字串長度:" + thisH1.innerHTML.length + "\n" +
"World在:" + thisH1.innerHTML.indexOf("world") + "位置" + "\n"
+ "第一個字" + thisH1.innerHTML.split(" ")[0] + "\n" +
"第二個字... | true |
ef966843bc5c3768ddba159c11a084294709f005 | JavaScript | thiagofb84jp/coding-day-by-day | /exercicios-js/w3cresource/sequentialStructure/exercise13.js | UTF-8 | 538 | 4.4375 | 4 | [] | no_license | /**
* Tendo como dado de entrada a altura (h) de uma pessoa, construa um algoritmo que calcule seu peso ideal, utilizando as seguintes fórmulas:
a) Para homens: (72.7*h) - 58
b) Para mulheres: (62.1*h) - 44.
*/
function pesoIdeal(altura) {
let pesoIdealHomem = (72.7 * altura) - 58;
let pesoIdealMulhe... | true |
9b9ff81f4ee9874789a49d96617bcd586d9162f7 | JavaScript | neherlab/demo-auspice-tree | /src/io/fetchAsupiceJson.js | UTF-8 | 546 | 2.671875 | 3 | [
"MIT"
] | permissive | import Axios from 'axios'
export function takeFirstMaybe(maybeArray) {
if (!Array.isArray(maybeArray)) {
return maybeArray
}
if (maybeArray.length > 0) {
return maybeArray[0]
}
return undefined
}
export async function fetchAuspiceJson(router) {
const jsonUrl = takeFirstMaybe(router.query?.['json... | true |
b58cf6bb3b8f1f807b6e1d7aa3f9782198744d80 | JavaScript | alessandro-lo-presti/movie-app | /frontend/src/page/ranking/ranking.js | UTF-8 | 2,440 | 2.75 | 3 | [] | no_license | import { writeMainHTML } from "../../common/common";
import { movieApiService } from "../../services/movieApiService";
import { orderByFieldAndDirection } from "./../../common/comparator";
const buildTbodyRow = (movie, index) => `
<tr class="movie-table-record">
<td class="movie-id">${index + 1}</td>
... | true |
73a38ae678677533a177e140d127d49f10165c30 | JavaScript | qi1n/leetcode | /js/legacy-js/575.distribute-candies/solution.js | UTF-8 | 247 | 2.953125 | 3 | [] | no_license | /*
* @lc app=leetcode id=575 lang=javascript
*
* [575] Distribute Candies
*/
/**
* @param {number[]} candies
* @return {number}
*/
var distributeCandies = function(candies) {
return Math.min(new Set(candies).size, candies.length / 2);
};
| true |
cb082364bbaefaf3a96d48d77ee804b522f37aeb | JavaScript | jeftarmascarenhas/react-testing-library | /src/clickers.js | UTF-8 | 476 | 2.609375 | 3 | [] | no_license | import React, { useState } from 'react'
function Clickers() {
const [count, setCount] = useState(0)
const handleUpCount = () => {
setCount(count + 1)
}
const handleDownCount = () => {
setTimeout(() => {
setCount(count - 1)
}, 250)
}
return (
<div>
<button onClick={handleUpCount}... | true |
8556e7bd5760479f1cf7b303b769bbbc294bc1a0 | JavaScript | tariqelb/Javascript-Exercise | /Function/Ex14/Ex14.js | UTF-8 | 524 | 4.25 | 4 | [] | no_license | // Write a JavaScript function to convert an amount to coins.
// Sample function : amountTocoins(46, [25, 10, 5, 2, 1])
// Here 46 is the amount. and 25, 10, 5, 2, 1 are coins.
// Output : 25, 10, 10, 1
function amountTocoins(amount , coins) {
let i = 0;
let pepers = [];
while (amount > 0)
{
... | true |
34e87640f69e7269c53a2d3c924e574cdcc8d6e0 | JavaScript | shelbygreen/env-racism-gatsby | /util/format.js | UTF-8 | 936 | 3.40625 | 3 | [
"0BSD"
] | permissive | export const formatNumber = (number, decimals = null) => {
const absNumber = Math.abs(number)
let targetDecimals = decimals
if (targetDecimals === null) {
// guess number of decimals based on magnitude
if (absNumber > 10 || Math.round(absNumber) === absNumber) {
targetDecimals = 0
} else if (absNumb... | true |
9b4170b21af8edb40519bd4595e7303f63f6a1e0 | JavaScript | adi4cyber/gun-mysql | /src/queue/ReactiveQueue.js | UTF-8 | 2,160 | 2.71875 | 3 | [] | no_license | import Event from 'events';
import Queueable from './Queueable';
export default class ReactiveQueue extends Event {
constructor() {
super();
this.queue = [];
this.onDeck = null;
this.on('item:added', run => {
if (run) {
this.run();
}
... | true |
057a3bdf2dcf4002ea3fe32292b3084a72722bf6 | JavaScript | Mohammed-Almuziny/W02D01 | /function.js | UTF-8 | 912 | 4.09375 | 4 | [] | no_license | //function 1
const sum = function (a, b) {
return a + b;
};
//function 2
const average = function (a, b) {
return (a + b) / 2;
};
//function 3
const findFactorial = function (num) {
let n = 1;
while (num > 0) {
n = n * num;
--num;
}
return n;
};
//function 4
... | true |
28f194342ee05dadb73712f834e2be7f8d25a0be | JavaScript | Whwitpohe/redPlum | /src/BaseTools/Load/loadLayer.js | UTF-8 | 1,541 | 2.515625 | 3 | [] | no_license | /**
* Created by FanJiaHe on 2015/11/26.
*/
var LoadLayer = function()
{
};
LoadLayer.prototype._ndoe = null;
/**
* 加载cocos2d jsonUI文件
* @param {string} fileName 文件名
* */
LoadLayer.load = function(fileName)
{
var container = new LoadLayer();
container.setNode(fileName);
return container;
};
LoadLay... | true |
914c4e7ae7b42c37ccc5d10a5552ec4e354bdd41 | JavaScript | skynikita/todo-app | /src/components/List.js | UTF-8 | 2,096 | 2.515625 | 3 | [] | no_license | import React, { useState } from "react"
import PropTypes from "prop-types"
import TodoItemForm from "./ItemForm"
import TodoItemCard from "./ItemCard"
import { sortByName, sortByPriority } from "../util/sortTasks"
const TodoList = (props) => {
const { tasks, setTasks, sortMethod } = props
const [taskUnderEditi... | true |
9902aefe3ed7c533bad2c2410e250bfdc76efdd2 | JavaScript | Eugene456/Lesson09 | /script/script.js | UTF-8 | 8,217 | 2.75 | 3 | [] | no_license | 'use strict';
let start = document.getElementById('start'),
cancel = document.getElementById('cancel'),
buttons = document.getElementsByTagName('button'),
incomePlus = buttons[0],
expensesPlus = buttons[1],
depositCheck = document.querySelector('#deposit-check'),
addIncomeItem = document.querySelectorAll('.a... | true |
6060a74bcce41027bc6e930ad378c6f878143fd1 | JavaScript | gladysaj/lab-thinking-in-react | /starter-code/src/App.jsx | UTF-8 | 1,076 | 2.765625 | 3 | [] | no_license | import React, { Component } from 'react';
import './App.css';
import SearchBar from './components/searchBar/SearchBar';
import ProductTable from './components/productTable/ProductTable';
import dataOriginal from './data.json';
class App extends Component {
state = {
data:[],
isAvailable: false
}
compon... | true |
dfabd579dfaa546cbd93d086f5e459180c1dee28 | JavaScript | matths/knockout-experiments | /js/lib/knockout-customElementsWithCustomAttributes.js | UTF-8 | 5,738 | 2.734375 | 3 | [] | no_license | (function(global, undefined) {
function attachToKo(ko) {
ko.componentBindingProvider = function (providerToWrap) {
this._providerToWrap = providerToWrap;
this._nativeBindingProvider = new ko.bindingProvider();
};
function _nodeIsCustomComponentElement (node) {
var noParams = !node.getAttribute || node.... | true |
0547ecdf579c2f90a40d1efab02603d65f078b4f | JavaScript | alexonxxx/react-redux-storeapp | /src/ducks/cart/cartReducer.js | UTF-8 | 1,177 | 2.59375 | 3 | [] | no_license | import { DECREMENT_QUANTITY, DROP_LINE_ITEM, INCREMENT_QUANTITY } from '.';
const cartReducer = (state = [], action) => {
switch (action.type) {
case DECREMENT_QUANTITY: {
const { productId } = action;
const index = state.findIndex(lineItem => lineItem.id === productId);
if (index === -1) retur... | true |
bdc47ac1d0e63aba841dfdf1aedfb0ea1bec16d3 | JavaScript | giladm/stash | /scripts/pairs/dupsHandlerHM.js | UTF-8 | 2,306 | 2.59375 | 3 | [] | no_license | /*
* * Gilad Melamed
* * Xtify
* * created: 10/29/12
* *
* * The script iterates over a set of conseqcutive appKey to find duplicate tokens.
* * Tokens found are inserted to a new collection dups_tokens_preview. Once completed
* * the scripts iterates over the dups, and for each finds... | true |
05e81033243cc40b96827dac22191525dc46e3d8 | JavaScript | camr1993/algos | /AlgoRoadMap/Arrays/maximumSubarray.js | UTF-8 | 288 | 3.421875 | 3 | [] | no_license | var maxSubArray = function (nums) {
// dynamic programming: keep track of highest steak as you go
let maxSum = nums[0]
for (let i = 1; i < nums.length; i++) {
if (nums[i - 1] > 0) {
nums[i] += nums[i - 1]
}
maxSum = Math.max(nums[i], maxSum)
}
return maxSum
}
| true |
8e34aaea3a97734462c9aa3289be620f9d529080 | JavaScript | factoryfx/factoryfx | /domFactoryEditing/src/main/resources/js/factoryEditing/widget/attribute/editors/ByteAttributeEditor.js | UTF-8 | 780 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | import { AttributeEditorWidget } from "../AttributeEditorWidget";
export class ByteAttributeEditor extends AttributeEditorWidget {
constructor(attributeAccessor, inputId) {
super(attributeAccessor, inputId);
this.attributeAccessor = attributeAccessor;
this.inputId = inputId;
}
render... | true |
8cc49856dd3d6d8a4ae7cb4cf1d2e26fa3828eb4 | JavaScript | FacuTGonzalez/omdbFinal | /src/src/components/form.jsx | UTF-8 | 2,399 | 2.515625 | 3 | [] | no_license | import axios from "axios";
import { Button } from "primereact/button";
//import './FormDemo.css';
import { useState, useEffect } from "react";
export const FormikFormDemo = () => {
const [registro, setRegistro] = useState({});
const handleSubmit = (e) => {
e.preventDefault();
console.log(registro);
return... | true |
7f88e8055a9a76031ec41bcc77203fbea3b5b067 | JavaScript | Ash-Lee/CodeBytes | /JavaScript/16 - Arith Geo.js | UTF-8 | 1,902 | 4.625 | 5 | [] | no_license | /* JavaScript =============================================================================================================
16 - Arith Geo
Create a function that takes an array of numbers and returns the string "Arithmetic" if the
sequence follows an arithmetic pattern or return "Geometric" if it follows a ... | true |
b054b2cfeee8b784a7224144a4f16ce7ebf1a5ed | JavaScript | NasC0/Telerik_HW_2013-2014 | /JavaScript Part 1/02. OperatorsAndExpressions/06. PointWithinCircleCheck.js | UTF-8 | 559 | 4.28125 | 4 | [] | no_license | ////////////////////////////////////////////////////////////////////////////////////////////////
// Task 6. Write an expression that checks if given print (x, y) is within a circle K(O, 5). //
////////////////////////////////////////////////////////////////////////////////////////////////
var xPoint = 2;
var yPoint =... | true |
7d104415e088986539cdc5efcffcf4087b96cfb8 | JavaScript | elfrmkr/blog-post-redux | /src/actions/index.js | UTF-8 | 3,207 | 3.234375 | 3 | [] | no_license | import jsonPlaceholder from '../apis/jsonPlaceholder';
import _ from 'lodash';
// we are going to call fetch users and posts mutliple times. For fetching, this action creator is going to be called ALONE. The other action creators will help to form this one.
// when we call of an action creator inside of an action cre... | true |
75e5c99771a44c8a0069d5969207febeb0815fc5 | JavaScript | makDocs/NodeJS | /m2(Http)/routes.js | UTF-8 | 1,767 | 2.921875 | 3 | [] | no_license | const fs = require('fs')
const handleHttpFunc = (req, res) => {
console.log('Omad')
console.log('95sas5a9655s85855555555555')
// console.log(req.method,req.url) // GET , /
// console.log(req.headers) // host , connection , accept ,cookie
// res.end('<h1>Saalam</h1>');
res.setHeader('Contetnt-T... | true |
552ce006a53bd00ef433c1d651abaae1d0470e5f | JavaScript | iYung/drawingApp | /square.js | UTF-8 | 1,168 | 3.46875 | 3 | [] | no_license | function squareShape(colour, startPos, endPos) {
this.type = "square";
this.colour=colour;
this.startPos = startPos;
this.endPos = endPos;
}
squareShape.prototype = Object.create(shape.prototype);
squareShape.prototype.constructor = squareShape;
squareShape.prototype.draw = function(cursor) {
curs... | true |
d2bb2c302538d94c5ad5c9ae661fe1bd04bdf1e7 | JavaScript | camiloa17/langara-review-ui | /src/Platform/CreatePlatform/CreatePlatform.js | UTF-8 | 1,302 | 2.640625 | 3 | [] | no_license | import { useState } from 'react';
import { Form, Button } from 'react-bootstrap';
export default function CreatePlatform(props) {
const [platformName, setPlatformName] = useState('');
const onSubmitCreate = async (e) => {
e.preventDefault();
if (platformName.length > 1) {
const su... | true |
3b0c16be5efa9641f4adf4b9849e14fd5d90fb33 | JavaScript | chandinisattineni/Codewars | /JavaScript/truncate-paragraph-using-higher-order-component-in-react-js.js | UTF-8 | 1,653 | 3.765625 | 4 | [] | no_license | /*
Learn how to make a React JS higher-order component (HOC) and follow good practice.
A HOC is a function that takes a component as the first parameter and returns a function wrapping the first parameter.
function withExample(Component) {
return function(props) {
return <Component ></Component>
}
}
Just gett... | true |
de40be531fe733d2eeda13ed4312a2cdde11c360 | JavaScript | nahojd/vanilla-tooltip | /tip.js | UTF-8 | 2,740 | 2.796875 | 3 | [
"MIT"
] | permissive | (function() {
function Tip() {
function isTip(element) {
return element.classList.contains('tip');
}
function isInPopover(element) {
if (!element || element.tagName.toLowerCase() === 'body')
return false;
if (element.classList.contains('popover-clone'))
return true;
return isInPopover(elem... | true |
8b9eaa3477b50b5020abf2d9e87f93ee9a2407d8 | JavaScript | cocheok/picl-desktop-client | /lib/bookmarks-store.js | UTF-8 | 1,308 | 2.65625 | 3 | [] | no_license | const BookmarksGuidService = require('bookmarks-guid-service');
var store = {};
function clear() {
store = {};
}
function setItemForId(id, item) {
store[id] = item;
}
function getItemForId(id) {
return store[id];
}
function deleteItemForId(id) {
delete store[id];
}
// returns array of BookmarksItems child... | true |
050738713a2e9de1b30a9855736604b6aa0eb99a | JavaScript | bkchu/udemy16-http-starter | /src/axios.js | UTF-8 | 984 | 2.59375 | 3 | [] | no_license | import axios from "axios";
const instance = axios.create({
baseURL: "https://jsonplaceholder.typicode.com"
});
instance.defaults.headers.common["Authorization"] = "AUTH TOKEN FROM INSTANCE";
/* intercept request,
edit it or get more info,
then pass it along by returning it.
also allows the option of logg... | true |
b0fd3802ec6d5f0d2a2a77516342de971492f9b0 | JavaScript | codingspecialist/rasp-streaming | /src/main/resources/static/js/funeral.js | UTF-8 | 584 | 2.84375 | 3 | [] | no_license | let index = {
init: function(){
$("#startDate").on('change', (e)=> {
this.activeRooms(e);
})
},
activeRooms: function (e) {
console.log(e.target.value);
let startDate = e.target.value;
fetch("/api/v1/activeRooms?startDate=" + startDate).then(function (res) {
return res.json();
}).then(function (r... | true |
a914f461014a2f24b775ed8196558fa8cf6d05cc | JavaScript | alan-hogarth/react_app_art_vids | /src/App.js | UTF-8 | 1,107 | 2.625 | 3 | [] | no_license | import { useEffect, useState } from 'react';
import './App.css';
import VidList from "./Components/VidList";
import VidFilter from "./Components/VidFilter";
function App() {
const [videos, setVideos] = useState([]);
const [vidFilter, setVidFilter] = useState([]);
const fetchVideos = ()=> {
const ur... | true |
719a0d4d40fbf0291b6732d7c530c2112abc1c5a | JavaScript | CodeBishop/codewars-sandbox | /6kyu/are-they-the-same.js | UTF-8 | 2,254 | 4.90625 | 5 | [] | no_license | /* INSTRUCTIONS
Given two arrays a and b write a function comp(a, b) (compSame(a, b) in Clojure) that checks whether the two arrays have the "same" elements, with the same multiplicities. "Same" means, here, that the elements in b are the elements in a squared, regardless of the order.
Examples
Valid arrays
a = [121, ... | true |
31494c1e080370f2d2fe2df6ac5be1eb24f93848 | JavaScript | weirdestnerd/mesa_blocking | /preprocess/density.js | UTF-8 | 8,155 | 2.765625 | 3 | [] | no_license | /**
* Module dependencies
*/
const dataProvider = require('../data/provider');
const Polygon = require('../utils').Polygon;
const fs = require('fs');
const path = require('path');
const dbf = require('dbf');
const utils = require('../utils');
const HashMap = require('hashmap');
const jsonfile = require('jsonfile');
... | true |
ced83f1a486a3f6f787e7eb73a9afe33e2ea7fb5 | JavaScript | elyourn/jest_lessons | /click-counter/src/App.test.js | UTF-8 | 3,085 | 2.84375 | 3 | [] | no_license | import React from 'react';
import Enzyme, { shallow } from 'enzyme';
import EnzymeAdapter from 'enzyme-adapter-react-16';
import App from './App';
Enzyme.configure({ adapter: new EnzymeAdapter() })
/**
* Factory facntion to create to create ShallowWrapper for the App component
* @function setup
* @param {object}... | true |
57ce99e96badb9b54af9f709a3f5619dd9fa23be | JavaScript | Victoriaspurlieu/Legacy | /assets/javascript/imageApiInCarousel.js | UTF-8 | 14,108 | 2.5625 | 3 | [] | no_license | $(document).ready(function() {
var apiKey = 'user_key=dd6dab64b179a2bb9a93127562835ed8';
var trendSpotterKey1 = '7743da92de8ab506139a44b7a092ca95';
var backupKeyTrendspottr = '1582e1c19ebc9c57de3aa64745c46068';
var trendSpotter = 'http://api.trendspottr.com/v1.5/search?key=' + trendSpotterKey1 + '&q=?';
var... | true |
c9d90026263d0e480c6d061f36df4ad34ebe3ae7 | JavaScript | awhlmycn/myWeb | /app/mysql/redis.js | UTF-8 | 828 | 2.671875 | 3 | [] | no_license | //https://www.cnblogs.com/jkll/p/4550080.html
var redis = require( 'redis' );
var REDIS_HOST = 'redis.eshinetest.cn';
var REDIS_PORT = 6379;
var redisClient = redis.createClient( { host: REDIS_HOST, port: REDIS_PORT});
redisClient.on( 'ready', function()
{
console.log('ready');
});
redisClient.on( 'con... | true |
a597ef97921793d6e30a01ef8b1733412d18575a | JavaScript | robertacintra/js | /exercises 01/exercicios/cotacao.js | UTF-8 | 328 | 3.765625 | 4 | [] | no_license | // Crie uma função para converter bitcoin em reais, dada uma quantia e uma cotação.
var conversao = function (){
var bitcoin = prompt("Quantos bitcoins você quer converter?");
var cotacao = prompt("Quantos reais vale 1 bitcoin hoje?")
var resultado = bitcoin * cotacao;
alert("Você teria " + resultado)
... | true |
e783785c52ff8018d6fddbe45b05f6425d6ed751 | JavaScript | SEAI-H-2020/Software | /server/Authentication_API.js | UTF-8 | 4,916 | 2.5625 | 3 | [] | no_license | module.exports = function (app, pool) {
// list of users and their respective username, password and email
app.get("/users", async (req, res) => {
/*
Swagger Documentation:
#swagger.tags = ['Authentication']
#swagger.description = 'Lists all users and their data.'
*/
try ... | true |
d41262faa9a5d9f54351634c6c9a77c7385f5381 | JavaScript | PeterSchreuderMA/AMPJ2 | /html/03VelocityAndAccerelation/script.js | UTF-8 | 3,351 | 2.640625 | 3 | [] | no_license | const canvas = document.getElementById('canvas');
const context = canvas.getContext('2d');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
canvas_width = canvas.width;
canvas_height = canvas.height;
let titel_text = new draw_text(canvas_width/2, 50, "Velocity And Accerelation",50);
let kineti... | true |
830a7d7bd60c88e23bd272d1d24f8b87ca2bb20a | JavaScript | arnargisla/blocks | /src/Player.js | UTF-8 | 2,349 | 3.234375 | 3 | [] | no_license | import Position from "./Position";
import util from "./util";
class Player {
constructor(name){
this.isMainPlayer = false;
this.name = name;
this.height = 20;
this.width = 20;
this.color = "#" + util.generateColorFromString(name);
this.speedPerSecond = 250;
this.position = new Position(5+... | true |
2281ae5aec7e802472216f70079b86fb8b2b5901 | JavaScript | hollowtree/runningteemo | /mooc/coursera/algorithmic-toolbox/02_introduction/fibonacci2.js | UTF-8 | 281 | 3.9375 | 4 | [] | no_license | function fibonacci(n) {
let arr = [0, 1]
for (let i = 2; i < n; i++) {
arr.push(arr[i - 1] + arr[i - 2]);
}
return arr[i]
}
function fibRecurs(n) {
if (n <= 1) {
return 2
} else {
return 2 * n + 2
}
}
console.log(fibonacci(10)) | true |
05c33fabe7c81c160c71cb06b8117f62a19c81ad | JavaScript | Leired7/maquetando-con-chuck | /s02/e03-e04-e05/js/modal.js | UTF-8 | 1,276 | 2.59375 | 3 | [
"MIT"
] | permissive | 'use strict';
function openModal(id) {
const modal = html.querySelector('#' + id);
modal.setAttribute('aria-hidden', false);
page.setAttribute('aria-hidden', true);
modal.classList.add('modal--active');
modal.setAttribute('tabindex', 1);
modal.focus();
html.classList.add('no-scroll');
}
function closeModal(id)... | true |
6a13702b49baec40cf7add8121e1b351a470245e | JavaScript | anshuman161/ReactJsFinal | /src/dashBoard/buttonaddlabel.jsx | UTF-8 | 2,421 | 2.515625 | 3 | [] | no_license | import React, { Component } from 'react';
import Button from '@material-ui/core/Button';
import Menu from '@material-ui/core/Menu';
import MenuItem from '@material-ui/core/MenuItem';
import { getLables, addLabelOnNotes } from '../services/labelservice';
export default class buttonAddLabel extends Component {
const... | true |
7b12ba703a1ebcace1ad8f47f28b7fc120491c0b | JavaScript | faaslang/faaslang | /tests/files/cases/function_valid_optional_param.js | UTF-8 | 184 | 2.90625 | 3 | [
"MIT"
] | permissive | /**
* Valid function with an optional param
* @param {?string} name
* @returns {string}
*/
module.exports = (name = null, callback) => {
return callback(null, name || 'hello');
};
| true |
53a1dbfaf42b11f86266b2e2fc2917d9089b7bd1 | JavaScript | carol198/javascript | /Ej3/main.js | UTF-8 | 182 | 3.3125 | 3 | [] | no_license | //Añadir elementos a un array con push(Ciclo for)
var meses=["enero","febreo","marzo","abril","mayo","junio","agosto","septiembre","octubre","noviembre","diciembre"];
alert(meses);
| true |
6a894c7f24372c6463f8e3ea4cb1236447ee3df0 | JavaScript | TalehFarzaliyev/JS-group | /day5/search.js | UTF-8 | 598 | 3.8125 | 4 | [] | no_license | let arr=[];
let day=prompt("Ayin uzunlugunu daxil edin!");
for (var i=1;i<=day;i++){
arr.push(i);
};
console.log(arr)
//7
function binarySearch(arr,birthday){
let start = 0;
let end = arr.length-1; //31-1->30
let step = 0;
while(start<=end)
{
let mid = Math.floor((start+end)/2)... | true |
a0c8008806135e28b2c0341213d73a1caf80a734 | JavaScript | lincolnneu/webdev-summer-2018-java-server-jiabo | /src/main/webapp/jquery/components/admin/user-admin.controller.client.js | UTF-8 | 5,001 | 3.125 | 3 | [] | no_license | (function(){
var $usernameFld, $passwordFld, $roleFld;
var $removeBtn, $editBtn, $createBtn, $updateBtn, $searchBtn;
var $firstNameFld, $lastNameFld;
var $userRowTemplate, $tbody;
var userService = new UserServiceClient();
$(main);
function main(){
$tbody = $('tbody');
$use... | true |
de14b1900b1b8b66394e9374e22f34c84f162996 | JavaScript | geandre/vue-check | /src/helpers.js | UTF-8 | 887 | 2.890625 | 3 | [
"MIT"
] | permissive | /**
* @module Helpers
* @description Groups helper functions
* @author Geandre Miranda <geandremiranda.ms@gmail.com>
*/
import Checkers from './checkers';
/**
* Classifies a value into a type and returns it.
*
* @param {*} value
* @returns {String} type
*/
const getType = (value) => {
if (!Checkers.isDefin... | true |