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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
e72a7f895a3bca906117b3c74f1e4d722bc22b20 | JavaScript | omarben78/javascript | /script.js | UTF-8 | 1,652 | 2.75 | 3 | [] | no_license | window.onload = function() {
var formValid = document.getElementById('bouton_envoi');
var nom = document.getElementById('nom');
var missNom = document.getElementById('missNom');
var nomValid = /^[a-zA-ZéèîïÉÈÎÏ][a-zéèêàçîï]+([-'\s][a-zA-ZéèîïÉÈÎÏ][a-zéèêàçîï]+)?$/;
var ... | true |
ac3279c1a73a276f1128566c8629eeacebb1a536 | JavaScript | cloned67/_String_Prototypes | /test.js | UTF-8 | 603 | 2.671875 | 3 | [
"CC0-1.0"
] | permissive | var _StringPrototypes = require("./").apply(global)
, test = require("tape")
;
test('String Prototipes', function (assert) {
var s;
assert.plan(5);
assert.strictEquals('123'.repeat(3) , '123123123');
s='\t\n 123 \n\t\t\r'
assert.strictEquals(s... | true |
a0e7b85e1132903032c0f217690df73a0b9215c1 | JavaScript | RodrigoCorreia/CodeWars | /javaScript/Find the divisors.js | UTF-8 | 713 | 4.53125 | 5 | [] | no_license | #Create a function named divisors/Divisors that takes an integer and returns an array with all of the integer's divisors(except for 1 and the number #itself). If the number is prime return the string '(integer) is prime' (null in C#) (use Either String a in Haskell and Result<Vec<u32>, String> in #Rust).
#Example:
#d... | true |
1c9070f8b73c678da16ac31ae2f3e3c4f6dc8d70 | JavaScript | 0xmanhnv/CRUD-REACTJS-LARAVEL | /resources/js/components/UserEditForm.js | UTF-8 | 2,940 | 2.53125 | 3 | [
"MIT"
] | permissive | import React, { Component } from 'react';
import { connect } from 'react-redux';
import axios from 'axios';
import { updateUser } from '../actions/index';
class UserEditForm extends Component{
constructor(props) {
super(props);
var $this = this;
var user = this.props.user;
this.state = {
email: user.email,... | true |
4ff6a182d2b1c8581267fbbe864d8f1cc8142e20 | JavaScript | NiutaR/tasks-intership | /debugging/index.js | UTF-8 | 492 | 3.1875 | 3 | [] | no_license | const starWarsApiUrl = 'https://swapi.dev/api/people';
const getStarWarsPeople = (cb) => {
fetch(starWarsApiUrl)
.then(res => res.json())
.then(cb);
}
getStarWarsPeople((res) => {
console.dir(res);
document.querySelector('p#info').innerHTML = `The number of people found ${res.count}. The first one from the... | true |
f5a6a1f37fe87466ccb4b69bb307331aeb1cc501 | JavaScript | agrabchak/Sprint02_frontend | /t15/js/script.js | UTF-8 | 1,144 | 3.5625 | 4 | [] | no_license | 'use strict'
let beginRange = prompt("Begin range is ...", '1');
let endRange = prompt("End range is ...", '100');
function checkDivision(beginRange, endRange) {
// let res = '';
if (beginRange === null || isNaN(+beginRange))
beginRange = 1;
if (endRange === null || isNaN(+endRange))
endR... | true |
d94db33e8eaa7c2c2dd700fd3a9ca7ba05a02991 | JavaScript | hepond/todo | /src/Todo.js | UTF-8 | 2,174 | 2.609375 | 3 | [] | no_license | import React, {useState,useEffect} from 'react'
import {ToggleButton, Button, OverlayTrigger,Tooltip} from 'react-bootstrap'
function Todo({ todo, index, markTodo, removeTodo,editTodos }) {
const [isEditing,setEditing] = useState(false);
const [edit,setedit] = useState(todo.text);
const handleSubmit = e => ... | true |
812398a5a486a61ab13fea8c1f4edec869d6dcd2 | JavaScript | grakin99/stock-api | /src/js/utils/get-user-input.js | UTF-8 | 644 | 3.015625 | 3 | [
"MIT"
] | permissive | /**
* @param inputFieldSelector for custom css selector string (default: #ticker-id)
*@method getInputValue returns the value of selected input field
@export getInputValue for use in the get-data module to deliver the user inputted stock ticker
@description userInput() Call this after the symbol= in the link http... | true |
79554c1c4d3e84e1fe35816c9edb738febeedfe5 | JavaScript | Hasuro1797/searchActor | /src/redux/reducers/index.js | UTF-8 | 380 | 2.53125 | 3 | [] | no_license | import { FETCH_ACTOR } from '../actions/index'
const initialState = {
actor: null,
}
const reducerActors = (state = initialState, action) =>{
switch (action.type) {
case FETCH_ACTOR:
return{
...state,
actor: action.payload
};
default:
... | true |
eb67e64990ea4ce59b33d0e629f089032b08591f | JavaScript | drunkfromcoffee/drunkfromcoffee.github.io | /scripts/rescale.js | UTF-8 | 412 | 2.71875 | 3 | [] | no_license | function resize() {
const elementsArray = ["message-container", "message-input"];
const percentArray = [94, 5];
const height = window.innerHeight;
for (let i = 0; i < elementsArray.length; i++) {
const temp = document.getElementById(elementsArray[i])
if (!temp) continue;
... | true |
b324fec24f5f7ad4b2c0302600c0b6d27ec24388 | JavaScript | MMahdiNasiri/Social-Network-django-web-application | /static/js/followHandler.js | UTF-8 | 1,557 | 2.78125 | 3 | [] | no_license | function followBtnHandler(is_following){
let newBtn = ''
if (is_following){
newBtn = '<button class="btn btn-success" onclick="followHandler(false)" >دنبال کردن</button>'
}else{
newBtn = '<button class="btn btn-outline-secondary" onclick="followHandler(true)" >توقف پیروی</button>'
}
... | true |
71c6613bc19e018aa7d63c8bf50a07c028b6321e | JavaScript | sergiodebei/cantigateatral | /src/js/4-global/fader-base.js | UTF-8 | 1,163 | 2.578125 | 3 | [] | no_license | var blMobile = false;
$(function() {
// setup ---------------------------------------------------------------------
// check for mobile
if( isMobile["any"]() ){
//used in css and stuff
$( 'body' ).addClass('body--mobile');
blMobile = true;
}
// check for safari
var ua = navigator.userAge... | true |
e89243d4046f5512f783affc5784e22aef8ece60 | JavaScript | jun3126/study | /javascript/canvas/rect1.js | UTF-8 | 505 | 2.90625 | 3 | [] | no_license | 'use strict';
let canvas = document.createElement('canvas');
document.body.appendChild(canvas);
if(canvas.getContext) {
let ctx = canvas.getContext('2d');
ctx.fillRect(25, 25, 100, 100);
ctx.clearRect(45, 45, 60, 60);
ctx.strokeRect(50, 50, 50, 50);
ctx.fillStyle = "rgb(50, 200, 50)";
ctx.fillR... | true |
6a318b36d276482257a483274e31f3fe242ddf28 | JavaScript | Luoyuda/js-demo | /leetcode/常规题目/487.js | UTF-8 | 1,090 | 3.25 | 3 | [] | no_license | /*
* @Author: xiaohuolong
* @Date: 2021-07-26 07:56:50
* @LastEditors: xiaohuolong
* @LastEditTime: 2021-07-26 07:57:20
* @FilePath: /js-demo/leetcode/常规题目/487.js
*/
/*
487. 最大连续1的个数 II
给定一个二进制数组,你可以最多将 1 个 0 翻转为 1,找出其中最大连续 1 的个数。
示例 1:
输入:[1,0,1,1,0]
输出:4
解释:翻转第一个 0 可以得到最长的连续 1。
当翻转以后,最大连... | true |
90ca4133a4bf33755dd355974c45ed92a627ac5b | JavaScript | mhdavis/friend-finder | /app/routing/apiRoutes.js | UTF-8 | 457 | 2.6875 | 3 | [
"MIT"
] | permissive | let friendsArray = require('../data/friends.js');
let determineMatch = require('./determineMatch.js');
module.exports = function(app) {
app.get("/api/friends", function (req, res) {
res.json(friendsArray);
});
app.post("/api/friends", function (req, res) {
let newFriend = req.body;
if (newFriend.n... | true |
a268e885713ddeee3673b0a0c0dda11405e203ac | JavaScript | zar777/PrimoEsonero | /floor1.js | UTF-8 | 1,121 | 2.765625 | 3 | [] | no_license | //piano terra
var a = [80,400];
var b = [420,400];
var c = [420,390];
var d = [170,390];
var e = [170,380];
var f = [150,380];
var g = [150,390];
var h = [80,390];
var latonord1 = POLYLINE ([a,b,c,d,e,f,g,h,a]);
//DRAW(latonord1);
/*var i = [80,330];
var l = [80,390];
var lineapil1 = POLYLINE ([i,l]);
var m = [85,3... | true |
9982eb0a97b085308cad8a1fe92e8e4c966df276 | JavaScript | persla/jsramverk-project-client | /src/components/socket-stocks.js | UTF-8 | 1,796 | 2.59375 | 3 | [] | no_license | import io from "socket.io-client";
let socket = io('https://project-socket.teachmeapp.me');
// this.socket = io('https://socket.teachmeapp.me');
// const socket = io('https://socket.teachmeapp.me');
const input = {
messages: [],
saab: [],
volvo: [],
fiat: [],
ford: [],
saabLast: "",... | true |
393a44720834a9537acfdde38305b5aa011f25e0 | JavaScript | albertogaia/js-burger | /js/main.js | UTF-8 | 1,285 | 3.6875 | 4 | [] | no_license | // Il programma dovrà consentire di calcolare il prezzo del panino selezionando o deselezionando gli ingredienti proposti.
//controllo se c'è il nome dell'hamburger
document.getElementById('my_btn').addEventListener('click', function(){
let nameBurger = document.getElementById('burgerName').value;
console.log(... | true |
012e187a400cbc8fd91d68462347032bbe8173de | JavaScript | fMercury/DIDI-SSI-Issuer-module | /issuer-front/src/services/ParticipantService.js | UTF-8 | 2,747 | 2.5625 | 3 | [] | no_license | import Constants from "../constants/Constants";
export default class ParticipantService {
static getGlobal(token, cb, errCb) {
const data = {
method: "GET",
headers: {
"Content-Type": "application/json",
token: token
}
};
fetch(Constants.API_ROUTES.PARTICIPANTS.GET_GLOBAL, data)
.then(data ... | true |
e75da170fc38b8a62195c30799e8d18d07d31494 | JavaScript | thomasverney/Code_files | /Ibat/lesson-5/week5-self/js/site.js | UTF-8 | 1,456 | 3.40625 | 3 | [] | no_license | let fleet = [
{ "colour": "Red", "engine": "2.0", "mf": "Ford" },
{ "colour": "Green", "engine": "2.1", "mf": "Nissan" },
{ "colour": "Blue", "engine": "2.2", "mf": "Fiat" }
]
function listCarsFunc() {
console.log("hello");
let getCarMf = document.getElementById("ulCars");
let htmlList = "<... | true |
fa92bc45b5ca6f0287693b933f554632d21137fe | JavaScript | DmitryAvanesov/avanesov-dmitry-otus | /node/3/tree.js | UTF-8 | 557 | 3.078125 | 3 | [] | no_license | import * as fs from 'fs';
var tree = {
files: [],
dirs: []
};
const getTreeFromPath = async path => {
fs.readdir(path, (err, files) => {
files.forEach(file => {
const innerPath = `${path}/${file}`;
if (fs.lstatSync(innerPath).isDirectory()) {
tree.dirs.push(innerPath);
getTreeFr... | true |
a4f23d980f28ed27780f222650672625f215bf3a | JavaScript | Loki419420/ed-forge | /tests/Ship.test.js | UTF-8 | 6,878 | 2.515625 | 3 | [] | no_license |
import { Ship } from '..';
import { assertValidSlot, REG_CORE_SLOT, REG_INTERNAL_SLOT, REG_MILITARY_SLOT, REG_HARDPOINT_SLOT, REG_UTILITY_SLOT } from '../lib/data/slots';
import { matchesAny, mapValuesDeep } from '../lib/helper';
import { clone, pickBy } from 'lodash';
import * as anacondaBuild from './fixtures/anaco... | true |
70811513ca53a62e57567db7dab04001cf9f4653 | JavaScript | Code-Institute-Submissions/tic_tac_toe | /assets/js/script.js | UTF-8 | 20,822 | 3 | 3 | [] | no_license |
//variable selection
//Button selection
var startButton = document.getElementById("str_btn");
var resetButton = document.getElementById("rst_btn");
//Main structure landpage selections
var mainChoices = document.getElementById("main_choices_container");
var icons = document.getElementsByTagName("i");
var colorBoxes = ... | true |
d4b99e58ecb4c6735f7bc6f5ec35f3df66d0e3bc | JavaScript | paper520/React-study | /src/containers/Component.jsx | UTF-8 | 1,392 | 2.90625 | 3 | [
"MIT"
] | permissive | import React from 'react';
// 第一种:函数式定义的无状态组件
function FunComponent(props) {
return <div>{props.data}</div>;
}
// 第二种:es6形式的extends React.Component定义的组件
class ExtendsComponent extends React.Component {
constructor(props) {
super(props);
}
render() {
return <div>extends方式定义的组件</div>;
}
};
export ... | true |
ee57c1df18260a1762e546b9fa34743e46ffd2a2 | JavaScript | Manish9823/LearnShare.github.io | /bx.demo/zufang/js/main.js | UTF-8 | 1,757 | 2.6875 | 3 | [] | no_license | window.onload=function(){
initMap();
var btn=document.getElementById("current-local");
btn.addEventListener("click",getLocation);
}
function initMap(){
var map=new BMap.Map("bmap");
map.centerAndZoom(new BMap.Point(121.235, 31.352), 11);
map.addControl(new BMap.NavigationControl());
map.addControl(new BMap.Scal... | true |
e19e352bfa6a44d819ceb21b611b4f94dbb317fc | JavaScript | yu3211/studyCode | /js_sample/js/chap03/scripts/subtract.js | UTF-8 | 331 | 3.34375 | 3 | [] | no_license | // http://127.0.0.1:8887/chap03/16_4.subtract.html
// 経過ms / (1000ms * 60s * 60m * 24h) = 日数
var dat1 = new Date(2017, 4, 15); // 2017/05/15
var dat2 = new Date(2017, 5, 20); // 2017/06/20
var diff = (dat2.getTime() - dat1.getTime()) / (1000 * 60 * 60 * 24);
console.log(`${diff}日の差があります。`); //36
| true |
a8de944ff51a204f2d82d86de7d940cbb543ac44 | JavaScript | malbasi/hollywood-age-gap | /src/01-chart.js | UTF-8 | 30,073 | 2.515625 | 3 | [] | no_license | import * as d3 from 'd3'
// import { debounce } from 'debounce'
const margin = {
top: 30,
right: 20,
bottom: 30,
left: 190
}
const width = 700 - margin.left - margin.right
const height = 650 - margin.top - margin.bottom
const svg = d3
.select('#chart-1')
.append('svg')
.attr('width', width + margin.lef... | true |
3fc16814c45f0c139f256e1667043c65f23e19e5 | JavaScript | Quentin-V/quinta-blackjack | /blackjack.js | UTF-8 | 2,329 | 2.765625 | 3 | [] | no_license | const Discord = require('discord.js');
const BlackJack = require('./game.js');
const credentials = require('./credentials.js');
const bot = new Discord.Client();
const admins = ['184331142286147584', '268753117082943488'];
bot.on('ready', () => {
console.log(`Connected as ${bot.user.tag}`);
})
var games = []; // I... | true |
473e1b0a4f782ac9d4620d055cfd0e8a52de6bff | JavaScript | s2tu/SonnyExample | /JavaProjects/HTMLLab/WebContent/scripts/ajax.js | UTF-8 | 1,067 | 2.9375 | 3 | [] | no_license | /**
*
*/
//document ready
$(function(){
var test = { tes2:"test"};
console.log(test["tes2"]);
console.log(test.tes2);
//fill in the innerHTML of the select with options with the state
var options = {
type:"GET",
dataType:"json",
url:"http://services.groupkt.com/state/get/ind/all",
e... | true |
f79db372450ab44608891784cf4e254d5da9af0a | JavaScript | Ghilt/Humlepromenaden | /facility.Spawner.js | UTF-8 | 2,141 | 2.53125 | 3 | [] | no_license | let facilitySpawner = {
run: () => {
let whatToSpawn = () => {
var abs = _.filter(Game.creeps, (creep) => creep.memory.rank == 'Abomination');
//console.log('Abomination: ' + abs.length);
var upgraders = _.filter(Game.creeps, (creep) => creep.me... | true |
beb7674008858b7d2037ae36aa6f809d6998fe69 | JavaScript | RadekM86/Node.js_challenge_dzien_3 | /app/zadanieDnia1.js | UTF-8 | 437 | 3.015625 | 3 | [] | no_license | //Twój kod
const crypto = require('crypto');
const fs = require('fs');
fs.readFile(process.argv[2], 'utf8', (err, data) => {
if (err === null){
console.log('Poprawnie odczytano plik.');
let dataHashed = crypto.createHmac('sha256', data)
.digest('hex');
console.log('Wartość zakodowana:'... | true |
2c9fd2c7720e8f25b2d557b4f683c383b12b9595 | JavaScript | keyboardbreaker/UnitTesting1 | /index.js | UTF-8 | 279 | 2.625 | 3 | [] | no_license | // const times1 = require('./frank').times1 // named import
const times1 = require('./frank') // default import
function timesItFive(n){
return times1(5 * n);
}
//module.exports = timesItFive; // default export
module.exports.timesItFive = timesItFive; //named export
| true |
caf174fde3aebca86194a373227fb143e9c34bdb | JavaScript | djole-petrovic-js/utils | /LinQ.js | UTF-8 | 710 | 2.734375 | 3 | [] | no_license | ( function(){
'use strict';
class LinQ {
constructor(items) {
this.items = items;
}
get() {
return this.items;
}
orderBy(fn) {
this.items = this.items.sort(fn);
return this;
}
select(fn) {
this.items = this.items.map(fn);
return this;
}
... | true |
9357b07113ddbbd6fba2cf0e50d36d37d3afac4c | JavaScript | Leonelaam/tanatoturismo | /src/front/js/store/flux.js | UTF-8 | 4,429 | 2.578125 | 3 | [] | no_license | const getState = ({ getStore, getActions, setStore, setRedirect }) => {
return {
store: {
nick_name: "nick_name",
token: null,
places: null,
redirect_logout: false,
user_id: null,
currentplace: null,
favoritePlaces: []
},
actions: {
login: () => {
setStore({
nick_name: sessionSt... | true |
9caa5412122a748bd8c223f61dfc225f8f43e207 | JavaScript | stormi186/phonebook-backend | /index.js | UTF-8 | 3,475 | 2.53125 | 3 | [] | no_license |
const express = require('express')
const app = express()
require('dotenv').config()
const bodyParser = require('body-parser')
app.use(bodyParser.json())
const cors = require('cors')
app.use(cors())
const morgan = require('morgan')
morgan.token('body', (req) => { return JSON.stringify(req.body) })
var loggerFormat... | true |
07a31a3a16ef17d900309d48b4146028f3df1b80 | JavaScript | heangly/AlgoExpert-Problem-Solutions | /solutions-in-javascript/056-Minimum-Characters.For-Words.js | UTF-8 | 540 | 3.390625 | 3 | [] | no_license | function minimumCharactersForWords(words) {
const table = {}
for (const word of words) {
for (const char of word) {
table[char] = 1
}
}
for (const word of words) {
const temp = {}
for (const char of word) {
if (char in temp) {
temp[char]++
table[char] = Math.max(te... | true |
d0578656e2fc06bbba3324b19cb35da2fce6e5ff | JavaScript | Malikbook/MONO_layout | /main_js.js | UTF-8 | 7,234 | 2.71875 | 3 | [] | no_license | // Slider-1
let next = document.querySelector(".next");
let prev = document.querySelector(".prev");
let slides = document.querySelectorAll(".goods_img");
let i = 0;
next.addEventListener("click", function () {
++i;
if (i >= slides.length) {
slides[i - 1].classList.remove("img_block");
i = 0;
slid... | true |
43e7173699ad16d996289dc2c673f48db05700cb | JavaScript | fsaina/detoxify | /extension/scripts/popup.js | UTF-8 | 2,766 | 2.84375 | 3 | [] | no_license | window.browser = (function () {
return window.msBrowser ||
window.browser ||
window.chrome;
})();
function onPageUnsuported() {
document.getElementById("toggle-btn").disabled = true;
document.getElementById("toggle-btn").checked = false;
document.getElementById("txt1").innerText = "Sorr... | true |
761465ac6cac3a5e8fea253c753560cc2bf5cb61 | JavaScript | AneekG8/Rock-Paper-Scissors-update1 | /script.js | UTF-8 | 5,419 | 3.375 | 3 | [] | no_license | const game=()=>{
//scores
let pScore=0;
let cScore=0;
//function to load game
const loadGame=()=>{
setTimeout(()=>{
document.querySelector('.preloader').style.opacity='0';
document.querySelector('.wrapper').style.transform=`translateX(-100%)`;
document.querySelector('.wrapper').style.transition... | true |
b4e9a01c60e35c7a9def4ea50c0252f322ea8a8d | JavaScript | abhishek3365/Testapis | /server.js | UTF-8 | 2,813 | 2.625 | 3 | [] | no_license | const express = require('express');
const items = require('./items.json');
const PORT = process.env.PORT || 3000;
const app = express();
app.use(function(req, res, next) {
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE'... | true |
fe6adfed4b93b78d60e4d1deb540aafdff3f54d4 | JavaScript | jillwilliams/Finding-Patterns | /script.js | UTF-8 | 541 | 3.546875 | 4 | [] | no_license | // On buttyon click reveal a blue heptagon-pattern 1
const blueHep = () => {
return "Blue Heptagon";
};
const pattern1 = ( ) => {
document.getElementById("demo").innerHTML = blueHep();
}
// On buttyon click reveal pattern 2
const Saturday = () => {
return "S, for Saturday";
};
const pattern2 = ( ) => {
... | true |
dda9cc132822bedb93dc8be94b7da31c0a5a2892 | JavaScript | jamiepreston/advent-of-code-2020 | /day-3/src/trajectory-v1.js | UTF-8 | 1,151 | 2.90625 | 3 | [] | no_license | export const getSquare = ({
map,
position
}) => {
const [x,y] = position;
const mapArray = map
.split('\n');
if (mapArray.length <= y) { return undefined; }
const row = mapArray[y];
const normalisedPosition = row.length <= x
? x % row.length
: x;
return row[normalisedPosition];
}
export c... | true |
df2c4e43051e7d1536174ef987c1bb7324bd3ae5 | JavaScript | rmunozdev/masterart | /routes/index.js | UTF-8 | 492 | 2.53125 | 3 | [] | no_license | var express = require('express');
var router = express.Router();
var fs = require('fs');
/* GET home page. */
router.get('/',function(req, res, next) {
var selectedFiles = [];
loadFiles(selectedFiles);
res.render('index', { title: 'Express' , files: selectedFiles});
});
function loadFiles(selectedFiles) {
var... | true |
515ac0b1af2ab4c9477fefcd32dc340f951eeeac | JavaScript | hamzatech2424/NativeBaseComponenets | /src/Components/Native Base Components/RadioButton.js | UTF-8 | 3,036 | 2.703125 | 3 | [] | no_license | import React, { useState } from "react"
import { View, Text, StyleSheet } from "react-native"
import RadioForm, { RadioButton, RadioButtonInput, RadioButtonLabel } from 'react-native-simple-radio-button';
const RadioButtons = ({ size, colorScheme,isInvalid,isDisabled }) => {
console.log(isInvalid)
const [ra... | true |
416b86e6d34cae5a6eafd41983c392a369244dab | JavaScript | aishu2016/Library | /login.js | UTF-8 | 1,409 | 3.3125 | 3 | [] | no_license | let email = document.getElementById("email");
let pwd = document.getElementById("pwd");
function validate() {
//email validation//
let regexp = /^([A-Za-z0-9\.-]+)@([A-Za-z0-9\-]+)\.([a-z]{2,3})(\.[a-z]{2,3})?$/
if (!regexp.test(email.value.trim())) {
email.innerHTML = "Invalid email";
... | true |
5a5ffd90c2259c7b8082292a8b50e6012bf9b00c | JavaScript | techieeliot/full-stack-open-2020 | /part2/phonebook/src/App.jsx | UTF-8 | 6,175 | 2.953125 | 3 | [] | no_license | import React, { useState, useEffect } from 'react'
import './App.css'
import Filter from './components/Filter'
import PersonForm from './components/PersonForm'
import Persons from './components/Persons'
import itemsService from './services/items'
import Notification from './components/Notification'
const App = () => {... | true |
3a335beb9aef5c59eeb0a76d36e6ad88bd8b6689 | JavaScript | Artem7753/Artem7753.github.io | /library/public/view.js | UTF-8 | 4,235 | 2.90625 | 3 | [
"MIT"
] | permissive | class View {
constructor(controller) {
this.controller = controller;
this.addButton = document.getElementById("add_book");
this.closeButton = document.getElementById("exit");
this.form = document.getElementById("add_new_book_form");
this.addBookBut = document.getElementById(... | true |
73da441f6d009c2b50a7e7ffc2f05fb6d64e48d8 | JavaScript | BenjaminHoppe/javascriptNotes | /notes.js | UTF-8 | 7,409 | 4.21875 | 4 | [] | no_license | // ------------------------------------------------
// JAVASCRIPT NOTES
// ------------------------------------------------
// ------------------------------------------------
// Objects:
// ------------------------------------------------
// Creating objects - Literal notaton
let hotel = {
name: '... | true |
29994eb50f583dff24d98c6a5e13c834e8db650d | JavaScript | 128Ghe980/ChainsFront01 | /src/pages/Panel/componets/CacheTimer/index.jsx | UTF-8 | 564 | 2.515625 | 3 | [] | no_license | import React from 'react';
import axios from 'axios';
const schedule = require('node-schedule');
const Dataurl = 'http://localhost:3001/api/observers';
function fetchdata() {
const request = axios.get(Dataurl);
const dataPromise = (request.then(response => response.data));
return dataPromise;
}
const rule = ne... | true |
7cd95a13d0d6d9f327064e1facb1e1f95fbca845 | JavaScript | HarshilShrivastava/News-website | /script.js | UTF-8 | 5,404 | 3.140625 | 3 | [] | no_license | var x;
function myFunction() {
x = document.getElementById("myNumber").value;
}
var url = 'https://newsapi.org/v2/top-headlines?country='+'in'+'&apiKey=57d943c1eebb41a58db8c758539347e4';
fetch(url)
.then(function(response) {
return response.json();
})
.then(function(myJson) {
... | true |
c9e0bf9dfe453fc8a1676d8c94a20cd01383c4ce | JavaScript | Zarfius94/Kontext-Sensitive-Systeme | /website/euler.js | UTF-8 | 753 | 2.8125 | 3 | [] | no_license | function eulerCoordinates(rawalpha, rawbeta, rawgamma, offset) {
var alpha, beta, gamma;
//gamma ist in [-90,90)
gamma = 0;
if(offset < 0) {
gamma = 180 - (Math.abs(rawgamma));
} else {
gamma = Math.abs(rawgamma);
}
//alpha ist in [0,360)
alpha = Math.ab... | true |
0df61495ae4b6438c9c1336485537243954f2fbc | JavaScript | camaze/test_resume | /js/nav-mouse-enter.js | UTF-8 | 1,569 | 2.671875 | 3 | [] | no_license | // 鼠标进入导航的li(关于等时),会有小红条,而且在作品那里有显示作品1-3
! function () {
let view = View('nav.menu > ul >li')
var controller = {
view: null,
init: function () {
this.view = view
this.bindEvents()
},
bindEvents: function () {
for (let i = 0; i < this.... | true |
63c6a433f9cd6f62fa72ff26653bc4cecc2e1c26 | JavaScript | Maxstef/supermario | /js/game.js | UTF-8 | 17,891 | 2.75 | 3 | [] | no_license | var canvasElem = document.getElementById("game");
var backOffset = 0;
canvasElem.style.backgroundImage = 'url("assets/sky.jpg")';
canvasElem.style.backgroundSize = '80% 100%';
canvasElem.style.backgroundRepeat = 'repeat-x';
var world = boxbox.createWorld(canvasElem,{
scale: 30,
gravity: {x:0, y:30}
});
var score = 0... | true |
e2168fe00ab141df6131af51711ab921ab563c36 | JavaScript | Hot-N-Seek/myApp | /www/js/services.js | UTF-8 | 913 | 2.96875 | 3 | [
"MIT"
] | permissive | angular.module('starter.services', [])
/**
* A simple example service that returns some data.
*/
.factory('Places', function() {
// Might use a resource here that returns a JSON array
// Some fake testing data
var places = [];
// list.forEach(function(element, index, array) {
// places.push({id:in... | true |
f1c3f2ec9838798bc57c8c5dad0916b96c606303 | JavaScript | ArmaanDhingra/LegalAdviceEECS330 | /login.js | UTF-8 | 549 | 2.671875 | 3 | [] | no_license |
function check() {
var uname = document.getElementById('user').value;
var psw = document.getElementById('pass').value;
if(uname === "philasmith"){
if(psw === "client"){
return window.location.href='client-profile.html';
}
else{
return window.location.href='loginbad.html';
}
}
else{
if(uname ===... | true |
9f6d4de49e29de0b0e40791dae094ce80e49a4de | JavaScript | aaaahhhh1818/jex01 | /src/main/webapp/resources/js/reply.js | UTF-8 | 2,094 | 3.8125 | 4 | [] | no_license |
//비동기를 동기화처럼 처리되려면 async 사용
async function doA() { //함수 - 선언문
console.log("doA.................")
const response = await axios.get("/replies") //결과가 나올 때 까지 기다렸다가 결과 나오면 response에 할당해라
const data = response.data
console.log("doA..data", data)
return data //doA를 실행하면 배열이 나옴 -> 리턴을 받는 방식
}
const d... | true |
c8388b0687e868845eac870a3c9b96c67f88fe16 | JavaScript | JoeSoellner/full-stack-open | /part2/course-info/src/components/Course.js | UTF-8 | 749 | 2.6875 | 3 | [] | no_license | import React from 'react';
const Header = (props) => {
return (
<>
<h1>{props.course}</h1>
</>
)
}
const Part = (props) => {
return (
<>
<p>
{props.part.name} {props.part.exercises}
</p>
</>
)
}
const Content = ({ parts }) => {
const partComponents = parts.map(part => <Part part={part} />);... | true |
286e713e69c66b88cff2411cb59621dff25af441 | JavaScript | DucSon94/demogit | /chicken.js | UTF-8 | 106 | 3.078125 | 3 | [] | no_license | function Chicken(name) {
this.name = name
}
console.log("ò ó o");
console.log("chich chì chích"); | true |
7b833d929e3a0c91c9a949fc00101f3204b1adaf | JavaScript | DanRobS/liquor-tree | /src/mixins/DndMixin.js | UTF-8 | 6,021 | 2.609375 | 3 | [
"MIT"
] | permissive | const DropPosition = {
ABOVE: 'drag-above',
BELOW: 'drag-below',
ON: 'drag-on'
}
function isMovingStarted (event, start) {
return Math.abs(event.clientX - start[0]) > 5 || Math.abs(event.clientY - start[1]) > 5
}
function composedPath (event) {
let el = event.target
const path = []
while (el) {
pat... | true |
0ddb651c97a936b782e266deddaa4e866f8f805c | JavaScript | anargiris/QuizGame | /QuizGame/firebase.js | UTF-8 | 2,000 | 3.046875 | 3 | [] | no_license | const SubmitBtn = document.getElementById('submit-btn');
const playerName = document.getElementById('name-input');
let database = firebase.database();
const rootRef = database.ref('users')
let highscores =[];
let leaderboardBtn = document.getElementById('scores');
let scorelist = document.getElementById('scorelis... | true |
3986740ee1b6657b2310d21b520f521afb3b179a | JavaScript | havenchyk/slider | /js/main.js | UTF-8 | 4,581 | 3.015625 | 3 | [] | no_license | var Slider = (function ($) {
var currentIndex, itemsNumber, $container, $wrapper, $items, autoSlide, imageSources;
var speed = 1000;
var delay = 2000000;
var width = 600;
function init() {
initDomElements();
bindEvents();
imageSources = Array.prototype.slice.call($items.find('img')).map(functio... | true |
5ef42019bb9a34ba07bc223b730db1c820358792 | JavaScript | hawk-lord/aabtable | /data/my-script.js | UTF-8 | 2,480 | 2.78125 | 3 | [] | no_license | /**
* Created by per on 2015-08-19.
*/
//window.alert("Page matches ruleset");
document.body.style.border = "thick solid blue";
document.body.style.backgroundColor = "yellow";
// document.title = "Hej document";
const Transaction = function() {
paymentDate: "";
amount: 0;
categoryPurpose: "";
cred... | true |
f475649f0236733acac05d5ea3ef1cb768389a6d | JavaScript | anniepyim/Heatmap | /dist/js/downloadSvg.js | UTF-8 | 2,066 | 2.71875 | 3 | [
"MIT"
] | permissive | function downloadImage(){
var a = document.createElement('a');
// toDataURL defaults to png, so we need to request a jpeg, then convert for file download.
a.href = c.toDataURL("image/png");
a.download = 'somefilename.png';
//a.click();
// create a mouse event
var event = new MouseEvent('cli... | true |
bc77459d0f7e7f3740f2d755c43f961785014a2e | JavaScript | appcoreopc/promapp | /src/App.js | UTF-8 | 2,909 | 2.8125 | 3 | [] | no_license | import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import request from 'superagent';
import {GetTeamDataUrl, LoginUrl, UserNameEmptyMessage, PasswordEmtpyMessage, TeamEmptyMessage, ErrorSigningInMessage} from './shared';
class App extends React.Component {
constructor(props)... | true |
2919736320ba6d1ed60036c99ca9d77a0da21553 | JavaScript | MattMurn/Credit-Card-Fullstack | /testing/index.test.js | UTF-8 | 4,977 | 3.203125 | 3 | [] | no_license | // const Card = require('../classes/Card');
// const date_compare = require('./react_function');
// new_card with 35% apr, 1000 limit, created on 9/17/18;
// test data
// I set this up using the Date() object. Didn't want to use an api.
let open_date = new Date("October 18, 2018 11:13:00");// 0 days
let second_transact... | true |
32de1f50d499a5f2679a3735da5d5c9c674c83bb | JavaScript | philip-putnam/cryptosquare | /js/scripts.js | UTF-8 | 875 | 3.234375 | 3 | [] | no_license |
var boxRows = function(array) {
var dimensions = array.length;
var dimensions = Math.ceil(Math.sqrt(dimensions));
if ((dimensions * (dimensions - 1)) >= array.length) {
dimensions = dimensions - 1;
}
return dimensions;
}
var stringContain = function(array, colNum) {
var tempArry = [];
// Trying to ... | true |
519d014fc40c42c90036ec8ea54ecff6cec62542 | JavaScript | iamdiegoskr/TallerElectrodomesticosJavascript | /js/models/Tv.js | UTF-8 | 1,053 | 2.640625 | 3 | [] | no_license | import HomeAppliances from "./HomeAppliances.js";
export default class Tv extends HomeAppliances{
constructor(consumption,origin,inches,isTdt){
super(consumption,origin);
this.inches = inches;
this.isTdt = isTdt;
this.price = this.getPriceTotal;
}
get getInches(){
... | true |
d9ffe8d84ab38e8404593f55d97fa41d777c951e | JavaScript | englishcards/englishcards.github.io | /sql_ajax/quiz/practice/practice.js | UTF-8 | 8,746 | 2.765625 | 3 | [] | no_license | const question = document.querySelector('.question');
const operators = document.querySelectorAll('.parts__answer');
const operatorsWrap = document.querySelector('.parts-wrap');
const inputRow = document.querySelector('.answer-field');
const btnClear = document.querySelector('.button-answer_left');
const btnCheck ... | true |
8933d2ac8cb617b025c20f95b9563683861f0890 | JavaScript | SilverHoodCorp/polar-bookshelf | /web/js/proxies/TraceListenerExecutor.js | UTF-8 | 1,168 | 2.578125 | 3 | [
"Apache-2.0",
"MIT",
"CC-BY-3.0"
] | permissive | const {FunctionalInterface} = require("../util/FunctionalInterface");
const {TraceEvent} = require("./TraceEvent");
const {MutationType} = require("./MutationType");
module.exports.TraceListenerExecutor = class {
/**
* @param traceListener The specific traceListener we're working with.
* @param traceHan... | true |
0ff898b5f6b883b1fcd482a1d8a3d0d08dde3cf3 | JavaScript | MarkLoeser/free-code-camp-indy.github.io | /js/blogs_info/blogs_info.js | UTF-8 | 265 | 2.5625 | 3 | [] | no_license | var blogs = [];
/*
To add a new blog, add a new line in this format: "blogs.push(new blog('blog name', 'blog imageLocation', 'blog_link');"
*/
blogs.push(new blog("Gav's Dev Blog", "./images/blog_images/gavs_dev_blog.jpg", "https://gavsdevblog.wordpress.com/"));
| true |
06852a9abc4f64cd0d41623bb1d068c754c3e7da | JavaScript | BelisonRazer/yandex.praktikum.mesto_root | /src/js/validate-form-new.js | UTF-8 | 3,205 | 2.84375 | 3 | [] | no_license | "use strict";
import {resetError} from "./validate-form-second";
import {activateError} from "./validate-form-second";
import {isInputLength} from "./validate-form-second";
import FormButtonState from "../blocks/button/button";
const formButtonState = FormButtonState();
const form = document.forms.new;
const name = ... | true |
ca8b2e524a7db6430e9c93c237b98c53d8bab50f | JavaScript | ilya-nozhkin/Homework-SPbU | /2nd_course/1st_semester/4th_homework/task_1/javascript/game.js | UTF-8 | 6,396 | 2.984375 | 3 | [] | no_license | function defaultLandFunction(x) {
x /= 30;
return (1 + Math.cos(x)) * Math.exp(-x * x / 30) * 40;
}
var NetworkMessageType = {
playerData: 0
}
var GameStatus = {
training: 0,
running: 1,
won: 2,
lost: 3
}
class Game {
constructor() {
this.map = new Map(defaultLandFunction);
... | true |
045e4003089947fa5297a895bba639e912c3a528 | JavaScript | Ampa1R/js-02-18 | /students/Ванжин Николай/shopsite/script.js | UTF-8 | 1,983 | 2.765625 | 3 | [] | no_license | const goods = [{
title: 'Mango People T-shirt',
price: 52.00,
pictureLink: 'img/image_placeholder_1657.png'
},
{
title: 'Mango People T-shirt',
price: 52.00,
pictureLink: 'img/image_placeholder_1877.png'
}, {
title: 'Mango People T-shirt',
price: 52.00,
pictureLink: 'img/rectangle_5_copy_3_1209.png... | true |
3907d2964b54ec6c420d128a22541a344935cfa3 | JavaScript | icmpecho/concurrency-demo | /demo1/node/index.js | UTF-8 | 363 | 2.609375 | 3 | [] | no_license | const express = require('express')
const faker = require('faker')
const app = express()
const query_data = (cb) => {
setTimeout(() => {
data = faker.name.findName()
cb(data)
}, 100)
}
app.get('/', (req, res) => {
query_data((data) => {
res.send({data: data})
})
})
app.listen(8000, () => {
conso... | true |
91ddf23a2655c7c48b3706611357d6746dd72d8e | JavaScript | dreamfactorysoftware/example-scripts | /v8js/table_endpoint_obfuscation/table_endpoint_obfuscation_pre_2.4.js | UTF-8 | 1,654 | 2.921875 | 3 | [] | no_license | var api_path = 'db/_table/todo'; //the service/_table/tablename you wish to obfuscate
var method = event.request.method; //get the HTTP Method
var parameters = event.request.parameters; //copy params from the request to a var
var result; //create the result var (to be returned by the script)
if (event.resource && eve... | true |
2d7e38f334f058bdd7bb0b56dd9b13e178ad2fef | JavaScript | FakeTerrible/js-Algorithms | /Algorithm/sort/bubble.js | UTF-8 | 403 | 2.953125 | 3 | [] | no_license | /**
*
* @param {Array} nums
* @returns {Array}
*/
var bubble = function (nums) {
const n = nums.length;
for (let i = 0; i < n - 1; i++) {
for (let j = i + 1; j < n; j++) {
if (nums[i] > nums[j]) {
let temp = nums[i];
nums[i] = nums[j];
num... | true |
badbe3aef6fe210fb8b458686ba105b1dae296dc | JavaScript | AFournier-Dev/phpMultiplication | /ajax.js | UTF-8 | 3,092 | 3.5625 | 4 | [] | no_license | /**
* But : Que la soumission du formulaire n'entraîne pas un rechargement complet de la page, mais juste de la partie nécessaire.
*
* LES ÉTAPES :
*
* 1/Empêcher le déroulement par défaut de la soumission du formulaire (càd qu'il n'y ait pas rechargement complet de la page) ==> récupérer le form, écouter sur le ... | true |
31e15f867501cf94a7b9b6dadabe82f39d2f24a2 | JavaScript | harish156/myBlogProject | /src/backend/feed.model.js | UTF-8 | 433 | 2.546875 | 3 | [] | no_license | const mongoose = require('mongoose');
const Schema = mongoose.Schema;
/* Model for the Blog post. Each blog post has an entry of title and comments.
The comments is an array of objects where each object represents the comment's
body, date and number of likes. */
let BlogPost = new Schema({
title: String,
c... | true |
df7793e2d4b8a5c30e8b42cc1ab84d40dbf30d8d | JavaScript | henricbjork/Exanimation | /src/spotify/functions/getAudioAnalysis.js | UTF-8 | 434 | 2.65625 | 3 | [] | no_license | export const getAudioAnalysis = (accessToken, id) => {
if (!accessToken) return;
return new Promise(function (resolve, reject) {
const rootUrl = 'https://api.spotify.com/v1';
fetch(`${rootUrl}/audio-analysis/${id}`, {
headers: {
Authorization: 'Bearer ' + accessToken,
},
})
.then((... | true |
2a92903d89e9f0f38f6a2e4f83ad5b6787af5e57 | JavaScript | colefranz/InstantJabber | /server/guestUtils.js | UTF-8 | 1,076 | 2.625 | 3 | [] | no_license | (function(exports) {
'use strict';
var moment = require('moment'),
randomAdjectives,
randomColours,
randomAnimals;
randomAdjectives = [
'Obese',
'Proud',
'Fair',
'Greedy',
'Wise',
'Foolish',
'Tricky',
'Truthful',
'Loyal'
];
randomColours = [
'Beige',
... | true |
7530259772de86e6b540dc2f4ada67f3b163355d | JavaScript | Yahvuh/PoECurrency | /dist/js/main.js | UTF-8 | 1,579 | 2.953125 | 3 | [] | no_license | 'use strict';
const docs = {
jewellersDom : document.getElementById('jewellers'),
alterationDom : document.getElementById('alteration'),
augmentationDom : document.getElementById('augmentation'),
transmutationDom : document.getElementById('transmutation'),
portalDom : document.getElementById('portal'),
wisdomDom... | true |
c593dd606abfdb00e0b9cc7e2d2e6b993b6f4030 | JavaScript | pushpitarathore/async_await | /index.js | UTF-8 | 610 | 4.15625 | 4 | [] | no_license | //lets create a async function
function y() {
return new Promise(function (resolve, reject) {
setTimeout(function () {
reject("anil");
}, 3000);
});
}
async function x() {
//async function always return a promise
let z = await y(); //await always wait for promise
retur... | true |
695e925cca1a9f178c11306f026ec0b22612f5c5 | JavaScript | Artniner/ANNav_crx | /js/background.js | UTF-8 | 1,097 | 2.75 | 3 | [
"MIT"
] | permissive |
chrome.runtime.onMessage.addListener((req, sender, sendResponse) => {
crossRequest(req.url, req.data, sendResponse);
return true; // sendResponse默认只在同步情况下能正常工作,如果是异步情况,需要return true(应该是等待sendResponse完成后再执行后续操作)
});
function crossRequest(url, data, sendResponse){
var ret = '';
myajax = $.ajax({
url: url,
da... | true |
d014ce5f07dbdeafd953a882322e4eed907628a7 | JavaScript | MariyaEA/network | /network/static/network/profile.js | UTF-8 | 632 | 3 | 3 | [] | no_license | document.addEventListener('DOMContentLoaded', function() {
// Select all buttons
let unfollowBtn = document.querySelector('#unfollowBtn')
if (unfollowBtn !== null) {
unfollowBtn.onmouseover = function () {
unfollowBtn.value = "Unfollow"
unfollowBtn.className = "btn following-... | true |
15ed209c09b034c369c4902b82558de05d557126 | JavaScript | zhangwinwin/react-my-blog | /server/lib/bcrypt.js | UTF-8 | 615 | 2.53125 | 3 | [] | no_license | import { SALT_WORK_FACTOR } from '../config'
import bcrypt from 'bcrypt'
// 加密
export function encrypt (password) {
return new Promise((resolve, reject) => {
bcrypt.genSalt(SALT_WORK_FACTOR, (err, salt) => {
if (err) reject(password)
bcrypt.hash(password, salt, function (err, hash) {
if (err)... | true |
f343588d168b3ae64f5bba8abecfaf075e28f667 | JavaScript | jpdiv-code/yaflog | /YAFLog.js | UTF-8 | 3,061 | 2.9375 | 3 | [
"MIT"
] | permissive | 'use strict';
const yaml = require('yaml');
const FLog = require('./FLog');
async function log(level, message, extra, color) {
const consoleEnabled = this.options.enabled;
if (!consoleEnabled && !this.flog) {
return;
}
const t = new Date();
const obj = {
timestamp: t.getTime(),
... | true |
8ac84381aed64f9c8c28df4f398cfbcb0718f8ad | JavaScript | gjveron-auntap/buscaminas | /backend/features/step_definitions/inicio.js | UTF-8 | 582 | 2.84375 | 3 | [] | no_license | "use strict";
const { Given, When, Then } = require('cucumber');
const { expect } = require("chai");
const { Game } = require ("../../srcbusiness/model/game")
Given(/^i have a new game$/, async function () {
let game = this.game = new Game();
game.init(5, 5);
return;
});
When(/^i look at the uncovered board fo... | true |
8d79ca3aa8dfe2c7e9137967962dcd379d29b5fb | JavaScript | xiaoyunyang/coding-challenges | /leetcode/771-jewels-and-stones.js | UTF-8 | 282 | 3.453125 | 3 | [] | no_license | /**
* @param {string} J
* @param {string} S
* @return {number}
*/
var numJewelsInStones = function(J, S) {
const jewels = new Set(J)
let num = 0
for(let i=0; i<S.length; i++) {
const stone = S.charAt(i)
if(jewels.has(stone)) {
num++
}
}
return num
}; | true |
bc1e040cd677b78e1be0cf1446379b9015dc8ec2 | JavaScript | flow-typed/flow-typed | /definitions/npm/plow-js_v2.1.x/test_plow-js_v2.1.x_connections.js | UTF-8 | 1,042 | 2.859375 | 3 | [
"MIT"
] | permissive | // @flow
import * as plow from "plow-js";
/**
* `$all`
*/
plow.$all(plow.$add("foo", "bar"), plow.$add("foo", "foo"))({ foo: ["baz"] });
// $FlowExpectedError
plow.$all(plow.$add("foo", "bar"), plow.$add("foo", "foo"))({ foo: ["baz"] }) *
2;
/**
* `$summarize`
*/
const summarizeOps = [
plow.$contains("foo", ... | true |
293bb5533a2df899287324b172c8dc07b3a9f009 | JavaScript | SimonImanigirimpuhwe/nelly_challenge_one | /posts.js | UTF-8 | 1,004 | 3.21875 | 3 | [] | no_license | const loading_div = document.querySelector(".loading");
const get_user_name = (id) => {
fetch(`https://jsonplaceholder.typicode.com/users/${id}`)
.then((result) => result.json())
.then((data) => {
const header = document.querySelector(".header_title")
return header.innerHTML = `${data.name... | true |
e4492ea39e1c23ee87bad1e2aa9ffb5e3639ae81 | JavaScript | deno287/ParEasy | /Desktop/dip/Controllers/projects/2/100/prepare.js | UTF-8 | 462 | 2.515625 | 3 | [] | no_license | var in_matrix = [];
var out_matrix = [];
var numrows = 4, numcols = 4;
in_matrix = parallel.createZeroMatrix(numrows, numcols);
out_matrix = parallel.createZeroMatrix(numrows, numcols);
in_matrix[0+2*numcols]=9;
in_matrix[0+3*numcols]=2;
in_matrix[1+2*numcols]=1;
in_matrix[1+3*numcols]=7;
in_matrix[2+0*numcols]=9;
in... | true |
9ecf4b59a879402311b2843e0c48cfdffd886e88 | JavaScript | MacroBiz/lotide | /test/middleTest.js | UTF-8 | 1,671 | 3.671875 | 4 | [] | no_license | const middle = require('../middle');
const { assert } = require('chai');
describe('#middle', () => {
it("return '[]' for [1]", () => {
assert.deepEqual(middle([1]), []);
});
it("return '[]' for [1, 2]", () => {
assert.deepEqual(middle([1, 2]), []);
});
it("returns [2] for [1, 2, 3]", () => {
asse... | true |
d8c164ba7a2957f6387d362a5f4eb5b399b51e0f | JavaScript | callmedevmomo/Algorithm_Study | /0223/index.js | UTF-8 | 2,153 | 3.46875 | 3 | [] | no_license | const reducer = (result, currentValue) => currentValue.map((_, i) => [
...result[i] || [],
currentValue[i]
].filter((el) => el !== 0));
const solution = (board, moves) => {
const stacks = board.reduce(reducer, []);
const basket = [];
let result = 0;
for (const i of moves) {
const temp =... | true |
cc0277c42e030738f83974932b39b91cc487fdc6 | JavaScript | sushruth91/restaurant-proj | /restaurant/javascript/js/functions.js | UTF-8 | 673 | 3.96875 | 4 | [] | no_license | //FUNCTIONS ARE OBJECTS
// FUNCTIONS ARE First-CLass Data Types
function multiply(x,y){
return x*y;
}
console.log(multiply(5,3));
multiply.version="v.0.0.12";
console.log(multiply.version);
//Function Factory
function makeMultiplier(multiplier){
var myFunc = function(x){
return multiplier*x;
};
return myFunc;
... | true |
16484ef4a16b0a61e13e4150029da6197c76aa14 | JavaScript | eduardstefanescu10/cms | /public/js/components/categories.js | UTF-8 | 3,984 | 2.59375 | 3 | [] | no_license | // Change labels
$('title').text(lang['title_categories'] + ' | ' + lang['site_name']);
$('h1').text(lang['title_categories']);
$('#label_categories').html('<i class="fas fa-table"></i> ' + lang['title_categories']);
$('#searchText').attr('placeholder', lang['label_categories_placeholder']);
$('#label_category_new... | true |
1cfa75caae1f714fb4f047676a0da3a998cca8a5 | JavaScript | dherault/text_scrambler | /src/Scrambler.js | UTF-8 | 1,821 | 2.84375 | 3 | [
"MIT"
] | permissive | const beautify = require('js-beautify').js
const printDependencies = require('./printDependencies')
const { randomArray } = require('./utils')
let id = 0
class Scrambler {
constructor() {
this.id = id++
this.scramblerParts = []
}
addScramblerPart(scramblerPart) {
this.scramblerParts.push(scramblerP... | true |
1fb60f46c39be6fa5d233c37a0074dbd9fe7c57a | JavaScript | will138-c/web422_assignment1 | /server.js | UTF-8 | 3,183 | 2.515625 | 3 | [] | no_license | /*********************************************************************************
* WEB422 – Assignment 1
* I declare that this assignment is my own work in accordance with Seneca Academic Policy.
* No part of this assignment has been copied manually or electronically from any other source
* (including web site... | true |
67fad38e413f5c0bf563189d8cc758f3266cecbd | JavaScript | Libria/CSE-WebApp | /lab09/Maze!_files/maze.js | UTF-8 | 1,679 | 3.765625 | 4 | [] | no_license | /* CSE3026 : Web Application Development
* Lab 09 - Maze
*/
var loser = null; // whether the user has hit a wall
window.onload = function() {
// Boundary
$$(".boundary").map(current => {
current.observe("mousemove", overBoundary);
})
// End
$('end').observe("mousemove", overEnd);
// ... | true |
7c484db3e632f754826d3455ca4f4714feaad5d8 | JavaScript | GrzegorzKluka/zadanie_8_5 | /js/scripts.js | UTF-8 | 214 | 3.25 | 3 | [] | no_license | var a=prompt("podaj szerokość podstawy");
var h=prompt("podaj wysokość");
triangleArea = a*h/2;
alert('Pole trójkąta o szerokości podstawy a = ' + a + ' i wysokości h = ' + h + ' wynosi: ' + triangleArea); | true |
ddc30baf1899ed40afc03d765434010a782d80d2 | JavaScript | akira-cn/graphics | /common/lib/ogl/math/Color.js | UTF-8 | 1,238 | 3.359375 | 3 | [
"MIT"
] | permissive | import * as ColorFunc from './functions/ColorFunc.js';
// Color stored as an array of RGB decimal values (between 0 > 1)
// Constructor and set method accept following formats:
// new Color() - Empty (defaults to black)
// new Color([0.2, 0.4, 1.0]) - Decimal Array (or another Color instance)
// new Color(0.7, 0.0, 0.... | true |