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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
8660fe2a8ccf43de0b934ebea30c5d715dc99ea5 | JavaScript | DraciVik/codewars_solutions | /7kyu-product-of-maximums-of-array.js | UTF-8 | 1,790 | 3.765625 | 4 | [
"MIT"
] | permissive | // ntroduction and Warm-up (Highly recommended)
// Playing With Lists/Arrays Series
// Task
// Given an array/list [] of integers , Find the product of the k maximal numbers.
// Notes
// Array/list size is at least 3 .
// Array/list's numbers Will be mixture of positives , negatives and zeros
// Repeati... | true |
ca1ef19ae94d906b7e51c7437824be78424d90b1 | JavaScript | difire/difire | /20201123/index.js | UTF-8 | 2,405 | 2.859375 | 3 | [] | no_license | var flag= false;
var cur={
x:0,
y:0,
wanchengyidong:true
}
var nx,ny,dx,dy,x,y;
function down(){
flag=true;
}
function move(){
if(flag){
if (event.touches) {
touch=event.touches[0];
if (touch.clientX>122 && touch.clientX<290) {
label.style.left = touch.clientX-40+"px";
cur.x=touch.clientX
}
}
else{
... | true |
2bd389c4cb47a70a115f95a38e36d2606865d74c | JavaScript | talles2512/Gerenciamento-Frotas | /CONTROLE_FROTAS/veiculo/functions/verificacao.js | UTF-8 | 1,100 | 2.53125 | 3 | [] | no_license | function enviardados(dados)
{
if (dados.Chassi == "") {
alert("Preencha o Chassi corretamente!");
document.dados.tx_Chassi.focus();
return false;
}
if ( document.dados.tx_Placa.value.length <= 6) {
alert("Preencha a Placa corretamente!");
document.dados.tx_... | true |
4a1fb3d860cf6a57314d8fcbd5f38986b900bd39 | JavaScript | alyssalea/Andres_spirograph | /sketch.js | UTF-8 | 603 | 3.234375 | 3 | [] | no_license | function setup() {
createCanvas (windowWidth,windowHeight)
frameRate (30)
background (34,56,78)
}
function windowResized(){
resizeCanvas (windowWidth,windowHeight)
background (34,56,78)
}
function draw() {
fill (0,0,0,0)
stroke (random (255), random(255), random(255))
ellipsev()
if (keyIsDown (DOWN_... | true |
d5b67af551a1ebcc841d0131ef7bfbadb3f31a1a | JavaScript | JasonLin1230/leetCode | /Algorithms/35.js | UTF-8 | 693 | 3.5 | 4 | [
"MIT"
] | permissive | /**
* @param {number[]} nums
* @param {number} target
* @return {number}
*/
// Runtime: 56 ms, faster than 100.00% of JavaScript online submissions for Search Insert Position.
// Memory Usage: 33.8 MB, less than 54.50% of JavaScript online submissions for Search Insert Position.
var searchInsert = function(nums, ta... | true |
95b151eb49c9aa6d113272f18443972b192a0fba | JavaScript | mfaisalabbasi/socialapp | /routes/api/profile.js | UTF-8 | 7,565 | 2.609375 | 3 | [] | no_license | const express = require("express");
const router = express.Router();
const auth = require("../../middleware/auth");
const Profile = require("../../models/Profile");
const User = require("../../models/User");
const { check, validationResult } = require("express-validator");
//req /api/profile/me
//desc getting current ... | true |
c4ed0a8786c9ebfdb35fef2c9db98635afa21509 | JavaScript | rbuchmeier/diamondhllamas | /pages/api/llamas/[id].js | UTF-8 | 1,036 | 2.8125 | 3 | [] | no_license | // import { llamas } from '../../../data'
const fs = require('fs');
//export default function llamaHandler({ query: { id } }, res) {
export default function llamaHandler(req, res) {
const { id } = req.query;
let filepath = './llamas.json'
let rawData = fs.readFileSync(filepath);
let llamas = JSON.parse(rawData... | true |
56d2d16f9fc36103556af7424c1ed0fe0a41c35b | JavaScript | akilans/NodeJs-Tutorial | /9_mdb_insert_data.js | UTF-8 | 1,014 | 3.234375 | 3 | [] | no_license | // Connect mongodb database & insert one entry & insert multiple entries
const mongodb = require('mongodb').MongoClient;
const db_url = "mongodb://localhost:27017";
mongodb.connect(db_url, (err, db) => {
if (err) throw err;
const dbo = db.db("employee");
// Insert one document [ row ]
const newEmp... | true |
b9a45286337214e80c7fd17b1e3eb675709d213d | JavaScript | belrah/array-loops | /script.js | UTF-8 | 250 | 2.984375 | 3 | [] | no_license | var food=["Rice", "Plantain", "Beans", "Salads", "Potatoe", "Spaggetti"];
var length=food.length;
var list="<ol>"
for (var i = 0; i<length; i++) {
list +="<li>" + food[i] + "</li>";
}
list +="</ol>";
document.getElementById('demo').innerHTML=list;
| true |
3d8fb3983de5c28f9ab839ed162bb7692dcc8a3b | JavaScript | karlwnw/chrome-extension-shortcuts | /content_scripts/google.js | UTF-8 | 871 | 2.71875 | 3 | [
"MIT"
] | permissive | chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {
let isSuccess = false;
if (request.command === 'focus-next-link') {
isSuccess = focusNextLink();
}
sendResponse({"isSuccess": isSuccess});
});
function focusNextLink() {
if (!globalGoogleLength) {
return... | true |
3d384eb763a4270ec9040368dd7b5b429305bacb | JavaScript | Rahul-skush/Data_Transformation-1 | /client/src/Components/JobandDataEntry/AddJob.js | UTF-8 | 1,944 | 2.53125 | 3 | [] | no_license | import React, { Fragment, useState } from 'react'
import axios from 'axios';
import TextField from '@material-ui/core/TextField';
const AddJob = (props) => {
const [jobs, setJobs] = useState({ name: "", description: "" });
const handleJobNameChange=(event)=>{
console.log(event.target.value);
const value... | true |
aceb9d1367087b469a44aa2cfe6902d54a8a89a3 | JavaScript | p4535992/repositoryForTest | /testWitSources/jspm_packages/npm/shapefile@0.3.0/read.js | UTF-8 | 907 | 2.53125 | 3 | [
"BSD-3-Clause"
] | permissive | /* */
(function(process) {
var queue = require('queue-async');
var file = require('./file');
module.exports = function(reader) {
return function() {
var argv = [].slice.call(arguments),
callback = argv.pop(),
r = reader.apply(null, argv);
queue(1).defer(r.readHeader).defer(fun... | true |
dc54be39fbcac5ced84d0b5addb667c43f8f74ce | JavaScript | huangxiaolu495/dce_project | /js/calendar.js | UTF-8 | 21,474 | 2.515625 | 3 | [] | no_license | /**
* jquery日历插件jqyery.calendar.js
* @author:xuzengqiang
* @since :2015-2-4 15:31:39
**/
;
(function ($) {
jQuery.fn.extend({
showCalendar: function (options) {
var defaultOptions = {
//class名称
className: 'strongCalendar',
//日历格式'yyyy-MM-dd'('yyyy-MM-dd','yyyy年MM月dd日')
... | true |
58349582db98a70da2806a948dcb827efacdcced | JavaScript | kevinkoh89/rest-client | /src/index.js | UTF-8 | 3,034 | 2.625 | 3 | [] | no_license | import axios from 'axios';
import axiosRetry from 'axios-retry';
import format from "string-template";
const inRange = (value, min, max) => value >= min && value <= max
export const Request = { GET:"get", POST:"post", PUT:"put", DELETE:"delete" }
export class RestClient{
constructor(configs){
this._confi... | true |
8cf7567a5339cf3700cd7710791c0d4ea4aaeaae | JavaScript | alexisrodriguez99/1er_Year_UTN | /1er cuatrimestre SPD-LAB1-PROG1-INGLES1/CursoIngresoJS-master/5-InstruccionWhile/jsIteraciones (1).js | UTF-8 | 134 | 2.75 | 3 | [] | no_license | function mostrar()
{
var contador;
contador=1;
while(contador<11)
{
alert(contador);
contador=contador+1;
}
}//FIN DE LA FUNCIÓN | true |
4e2026d29b548fb352071cdbcfc135edb90c97ae | JavaScript | DannyZeng2/take-out-food | /src/best-charge.js | UTF-8 | 2,237 | 3.171875 | 3 | [] | no_license | function bestCharge(selectedItems){
//1h
var allItems = loadAllItems();
var promotions = loadPromotions();
var itemsNameAndCount = getItemsNameAndCount(selectedItems);
var itemsFullInfo = getItemsFullInfo(itemsNameAndCount, allItems);
var priceArr = getSalePrice(promotions,itemsFullInfo)
var totalPr... | true |
5f2fadf049d0c7c8f3d5fe32eef6e28a179c4c52 | JavaScript | xiaominzhu88/todo-react-redux | /src/store/reducers/index.js | UTF-8 | 1,138 | 2.796875 | 3 | [] | no_license | const initialState = {
todos: [],
filter: 'ALL', //completed, active...
};
// create key (could also use simple uuid())
function createId() {
let id = 0;
return function () {
return id++;
};
}
const genId = createId();
function todoList(state = initialState, action) {
switch (action.type) {
case '... | true |
e3ddd57abe1d17c77725cf0136e0f46d96c55246 | JavaScript | ShmuelLotman/Sorting | /bubblesort.js | UTF-8 | 458 | 3.75 | 4 | [] | no_license | function bubbleSort(arr) {
var finalCount = 0;
for (var i = 0; i < arr.length; i++) {
finalCount += swap(arr);
}
return "swappedArr is " + arr + "and it's swapped" + finalCount + "times.";
}
function swap(arr) {
var count = 0;
for (var j = 0; j < arr.length - 1; j++) {
if (arr[j] > arr[j + 1]) {
... | true |
25688b6be217acaf1d2198bd1474d42f229a4c4c | JavaScript | joaocamposfct/thescraper | /controllers/info.js | UTF-8 | 4,720 | 2.515625 | 3 | [] | no_license | /**
* Info controller
*/
var request = require('request');
var async = require('async');
var j;
var competitors = [];
var competitorId = 0;
var _this = this;
exports.parseFight = function(fightUnparsed, callback){
var fight = {};
fight.competition_name = fightUnparsed.competition_name;
fight.id_person_blue = fight... | true |
c10f5baa5baacda70afff773e677e047f1d2ee19 | JavaScript | igqueiroz/crudforms | /src/components/SignIn.js | UTF-8 | 3,271 | 2.71875 | 3 | [] | no_license | // Para uma atenticação completa pelo Firebase é necessário ter as chaves da API apiKey, no caso foi usado a autenticação básica e as credentials armazenados na Store.
// Uma vez as credentials armazenadas diminuimos a quantidade de requisições.
// Doc: https://firebase.google.com/docs/auth/users
import React, { Comp... | true |
005301010d24bd4949b47eecf91b4943b6c6081e | JavaScript | issamabdelkrim/react-complete-guide | /src/App.js | UTF-8 | 794 | 2.8125 | 3 | [] | no_license | import React, { Component } from "react";
import logo from "./logo.svg";
import "./App.css";
import Person from "./Person/Person";
class App extends Component {
state = {
persons: [
{
name: "Issam",
age: 25
}
]
};
swicthNameHandler = () => {
this.setState({
persons: [... | true |
89bb0196a3edca9014335a01abb96402fdd75cd6 | JavaScript | Dhanya110/Project-37 | /js folder/Food.js | UTF-8 | 971 | 2.78125 | 3 | [] | no_license | class Food{
constructor(){
this.foodStock=20;
this.lastFed;
this.image=loadImage("js folder/Milk.png")
}
getFoodStock(){
var foods_stock =database.ref('Food');
foods_stock.on("value", readStock);
//foodStock.set(20)
}
updateFoodStock(... | true |
d0a8a7e1621fe2877fbea4795619b937c9d83a4f | JavaScript | franck-samy/rick-and-morty | /game.js | UTF-8 | 8,809 | 3.25 | 3 | [] | no_license | class Game {
constructor() {
this.player = new Character();
this.background = new Background();
this.obstacles = [];
this.bonuses = [];
this.meeseeksLeft = [];
this.meeseeksRight = [];
this.score = 0;
this.lives = 5;
this.bottles = [];
... | true |
757ff5c92d16a44df97d8082c2de2409a703b24c | JavaScript | avarian/arkademy | /4.js | UTF-8 | 704 | 2.875 | 3 | [] | no_license | function arkaFood(harga,kode_promo,jarak,pajak) {
var bayar = harga;
if (kode_promo==='ARKAFOOD5' && harga>=50000) {
if ((harga*50/100) > 50000) {
bayar-=50000;
}else{
bayar-=(harga*50/100);
}
}
if (kode_promo==='DITRAKTIRDEMY' && harga>... | true |
8848759513c65e9c5e03e42aad241fd2e99a9d84 | JavaScript | kode4food/interpol | /test/writers.js | UTF-8 | 915 | 2.53125 | 3 | [
"MIT"
] | permissive | /*
* Interpol (HTML Composition Language)
* Licensed under the MIT License
* see doc/LICENSE.md
*
* @author Thomas S. Bradford (kode4food.it)
*/
"use strict";
var nodeunit = require('nodeunit');
var interpol = require('../lib');
var writers = require('../lib/writers');
function testStringWriter(test, expected,... | true |
d41df96f67d97fdd1b3560d29aec24b0ef586ce9 | JavaScript | gisantiago/Phrase-Hunter | /js/Phrase.js | UTF-8 | 1,576 | 4.1875 | 4 | [] | no_license | /* Treehouse FSJS Techdegree
* Project 4 - OOP Game App
* Phrase.js */
class Phrase {
constructor(phrase) {
this.phrase = phrase.toLowerCase();
}
/**
* Display phrase on game board
*/
addPhraseToDisplay() {
const phrase = this.phrase.split('');
for(var i =... | true |
6721cf09d7f784d9149090c2faed71af031bd36b | JavaScript | sam6321/DDFC-OVA-Discord-Bot | /Commands/music.js | UTF-8 | 1,023 | 2.71875 | 3 | [
"MIT"
] | permissive | const MusicContext = require("../music/context.js");
exports.description = "Plays music from Youtube. Has three subcommands: 'play', 'skip', and 'list'";
exports.info = "Plays music from Youtube.\n'play' - Specify a Youtube video URL to play. If a video is already playing, it will be added to the queue.\n'skip' - Vote... | true |
c4eacbc1d94399aae9642773c1c1dfcd30bceabc | JavaScript | dodyvirgiawan/act.io | /models/todo.js | UTF-8 | 2,608 | 2.625 | 3 | [] | no_license | 'use strict';
const { Model } = require('sequelize');
const { formatDate } = require('../helpers/formatDate.js');
module.exports = (sequelize, DataTypes) => {
class Todo extends Model {
static associate(models) {
Todo.belongsTo(models.User, {foreignKey: 'UserId'})
Todo.belongsToMan... | true |
988dcc857545f9bd9c748ad8d9fb57ad43eb2d9e | JavaScript | jhuckaby/canvas-plus | /lib/filter/adjust.js | UTF-8 | 6,289 | 2.53125 | 3 | [
"MIT"
] | permissive | // canvas-plus - Image Transformation Engine
// Adjust Filter Mixin
// Copyright (c) 2017 Joseph Huckaby
// Released under the MIT License
var Class = require("pixl-class");
module.exports = Class.create({
adjust: function(opts) {
// adjust brightness / contrast / hue / saturation
// opts: { brightness, contra... | true |
1b7cea9db99ddde17dec3ae120b61d56f06b679f | JavaScript | AlexanderMolchanov/test-folder | /alert.js | UTF-8 | 369 | 3.953125 | 4 | [] | no_license | function pow(x , n){
var result = 1;
for (var i = 0; i < n; i++){
result *= x;
}
return result;
}
function int(n){
while(n > 1){
n--;
}
if( n > 0 && n < 1){
return false;
} else return true;
}
var x = +prompt('enter X');
var n = +prompt('enter n');
if ( int(n) ){
alert (x + '^' + n + ' = ' + pow(x,... | true |
b410983b78254a8e9b611c2653b9ea1a4243a524 | JavaScript | MiguelLiraLuis/LAIG | /LAIG3/reader/MyPyramid.js | UTF-8 | 1,257 | 2.75 | 3 | [] | no_license | function MyPyramid(scene) {
CGFobject.call(this,scene);
this.p1 = new getXY(0,0);
this.p2 = new getXY(1,0);
this.p3 = new getXY(0.5,1);
this.triangle = new MyTriangle(scene,this.p2,this.p3,this.p1);
this.plane = new MyPlane(scene, 1, 1, 9, 9);
};
MyPyramid.prototype = Object.create(CGFobject.prototype);
My... | true |
ad62a2a68d1ee46290548d55194e898853515e0c | JavaScript | helsingborg-stad/hbg-react | /lib/components/Calendar/Calendar.js | UTF-8 | 13,542 | 2.53125 | 3 | [
"MIT"
] | permissive | "use strict";
exports.__esModule = true;
var _class, _temp;
var _propTypes = require("prop-types");
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require("react");
var _react2 = _interopRequireDefault(_react);
var _dateFns = require("date-fns");
var _dateFns2 = _interopRequireDefault(_dateF... | true |
604ba06f8f95f10475c49ef8952464bd13689efc | JavaScript | NwosaEmeka/loan-calculator | /js/main.js | UTF-8 | 1,722 | 3.125 | 3 | [] | no_license | const calc_btn = document.querySelector('.form-group');
let loading = document.querySelector('.loading');
let results = document.querySelector('.result');
const errorMsg = document.querySelector('.errorMsg');
calc_btn.addEventListener('submit', showloading);
function showloading(e) {
loading.style.display = 'block';... | true |
a3b0bd7c56042bed9aa435cf878210b16a751598 | JavaScript | ashlyn/dmscreen | /src/components/PathfinderMonsterAdvancer/AdvanceMonster.js | UTF-8 | 13,827 | 2.53125 | 3 | [] | no_license | import { statBonusFromAbilityScore, racialFeatCount, withPlus,
assignAbilityScoreChangeToHighestStat, applyAbilityScoreChanges,
getSavingThrowChangesFromHitDice, applyChangesToSavingThrows, hpDisplay,
getSavingThrowChangesFromStatChanges, getStatBonusDifference, displayArmorClass,
calcTotalAc, calcFlat... | true |
2118855d8460690f6dc93c5658d0d569c06806e9 | JavaScript | kwang429/chatterbox-client | /client/scripts/app.js | UTF-8 | 3,460 | 2.625 | 3 | [] | no_license | // jshint esversion:6
var App = {
$spinner: $('.spinner img'),
username: 'anonymous',
previousLastIndex: 0,
initialize: function() {
App.username = window.location.search.substr(10);
FormView.initialize();
RoomsView.initialize();
MessagesView.initialize();
// Fetch initial batch of mes... | true |
c08078d73a93188fee6e2b5642b602dbf38cdcd2 | JavaScript | libotti/JogoComBuscaBinaria | /src/index.js | UTF-8 | 1,856 | 3.1875 | 3 | [] | no_license | import React, {useState} from 'react';
import ReactDOM from 'react-dom';
import './index.css';
const MostrarI = (props) => {
return <p>{props.i}</p>
}
function App(props){
//ENTRADA RODANDO FIM
const [estado, setEstado] = useState('ENTRADA')
//palpite
const [palpite, setPalpite] = useState(150);... | true |
c7fc8c582f7796d93f8fe9a3ab847e83c5743d4d | JavaScript | satishlabs/nodejs-hello-lab | /myserver.js | UTF-8 | 717 | 2.796875 | 3 | [] | no_license | const express = require("express"); //use to build the rest API
//const mongoose = require("mongoose"); //connect with database mongodb
const dotenv = require("dotenv"); //load the env file
//Load the enviornment from .env.jlc file
dotenv.config({path: ".env.jlc"});
const app = express(); //creating express object
c... | true |
e0519b2293cffdded8155b563b3e52a0604acc32 | JavaScript | blackice002/liri-node-app | /liri.js | UTF-8 | 5,215 | 2.890625 | 3 | [] | no_license | // file configuration
require("dotenv").config();
var fs = require("fs");
var keys = require("./keys.js");
var request = require('request');
var Spotify = require('node-spotify-api');
var moment = require('moment');
var spotify = new Spotify(keys.spotify);
var userInput = process.argv[2];
var inputValue = process.a... | true |
0b01a4a362a9d783919e1a4e3702cc5c66b482bd | JavaScript | nikkyjain/nikkyjain.github.io | /others/oldSites/ExamPaperCreator/js/myFunctions.js | UTF-8 | 18,935 | 2.609375 | 3 | [
"MIT"
] | permissive | var relativePath="./";
var homePage="index.html";
var qs = (function(a) {
if (a == "") return {};
var b = {};
for (var i = 0; i < a.length; ++i)
{
var p=a[i].split('=', 2);
if (p.length == 1)
b[p[0]] = "";
else
b[p[0]] = decodeURIComponent(p[1].replace(/\... | true |
fe4b6485deeb2999997d3dbe106335dd27001f79 | JavaScript | Peatix/node-colorsync-ola | /nervous-timer.js | UTF-8 | 5,004 | 3.25 | 3 | [] | no_license | ( function () {
/*
nervousTimer.js
nervousTimer.js provides alternative setInterval() / setTimeout() implementation that runs based on real world's time.
Web browser's native setInterval funciton is running based on task queue, and if browser's timer thread was asleep, program can't know how much difference ... | true |
39502a850404f97b09f837b36cc2e1585478b74a | JavaScript | Benzeq/bootcamp-ex | /7Exercise 7_JavaScript Basics/3Special_for_loop/3special_for_loop.js | UTF-8 | 389 | 4.34375 | 4 | [] | no_license | for (var x = 3; x < 10; x++) {
x = x + 3;
}
console.log("x = " + x);
/*
1. x starting from 3, and stops at 12 (exclude 12!), so the output presumed to
be 11+3 == 14. BUT NO! the result is 15. WHY?
2. I changed the 12 in 10 (exclude 10!). Presumed it will be 9 + 3 = 12 or like it behaved
before and w... | true |
f279bb4bbc4332b40d88c5892667300e32716e4a | JavaScript | JoeKarlsson/data-structures | /bitwise/bitwise-basics.js | UTF-8 | 1,135 | 3.3125 | 3 | [
"MIT"
] | permissive | const bitwiseAND = (a, b) => {
return (a & b).toString(2);
};
const bitwiseOR = (a, b) => {
return (a | b).toString(2);
};
const bitwiseXOR = (a, b) => {
return (a ^ b).toString(2);
};
const bitwiseNOT = (a) => {
return (~a >>> 0).toString(2);
};
const bitwiseLeftShift = (a, bits) => {
return (a << bits).... | true |
123c189d1d3b98781dd5c5dc2784f366f40a2f1c | JavaScript | arya46/artistSearch | /artist.js | UTF-8 | 1,706 | 2.734375 | 3 | [] | no_license | var EventEmitter = require("events").EventEmitter;
var https = require("https");
var http = require("http");
var util = require("util");
function Artist(artist) {
EventEmitter.call(this);
artistEmitter = this;
//Connect to the API URL (http://api.musicgraph.com/api/v2/artist/search?api_key=${... | true |
f5f63f4d7fde110985a61b69249597b8c276e732 | JavaScript | HoneyJt/store_demo | /learnPro/app.js | UTF-8 | 1,613 | 2.625 | 3 | [] | no_license | //app.js
const api = require('./utils/request.js')
App({
navigateToLogin: false,
onLaunch: function () {
var that = this;
/**
* 获取网络状态
* 没有网络的状态下根据实际情况调整
*/
wx.getNetworkType({
success: function(res) {
const networkType = res.networkType
if(networkType === 'none'){... | true |
eb447580efac3f48525d38c878cb1f350ae08bff | JavaScript | Frehiwot29/Assignment_CS301 | /W1D2/mileage.js | UTF-8 | 355 | 2.96875 | 3 | [] | no_license | "use strict";
const prompt = require("prompt-sync")();
let beginingOdo = parseFloat(prompt("Enter the begining odometer: "));
let endingOdo = parseFloat(prompt("Enter the End odometer value: "));
let usedGas = parseFloat(prompt("Enter the gas by galon: "));
let mileagepergalon = (endingOdo - beginingOdo) / usedGas;
con... | true |
9160c732d201e585b405e5a512c88f1e71d7a213 | JavaScript | zcogley/javaScriptChapter3 | /beanCounting.js | UTF-8 | 227 | 3.359375 | 3 | [] | no_license | function countBs(str) {
return countChar(str, "B")
}
function countChar(str, char) {
var count = 0
for (counter = 0; counter < str.length; counter++)
if (str.charAt(counter) === char)
count++;
return count
}
| true |
03e76d9a2b629ac9699188c0a877a13809645a51 | JavaScript | 0XE4/0XE4.github.io | /startpages/OldSite/MyStartPage-0XE4/script.js | UTF-8 | 570 | 2.875 | 3 | [
"WTFPL"
] | permissive | var images = ['0001.png', '0002.png', '0003.png', '0004.png', '0005.png'];
$('body').css({'background-image': 'url(images/' + images[Math.floor(Math.random() * images.length)] + ')'});
var searchbox = document.getElementById('search');
//Uncomment line below to focus on serach on load
// $('#search').focus();
search... | true |
7f04667b36c82e2529e174b079ede469a91bce7a | JavaScript | magicbox12/magicbox12 | /oli.js | UTF-8 | 2,007 | 3.8125 | 4 | [] | no_license |
start()
async function start(){
//await one()
//await two()
//await three()
//await four()
//await five()
//await six()
await seven()
}
function one(){
return new Promise(async (resolve) => {
const maxvalue = 1000
const three = 3
const five = 5
let sum = 0
for(va... | true |
6786c535e0a9c2b51509c61e6c9743d0cf9f8539 | JavaScript | RatheeshMKpb/Weather_application-Using-Jquery | /script.js | UTF-8 | 4,178 | 2.96875 | 3 | [] | no_license | var unit = "C";
$(".checkbox").prop("checked", "checked");
function getLocation() {
$.get("https://ipapi.co/json", function(data) {
getWeather(data.city);
});
}
function getWeather(city) {
var $api = "http://api.openweathermap.org/data/2.5/weather?q="+city+"&units=metric&appid=d490d... | true |
cad69add3ea6d6bc3065f0428acc6e8e5bf6719c | JavaScript | AttackOnMorty/leetcode | /array/169.majority-element.js | UTF-8 | 409 | 3.53125 | 4 | [] | no_license | /*
* @lc app=leetcode id=169 lang=javascript
*
* [169] Majority Element
*/
// @lc code=start
/**
* @param {number[]} nums
* @return {number}
*/
// O(n) / O(1)
function majorityElement(nums) {
let candidate = null;
let count = 0;
for (const num of nums) {
if (count === 0) {
candidate = num;
... | true |
1b3329c388e313ff54c0497f456608030fb5f0b7 | JavaScript | kyleaisho/JSAlgorithms | /LeetCode/merge_k_sorted_lists.js | UTF-8 | 1,446 | 3.765625 | 4 | [
"MIT"
] | permissive | /**
* Definition for singly-linked list.
* function ListNode(val) {
* this.val = val;
* this.next = null;
* }
*/
/**
* @param {ListNode[]} lists
* @return {ListNode}
*/
const insertNode = (node, root, back) => {
if (!root) {
root = node;
back = node;
} else {
back.next ... | true |
bb29dc04ae94ea96cf84ce20466ea3ccbf094ed7 | JavaScript | Jeffrey-FLS/js-basics-arithmetic-lab-nyc-clarke-web-100719 | /index.js | UTF-8 | 179 | 2.9375 | 3 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | // Write your code here
"use strict";
let var1 = 31,
var2 = 2;
let multiply = var1 * var2;
let random = Math.random();
let mod = 9 % 5;
let max = Math.max(1, 2, 3, 4, 20);
| true |
2dbc7ce063e84a4970ce69e8f54e891174059da8 | JavaScript | Jevan5/plantee | /back-end/environment.js | UTF-8 | 1,188 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | class Environment {
static modeEnum = {
DEV: 'dev',
PROD: 'prod',
TEST: 'test'
};
constructor(mode, apiPort, apiUrl, mongoPort, mongoUrl) {
this.mode = mode;
this.api = {
port: apiPort,
url: apiUrl
};
this.mongo = {
... | true |
b3487b5cb6c0aac82099b5ff495a593b2eebdec7 | JavaScript | Andy-Pacheco/codehouse_CarlosYa-ez | /Notepad/Proyectos/Herencia/js/classes/Persona.js | UTF-8 | 218 | 3.328125 | 3 | [] | no_license | function Persona(nombre){
this.nombre = nombre;
Persona.prototype.caminar = function(){
console.log("Estoy caminando");
}
Persona.prototype.saludar = function(){
console.log("Hola soy " + this.nombre);
}
} | true |
a9bd771f268f7986b05637eb33da231478e89e00 | JavaScript | Marwa-GH/CheckpointDOM | /DOM-JS.js | UTF-8 | 1,465 | 3.4375 | 3 | [] | no_license | var icon = document.getElementsByClassName("fa-heart");
function changeColor(obj) {
if(obj.style.color == "" || obj.style.color == "black" ){
obj.style.color = "red";
}
else{
obj.style.color = "black";
}
}
function eliminate(object) {
va... | true |
94bfb816f936b0172cf062ac1b7f5cdc999013b1 | JavaScript | adam-osu/340-project | /public/javascript/modules/customerSearcher.js | UTF-8 | 2,176 | 3.171875 | 3 | [] | no_license | class CustomerSearcher {
constructor({ addButtonHandler }) {
this.addButtonHandler = addButtonHandler;
}
search() {
const searchTerms = document
.getElementById("customer-search")
.value.split(" ");
let url;
if (searchTerms.length === 0) {
return;
} else if (searchTerms.le... | true |
90f85003888b17101c0bc18cfaf528a5e49b86c3 | JavaScript | emmanuel-jan/EarnSmartClone | /js/validation.js | UTF-8 | 11,808 | 2.890625 | 3 | [] | no_license | $(document).ready(function(){
$("#register_form").on("submit",function(){
var status = false;
var fullname = $("#fullname");
var name = $("#username");
var email = $("#email");
var password = $("#password");
var confirmPassword = $("#confirmpassword");
var c... | true |
05ff4c43da1c91e2f93411446172ddb852109f01 | JavaScript | pratiic/movion | /src/redux/reviews/reviews.reducer.js | UTF-8 | 569 | 2.5625 | 3 | [] | no_license | import { reviewsActionTypes } from "./reviews.types";
const INITIAL_STATE = {
editing: false,
editedReviewID: "",
editedReviewText: "",
};
export const reviewsReducer = (state = INITIAL_STATE, action) => {
switch (action.type) {
case reviewsActionTypes.SET_EDITING:
return { ...state, editing: action.payload ... | true |
741f11dab76d15018636c40ccc06c9ccb12a35b2 | JavaScript | arpitlkce/Product-Comparator | /main.js | UTF-8 | 3,492 | 2.859375 | 3 | [
"MIT"
] | permissive | //OOJS class definition
product = function(){}
product.prototype = {
compArray : [],
type:"All",
init:function(){
//CLICK Events for Tab Switch
//for every tab switch will call Restful API through AJAX by passing selected cars and type of tab
$("#all").click(function(){
prod.type="All";
$('#... | true |
051242f3d53ee2fe35f4d53f1359ff1451fc7b91 | JavaScript | metodiev/JavaScript | /Conditional Statements_lab/godzillaVsKong.js | UTF-8 | 812 | 3.15625 | 3 | [] | no_license | function GodzillaVsKong(input){
let budget = Number(input.shift());
let numberOfStatists = Number(input.shift());
let dressPriceForOnePerson = Number(input.shift());
let costs = 0;
let decorSum = budget * 0.10;
let dressSum = numberOfStatists * dressPriceForOnePerson;
if (numberOf... | true |
4eec4dbf3cf633d8359f636a1433bacddaae81b8 | JavaScript | AVRH/birdwatch | /src/components/store.js | UTF-8 | 704 | 2.96875 | 3 | [] | no_license | const storage = window.localStorage
class Store {
/**
* Creates instance of store on the top of localStorage
* @param storeId id to store items inside localStorage
*
*/
constructor(storeId){
this.storeId = storeId
const initialState = this.get()
if (!initialState){
... | true |
97eeac8c2550805c55801854d04f5045dce516ff | JavaScript | luotaoyeah/learning-javascript | /projects/2020/src/book/javascript-the-definitive-guide.6e/10/defining-regular-expressions/repetition/03.js | UTF-8 | 219 | 3.171875 | 3 | [] | no_license | (function () {
/*
* `{n,}` 表示模式出现的次数为: n <= 次数
*/
const str = '1 22 333 4444';
console.assert(JSON.stringify(str.match(/\d{2,}/g)) === JSON.stringify(['22', '333', '4444']));
})();
| true |
1c32af22cc2ae526ad0021b00d1cd082675a7726 | JavaScript | emory-libraries/Pattern-Library | /Plopfile.js | UTF-8 | 9,211 | 2.515625 | 3 | [] | no_license | module.exports = (plop) => {
// Load dependencies.
const path = require('path');
const fs = require('fs-extra');
const _ = require('lodash');
const utils = require('./scripts/utils.js');
const plconfig = require('./patternlab-config.json');
const spawn = require('child_process').spawn;
const moment = r... | true |
ea833f1e9a03c359210dc0d0586c877698538d44 | JavaScript | bjoerntorben/simple-mysql-wrapper | /lib/runQuery.js | UTF-8 | 489 | 2.515625 | 3 | [
"MIT"
] | permissive | 'use strict';
const runQuery = function(sql, callback = function() {}) {
if(!sql) return callback({message: 'No sql query string given'});
if(typeof sql === "function") return sql({message: 'No sql query string given'});
if(!this._connection) return callback({message: 'No active connection, run connect fir... | true |
9aa504e4980f0bdf27feaa33c7926ff13cedaa0b | JavaScript | NicAChan/CodeCore-Homework | /box_it_script/box_it_script.js | UTF-8 | 1,408 | 3.640625 | 4 | [] | no_license | const args = process.argv.slice(2);
function drawLine(num){
let line = "";
while(num>0){
line += '━';
num -= 1;
}
return line;
}
function drawTopBorder(num){
return("┏" + drawLine(num) + "┓");
}
function drawMiddleBorder(num){
return('┣' + drawLine(num) + '┫');
}
function dra... | true |
e11222965af2f7696de1fbbdb260f561fd8c63d3 | JavaScript | c-ehrlich/dockside-apps | /scripts/notes.js | UTF-8 | 3,381 | 2.875 | 3 | [] | no_license | "use strict";
// TODO
// use attrs instead of clunky class names to set properties
var notesAppState = {
openWindow: "main"
};
// `DOMContentLoaded` may fire before the script has a chance to run, so check before adding a listener
document.readyState === 'loading' ? document.addEventListener("DOMContentLoaded", ini... | true |
d1a5e00fc61832dfba83a598477bcb6bcad8afa7 | JavaScript | George-Payne/react-gnome | /src/reconciler/TextNode.js | UTF-8 | 335 | 2.734375 | 3 | [] | no_license | // @flow
class TextNode {
value: string;
_parent: *;
constructor(value: string) {
this.value = value;
}
setParent(parent: *) {
this._parent = parent;
}
update(newValue: string) {
this.value = newValue;
this._parent.updateText(newValue);
}
}
export def... | true |
e916581b5495c33e34a5a8107b8f1ed574c900a1 | JavaScript | TOTOleHero/RRULE | /JavaScript/Common/Menu.js | UTF-8 | 3,960 | 2.71875 | 3 | [] | no_license | /* Add dropdowns */
DocumentLoad.AddCallback(function()
{
if (document.getElementById("main_menu") == null)
return;
var items = document.querySelectorAll("#main_menu ul li");
for (var i = 0; i < items.length; i++)
{
var hasChild = items[i].querySelector("ul");
if(hasChild)
{
items[i... | true |
091e02a4f0908adfa3364c8b7dbe7dfa7add4803 | JavaScript | 7imon7ays/browser-games | /simpletower.js | UTF-8 | 2,141 | 3.15625 | 3 | [] | no_license | var Game = (function() {
var Hanoi = function(num){
var that = this
that.towers = [[], [], []];
var filler = function(num) {
_.times(num, function(index) {
that.towers[0].push(num - index);
});
};
that.error = null;
filler(num);
};
Hanoi.prototype.move = function(origin, target) {
var... | true |
23fac11461f15657495fbab8410434004ad65c11 | JavaScript | Zakkski/design-d3-training | /d3-series/materials/Week 2/Assignment/cars.js | UTF-8 | 1,568 | 3.53125 | 4 | [
"MIT"
] | permissive | loadData = (callback) => {
const xml = new XMLHttpRequest('application/json');
xml.open('GET', 'cars.json', true);
xml.onreadystatechange = () => {
if (xml.readyState == 4 && xml.status == '200') {
callback(xml.responseText);
}
};
xml.send(null);
};
getCommonMakes = (cars) => {
const makes = ... | true |
c8790ce7402c44c0fde1319785abfdc786b21a87 | JavaScript | dcalds/github-api-app | /src/pages/Main/index.js | UTF-8 | 8,197 | 2.515625 | 3 | [
"MIT"
] | permissive | import React, { useState, useEffect, useRef } from 'react';
import {
View, Text, Button, TextInput, StyleSheet, TouchableOpacity, Image, Animated, Keyboard
} from 'react-native';
export default function Main({ navigation }) {
const [username, setUsername] = useState(null)
const [userData, setUserData] = useSta... | true |
157bf43dc9128b06469000c3914f4498622db75a | JavaScript | Fancy827983452/GolangTest | /go/src/GolangTest/src/view/static/js/hospitalViewAllDoctors.js | UTF-8 | 8,248 | 2.75 | 3 | [] | no_license | //由于使用confirm弹窗确实用户操作,点击取消时会有页面跳转(?)
//onbeforeunload在即将离开当前页面(刷新或关闭)时触发
//由用户进行判断是否跳转页面
// window.onbeforeunload=function(){
// return '确定要离开吗?'
// }
function loading() {
var jsonTxt=document.getElementById("formValue").innerText;
if(jsonTxt) {
var obj = JSON.parse(jsonTxt);
document.getEl... | true |
4af7f1456b543ac6463baf89c9bce5fecd26836f | JavaScript | jrbert/torneiomagico | /Electra.js | UTF-8 | 1,150 | 2.875 | 3 | [] | no_license | var delay=15000;
setTimeout(function(){
while (inicio != 1 || inicio != 2 || inicio != 3){
var inicio = prompt ("Digite o número de acordo com a opção desejada:")
if (inicio == 1) {
alert ("Não tem nada atrás. Apenas um muro. Você morre queimada pela lava que sobe na sala.")
window.location.replac... | true |
0f8c2d398f3b68cdd82c3dd05bfdad0305095e31 | JavaScript | manorius/unityexperiment | /Assets/Sources/Twist.js | UTF-8 | 1,951 | 2.90625 | 3 | [
"MIT"
] | permissive | // This script is placed in public domain. The author takes no responsibility for any possible harm.
// twist a mesh by this amount
var twist = 1.0;
var inputSensitivity = 1.5;
private var baseVertices : Vector3[];
private var baseNormals : Vector3[];
function Update ()
{
var mesh : Mesh = GetComponent(MeshFilter).... | true |
869d3f6a52db68260ede9bdd6fb818ea6c4c9710 | JavaScript | shinsaku417/toyproblems | /spiral/spiral.js | UTF-8 | 690 | 3.515625 | 4 | [] | no_license | // given 2D array, traverse it spirally
var spiral = function(arr) {
var result = [];
var minHor = 0;
var maxHor = arr[0].length - 1;
var minVer = 0;
var maxVer = arr.length -1;
while (minHor <= maxHor && minVer <= maxVer) {
for (var i = minHor; i <= maxHor; i++) {
result.push(arr[minVer][i]);
... | true |
17f966d55f00c079b246242b63c20bb14d624cc2 | JavaScript | dmitrygalperin/ip_location_logger | /public/js/locate.js | UTF-8 | 2,307 | 3.015625 | 3 | [] | no_license | var socket = socketAddress;
var map;
var markerPosition;
var geoLocationSuccess = true;
function getLocation() {
//if geolocation is supported, try geolocation
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition, getLocationAlternate);
} else {
//if ... | true |
c7219bed68165a805b999ce73fd8adaf68b44f5c | JavaScript | rohitlohia47/Movie-Ticekt-Booking-App | /script.js | UTF-8 | 2,157 | 3.578125 | 4 | [] | no_license | const container = document.querySelector(".container")
const movieSelect = document.getElementById('movie')
const seats = document.querySelectorAll(".row .seat:not(.occupied)")
const count = document.getElementById('count')
const total = document.getElementById('total')
populateUI();
let ticketprice = movieSelect.val... | true |
f1068e3ce5574edf7cc5eb0a227cd9ee08867688 | JavaScript | kbqncf/ktouch | /ktouch.js | UTF-8 | 4,026 | 2.546875 | 3 | [] | no_license | /**
@version 1.0.0
@author gangli
@deprecated 移动端触摸事件库
*/
(function () {
"use strict";
var util = {
$: function (selector) {
return document.querySelector(selector);
},
getEventInfo: function (e) {
var _e = {};
_e.pageX = e.changedTouches[0].pageX;... | true |
033857289fbef9a9e2557784b56cd5137c1f773f | JavaScript | ayumitanaka13/interview-practice | /hamburger-menu-2/index.js | UTF-8 | 239 | 2.9375 | 3 | [] | no_license | const menu = document.querySelector("#menu");
const ul = document.querySelector("ul");
let isOpen = false;
menu.addEventListener("click", () => {
isOpen ? ul.classList.remove("show") : ul.classList.add("show");
isOpen = !isOpen;
});
| true |
6aca151519cff65aa67c71564678b60f4ce31013 | JavaScript | lmammino/streams-workshop | /04-transform-streams/stream-copy-gzip.js | UTF-8 | 986 | 2.609375 | 3 | [
"MIT"
] | permissive | import {
createReadStream,
createWriteStream
} from 'fs'
import { createGzip } from 'zlib'
const [, , src, dest] = process.argv
const srcStream = createReadStream(src)
const gzipStream = createGzip()
const destStream = createWriteStream(dest)
srcStream.on('data', data => {
const canContinue = gzipStream.write(d... | true |
75aded0055177a0958d5fda0f49cba2e6f927b11 | JavaScript | rikusarlin/fullstack | /osa5/bloglist-frontend/src/App.js | UTF-8 | 4,928 | 2.5625 | 3 | [] | no_license | import React, {useState, useEffect} from 'react';
import blogsService from './services/blogs'
import loginService from './services/login'
import './App.css';
import Blogs from './components/Blogs'
import Notification from './components/Notification'
import Togglable from './components/Togglable'
import Error from './co... | true |
d747a34fd16f3c95cd546b602f3b61fb29b3af9c | JavaScript | Natassya/questions-database | /backend/models/question.js | UTF-8 | 2,292 | 2.515625 | 3 | [] | no_license | // import { Subquestion } from './subquestion.model';
// import { Alternative } from './alternative.model';
// import { Statement } from './statement.model';
// import { Tag } from './tags/tag.model'
//
// export class Question {
// public type: string;
// public description: string;
// public answer: string;
// ... | true |
47bdd9be3fb655f5878a27c5d0db892e78a592ce | JavaScript | osmanatam/we452366 | /20190914/23.express-source/4.express中的中间件/1.server.js | UTF-8 | 833 | 2.703125 | 3 | [
"MIT"
] | permissive | const express = require('./express');
let app = express();
// cookie path 只要路径开头匹配
// 中间件的特点 可以封装一些公共逻辑 ,扩展req,res
// 决定是否向下执行
// 错误处理: 只要有错误 就在next中传递错误
app.use(function(req,res,next){
console.log('middle1');
next(); // router中的layer中的next
});
app.use('/u',function(req,res,next){
console.log('middle2')... | true |
1d4d2789425f4e66737c5167d3240c9ad393bc73 | JavaScript | MyScienceWork/PolarisOS | /front/common/utils/utils.js | UTF-8 | 6,990 | 2.8125 | 3 | [
"MIT"
] | permissive | // @flow
const _ = require('lodash');
_.mixin({
mergeByKey(arr1, arr2, key) {
const criteria = {};
criteria[key] = null;
const newArray = JSON.parse(JSON.stringify(arr1));
return _.map(newArray, (item) => {
criteria[key] = item[key];
return _.merge(item, _.fi... | true |
ebf3e5a4bd82c3ad018e8b371db80454727d5cf8 | JavaScript | whos-bhdn/HomeWork12-JS- | /Task#1/index.js | UTF-8 | 1,362 | 3.484375 | 3 | [] | no_license | // Завдання 1
// Необхідно реалізувати наступний функціонал як на відео color,
// а саме:
// • при першому наведенні мишки на блок
// колір фону має ставати червоний
// • при відведенні мишки блок має
// ставати знову фіолетовий
// • при другому наведенні – блок стає жовтим
// • при третьому – зеленим
// • при насту... | true |
d3e3fe3efebafcb0a860d258c611b2d8e55f7f55 | JavaScript | KIRANSHANKARK/grocerychallenge | /grocery.js | UTF-8 | 797 | 2.671875 | 3 | [] | no_license |
function ajax(){
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange= function()
{
if(this.readyState==4&&this.status==200){
var x;
x=JSON.parse(this.responseText);
var output = x.grocery;
var htmlc="";
var display = document.getElementById("da1");
for(i=0;i<output.length;i++){
var cont=outp... | true |
d0897469afd370dab84d7c5362ecab7413ffb773 | JavaScript | maarsej/lighthouse-js-fundamentals | /kata2.js | UTF-8 | 584 | 3.75 | 4 | [] | no_license | var conditionalSum = function(values, condition) {
var total = 0;
if (condition === "even"){
for (i=0;i<values.length; i++){
if (values[i]%2=== 0){
total = total + values[i];
}
}
}
if (condition === "odd"){
for (i=0;i<values.length; i++){
if (values[i]%2=== 1){
total ... | true |
0418fdf506802cd76b16d12b0e4ebc17ca05c0e6 | JavaScript | dmcblue/faded | /js/Lib/Player.js | UTF-8 | 2,376 | 2.90625 | 3 | [] | no_license | var Player =
function(args){
if(args.placementRadius === undefined){
args.placementRadius = Player.PLACEMENT_RADIUS;
}
if(args.speedFactor === undefined){args.speedFactor = Player.SPEED_FACTOR;}
if(args.spriteCounter === undefined){args.spriteCounter = Player.SPRITE_COUNTER;}
if(args.spriteClasses === un... | true |
5f20e53a2c1299b313a7d1515165e43157942a05 | JavaScript | jeremyjpark/javascript-exercises | /arraySumr.js | UTF-8 | 281 | 3.78125 | 4 | [] | no_license | var sumRecursive = function(array) {
if (array.length == 0) {
return 0;
} else if (array.length == 1) {
return array[0];
} else {
return array[0] + sumRecursive(array.slice(1, array.length));
}
}
console.log(sumRecursive([1, 2, 3, 4, 5]));
| true |
46c8f8347ce93b0f291bfdf8254df7e2b26e149e | JavaScript | shaquito25/Portfolio | /landing-project/public/form-validation/code.js | UTF-8 | 491 | 3.484375 | 3 | [] | no_license | const nombre = document.getElementById("fname")
const form = document.getElementById("form1")
const parrafo = document.getElementById("warnings")
form.addEventListener("submit", e => {
let warnings = ""
let entrar = false
parrafo.innerHTML = ""
if (nombre.value.length < 6) {
warnings += `E... | true |
a78697acc046f336e293941b770fe90a222f077e | JavaScript | codyseibert/zetajs | /examples/belong.js | UTF-8 | 416 | 3.09375 | 3 | [
"MIT"
] | permissive |
// function getIndexToIns(arr, num) {
// arr.sort((function(a, b) {
// return a - b;
// }));
// for (var i = 0; i < arr.length; i++) {
// if (arr[i] >= num) return i;
// }
// return arr.length;
// }
// getIndexToIns([5, 3, 20, 3], 5);
let Z = require('../index');
Z([5, 3, 20, 3])
.scope(n =>... | true |
74b7ea034a0aafa0321de2232388dc12404fc620 | JavaScript | ffarenn/goit-js-hw-07 | /js/task-01.js | UTF-8 | 358 | 2.875 | 3 | [] | no_license | const navEl = document.querySelector('#categories')
console.log(navEl)
console.dir(document.querySelector('.item'));
const navItem = document.querySelectorAll(".item > h2").forEach(item =>
console.log(`Категория: ${item.textContent}, Количество элементов вкатегории: ${item.nextElementSibling.children.length}`))
| true |
5190be459e9ed04f751572f91d117ab394e198f7 | JavaScript | StipeG/Mastrinka | /Mastrinka/www/lib/Custom/Custom.js | UTF-8 | 2,690 | 2.640625 | 3 | [] | no_license | function Manifestations()
{
this.id = -1;
this.name = "";
}
function Tables()
{
this.id = -1;
this.name = "";
this.manifestation = new Manifestations();
}
function Samples()
{
this.id = -1;
this.name = "";
this.table = new Tables();
}
function CreateFromManifestItemsFromServer(data)
{
... | true |
791bced03b6e087ceb189669a514f6cda06f7bc9 | JavaScript | mold/Elbil | /project elvizp/assets/init.js | UTF-8 | 1,604 | 2.796875 | 3 | [] | no_license | /*
Vehicle information.
*/
var vehicle = {
cd:0.29,
cr:0.012,
area:2.7435,
mass:1521
};
evenergy.config(vehicle);
/*
Resets visualization.
*/
function reset(){
if(linechart === undefined)
return;
else
linechart.reset();
}
/*
Updates the route data used in the visualization
*/
function ... | true |
5d3770bd699b790b4deafef53f1f0c08fb5bf4d9 | JavaScript | MinakshiMittal/my-personal-quiz | /quiz.js | UTF-8 | 2,018 | 3.328125 | 3 | [] | no_license | const chalk = require('chalk');
var readlineSync = require('readline-sync');
console.log(chalk.cyanBright.bold("LET'S PLAY A GAME :)"));
console.log(chalk.blueBright.bold("FEW QUESTIONS WILL APPEAR AND YOU'LL HAVE TO ANSWER IT.."));
console.log(chalk.blueBright.bold("PERSON SCORING THE HIGHEST KNOWS") + chalk.whiteBri... | true |
ca834892454e39ed20e1171b51304c69c9b90584 | JavaScript | ruslanold/react-redux-hw5 | /api-for-instagram/server.js | UTF-8 | 2,236 | 2.59375 | 3 | [] | no_license | const express = require('express');
const app = express(),
bodyParser = require("body-parser");
port = 3080;
const InstagramCli = require("./instagram")
app.use(bodyParser.json());
let client = new InstagramCli();
app.post('/api/login', async (req, res) => {
const { username, password } =... | true |
b2d7947b495a5fb77ff13ad985bfc8ccb2b849a9 | JavaScript | MocaccinoJ/Fundamentos-Basicos-js | /objetoClases2.js | UTF-8 | 1,385 | 3.859375 | 4 | [] | no_license | class Persona {
constructor(nombre, apellido, altura) {
this.nombre = nombre;
this.apellido = apellido;
this.altura = altura;
}
saludar(fn){
var {nombre, apellido} = this
console.log(`Hola, me llamo ${nombre} ${apellido}`)
if (fn) {
fn (nombre, apellido)
... | true |
e1722a766acb07b12b2989398c9a89f9b921501b | JavaScript | mostlyserious/ms-craft | /src/js/modules/toggle.js | UTF-8 | 4,319 | 3.015625 | 3 | [] | no_license | /**
* @param {NodeListOf<HTMLElement>} els - A collection of DOM elements.
*/
export default els => {
document.body.addEventListener('click', event => {
closeAll(els);
});
addEventListener('keydown', event => {
if (event.code === 'Escape') {
closeAll(els);
}
});
... | true |
a06e4e62b31313c6b906089b8c1ab45fec0561f6 | JavaScript | MAVG-Programmers/Arena | /public/js/platform.js | UTF-8 | 1,398 | 3.015625 | 3 | [] | no_license | console.log("platform init");
function Platform(options) {
if(options) {
this.spawn(options);
}
}
Platform.WIDTH = 32;
Platform.HEIGHT = 32;
Platform.platforms = [];
//from and to are objects with the following properties required: x, y
Platform.prototype.spawn = function(platform) {
platform.x +... | true |
e035a5d1dee914041f0d32c40346ae1339dec01a | JavaScript | ces1-2020-cm/estudiantes | /VPF/index.js | UTF-8 | 1,806 | 3.28125 | 3 | [] | no_license | <<<<<<< HEAD
function numerosImpares(){
for (i = 1; i <= 100; i += 2) {
console.log(i);
}
}
function numerosPares() {
let cont =0;
while (cont <= 100) {
if (cont % 2 == 0) {
console.log(cont);
}
cont++;
cont = cont + 1;
}
}
f... | true |