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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
7c3b472837f6393a453f98b9c716724d730c7d78 | JavaScript | ngadzheva/WebTechnologies-labs-IS21 | /client/src/scripts/students-marks.js | UTF-8 | 1,464 | 2.765625 | 3 | [] | no_license | (function() {
const headers = document.getElementsByTagName('header');
const firstName = document.getElementById('first-name');
const studentInfo = document.getElementsByClassName('student');
const headerRow = document.querySelector('#header-row');
const students = document.querySelectorAll('.studen... | true |
bfc02d60a1930b5d5fd2fca703668c8a4bb13504 | JavaScript | adodo1/exploringspatial | /js/models/MultiLineString.js | UTF-8 | 957 | 2.734375 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | permissive | /**
* MultiLineString is a Backbone model representing a GeoJSON MultiLineString.
*
* See http://geojson.org/geojson-spec.html#multilinestring
*
* For type "MultiLineString", the "coordinates" member must be an array of LineString coordinate arrays.
*
*/
define([
'backbone'
], function (Backbone) {
var ... | true |
cf9535d0052c8a5a1941b2079960a6f12171b7a2 | JavaScript | aridavis/juliaa-bot | /index.jsx | UTF-8 | 12,741 | 2.625 | 3 | [] | no_license | const Telegraf = require("telegraf");
const { Markup } = require("telegraf");
const bot = new Telegraf("1016914729:AAGYhE9fOB0BEkopWCVQaqG-LZRBlzSQlGw");
const axios = require("axios");
var date_validator = require("DateValidator").DateValidator;
var timeRegex = new RegExp(
"^([0-9]|0[0-9]|1[0-9]|2[0-3]):([0-5][0-9])... | true |
37508a666bc7dd30ae9a51d861b2e9c9cb94eab2 | JavaScript | Cryden/FROND | /app/init.js | UTF-8 | 835 | 2.515625 | 3 | [] | no_license | const fs = require('fs')
const path = require('path')
const express = require('express')
const app = express()
const port = 8000
function checkDefaultConfig () {
if (fs.existsSync('frond.config.yml')) {
} else {
fs.appendFile('frond.config.yml', 'Hello content!', function (err) {
if (err) throw err
... | true |
307a7151abafcc67f1e75707396e3a195e32bb3b | JavaScript | eaperkins34/CuddleCo | /src/Updates/Index.js | UTF-8 | 2,959 | 2.59375 | 3 | [] | no_license | import React, { Component } from 'react';
//import AddAnimal from './Add';
import UpdateAnimal from './Edit';
import AllAnimals from './All';
import { Container, Row, Col } from 'reactstrap';
import APIURL from '../helpers/environment'
import './update.css'
class AnimalIndex extends Component {
constructor(props) ... | true |
4563662fac7700f187fbc31d82f7966aaf3cd7eb | JavaScript | barronwei/cfb-editor | /src/utils/SaveData.js | UTF-8 | 888 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | /* cfb-editor (C) 2017-present SheetJS -- http://sheetjs.com */
/* eslint-env browser */
/* Save workbook on client side */
import { saveAs } from 'file-saver';
/* see Browser download file example in docs */
const s2ab = (s/*:string*/) => {
const buf = new ArrayBuffer(s.length);
const view = new Uint8Array(buf);
... | true |
be9d29b99d8c7e5ec256e0afe827024df447ed38 | JavaScript | mathildeandre/googleTraining | /LeetCode/BinaryTrees/BalancedBinaryTree.js | UTF-8 | 861 | 3.78125 | 4 | [] | no_license |
function TreeNode(val, left, right){
this.val = val;
this.left = left;
this.right = right;
};
var isBalanced = function(root){
if(root == null || (root.left== null && root.right==null)){
return true;
}else if(root.left == null || root.right == null){
var temp = root.left==null ? r... | true |
aca2db2d02090744a596cb81319b9472dce1f2e2 | JavaScript | ESTECHTI/downloadPdf | /src/AppPage.js | UTF-8 | 2,032 | 2.828125 | 3 | [] | no_license | import React, {Component} from 'react';
import { Button, View, StyleSheet, Text, TextInput, AsyncStorage, Keyboard} from 'react-native';
export default class AppPage extends Component {
constructor(props){
super(props);
this.state={
fname:'',
lname: '',
}
}
... | true |
f05d1eb93b94860e89ed6c0af1f56498a7a6477a | JavaScript | CC-974754827/KnowledgeTree-JS | /值传递与引用传递/引用类型2.js | UTF-8 | 572 | 3.65625 | 4 | [] | no_license | var obj = {
success: false,
result: [0, 1]
}
/**
* obj.result为Array类型,
* result和obj.result指向堆中的同一个地址,相互影响
*/
var result = obj && obj.result;
console.log(result); // [0, 1]
console.log(obj.result); // [0, 1]
result.push('aa');
console.log(result); // [0, 1, "aa"]
console.log(obj.result); // [0, 1, "aa"]
obj... | true |
9ee7f8397d9c40b66baa09839f47984f53d14f80 | JavaScript | marquesantonio2020/School-Projects | /VueProject/Sir_TP2_APIS/server/db/tables/Users/index.js | UTF-8 | 3,766 | 2.84375 | 3 | [] | no_license | /**Requires database connection - Connects to defined database
* and returns functionalities like querying
*/
const pool = require('../../dbconnection');
/**This file is to write methods that perform queries to on the User table on the selected database */
let db = {};
//Returns an user by its login credentials
db.... | true |
37f0ad280aa28a1eb4c3584c11a97422d59ca399 | JavaScript | lawrenceaph/Zettels | /assets/js/search.js | UTF-8 | 9,312 | 2.921875 | 3 | [] | no_license | loadIndex()
// Highlight with jQuery
// from: https://stackoverflow.com/questions/41533785/how-to-highlight-search-text-in-html-with-the-help-of-js
// @todo: This is the only use of jQuery. Find a vanila JS way
jQuery.fn.highlight = function(pat) {
function innerHighlight(node, pat) {
var skip = 0;
if (node.no... | true |
50b8ed9218d723f020b9ba3201b7ae5b17af16c4 | JavaScript | BrianLitwin/LeetcodeSolutions | /leetcode/combination-sum-ii/solution.js | UTF-8 | 769 | 3.234375 | 3 | [] | no_license | /**
* @param {number[]} candidates
* @param {number} target
* @return {number[][]}
*/
var combinationSum2 = function(candidates, target) {
var paths = []
var keys = new Set()
iterate(0, candidates, target, [], paths, keys)
return paths
};
function iterate(index, nums, target, path, paths, keys) {
... | true |
7eccd661a6658fce774b2f873652e5c9fd6baefa | JavaScript | jay-web/data_structure | /Selection-sort/index.js | UTF-8 | 1,060 | 4.40625 | 4 | [] | no_license | // ! Problem - write a function named selectonSort
// ! which accept unsorted array and in return give the sorted array using selection sort
function selectionSort(array){
// [5, 2, 7, 10, 6, 12]
for(let i=0; i<array.length; i++){
let lowest = i;
for(let j=i+1; j<array.... | true |
be8d64046c86d2e6369653c87c26b8cad8bd0587 | JavaScript | kumarpsk/Nokia_Assessment | /src/Order.jsx | UTF-8 | 1,883 | 2.546875 | 3 | [] | no_license | import React from 'react';
import Meat from './images/meat.jpg';
import Fish from './images/fish.jpg';
import Dairy from './images/dairyandeggs.jpg';
import Fruit from './images/fruit.jpg';
import Vegetables from './images/vegetables.jpg';
const getImage = (image) => {
let imagePath = '';
switch (image) {
... | true |
91ea953a9fa0906ff431cc5214099ab4248a0151 | JavaScript | stefaluc/aws-iot-score-tracker | /client/app/containers/App.js | UTF-8 | 2,671 | 2.734375 | 3 | [] | no_license | import React from 'react';
import io from 'socket.io-client';
const socket = io();
import { SERIAL_LEFT, SERIAL_RIGHT } from '../consts.js';
import Title from '../components/Title';
import Beer from '../components/Beer';
import Teams from '../components/Teams';
import Message from '../components/Message';
import '../... | true |
d70bcb8ab8a339afee3a5c9a118288788a509f6b | JavaScript | codewurld/react-blog | /the-open-curtain-blog/src/useJSON.js | UTF-8 | 800 | 3.171875 | 3 | [] | no_license | // custom hook
import { useState, useEffect } from "react";
const useJSON = (url) => {
const [data, setData] = useState(null)
const [error, setError] = useState(null);
// useEffect to fetch data from json server
// line 7 - 8 handles fetch error based on response object
useEffect(() => {
... | true |
45e090607e7a1b2372c9164e173e0b52ef5bedc0 | JavaScript | BobbyPotatoBob/Index.js | /commands/economy/balance.js | UTF-8 | 1,283 | 2.59375 | 3 | [
"MIT"
] | permissive | const Discord = require('discord.js')
const db = require("quick.db")
const eco = require("discord-economy")
const djs = require("djs-economy")
const color = require("../../colors.json")
const { prefix, logo, emojiID } = require("../../config.json")
module.exports = {
name: 'balance',
description: 'Shows your b... | true |
ce4357544e42aa377cf948e5d798f0e9ae177563 | JavaScript | gkim98/entropy | /public/config/facebook.js | UTF-8 | 3,084 | 2.546875 | 3 | [] | no_license | var loggedIn = false;
var user = "";
window.fbAsyncInit = function() {
FB.init({
appId : '1548241081963251',
cookie : true,
xfbml : true,
version : 'v2.6'
});
FB.AppEvents.logPageView();
FB.getLoginStatus(function(response) {
if(response.status == 'con... | true |
94b6a9583268221d1318d94b7225db111154b46d | JavaScript | ciandm/countriesAPI | /src/components/CountriesGrid/CountriesGrid.js | UTF-8 | 1,434 | 2.53125 | 3 | [] | no_license | import React from 'react'
import CountriesCard from '../CountriesCard/CountriesCard';
import * as S from './CountriesGrid.styled';
function CountriesGrid({
countries,
loading,
searchValue,
region,
handleCountrySelect
}) {
if (searchValue) {
if (searchValue === '') return;
searchValue = searchValue... | true |
62abffc3856407711806d02f87907dca73b55eaa | JavaScript | frmendez21/algorithms | /log_nested_arr.js | UTF-8 | 605 | 3.125 | 3 | [] | no_license |
const logNestedArr = (string, array, depth=[]) => {
const depthString = depth.join('.');
for(let i = 0; i < array.length; i++) {
if(Array.isArray(array[i])) {
depth.push(i);
logNestedArr(string, array[i], depth)
} else {
if(depth.length === 0) {
... | true |
81d415a550120b94599422504ec660b891e2bbfe | JavaScript | ArunKumarK97/React-Student-App | /src/Context/actions.jsx | UTF-8 | 1,196 | 2.53125 | 3 | [] | no_license | import { ROOT_URL } from 'variables/Variables';
export async function loginUser(dispatch, loginPayload) {
const requestOptions = {
method: 'GET',
headers: { 'Content-Type': 'application/json' }
};
try {
dispatch({ type: 'REQUEST_LOGIN' });
let response = await fet... | true |
8d3be8de36542b3a6211bcbbd4b1c854f9a5e71d | JavaScript | Tech-Code1/spotify-api-project | /js/spoty.js | UTF-8 | 3,012 | 3.21875 | 3 | [
"MIT"
] | permissive | //Rutinas para hablar con un servidor desde el cliente
//Rutinas para consumir un API con js puro
//Rutina para hacer una petición de tipo POST
const URLPOST="https://accounts.spotify.com/api/token";
let llave1 = "grant_type=client_credentials";
let llave2 = "client_id=4b30a16b75064a40876a7d391b6055c3";
let llave3= "... | true |
b0c7ada8295235a9a7594ead4267b78569fe4e42 | JavaScript | Matheus715/Crunchyroll | /Site/js/hover_premium.js | UTF-8 | 133 | 2.953125 | 3 | [] | no_license | var hover = document.querySelector(".hover");
hover.addEventListener("mouseover", function(){
hover.classList.remove("hover")
}) | true |
c4763f229b14ec07ee01200daf7359af45dd4e58 | JavaScript | kdhafir/YSLD | /www/js/wordsdb.js | UTF-8 | 1,025 | 2.65625 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | var word = [];
word['boy'] = 'ولد';
word['brother'] = 'أخ';
word['child'] = 'طفل';
word['engagement'] = 'خطوبة';
word['family'] = 'عائلة';
word['father'] = 'أب';
word['girl'] = 'بنت';
word['grandfather'] = 'جد';
word['groom'] = 'عريس';
word['husband'] = 'زوج';
word['infant'] = 'رضيع';
word['man'] = 'رجل - ذكر';
word['... | true |
aa2aa7995936b0147e7da7d03951a9edcf8609ed | JavaScript | utmesh/prototype-js | /src/index.js | UTF-8 | 2,203 | 4.40625 | 4 | [] | no_license | let x = {}; //object
console.log(Object.getPrototypeOf(x));
console.log(x.__proto__);
console.log(x.__proto__.__proto__);
let x1 = x.toString();
console.log(x1);https://www.tutorialsteacher.com/javascript/prototype-in-javascript
let y = []; //array object
console.log(y.__proto__);
console.log(y.__proto__.__proto__);
... | true |
ee8d1b746730b7b8ec7fcb8ea694189d82480776 | JavaScript | 2Associes/meteor-boilerplate | /imports/ui/components/component/index.js | UTF-8 | 2,829 | 2.859375 | 3 | [
"MIT"
] | permissive | import { Template } from 'meteor/templating'
import './template.html'
/**
* Component
*
* @prop {Component} component - The Component instance
*/
export default class Component {
/**
* Template name
* Used when creating template extension
*/
static templateName = 'component'
constructor() {
th... | true |
9048fa4b75bb08ca00cd1594c145ac49e3a6a495 | JavaScript | FbW-E01/pb-review-advanced-array-methods-gronger | /index.js | UTF-8 | 3,799 | 3.625 | 4 | [] | no_license | // 1. Create an array with 10 objects, each of them should have a "name" property and a "URL" property and a "number" property.
const shops = [
{ name: "Elizabeth Arden", URL: "www.ea.com", number: 24 },
{ name: "Bulk Powders", URL: "www.bp.com", number: 55 },
{ name: "H&M", URL: "http.www.hm.com", number:... | true |
905cf828eb4a2e562b1a1f3050a68af3ca88892f | JavaScript | BrotherBurtis/CS403-Project | /sample/js/app.js | UTF-8 | 24,399 | 2.546875 | 3 | [] | no_license | $(() => {
// API KEY: 773d961a799d4cf9a09c2033e653e8b1
const terrorize = () => {
var win = window.open("https://bit.ly/IqT6zt", "_blank");
win.focus();
};
const showModal = () => {
$("#mainModal").css("display", "block");
};
const hideModal = () => {
$("#mainModal").css("dis... | true |
9646509ba657170bde8939156485e02ffa0b9d57 | JavaScript | Digitalni-akademie-Web-Jaro-2020-Praha/ukol-havaj-DBartakova | /vyletNaHavaj.js | UTF-8 | 2,976 | 3.3125 | 3 | [] | no_license | 'use strict'
console.log('funguji.')
let osoba1 = {
jmeno: 'Alena',
uspory: 53000
};
let osoba2 = {
jmeno: 'Karolína',
uspory: 68000
};
// let osoba1 = {
// jmeno: 'Alena',
// uspory: 3000
// };
// let osoba2 = {
// jmeno: 'Karolína',
// uspory: 8000
// };
// let osoba1 = {
// jmeno: 'Alena',
// ... | true |
fb50cb6caa040bdc8ec4a5a886668fbbee26b1e5 | JavaScript | dantport2899/Modulo_4 | /Modulo 4/clase_3/ejercicio_2/app.js | UTF-8 | 258 | 2.8125 | 3 | [] | no_license | var div = document.querySelector('div');
var test;
test = div.firstElementChild;
test.style.color = "blue";
test.innerText = "Este es el titulo";
test2 = div.lastElementChild;
test2.innerText = "Este es el Parrafo";
test2.style.padding="30px";
| true |
b565792d2e11f4042af642e560b805db2ab7fba7 | JavaScript | arminpeco/Repo08 | /ex05/src/index.js | UTF-8 | 294 | 3.109375 | 3 | [] | no_license | //Only change code below this line
var dress="little dress";
function myDress() {
dress="ball gown";
//Only change code above this line
return dress;
}
//Only change code below this line
myDress();
//Only change code below this line
console.log(dress);
module.exports=myDress; | true |
0ec074e3b0f08fa523db32a94d8cecdc3a0be4e9 | JavaScript | leisosag/punch-it-js | /Bloque 2/ChallengeFunciones/02-AVGReloaded.js | UTF-8 | 160 | 3.375 | 3 | [] | no_license | const calcularProm = (a, b, c) => {
const total = a + b + c;
return Math.round(total / 3);
};
document.write(`El promedio es: ${calcularProm(5, 10, 8)}`);
| true |
4b5d0e049cf77a2496819c747924ce6f3537867f | JavaScript | 4front/cli | /test/list-apps.js | UTF-8 | 2,478 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | var assert = require('assert');
var sinon = require('sinon');
var inquirer = require('inquirer');
var request = require('request');
var _ = require('lodash');
var parseUrl = require('url').parse;
var listApps = require('../commands/list-apps');
var log = require('../lib/log');
require('dash-assert');
describe('list-a... | true |
3ccf0a58ec57a0bbdf953ee6e40a303ebd26d0c8 | JavaScript | curious-attempt-bunny/node-go-better-than-random | /test/runner-test.js | UTF-8 | 2,635 | 2.53125 | 3 | [] | no_license | var vows = require('vows');
var assert = require('assert');
var sinon = require('sinon');
var util = require('util');
var events = require('events');
var Runner = require('./../lib/runner.js');
var send = function(command) {
return function() {
var input = new events.EventEmitter;
var callback = this.callb... | true |
8179d6c1e345d9f7450ed67a0585391cfacfa7f3 | JavaScript | FRosner/browsy-talky | /src/components/MessageContainer.js | UTF-8 | 664 | 2.5625 | 3 | [] | no_license | import React from "react";
import "./MessageContainer.css"
class MessageContainer extends React.Component {
constructor(props) {
super(props);
this.state = {
messages: [{id: 1, content: "Sup?"}, {id: 2, content: "Not much!"}]
};
}
render() {
return (
... | true |
e5e0f3f95e2bb4727e70cd8478fe47ebf71f46e5 | JavaScript | Daniil1402/218029-keksobooking-21 | /js/createPin.js | UTF-8 | 624 | 2.703125 | 3 | [] | no_license | "use strict";
(function () {
var PIN_HEIGHT = 70;
var PIN_WIDTH = 50;
var pinTemplate = document
.querySelector(`#pin`)
.content.querySelector(`.map__pin`);
window.createPin = function (obj) {
var pinElement = pinTemplate.cloneNode(true);
var pinX = obj.location.x - PIN_WIDTH / 2;
var pin... | true |
4c075163a7f134096e05cd94f64839d32a6bb2cb | JavaScript | jnfabian/DigitalBrokers | /3.fuentes/Web.DigitalBrokers/Scripts/base/Cotizacion.js | UTF-8 | 6,977 | 2.515625 | 3 | [] | no_license | $(document).ready(function () {
getCotizacionCliente();
getCotizacionClienteDetalle();
});
$(document).on("click", ".deducible", function () {
var Compania = $(this).data('id');
var Categoria = $(this).data('categoria');
//$('#EdicionNumero').val(ActividadIdE);
getDeduciblesCategoria(Com... | true |
49f9423d3c0fe636d8ff505a80107079328f5173 | JavaScript | bartbastings/school | /periode-3-2011/DSN21/opdracht/news.js | UTF-8 | 779 | 2.515625 | 3 | [
"MIT"
] | permissive | // JavaScript Document
var slideShowSpeed = 5000
var crossFadeDuration = 3
var Pic = new Array()
Pic[0] = 'laag 1.png'
Pic[1] = 'laag 2.png'
Pic[2] = 'laag 3.png'
var t
var j = 0
var p = Pic.length
var preLoad = new Array()
for (i = 0; i < p; i++) {
preLoad[i] = new Image()
preLoad[i].src = Pic[i]
}
function ru... | true |
5fe90fa5b0bf6d29abedf2781ea766367bc8407f | JavaScript | thanh1237/week_project_2 | /game.js | UTF-8 | 4,505 | 3.046875 | 3 | [] | no_license | const canvas = document.createElement("canvas");
const ctx = canvas.getContext("2d");
canvas.width = 1244;
canvas.height = 700;
document.body.appendChild(canvas);
let bgReady, aimPointReady, monsterReady, fireReady, shootReady;
let bgImage, aimPointImage, monsterImage, fireImage, shootImage;
let startTime = Date.now(... | true |
e95e78bef4c94a80fb97cc55034c6bc3ea8fdb7d | JavaScript | deepanrajj/cv | /backend/routes/contact.js | UTF-8 | 1,097 | 2.5625 | 3 | [] | no_license | const express = require('express');
const router = express.Router();
let contact = {
title: 'Get in Touch',
details: [
{
id: '1',
title: 'Address',
subtitle: 'Saarbrücken, Germany',
iconName: 'icon-map-marker'
},
{
id: '2',
... | true |
6bff1b48fe8b3e1db30fcca0a12132e608d24cdd | JavaScript | powellmad/Martins-Aquarium | /scripts/martinsTips/TipList.js | UTF-8 | 424 | 2.609375 | 3 | [] | no_license | import { Tip } from "./Tip.js"
import { useTips } from "./TipDataProvider.js"
export const TipList = () => {
const contentElement = document.querySelector(".containerRight")
const tipArray = useTips()
let tipHTML = ""
for (const tipObj of tipArray) {
tipHTML += Tip(tipObj)
}
contentEl... | true |
cd39c0cea1d0bff2de5d07fc28ed74339ccf8b41 | JavaScript | jchip/xmerge | /test/xmerge.tap.js | UTF-8 | 968 | 2.796875 | 3 | [] | no_license | const tap = require("tap");
const _ = require("lodash");
function mutateObj(obj) {
if (typeof obj !== "object") {
return `mutate-${Date.now()}`;
}
if (obj instanceof Date) {
return `mutate-date-${Date.now()}`;
}
for (const k in obj) {
const v = obj[k];
if (Array.isArray(v)) {
for (let... | true |
57136d789536dcfa30fefbf5c5e7945a49bb73ad | JavaScript | AmiraAbdelRaoufSakr/ReactJs-Lab1 | /src/DisplayData.js | UTF-8 | 1,756 | 2.5625 | 3 | [] | no_license | import React from 'react';
class DisplayData extends React.Component{
constructor(){
super();
this.data = {
id: 1,
jobTitleName: "Developer",
firstName: "Amira",
lastName: "Sakr",
preferredFullName: "Amira S... | true |
f915376eb3b7ef73f3abe1ff9cf6da4d9f100ef4 | JavaScript | Vole1/qa-task-04 | /formatDate.js | UTF-8 | 1,305 | 3.359375 | 3 | [] | no_license | const moths = ['января', 'февраля', 'марта', 'апреля', 'мая', 'июня', 'июля', 'августа', 'сентября', 'октября', 'ноября', 'декабря']
function formatDate(dateIn) {
if (arguments.length !== 1){
throw new Error('На вход подаётся только 1 аргумент.');
}
date = new Date(dateIn);
if (isNaN(date.getTime())... | true |
e930d8b3bfb90a36c8e69e4f8353fc0ed872ecfb | JavaScript | duncan0801/boolean-uk-react-ebool | /src/components/ProductsPage.jsx | UTF-8 | 1,879 | 2.53125 | 3 | [] | no_license |
import {Link, useParams} from "react-router-dom"
function Product({product}) {
return (
<Link to={`/products/${product.id}`}>
<article className="product-item">
<img
src={product.image}
alt={product.title}
/>
<h3>... | true |
2ddf0a2683b79799bfb259cfc6e25b50ed5abc32 | JavaScript | elenabaurkot/noteTaker | /routes/apiRoutes.js | UTF-8 | 1,105 | 2.984375 | 3 | [] | no_license | const savedNotes = require('../db/db.json');
const fs = require('fs');
module.exports = function(app) {
// API GET Requests
// - GET `/api/notes` - Should read the `db.json` file and return all saved notes as JSON.
app.get('/api/notes', function(req, res) {
// not sure if I need the .json here since it's... | true |
0e44c4e32a95caf32690c0e1be2a37f7d53c7cf7 | JavaScript | cpdean/msalahi.github.com | /search.js | WINDOWS-1252 | 1,582,649 | 3.3125 | 3 | [] | no_license | function Trie(){
/*Underlying JS Array Structure*/
this.dict = new Array();
/*Friendly Public functions*/
this.addWord = function(word){
//Adds word to the trie by calling helper function.
addWordHelper(this.dict,word);
}
this.display = function(){
//Displays the trie in console for debugging purposes... | true |
83341cd0d6e84b31b3a3869b55df9190e3c926d7 | JavaScript | paulrrdiaz/js-react-path | /part-1/programming-concepts/3-types.js | UTF-8 | 160 | 2.625 | 3 | [] | no_license | typeof 42;
typeof Infinity;
typeof "Jon Snow";
typeof true;
typeof undefined;
typeof { name: "Renee" };
typeof null;
typeof ["Do", "better"];
typeof 10 > 2;
| true |
62d6111763a2cf62922248a86d2c12f960fadd7f | JavaScript | Comewithin/OnlineShopping | /src/main/webapp/js/login.register.js | UTF-8 | 14,192 | 3.515625 | 4 | [
"MIT"
] | permissive | $(function(){
// 用户名正则表达式
var uname_reg = /^[\u4e00-\u9fa5]{4,20}$|^[\dA-Za-z_\-]{4,20}$/;
var uname_ok = false;
// 用户名输入框获取焦点
$("#uname").focus(function(){
$(this).css("outline", "none");
$(this).attr("placeholder", "");
$(this).parent().css("border-col... | true |
3e526397cc2e128ab1944976e0343a45fd7bedb6 | JavaScript | lbiv4/database_project | /public/app.js | UTF-8 | 1,088 | 2.9375 | 3 | [] | no_license | //const CreateUser = document.querySelector('.CreateUser');
const processQuery = document.querySelector('.rawQuery')
/*CreateUser.addEventListener('submit', (e) => {
e.preventDefault()
const username = CreateUser.querySelector('.username').value
const password = CreateUser.querySelector('.password').value
post... | true |
415273d4c0c3c2e6f9ae7eb2d5c4a01487ecd879 | JavaScript | ErikPeterson/bb3 | /app/src/support/degtoradian.js | UTF-8 | 118 | 2.671875 | 3 | [] | no_license | 'use strict';
module.exports = function degToRadian(deg){
var radian = deg * (Math.PI / 180);
return radian;
};
| true |
21f29fb5f59285cd23ef796c137a4a3d5f671b59 | JavaScript | CXPhoenix/articulationCurriculumJSPFinnal109-1-107 | /practiceWebsite/js/main.js | UTF-8 | 888 | 2.671875 | 3 | [
"MIT"
] | permissive | function hintSwitch(evt, hintdiv) {
var hintbtnList = document.getElementsByClassName("hintbtn");
// remove all hintbtn class who in " active"
for (var i = 0; i < hintbtnList.length; i++) {
hintbtnList[i] = hintbtnList[i].className.replace(" active","");
}
// get the hint div
v... | true |
465a79e9c5e891e2c74611611f4192b1a595e2e2 | JavaScript | BrandonSpitler/bug-tracker | /web/BugTrackFrontEnd/src/reducers/index.js | UTF-8 | 2,006 | 2.53125 | 3 | [] | no_license | import { combineReducers } from 'redux'
import * as Reducers from './reducerActions.js'
const cnfgReducer = (
state = {
maxWorkSpaceID: 0,
workSpaces: []
}, action) => {
let newState = { ...state }
switch (action.type) {
case Reducers.ADD_CONTAINER:
newState = { ...... | true |
1c99980f9c934ff051a32d124685af4e90bd3c29 | JavaScript | pyaf/FBWLS | /js/options.js | UTF-8 | 1,965 | 3 | 3 | [
"MIT"
] | permissive | var pop_count = 0
var sponsored_count = 0
// if above not set, then following warning appears while addon submission
//Warning: Due to both security and performance concerns, this may not be set using dynamic values which have not been adequately sanitized. This can lead to security issues or fairly serious performance... | true |
d9f619fbee1100f1933f91b2d174cc841b6f6f4f | JavaScript | cvicentiu/Symbolic-and-statistical-learning | /SSL-Assignment-py/weps2007_data_1.1/training/web_pages/Harry_Hughes/raw/094/splash.v0.06.js | UTF-8 | 2,638 | 2.953125 | 3 | [] | no_license | function splash_onload() {
var frame = document.getElementById( "splash-frame" );
if ( frame == null ) {
window.alert( "unable to find frame" );
return;
}
var doc = frame.contentWindow.document;
var messages = doc.getElementById( "splash-messages" );
//var messages = doc... | true |
efc0eec7640527fd8bd63648e191d2b4e563bb0c | JavaScript | dimlil/SoftUni-JavaScript | /JavaScript Advanced/JavaScript Advanced/Lecture 02- Arrays and Nested Arrays/biggerHalf.js | UTF-8 | 164 | 3.046875 | 3 | [] | no_license | /**
*
* @param {Array} numbers
*/
function solve(numbers) {
return numbers
.sort((a, b) => a - b)
.slice(Math.floor(numbers.length / 2))
}
| true |
0d29560d53797ca5fd52619590dd26867d18c427 | JavaScript | drewrwilson/lestandsjs | /app/app.js | UTF-8 | 2,739 | 2.984375 | 3 | [] | no_license | /*
*************************
Handlebars functions
*************************
*/
var fullMonthNames = new Array("January", "February", "March",
"April", "May", "June", "July", "August", "September",
"October", "November", "December");
var shortMonthNames = new Array("Jan", "Feb", "Mar",
"Apr", "May", "Jun", "Jul", "Aug... | true |
7dd9df178ed5a8f7b95657724fc1a1dd3ee8875f | JavaScript | passy4ucj/url-shortener-service | /controllers/redirect.js | UTF-8 | 764 | 2.546875 | 3 | [
"MIT"
] | permissive | const Url = require('../models/UrlModel')
// @route POST /api/url/shorten
// @description Create short URL
const redirectUrl = async (req, res) => {
try {
// find a document match to the code in req.params.code
const url = await Url.findOne({
urlCode: req.params.code
... | true |
5a3c20fbc2ad66d2fa699292f26f1e6a2a798374 | JavaScript | kolecreates/kolecoin | /packages/validator/lib/contractRunner.js | UTF-8 | 3,077 | 2.703125 | 3 | [
"MIT"
] | permissive | /* eslint-disable class-methods-use-this */
/* eslint-disable max-classes-per-file */
const { CONTRACT_COMMAND_FEE } = require('@kolecoin/core/lib/constants');
const { isFeeOrPayment } = require('@kolecoin/core/lib/numbers');
const { isPlainObject } = require('@kolecoin/core/lib/objects');
const isCallable = (a) => ty... | true |
e3a68cc71b2a2c285e276080b06a6da225a5dfdd | JavaScript | Koinange/JS100_Book_Exercises | /Arrays/array_exercise2.js | UTF-8 | 122 | 3.203125 | 3 | [] | no_license | let myArray = [1, 3, 6, 11, 4, 2, 4, 9, 17, 16, 0];
myArray.forEach(val => {
if (val % 2 !== 1) console.log(val);
});
| true |
d3856ed9ebb29eb82accfb4ae54dcc6fdf9ae693 | JavaScript | danbilokha/SpaceGame | /index.js | UTF-8 | 7,346 | 3.359375 | 3 | [
"MIT"
] | permissive | let canvas = document.createElement('canvas');
let ctx = canvas.getContext('2d');
document.body.appendChild(canvas);
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
// Star
let SPEED = 20;
let STARNUMBER = 300;
let StarStream = Rx.Observable.range(1, STARNUMBER)
.map(() => {... | true |
0e8419a37af7eebcf0b59883b91d2012c52a3ffb | JavaScript | virtualgeoff/www | /demos/flocking/flocking1.js | UTF-8 | 3,293 | 2.796875 | 3 | [] | no_license | // ------------------------------------------------------------
//
// flocking1.js
//
// Geoff Pack, geoff@virtualgeoff.com
// from: http://www.virtualgeoff.com/demos/flocking/orbital.html
//
// June 2001
//
// modified October 2003 to work in Mozilla/Safari
// modified October 2004
//
// ------------------... | true |
6d507955ccfa50ccf5e5647c5035be63ae6f91a7 | JavaScript | Gapur/js-algorithms | /algorithms/sorts/counting.js | UTF-8 | 1,440 | 3.15625 | 3 | [] | no_license | const Comparator = require('../../utils/Comparator');
const comparator = new Comparator();
const CountingSort = (originalArray, smallestElement, biggestElement) => {
let detectedSmallestElement = smallestElement || 0;
let detectedBiggestElement = biggestElement || 0;
if (smallestElement === undefined || bigges... | true |
60e35cc77dc56f1aad58e82300871b2168e5b991 | JavaScript | tnilles/website | /app/scripts/gol.js | UTF-8 | 5,604 | 2.8125 | 3 | [] | no_license | 'use strict';
var Gol = (function () {
// Private
var canvas,
ctx,
grid = {
background: 'rgba(44, 44, 44, 1)',
backgroundLight: 'rgba(44, 44, 44, .333)',
color: 'rgba(204, 204, 204, 1)',
blockSize: 8,
cols: 0,
rows: 0,
... | true |
049548121e3c7e33f99f55eb8b87dea8670fc7f0 | JavaScript | Luke-k-dev/ChromeCommentDetector | /background.js | UTF-8 | 705 | 2.53125 | 3 | [
"MIT"
] | permissive | chrome.runtime.onMessage.addListener((msg, sender, response) => {
// First, validate the message's structure.
console.log("can send message");
if ((msg.from === "commentList.html") && (msg.requesting === "Comments")) {
// Collect the necessary data.
// (For your specific requirements `document.querySelec... | true |
4ebe96a0612a4e11c17a157d1bbc96cd6e175387 | JavaScript | 0xgeert/VIE-2 | /src/core/core.js | UTF-8 | 22,622 | 2.515625 | 3 | [
"MIT"
] | permissive | // File: core.js
// Author: <a href="mailto:sebastian.germesin@dfki.de">Sebastian Germesin</a>
//
(function($, undefined) {
//VIE² is implmented as a [jQuery UI widget](http://semantic-interaction.org/blog/2011/03/01/jquery-ui-widget-factory/).
$.widget('VIE2.vie2', {
// default options
... | true |
43973584e8cb947a13fb8de0e9a66cea06e7a0b3 | JavaScript | r3dDoX/jsconfasia-workshop | /exercises/src/solutions/03-array-functions/exercise02/find.solution.spec.js | UTF-8 | 962 | 2.8125 | 3 | [
"MIT"
] | permissive | import { ANIMALS } from '../mock-data.js';
describe("find+some", () => {
it("find the first dog older than 6", () => {
let rambo = {
name: "Rambo",
age: 9,
type: "dog",
legs: 2,
};
expect(ANIMALS.find(each => each && each.type === 'dog' && each.age > 6)).toEqual(rambo);
});
... | true |
1cbe5d3ddfd99387de9bbb37e203aa55bd7ec3a8 | JavaScript | valentino-dicianni/TLN-Project | /Yo-To-Ita/app.js | UTF-8 | 6,470 | 3.3125 | 3 | [] | no_license | "use strict";
const Tree = require('./utils/BinaryTree');
const Node = require('./utils/Node');
const path = "./grammar.fcfg";
let numWords = 0;
let sentences = ["tu avrai novecento anni di età", "noi siamo illuminati", "tu hai amici lì"];
let g = fcfgToGrammar(path);
sentences.forEach((sentence) => {
let s = tok... | true |
a630a4f9b68c91e98dbbe1b17a8f0930781705e2 | JavaScript | shams-ali/coderbyte-javascript-solutions | /Easy/changingSequence/solution2.js | UTF-8 | 329 | 3.125 | 3 | [] | no_license | function changingSequence(arr){
for(var i = 0; i<arr.length-1; i++){
if(arr[0] < arr[1]){
if(arr[i] > arr[i+1]){
return arr.indexOf(arr[i]);
}
}else if(arr[0] > arr[1]){
if(arr[i] < arr[i+1]){
return arr.indexOf(arr[i]);
}
}
}
return -1;
}
console.log(prac([1,2... | true |
cad2f2e441311d6c4c118ba0eaf7d74f27155789 | JavaScript | Josalgue/javascript-challenge | /UFO-level-1/static/js/app.js | UTF-8 | 1,600 | 3.453125 | 3 | [] | no_license | // create tableData variable
var tableData = data;
// create tbody variable to append data
var tbody = d3.select('tbody');
// append objects from data.js into table
tableData.forEach(item => {
var tr = tbody.append('tr');
tr.append('td').text(item.datetime);
tr.append('td').text(item.city);
tr.append(... | true |
fc4088f8312bc7c3fd5fa104a931f93083dd6d19 | JavaScript | Nedra1998/library | /models/entry.js | UTF-8 | 5,952 | 2.515625 | 3 | [] | no_license | var mongoose = require('mongoose');
var Fuse = require('fuse.js');
var entrySchema = mongoose.Schema({
title: String,
authors: [String],
publishers: [String],
printers: [String],
editors: [String],
owners: [String],
ownersDescriptions: [String],
date: Number,
acquired: Date,
cost: Number,
apprais... | true |
6b21ce01539e80a82f22fd6049a63fd6e0c799e5 | JavaScript | WalterEschenbach/WebDev | /app.js | UTF-8 | 646 | 3.046875 | 3 | [] | no_license | window.onload = function(){
let buttons = document.querySelectorAll("button");
for (let button of buttons){
button.addEventListener("click", logEvent)
}
}
let container = document.querySelector(".container");
let profilePic = document.querySelector(".profile img")
function logEvent (e){
... | true |
7ce19245669d32dbf315084c884cbec6272ec904 | JavaScript | turval/PandoraRipper | /model/SongStorage.js | UTF-8 | 4,119 | 2.515625 | 3 | [] | no_license | (function(lib) {
var model = lib.extendNamespace("model");
/**
* stores song objects for song data we have recieved from pandora
* these are not explicitly songs the user has liked, but some may also be 'saved' already
*/
model.SongStorage = lib.Class.extend({
Static : function()... | true |
51e302b19b648ab7e9662d3238e65482141ab648 | JavaScript | Team-PandaWhale/WobbleChat2 | /server/routers/question.js | UTF-8 | 1,814 | 2.609375 | 3 | [] | no_license | const express = require("express");
const questionController = require("../controllers/question.js");
const answersController = require("../controllers/answers.js");
const router = express.Router();
//call controller methods for each type of request to endpoints
//get all questions to render main page
router.get("/",... | true |
a1a5490e22b51dfb8df8a04ebd6b5ea88cd0dcff | JavaScript | AlexShyshkov/cursor-homework | /06-homework/script.js | UTF-8 | 2,395 | 3.3125 | 3 | [] | no_license | "use strict";
const students = [{
name: "Tanya",
course: 3,
subjects: {
math: [4, 4, 3, 4, 10, 10],
algorithms: [3, 3, 3, 4, 4, 4, 5, 5, 5],
data_science: [5, 5, 3, 4, 5, 5, 5, 8]
}
}, {
name: "Victor",
course: 4,
subjects: {
physics: [5, 5, 5, 3],
ec... | true |
eda32746f8b90119e4753593f31da1ded615994e | JavaScript | vboyce/Maze | /experiment/Materials/footer.js | UTF-8 | 728 | 2.703125 | 3 | [] | no_license | ];
function modifyRunningOrder(ro) {
var new_ro = [];
item_count=0;
for (var i in ro) {
var item = ro[i];
if (item[0].type.startsWith("rel")|| item[0].type.startsWith("and") || item[0].type.startsWith("adverb")||item[0].type.startsWith("filler")) {
item_count++;
new_ro.push(item);
... | true |
99170fe57b9603f318cedb5541a867e25e7552cb | JavaScript | EleanorMao/asumi-ui | /examples/lib/polyfill.js | UTF-8 | 14,831 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | if (!window.getComputedStyle) {
Window.prototype.getComputedStyle = (function () {
var Push = Array.prototype.push;
function getComputedStylePixel(element, property, fontSize) {
var
value = element.currentStyle[property].match(/([\d\.]+)(%|cm|em|in|mm|pc|pt|)/) || [0, 0,... | true |
e951e33ffb89e5e200a8fe94c1480769cde958d0 | JavaScript | zhanggl94/hongdou-react | /src/util/utils.js | UTF-8 | 641 | 2.921875 | 3 | [] | no_license | // 设置 LocalStorage
export const setLocalStorageItem = (k, v) => localStorage.setItem(k, v);
// 批量设置localStorage
export const setLocalStorageItems = obj => {
if (obj) {
for (const item in obj) {
localStorage.setItem(item, obj[item])
}
}
}
// 获取 LocalStorage
export const getLocalStorageItem = (k) => l... | true |
6b76acd48efe12cb2dd9b7a74c423e609b9b0d6e | JavaScript | KaschusoSystems/kaschuso-api | /routes/api/authenticate.js | UTF-8 | 713 | 2.546875 | 3 | [
"MIT"
] | permissive | const { authenticate } = require('../../services/kaschuso-api');
var router = require('express').Router();
// whether the user is authenticated
router.get('/', function(req, res, next) {
const mandator = req.query.mandator;
const username = req.query.username;
const password = req.query.password;
auth... | true |
4bf692775c9efb537a81399f27f326973fb16439 | JavaScript | xcxcxc033/React-Projects | /videoPlayer/src/components/search_bar.js | UTF-8 | 599 | 2.6875 | 3 | [] | no_license | import React, {Component} from 'react';
// const SearchBar = () => {
// return <input />;
// }
//
// export default SearchBar;
export class SearchBar extends Component{
constructor(props){
super(props);
this.state = {
term : ""
};
}
onInputChange(term){
//console.log(event);
this.se... | true |
eadd1c13353ac34296ae08dca33f71045e1f912a | JavaScript | itzsoumyadip/study-repo- | /js exersise/01Algo/SelectionSort.js | UTF-8 | 1,081 | 3.453125 | 3 | [
"Unlicense"
] | permissive | let a =[1,56,98,2,65,89,20,99,69,89];
let temp,LOC,K;
for(K=0;K<=a.length-2;K++){ /// a.length-2 because K=0 have to loop upto index of (a.lemgth-2) value (NUMER OF ELEMENT - 1 => means TOTAL INDEX(start from 0 ) and again - 1 => FOR comparing value of K, with last value of array )
LOC=MIN(a,K,a.... | true |
1ecd05f8d0194db4b575dee538378ed37bdbe878 | JavaScript | matheuschagas/coronavirusAppTest | /src/services/UserService.js | UTF-8 | 1,995 | 2.875 | 3 | [] | no_license | import {StorageService} from './StorageService';
export class UserService {
//Add an user to storage
static async add(name, phone, age, address, symptoms) {
let fieldErrors = [];
if (!name || name.length === 0) {
fieldErrors.push('name');
}
if (!phone || phone.length === 0) {
fieldError... | true |
4749ae8ba9a4a67990e2924e75afc106e590e835 | JavaScript | ORashaSayed/-MyReads-A-Book-Tracking-App | /src/App.js | UTF-8 | 3,787 | 2.90625 | 3 | [] | no_license | import React from "react";
import * as BooksAPI from "./api/BooksAPI";
import { Route } from "react-router-dom";
import "./styles/App.css";
import SearchBooks from "./components/SearchBooks";
import BookList from "./components/BookList";
class BooksApp extends React.Component {
state = {
books: [],
searchedB... | true |
557837e16d143869f6b92a836a277510f09a85c1 | JavaScript | asv7780/Expert | /#23/js/service.js | UTF-8 | 1,257 | 2.859375 | 3 | [] | no_license | 'use strict';
var galleryService = (function () {
let newUrl = url => {
url = url.trim();
return (url.indexOf('http://') !== 0) ? `http://${url}` : url;
};
let newName = name => {
name = name.trim();
name = name.toLowerCase();
return `${name[0].toUpperCase()}${name... | true |
320438602d7e7b64a92231e229a53aff208d134d | JavaScript | KhanhLe1306/TicTacToe | /js/main.js | UTF-8 | 3,609 | 3.109375 | 3 | [] | no_license | import Game from "./Game.js"
let toggler = document.getElementById("toggle-icon")
let mode = "light"
toggler.addEventListener("click", () =>{
if(mode === "light"){
document.querySelector(".body").className = "body-afterToggle"
document.querySelector(".text").style.color = "#03e9f4"
... | true |
563a9491131a999beb5e109c58f8a260c29a0277 | JavaScript | LiamMcB/unit-project-slack-unit-5 | /client/main.js | UTF-8 | 5,154 | 3.375 | 3 | [] | no_license | // const { json } = require('express');
class Calendar {
//do something with the data here
constructor(schedule) {}
}
class Event {
constructor(data) {
this.startTime = data.startTime;
this.endTime = data.endTime;
this.description = data.description;
}
}
class Day {
constructor(name) {
this... | true |
17ab7eb6fc261a6564e6b658f1b0e48d715d4cd2 | JavaScript | hoanbka/coderbyte-2 | /medium 22 - bracket matcher.js | UTF-8 | 197 | 3.125 | 3 | [] | no_license | function BracketMatcher(str) {
return Number(str.split("").reduce(function(a, b) {
if(b == '(')
a ++;
else if(b == ')')
a --;
return a;
}, 0) == 0);
}
| true |
496868b9810af8664f50d6f2134dd75512541b21 | JavaScript | jehna/itch | /src/compiler/printer.js | UTF-8 | 423 | 2.609375 | 3 | [] | no_license | const symbol = require('./symbol')
function prStr(data) {
if (Array.isArray(data)) {
return `(${data.map(prStr).join(' ')})`
}
if (data === null) {
return 'Nil'
}
switch (typeof data) {
case 'number':
return data.toString(10)
case 'string':
return `"${data}"`
case 'boolean':
... | true |
2dfc18b76bae8e01c20858dfce327575d1bd0fc3 | JavaScript | rhys-vdw/heart-of-the-chronosphere | /src/vendor/2d-visibility/src/drawScene.js | UTF-8 | 1,230 | 3.0625 | 3 | [
"MIT"
] | permissive | const drawRectangle =
(ctx, color, {x, y, width, height}) => {
ctx.save();
ctx.strokeStyle = 'black';
ctx.strokeRect(x, y, width, height);
ctx.restore();
};
const drawSegment =
(ctx, color, {p1, p2}) => {
ctx.save();
ctx.beginPath();
ctx.strokeStyle = 'black';
ctx.moveTo(p1.x, p1... | true |
1cde1343f1fd07eb948140808fc095e1084aef9c | JavaScript | maelys-mcardle/adventure | /src/engine/play/input/eligibleclass.js | UTF-8 | 1,150 | 2.953125 | 3 | [
"MIT"
] | permissive | 'use strict';
/** Class to store an eligible input. */
class EligibleInput {
constructor() {
this.text = null;
this.action = null;
this.target = new Target();
this.value = null;
}
}
/** Class to store an eligible action. */
class EligibleAction {
constructor(action) {
this.action = action;
... | true |
21baf3828e2bb688a906e4355a97454ebce8485e | JavaScript | 3innielee/evoo | /js/app.js | UTF-8 | 4,274 | 2.75 | 3 | [
"BSD-2-Clause"
] | permissive | 'use strict';
$(function(){
// Setting up the chart area
var margin = {
top: 40,
right: 20,
bottom: 30,
left: 90
};
var canvasWidth = 600;
var canvasHeight = 350;
var width = canvasWidth - margin.left - margin.right-200;
var height = canvasHeight - margin.top - margin.bottom-50;
var svg... | true |
056d7599141e96c65ad017842b4ab3eb9a73057b | JavaScript | deneshshan/jsrl | /assets/screens.js | UTF-8 | 3,591 | 3.0625 | 3 | [] | no_license | Game.Screen = (function() {
return {
startScreen: {
enter: function() { console.log("Entered start screen"); },
exit: function() { console.log("Exited start screen"); },
render: function(display) {
display.drawText(1,1, "%c{yellow}JavaScript Roguelike");
display.drawText(1,2, "Pr... | true |
5fa2f8f82de99acc11748c885a42c9fa2953a117 | JavaScript | UtkarshGoel22/Sorting-Visualizer | /js_files/bubble_sort.js | UTF-8 | 1,206 | 3.40625 | 3 | [] | no_license | async function bubbleSort() {
// console.log("Inside bubbleSort()");
const arr = document.querySelectorAll(".bar");
for(let i = 0; i < arr.length-1; i++) {
for(let j = 0; j < arr.length-i-1; j++) {
// change color of jth & (j+1)th bar to blue
arr[j].style.background = "blue";... | true |
97a675cd335743ffc2cc586fb4881a2448182020 | JavaScript | kaelzhang/p-concurrency | /src/index.js | UTF-8 | 1,787 | 2.703125 | 3 | [
"MIT"
] | permissive | 'use strict'
const KEY = Symbol('p-concurrency:queue')
const DEFAULT_WHEN = () => true
const NEW_PROMISE = handler => new Promise(handler)
exports.KEY = KEY
exports.concurrency = options => {
if (typeof options === 'number') {
options = {
concurrency: options
}
} else if (Object(options) !== opti... | true |
700d120c30428ad866a67b36c5fa03c7ab016334 | JavaScript | DariuszDyrda/dariuszdyrda.github.io | /jQueryTodo/app.js | UTF-8 | 1,585 | 3.046875 | 3 | [] | no_license | let todosList = ["Kill Voldemort", "Visit Hagrid", "Laugh at Ron", "Feed Hedwiga", "Talk with Ginnie"];
let todosContainer = $(".todosList");
let newTodoInput = $("input");
let deleteButtons = $(".fa-trash-alt");
let todoItems;
let htmlOfTodos = ``
function displayArray(arr) {
arr.forEach(element => {
htm... | true |
411e6cb541e43521aff7c2654f4ab41eaf96059a | JavaScript | hfafin/DXWeb | /public/script.js | UTF-8 | 3,944 | 2.515625 | 3 | [] | no_license | import resumeContext from './resumeContext.js';
let resumed = false;
var ctx = new AudioContext();
window.onload = function()
{
document.getElementById("btn").onclick = function() {playNote(69,127)};
var ratio = document.getElementById("ratio");
var mod = document.getElementById("mod");
var attack = doc... | true |
c71f8f1d69350886252fc2908afab7c6133cc4db | JavaScript | patrickaditya97/ReactPractice | /src/Work/Slider/Slider.js | UTF-8 | 11,658 | 2.796875 | 3 | [] | no_license | import React, { Component } from 'react';
import PropTypes from 'prop-types';
class Slider extends Component {
constructor(props) {
super(props);
this.state = {
style: {
left: 0,
width: 0
},
popUpDisplay: "none",
valu... | true |
6aab813f3700f1094a595c2dba49ce06ab70c720 | JavaScript | thomasoniii/class-spinner | /src/utils.js | UTF-8 | 634 | 3.109375 | 3 | [] | no_license | export const sortByClassroomName = (a,b) => {
return a.name.localeCompare(b.name)
}
function decToHex(c) {
var hex = c.toString(16);
return hex.length == 1 ? "0" + hex : hex;
}
function hexToDec(c) {
return parseInt(c, 16)
}
export const invertColor = (color) => {
const rgb = color.match(/#(..)(..)(..)/)
... | true |
ecf45cef7a481382fb2654022ff38d9a975d84ca | JavaScript | denysMoon/to-do | /src/redux/reducers/fetchReducer.js | UTF-8 | 731 | 2.59375 | 3 | [] | no_license | import { FETCH_DATA, POST, DELETE, EDIT_POST } from '../types'
const initialState = {
fetchedPosts: []
}
export const fetchReducer = (state = initialState, action) => {
switch(action.type) {
case FETCH_DATA:
return { ...state, fetchedPosts: action.payload };
case POST:
return {...sta... | true |
bea5e60f6409f0ba17138021b2895750386997aa | JavaScript | mathieux51/simplesurance | /src/reducers/questions.js | UTF-8 | 947 | 2.609375 | 3 | [] | no_license | import { SET_QUESTIONS, SET_ANSWER, SET_STAGE } from '../constants'
function updateObjectInArray(array, action) {
return array.map((question, index) => {
if (index !== action.index) {
return question
}
return {
...question,
reply: action.reply
}
})
}
const initialState = {
stag... | true |