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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
a321000ccd40e99c2e1a7526c27dd0563692d265 | JavaScript | alvarobolanos/advjava_final_gui | /src/main/resources/static/js/itemService.js | UTF-8 | 2,991 | 3.4375 | 3 | [] | no_license | var requestURL = 'http://localhost:8080/todolist'; // Set the base url.
function populateTodoList(target) { // A function to populate the div #todoList. Receives a parameter describing the target within the API gateway (don't know if this is how it's called but I mean the entry point to the rest reso... | true |
fba6f1e1f2a7d18f3f01fea6d27d1b67ca3c95b4 | JavaScript | nataliajsilva/n1-meli-backend-projeto-pratico | /src/controllers/optusController.js | UTF-8 | 866 | 3.015625 | 3 | [] | no_license | // - buscar todos os filmes com uma data de lançamento superior a data atual;
const optus = require("../model/optus.json")
exports.get = (request,response) => {
console.log(request.url)
response.status(200).send(optus)
}
exports.getById = (request, response) => {
const id = request.params.id
if(id <=... | true |
8ebde4def82499055601f7bf3cb3cd9d6f04f8c5 | JavaScript | Sykurpudar/TicTacToe | /src/client/index.js | UTF-8 | 1,897 | 3.609375 | 4 | [] | no_license | //index.js
"use strict";
const Game = require("../logic/game.js");
//Returns all elements with class square
function getHTMLgrid() {
var squares = document.getElementsByClassName("square");
return squares;
}
/*
Main function for our game logic
*/
const currentGame = new Game(); // Initialize new game
var message =... | true |
a9adcd378bbea04270816eae1f77e1bf6ea6e71b | JavaScript | GijsbertdeLeeuw/etch-a-sketch | /scripts/etch-a-sketch.js | UTF-8 | 4,820 | 3.109375 | 3 | [
"MIT"
] | permissive | "use strict"
// **** Constants From DOM ****
const CONTAINER_SIZE = 768;
// **** Populate Fields ****
const sizeXXL = document.querySelector("#sizeXXL");
const sizeXL = document.querySelector("#sizeXL");
const sizeL = document.querySelector("#sizeL");
const sizeM = document.querySelector("#sizeM");
c... | true |
4b651388f1c93ab58700363cfa3656664fb3b58b | JavaScript | DTin98/SuccessfulLand-App-Clone | /src/store/reducers/user.js | UTF-8 | 754 | 2.53125 | 3 | [] | no_license | import { actionTypes } from '../actions/user'
const initialState = {
data: {},
isLogout: false,
isLogin: false,
session: ''
}
const reducer = (state = initialState, action) => {
switch (action.type) {
case actionTypes.SIGN_IN:
return Object.assign({}, state, {
... | true |
70030d0a7ac39026dba9af8293e88047b6f8a232 | JavaScript | FrozenMind/JsGameCollection | /Pong/public/client/clientMain.js | UTF-8 | 6,903 | 3.15625 | 3 | [
"MIT"
] | permissive | //client main file
var socket = undefined,
stage,
width, height, //stage width and height
rect_player1, rect_player2, cir_ball, //players and ball drawing object
btn_search, btn_ready, //btn to search for a game and press ready
txt_status, //show different texts like are u ready, please wait, ..
txt_score, ... | true |
7254795369e580d2b7f7f6e0e287afccc90f434b | JavaScript | Jurek33/Hackerrank_Solutions | /problem_solving/Algorithms/implementation/Larrys_Array.js | UTF-8 | 240 | 3.203125 | 3 | [] | no_license | function larrysArray(A) {
let inversions = 0;
for(let i=0; i<A.length; i++) {
for(let j=i+1; j<A.length; j++) {
if(A[i]>A[j]) inversions++
}
}
if(inversions%2===0) return 'YES';
return 'NO';
} | true |
fb2184541e0b655b7a6216952175dcc5ac7ecb2c | JavaScript | hidden0/Screeps | /Stable/role.builder.js | UTF-8 | 13,098 | 2.734375 | 3 | [] | no_license | var roleBuilder = {
/** @param {Creep} creep
@Description: To maintain the hive. The builder ensures all buildings are constructed, and walls maintained.
Logic Flow / States (priority by number with 1 being highest priority)
- 1) Wall upkeep. The spawn will hold a value for wallStr in m... | true |
7b87cbde6e159355e8af18a18c06486a5b85c8e9 | JavaScript | pranjalkumar/webhook | /controllers/user.js | UTF-8 | 3,965 | 2.65625 | 3 | [] | no_license | 'use strict';
const mongoose=require('mongoose');
const Users=require('../models/user').Users;
const bcrypt=require('bcrypt');
const jwt=require('jsonwebtoken');
//making api key for each user to help them validate the return request
//random string generation
function makeid(length) {
let text = "";
let poss... | true |
48179c0e91a013c9f1a3e690a578b10ac055a6c8 | JavaScript | eamederos/node-tutorials | /01_node_tutorials/08_os_module.js | UTF-8 | 356 | 3 | 3 | [] | no_license | const os = require('os')
//about the current user
const user = os.userInfo();
console.log(user);
//details about the system in seconds
console.log(`System has bee up for ${os.uptime()/(60*60*24)} days`);
const currentOs = {
name: os.type(),
release: os.release(),
totalMem: os.totalmem(),
freeMem: os.... | true |
b5c174f4c122268c860d22b9ffdfcba00a3eb1cb | JavaScript | digwallace/NodeJS-Server-Examples | /File_System_reading.js | UTF-8 | 659 | 2.921875 | 3 | [] | no_license | /* Simple example showing how to read the file system and display files
such html files.
You may test it by running as:
$ node [Name of this file].js
and entering the following into your web browser:
http://localhost:8080
*/
var http = require('http');
var fs = require('fs');
... | true |
40176a34cb66760d752b03a42808a4c98825f31a | JavaScript | ivanwills/indent-checker | /test/indent.js | UTF-8 | 2,406 | 2.71875 | 3 | [] | no_license | /* global require, describe, it */
var assert = require('assert')
indent = require('../index');
describe('Good lines of text', () => {
it('All spaces', () => {
assert.equal(indent.textOk('my line'), true);
assert.equal(indent.textOk(' my line'), true);
assert.equal(indent.textOk(' my line'), true);
assert.... | true |
7de7e2da8ebc4ac671d959bf76e1974390827654 | JavaScript | daneos/cpuseum | /script/replace_content.js | UTF-8 | 190 | 2.84375 | 3 | [] | no_license | function replaceContent(url)
{
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", url, false);
xmlhttp.send();
document.getElementById("content").innerHTML = xmlhttp.responseText;
} | true |
d58702f84a535a627356003800945e98e3a575e5 | JavaScript | NONGFUER/tit-design | /src/utils/compose.js | UTF-8 | 369 | 3.03125 | 3 | [] | no_license | export function compose({...funcs}){
if(funcs.length === 0){
return (arg) =>arg
}else{
const last = funcs[funcs.length-1];//最后一个函数
const rest = funcs.slice(0,-1)//剩下的,从第0个开始到最后一个(不含最后一个)
return (...args) => rest.reduceRight((composed,f)=>f(composed),last(...args))
}
} | true |
b51dccf1364ac8b1cae63dc19680f95e3af0919f | JavaScript | julia-thea/JavaScript-exercises | /strings.js | UTF-8 | 1,233 | 4.4375 | 4 | [] | no_license | /*
var text = 'So much magic in the world, that makes it beautiful.';
console.log(text.indexOf('world'));
var str = "Apple,Banana,Kiwi";
var newString = str.slice();
console.log(str);
console.log(newString);
var txt = "Hello World";
console.log(txt.replace('World', 'Universe'));
var txt = "Hello World";
console.lo... | true |
10fe5e7ad99a9d5570b14cec980a6a30587fdb1e | JavaScript | Qrisno/js-practices | /day-5/Strings/homework3/hw3.js | UTF-8 | 490 | 3.5625 | 4 | [] | no_license | function searchWord(str, part) {
if (typeof str !== 'string' || typeof part !== 'string') {
throw new Error('Parameter has to be a string !');
}
let n = str.split(part).length - 1
let output = "'" + part + "' was found " + n + ' times!'
return output;
}
try {
console.log(searchWord('Th... | true |
43362aa25ebb173a9c95232292200259b103d0fe | JavaScript | sashaj/job-tests | /4_test/src/js/index.js | UTF-8 | 2,188 | 3.25 | 3 | [] | no_license | window.onload = function() {
const submitButton = document.querySelector('.form__submit');
const inputEmail = document.querySelector('.form-input__email input');
const inputPassword = document.querySelector('.form-input__password input');
const form = document.querySelector('.form');
const formError = documen... | true |
3378ee07f9749e1073229dd0a89008ff369dd4a6 | JavaScript | heheyuanqing/informationCenter | /req/javascript/result.js | UTF-8 | 1,043 | 2.71875 | 3 | [
"MIT"
] | permissive | window.onload = () => {
var btn = document.getElementById('btn');
var result = document.getElementById('result');
btn.addEventListener('click', function () {
var name = document.getElementById("name").value;
$.ajax({
url: "http://127.0.0.1:3000/result/",
method: "GET"... | true |
8f52127a7a4357a1fdb1090399ba36ad6ea03c6a | JavaScript | jestrux/abwebsite | /public/js/series_categories.js | UTF-8 | 1,020 | 2.53125 | 3 | [] | no_license | var model_id = null;
function showDeleteModal(model)
{
showModal("delete_confirmation_modal");
$("#confirmation_text").text("Delete " + model.name);
model_id = model.id;
}
function deleteSeriesCategory()
{
document.getElementById('delete' + model_id).submit();
// $.ajax({
// type: 'delete',
// url: ... | true |
ddefb16a03fab09e857c8842cfbc1912969ca008 | JavaScript | famous-proger/GoldeNote-Chrome-Extension | /assets/popup/js/add-list-item.js | UTF-8 | 3,594 | 3 | 3 | [] | no_license | "use strict";
function addListItem() {
// ADD OPEN NOTE FUNCTIONALITY
openNote();
getElement("list_of_notes").innerHTML = "";
chrome.identity.getAuthToken({ interactive: true }, function (token) {
let get_table_items = new XMLHttpRequest();
get_table_items.open('GET', `https://she... | true |
980f8bf0f7a1e33dede3074132e1103bf8afd43b | JavaScript | chitalian/kb-layout-manager | /client/client.js | UTF-8 | 15,171 | 2.703125 | 3 | [] | no_license | /*
* Global constants
*/
// Every type that can be assigned to a key
const key_types = ["NONE","HID","MOD","MIDI","FUNC","TOGGLE","TARGET","CLICK",
"MOUSE_X","MOUSE_Y","SCROLL_X","SCROLL_Y","HIDMOD"];
// Export header to be added to the beginning of the generated layermap file
const export_header_format =
'// crea... | true |
dfb0fbe9ce9fa3324f017e0aaf6eed9ebf0c0b95 | JavaScript | didikz/nodeuniversitycourses | /eventemitters/jobs.js | UTF-8 | 416 | 2.53125 | 3 | [] | no_license | let util = require('util');
let events = require('events');
let Job = function Job() {
let job = this;
job.process = () => {
setTimeout(() => {
// emulate the delay of job async
job.emit('done', {completedOn: new Date() });
}, 700);
};
job.on('start', () => {
... | true |
b2ace0062114ec77ea3ac8a3f9090b914059f1e4 | JavaScript | compute-io/lasso-regression | /examples/index.js | UTF-8 | 560 | 2.890625 | 3 | [
"MIT"
] | permissive | 'use strict';
var lasso = require( './../lib' ),
randomNormal = require( 'distributions-normal-random' ),
x, y,
out,
i;
// Set seed of random number generator:
randomNormal.seed = 117;
// Create a 100 x 10 matrix of standard normal variates
x = randomNormal( [100,10], {
'dtype':'float64'
});
// Generate respon... | true |
411ceb9491be85bdc8b1535bb95299c3ee5525e4 | JavaScript | BraneiroFabian/CursoIngresoJS | /9-Parciales/uno.js | UTF-8 | 248 | 3.453125 | 3 | [] | no_license |
function mostrar()
{
var ancho;
var largo;
var perimetro;
ancho=prompt("Ingrese ancho");
largo=prompt("Ingrese largo");
ancho=parseInt(ancho);
largo=parseInt(largo);
perimetro=ancho*2+largo*2;
alert("El perímetro es: "+perimetro);
}
| true |
60cafd2e067555072c3657b7f2e4e14cd7ca9a43 | JavaScript | gal664/fake-youtube | /server/video/index.js | UTF-8 | 2,884 | 2.578125 | 3 | [] | no_license | const Video = require("./videoModel");
const express = require("express");
const router = express.Router();
const fetchVideoInfo = require("youtube-info");
// get all videos
router.get("/", (req, res) => {
const { channel, query } = req.query;
let filter = {};
if (channel) filter.channel = channel;
if (query) ... | true |
bdf00652b618191ac20b24756724abb5562fe729 | JavaScript | szreek/bootcamp_js | /coupon-frontend/app/js/script.js | UTF-8 | 8,715 | 2.84375 | 3 | [] | no_license | var modal = document.getElementById('js-success');
var form = document.forms[0];
// generate dates for forms
var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
var dateFields = document.getElementsByClassName('js-date-input');
for (var i = 0; i < dateFields.length; i++) {
// mo... | true |
3848d79c5f00e7cea4b32b0a8f997cf6db801f5f | JavaScript | mughetti/restful-apis | /app.js | UTF-8 | 4,742 | 2.84375 | 3 | [] | no_license | //basic setup
var express = require('express');
var app = express();
var bodyParser = require('body-parser');
var morgan = require('morgan');
var mongoose = require('mongoose');
var port = process.env.PORT || 8080;
var User = require('./app/models/user');
var jwt = require('jsonwebtoken');
var superSecret ... | true |
d5c4d7c1e18f8636b8e5e42ef5eec0d4e92c74c7 | JavaScript | Manu1400/eslint-plugin-emmanuel | /tests/essai.js | UTF-8 | 2,156 | 3.59375 | 4 | [] | no_license | //const regex1 = /[abc]/
//const regex2 = /[a-c]/; //nk ji jj
//
//const invalid = /[c-a]/
//
//console.log(regex1) // yhh
//console.log(regex2) //
//console.log(invalid) //
// /[abcdef]/
//
Number(1)
Number(1).toExponential()
Number('123')
new Number('123')
Number.parseInt()
parseInt = Number.parseInt
Number()
N... | true |
523b351a42d22e27d257bd38cc0c9e308ed74187 | JavaScript | Renba/proyecto_ajax | /proye_ajax/assets/js/indicator.js | UTF-8 | 4,433 | 2.609375 | 3 | [
"MIT"
] | permissive | $(document).ready(function(){
displayIndicators();
});
function displayIndicators(){
$.ajax({
url:"indicator/indicators_index.php",
type:"GET",
dataType:"html",
success:function(response){
$("#action").html(response);
}
});
}
function displayCreate(){
option_number = 2;
... | true |
40e9edd73b2ef80f721662dba77044475348e8e6 | JavaScript | rachelruderman/Blog-with-React-Form-and-Redux | /src/components/posts_new.js | UTF-8 | 4,657 | 2.890625 | 3 | [
"MIT"
] | permissive | import React, {Component} from 'react'
import {Field, reduxForm} from 'redux-form'
import {Link} from 'react-router-dom'
import {connect} from 'react-redux'
import {createPost} from '../actions'
class PostsNew extends Component {
renderField(field){
//the field param contains an eventhandler so it knows what in... | true |
cfa107470e39122776614c9610b4fa4eacd58eed | JavaScript | anwar78692/Html-Projects | /oops.js | UTF-8 | 518 | 3.984375 | 4 | [] | no_license | // super
// constructr
// extends
class Car {
// in javascript constructor is same as constructor name
constructor(name, mileage, color) {
this.name = name;
this.mileage = mileage;
this.color = color;
}
}
let bmw;
bmw = new Car("bmw", "9", "Red");
console.log(bmw);
let merced... | true |
5b482593b14b96b523f391652450ddc9de7fcacd | JavaScript | percy2017/2click | /public_html/js/mapa_mensajero.js | UTF-8 | 9,955 | 2.765625 | 3 | [
"MIT"
] | permissive | // $(document).ready(function() {
// });
function initMap()
{
var marker;
var lat_x;
var lng_y;
var mapa;
if (navigator.geolocation)
{
console.log('Esperando la posicion del GPS');
// document.getElementById("espera_text").innerHTML = 'Esperando la posicion del GPS';
var geo_options = {e... | true |
13ebdf151e6598e5691894e0a81e1232ab507c55 | JavaScript | gunget/rct_hooks_phonebooks | /src/rct_ref_sources/src_todos/components/useFetch.js | UTF-8 | 1,494 | 3.078125 | 3 | [] | no_license | import { useState, useEffect } from "react";
const useFetch = (callback, url) => {
// use라는 명칭으로 함수를 시작하면 리액트가 그안의 useEffect들도 라이프사이클에 맞춰 태운다고 함. 그렇게 재사용가능한 커스텀훅스를 만들 수 있음
const [loading, setLoading] = useState(false);
const fetchInitData = async () => {
setLoading(true);
const response = await fetch(ur... | true |
2e8093c2b0a1c07018e09c1a19ac505478dad487 | JavaScript | gokulsaraswat/web | /things_i_got_form_internet/things_i_got_form_internet/vue-hangman/dist/script.js | UTF-8 | 4,284 | 3.1875 | 3 | [
"MIT"
] | permissive | // Change this if you want the possibility of longer or shorter puzzles.
const maxLength = 40; // (Typically, the lower this number, the harder the puzzle.)
//Change this if you want more or fewer strikes allowed
const allowedStrikes = 3; //If you set this and maxLength both too high, the puzzle will be impossible to ... | true |
318126b3067bb82cd05277de6c236971116a1dc6 | JavaScript | nik-kov/Codewars_solutions | /How good are you really.js | UTF-8 | 1,673 | 3.96875 | 4 | [] | no_license | // There was a test in your class and you passed it. Congratulations!
// But you're an ambitious person. You want to know if you're better
// than the average student in your class.
//
// You receive an array with your peers' test scores. Now calculate
// the average and compare your score!
//
// Return True if you're ... | true |
2c6690045fb9fd91c159c7234ddad983c3357f19 | JavaScript | martinr-max/chat-app-mern-stack | /chat-server/socket/socket.js | UTF-8 | 2,261 | 2.796875 | 3 | [] | no_license | const {
createRoom,
createMessage,
addUserToRoom,
leaveRoom,
getRecentMessages,
getUsersInRoom} = require('../handlers/queryhandler')
const socketIO = (io) => {
io.on("connection", async socket => {
console.log(`Connected: ${socket.id}`);
try {
socket.on('join', async (username, room... | true |
4b7b792a53013711e366199e96bfc52084f757d4 | JavaScript | VictoriaWika/rickandmorty-app | /src/components/App/App.js | UTF-8 | 1,338 | 2.890625 | 3 | [] | no_license | import { useEffect, useState } from 'react'
import CharacterPage from '../CharacterPage'
import HomePage from '../HomePage'
import Navigation from '../Navigation'
import './App.css'
export default function App() {
const [characters, setCharacters] = useState([])
const [currentPage, setCurrentPage] = useState('Home... | true |
c8255c1de1c3e1e8b076f39eba87ac51dc632370 | JavaScript | Dublez/evaluate-news-nlp | /__test__/handleSubmint.spec.js | UTF-8 | 10,147 | 2.75 | 3 | [
"MIT"
] | permissive | import { handleSubmit, getFormText, postServerData, renderResult, createResultsSection, createTextSection, createParamsSection } from '../src/client/js/formHandler';
import 'regenerator-runtime/runtime';
// Describe function has two arguments: a string description and a test suite as a callback function.
// A test su... | true |
d3b1c05c2c26282bc7b24b10e428c92efaa0f8ea | JavaScript | magalidov/Pegasus | /js/apps/books/service/search-book-service.js | UTF-8 | 316 | 2.671875 | 3 | [] | no_license |
export const addBookService = {
searchForAbook,
}
function searchForAbook(bookName) {
if (bookName === '') return []
return axios.get(`https://www.googleapis.com/books/v1/volumes?printType=books&q=${bookName}`)
.then(foundBooks => foundBooks.data)
.then(booksData=>booksData.items)
}
| true |
2af65264080bc6873257e7d91a5e6f21eaca5cf5 | JavaScript | KBrayanGarcia/Flexbox | /script/script.js | UTF-8 | 390 | 2.796875 | 3 | [] | no_license | const menu = document.querySelector('.menu-hamburguer');
const contenedorEnlaces = document.querySelector('.enlaces');
menu.addEventListener('click', hideShow);
function hideShow() {
if (contenedorEnlaces.classList.contains('mostrar-menu')){
contenedorEnlaces.classList.remove('mostrar-menu');
}els... | true |
522092bfc2e11e6818ea432de13e330212c1ccb2 | JavaScript | YYL1999/algorithms | /剑指offer/数组调整.js | UTF-8 | 269 | 3.484375 | 3 | [] | no_license | function reOrderArray(array)
{
// write code here
let arr1=[],arr2=[]
for(let i =0;i<array.length;i++){
if(array[i]%2===0){
arr2.push(array[i])
}else{
arr1.push(array[i])
}
}
return [...arr1,...arr2]
} | true |
33f9bd230fa57c764fcd00fea64ec8510365bcd8 | JavaScript | jonathanda1/Angular2 | /forfun/functionalprogramming/programmingchallenges.js | UTF-8 | 585 | 4.40625 | 4 | [] | no_license | // Reversing a string
function reverseString(str) {
var Array = str.split("");
var revArray = Array.reverse();
var newStr = revArray.join("");
return newStr;
}
reverseString("hello");
// A number's factorial
function factorialize(num) {
if (num == 0) {
return 1
} else {
return (num * factorialize(... | true |
af2e4ccca3195ff6cfa8ef2483327306540442b3 | JavaScript | dayaftereh/stargen | /templates/js/planet.js | UTF-8 | 1,976 | 3.171875 | 3 | [
"MIT"
] | permissive |
class Planet {
constructor(index, data, camera) {
this.index = index;
this.data = data;
this.camera = camera
this.enabled = true
this.epoch = (Math.random() * this.data.orbitPeriod) % this.data.orbitPeriod;
// create the planet mesh
this.material = new THREE... | true |
610b96031fb138e772c8340ba0158e349b89f8f3 | JavaScript | woochica/trachacks | /estimatorplugin/0.12/estimatorplugin/htdocs/Controls.js | UTF-8 | 3,756 | 2.546875 | 3 | [] | no_license | /* -*- Mode: javascript; -*- */
if(typeof(ADW) == 'undefined')ADW = {};
if(!ADW.Controls)
ADW.Controls = {};
(function (){
var Controls = ADW.Controls;
Controls._createdNodes = {};
Controls.setAttribute = function(node, attrib, value){
if(typeof(value) == "function") node[attrib] = value;
... | true |
86747fb210a46c041624d54d8c804f8ae0eedea3 | JavaScript | yangxi1998/rectangle2 | /rectangle.js | UTF-8 | 3,820 | 2.6875 | 3 | [
"MIT"
] | permissive | $(function() {
var $width=$('#width'),$height=$('#height'),$btnCal=$('#calcute'),$perimeter=$('#perimeter'),$area=$('#area'),$widthValidation=$('#width-validation'),$heightValidation=$('#height-validation');
// $width.focusout(function(){
// var w=$width.val();
// if(w===''){//字段级校验
// $widthVa... | true |
a6a04058690e471e528c61d0204dddccc07d0994 | JavaScript | unostar/CPP | /t-styl.info/templates/radio/javascript/popup.js | UTF-8 | 2,157 | 2.734375 | 3 | [] | no_license | var popupLinkConfig = new Array;
// popupLinkConfig["classname"] = new Array ( "targetname", "width=350,height=640,scrollbars=yes,resizable=yes,status=yes,toolbar=yes,location=yes,menubar=yes");
popupLinkConfig["email"] = new Array ( "email", "width=370,height=410,resizable=no,status=no,scrollbars=no");
popupLinkConfig... | true |
412d4ee744897c585a0dafc49f6f677d27eac2dd | JavaScript | kevindurb/awx | /awx/ui/client/src/shared/list-generator/list-generator.factory.js | UTF-8 | 36,723 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | /*************************************************
* Copyright (c) 2015 Ansible, Inc.
*
* All Rights Reserved
*************************************************/
/**
* @ngdoc function
* @name shared.function:list-generator
* @description
* #ListGenerator
*
* Use GenerateList.inject(list_object, { key:value... | true |
cfc739af35634bb4269ed65681ce1767358cb87f | JavaScript | LegoOow/LegoOow.github.io | /cart.js | UTF-8 | 19,826 | 2.84375 | 3 | [] | no_license | //Variables//
let panier = JSON.parse(localStorage.getItem('monPanier'));
//Function//
nav();
displayCart();
// Navigation //
function nav() {
const div0 = document.createElement('div');
const container = document.getElementById('container');
const nav = document.createElement('nav');
const a0 = do... | true |
ba779d704abedb4df8fc1bcdd28632d82947cbb9 | JavaScript | danielemesh/openWeatherServer | /routes/index.js | UTF-8 | 1,002 | 2.796875 | 3 | [] | no_license | var express = require('express');
var http = require('http');
var router = express.Router();
/* GET home page. */
router.get('/', function (req, res, next) {
res.render('index', {title: 'Express'});
});
router.get('/:city_id', function (req, res, next) {
// Issue an API call to get city weather by ID
getWeathe... | true |
dcb4909ef7d5daf564cc8ae94a102410c3f0df9e | JavaScript | elenamarinaki/Code_Challenges---JavaScript | /Modern_JavaScript/powersOfTwo.js | UTF-8 | 470 | 4.59375 | 5 | [] | no_license | // Write an infinite powersOfTwo generator function that yields 1, 2, 4, 8, 16, etc., multiplying by 2 each time.
function* powersOfTwo() {
let i = 1;
while (true) {
yield i;
i *= 2;
}
}
// ----------------------- TESTING
const [x0, x1] = powersOfTwo();
// Get the 32nd power of 2.
const iterable = pow... | true |
bf0ce5fd53e2bde21618d07a99092f63e3a4d47f | JavaScript | MinskLeo/react-rpg.com | /src/features/stats/reducer.js | UTF-8 | 9,000 | 2.90625 | 3 | [
"MIT"
] | permissive |
const initialState = {
hp: 10,
maxHp: 10,
damage: 3,
defence: 0,
level: 1,
exp: 0,
expToLevel: 20,
gold: 0,
equippedItems: {}
};
const statsReducer = (state = initialState, action) => {
let newState = Object.assign({}, state);
switch(action.type) {
case 'GET_GOLD':
// add gold to cu... | true |
0ef116c647bcd7f79b58b51c38dc47d55d39e2fd | JavaScript | gao18516823865/navigation-bar | /pages/logs/logs.js | UTF-8 | 1,153 | 2.546875 | 3 | [] | no_license | // logs.js
const util = require('../../utils/util.js')
Page({
data: {
logs: [],
page: 1,
pageSize: 5,
arrayNumber: [],
number: [1, 2, 3, 4, 5],
hasMoreData:true,
},
onLoad() {
this.setData({
logs: (wx.getStorageSync('logs') || []).map(log => {
return {
date: ut... | true |
15b14277c198071ef6372423bfcee3f65bfeff2d | JavaScript | nss-evening-cohort-7/nutshell-vaulted-ceilings | /js/friends/friendsDom.js | UTF-8 | 2,068 | 2.703125 | 3 | [] | no_license | const modFriendsList = (friendsArr) =>
{
let domString = '';
friendsArr.forEach(friend =>
{
domString += `<div class="userCard">`;
domString += `<li class="list-group-item" data-friendUid="${friend.uid}">`;
domString += `${friend.username}`;
domString += ` <button class="btn btn-success addThisFri... | true |
4248525d1ecfbc610d717a3b822dda54a30d2bb6 | JavaScript | NguyenPhanDu/awesome_class_api | /src/app/controllers/HomeworkTypeController.js | UTF-8 | 875 | 2.53125 | 3 | [] | no_license | const HomeworkType = require('../models/HomeworkType');
class HomeworkTypeControlller{
async create(req, res){
const newHomeWorkType = new HomeworkType({
name: req.body.name
})
await newHomeWorkType.save()
.then(userType =>{
userType = userType.toObje... | true |
35dab471efac81c33b73577bf4cd873e4a6c1d5f | JavaScript | yukke-dmm/maeticke-mirror | /app/assets/javascripts/script.js | UTF-8 | 3,275 | 2.609375 | 3 | [] | no_license |
// $(function(){
// $("document").ready(function(){
$(function() {
$(".theTarget").skippr({
// スライドショーの変化("fade" or "slide")
transition : 'fade',
// 変化にかかる時間(ミリ秒)
speed : 1000,
// easingの種類
easing : 'easeOutQuart',
// ナビゲーションの形("block" or "bubble")
navType : 'block',
// 子要素の種類("div" or "img")
c... | true |
f5c45708167f979c365a7dae118a0f818909bd7a | JavaScript | melaniehoff/melaniehoff.github.io | /projects/main.js | UTF-8 | 2,846 | 2.671875 | 3 | [] | no_license | let arrWorks = []
let titles = []
$(document).ready(function() {
fillSidebar(works);
fillInWorks(arrWorks);
});
//populate sidebar
function fillSidebar(works) {
arrWorks = Object.values(works);
// console.log(works.softSurplus.title);
// console.log(arrWorks[0].title);
var i = 0;
w... | true |
b4d4385b2c955a2d34ab392efe9b50c97e8130e5 | JavaScript | BW-Weight-Lifting-Journal-6/Front-End | /weightlifting/src/components/EditWorkoutForm.js | UTF-8 | 2,122 | 2.59375 | 3 | [
"MIT"
] | permissive | import React, { useState } from "react";
import axiosWithAuth from "../utils/axiosWithAuth";
import styled from "styled-components";
const EditWorkoutForm = (props) => {
const id = props.match.params.id;
const [edit, setEdit] = useState({
exercise: '',
reps: '',
muscle: '',
... | true |
568d3cac6692c77721c7b38e60658b8b2b473e8b | JavaScript | philbaccara/philbaccara.github.io | /js/cv.js | UTF-8 | 2,557 | 2.625 | 3 | [
"MIT"
] | permissive | $(document).ready( function() {
/*=============================================================================
Skills meters
=============================================================================*/
/**
* Add delayed animations to skills gauges
*/
$(".js-meter > .js-fill").each( functio... | true |
d1ad73096ece51041784b57d1f248f93cfda98d5 | JavaScript | VoloviZzz/prokatmgn | /app/models/invoices.js | UTF-8 | 1,529 | 2.515625 | 3 | [] | no_license | const db = require('../libs/db');
exports.del_invoices = function del_invoices(arg = {}) {
if (!arg['id']) return Promise.resolve([new Error('Не указан идентификатор позиции')]);
return db.execQuery(`DELETE FROM invoices WHERE id = ${arg.id}`);
}
exports.add_invoices = function add_invoices(arg = {}) {
... | true |
b9678511ffa0e8ba8e4a21bd1b8f14ed537bc853 | JavaScript | indraworks/js-comerce | /frontend/src/screens/ProductScreen.js | UTF-8 | 2,515 | 2.828125 | 3 | [] | no_license | import { getProduct } from '../api';
import { parseRequestUrl } from '../utils';
import Rating from '../components/Rating';
const ProductScreen = {
//after render dtriger kick button
after_render: () => {
const request = parseRequestUrl();
document.getElementById('add-button').addEventListener('click', ()... | true |
aa772b97c73a64f85fec58a114a99450d9c569a9 | JavaScript | amandaLuana/Curso-web-cod3r | /listaExercicios1/ex21.js | UTF-8 | 341 | 3.140625 | 3 | [] | no_license | function planoSaude(idade) {
let valorFixo = 100
if (idade < 10) {
console.log(180)
} else if (idade > 10 && idade < 30) {
console.log(150)
} else if (idade > 30 && idade < 60) {
console.log(195)
} else {
console.log(230)
}
}
planoSaude(9)
planoSaude(50)
planoSau... | true |
56cec59cfd93f992552d97ce1afc505d63b2daf7 | JavaScript | RichaSundrani/Algorithm-problems | /Problem_solving/PracticeQ Algorithms/Amazon_leetCode_Soltions/Tree_and_Graphs/validate_binary_search_tree.js | UTF-8 | 1,727 | 4.15625 | 4 | [] | no_license | /*
Validate Binary Search Tree
Given the root of a binary tree, determine if it is a valid binary search tree (BST).
A valid BST is defined as follows:
The left subtree of a node contains only nodes with keys less than the node's key.
The right subtree of a node contains only nodes with keys greater than the node's key... | true |
705da4f494dcf26516cb7710952198b6d3829ee5 | JavaScript | brunolm/codewars | /7 kyu/regexp-basics-is-it-a-eight-bit-signed-number.js | UTF-8 | 236 | 3.03125 | 3 | [] | no_license | // http://www.codewars.com/kata/regexp-basics-is-it-a-eight-bit-signed-number
String.prototype.signedEightBitNumber = function () {
return /^(0|([1-9][0-9]?|[1][012][0-7]|1[01]\d)|-([1-9][0-9]?|[1][012][0-8]|1[01]\d))$/.test(this);
} | true |
039a47adeaf57d07e8899359e836d4d8a75fec51 | JavaScript | Latyn/UNA-2 | /ClinicaJava/web/resources/js/BaseDatos.js | UTF-8 | 1,115 | 3.296875 | 3 | [
"MIT"
] | permissive | function store(id, carrito){
sessionStorage.setItem(id, JSON.stringify(carrito,replacer));
}
function retrieveCarritoFromUrl(url,callBack){
var AJAX_req = new XMLHttpRequest();
AJAX_req.open( "GET", url, true );
AJAX_req.setRequestHeader("Content-type", "application/json");
AJAX_req.onreadystatechan... | true |
68774efb2b4142306ca1df24f94557cf38b604fa | JavaScript | daviian/ssn-aut-validator | /test/index_test.js | UTF-8 | 719 | 2.59375 | 3 | [
"MIT"
] | permissive | /**
* Module dependencies.
*/
import SSNValidator from '../src';
/**
* `Social Security Number` samples.
*/
const numbers = {
invalid: ['1234010158', '1485040585', '8912121296', '12345678', '1234567898754', '', null],
valid: ['6421310776', '4256080399', '9875210802', '3968280689']
};
/**
* Test `ssn-validato... | true |
e3b130c392126828f743ca251682ed442b870b05 | JavaScript | VestryOd/basic-js | /src/hanoi-tower.js | UTF-8 | 277 | 2.671875 | 3 | [
"MIT"
] | permissive | module.exports = function calculateHanoi(/* disksNumber, turnsSpeed */) {
let [disksNumber, turnsSpeed] = [...arguments];
let result = {};
result.turns = (Math.pow(2, disksNumber)) - 1;
result.seconds = result.turns / (turnsSpeed / 3600);
return result;
} | true |
9348e9a89bda3508d65dd100e13eaf76940fc880 | JavaScript | daliborkoenig/fbw48-2_shared | /2021/04_April/24_04_2021/filter.js | UTF-8 | 941 | 4.15625 | 4 | [] | no_license | // filter returns a new array with items that pass the test provided by the callback function
let ages = [18,19,13,40,35]
let isAllowed = ages.filter(function(item,index) {
// if (item >= 18){
// return item
// }
return item >=18 //condition for filter function
})
console.log(ages);
console.log(isAllowed);... | true |
1946d5ef8a3677cd963db3ef1a806eabed53288a | JavaScript | DesislavDimitrov/SoftUni-Repo | /JavaScript/BASICS/12-While Cycles/12.1-Sum number.js | UTF-8 | 279 | 3.71875 | 4 | [] | no_license | function sumNumber(input) {
let n = Number(input[0]);
let sum = 0;
let i = 1;
while (sum < n) {
let currentNumber = Number(input[i]);
sum += currentNumber;
i++;
}
console.log(sum);
}
sumNumber(["100",
"10",
"20",
"30",
"40"]); | true |
c92c91ff33ac0c385b260556266e89297c1d9d41 | JavaScript | mix1o/todo-list | /src/functions/filterByStatus.js | UTF-8 | 287 | 2.59375 | 3 | [] | no_license | export const filterByStatus = (firstElement, secondElement) => {
const firstCompleted = firstElement.task.filter(todo => todo.isDone === true);
const secondCompleted = secondElement.task.filter(
todo => todo.isDone === true
);
return { firstCompleted, secondCompleted };
};
| true |
c57c88691def1b03159d8de5417c25ab52c4496e | JavaScript | Home-ac/open-apparel-registry | /src/app/src/util/util.facilitiesCSV.js | UTF-8 | 1,034 | 2.515625 | 3 | [
"MIT"
] | permissive | /* eslint-disable camelcase */
import flow from 'lodash/flow';
import { joinDataIntoCSVString } from './util';
export const csvHeaders = Object.freeze([
'oar_id',
'name',
'address',
'country_code',
'country_name',
'lat',
'lng',
'contributors',
]);
export const createFacilityRowFromFea... | true |
9e7414d8f7887595a9f99bc457e03113a602e800 | JavaScript | tonylcb/estudos_origamid | /react-completo/appreact/src/Hooks/04_useMemo_useCallBack/UseMemo.js | UTF-8 | 395 | 2.625 | 3 | [] | no_license | import React from 'react';
const UseMemo = () => {
const [contar, setContar] = React.useState(0);
const valor = React.useMemo(() => {
const localItem = window.localStorage.getItem('produto');
console.log('Aconteceu memo');
return localItem;
}, []);
console.log(valor);
return <button onClick={(... | true |
5e0e9ca6397aff622ea7aa77e88b527e67bac257 | JavaScript | hecodeit/noise-webgl | /src/6.js | UTF-8 | 1,922 | 3.171875 | 3 | [] | no_license | // nippon-colors visulization
// create canvas
const canvas = document.createElement('canvas');
const context = canvas.getContext('2d');
document.body.appendChild(canvas);
// colors
const chineseColors = require('chinese-colors');
// size
var width, height, pixelRatio;
function randomColorDraw(){
const colorIndex =... | true |
8307746cd2e5852d3a0928692ce4d10cc468ab1c | JavaScript | Kran67/FlexCanvasJS | /src/FlexCanvasJS/dataContainers/DataRendererBaseElement.js | UTF-8 | 12,491 | 2.75 | 3 | [
"MIT"
] | permissive |
/**
* @depends SkinnableElement.js
*/
///////////////////////////////////////////////////////////////////////
///////////////////////DataRendererBaseElement/////////////////////////
/**
* @class DataRendererBaseElement
* @inherits SkinnableElement
*
* Abstract base class for DataList item rendering. Any Canv... | true |
42531c0eb4577224b5654663eb457977d1f59d0c | JavaScript | AngelCan/Tarea_React | /src/components/Invitados/Invitados.jsx | UTF-8 | 1,409 | 2.5625 | 3 | [] | no_license | import React, {useState} from 'react'
import {useForm} from 'react-hook-form'
import './Invitados.css'
const Invitados = () => {
//Creamos register y handleSubmit
const {register, handleSubmit} = useForm()
//Creamos un arreglo donde guardar los inputs
const [inputs, setInput] = useState([])
//Envia... | true |
e5a74e45d5b4b4fefe4fbdac3eb771969d0e76cd | JavaScript | rexrainbow/phaser3-rex-notes | /plugins/utils/geom/circle/Circle.js | UTF-8 | 9,045 | 3.390625 | 3 | [
"MIT"
] | permissive | /**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2019 Photon Storm Ltd.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/
import Class from '../../object/Class.js';
import Contains from './Contains.js';
import GetPoint from './GetPoint.js';
import GetPoints from './... | true |
0cb5cd84af80c35ee2f9e3df1b6fa6b1f7d1de8f | JavaScript | nausik/Guessthe | /Player.js | UTF-8 | 1,914 | 3.265625 | 3 | [] | no_license | function Player(element) {
this.element = element;
this.status = false;
this.boundaries = {
start: 0,
end: 0
};
this.duration;
this.changeTrack = function (url, duration) {
this.pauseTrack();
element.src = url;
element.load();
this.duration = dura... | true |
e8743a49f26a8f1fd8cd878f75f77ae4cd27a613 | JavaScript | iongion/libamf | /src/utils/Utils.js | UTF-8 | 828 | 3.265625 | 3 | [
"MIT"
] | permissive | /**
* Construct a class using variable string
* @param {String} className
* @exports
* @returns {Object}
*/
exports.constructClass = (className) => {
class Dummy {
constructor() {}
}
return new ({ [className]: class extends Dummy { } })[className]()
};
/**
* A function to convert to a buffer... | true |
06d8f7886a9c364c7d858406d1d759ccdac42587 | JavaScript | ChristianKienle/minipress | /_packages/code-gen/src/code.js | UTF-8 | 1,166 | 2.859375 | 3 | [
"MIT"
] | permissive | // @ts-check
const Context = require('./context')
const prettify = require('./prettify')
const { EOL } = require('os')
/**
* @typedef {import('./types').Lang} Lang
*/
module.exports = class Code {
/**
* @typedef {object} Options
* @prop {Lang} [lang='js']
*/
/**
* @param {(context: Context) => (stri... | true |
99c17cc2233ed32acf8fb5de0c86ac69efeee06c | JavaScript | LightSpeedC/programming-examples | /node/json/json-parse-stringify-async/file-read-async.js | UTF-8 | 3,803 | 2.78125 | 3 | [] | no_license | // file-read-async
'use strict';
const fs = require('fs');
const INPUT_JSON_FILE = process.argv[2] || 'data.json.log';
const VARIANT = process.argv[3] || '';
const jsonStringifyAsync = require('./json-stringify-async' + VARIANT);
const jsonParseAsync = require('./json-parse-async');
async function main() {
const c... | true |
1191f7d6a95225dd5badf64a8af91d917e382129 | JavaScript | jcruz375/lista-de-To-Do | /ToDos.js | UTF-8 | 1,237 | 3.328125 | 3 | [] | no_license |
const lista = document.querySelector('#app ul')
const input = document.querySelector('#app input')
const button = document.querySelector('#app button')
var todos = JSON.parse(localStorage.getItem('list_todos')) || []
function renderizar(){
lista.innerHTML = ''
for(todo of todos){
var todoElement = d... | true |
c2197aee07db97f65fa89666804eb22e7d86324f | JavaScript | MoreSaltMoreLemon/Roughly.Recipes | /src/components/Doughnut.js | UTF-8 | 1,993 | 2.59375 | 3 | [] | no_license | import React from "react";
import { ResponsiveSunburst } from "@nivo/sunburst";
import { string } from "postcss-selector-parser";
// Make sure parent container have a defined height when using
// responsive component, otherwise height will be 0 and
// no chart will be rendered.
// website examples showcase many proper... | true |
62cc2291adc1449ec3002da303b6bb1aa3336578 | JavaScript | KseniyaShumskaya/JS | /js2.js | UTF-8 | 5,831 | 4.28125 | 4 | [] | no_license |
//1 - Дан массив целых чисел. Числа не отсортированы и могут повторяться.
// Необходимо найти в данном массиве такие два числа M и N, чтобы их сумма была равна 7.
// Например, 3 + 4 = 7 или 0 + 7 = 7 или -2 + 9 = 7 и тд.
// Для решения достаточно найти хотя бы одну подходящую пару чисел M и N.
// Подумайте над оптимал... | true |
28ac87f2a2291aabd92e49df4dc1138b0d9dd9bc | JavaScript | aaronwhyte/cave2d | /public_html/js/widgets/layeredeventdistributor2.js | UTF-8 | 4,563 | 3.65625 | 4 | [] | no_license | /**
* Listens for mouse and touch events on a canvas, and distributes them
* to one layer of listeners at a time, in layer order.
* If any listener in a layer reports that the event was handled, by returning "false",
* then that event will not be distributed to the next layer.
* @param canvas
* @param layerCount
... | true |
d65da3a53db3b110ac21799c703c2ea9363ba46a | JavaScript | szymonszoldra/fullstackopen | /part5/cypress/integration/blogapp.spec.js | UTF-8 | 4,044 | 2.890625 | 3 | [] | no_license | // custom commands can be found on /cypress/support/commands.js
describe('Blog app', function() {
beforeEach(function () {
cy.setup();
cy.visit('http://localhost:3000');
});
it('Login form is shown', function() {
cy.contains('log in to application');
cy.contains('username');
cy.contains('pass... | true |
3a4e9e11a3fd827521ae39fcfd1e11d4d165e98b | JavaScript | valdineifer/keep-to-simplenote | /index.js | UTF-8 | 1,514 | 2.8125 | 3 | [] | no_license | const fs = require('fs')
const path = require('path')
const convertKeepToSimplenote = require('./src/convertKeepToSimplenote')
const createFinalJsonFile = require('./src/createFinalJsonFile')
try {
const fullPath = path.resolve(process.argv[2])
const option = process.argv[3]
const verbose = option === '-v'... | true |
d1d3891ce773f35db5a57d40c306a6c01a91f8a2 | JavaScript | inokappa/webpage-check-sample | /spec/viewspec.js | UTF-8 | 2,456 | 2.515625 | 3 | [] | no_license | const fs = require('fs');
const fse = require('fs-extra');
const path = require('path');
const resemble = require("resemblejs");
// please write your target url to targets.js
const t = require('../targets.js');
const root = t.root;
const targets = t.targets;
for (let value of targets) {
describe(`https://${value.hos... | true |
d12c0162a711eaed836e8be985c862553e042602 | JavaScript | vitaha512/jsl | /Lesson_01/02/js/script.js | UTF-8 | 365 | 4.09375 | 4 | [] | no_license | var num = 33721;
var str = String(num);
var res = 1;
var resPow;
for (var i = 0; i <= str.length - 1; i++) {
res = res * str[i];
}
resPow = Math.pow(res, 3);
console.log( "Число: " + num + ".");
console.log( "Произведение цифр этого числа: " + res + ".");
console.log( "Возведение в степень 3: " + resPow + "."); | true |
8535aca7e5d60fed2988fb2ab4b2be7c555070b7 | JavaScript | GilbDavis/UTPScheduler | /JS/GetEmails.js | UTF-8 | 375 | 2.78125 | 3 | [] | no_license | //Espera a que el documento cargue para ejecutar el codigo
$(document).ready(function() {
var lista = document.getElementById('correosmysql');
var corr = document.getElementById('correos');
//Al elejir un correo del selector este lo copia al textbox de correos
lista.onchange = function() {
corr.value += l... | true |
6d29fa335dad8c945ecbd19a09dd86c0edff0c99 | JavaScript | MuhammadAmeen252/react-calculator | /src/App.js | UTF-8 | 10,147 | 3.46875 | 3 | [] | no_license |
//SP18-BCS-098-6AB(Muhammad Ameen)
import React from "react";
import "./App.css";
import { Button } from "react-bootstrap";
//i used bootsrap libraries by taking help from internet
import Col from "react-bootstrap/Col";
import Row from "react-bootstrap/Row";
import Container from "react-bootstrap/Container";
class A... | true |
50bfb343e6e63c7b40fdb7219063d5a37ecd9f14 | JavaScript | waffel183/Math_Examples_Website | /Orthocenter/script.js | UTF-8 | 1,113 | 2.90625 | 3 | [] | no_license | const canvas = document.getElementById("canvas");
const context = canvas.getContext('2d');
var A = new Point(100,100,10,"#0000FF");
var B = new Point(200,200,10,"#FF0000");
var C = new Point(250, 193,10,"#00FF00");
//realpoints
A.drag();
B.drag();
C.drag();
//lines between the realpoints
var ab = new Li... | true |
0ea008bfa334a52760e19f21d754785b6cc0bbd4 | JavaScript | Charlesgdl/PI | /escalaCinza.js | UTF-8 | 1,119 | 3.328125 | 3 | [] | no_license |
/*desativado
function escalaCinza(){
let largura = document.getElementById("largura").value;
let numCor = 1;
let tr = document.querySelectorAll('tr');
tr.forEach(l => {
let tamanho = tr.length;
numCor=numCor+1;
cores = String('rgb(' + numCor + ',' + numCor + ',' + numCor ... | true |
2fac4c37977cb18f3b12c4140891bc3bb56b48cb | JavaScript | enterstudio/gig.fs | /client/lib/old.channel_in_memory.js | UTF-8 | 4,439 | 2.6875 | 3 | [
"MIT"
] | permissive | /**
* GiG.fs: channel_in_memory.js
*
* Copyright (c) 2014, Stanislas Polu. All rights reserved.
*
* @author: spolu
*
* @log:
* - 2014-04-11 spolu `in_memory` mode
* - 2014-04-11 spolu Creation
*/
"use strict";
var util = require('util');
var events = require('events');
var async = require('async');
var co... | true |
290af574a8999825a34f7c76b18f915bf38223bc | JavaScript | mathew94/basic-js | /gradeMark.js | UTF-8 | 384 | 3.171875 | 3 | [] | no_license | var mark = 110;
if( mark < 60){
console.log("Grade F");
}
else if( mark <=70 ){
console.log("Grade D");
}
else if( mark <=80 ){
console.log("Grade C");
}
else if( mark <=90 ){
console.log("Grade B");
}
else if( mark <=100 ){
console.log("Grade A");
}
else if( mark > 100){
console.log("Invalid I... | true |
7231f2330c37af57576dcafa1f73fbf13e2f12c7 | JavaScript | HaqueMannan/The-Complete-Node.js-Developer-Course | /Section 8 - MongoDB and Promises (Task App)/Section 8.5 - Promises/playground/8-promises.js | UTF-8 | 1,785 | 4.25 | 4 | [] | no_license | // CALLBACK PATTERN EXAMPLE
const doWorkCallback = (callback) => {
setTimeout(() => {
// callback('This is an error!', undefined) // For an error
callback(undefined, [1, 4, 7]) // For a success
}, 2000)
}
doWorkCallback((error, result) => {
if(error) {
return console.... | true |
f60c2d748866e2147b5d21ecab193ccb65a457ba | JavaScript | Bentheburrito/adminsassistant | /commands/slowmode.js | UTF-8 | 1,147 | 2.890625 | 3 | [] | no_license | exports.aliases = ["slow", "setratelimit"];
exports.run = (client, message, args) => {
if (!message.member.hasPermission("ADMINISTRATOR")) return message.channel.send("You cannot use this command.");
let curRateLimit = message.channel.rateLimitPerUser;
// Ideally, would somehow check if it's a proper integ... | true |
2b3d43a7b3119546f9533e9607dd92afb609754b | JavaScript | chsohn15/bookliker-practice-challenge-wdc01-seng-ft-071320 | /js/index.js | UTF-8 | 4,785 | 3.125 | 3 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | document.addEventListener("DOMContentLoaded", function() {
const ul = document.querySelector('ul#list')
const showPanel = document.querySelector('#show-panel')
const url = "http://localhost:3000/books/"
fetch(url)
.then(res => res.json())
.then(books => addAllBooks(books))
function ad... | true |
164508000064308347ce013c0965124f0dd1d613 | JavaScript | kristen-howton/coffee-java-provider | /scripts/equipment/EquipmentList.js | UTF-8 | 470 | 2.75 | 3 | [] | no_license | import { equipment } from "./Equipment.js"
import { useEquipment } from "./equipmentDataProvider.js"
const contentTarget = document.querySelector(".EquipmentInformationDisplay")
export const equipmentList = () => {
const equipmentObjectArray = useEquipment()
for (const equipmentObject of equipmentObjectArr... | true |
dbb056df830e8c3f63e0f2f38e80777cab2547e2 | JavaScript | julianactrl/Video-Games-API | /api/src/routes/videogame.js | UTF-8 | 6,754 | 2.703125 | 3 | [] | no_license | require("dotenv").config();
const { GAMES_ALL, SEARCH_GAMES, GAMES_ID, API_KEY } = process.env;
const axios = require("axios");
const server = require("express").Router();
const { Videogame, Genre } = require("../db.js");
const { Op } = require("sequelize");
const { name } = require("../app.js");
// [ X ] GET /videoga... | true |
bbbbf251e5ea6c2362b06f130ffa29f37923f327 | JavaScript | cs-fullstack-2019-spring/javascript-basic-review1-cw-EnrickaM | /ex2.js | UTF-8 | 130 | 3.546875 | 4 | [] | no_license | // Exercise 2
// Ask the user for any input. Print that user input
var year = prompt("Enter your birth year");
console.log(year); | true |
3335b29549f9f308fdf94779db655f082fe43051 | JavaScript | usman-tahir/rubyeuler | /two_more_homework_problems.js | UTF-8 | 811 | 3.359375 | 3 | [] | no_license | #!/usr/bin/env node
// http://programmingpraxis.com/2015/08/04/three-homework-problems/
function sumOfSquaresOfTwoLargestInts(a,b,c) {
if (a > b) {
if (b > c) {
return (a * a) + (b * b);
} else {
return (a * a) + (c * c);
}
} else {
if (a > c) {
return (a * a) + (b * b);
} els... | true |