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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
0a6fe0e169d0c867c38243635ed9e5702957c10a | JavaScript | marraleks/tema-7 | /Oppgavesett/Oppgavesett7/Oppgave34/index.js | UTF-8 | 676 | 3.703125 | 4 | [
"MIT"
] | permissive | // Lage array med frukter
const frukter = ["eple", "banan", "pære", "appelsin", "drue"];
console.log(frukter);
// Sorterer arrayet etter alfabetisk rekkefølge
frukter.sort();
console.log(frukter);
// Legg til ananas og sortere på nytt
frukter.push("ananas");
frukter.sort();
console.log(frukter);
// Finn... | true |
134f896671be4b5a3e9aceaa3e2a7b78179edcf5 | JavaScript | misza-tuts/tracalorie | /app.js | UTF-8 | 11,080 | 3.515625 | 4 | [] | no_license | //Storage controller
//Item controller
const ItemCtrl = (function() {
//Item constructor
const Item = function (id, name, calories) {
this.id = id;
this.name = name;
this.calories = calories;
}
//Data structure / state
const data = {
items: [
{id: 0, name: 'Bigos', calo... | true |
f33ab6df1d81751c5003db7ae2c0ef0a2f95b44e | JavaScript | Path-may1/tinyapp- | /test/test.js | UTF-8 | 1,544 | 2.609375 | 3 | [] | no_license | const { assert } = require('chai')
//const {generateRandomString, urlsForUser, findUserByEmail} = require('../helpers')
const {urlsForUser, generateRandomString} = require('../helpers')
//Databases
const UrlDatabase1 = {
b6UTxQ: { longURL: "https://www.lighthouselabs.ca", userID: "aJ48lW" },
i3BoGr: { lon... | true |
a6405972dd2a3217ec28e4d4c4a6fddc023c89bd | JavaScript | tatsiana1707/js30 | /script.js | UTF-8 | 1,411 | 3.125 | 3 | [] | no_license | const houresArrow = document.querySelector('.houres-arrow');
const minutesArrow = document.querySelector('.minutes-arrow');
const secundesArrow = document.querySelector('.secundes-arrow');
function setDate() {
const now = new Date();
const secundes = now.getSeconds();
const secundesDegrees = ((sec... | true |
821dbe79bbe358b171eb3aa05c4f001afba1411b | JavaScript | NayFreire/morangandoAPI | /controller/produto-controller.js | UTF-8 | 6,919 | 2.65625 | 3 | [] | no_license | const mysql = require('../mysql').pool
//RETORNA TODOS OS PRODUTOS
exports.getProdutos = (req, res, next) => {
mysql.getConnection((error, conn) => {
if(error){
return res.status(500).send({
error: error
})
}
conn.query('SELECT * FROM produto', (error... | true |
acef6ee8c7852722467d73c86addf810d2f2d767 | JavaScript | bkspace/express-normalize-keys | /src/normalize-keys.js | UTF-8 | 4,140 | 3.265625 | 3 | [] | no_license | import changeCase from 'change-case'
import { determine } from './helpers'
const internals = { changeCase }
/**
* Applys a convert function to a passed in Object or Array.
*
* A recursive function that can handle nested Objects, nested Arrays or a mixture
* of both.
*
* Recursive base-case is where an input is... | true |
0eeac57af8af76ca45e0d573254805e1681ef545 | JavaScript | KuroNekoNyaa/banana-phone-mail | /index.js | UTF-8 | 7,780 | 2.5625 | 3 | [] | no_license | // 工具函数
var getCls = function (cls) {
return document.getElementsByClassName(cls)[0];
};
var addCls = function (elem, cls) {
document.getElementsByClassName(elem)[0].classList.add(cls);
};
var removeCls = function (elem, cls) {
document.getElementsByClassName(elem)[0].classList.remove(cls);
};
window.onl... | true |
4f938528f1ecd2ab86119b45e66ecf87f2d99ae1 | JavaScript | arsiag/Coding-Dojo-MEAN | /ModularizedMongooseDashboard/server/models/dog.js | UTF-8 | 997 | 3.15625 | 3 | [] | no_license | // require mongoose
var mongoose = require('mongoose');
// create the schema
var DogSchema = new mongoose.Schema({
name: String,
weight: Number,
color: String
}, {timestamps: true});
DogSchema.path('name').required(true, 'Be careful! Dog name cannot be blank');
DogSchema.path('name').minlength(4, 'Be car... | true |
19589492a6ad3b0a7384c7f7a4cf7122c7907d8f | JavaScript | shivamsaigupta/restaurant-page | /src/tabs/location.js | UTF-8 | 676 | 2.546875 | 3 | [] | no_license | const location = () => {
const mainContainer = document.querySelector('#main-container');
const content = document.createElement('div');
content.classList.add('content-wrapper');
const imgContainer = document.createElement('div');
imgContainer.classList.add('img-container-large');
imgContainer.innerHTML = ... | true |
cd2e53071d00c6d04af904570c1e9bc6892f8c3d | JavaScript | Globobeet/thistothat | /lib/js/models/CategoryMenu.js | UTF-8 | 1,506 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | var CategoryMenu;
(function($, _){
'use strict';
CategoryMenu = function(el, items) {
this.el = el;
this.$el = $(el);
this.items = items;
this.init();
};
_.extend(CategoryMenu.prototype, {
init: function() {
_.bindAll(this, '_handleCategoryClick');
... | true |
7f813591da471dd24351508ff691842a373a7039 | JavaScript | will-weindel/CTCI_Practice_Questions | /Ch 5 - Bit Manipulation/3-flipBitToWin/flipBitToWin.test.js | UTF-8 | 535 | 2.59375 | 3 | [] | no_license | const {flipBitToWin} = require('./flipBitToWin');
const {flipBitToWinn} = require('./flipBitToWin');
const flipBitToWinSol = require('./flipBitToWinSol');
test('Basic flipBitToWin test', () => {
expect(flipBitToWin(0)).toBe(1);
expect(flipBitToWin(1)).toBe(1);
expect(flipBitToWin(3)).toBe(2);
expect(flipBitToW... | true |
7604d5699963a93d643435f1a1e065a68fb26188 | JavaScript | thinkful-ei20/domcam | /decodeEncode.js | UTF-8 | 1,645 | 4.3125 | 4 | [] | no_license | 'use strict';
const decode = str => {
// assign the variable words to the str argument, split into an array at the ' ';
const words = str.split(' ');
// return words, reduced. The Accumulator is what is returned, current value is the current iteration in the array
return words.reduce( (accumulator, currentValu... | true |
0b3a501faf16d9620ea6c26d019403b0c94bdd98 | JavaScript | boombarashk/snake | /src/point.js | UTF-8 | 1,973 | 3.234375 | 3 | [] | no_license | export const FILLING = {
FILL: 'fill',
BORDERL: 'borderLeft',
BORDERR: 'borderRight',
BORDERT: 'borderTop',
BORDERB: 'borderBottom',
CIRCLE: 'circle',
EMPTY: 'empty',
}
export const BORDERWIDTH = 1
export const STEP = 10
export class Point {
constructor(field, x, y, fill = FILLING.FILL,... | true |
3675ada4a05d217131b1556e09c1e314efc663d4 | JavaScript | fullyouth/font-end | /zhufeng-lesson/src/http-server/utils.js | UTF-8 | 246 | 2.515625 | 3 | [] | no_license | const chalk = require('chalk');
const log = console.log
const logger = {
green: (...arg) => log(chalk.green(...arg)),
red: (...arg) => log(chalk.red(...arg)),
blue: (...arg) => log(chalk.blue(...arg)),
}
module.exports = {
logger
}
| true |
e2dea7486495b5a6aef13dd3eaf356bcfc7eba5e | JavaScript | Proglang-TypeScript/tsd-generation-report | /code/typescript-declaration-file-generation/templates/function-as-constructor.js | UTF-8 | 195 | 3.34375 | 3 | [
"CC0-1.0"
] | permissive | function ToUpperCase(a) {
this.run = function () {
return a.toUpperCase();
};
return this.run(a);
}
ToUpperCase("hello");
// "HELLO"
var t = new ToUpperCase("world");
t.run();
// "WORLD" | true |
ee2e903e438f4317512035a0c0e1b886cdf880ad | JavaScript | chapel/beckon | /test/index.js | UTF-8 | 6,116 | 2.8125 | 3 | [
"MIT"
] | permissive | var Lab = require('lab');
var Beckon = require('../');
// Test shortcuts
var expect = Lab.expect;
var before = Lab.before;
var after = Lab.after;
var describe = Lab.experiment;
var it = Lab.test;
function noop() {}
describe('Beckon', function () {
describe('constructor', function () {
it('returns a function'... | true |
c8745b192204beacc826899cf605bef1be930b1b | JavaScript | xrochoa/BlackholeSurfer | /js/utilities.js | UTF-8 | 487 | 3.703125 | 4 | [] | no_license | function randomInteger(min, max) {
var random = Math.floor(Math.random() * (max - min + 1)) + min;
return random;
}
var generateWeighedList = function(list, weight) {
var weighedArray = [];
// Loop over weights
for (var i = 0; i < weight.length; i++) {
var multiples = weight[i] * 100;
... | true |
5ce17165dbfb29b67d614816221c1ff052e9502e | JavaScript | NahiyanNashrah/Unit-test-with-Jest | /anagram.js | UTF-8 | 192 | 3.0625 | 3 | [] | no_license | const checkAnagram = (str1, str2) => {
return format(str1) === format(str2);
}
function format(str) {
return str.toLowerCase().split('').sort().join('');
}
module.exports = checkAnagram; | true |
04f6f9d569acb7bcf093a8e71d05e6bcad416a87 | JavaScript | shanesyy/piano-interative-demo | /js/video.js | UTF-8 | 5,932 | 3.171875 | 3 | [] | no_license | // Get a handle to the player
player = document.getElementById('video-element');
btnPlayPause = document.getElementById('btn-play-pause');
btnMute = document.getElementById('btn-mute');
progressBar = document.getElementById('progress-bar');
volumeBar = document.getElementById('volume-bar');
btnFaster ... | true |
b3f2bee00dc273b636a2b8cac577502d048ea170 | JavaScript | VovanR/time-progress | /js/item/base-item.js | UTF-8 | 4,288 | 2.640625 | 3 | [
"MIT"
] | permissive | import {createElement} from '../utils.js'
class BaseItem {
constructor() {
this.name = null
this.currentDate = null
this.labelElement = null
this.valueOutputElement = null
this.maxValueOutElement = null
this.valuePercentElement = null
this.meterElement = null
this.meterElement = nul... | true |
5b9408f985fc3120f3e9fe0cb859d86d8c866e34 | JavaScript | shashankcm/JS-Questions | /Challenges-master/CodeWars.com/rot13.js | UTF-8 | 264 | 3.609375 | 4 | [] | no_license | let alphabet = 'aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZaAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ'
const isLetter = (letter) => alphabet.includes(letter)
function rot13(message) {
return message.split('').map(char => isLetter(char) ? alphabet[alphabet.indexOf(char) + 26] : char).join('')
}
c... | true |
f10583eac276a2f57f811170501018f429ecc740 | JavaScript | dondarrion91/marvelApp | /src/components/Heroes/Pagination.js | UTF-8 | 3,767 | 2.515625 | 3 | [] | no_license | import React,{Fragment,useEffect,useState} from "react"
import PaginationBody from "./PaginationBody";
import axios from 'axios';
import PaginationNav from "./PaginationNav";
import { Link } from "react-router-dom";
import styled from '@emotion/styled';
// styles
const NavContainer = styled.nav`
background: #b97... | true |
9378498fe8bb5e3ac73592a91d66c54de87470b9 | JavaScript | Robo-EX/Counter_App | /src/components/counter.jsx | UTF-8 | 1,445 | 2.515625 | 3 | [] | no_license | import React, { Component } from "react";
class Counter extends Component {
formatCount() {
const val = this.props.counter.value;
return val === 0 ? "Zero" : val;
}
getBadgeClass() {
let classes = "badge m-3 badge-";
classes += this.props.counter.value === 0 ? "info" : "primary";
return clas... | true |
651e98a69ec96cf42890d803068de065389702da | JavaScript | scottcarpenter28/365-day-coding-challenge | /365 day code challenge/scripts/stringSum.js | UTF-8 | 1,089 | 3.765625 | 4 | [] | no_license | $(document).ready(function() {
// Get value on button click and show alert
$("#output").click(function() {
var num1 = new stringNumber($('#num1').val());
var num2 = new stringNumber($('#num2').val());
var carry = 0;
var result = "";
do {
var val1 = parseInt(num1.getIndex())
var val2... | true |
317fd66f40d9ba7a5c8e31a166358b737c9ffd8a | JavaScript | agnespravida/deploy-exp | /server/controllers/controllers.js | UTF-8 | 678 | 2.78125 | 3 | [] | no_license | const { Data } = require("../models/index.js")
class Controller {
static showAll(req, res){
Data.findAll()
.then(data => {
res.status(200).json(data)
})
.catch(err => {
console.log(err.message + " <<< ini dari showAll")
res.status(500).json(err)
})
}
static addD... | true |
73cc5ab66330b843efa3026c121acd6c8bf49df8 | JavaScript | christhoval06/daflon | /src/screens/machine.screen.js | UTF-8 | 3,279 | 2.5625 | 3 | [] | no_license | import React, {Component} from 'react';
import {inject, observer} from 'mobx-react';
import {Button, Col, Row} from "reactstrap";
import {ReelModel} from "../models";
import {ReelComponent} from "../components";
import {API} from "../api";
@inject('GameStore') @observer
class MachineScreen extends Component {
const... | true |
eb2ded41586917213ac5bc68ef527fe981b59333 | JavaScript | pengzzp/mzhan | /src/scripts/units/change.js | UTF-8 | 579 | 2.59375 | 3 | [] | no_license | // 切换界面
function Change(){
this.url=''
this.routes={}
}
Change.prototype={
constructor:Change,
init(){
window.addEventListener('load',this.refresh.bind(this))//初始化
window.addEventListener('hashchange',this.refresh.bind(this))//地址栏hash变化时切换界面
},
route(url,cb){//将界面url存储到数组中
var ... | true |
42fd543a44eac0ad267929f63de2d60ab2395231 | JavaScript | JJezorske/oreo | /script.js | UTF-8 | 1,863 | 3.5625 | 4 | [] | no_license |
//var heading = document.getElementById("heading");
//console.log("This is an elemnt of type: ", heading.nodeType );
//console.log("The inner HTML is", heading.innerHTML );
//console.log("There are this many child objects ", heading.childNodes );
var myLinks = document.getElementsByTagName("a");
console.log(myLinks.l... | true |
ccb2af9f80966c8927e3dd99508801d1bd7b5cb0 | JavaScript | Makmiko/JS | /Lesson4/js/js.js | UTF-8 | 2,374 | 3.84375 | 4 | [] | no_license | //Задача про города
cities = [
"New York",
"Magnitogorsk",
"Juvyasculya",
"Throneheim",
"Auraangabad",
"Verona"
];
function citySort(cities) {
cities.sort((item1, item2) => {
if (item1.toLowerCase() < item2.toLowerCase()) {
return -1;
}
if (item1.toLowerCase() == item2.toLowerCase()) {
... | true |
92168b84005c21a3c618eec491b9ed6c0ff5e2b3 | JavaScript | kalibria/learning-JS | /01-basics/fibonacciNumbers.js | UTF-8 | 1,258 | 3.84375 | 4 | [] | no_license | var fibonacciNumbers = [1, 1];
var numbersQuantity = 7;
var nextNumber = fibonacciNumbers[0] + fibonacciNumbers[1];
fibonacciNumbers.push(nextNumber);
for(var i = 1; i < numbersQuantity; i++){
nextNumber += fibonacciNumbers[i];
fibonacciNumbers.push(nextNumber);
}
console.log(fibonacciNumbers);
/* Техническо... | true |
75a028d2da8d8bb70223b6105a0b7056c26e59e2 | JavaScript | slmarshall1/Ass_4_chartjs_marshalls | /official_chart_assignment/script/chart.js | UTF-8 | 4,772 | 2.75 | 3 | [] | no_license | //create function and variable for the chartContainer(canvas) this is where the chart will display on the webpage
window.onload = function () {
var chart = new CanvasJS.Chart("chartContainer",
{
title:{
text: "Annual Sales"//chart title
},
//
axisX:{
valueFor... | true |
dd0001ca27270502c3a9bd0baf0e62a30a5a7a4e | JavaScript | Madisonkanna/coding_challenges | /deepEquality/deepEquality.js | UTF-8 | 1,747 | 3.796875 | 4 | [] | no_license | /**
* Write a function that, given two objects, returns whether or not the two
* are deeply equivalent--meaning the structure of the two objects is the
* same, and so is the structure of each of their corresponding descendants.
*
* Examples:
*
* deepEquals({a:1, b: {c:3}},{a:1, b: {c:3}}); // true
* dee... | true |
b677c3b64b85aebf4fa368071c309874ec6238f9 | JavaScript | connorrhodes/week-4-game | /assets/javascript/game.js | UTF-8 | 5,441 | 3.796875 | 4 | [] | no_license | // Instructions:
// The player will have to guess the answer, just like in Hangman.
// This time, though, the player will guess with numbers instead of letters.
// Here's how the app works:
// There will be four crystals displayed as buttons on the page.
// The player will be shown a random number at the start of the ... | true |
783f10f94d3038053f00493a85f8613e040a6dad | JavaScript | px29/leetcode | /topics/c3/squareFreeNumber.js | UTF-8 | 271 | 3.171875 | 3 | [] | no_license | function squareFreeNumber(n) {
if (n % 2 === 0) {
n = Math.floor(n / 2);
}
if (n % 2 === 0) {
return false;
}
for (let i = 3; i < Math.sqrt(n); i += 2) {
if (n % i === 0) {
n = Math.floor(n / i);
}
}
}
| true |
c0c6521ae2becc54c472f7934b00572d3791cc68 | JavaScript | Charliechin/MathOperations | /index.js | UTF-8 | 2,968 | 3.515625 | 4 | [] | no_license |
// var op1 = {
// num1: ,
// num2: ,
// operation: ,
// result:
// };
// Note to futureSelf, on load this component, the first thing
// to do is get the result and compute it
var op1 = {
num1: 2,
num2: 2,
operation: '+',
result: 4
};
const { num1, operation, num2, result } = op1;
var computeOperato... | true |
7154b2ad096bfe56f410bbeacbbce9abe8d5fabc | JavaScript | 51ding/node-design-pattern | /异步编程/util.js | UTF-8 | 939 | 2.515625 | 3 | [] | no_license | const url = require('url');
var cheerio=require("cheerio");
var sha1=require("sha1");
//exports.urlToFileName=fuffeunction(urlStr,callback){
// let urlObj;
// try{
// urlObj=url.parse(urlStr,true);
// }
// catch(error){
// return callback(error);
// }
// callback(null,(urlObj.href+".html").replace(/\/\//,"... | true |
dfe31c42bfb9f16c22735d1d9ff0cb2ffdaf9f96 | JavaScript | jamescalverley/homework-10-employee-template | /Develop/app.js | UTF-8 | 8,896 | 3.328125 | 3 | [] | no_license |
const inquirer = require("inquirer");
const fs = require("fs");
let ID = 1;
let employeeList = [];
class Employee {
constructor( name, role, email ){
this.id = ID++;
this.name = name;
this.role = role;
this.email = email;
}
};
class Manager extends Employee {
constructor(... | true |
3caeb7836a07378ab1e5102ec9c9bbb4f1a47619 | JavaScript | nyatla/matatabi_contract | /ui/src/js/deployui.jsx | UTF-8 | 11,617 | 2.578125 | 3 | [
"MIT"
] | permissive | /*
トークンのデプロイ画面。
2つの機能を提供する。
1.パラメータの入力フォームとコントラクトのデプロイ機能
2.デプロイ結果の表示とブログパーツの生成機能への引き渡し
*/
import React from 'react';
import ReactDOM from 'react-dom';
import { isNumber } from "util";
import StringInput from "./parts/StringInput.jsx";
import UIntInput from "./parts/UIntInput.jsx";
import AddrI... | true |
ce261a12fc0149d96ee0c9f0b88c3f566f8be994 | JavaScript | robbiebart/project-m2-nyan-cat | /js/data.js | UTF-8 | 1,055 | 3.375 | 3 | [] | no_license | // In this file we have some data that the other source files will use.
// Most of this data is stored in constants.
// Constants are just variables that never change. By convention,
// We write constants with upper case letters.
// The GAME_WIDTH and GAME_HEIGHT constants denote the size
// of the game area in pixels... | true |
d1a065a1d320f3c3cb9fbd9dae916377a52afbbb | JavaScript | LeonardoALARCON/TPJS-Ex2 | /scraper.js | UTF-8 | 6,158 | 2.75 | 3 | [] | no_license | 'use strict';
/**
* Web Scraper
*/
// Instead of the default console.log, you could use your own augmented console.log !
// var console = require('./console');
// Url regexp from http://daringfireball.net/2010/07/improved_regex_for_matching_urls
var scraper = function (queue, api, page, i){
console.log = ... | true |
a3738b79da017a19acc0249619f18d80186f1086 | JavaScript | ggupta78/fcc | /js-algo-ds-cert/intermediate-algo-scripting/Steamroller.js | UTF-8 | 487 | 3.453125 | 3 | [] | no_license |
function steamrollArray(arr) {
// I'm a steamroller, baby
let result = [];
var recursivePop = function(arg) {
if(!Array.isArray(arg)) {
result.push(arg);
} else {
arg.forEach(element => {
recursivePop(element);
});
}
};
... | true |
bae2288c3f9861d13a0a38918c4708d66e4e33e4 | JavaScript | Avinash-Murugappan/Vote-Favorite-Student | /src/components/InputForm.js | UTF-8 | 2,488 | 2.765625 | 3 | [] | no_license | import React, {useState} from 'react'
import { Link, useHistory, BrowserRouter as Router } from 'react-router-dom';
// *write something
// !something is wrong here
//TODO:
const InputForm = ({setData, data}) => {
const [name, elName] = useState("")
const [email, setEmail] = useState("")
const [tel, setTe... | true |
a8610aacef11f8576bf1d16092a84515ecca5cdd | JavaScript | bburns/dnd-rules | /scripts/nm2json.js | UTF-8 | 3,080 | 3.171875 | 3 | [] | no_license | // given raw neomem text, output json
const fs = require('fs')
// const path = require('path')
// const s = fs.readFileSync(path.resolve(__dirname, '../../assets/rules.neomem'), 'utf-8')
const s = fs.readFileSync(0).toString()
const lines = s.split('\n')
const regexps = {
dashes: /^----+$/, // blocks are offset ... | true |
7bfb05d42b3fff9df094896879e4330dfad36a15 | JavaScript | safayetjamil647/javascript | /operator.js | UTF-8 | 55 | 2.796875 | 3 | [] | no_license | var x=10;
var y=20;
console.log(x+y);
console.log(x-y); | true |
fd841350847228f244ffe16dca22d0668f5b4a6c | JavaScript | cli333/algos | /dp134.js | UTF-8 | 2,412 | 3.78125 | 4 | [] | no_license | // Given two words(beginWord and endWord), and a dictionary's word list, find all shortest transformation sequence(s) from beginWord to endWord, such that:
// Only one letter can be changed at a time
// Each transformed word must exist in the word list.Note that beginWord is not a transformed word.
// Note:
// Retu... | true |
c6ed01d10c85cba6c622bb610d0bfc12504a1460 | JavaScript | beaufortfrancois/video-text-to-clipboard-chrome-extension | /main.js | UTF-8 | 1,964 | 2.75 | 3 | [] | no_license | chrome.runtime.onInstalled.addListener(function() {
// When the app gets installed, set up the context menus
chrome.contextMenus.create({
id: 'id',
title: 'Add video text to clipboard',
contexts: ['video']
});
});
chrome.contextMenus.onClicked.addListener(function(info, tab) {
const code = `(functi... | true |
873260bd845233fb0ecc1368eb1831292d72155d | JavaScript | dzrise/rosa | /src/services/FormDataCreator/index.js | UTF-8 | 344 | 2.828125 | 3 | [] | no_license | export function formDataCreator(data) {
if (!Object.keys(data).length) return;
const formData = new FormData();
Object.keys(data).forEach(key => {
if (data[key] instanceof Array) {
data[key].forEach(item => {
formData.append(`${key}[]`, item);
});
} else {
formData.append(key, data[key]);
}
});
... | true |
c044b179193fa434006c2e343a06cb2f81951ead | JavaScript | farheenfatima3/Fun-with-triangles | /quiz.js | UTF-8 | 659 | 3.28125 | 3 | [] | no_license | const userForm = document.querySelector(".quiz-form")
const btn = document.querySelector("#submit-btn")
const testing = document.querySelector("#test")
btn.addEventListener("click", quiz)
function quiz() {
let forms = new FormData(userForm)
const ans = ["15cm", "32cm", "6", "35"]
let score = 0;
... | true |
c3ad9bcd6c00c889d14eebbd4c958e3fa4a53097 | JavaScript | thomasgengel34/Lamb_N_Lentil_Javascript | /Scripts/httpFoodList.js | UTF-8 | 1,493 | 2.5625 | 3 | [] | no_license | "use strict";
const httpFoodList = {
key:"sFtfcrVdSOKA4ip3Z1MlylQmdj5Uw3JoIIWlbeQm",
ingredientSearchSubmit: async function ingredientSearchSubmit(search) {
let searchUrl = foodList.buildFoodListSearchUrl(search);
const responseJson = await httpFoodList.httpCall(searchUrl);
... | true |
9c49d3e05aac812af5bfb487812b738483bc9431 | JavaScript | Zagoshipda/react | /hello-react/src/test2.js | UTF-8 | 728 | 4.0625 | 4 | [] | no_license | // https://underbleu.com/Javascript/var-keyword/
// https://developer.mozilla.org/en-US/docs/Glossary/Hoisting
var a = 'a';
// function scope
function func() {
// 지역변수로 var scope가 이미 정의되었기 때문에 지역변수로 사용된다.
console.log('-----inside function');
console.log(a); // undefined, javascript only hoists declarations, NO... | true |
1cf464a9cb765ce56676e5c28e528e64f4058f94 | JavaScript | superman2211/CanvasScript3 | /src/cs3/events/TweenEvent.js | UTF-8 | 978 | 2.640625 | 3 | [
"MIT"
] | permissive | var TweenEvent = new Class(Event, function()
{
this.__init__ = function(type, time, position, bubbles, cancelable)
{
Event.call(this, type, bubbles, cancelable);
this.time = time;
this.position = position;
};
this.clone = function()
{
return new TweenE... | true |
49e4292bb811ee63095dbcc8b1bc329da2ce9eed | JavaScript | TrevTheDev/mash | /src/parsers/rm.js | UTF-8 | 1,254 | 2.546875 | 3 | [
"MIT"
] | permissive | /* eslint-disable no-param-reassign */
import { LOCAL, glob } from '../util/globals.js'
/**
* @param {FsObject|FilePromise|File|Directory} fsObject
* @param {boolean} recursive
* @param {boolean} limitToCWDFilesystem
* @param {boolean} onlyIfExists
* @returns {boolean}
*/
export const rm = async (fsObject, recurs... | true |
ec69055c382dc6a4dc86fae9930e0fedf6c4a3ff | JavaScript | XinChou16/MIX | /algorithms/interview/string-combine.js | UTF-8 | 491 | 3.96875 | 4 | [] | no_license | /**
* 字符串组合
* 输入'abc'
* 输出所有可能的字符串组合
*/
function getStringCombine(arr) {
let ret = [];
const loop = (word) => {
if (word.length === arr.length) {
return ret.push(word);
}
for (let i = 0; i < arr.length; i++) {
if (word.includes(arr[i])) continue;
... | true |
0a8689e584f07bbb7e9b0d6fdf83acbbfa3cda34 | JavaScript | delymar/marvel | /app/services/favorite.service..js | UTF-8 | 2,798 | 2.515625 | 3 | [] | no_license | /**
* Created by Delymar on 23/10/2016.
*/
(function () {
'use strict'
angular.module('app').
factory('favoriteService', favoriteService);
favoriteService.$inject = ['apiService', '$q'];
function favoriteService(apiService, $q) {
var favoriteService = {
add: add,
... | true |
bd3671353706ff6faa71432a90915a5fea48b13d | JavaScript | hallamoore/hallamoore.github.io | /resrcful/components/timeline/employees.js | UTF-8 | 2,929 | 3.203125 | 3 | [] | no_license | import { Element } from "../../element.js";
const getInitials = (name) => {
const parts = name?.split(/\s/) || [];
if (parts.length === 0) {
return "";
}
if (parts.length === 1) {
return parts[0][0].toUpperCase();
}
return `${parts[0][0]}${parts.at(-1)[0]}`.toUpperCase();
};
// Returns values betw... | true |
aad7b6e5acdde42f71229e5d9d22ca7124e38fdc | JavaScript | CyberTaoFlow/Snowman | /Source/server/web/static/js/manipulator.js | UTF-8 | 30,505 | 2.84375 | 3 | [] | no_license | /*
* This javascript contains all the code used for the little button box on the left.
*
*/
// This function binds all the button clicks in the manipulator.
function initializeButtons() {
$('#manipulator button#enable').unbind('click');
$('#manipulator button#enable').click(function(event){
// Reset this but... | true |
a25bdbd0c1ac3eccdefa38753994fd12e910e898 | JavaScript | navaneeth-rajagopalan/path_finding_visualization | /src/PathfindingVisualizer/PathfindingVisualizer.js | UTF-8 | 3,371 | 2.890625 | 3 | [] | no_license | import React, { Component } from 'react';
import Node from './Node/Node';
import Dijkstra from '../Algorithms/Dijkstra';
import classes from './PathfindingVisualizer.module.css';
class PathfindingVisualizer extends Component {
constructor(props) {
super(props);
const grid = [];
this.gridRow... | true |
09fc272c18d55e3fb4b00cee3c286d198ff62251 | JavaScript | iamtodorg/github_open_issues | /script.js | UTF-8 | 1,376 | 2.65625 | 3 | [] | no_license | $(function () {
$(".my-form").on('submit', function (e) {
var repo = $('.repo').val();
var endpoint = 'https://api.github.com/repos/' + repo + '/issues';
$.get(endpoint, function (data) {
if (!data.length) {
$('.message').html('No issues for: ' + repo);
... | true |
d13a867731ccf3c9a7dfb12c97ad0f6038821b50 | JavaScript | jkjithesh/jk | /study/js/User.js | UTF-8 | 867 | 2.96875 | 3 | [] | no_license | class User{
constructor(name, age, email){
this.name = name;
this.email = email;
this.age = age;
}
courseList = [];
getInfo(){
return {name: this.name, email: this.email}
}
enrollCourse(name){
this.courseList.push(name);
}
getCourseList(){
... | true |
7ae8ae9343e37bb82e87aac9209309741f9be9f1 | JavaScript | dltkqnr/dltkqnr.github.io | /jsexer05/app1.js | UTF-8 | 348 | 3.5 | 4 | [
"MIT"
] | permissive |
var number = 0;
var holder;
window.onload = function() {
holder = setInterval(countUp,100);
showNumber();
}
function countUp() {
if(number<100)
number ++;
else
clearInterval(holder);
console.log(".");
showNumber();
}
function showNumber(){
document.querySelector('#dis... | true |
b6fdaad6ee729974a2e9f295709132111311b06d | JavaScript | starosta1721/js_programming | /JS_training/код JS разбитие любого числа на отдельные числа.js | UTF-8 | 269 | 3.15625 | 3 | [] | no_license | function max(arr) {
var arrMax, temp = arr[0];
for (i = 0; i < arr.length; i++) {
if (arr[i] > temp) {
arrMax = arr[i];
temp = arr[i];
} else {
arrMax = temp;
temp = arr[i];
};
};
console.log(arrMax);
};
max([234, 0, 123, 456, -3, -100, 1234]);
| true |
d90bff992a2db95cc69f8d30eb2e00ac70b7285b | JavaScript | SantiagoFrers/React-Udemy-03-Test-JEST-ENZYME | /src/tests/base/02-template-string.test.js | UTF-8 | 542 | 3.046875 | 3 | [] | no_license | import {getSaludo} from '../../base/02-template-string'
describe('Pruebas en 02-template-string.js', () =>{
test('getSaludo debe retornar hola + nombre ', () => {
const nombre = 'Santi'
const saludo = getSaludo( nombre );
expect ( saludo ).toBe('Hola ' + nombre)
})
// getSaludo deberia r... | true |
3bda3a5a3daed42173d745feed2bd8da84ed9a29 | JavaScript | MarcRodrigFelix/js-advanced-functions-first-class-functions-lab-onl01-seng-pt-030220 | /index.js | UTF-8 | 810 | 3.625 | 4 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | const returnFirstTwoDrivers = (arraysOfDrivers) => {
let firstDrivers = arraysOfDrivers.slice(0,2)
return firstDrivers
};
const returnLastTwoDrivers = function(arraysOfDrivers){
let lastDrivers = arraysOfDrivers.slice(-2)
return lastDrivers
};
const selectingDrivers = [
returnFirstTwoDrivers,
returnLast... | true |
3a8ba6936ea6a27bec8df95281bacdae955d219a | JavaScript | jennifer0101/we-will-be-done-by-christmas | /client/src/components/Form/form.js | UTF-8 | 2,225 | 2.78125 | 3 | [] | no_license | import React from "react";
import API from "../../utils/API"
import "./formstyle.css";
class Form extends React.Component {
constructor(props) {
super(props);
this.state = {
itemName: " ",
amountItem: " ",
expiration: " ",
takeBy: " ",
note: " ",
contact: " ",
};
... | true |
1127b5b83f631e24078392bf73acae4d52ee8b61 | JavaScript | DMU-P2614812/labs | /TECH1015_CW2/js/index.js | UTF-8 | 526 | 3.0625 | 3 | [] | no_license | /* When 'menu' is clicked, toggle between hiding and showing the dropdown content */
function toggleMenu() {
document.getElementById("menu-dropdown").classList.toggle("show");
}
// Close the dropdown if the user clicks outside of it
window.onclick = function(event) {
if (!event.target.matches('.drop-btn... | true |
52303f5085aae3c7592ef138ef829671af124dc2 | JavaScript | bilyananinova/JS-Advanced | /Exercise Advanced Functions/Next Article/script.js | UTF-8 | 393 | 2.96875 | 3 | [] | no_license | function getArticleGenerator(articles) {
return function showNext() {
if (articles.length > 0) {
let output = document.getElementById('content')
let article = document.createElement('article')
article.textContent = articles.shift();
output.appendChild(ar... | true |
b0289a779f8745bbb43d95d247e059d804989901 | JavaScript | hsmail02/19.5-rookies | /react/seminar1/counter-example/5.counter-example-final/Counter.js | UTF-8 | 554 | 2.546875 | 3 | [] | no_license | import React, {useState} from 'react';
import './Counter.css';
const Counter = (props) => {
const [isHiddenValue, setIsHiddenValue] = useState(false);
return (
<div>
<h1>value: {!isHiddenValue && props.value}</h1>
<button onClick={props.incrementValue}>+1</button>
<span className="hideInputW... | true |
4901a94b949d27d400766fa0024b3453234c4b68 | JavaScript | Dulal-12/JavaScriptPractice-Basic | /function.js | UTF-8 | 196 | 3.296875 | 3 | [] | no_license | function addMachine ( a, b ) { //function istatement
return a+b;
}
var add = function(a,b){
return a+b;//function expression
}
const result = add ( 100,200);
console.log(result); | true |
4a033b7044bc087ca9692afc3200b6252a8d5051 | JavaScript | szimmers/udemy-nodejs-learn-understand | /s07-http-web-server/60/app.js | UTF-8 | 453 | 2.6875 | 3 | [] | no_license | const http = require('http');
const fs = require('fs');
http.createServer(function(req, res) {
console.log(`${req.url}...`);
res.writeHead(200, {
'Content-Type': 'text/html'
});
let path = `${__dirname}/index.html`;
// providing the encoding type coverts it from buffer to string
let html = fs.readFileSync(pat... | true |
7cb1853964c6fe23c8ef621fa32eebf5d64f4ddc | JavaScript | anushibin007/middleman | /functions/utils/utilities.js | UTF-8 | 420 | 2.75 | 3 | [] | no_license | const path = require("path");
/**
* For now, the hash function gives a Base 64 encoding of the input
*/
exports.getHash = (input) => {
return encodeURIComponent(Buffer.from(input).toString("base64"));
};
exports.unHash = (input) => {
const decodedInput = decodeURIComponent(input);
return Buffer.from(decodedInput... | true |
19834878a302e01a824e1554a26d01f81c8429fa | JavaScript | baersc/FCCAlgorithms | /arguments-optional.js | UTF-8 | 1,185 | 4.46875 | 4 | [] | no_license | // Create a function that sums two arguments together. If only one argument is
// provided, then return a function that expects one argument and returns the
// sum.
// For example, addTogether(2, 3) should return 5, and addTogether(2) should
// return a function.
// Calling this returned function with a single... | true |
4f1810c7245cd07d7d9c36801f99d0230a910666 | JavaScript | kchapelier/convchain-gpu | /index.js | UTF-8 | 10,509 | 2.8125 | 3 | [
"MIT"
] | permissive | "use strict";
const Context = require('./webgl2/context');
/**
* ConvChainGPU constructor.
*
* @param {Array|Uint8Array} sample Sample pattern as a flat array or a 2D array.
* @param {int} [sampleSize] Indicate the width and height of the sample when used with a flat array, if omitted assume the sample is a squar... | true |
d8e446ae0424f1f5da0cac9901a35c4547199754 | JavaScript | 3eyeRaven/naked_javascript | /React16/whatisReact.js | UTF-8 | 1,177 | 3.375 | 3 | [] | no_license | //What is React?
//What? Why? How?
//
//React is a JavaScript Library for building User Interfaces"
//React uses 'components to for building User Interfaces.'
//
//React runs in the browser instead of the server.
//
//Components?
//Displays image of components on webpage: Header/ Sidebar/ Headline/ Article Content
//
/... | true |
9af573f8bd6e74b770ed1aa4976b10e59ce8078a | JavaScript | ItsAsta/CST2120_Game_Website | /assets/scripts/indexJS.js | UTF-8 | 1,636 | 3.375 | 3 | [] | no_license | $(document).ready(function () {
// An on click function that logs out by removing the cookie if the element specified is clicked.
$("#account-status").click(function () {
document.cookie = "username=; expires=Thu, 01 Jan 2000 12:12:12 GMT; path=/;"
});
console.log("Index Ready")
});
//This fun... | true |
2c89bbd61c2bfb3d885e457366a023eaa4d1e394 | JavaScript | transitive-bullshit/primitive | /lib/rasterize.js | UTF-8 | 1,912 | 3.109375 | 3 | [
"CC0-1.0",
"MIT"
] | permissive | import Scanline from './scanline'
/**
* Converts a polygon to an array of rasterizable scanlines.
*
* @param {Array<Object>} points
* @return {Array<Scanline>}
*/
export default (points) => {
const lines = []
let edges = []
for (let i = 0; i < points.length; ++i) {
const p1 = points[i]
const p2 = (... | true |
c3e63ea9a7702dac16e72530c534f3cc01e63280 | JavaScript | maym4y/trybe-exercises | /exercises/bloco_4/dia_2/desafio1.js | UTF-8 | 95 | 3.09375 | 3 | [] | no_license | let numbers = [5, 9, 3, 19, 70, 8, 100, 2, 35, 27];
for (x of numbers){
console.log(x);
}
| true |
34ed00985eea86ea33a31fc253dc73bb86fb58a3 | JavaScript | kevsaj/test | /Random.js | UTF-8 | 296 | 2.859375 | 3 | [] | no_license | export function floatValue(min, max) {
return Math.random() * (max - min) + min
}
export function integerValue(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min
}
export function color() {
return '#'+Math.floor(Math.random()*16777215).toString(16)
} | true |
b2e9514a87b8444b87387228a378df4ca3e7bd7f | JavaScript | ctkxf/test.github.io | /js/regist-js/password.js | UTF-8 | 4,401 | 3.734375 | 4 | [
"MIT"
] | permissive | /**
* 这是一个外部js文件,用来判断用户输入的密码的安全程度
*/
/**
* 设计一个函数,用来给强弱程度进行颜色变化
*/
function color(){
var level=choose();//调用choose函数,该函数是用来判断密码的强弱程度的
switch(level){//根据强弱程度来进行判断
case 0://为0时,输入的密码不符合规范
break;
case 1://为1时,密码只含有数字或小写字母,大写字母或特殊字符,密码强度为弱
$("#ruo").addClass("... | true |
252a3861137b2def7470bd6bbf20e8e0b89373dc | JavaScript | JelenaMarjanovic/bit-pp | /ES5/conditions/Exercise_00.js | UTF-8 | 625 | 3.34375 | 3 | [] | no_license | var bankBalance = 302.64; // 302.64, 0, NaN
var phonePrice = 99; // 99, 999, NaN
var isBankBalanceValid = (typeof bankBalance === 'number') && !!bankBalance;
var isPhonePriceValid = (typeof phonePrice === 'number') && !!phonePrice;
result = '';
if(bankBalance <= 0) {
result = "You're broke!";
} else {
if(isBan... | true |
55d22570049b5282ac008a99e1597c8fffd36099 | JavaScript | alexprey/sveltedoc-parser | /lib/jsdoc.js | UTF-8 | 6,367 | 2.734375 | 3 | [
"MIT"
] | permissive |
const PARAM_NAME = '[a-z0-9$\\.\\[\\]_]+';
const TYPE = '\\{(.*)\\}';
const TYPE_DESC = '-?\\s*(.*)';
const PARAM_TYPE = '\\{((?:\\.\\.\\.)?[^\\}]*)=?\\}';
const TYPE_RE = new RegExp(`^\\s*${TYPE}`, 'i');
const PARAM_RE = new RegExp(`^\\s*(?:${PARAM_TYPE}\\s+)?(?:\\[\\s*(${PARAM_NAME})\\s*(?:=\\s*([^\\]]+))?... | true |
7e10e590e5cd3e8f507ba3efbfd03308027ac6cc | JavaScript | wangqingxian/springBoot | /action-wanjia-root/action-wanjia-oa/src/main/webapp/assets/js/preview.js | UTF-8 | 2,087 | 2.640625 | 3 | [
"MIT"
] | permissive | //从地址中获取参数
function getQuery(name){
var reg =new RegExp("(^|&)"+name+"=([^&]*)(&|$)"),
r=window.location.search.substr(1).match(reg);
if(r !== null){
return r[2];
}
return null;
}
$(function(){
var next = 0;
var last = 0;
var ImgUrl = []; //存放所有图片地址的
//漫画浏览
$.ajax({
url: rc+"/review/showBookInfoAndPag... | true |
db587b94881ad04d889fa0226216de05bf9841bf | JavaScript | Andreas-Beer/visualFunctionAnalyser | /public_html/js/model/stringRepresentation.js | UTF-8 | 868 | 3.5 | 4 | [] | no_license | function stringRepresentation (val) {
var type = typeof val;
if (type === 'string') {
return '"' + val + '"';
}
if (type === 'undefined') {
return 'undefined';
}
if (type === 'object') {
if (!val) {
return 'null';
}
var cnst = val.constructor;
if (cnst === Ar... | true |
d3bd5a6f4bbb7565d44e81ab163686d8f56e2ca9 | JavaScript | MatthewLee4/scene-it-starter | /watchlist.js | UTF-8 | 1,357 | 3.484375 | 3 | [] | no_license | //WAITS FOR PAGE TO LOAD BEFORE DOING WHAT'S BELOW
document.addEventListener('DOMContentLoaded',function() {
//GETTINGNG WATCHLIST FROM LOCALSTORAGE
let watchlistJSON = localStorage.getItem('watchlist');
let watchlistMovies = JSON.parse(watchlistJSON);
//FUNCTION FOR GENERATING MOVIE CARDS
fun... | true |
363ecae197ce7e7b3344641d3632ca99232c4356 | JavaScript | HoracioTito/Practica_js | /squares.js | UTF-8 | 1,390 | 4.6875 | 5 | [] | no_license | // A square of squares
// You like building blocks. You especially like building blocks that are squares.
// And what you even like more, is to arrange them into a square of square building blocks!
// However, sometimes, you can't arrange them into a square.
// Instead, you end up with an ordinary rectangle! Those b... | true |
ff246d927eb7b5d59a3081f54f9619f234b02a1f | JavaScript | bilyananinova/JS-Basic | /MoreExercises/NestedLoops-MoreExercises/profit.js | UTF-8 | 760 | 3.625 | 4 | [] | no_license | function profit(arg) {
let oneLvCount = Number(arg[0]);
let twoLvCount = Number(arg[1]);
let fiveLv = Number(arg[2]);
let sum = Number(arg[3]);
let print = '';
let counterA = 0;
let counterB = 0;
let counterC = 0;
for (let a = 0; a <= oneLvCount; a++) {
counterA... | true |
900f2e123f1e0117c384e6fc9b0718c91f1c5917 | JavaScript | yuyunzhi/LeetCode | /linkList/24两两交换链表节点.js | UTF-8 | 739 | 3.84375 | 4 | [] | no_license | /*
给定一个链表,两两交换其中相邻的节点,并返回交换后的链表。
你不能只是单纯的改变节点内部的值,而是需要实际的进行节点交换。
https://leetcode-cn.com/problems/swap-nodes-in-pairs/
*/
/**
* @param {ListNode} head
* @return {ListNode}
*/
var swapPairs = function (head) {
let dummy = new ListNode(0)
dummy.next = head
let prev = dummy
let cur = head
while(cur && cur... | true |
5c971c6703c0dc38ac9f970b01159eb16267454e | JavaScript | Bluezzy/210 | /practice2/insertionsort.js | UTF-8 | 1,778 | 4.6875 | 5 | [] | no_license | // MAIN ALGORITHM
// 1. variable named result; assign it to empty array.
// 2. step through the array. For each element :
// - insertInOrder(result, currentElement)* (see insertInOrder algorithm below)
// -
// 3. return result
function insertSort(array) { // non-mutating function
var result = [];
var i;
f... | true |
28112828a8bd1349025087b559d2df4d0375c13e | JavaScript | Acme2020/CompanyRun | /server/models/runModel.js | UTF-8 | 819 | 2.640625 | 3 | [] | no_license | const db = require("../db/db");
exports.getRuns = async (id) => {
try {
let result = await db.query(
"SELECT * FROM runs WHERE participant_id = $1",
[id]
);
return result.rows;
} catch (error) {
console.log(error);
}
};
exports.createRun = async (run_date, distance, time, participant_id) => {
try {
... | true |
6e7acf4334e8f89e38c59ee8ef74cef57c6991df | JavaScript | jesussantana/project-management-frontend | /src/components/projects/ProjectDetails.js | UTF-8 | 2,973 | 2.546875 | 3 | [] | no_license | import React, { Component } from 'react'
import axios from 'axios'
import { Link } from 'react-router-dom'
import EditProject from './EditProject';
import AddTask from './AddTask';
class ProjectDetails extends Component {
constructor(props) {
super(props)
console.log("props: ", props)
... | true |
ac5a91143746db91eba1be78871ccbc2ae40668a | JavaScript | Krashna-Saraswat/react-test | /src/Actions/index.js | UTF-8 | 735 | 2.6875 | 3 | [] | no_license | export const onInitialLoad = (launchYear, isLaunchSuccess, isLandSuccess) => {
const url = getURL(launchYear, isLaunchSuccess, isLandSuccess);
return (dispatch) => {
const path = url;
fetch(path).then(res => res.json()).then((response) => {
dispatch({
type: "DATA_FETCH",
payload: response
})
}).ca... | true |
9ef1edf2ac50bb28625664687a5323be7b46f9f7 | JavaScript | Lyumih/my-to-do-react | /src/components/App.js | UTF-8 | 1,462 | 2.765625 | 3 | [] | no_license | import React, { Component } from 'react';
import { v4 } from 'uuid'
import Header from './Header'
import AddTaskForm from './AddTaskForm'
import Tasks from './Tasks'
class App extends Component {
constructor(props){
super(props)
this.state = {
tasks: []
}
this.addTask = this.addTask.bind(this... | true |
ce6cdaa6dee7892fbbf400969ea821019828cd0e | JavaScript | JVictorC/Profile-Main-React | /public/ArquivosPort/Projetos/Fundamentos/3° Todo-list/script.js | UTF-8 | 5,764 | 3.15625 | 3 | [] | no_license | const ol = document.getElementById('lista-tarefas');
function testelogico(seaparado, i, elementoAlvo) {
const element = elementoAlvo;
if (seaparado[i] === 'completed') {
seaparado.splice(i, 1);
element.className = seaparado.join(' ');
}
}
function completeTasks(event) {
const elementoAlvo = event.targ... | true |
62d0e720240637343e90e82c789085a0407a9369 | JavaScript | aamEgo/external-courses | /task2/mission2.js | UTF-8 | 258 | 3.25 | 3 | [] | no_license | function printArrayAndSize(arr){
for (var val of arr){
console.info(val);
}
var arrSize = arr.length;
console.info('array size = '+arrSize);
}
function test() {
var arr = [14,12,166,11,22];
printArrayAndSize(arr);
}
test(); | true |
8b4f8e4926cf76762a8320528fd90d030ceaecd8 | JavaScript | kubamarkiewicz/reyesvaron | /js/services/parallax-service.js | UTF-8 | 2,525 | 2.53125 | 3 | [] | no_license | var ParallaxService = angular.module('ParallaxService', [])
.service('ParallaxService', function ($rootScope)
{
this.parallaxRate = 1.15;
this.elements = [];
this.initilized = false;
this.add = function(element, background)
{
this.elements.push({
element : element,
... | true |
5a96ddf0576d3aa738069c235e7a663b39ed6dbb | JavaScript | Dmitry16/SoluTecs | /app/js/bar-runner.js | UTF-8 | 964 | 2.828125 | 3 | [] | no_license | const div = document.querySelectorAll('.skill-bar-runner');
const p_skill = document.querySelectorAll('.skill-level');
let skills = new Map();
let sk1 = {name: 'Diseño', lev: 87},
sk2 = {name: 'Programación de Aplicaciones Web', lev: 90},
sk3 = {name: 'Publicidad en Internet (Google Adwords)', lev: 75},
s... | true |
d5c0f8c4aa1b638fbc28520517240b1e6caaf007 | JavaScript | jounlix/mygametest | /mygame/script.js | UTF-8 | 1,353 | 3.28125 | 3 | [] | no_license | document.onkeydown = checkButton;
let cube = {
x: 0,
y: 0,
id: 'cube',
width: 56,
height: 56,
trn: .25,
step: 100,
color: 'black'
}
let map = {
width: 900,
height: 900
}
function checkButton(event) {
if (event.keyCode === 38) {
// key: "Arrow... | true |
90cb35d85cd098e2a1e883e9bd25c5520b0cd9fb | JavaScript | guishuangwang/labelObjects | /src/utils.js | UTF-8 | 978 | 3.375 | 3 | [] | no_license | /**
* 鼠标按住框选区域时,根据方向计算出矩形框的左上角坐标
*/
export const calculateRectXY = (oldX, oldY, newX, newY) => {
let deltaX = newX - oldX;
let deltaY = newY - oldY;
if(deltaX > 0 && deltaY > 0) {
// 往右下角滑
return {
x: oldX,
y: oldY
};
}else if(deltaX < 0 && deltaY < 0) {... | true |
9d0ddf36e93e9e2ae66c6578e419f5e31a396fbf | JavaScript | prytis/uzdaviniai | /areaPerimeter.js | UTF-8 | 156 | 3.234375 | 3 | [] | no_license | const areaOrPerimeter = function(l , w) {
return l == w ? l*w : 2*(l + w)
};
console.log(areaOrPerimeter(5,5));
console.log(areaOrPerimeter(3,5)); | true |
6ec5014259ff0594deddc1c2d789e335c9c1b2f0 | JavaScript | pns09/Leetcode | /AlgoExpert/Arrays/zigzagTraverse.js | UTF-8 | 1,095 | 4.21875 | 4 | [] | no_license | function zigzagTraverse(array) {
// Write your code here.
// O(N) | O(N)
let row = 0;
let col = 0;
const endRow = array.length - 1;
const endCol = array[0].length - 1;
let res = [];
let goingDown = true;
while (!checkBoundary(row, col, endRow, endCol)) {
res.push(array[row][col]);
if (goingDo... | true |
50d2d4d55ecbe6ad3577bfa5d97553612c316476 | JavaScript | lokeki/naukaJS | /formularze/js/wartosciPol.js | UTF-8 | 399 | 3.328125 | 3 | [] | no_license | const form = document.querySelector('#myForm');
console.log(form.firstName.value); //odczytujemy wartosc z formularza
console.log(form.firstName.getAttribute('value')); //odczytujemy wartosc atrybutu value
// albo poprzez
console.log(form.firstName.defaulValue)
form.lastName.value = 'Kowalski';
console.log(form.s... | true |