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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
a6c464405c589881f887708e8e7ea6024fd19bfe | JavaScript | HuongDang-Miley/foodies-go-frontend-old | /src/stores/actions/searchActionCreatorBackUp.js | UTF-8 | 3,259 | 2.515625 | 3 | [] | no_license | import Axios from './Axios.js'
import axios from 'axios'
import placeDetail from '../../data/placeDetail.json'
const key = process.env.GOOGLE_API_KEY
// import Axios from './Axios.js'
// import sushiPlaces from '../../data/sushiPlaces.json'
// import burgerPlace from '../../data/burgerPlace.json'
// const key = 'AIzaSy... | true |
b2da6d71ae6040da378958a0de50b28108ea896f | JavaScript | ItsOKayCZ/Web | /2016/Pong/JS/Ball.js | UTF-8 | 5,643 | 2.75 | 3 | [] | no_license | function Ball(pHeight){
this.radius = 15;
this.acc = 1.00000005;
this.scores = {
p1: 0,
p2: 0
};
this.vel = {
x: 3,
y: 3
};
this.parts = pHeight / 4;
this.part = {
first: 5,
second: 3
};
this.pos = {
x: c.width / 2,
... | true |
dc722eb5e8777befd40a50e3edd724c19154eb27 | JavaScript | lightning1993/calculator | /script/script.js | UTF-8 | 4,002 | 3.21875 | 3 | [] | no_license | //计算功能实现
var list = document.getElementById("list");
//计算显示屏
var sum = document.getElementById("sum");
//数字显示屏
var content = document.getElementById("content");
//获取数字
var nums = document.getElementsByClassName("num");
//获取计算符号
var signs = document.getElementsByClassName("sign");
var lis = list.children;
var calc = doc... | true |
59b8a894d7ef8ab57377e7b3ba136e79e85f98a6 | JavaScript | fg-yarullin/module_11 | /js/quicksort.js | UTF-8 | 1,968 | 3.9375 | 4 | [] | no_license | function swap(items, firstIndex, secondIndex){
const temp = items[firstIndex];
items[firstIndex] = items[secondIndex];
items[secondIndex] = temp;
}
// функция разделитель
function partition(items, left, right) {
var pivot = items[Math.floor((right + left) / 2)],
i = left,
j = right;
while ... | true |
a71817f3ec73e5beab8a2281dbe88d924cd3e617 | JavaScript | baderkha/roblox-game-api | /src/controller/TextController.js | UTF-8 | 1,955 | 2.71875 | 3 | [] | no_license | const { FileSystem } = require('../util/FileSystem');
const text2png = require('text2png');
/**
* Controller we can use to render text for custom fonts to roblox
* @author Ahmad Baderkhan
* @version 2021/05/08 v1
*/
class TextController {
static DEFAULT_FONT_EXTENSION = '.tff';
constructor() {}
/**
... | true |
81b3f41a11d24ef3584e2ec68dc377e5c53ee16e | JavaScript | kyleatmore/Brick-Break | /lib/laser.js | UTF-8 | 703 | 2.734375 | 3 | [] | no_license | import MovingObject from './moving_object';
class Laser extends MovingObject {
constructor(paddle, xPos, game, ctx) {
const options = {
"pos": [
xPos, paddle.yPos - 19
],
"vel": [0, -5],
"width": 5,
"height": 19,
"game": game,
};
super(options);
this.image ... | true |
ed2b4e8739a172b1bcc9223cff8c89378c0a5a02 | JavaScript | Kevin123-QA/QACinemas_Group_Project | /back-end/Routes/discussionboard.js | UTF-8 | 775 | 2.609375 | 3 | [] | no_license | "use strict";
// Setup
const ROUTER = require("express").Router();
const DISCUSSION_BOARD = require("../Models/discussionboard");
// Get Requests (200 is default HTTP status code)
ROUTER.get("/discussions/getAll", async(req, res, next) => {
try {
const POSTS = await DISCUSSION_BOARD.find();
... | true |
0d5838e44bd25fec5412c72ea014f36634f7d900 | JavaScript | eagle7410/node_news_cms | /server_employee/front/src/utils/validators.js | UTF-8 | 514 | 3.125 | 3 | [
"MIT"
] | permissive | /**
* Check is email
* @param {string} email
*
* @returns {boolean}
*/
const isEmail = (email) => /\S+@\S+\.\S+/.test(email);
/**
* Check date is today or future.
*
* @param {Date} date
*
* @returns {*}
*/
const isNowOrFuture = (date) => date.isFutureOrNowDay();
/**
* Check string length not more max.
*
*... | true |
e37e7f559c1b342061f4a414f6a3fcb1a8e00b66 | JavaScript | miguelalcala-github/full_stack_app_with_react_and_a_rest_api | /src/components/CourseDetail.js | UTF-8 | 4,814 | 2.640625 | 3 | [] | no_license | import React, { Component } from 'react';
import { Link } from 'react-router-dom';
import Data from '../Data'
import ReactMarkdown from 'react-markdown'
export default class CourseDetail extends Component {
state = {
course: {},
createdBy:{},
message: null
}
constructor() {
super();
this.dat... | true |
94348945c78bc10cc4d9dc942b51caa9ec2d1530 | JavaScript | MitanshiKshatriya/basic-CRUD-and-AUTH | /middleware/authenticate.js | UTF-8 | 583 | 2.53125 | 3 | [] | no_license | const jwt = require('jsonwebtoken')
const authenticate = (req,res,next) =>{
try{
//const token = req.headers.autherization.split(' ')[1]
//const token = req.headers.autherization
const token = req.header('Authorization').replace('Bearer ', '')
const decode = jwt.verify(token,'verySecretValue')
req.user = decode
n... | true |
b934b2d842f5f80be9eac00ef0e9e50448f719ba | JavaScript | yaconeill/marvel_catalog | /js/index.js | UTF-8 | 20,926 | 2.78125 | 3 | [
"MIT"
] | permissive | /**
* Object to save the voting data that will be printed in chart
* @param {String} type - comics|characters
* @param {String} name - comic|character name
* @param {Int} id - id from the item
* @param {Int} rate - amount of votes
*/
$(document).ready(function () {
RatingData = function (type, name, id, r... | true |
71ee1192d5ddf47e0f0548557c4795f595677ea9 | JavaScript | TakashiSasaki/MyAssert | /myassert-main.js | UTF-8 | 2,454 | 2.890625 | 3 | [] | no_license | if(typeof assert === "undefined") assert = require("assert");
assert.isInstanceOf = function(actual, expected) {
if(actual instanceof expected) return;
assert.fail(actual.constructor.name. expected.constructor.name, "", "instanceof");
}//assert.isInstanceOf
assert.isString = function(actual) {
if(typeof actual ... | true |
2a750755ed704d9d185432fe889a7d1d4d88ecb4 | JavaScript | cs-fullstack-2019-spring/javascript-mapthisobjects-cw-clyde5649 | /problem 1.js | UTF-8 | 189 | 2.828125 | 3 | [] | no_license |
let array ={"dog", "cat", "pig", "hamster"};
let pet={"PetNumer","petType"};{
var pet="dog" ;
var pet="cat";
var pet "hamster";
var pet=array.map(function(eachelement);
} | true |
2a826a5332210c6c5e04f25db1a7406308d0e441 | JavaScript | Alex1100/google-interview-prep | /general-interview-prep/javascript/shortestPathBFS.js | UTF-8 | 1,015 | 3.109375 | 3 | [] | no_license | const shortestPath = (adj, s, dest, v) => {
let pred = [];
let dist = [];
if (bfsTraversal(adj, s, dest, v, pred, dist) === false) {
return;
}
let path = [];
let crawl = dest;
path.push(crawl);
while(pred[crawl] !== -1) {
path.push(pred[crawl]);
crawl = pred[crawl];
}
return {
dis... | true |
9222baf24353da702067eb76a48275c703bdb1c9 | JavaScript | tsajanprajapati/test | /minesweeper/minesweeper.js | UTF-8 | 10,665 | 2.6875 | 3 | [
"MIT"
] | permissive | 'use strict';
$(function(){
var rows = 9;
var columns = 9;
var cellNUms = rows * columns;
var bombNums = 10;
var $divMain = $("#mines");
var bombCnt = 0;
var level = 1;
var $gameSet = $("#gameSet");
var cell = [];
var BombPosX = [];
var BombPosY = [];
var overlapChk = fal... | true |
697e045e5312eeb3f3a2877d5d24c5239963cad0 | JavaScript | doggvalera/carpooling | /src/main/resources/static/js/main.js | UTF-8 | 2,939 | 2.53125 | 3 | [] | no_license |
function showDiv() {
document.getElementById('carDescription').style.display = "block";
}
function hideDiv() {
document.getElementById('carDescription').style.display = 'none';
}
var state;
function setMode(_state){
if (state=="driver"){
showDiv();
$("#rideModeOption2").removeClass("active... | true |
6c67170d8ecb15f0bf428f173cfbcbbe0f7c524c | JavaScript | SouleymaneGit/Assignment-0 | /14-frequencyCounter/frequencyCounter.js | UTF-8 | 272 | 3.25 | 3 | [] | no_license | function frequencyCounter(word) {
var obj={};
for(let i=0; i<word.length; i++){
if(obj[word.charAt(i)] === undefined) obj[word.charAt(i)] = 1;
else obj[word.charAt(i)]++;
}
return obj;
}
// Do not edit this line;
module.exports = frequencyCounter; | true |
b9ca3680c4b7daa8c2375cc9e277c018c97a1203 | JavaScript | AlexNikitenko/hwnode | /2021-03-13-homework-mysql-insert-delete/public/javascripts/main.js | UTF-8 | 1,132 | 2.875 | 3 | [] | no_license | const formSelect = document.querySelector('#form-select');
const formInsert = document.querySelector('#form-insert');
const formDelete = document.querySelector('#form-delete');
const answEl = document.querySelector('.output');
const btnSubmit = document.querySelector('.btn-submit');
const thenData = (r) => {
const s... | true |
59ad71a1f43bbdec2966e085300e30f2a7366a97 | JavaScript | wuxiangwa/learn_log | /2018-07-16/index.js | UTF-8 | 1,906 | 3.640625 | 4 | [] | no_license | const clone = require('lodash/clone');
const cloneDeep = require('lodash/cloneDeep');
// const arr = [
// {id: 1, name: 'joker1'},
// {id: 2, name: 'joker2'},
// {id: 3, name: 'joker3'},
// {id: 4, name: 'joker4'}
// ];
//
// let item = _.find(arr, {id: 1});
// console.log(arr[0] === item);
//
// item = {
// ... | true |
31fc8ddc6996a768e7d39515108c5b5c48393a5e | JavaScript | nuntius-rex/JCCC-Fundamentals-of-JavaScript-Programming | /4_triangle.js | UTF-8 | 171 | 2.96875 | 3 | [] | no_license |
/*
Displays:
#
##
###
####
#####
######
#######
*/
var triangle="";
for(i=0; i<8; i++){
//do something
triangle+="#";
console.log(triangle);
}
| true |
375d96af5919362ecb5566af3fedc2f17257dc70 | JavaScript | bread-n-butter/eventify | /src/components/dashboard/GoogleMapsWithSearchBox.js | UTF-8 | 4,875 | 2.59375 | 3 | [] | no_license | /**
*
* Google Mini-Map on the right side of the Dashboard.
*
* Creates Map from react-google-maps library.
*
*/
import {default as React, Component, PropTypes} from 'react';
import {GoogleMapLoader, GoogleMap, Marker, InfoWindow, Circle} from 'react-google-maps';
export default class GoogleM... | true |
ae7eb64b07aaf971accf3a97d64a43bff9d279db | JavaScript | anandchandwani/Tutorial | /lectures-master/lectures-master/unit-11-authentication/applicant-portal/js/utils/code-window.jsx | UTF-8 | 679 | 2.734375 | 3 | [] | no_license | var React = require('react');
var Spacer = require('./spacer');
//need a component for this because preserving the indentation is bothersome. It is normally ignores becuase JSX ignores whitespace
var CodeWindow = React.createClass({
render: function() {
var codeLines = this.props.code.split('\n');
var codeN... | true |
5db3427f88c0ee00ff157a8dea26c650d6332a87 | JavaScript | LiPengZh/zuoye | /zuoye/面向对象/对复杂数据类型进行传值.js | UTF-8 | 220 | 3.03125 | 3 | [] | no_license | var a=[1,2,3],b={name:"adang",sex:"male",tel:"1234566"};
var c=[],d={};
for (var p in a) {
c[p]=a[p];
}
for (var p in b) {
d[p]=b[p];
}
c.push("4");
d.email="xxxxx";
alert(a);//1,2,3
alert(c);//1,2,3,4
alert(b.email);
| true |
f4b33ff2325a4693652f7a98ef50b9e571a08c76 | JavaScript | kule2018/JavaScript-test | /src/LinkedListTest/DoublyLinkedListTest.js | UTF-8 | 876 | 3.484375 | 3 | [] | no_license | import DoublyLinkedList from "./lib/DoublyLinkedList.ts";
const doublyLinkedList = new DoublyLinkedList();
// 双向链表尾部插入元素
doublyLinkedList.push(12);
doublyLinkedList.push(14);
doublyLinkedList.push(16);
// 双向链表任意位置插入元素
doublyLinkedList.insert(13,1);
doublyLinkedList.insert(11,0);
doublyLinkedList.insert(14,4)... | true |
5089fed014203413c84f1a3a63a19c11d562e3b4 | JavaScript | AntonLiBerg/StratSki | /SkiWeb/Util/GUtil.js | UTF-8 | 1,162 | 2.53125 | 3 | [] | no_license | const GUtil = {
runningFuncs: {},
toggleDisplayStandBy: function (selectorParam,msg) {
var selector;
msg ?? "Asking";
if (selectorParam.id)
selector = "#" + selectorParam.id;
else if (selectorParam.class)
selector = "." + selectorParam.class;
if (... | true |
eab2d247149986a88e1d64de18fff94026ac25f3 | JavaScript | Nodar32/routes | /goroda zadanie/script.js | UTF-8 | 5,173 | 3.015625 | 3 | [] | no_license | let body = document.querySelector("body");
// Массив, хранящий в себе города и их id
let cities = [
{ id: 1, name: "Tbilisi" },
{ id: 2, name: "Moskva" },
{ id: 3, name: "Kiev" },
{ id: 4, name: "Minsk" },
{ id: 5, name: "London" },
{ id: 6, name: "Paris" },
{ id: 7, name: "Pekin" },
{ id: 8... | true |
d878c8a1d049dca80829d28bc43a0195de439d26 | JavaScript | Rameezrk/100DevDailyChallenges-CodewarsChallenges | /Codewar Challenges/18CodeWars.js | UTF-8 | 297 | 3.171875 | 3 | [] | no_license | //challenge 1 - Lario and Muigi Pipe Problem - https://www.codewars.com/kata/56b29582461215098d00000f
//solution
function pipeFix(numbers){
let output = []
for (let i = numbers[0]; i < numbers[numbers.length-1] + 1; i++) {
output.push(i)
}
return output
}
//end
| true |
f11da626e0b41baeeb37a3f521c98891f38d51c8 | JavaScript | jackmercy/eastwest-microservice | /landing-page/src/utils/form.js | UTF-8 | 3,133 | 3.28125 | 3 | [] | no_license | const containLowerCharacter = (value) => new RegExp('^(?=.*[a-z])').test(value);
const containUpperCharacter = (value) => new RegExp('^(?=.*[A-Z])').test(value);
const containSpecialCharacter = (value) =>
new RegExp('^(?=.*[!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~])').test(value);
const containNumber = (value) => new RegEx... | true |
ade6a763086c0fe86b281055c29a88522aa29020 | JavaScript | saraspahi/Weather-app | /web-server/src/utils/forecast.js | UTF-8 | 621 | 2.578125 | 3 | [] | no_license | const request = require('postman-request')
const forecast = (latitude,longitude,callback)=>{
const uri = 'http://api.weatherstack.com/current?access_key=d6c0527fe72e0b42cc21c7c6c1b4a3df&query='+latitude+','+longitude
request({url: uri, json: true},(error,response,body)=>{
if(error){
callback('Connect... | true |
de60e0274c0f1d47eedfd509d99c7be04691146b | JavaScript | MikeBeaulieu/ujs-book-materials | /chapter2/singleObject.js | UTF-8 | 676 | 3.234375 | 3 | [
"MIT"
] | permissive | /*
* Read a JSON file with a single unnamed object,
* and display the values for each element.
*/
// include the Node.js file system module
var fs = require ("fs");
// read the content of the file synchronously
var data = fs.readFileSync ("singleObject.json");
// convert the text into a JSON object
var server = JS... | true |
5a067a168530ad0b650a5de06587322d34c82faa | JavaScript | douglasfrancis/e-commerce | /client/src/components/Register.js | UTF-8 | 1,983 | 2.53125 | 3 | [] | no_license | import React, { useState } from 'react';
import './Auth.css';
import { Link, Redirect } from 'react-router-dom';
import Axios from 'axios';
import ErrorMsg from './ErrorMsg';
export default function Register() {
const [firstName, setFirstName] = useState(null);
const [lastName, setLastName] = useState(nul... | true |
643e1687201df3f295c19cb9ca18f74f06c6d649 | JavaScript | levserk/v6-game-server | /lib/logger.js | UTF-8 | 1,184 | 2.78125 | 3 | [] | no_license | var Logger = {};
Logger.logLevel = 1;
Logger._log = function() {
var level = Array.prototype.pop.apply(arguments);
Array.prototype.unshift.call(arguments, getTime());
if (level <= this.logLevel) {
console.log.apply(console, arguments);
}
};
Logger.log = function() {
Array.prototype.unshi... | true |
2d088d90eace34b0a6a29835ebb968140d092ae6 | JavaScript | mcreng/CodeIT-2018 | /routes/air-traffic.js | UTF-8 | 4,134 | 2.625 | 3 | [] | no_license | import { Router } from "express";
import axios from "axios";
import moment from "moment";
import fs from "fs";
var router = Router();
function getTimeDiff(a, b) {
var d1 = moment(a, "HHmm");
var d2 = moment(b, "HHmm");
return d2.diff(d1, "seconds");
}
function addTime(a, diff) {
var d1 = moment(a... | true |
7a8b0031e1a509a0a190193a930fde69a913c3c8 | JavaScript | zjhzjhzjh123451/Online-restaurant-order-system | /0422final/static/js/menu.js | UTF-8 | 8,287 | 2.53125 | 3 | [] | no_license | function getMenu() {
$.ajax({
url: "/get_dish",
dataType : "json",
success: function(items) {
update_dish_list(items,1);
update_dish_type(items);
updating_floatingwindows(items);
// alert("hui");
}
});
}
function hiddeUI(... | true |
8610b6024764a711ba2a51674727d96e0af2ed95 | JavaScript | mbellifa/inctower | /js/incTower/spells.js | UTF-8 | 18,443 | 2.65625 | 3 | [] | no_license | define(['incTower/core', 'lib/knockout', 'lib/break_infinity', 'incTower/cursor', 'incTower/skills'], function (incTower, ko, Decimal, Cursor) {
'use strict';
function Spell(opts) {
this.fullName = opts.fullName;
this.manaCost = opts.manaCost;
this.trueManaCost = ko.pureComputed(function... | true |
b9818f7ea9b3234b6e2e1b67c5d5420f959d589c | JavaScript | littlegustv/oldsite | /games/libs/entity.js | UTF-8 | 8,965 | 2.828125 | 3 | [] | no_license | var Entity = {
velocity: {x: 0, y: 0},
offset: {x: 0, y: 0},
opacity: 1,
angle: 0,
alive: true,
z: 1,
points: 1,
// this makes it a CLASS variable, which is maybe not a good idea, since that means unless it is initialized, adding a behavior adds it to ALL objects ofthat class
behaviors: [],
init: function (x,... | true |
2255648c7a44bcc068b93760e0a535ef001f2d5f | JavaScript | sandisunandar99/bot-telegram-nodejs | /services/registers.js | UTF-8 | 690 | 2.515625 | 3 | [
"MIT"
] | permissive |
const { User } = require('../models')
const checkRegistered = async (from) => {
try {
const useId = from.id
const user = await User.findOne({ user_id: useId })
return { status: 'success', data: user }
} catch (error) {
return { status: 'error', error }
}
}
const registerUser = async (from, text... | true |
2f476744f23afc27e1920d726dea4e1b0e23bea7 | JavaScript | MysteriousK69/Air | /src/commands/withdraw.js | UTF-8 | 1,314 | 2.84375 | 3 | [
"MIT"
] | permissive | module.exports.run = async (bot, message, args) => {
let data = await bot.fetchUser(message.author.id);
if (args.join(' ') === 'all') {
data.coinsInWallet += data.coinsInBank;
await message.channel.send(`Withdrawed **${data.coinsInBank}** coins.`);
data.coinsInBank -= data.coinsInBank... | true |
0c342e67a7d2b94a06f06675acbf4f84c4435f63 | JavaScript | edwinarroyolopez/paintSoft | /web/js/producto_grupo.js | UTF-8 | 26,566 | 2.71875 | 3 | [] | no_license |
/* Form: Producto ----> Grupo: textbox --- lista
Uso de teclas de dirección para seleccionar items de la lista */
/* Globales ----> */
var pos_anterior = 0, pos_actual = 0;/* Define la posición en la que se encuentra foco */
var cantidad_items = 0; /* Cuantos items tiene la lista */
var... | true |
bf4f8181c33eb3b672f68c3e463097043389dd83 | JavaScript | orlando-arciniegas/fun_flags | /main.js | UTF-8 | 2,347 | 3.53125 | 4 | [] | no_license | let url = 'https://restcountries.eu/rest/v2/all'
async function waitResponse(url) {
let response = await fetch(url);
let data = await response.json();
function search() {
// Capturo los elementos del HTML //
let form = document.getElementById('form');
let field = document.getElemen... | true |
69c7e53b37e4818dc6a24fc0120f57865259e930 | JavaScript | nataliasabadysh/Flow-JavaScript | /examples/6.js | UTF-8 | 183 | 3.1875 | 3 | [] | no_license | /* @flow */
const getGreeting = (name: string = 'User'): string => {
return `Hello, ${name}!`;
};
getGreeting();
getGreeting(null);
getGreeting(undefined);
getGreeting('Kate');
| true |
4b06ee431068c478f72a17c14659927d33237d69 | JavaScript | crisstanza/modos-gregos-e-intervalos-musicais | /js/lib/$.js | UTF-8 | 2,721 | 2.96875 | 3 | [] | no_license | "use strict";
if (!$) var $ = {};
(function() {
$.forEach = function(elements, callback) {
if (elements) {
var length = elements.length;
for (var i = 0 ; i < length ; i++) {
var element = elements[i];
callback(element, i);
}
}
};
$.containsClass = function(element, classNameToSearch) {
if ... | true |
9b80e31e91345bebaed1cd64df05ee5cabf23b04 | JavaScript | johnshu666/vanilla-js-small-example. | /domcrashcourse/scripts/global.js | UTF-8 | 11,887 | 2.96875 | 3 | [] | no_license | function addEvent(func) {
let formerLoad = window.onload;
if (typeof formerLoad !== 'function') {
window.onload = func;
} else {
formerLoad();
func();
}
}
//hightLight Nav Li
function highLightNav() {
let links = document.querySelector('nav').getElementsByTagName('a')
... | true |
52a2e4fe41c76ce3ec666c5817e382db3298a568 | JavaScript | puentebravo/Javascript-Algorithms-and-Data-Structures | /binarySearch.js | UTF-8 | 1,422 | 4.5 | 4 | [] | no_license | // Binary search is a much faster form of search, rather than eliminating one element at a time, you can eliminate half of the remaining elements at a time. Binary search ONLY WORKS ON SORTED ARRAYS!
// DIVIDE AND CONQUER
// We split up the sorted array into two pieces, we pick a pivot point (usually in the middle) an... | true |
05a57b41e89f218b2e3bb2bcabdfbb9ec645f193 | JavaScript | defx/synergy | /test/helpers.js | UTF-8 | 1,138 | 2.859375 | 3 | [
"MIT"
] | permissive | import { applyAttribute } from "../src/helpers.js"
describe("applyAttribute", () => {
it("sets boolean true as empty string", () => {
let node = document.createElement("div")
applyAttribute(node, "foo", true)
assert.equal(node.getAttribute("foo"), "")
})
it("removes attribute when boolean false", (... | true |
78e69845c18e9ad04d198f7edb6ea01729c9d168 | JavaScript | Ronniegrg/Data-Strucctures-and-Algorithms-with-JavaScript | /searching-value2.js | UTF-8 | 316 | 3.4375 | 3 | [] | no_license | let names = [ "David","Mike", "Cynthia", "Raymond", "Clayton","Mike", "Jennifer" ];
let name = "Mike";
const firstPos = names.indexOf( name );
console.log( `First found ${ name } at position ${ firstPos }` );
const lastPos = names.lastIndexOf( name );
console.log( `Last found ${ name } at position ${ lastPos }` );
| true |
73ab18e1b28c91f39662d40eed81c3a44f72ee28 | JavaScript | surajthaqurie/Twilio-Node-React | /server/server.js | UTF-8 | 1,241 | 2.8125 | 3 | [] | no_license | // require('dotenv').config();
require('dotenv').config();
const express = require('express');
const cors = require('cors');
// const twilio = require('twilio');
// Twilio requirements -- Texting API
const accountSid = process.env.TWILIO_ACCOUNT_SID; // YOUR__ACCOUNT__SID
const authToken = process.env.TWILIO_T... | true |
3d6118f6bf314513ad5a26e069babeef1a1eaebd | JavaScript | emmasjelle/Eksamensprojekt | /Scripts/skal_slettes.js | UTF-8 | 23,301 | 3.390625 | 3 | [] | no_license | /*
FRA Navbar.js
*/
//Global scope define
//The purpose of this code is to show the appropriate navbar in regards to the users acces level in our system.
//The user is either a guest, practitioner or a client.
//The runs our createUserArray and createTimesArray to check if times(bookings) and users are already stored ... | true |
e24b8165b61ee4d6d91961ad860b06f5845c9302 | JavaScript | ayub96/Project-Room-Management-System | /src/main/resources/static/js/Room/ReqresUpdateRoomAPI.js | UTF-8 | 648 | 2.921875 | 3 | [] | no_license | 'use strict';
const updateFunction = () => {
fetch(`http://localhost:8081/room/update/` + document.querySelector(`#RoomId`).value, {
method: `PUT`,
body: JSON.stringify({
roomNumber: document.querySelector(`#updateRoomNumber`).value,
roomType: document.querySelector(`#upda... | true |
c92357615c3aa3510b8b8ca8c8e3c528f5f131fe | JavaScript | corner1990/dream | /src/zfnode/util.js | UTF-8 | 502 | 3.25 | 3 | [] | no_license | //utils是一个工具方法
//继承 只继承公有方法`
//util.inherits()
// 可以让console.log打印出对象的隐藏属性
//util.inspect()
// util.promisify()
let fs = require('fs')
let {promisify, inspect} = require('util')
let path = require('path')
let read = promisify(fs.readFile)
read(path.join(__dirname, './1.txt'), 'utf8')
.then(data => {
console.log... | true |
80e03491a931f89b8af9318ca88b1671046189ae | JavaScript | EmORz/JS_Advanced | /DOM/06. JS-Advanced-DOM-Manipulations-Exercise-Resources/01. Subtraction/subtract.js | UTF-8 | 281 | 3.15625 | 3 | [
"MIT"
] | permissive | function subtract() {
let firstNum = document.getElementById('firstNumber');
let secondNum = document.getElementById('secondNumber');
debugger
let result = document.getElementById('result');
result.textContent = Number(firstNum.value) - Number(secondNum.value);
} | true |
c0e6b56a632b71e36eb5346c48bd30eb4d113f08 | JavaScript | jdn7d/pause | /pause-frontend/src/models/meditation.js | UTF-8 | 1,210 | 3.140625 | 3 | [
"MIT"
] | permissive |
class Meditation {
constructor(data) {
// assign attributes
this.id = data.id
this.title = data.title
this.duration = data.duration
this.content = data.content
this.comments = data.comments.map(comData => new Comment(comData, this))
console.log(this.comments)
... | true |
2cfb1cfd602c8d915b143959db8ebdb4dc9f988b | JavaScript | hoon2hooni/code_practice | /my-jest/test.js | UTF-8 | 299 | 2.890625 | 3 | [] | no_license | function getUser(id) {
return {
id,
email: `user${id}@test.com`,
};
}
test('1 is 1', () => {
expect(getUser(1)).toEqual({
id: 1,
email: `user1@test.com`,
});
});
// test('return a user object', () => {
// expect(getUser(1)).toEqual({
// id: 1,
// email: `user1@test.com`,
// });
// ... | true |
ce27e3d216c78b4bb8c62c9282583953e1a4f7e2 | JavaScript | junnumohd/javascript | /junaidStudy/note2000.js | UTF-8 | 890 | 3.546875 | 4 | [] | no_license | // function amount2k(amount){
// var note2000 = 0;
// if(amount > 2000){
// var divide = amount/2000;
// return Math.floor(divide);
// }
// return 0
// }
// var b = amount2k("3000");
// console.log(b)
// function profitLoss(cp,sp){
// if(sp > cp){
// return "profit";
// }
// return "loss";
// }
// var c ... | true |
a062740cb75021db1bea058c9c5ef0277269d3ba | JavaScript | dDessy28/dDessy28.github.io | /public/js/cms.min.js | UTF-8 | 8,310 | 2.59375 | 3 | [] | no_license | var global = "left";
function apaAja(id) {
return document.getElementById(id);
}
function bold() {
var b = prompt("Masukan Teks");
if (b !== "" && b) {
apaAja("konten").value += "<b>" + b + "</b>";
}
}
function italic() {
var i = prompt("Masukan Teks");
if (i !== "" && i) {
apaAja("konten").value += "<i>"... | true |
483af0226ba491d2389d804f3af8cf66d7dd9288 | JavaScript | jasonfleming1/cwoolcott.github.io | /bootcamp_activities/activities11.3/00-ChrisAwesomeOmdbExample/omdbRequest.js | UTF-8 | 397 | 3.359375 | 3 | [
"MIT"
] | permissive | // Basic Node application for requesting data from the OMDB website
// Here we incorporate the "request" npm package
var Movie = require("./movie");
// Create a new TV object
var movie = new Movie();
var movieArgs = process.argv;
var movieTitle = '';
for (i=2; i<movieArgs.length; i++){
movieTitle += movieArgs[i] ... | true |
f7c5a4c0676b317b0c13bb863ce42ccaaa617798 | JavaScript | RockoDev/javascript-public-snippets | /text-to-numbers.js | UTF-8 | 432 | 3.859375 | 4 | [] | no_license | function textToNumbers(text) {
var r = text.toUpperCase();
[
['A','4'],
['B','8'],
['E','3'],
['G','6'],
['I','1'],
['O','0'],
['S','5'],
['T','7'],
['Z','2']
].forEach(function(c) {
r = r.replace(new RegExp(c[0], 'g'), c[1]);
... | true |
0760fccc7599b00cdd0fcb9fa29ea12bb01344df | JavaScript | layshidani/yeahCult | /public/js/api-wiki.js | UTF-8 | 1,682 | 2.609375 | 3 | [] | no_license | const PLACE_NAME = window.location.search.match(/\?placeName=(.*)/)[1];
const wikiUrl = 'https://pt.wikipedia.org/api/rest_v1/page/summary';
const wikiUrlEn = 'https://en.wikipedia.org/api/rest_v1/page/summary';
fetch(`${wikiUrl}/${PLACE_NAME}`)
.then(resp => resp.json())
.then(resp => {
const wikiTitle = resp... | true |
171ce1ccc11780c11492cacec69f4fba82fe2156 | JavaScript | PeckLiu2017/js-algorithm | /linkedList/linkedList.js | UTF-8 | 4,992 | 4.1875 | 4 | [] | no_license | // 这种数据结构有一个缺点:(在大多数语言中)数组的大小是固定的,
// 从数组的起点或中间插入 或移除项的成本很高,
// 因为需要移动元素(尽管我们已经学过的JavaScript的Array类方法可以帮 我们做这些事,但背后的情况同样是这样)
// 链表存储有序的元素集合,但不同于数组,链表中的元素在内存中并不是连续放置的。
// 每个元素由一个存储元素本身的节点和一个指向下一个元素的引用(也称指针或链接)组成。
// 相比于数组:链表增加或移除元素时不需要移动其他元素的相对位置。但若访问元素必须从头进行迭代
// LinkedList类也有存储列表项的数量的length属性(内部/私有变量)(行{2})
// 另一个重要的点... | true |
5ddaebcfbf3f9440bb38b591d6dbd8f51c591b5a | JavaScript | tonlopes21/CursoemvideoJavascript | /Aula 14/ambiente.js | UTF-8 | 194 | 3.140625 | 3 | [] | no_license | /*
var c = 1
while(c<=5){
console.log(c)
c++
}
*/
//-------------------------
/*for(var c = 1;c<=5;c++){
console.log(c)
}*/
for(c=1; c<= 10 ; c++){
console.log(`Passo${c}`)
}
| true |
45f1ed8940f3272424262101e5b7bceceb179b65 | JavaScript | travel206/praxis-academy | /novice/01 - 04/latihan/String Length.js | UTF-8 | 144 | 3.296875 | 3 | [] | no_license | const hello = 'Hello, World';
const helloLength = hello.length;
console.log (hello[0] = 'L');
console.log (hello[2]);
console.log (helloLength); | true |
719f95058be3fd866c285ec8438cdb8ab7549631 | JavaScript | wteophilo/js-alura | /basico/adiciona.js | UTF-8 | 727 | 2.71875 | 3 | [
"LicenseRef-scancode-public-domain"
] | permissive | var btAdd = document.querySelector('#adicionar-paciente');
btAdd.addEventListener('click',function(event){
event.preventDefault();
var inputNome = document.querySelector('#campo-nome');
var inputPeso = document.querySelector('#campo-peso');
var inputAltura = document.querySelector('#campo-altura');
var no... | true |
f62329b2f359aea45dcce247117ed67093ea6f75 | JavaScript | bobderrico80/gtcs | /slideshow.js | UTF-8 | 571 | 2.78125 | 3 | [] | no_license | $(document).ready(function() {
var slides = $('.slideshow-container').children();
var totalSlides = slides.length;
var current = 0;
var timerInterval = 5000;
var timer = setInterval(advanceSlides, timerInterval);
function advanceSlides() {
slides.eq(current).fadeOut()
.removeClass('active')
... | true |
9bb7f124665a9c059ac098de4df24f3358c209db | JavaScript | yunus-erol/vue-monster-game | /app.js | UTF-8 | 3,212 | 2.578125 | 3 | [] | no_license | new Vue({
el:'#app',
data : {
player_heal : 100,
monster_heal : 100,
game_is_on : false,
spacialCredits :3,
healthCredits :3,
logs :[]
},
methods:{
start_game : function (){
this.game_is_on =true
},
att... | true |
4e39bcf9386e3fe492bd577ea0c904bc0079f796 | JavaScript | peverbian/peverbian.github.io | /match3/js/combine.js | UTF-8 | 5,695 | 3.453125 | 3 | [] | no_license | //checks if the board is full.
function boardFull1(board) {
//console.log("checking for 1 spot");
var full = true;
for(var i = 0; i < board.length; i++) {
for(var j = 0; j < board[i].length; j++) {
if(board[i][j] == null) {
//console.log("found a spot");
return false;
}
}
}
//console... | true |
f07e4cb9d4974525344c0064d4fc04e0c824a994 | JavaScript | algorithm005-class01/algorithm005-class01 | /Week_07/G20190343020102/52.n皇后-ii.js | UTF-8 | 518 | 2.921875 | 3 | [] | no_license | /*
* @lc app=leetcode.cn id=52 lang=javascript
*
* [52] N皇后 II
*/
// @lc code=start
/**
* @param {number} n
* @return {number}
*/
var totalNQueens = function (n) {
let ans = 0
let dfs = (row, col, l, r) => {
if (row == n) {
ans++
return
}
let bit = ((1 << n) - 1) & (~(col | r | l))
... | true |
5b15470003df45ab6a9879dadfcb768a74ff4a05 | JavaScript | pzl/MQ2D | /src/Input/Keyboard.js | UTF-8 | 2,520 | 2.828125 | 3 | [] | no_license | var Keyboard = function(){
var key = {
arrow:{left: 37, up: 38, right: 39, down: 40 },
wasd: { left: 65, up: 87, right: 68, down: 83},
space: 32, 1: 49, 2: 50, 3:51, 4:52, 5:53, 6:54, 7:55
},
right=0,
left=0,
up=0,
down=0,
players,
API = {},
shootCB,
changeCB,
angleCB,
angle = 0,... | true |
3fa451e7781770b8f947c7804eb92e93bd5f0b45 | JavaScript | maheeri/js101 | /lesson_3/easy2/9CenterTitle.js | UTF-8 | 202 | 2.875 | 3 | [] | no_license | let WIDTH = 40;
let title = "Flintstone Family Members";
let spacesOnEachSide = Math.floor((WIDTH - title.length) / 2);
console.log(" ".repeat(spacesOnEachSide) + title + " ".repeat(spacesOnEachSide)); | true |
056d253ca2d0708269447c4c2d804afa3991e755 | JavaScript | JavierLuqueBernier/JavascriptTheory | /4.-CursodeAsincronismoJavascript/3.-Async/PeticionalaAPIconFetchyAsync.js | UTF-8 | 1,067 | 3.265625 | 3 | [] | no_license | const API = 'https://rickandmortyapi.com/api/character/';
const fetch = require('node-fetch');
const getAPI = async (url_api) => {
// Declaramos nuestra promesa con Async
return new Promise(async (resolve, reject) => {
let response = await fetch(url_api);
response.status == 200 // Validacion p... | true |
585be65c0372cc300a682bc0fdc3df1c71774a32 | JavaScript | Yoobe/ag-grid | /charts-community-modules/ag-charts-community/dist/esm/es5/util/timeFormat.js | UTF-8 | 6,321 | 3.0625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | var CONSTANTS = {
periods: ['AM', 'PM'],
days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
shortDays: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
months: [
'January',
'February',
'March',
'April',
'May',
'June',
... | true |
59f41861faf836674921fdf7734d57f54eab7aa8 | JavaScript | jomaejercito/js-looping-and-iteration-filter-and-map-lab-v-000 | /index.js | UTF-8 | 570 | 2.96875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | function driversWithRevenueOver(drivers, revenue) {
return drivers.filter(driver => driver.revenue > revenue);
}
function driverNamesWithRevenueOver(drivers, revenue) {
return driversWithRevenueOver(drivers, revenue)
.map(driver => driver.name);
}
function exactMatch(drivers, object) {
return drivers.filter... | true |
c74bc0ece105fe5225d01f752535fdbfb851c6fa | JavaScript | PolSpock/BitBet | /FRONT/public/javascripts/index.js | UTF-8 | 3,298 | 2.578125 | 3 | [] | no_license | var web3 = new Web3(new Web3.providers.HttpProvider("http://127.0.0.1:7545"));
var BitbetOracle;
var BitbetBet;
var userAccount;
function startApp() {
web3.eth.getAccounts().then(function (res) {
userAccount = res[0];
});
var bitbetOracleAddress = '0x96da1b66047666d72b8676077cf01a0d70060d8b';
... | true |
feedf335e3eb413b5b0219b25eb50beaffb3ac79 | JavaScript | ApsisInternational/gulp-config-apsis | /src/taskMaker.js | UTF-8 | 495 | 2.65625 | 3 | [
"MIT"
] | permissive | /**
* Create a gulp task
* @param {object} task configuration for the task
* @return {}
*/
function taskMaker(gulp) {
if (!gulp) {
throw new Error('Task maker: No gulp instance provided.');
}
const maker = {
createTask,
};
return maker;
function createTask(task) {
... | true |
0d2e5b860c44ba6ae996d280327c5c14c28f0b89 | JavaScript | learn-co-students/atl-web-042219 | /21-intro-js/index.js | UTF-8 | 1,442 | 3.953125 | 4 | [] | no_license | console.log("hello world!")
//find h1 tag
//change from Book List --> Favorite Books
let h1Element = document.querySelector("h1")
console.log("This is my element!!", h1Element)
h1Element.innerText = "Favorite Books"
//create a book element with JS
const bookList = document.querySelector('#book-list')
//iteration b... | true |
3965c3ed732708dd97c4625dca994637c12d01a4 | JavaScript | dan2298/Algos | /Linked List/deleteMiddleNode.js | UTF-8 | 436 | 4.40625 | 4 | [] | no_license | /*Implement an algorithm to delete a node in the middle (i.e., any node but the first and last node, not necessarily the exact middle) of
a singly linked list, given only access to that node */
//CTCI
class LinkedList {
constructor(value) {
this.value = value;
this.next = null;
}
}
function de... | true |
c3f833b7233a2d4eda8c03835cadfe4dd897a4bb | JavaScript | malie/automatic-differentiation-js | /autoencoder-example.js | UTF-8 | 3,939 | 2.625 | 3 | [] | no_license | // todo: try generate inputs from autoencoder
// by using the input derivatives to advantage.
// First input is noisy, random, or just one 1
import { T, trace, compiler, instructionInterpreter,
randomTensor, mapTensor, zipTensor,
asmjsCompiler } from './ad'
var util = require('util')
function randint(n) {
r... | true |
f136722b5f6b35e2079a56367c1a2a0d38003ac0 | JavaScript | lscspirit/dyna | /src/core/lifecycle.js | UTF-8 | 2,954 | 2.625 | 3 | [
"MIT"
] | permissive | 'use strict';
var assign = require('object-assign');
var arrayUtils = require('../utils/array_utils');
var domReady = require('../utils/dom_ready');
var deferred = require('deferred');
var injector = require('./injector');
var ujs = require('./ujs');
/**
* Config phase of the framework lifecycle
* Con... | true |
32a0d96fe2cc0823d5b5cce632bb8a0562234db2 | JavaScript | step-archive/score-sridevs | /src/score.js | UTF-8 | 190 | 2.96875 | 3 | [] | no_license | const Score = function () {
this.score = 0;
};
Score.prototype.getScore = function () {
return this.score;
};
Score.prototype.updateScore = function () {
return this.score += 10;
};
| true |
add32fe7c03e07c11aa8299cc1c850ee2dca1e4b | JavaScript | CaioBornatto/pagina-pessoal | /src/app.js | UTF-8 | 772 | 2.765625 | 3 | [] | no_license | //Bibliotecas--------------------------------------------------
const express = require('express');
const path = require('path');
//-------------------------------------------------------------
const app = express();
//Renderiza as paginas-----------------------------------------
app.get('/',(req,res)=>{
res.sendF... | true |
d753c88a9bd22d4247950459bd329d7f9841ba25 | JavaScript | juanjmbsc/projeto_curso_algoritmo-1 | /operadores-concatenacao.js | UTF-8 | 407 | 4.25 | 4 | [] | no_license | /*
Algoritmo "Concatenação"
// Juan Castro
// Rumo ao objetivo!
Var
nome: caracter
numero: real
Inicio
escreva("Digite o nome: ")
leia(nome)
escreva("Digite o numero: ")
leia(numero)
escreva(nome, ", o numero digitado é", numero)
*/
var nome, numero
nome = prompt("Digite seu nome")
numero = pr... | true |
507131471ba13e2619c593de7303c7cf04c291cc | JavaScript | chriscebrero/LeetCode | /mergeTwoLinkedLists.js | UTF-8 | 279 | 3.40625 | 3 | [] | no_license | function mergeTwoLinkedLists(l1, l2) {
let l = new ListNode(null);
const preHead = l;
while (l1 && l2) {
if (l1.val < l2.val) {
l.next = l1;
l1 = l1.next;
} else {
l.next = l2;
l2 = l2.next;
}
l = l.next;
}
l.next = l1 || l2;
return preHead.next;
}
| true |
8bc3556cb052547e615f4a23eece6f3ccff07d88 | JavaScript | LarryHillyer/ToDoList | /app/maincontroller.js | UTF-8 | 370 | 2.5625 | 3 | [] | no_license | app.controller('maincontroller', function($scope){
$scope.test = "I like angular"
$scope.items = [];
$scope.addItem = function() {
if ($scope.newItem)
$scope.items.push($scope.newItem);
$scope.newItem="";
};
$scope.removeItem = function(index) {
$... | true |
3419cc73d52e72384a93e3ae08ec49c3b104ff4d | JavaScript | Sushil1204/True-Fan | /index.js | UTF-8 | 1,387 | 3.40625 | 3 | [] | no_license | const read = require("readline-sync");
const questionsList = [
{
question: "When was MS Dhoni born ? (DD/MM/YY) ",
answer: "7/7/81",
},
{
question: "How many centuries have been scored by the MS Dhoni in ODIs? ",
answer: "10",
},
{
question: "When MS Dhoni made ODI Debut for the Indian t... | true |
c4650c2b620cdc2ac6b71b5d973b3fb9b375c057 | JavaScript | cheran189/plinko-game | /sketch.js | UTF-8 | 2,223 | 2.765625 | 3 | [] | no_license | const Engine = Matter.Engine;
const World = Matter.World;
const Bodies = Matter.Bodies;
const Body = Matter.Body;
var engine,world;
var ground;
var plinkos = [];
var divisions = [];
var particles = [];
//var ground1,ground2,ground3;
var divisionsHeight = 300;
functio... | true |
ce083e39e4115e8732dc797298d8d6b5b448e3af | JavaScript | gdj0122/wxShopping | /pages/cart/cart.js | UTF-8 | 1,855 | 2.734375 | 3 | [] | no_license | // pages/cart/cart.js
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
cartList:[],
isSelectAll:true,
totalPrice:0,
totalCounter:0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.setData({
cartList:app.globalData.cartList
})
// 设置回调
app.addCartCallback... | true |
9db657687b49659022517a40d5dd534dcac4995d | JavaScript | Linc911/flybird | /src/js/FrameUtil.js | UTF-8 | 413 | 2.6875 | 3 | [] | no_license | class FrameUtil {
constructor(){
this.currentFrame = 0;
this.realFps = 0;
this.sFrame = 0;
this.sTime = new Date();
}
update(){
this.currentFrame++;
var t = new Date();
if(t - this.sTime >= 1000){
this.realFps = this.currentFrame - this.sFrame;
this.sF... | true |
bdab6430de7db6f0ef86ae1ba5d8aec8b6bf6e41 | JavaScript | ANU197/snake-javascript---full-game | /snake game/inti.js | UTF-8 | 3,076 | 3.15625 | 3 | [] | no_license | const cvs = document.getElementById("snake");
const ctx = cvs.getContext("2d");
const box = 32;
let snake = [];
snake[0] = {
x : 9*box,
y : 10*box
}
let food = {
x : Math.floor(Math.random()*17+1)*box,
y : Math.floor(Math.random()*15+3)*box
}
let score = 0;
let d;
document.addEventListe... | true |
0d3ac4292cc4d2c65fe007f953b228a9f491fe4e | JavaScript | ryancookdev/canvas-chess | /tests/unit/moveTest.js | UTF-8 | 441 | 2.625 | 3 | [
"MIT"
] | permissive | QUnit.module('Move');
QUnit.test('Test move', function (assert) {
var startSquare,
endSquare,
move;
startSquare = new CHESS.Square('e2');
endSquare = new CHESS.Square('e4');
move = new CHESS.Move(startSquare, endSquare);
assert.ok(move.getStartSquare().getName(), startSquare.getNam... | true |
71065f7a1b833199c2556f137ae1ada986befea4 | JavaScript | mrdzugan/next-first-app | /pages/todo.js | UTF-8 | 1,248 | 2.828125 | 3 | [] | no_license | import Link from "next/link";
import { useState } from 'react';
import styles from '../styles/Todo.module.css';
const Todo = () => {
const [todos, setTodos] = useState([]);
const [currentTodo, setCurrentTodo] = useState('');
const onTodoChangeHandle = (event) => {
const { value } = event.target;
... | true |
bf6ef7bf86a5e79a13fe76302572cb4b6a73d7fb | JavaScript | AleksandarOynakov/js-advanced | /Syntax, Functions and Statements Lab/Aggregate Elements.js | UTF-8 | 385 | 3.578125 | 4 | [] | no_license | function aggregate(array) {
function sum(array) {
console.log(array.reduce((a, b) => a + b, 0));
}
function inverse(array) {
console.log(array.reduce((a, b) => a + 1 / b, 0));
}
function concat(array) {
console.log(array.reduce((a, b) => `${a}` + `${b}`));
}
sum(array... | true |
8c2d3b2c41b6ef8d5ea883470f28ba90024b16a6 | JavaScript | spajovic/mySquare2 | /assets/js/main.js | UTF-8 | 21,641 | 2.515625 | 3 | [] | no_license | $('document').ready(function(){
// ispisivanje kategorija
ispisiKategorije();
//registracija
$('#dugme').on("click",registracija);
//logovanje
$("#dugme1").on("click",logovanje);
// vote
$("#dgmVote").on("click",glasanje);
//komentarisanje
$("#dugme-komentar").on("click",kome... | true |
6c22a5eb1afc4f483500ac5d9278346186235dc7 | JavaScript | ghazaltaimur/test-project | /public/js/front/general.js | UTF-8 | 351 | 2.515625 | 3 | [
"MIT"
] | permissive | $(document).ready(function(){
$(".featureTabsHead li").click(function(e){
e.preventDefault();
$('.featureTabsHead li').each(function(){
$(this).removeClass('active');
});
$('.featureTabsContent').addClass('hidden');
$id = $(this).attr('id');
$(this).addClass('active');
$('.'+$id).r... | true |
2d581e5da6eca76b7e59fe91353de160a5fca38e | JavaScript | stonks2midi/Sandbox | /sketches/website sketches/tonetesting.js | UTF-8 | 444 | 2.53125 | 3 | [] | no_license | //create a synth and connect it to the master output (your speakers)
var synth = new Tone.Synth().toMaster();
//c
synth.triggerAttackRelease('C4', 0.5, 0)
synth.triggerAttackRelease('D4', 0.5, 1)
synth.triggerAttackRelease('E4', 0.5, 2)
synth.triggerAttackRelease('F4', 0.5, 3)
synth.triggerAttackRelease('G4', 0.5, 4... | true |
b806cf5fdac3684680e3c090f1042179fdfc3b19 | JavaScript | LeeeeeeM/quickapp-danmu | /src/base/Pool.js | UTF-8 | 448 | 2.65625 | 3 | [] | no_license | import Shoot from './Shoot'
class Pool {
constructor() {
this.list = []
}
addShoot(options, line, windowWidth, windowHeight, isFullScreen, duration) {
const shoot = Shoot.getPooler(options, line, windowWidth, windowHeight, isFullScreen, duration)
this.list.push(shoot)
}
removeShoot(index) {
t... | true |
7e83639c2ab740697ec276aafdf38bd02960e684 | JavaScript | hodayale/moovi-app | /src/Components/LiveSearchBox.js | UTF-8 | 1,080 | 2.5625 | 3 | [] | no_license | import { Form, ListGroup } from "react-bootstrap";
import './LiveSearchBox.css'
import React from 'react';
const LiveSearchBox = (props) => {
const {placeholderText, results, searchTextChanged, resultSelected} = props;
const [searchText, setSearchText] = React.useState('');
const handleClick = (index)... | true |
115df05190fe3f36d5905107cccfe0d876796f31 | JavaScript | FekadeTegeghe/cs301_workspace | /udemyEx/tempAmplitude.js | UTF-8 | 704 | 4.28125 | 4 | [] | no_license | //Given array of daily temperature. Find amplitude of the temp.
// find max temp, min temp, difference b/n max & min (Amplitude)
"use strict";
/**
*
* @param {array} temp is an array
* @returns {number} amplitude is difference between max & min
*/
function findAmplitude(temp){
let max = temp[0];
let min =... | true |
1dc1afaa20ebc079aabd87e458569e5d6c5d75c9 | JavaScript | laskar-ksatria/e-commerce-rest-api | /user-product-cart-server/middleware/getTotalPrice.js | UTF-8 | 287 | 2.546875 | 3 | [] | no_license | const Product = require('../models/product')
const getPrice = async (req,res,next) => {
let amounts = req.body.amounts
const product = await Product.findOne({_id: req.params.productId})
req.totalPrice = Number(amounts) * product.price
next()
}
module.exports = getPrice | true |
4255095e72488df88ca727b2377119eb4ea34dc8 | JavaScript | LichBrennt/single-page-template | /js/main.js | UTF-8 | 682 | 2.640625 | 3 | [] | no_license | let navStatus = document.querySelectorAll('.nav-status>a')
let nav = document.querySelector('.nav-status')
navStatus.forEach(link =>{
link.addEventListener('click', function(e){
navStatus.forEach(status=>{
status.classList.remove('active')
})
e.target.classList.add('acti... | true |
3ab2795a28db9a64010994d00cbda118a922b082 | JavaScript | andrewjpoole/livedocs | /LiveDocs/wwwroot/scroll-interface.js | UTF-8 | 535 | 2.625 | 3 | [
"MIT"
] | permissive | export function getScroll() {
return {
X: window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0,
Y: window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0
};
}
export function setScroll(left, top) {
window.scrollTo(left... | true |
9ad7c66b10f555e36aec8441bf88714a60a31c76 | JavaScript | taylorjg/AngularMaterialDialog | /scripts/models/NameListModel.js | UTF-8 | 1,762 | 2.6875 | 3 | [] | no_license | /**
* Created by jonathantaylor on 02/11/2014.
*/
(function () {
"use strict";
window.nameListApp = window.nameListApp || {};
window.nameListApp.models = window.nameListApp.models || {};
window.nameListApp.models.nameListModel = function (items) {
var _calculateInitialValueOfNextId = funct... | true |