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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
27578d78653f7883ed78ce9a60c3f5b73010e590 | JavaScript | GerHobbelt/CompoundSignal | /tests/spec/main.spec.js | UTF-8 | 5,281 | 2.796875 | 3 | [] | no_license | //for node..
var signals = signals || require('signals');
signals.CompoundSignal = signals.CompoundSignal || require('CompoundSignal');
describe('CompoundSignal', function () {
it('should dispatch after other signals', function () {
var s1 = new signals.Signal();
var s2 = new signals.Sig... | true |
f53ecc1fd17904d5e127e78b9e73127e5ee04572 | JavaScript | takawo/dailycoding | /sketches/sketch846534/mySketch.js | UTF-8 | 784 | 2.8125 | 3 | [
"MIT"
] | permissive | function setup() {
createCanvas(400, 400);
colorMode(HSB, 360, 100, 100, 100);
angleMode(DEGREES);
}
function draw() {
background(0, 0, 50);
push();
translate(width / 2, height / 2);
for (let angle = 0; angle < 360; angle += 5) {
push();
rotate(angle);
if(mouseIsPressed){
stroke(0, 0, 20)... | true |
e060993ed66369b76d811776d154d06666d27e2c | JavaScript | lodum/SPEX | /code/js/queryPane.js | UTF-8 | 22,372 | 2.703125 | 3 | [] | no_license | /*
QueryPane class
Author: Peter Zimmerhof
*/
//JSDoc
/**
* A query pane in which one can manipulate a visual query pattern graph which translates into SPARQL and gets automatically executed
* @class
* @property {object} nodes - holds the array of current user generated visual (variable or instant) nodes
* @pro... | true |
ebae62927506e907775ccc3394dfdba9a839c22f | JavaScript | EricSmekens/jsep | /packages/regex/src/index.js | UTF-8 | 1,498 | 2.796875 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | const FSLASH_CODE = 47; // '/'
const BSLASH_CODE = 92; // '\\'
export default {
name: 'regex',
init(jsep) {
// Regex literal: /abc123/ig
jsep.hooks.add('gobble-token', function gobbleRegexLiteral(env) {
if (this.code === FSLASH_CODE) {
const patternIndex = ++this.index;
let inCharSet = false;
wh... | true |
c90ac8ef0dd5fef2be41d27f1bde5022d019e3a5 | JavaScript | dmaHome/dark-sky-card | /dark-sky-card.js | UTF-8 | 32,970 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | // First we need to retrieve the LitElement from the corresponding HA Lovelace class
var LitElement = LitElement || Object.getPrototypeOf(customElements.get("home-assistant-main"));
var html = LitElement.prototype.html;
const summarySensor = "sensor.dark_sky_summary";
const apparentTemperatureSensor = "sensor.dark_sk... | true |
039ce0464100ba9a2dedca1b680f5d2b42a0cb10 | JavaScript | HShawn1994/leetcode | /哈希表/961. 重复 N 次的元素.js | UTF-8 | 450 | 3.703125 | 4 | [] | no_license | // 题目: 重复 N 次的元素
/**
在大小为 2N 的数组 A 中有 N+1 个不同的元素,其中有一个元素重复了 N 次。
返回重复了 N 次的那个元素。
示例 1:
输入:[1,2,3,3]
输出:3
**/
/**
* @param {number[]} A
* @return {number}
*/
var repeatedNTimes = function(A) {
let obj = {}
for (let i = 0; i < A.length; i++) {
if (obj[A[i]] == null) obj[A[i]] = 1
else return... | true |
137db3526be6a62c73df6aeee992a84f8bb5e67d | JavaScript | GageDorl/Hangman-Again | /index.js | UTF-8 | 2,141 | 3.328125 | 3 | [] | no_license | var words = require('./word.js');
var wordArr = ['Javascript','Hypertext Markup Language','Cascading Style Sheet','Node Server','mySQL','inquirer','Bootstrap','jQuery']
var inq = require('inquirer');
function startGame(){
guessesLeft=10;
wordFinished=false;
secretWord = new words.Word(wordArr[Math.floor(Mat... | true |
7cb675fc0849966f1bb54daa403490d91c1a1b47 | JavaScript | SHERlocked93/FE_Daily | /nodejs-test/20171210/crawler test2.js | UTF-8 | 613 | 2.8125 | 3 | [] | no_license | const http = require('http')
const url = 'http://www.imooc.com/learn/348'
const cheerio = require('cheerio')
http.get(url, function(res) {
let html = ''
res.on('data', function(data) {
html += data
})
res.on('end', function() {
filterCharpters(html)
})
}).on('error', function() {
console.log('获取... | true |
280d8f3d2870a33f16910c193a94420e12791481 | JavaScript | kmalinich/node-cec | /lib/emit-lines.js | UTF-8 | 551 | 2.9375 | 3 | [
"MIT"
] | permissive | (function () {
let emitLines;
emitLines = (stream) => {
let backlog;
backlog = '';
stream.on('data', (data) => {
let n;
let results;
backlog += data;
n = backlog.indexOf('\n');
results = [];
while (~n) {
stream.emit('line', backlog.substring(0, n));
backlog = backlog.substr... | true |
189d0a8052f609a790e3b2d4fb0783cf478118d0 | JavaScript | thomskint/podcast | /js/Util.js | UTF-8 | 2,438 | 2.609375 | 3 | [] | no_license | Podcast.Util = (function() {
/**
* @description
* Set the logged in counter
*/
function showCounter() {
document.getElementById("result").innerHTML =
"<p>You have logged in <b>" + getCounter() +
"</b> time(s).</p>";
}
return {
format : function (f... | true |
62631c5576752aac82bfbe8f95a3eec00f8b8972 | JavaScript | alexdeangelis/helper-js | /JavaScript Tutorial for Beginners/scripts/jsEvents2.js | UTF-8 | 1,297 | 3.625 | 4 | [] | no_license | //Get the ul with the ID of checklist
var checklist = document.getElementById('checklist');
// This gets all lis within checklist
var items = checklist.querySelectorAll("li");
// This gets all inputs within checklist
var inputs = checklist.querySelectorAll("input");
//Loop through each li item within the checklis... | true |
3e9c5cacfe1293ff28efda7f3a8530766529d41f | JavaScript | PaulBratslavsky/reactTutorialJan2019CityTours | /src/Components/TourItem/index.js | UTF-8 | 1,277 | 2.5625 | 3 | [] | no_license | import React, { Component } from 'react';
import './TourItem.scss';
class TourItem extends Component {
state = {
showInfo: false
};
onClickShowInfo = () => {
console.log("Button Clicked");
/*
if ( this.state.showInfo === false ) {
this.setState({
showInfo: true
});
} ... | true |
6fcbe05d53adb696f2e6e5cfb7de7659ace8a751 | JavaScript | dayalm/react-patterns | /src/components/prop-types/Person.js | UTF-8 | 455 | 2.53125 | 3 | [] | no_license | import React from 'react';
import PropTypes from 'prop-types';
const Person = props => {
console.log(props);
return (
<div>
<h1>Person</h1>
<div>Name: {props.name}</div>
<div>Age: {props.age}</div>
<div>Can Drive: {props.canDrive ? 'Yes' : 'No'}</div>
<div>blah: {11}</div>
</d... | true |
f33a1b84a867d982cb5a2865ac73156d8ed92f82 | JavaScript | czearing/React-Elementary-Sorting-Algorithms | /src/App.js | UTF-8 | 2,290 | 3.5625 | 4 | [] | no_license | import React from "react";
import "./styles.css";
let data1 = [1, 2, 1, 3, 4, 2, 9];
let data2 = [1, 2, 1, 3, 4, 2, 9];
let data3 = [1, 2, 1, 3, 4, 2, 9];
function bubbleSort(data1) {
let data = data1;
let length = data.length;
let counter = 0;
for (i = 0; i < length; i++) {
counter++;
for (x = 0; x <... | true |
950662f73abe7f3ab1eb6c9ab8f65ce173ae9633 | JavaScript | Mathias007/komnata-pamieci | /scripts/pageChangelog.js | UTF-8 | 2,066 | 3.5 | 4 | [] | no_license | const changelogContainer = document.getElementById("changelog");
// Get Changelog Data
export async function getChangelogData(dataURL) {
await fetch(dataURL)
.then((response) => {
return response.json();
})
.then((data) => {
generateChangelog(data);
});
}
fu... | true |
83928dbbaefffb7dee15a62cca347bef46ac4012 | JavaScript | AashPointO/AashPointO.github.io | /weather.js | UTF-8 | 1,004 | 3.5 | 4 | [] | no_license | // reference: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch
// Obviously call updateWeather first before calling any other function
var weather;
function updateWeather() {
fetch("https://api.weather.gov/gridpoints/STO/31,67/forecast/hourly").then((response) => {
return response.json();
}... | true |
5fd2f3dc5688a87c63550b0a97c345536cc82b83 | JavaScript | dangnguyen2207/dangnguyen2207.github.io | /public/quizFunctions.js | UTF-8 | 5,082 | 2.65625 | 3 | [] | no_license | $(document).ready(function() {
$.getJSON("/public/BeefVer1.json", function(json) { //Make file pulling more dynamic
// prepare the data
var source = {
datatype: "json",
datafields: [{
name: "id"
}, {
name: "parentID"
}, ... | true |
5bb555f857e600a8ecb7759824aa9c57a06fb3c0 | JavaScript | learnjvs/search-jobs | /server/searchController.js | UTF-8 | 1,113 | 2.75 | 3 | [] | no_license | const fetch = require('node-fetch');
const List = require('./listModel');
const searchController = {};
searchController.fetchJobsList = async (req, res, next) => {
const { language, city } = req.body;
const url = `https://jobs.github.com/positions.json?description=${language}&location=${city}`;
try {
// fet... | true |
b744003bc75f41a7066ff4c24e53c47ab7591547 | JavaScript | mesheven/tracespace | /packages/fixtures/server/index.js | UTF-8 | 1,487 | 2.546875 | 3 | [
"CC-BY-3.0",
"CC-BY-4.0",
"MIT"
] | permissive | 'use strict'
const fs = require('fs')
const path = require('path')
const express = require('express')
const runParallel = require('run-parallel')
const runWaterfall = require('run-waterfall')
const template = require('lodash/template')
const debug = require('debug')('tracespace/fixtures/server')
const TEMPLATE = path... | true |
692939f9ce386dd8bcc739c4f6c6c143c7fa61ca | JavaScript | TechTarun/Social-Searcher | /src/main/resources/static/assets/js/donutChart.js | UTF-8 | 1,023 | 2.859375 | 3 | [] | no_license | google.charts.load("current", {packages:["corechart"]});
google.charts.setOnLoadCallback(drawChart);
function generate_data(){
var list = []
for (var a = 0; a < 7; a++){
var value = Math.floor(Math.random() * (1000 - 500 + 1) + 500)
list.push(value)
}
return list;
}
function create_date(){... | true |
0eca151dd9039fa3aa2025556e408fc2a3c47c00 | JavaScript | similonap/imposter | /imposter-backend/index.js | UTF-8 | 1,587 | 2.65625 | 3 | [] | no_license | const express = require('express')
var cors = require('cors')
const app = express()
const port = 3000
app.use(express.json());
app.use(cors())
app.use((req, res, next) => {
res.set('Cache-Control', 'no-store')
next()
})
let active = false;
let objects = [];
let players = [
]
app.get('/gameState', (req, res) =... | true |
f4944d59d8224b0d8ee32ac1bd4c35078450eb3f | JavaScript | frostyasian/Updated-Portfolio | /assets/javascript/app.js | UTF-8 | 1,427 | 3.203125 | 3 | [] | no_license | // When the user scrolls down 20px from the top of the document, show the button
window.onscroll = function() {
scrollFunction();
};
function scrollFunction() {
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
document.getElementById("topBtn").style.display = "block";
} else {
... | true |
ce032ecb42bc6ce2985b65911a02a597fd0cf962 | JavaScript | cyborgspider/nexon | /Mabinogi/js/carousel.js | UTF-8 | 1,391 | 2.59375 | 3 | [] | no_license | $.fn.carousel = function(options) {
var s = $.extend({
slides: '#sale-carousel li', //the slides
animtimeout: 3000, //use this to control length of animation
pausetimeout: 3000, //use this to control how long between timed animations
slider: '.item-list.sale', //t... | true |
e628265a6a447586b30b48758936693e479500cc | JavaScript | sabidlv/Projet_Interface | /src/app/helpers/getMessagesTable.js | UTF-8 | 1,072 | 2.8125 | 3 | [] | no_license | // import calcul function
// import { calculTaille } from './calculTaille';
// function pour récupérer et afficher les messages et rafraichie automatiquement
/*
*@param: path of the table of db
*@return: nothing
*/
export function getMessage(data) {
document.getElementById('container-msg').innerHTML = '';
// retri... | true |
73a7772369d0b60ebd56bfb07692c9c53415177c | JavaScript | Kostopinto/todo-react | /src/reducers/__tests__/todo.js | UTF-8 | 3,448 | 2.71875 | 3 | [] | no_license | import todo from "../todo";
import {
ADD_TASK,
DELETE_TASK,
EDIT_TASK,
COMPLETED_TASK,
SAVE_EDIT_TASK
} from "../../actions/actionTypes";
const mockState = {
todos: [
{
description: "kotelvaaaa",
isEditing: false,
isChecked: false
},
{
description: "poltavvaaa",
i... | true |
d0139d62a6e83c32861989064dd7eb42e4f40f1c | JavaScript | sthaamir57/zoomClassInBrowser | /scripts/app.js | UTF-8 | 2,058 | 2.71875 | 3 | [] | no_license | const today = new Date();
const day = today.getDay();
const timeNow = today.getHours();
const firstSubjects = document.querySelector(".first-subjects");
const lastSubjects = document.querySelector(".last-subjects");
const firstThreeDays = document.querySelector(".first-three-days");
const lastThreeDays = document.query... | true |
6f1a465b58ffd3f56867f3b3f1acdfa2a17970ab | JavaScript | Orlando1620/PRY_LIBRERIA | /public/js/usuario/listarUsuario/listarUsuarioController.js | UTF-8 | 7,481 | 2.984375 | 3 | [] | no_license | var usuarios = [];
listarUsuario();
function listarUsuario() {
fetch('/usuario/listar', {
method: 'GET',
headers: { 'Content-Type': 'application/json' }
})
.then(
function (response) {
if (response.status != 200)
console.log('Ocurrió un error con el servicio: ' + response.stat... | true |
3655f705347a9972239c95e3a25de7ef6203f662 | JavaScript | billysbilling/billy-api-client.js | /src/storage-adapters/web.js | UTF-8 | 1,380 | 2.8125 | 3 | [
"MIT"
] | permissive | var WebStorageAdapter = module.exports = function(options) {
options = options || {};
//Check support
if (!window.sessionStorage) {
throw new Error('sessionStorage is not supported by this platform.');
}
if (!window.localStorage) {
throw new Error('localStorage is not supported by t... | true |
91855d3e865a8eddf88471564b197c09c4dac6b0 | JavaScript | var-bin/reactjs-training | /es2015/build-metadata.js | UTF-8 | 359 | 2.5625 | 3 | [
"MIT"
] | permissive | "use strict";
function buildMetadata(object){
let id = parseInt(object.id);
let lastUpdatedAt = object.updatedAt || object.createdAt;
let hashCode = _buildHashCode(object);
const SECURE_HASH_CODE_LENGTH = 32;
return {
id,
lastUpdatedAt,
hashCode,
isSecureHash() {
return hashCode >... | true |
31438143223e2198b072b39f0e1fcc66d8f1665f | JavaScript | VishalThawrani/myweatherapp | /src/reducers/weatherReducer.js | UTF-8 | 299 | 2.65625 | 3 | [] | no_license | const initialState = {
weatherInfo:{}
}
const weatherInfo = (state = initialState, action) => {
console.log(action,"inside reducer");
if(action.type === "FETCH_WEATHER"){
state = {...state, weatherInfo: action.payload.data}
}
return state;
}
export default weatherInfo; | true |
e51a594ab20c0fe4b0e95b831a7110b74d72cb34 | JavaScript | qwop/userscript | /monolith/4/60512.user.js | UTF-8 | 772 | 2.578125 | 3 | [] | no_license | // ==UserScript==
// @name Lavendar
// @namespace GLB
// @include http://goallineblitz.com/*
// ==/UserScript==
function getElementsByClassName(classname, par){
var a=[];
var re = new RegExp('\\b' + classname + '\\b');
var els = par.getElementsByTagName("*");
for(var i... | true |
21d7f48bd89c5f48922cd1d0e9d6d9bbc68ee8ee | JavaScript | vvanherk/node_js | /node-basics/scope.js | UTF-8 | 115 | 2.984375 | 3 | [] | no_license | var age = 24;
function localFunction() {
// var age = 55;
age = 55;
}
localFunction();
console.log(age); | true |
fa8e8d6e12bc511379c5fc603dbb45b64ae46857 | JavaScript | RenataNovais/Trybe | /front-end-Module02/block-08/trybe-8.1/find.js | UTF-8 | 1,279 | 4.375 | 4 | [] | no_license | // encontrar número maior que 10
const array1 = [5, 12, 8, 130, 44];
const found = array1.find(element => element > 10);
console.log(found); // expected output: 12
// Encontrar um objeto em um array por uma de suas propriedades
const inventory = [
{name: 'maças', quantity: 2},
{name: 'bananas', quantity: 0},
{... | true |
5d49626a55e66ca1a0b570381f6660240871a182 | JavaScript | arifgursel/algorithms-easy | /printArray.js | UTF-8 | 220 | 3.6875 | 4 | [] | no_license | var x = [1,3,5,7,9,11];
var y = [1,3,5,7,9,11,22,33,44,55,66,66];
function printArray(dookieBreath){
for(i=0;i < dookieBreath.length;i++){
console.log(dookieBreath[i]);
}
}
printArray(x);
printArray(y); | true |
60ada07536016c1e8478f9b3528acccb3c2fa060 | JavaScript | iamgoangle/redux-app-demo | /src/reducers/cartReducers.js | UTF-8 | 344 | 2.71875 | 3 | [] | no_license | // CART REDUCER
// CREATE NEW STATE OF CART
let initState = {
cart: []
};
const cartReducers = (state = initState, action) => {
switch (action.type) {
case 'ADD_TO_CART':
return {
cart: [...state, ...action.payload]
}
break;
}
return state;
};
... | true |
cf0604332dd3081d0f12efadcbbc1cc67cf11967 | JavaScript | anugrah09/Real-time-commenting-system | /public/client.js | UTF-8 | 2,372 | 2.953125 | 3 | [] | no_license | let username;
let socket = io();
do{
username = prompt("Enter your name")
}while(!username)
const textarea = document.querySelector("#textarea")
const submitbtn = document.querySelector("#submitbtn")
const commentbox = document.querySelector(".comment__box")
// submitbtn.addEventListener('click', (e)=>{
// e.... | true |
edf39b53148af253c9051717ce62a51ce0f90bb7 | JavaScript | NVDan53/nodejs_blog | /src/app/controllers/CourseController.js | UTF-8 | 1,454 | 2.578125 | 3 | [] | no_license | const Course = require('../models/Course');
const {mongooseToObject} = require('../../util/mongoose');
class CourseController {
display(req,res,next) {
Course.findOne({slug: req.params.slug})
.then(course=>{
res.render('courses/show',{course:mongooseToObject(course)});
... | true |
e32bf551b761d83d72d5c4de0ae3e51833df28e0 | JavaScript | Chocobe/-Study-RxJS | /01 - RxJS 프로그래밍 (한빛미디어) - 스터디/chap09 - 조건 연산자/09-03 isEmpty 연산자의 사용 예.js | UTF-8 | 343 | 2.828125 | 3 | [] | no_license | const { range } = require("rxjs");
const { isEmpty } = require("rxjs/operators");
const getRangeObservable = count => range(1, count);
const subscribeWithIsEmpty = count => getRangeObservable(count).pipe(
isEmpty(),
).subscribe(result => console.log(`개수: ${count}, 값: ${result}`));
subscribeWithIsEmpty(0);
subscrib... | true |
c7eacc47aae28e9de60c939429de9cdb89dbcd22 | JavaScript | codeclimate-testing/dlite-web | /client/helpers/validations/date-validator.js | UTF-8 | 1,948 | 2.796875 | 3 | [] | no_license | 'use strict';
import errorMessages from '../../presentations/error-messages';
import selectionValidator from './selection-validator';
import {
hasOnlyNumbers,
hasValue
} from '../data/validations';
const hash = {
1: 31,
2: 29,
3: 31,
4: 30,
5: 31,
6: 30,
7: 31,
8: 31,
9: 30,
10: 31,
... | true |
941856acdc0ecadbb01c797daad8f089db1f5fa8 | JavaScript | CaSh001/TypeScript-course | /module2/dice_rolling/dice.js | UTF-8 | 2,520 | 2.671875 | 3 | [] | no_license | var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
ext... | true |
d3c2c2c58b8f164ea544bc203a10d2434708c913 | JavaScript | jamesjoel/tss6_online | /nodejs/json.js | UTF-8 | 348 | 3.484375 | 3 | [] | no_license | // Java Script Object Notation
// when an array containing only object then it is a JSON array.
var data = [
{
name : "rohit",
age : 25
},
{
name : "priya",
age : 30
},
{
name : "gaurav",
age : 24
},
{
name : "rishi",
age : 30... | true |
202b420f6ec29ae551a0f7afbb1c4e2aaead7c6a | JavaScript | an9979/algorithms | /minmult.js | UTF-8 | 1,520 | 2.984375 | 3 | [] | no_license | function minmult(n, d) {
let m = new Array(n + 1).fill(0).map(() => new Array(n + 1).fill(0));
let i, j, k, L, q;
for (i = 1; i < n; i++) {
m[i][i] = 0;
}
for (L = 2; L <= n; L++) {
for (i = 1; i <= n - L + 1; i++) {
j = i + L - 1;
m[i][j] = Infinit... | true |
c3fda07cc79ee1f6e3c8f5db7b4a6bd68a0301ce | JavaScript | morsix/react-max-a2-lists-conditionals | /src/App.js | UTF-8 | 1,911 | 3.203125 | 3 | [] | no_license | import React, { useState } from 'react';
import './App.css';
import InputText from './InputText/InputText'
import Validation from './Validation/Validation'
import Char from './Char/Char'
function App() {
const [inputTextState, setInputTextState] = useState({
textValue:""
})
const [charArrState, setChar... | true |
c7854ab25ed251a06a0e8b5dcabf6f4492d602aa | JavaScript | samartsevaas/marathonJS | /info_logs.js | UTF-8 | 4,125 | 2.953125 | 3 | [] | no_license | import {END_COUNT} from "./consts.js";
import {randomCount} from "./utils.js";
export const getClicks = (endCount = END_COUNT) => {
let clicks = 0;
return () => {
if(clicks < endCount) {
clicks++;
}
return clicks;
};
}
export function getLogs(firstPerson, secondPerson,... | true |
1bfd4f4833e6f832ab00f7eac29b1b4475c63b91 | JavaScript | mihaimSV/goit-fe-course | /javascript/module-09/tasks.js | UTF-8 | 10,081 | 3.921875 | 4 | [] | no_license | /* Дополнительное задание 1
Дан массив цветов и кнопки "Start" и "Stop". Сделайте так, чтобы после
нажатия кнопки "Start", каждую секунду body менял цвет фона на случайное
значение из массива.
При нажатии на кнопку "Stop", изменении цвета фона должно останавливаться.
*/
const colors = ['#FFFFFF', '#F44336', ... | true |
fc25d2e748491bbc83dd19d8e626957ce77f76ae | JavaScript | DeccaSoft/B7Web-Exercicios-Curso-JavaScript | /Mod 3 -Conceitos Basicos/Aula5-Objetos/objetos.js | UTF-8 | 465 | 4.03125 | 4 | [] | no_license | //Array
let carros = [
'Palio',
'Uno',
'Corola',
'Ferrari'
];
console.log(carros[2]);
//Objeto
let carro = {
marca: 'Fiat',
nome: 'Uno',
modelo: 'Treking',
ano: 2000,
cor: 'vermelho',
ligado: false,
ligar: function(){
console.log(`Ligando o ${this.nome}`);
l... | true |
a7f4bf09e4f025c4d950fd2fc583943256ccaa80 | JavaScript | TetianaZelena/goit-js-hw-07 | /js/task-04.js | UTF-8 | 2,491 | 4.0625 | 4 | [] | no_license | // Счетчик состоит из спана и кнопок, которые должны увеличивать и уменьшать значение счетчика на 1.
// Создай переменную counterValue в которой будет хранится текущее значение счетчика.
// Создай функции increment и decrement для увеличения и уменьшения значения счетчика
// Добавь слушатели кликов на кнопки, вызовы ф... | true |
b12a9981dd942caca593aac2fe008f636eec5754 | JavaScript | dri19tcc/TravelHelper | /models/trip.js | UTF-8 | 4,268 | 2.734375 | 3 | [] | no_license | var Trip = function(trip) {
this.tripID = trip.tag_id,
this.tripName = trip.name,
this.tripUpdate = trip.modified_date,
this.activities = trip.activity
}
module.exports = Trip
var app = require('../main');
var db = app.get('db');
var Activity = require('./activity');
Trip.find_all = function(googleID, callba... | true |
09ef6e9568dbe85c3100e0b8c1ee855a79b2f599 | JavaScript | Q-Zhao/dataviz-project-QZhao | /src/not_used/BarChart.js | UTF-8 | 4,470 | 2.59375 | 3 | [
"MIT"
] | permissive |
export default function (selectedCountryName, selectedYear, width, height) {
const margin = { left: 120, right: 60, top: 20, bottom: 120 };
d3.select("div#svg_chart3_container").remove();
var svg_chart3 = d3.select("div#detailChart3")
.append("div")
.attr("id", "svg_chart3_container")
... | true |
a5b2209d2e494fbda633adaa20a2c2300a2fdd60 | JavaScript | rotsuya/kitchensink | /public/javascripts/subworker.js | UTF-8 | 676 | 2.859375 | 3 | [] | no_license | /**
* Created with JetBrains WebStorm.
* User: rotsuya
* Date: 2013/01/16
* Time: 18:11
* To change this template use File | Settings | File Templates.
*/
var isPrime = function(n) {
for (var i = 2; i<= Math.sqrt(n); i++) {
if (n % i == 0) {
return false;
}
}
return true;
}... | true |
f8b53e9731cf3fb5bfe9583ebe928947cae949c1 | JavaScript | bbalet/Students-Database | /www/component/calendar/static/event_date_time_duration.js | UTF-8 | 2,584 | 3.390625 | 3 | [] | no_license | if (typeof require != 'undefined') {
require("date_select.js");
require([["typed_field.js","field_time.js"]]);
}
/** Displays an editable date_select, time field, and duration
* @param {Element|String} container where to put it
* @param {Date} start starting date/time
* @param {Number} duration in minutes
* @par... | true |
d6b5b635675b7bdcd102f06b99689c5e5f456b03 | JavaScript | shanik1320/Employee-Directory | /employee-directory/src/components/Main/Main.js | UTF-8 | 1,929 | 2.609375 | 3 | [] | no_license | import React from "react";
import API from "../../utils/API";
// import Container from "../components/Container";
// import Row from "../components/Row";
// import Col from "../components/Col";
import SearchForm from "../SearchForm"
import "./main.css";
class Main extends React.Component {
state = {
emplo... | true |
e21c22170520ee4c4d1aa8c3395bf747aadac7ae | JavaScript | bramprasetyop/H8-week-1 | /livecode1/easy.js | UTF-8 | 930 | 3.40625 | 3 | [] | no_license | function dominoCard(card, deck) {
var biggestDeck = Math.max(...deck)
var count = []
var counter = 0
for (var i = 0; i < card.length; i++) {
for (var j = 0; j < card[i].length; j++) {
if (card[i][j] === deck[0] || card[i][j] === deck[1]) {
count.push(card[i])
counter++
}
}
... | true |
8077abf5ce45b8a45c7bb57ec21c877cc5626d00 | JavaScript | morlanosgood/HabitiCode | /js/index.js | UTF-8 | 8,535 | 2.671875 | 3 | [
"MIT"
] | permissive | $(document).ready(function() {
localStorage.hab_is_valid = false;
localStorage.code_is_valid = false;
//testing scheduler
$("#test_scheduler").click(function( event ) {
$.ajax({
url:'scheduler.php',
async: false,
success: function(data){
... | true |
535ca075ed0107c475b497cdc502b7499a206560 | JavaScript | deekshitr/ripples | /server.js | UTF-8 | 2,965 | 2.53125 | 3 | [] | no_license | const express = require('express');
const bodyParser= require('body-parser');
const app = express();
const MongoClient = require('mongodb').MongoClient
app.set('view engine', 'ejs');
var db;
MongoClient.connect('mongodb://deekshitr:deekshitr123@ds123312.mlab.com:23312/ripples', function(err, database) {
if (err) re... | true |
5d2140dfab9c7963477cf903613f1ea8d25da7ae | JavaScript | dithyprabowo51/booking-room | /server/controllers/RoomController.js | UTF-8 | 1,917 | 2.578125 | 3 | [] | no_license | const { Room } = require('../models')
class RoomController {
static async addRoom(req, res, next) {
try {
const { room_name, min_capacity, max_capacity } = req.body
const newRoom = await Room.create({
room_name, min_capacity, max_capacity
})
res.status(201).json({
message:... | true |
04c692d6f85677aa5b00c93f91b4b5c732b77ca8 | JavaScript | AlexPero/PreojetReact | /app/screens/AddRecette.js | UTF-8 | 5,547 | 2.5625 | 3 | [] | no_license | import React, { useEffect, useState } from 'react';
import { Text, View, Button, TextInput, StyleSheet,TouchableOpacity, Alert } from 'react-native';
import AsyncStorage from '@react-native-async-storage/async-storage';
import { useNavigation } from '@react-navigation/native';
import {Picker} from '@react-native-picker... | true |
b70524d40969efaa67afa481695f8ef9a18275a9 | JavaScript | windldream/leetcode | /math/escapeGhosts.js | UTF-8 | 362 | 3.21875 | 3 | [] | no_license | /**
* @param {number[][]} ghosts
* @param {number[]} target
* @return {boolean}
*/
var escapeGhosts = function (ghosts, target) {
const source = [0, 0]
for (const ghost of ghosts) {
if (taxi(ghost, target) <= taxi(source, target)) return false
}
return true
function taxi(p, q) {
return Math.abs(p... | true |
ada996529093266e6140a560a4bf104437dc35b5 | JavaScript | kem247/kemi-cart | /app/redux/singleCart.js | UTF-8 | 2,319 | 2.578125 | 3 | [] | no_license | const axios = require("axios");
const SINGLE_CART = "SINGLE_CART";
const UPDATE_CART = "UPDATE_CART";
const DELETE_CART = "DELETE_CART";
export const setSingleCart = cart => ({
type: SINGLE_CART,
cart
});
export const updateCart = (cartId, cart) => ({
type: UPDATE_CART,
cartId,
cart
});
export const remo... | true |
cd6082d1586a0869b8fcbde3169a268579469426 | JavaScript | vhong000/studY | /frontend/src/fetches.js | UTF-8 | 8,944 | 2.796875 | 3 | [] | no_license |
/* eslint-disable */
// FETCH
function apiCall(url, options) {
var options = options || { headers: {}};
options.headers['Content-Type'] = 'application/json';
return fetch(url, options).then(response => {
return response;
});
}
// LOGIN USER
export const loginUser = user => fetch('/api/auth/login', {
meth... | true |
bacd15ca8e83ca70b33a4fd8618f431804c1e4c7 | JavaScript | shah-smit/quiz-roulette-media-service | /index.js | UTF-8 | 629 | 2.59375 | 3 | [] | no_license | const express = require('express')
const app = express()
const port = 80
app.get('/', (req, res) => {
res.send('Hello World!')
})
app.get('/avatar/:imagename', function (req, res) {
res.sendFile(__dirname + `/image/avatar/${req.params.imagename}.gif`);
});
app.get('/avatarvid/:imagename', function (req, res)... | true |
e8bd05fa15d82e29c1b865281a91d777df495e72 | JavaScript | CooperAtive/Code-Fellows | /pivotal/test/Television_spec.js | UTF-8 | 1,844 | 3 | 3 | [] | no_license | /*jshint expr: true*/
(function () {
'use strict';
}());
var Television = require('../lib/Television.js').Television,
expect = require('chai').expect;
describe('Television object test:', function() {
var tv;
beforeEach( function() {
tv = new Television('Samsung', 65);
});
describe('c... | true |
281df485ba941d462df85069f0206a30805b8f61 | JavaScript | brujoh88/manualPracticoNodeJS | /Capitulo 2/Ejercicio2/hotel.js | UTF-8 | 1,412 | 2.84375 | 3 | [] | no_license | class Hotel {
constructor(name, city, adress, tel, webPage, gerente, habitaciones) {
this.name = name
this.city = city
this.adress = adress
this.tel = tel
this.webPage = webPage
this.gerente = gerente
this.habitaciones = habitaciones
}
getName() {
return this.name
}
setName(dat... | true |
84f109ba0cb1fa6380cd6ecc858d0206812e2e19 | JavaScript | geoyws/mtg-counter | /js/app.js | UTF-8 | 976 | 2.984375 | 3 | [] | no_license | var mtgCounter = {
resetHealth: function () {
localStorage.myHP = 20;
localStorage.oppHP = 20;
mtgCounter.updateHP();
},
updateHP: function () {
$("#myHP").text(localStorage.myHP);
$("#oppHP").text(localStorage.oppHP);
},
alterHP: function (event, amount) {
... | true |
9755dd28871c34312adbe72639efe0b475d3a17c | JavaScript | scarlettperry/the-office-family | /src/Filter.js | UTF-8 | 956 | 2.5625 | 3 | [] | no_license | import React from 'react'
import {onlyUnique} from './helperFunctions.js'
const Filter = (props) => {
let allBranches = props.employees.map(obj => obj.branch.name)
let uniqueBranches = allBranches.filter(onlyUnique)
let branch = uniqueBranches.map(
obj =>
<option>
{obj}
... | true |
f5c87db1fd230a56d35ff15f03a62176572238c9 | JavaScript | MasallahOZEN/SmartTouch | /SmartCRM/Development/crm-web-application/SmartTouch.CRM.Web/Scripts/knockout.clear.js | UTF-8 | 4,410 | 2.65625 | 3 | [
"MIT"
] | permissive | (function() {
if ((typeof ko === "undefined") ||
(typeof ko.version !== "string") ||
(parseFloat(ko.version.split("-")[0]) < 3.3)) {
throw new Error("This library requires Knockout 3.3");
}
// Simple binding that we can use to keep a side-effecting pureComputed awake
ko.binding... | true |
fb02e9fcfd60126e4bdb63a79eeb132481b76913 | JavaScript | marcgca/M08---Javascript | /exercici15.js | UTF-8 | 892 | 3.765625 | 4 | [] | no_license | // Declarem les variables que utilitzarem
var data = prompt("Introdueixi la data:");
// Establim un patró per la data amb RegExp
// Establim que els dies han de ser vàlids, per exemple 00 no ho és
var patt = new RegExp("([0][1-9]|[1-2][0-9]|[3][0-1])-([0][1-9]|[1][0-2])-[0-9]{4}");
// Ho comparem amb el test. Retorna t... | true |
c4ed58317936e1197e4863714d98d264fcb38270 | JavaScript | lucianboatright/Daily_Notes_single_page_app | /spec/note-controller-insert-test.js | UTF-8 | 360 | 2.796875 | 3 | [] | no_license | (function testInsert(){
var mockDiv = {
innerHTML: ""
}
var mockDocument = {
getElementById: function(){
return mockDiv;
}
}
var noteController = new NoteController(mockDocument);
noteController.add('second');
noteController.insert("app");
console.log(mockDiv)
assert.isTrue(mockD... | true |
c069fef286e31504f8d39b544c034fb9ae580165 | JavaScript | giabb/sports-analytics | /js/table.js | UTF-8 | 3,483 | 2.546875 | 3 | [
"MIT"
] | permissive | ////////////////////////////// TABLE DRAWING //////////////////////////////
function drawTable(data) {
const keys = ['sofifa_id', 'overall20', 'short_name', 'age', 'nationality', 'player_positions', 'pace_diving', 'shooting_handling', 'passing_kicking', 'dribbling_reflexes', 'defending_speed', 'physic_positioning']... | true |
d049247b7df73175ecfca74c67a9a3a0fa94ed2d | JavaScript | MauriBian/UNQFy | /UNQFYController.js | UTF-8 | 4,063 | 2.765625 | 3 | [] | no_license | const unqmod = require("./unqfy")
const fs = require('fs');
function getUNQfy(filename = 'data.json') {
let unqfy = new unqmod.UNQfy();
if (fs.existsSync(filename)) {
unqfy = unqmod.UNQfy.load(filename);
}
return unqfy;
}
function saveUNQfy(unqfy, filename = 'data.json') {
unqfy.save... | true |
655e6193aa88f29a218dd14151576cc0cd681c0c | JavaScript | hkneal/DojoAssignments | /WebFundamentals/HTML/Javascript/What Really Happened.js | UTF-8 | 825 | 3.40625 | 3 | [] | no_license | function whatReallyHappensToday()
{
var disaster = false;
var result = Math.random();
//console.log(result);
if(result <= .30)
{
console.log("A Meteor Strike will happen today!");
disaster = true;
}
result = Math.random();
if (result <= .25)
{
console.log("A Blizzard will happen today!");
... | true |
f4f5415e6b319046c3735d9c499779887b8e74df | JavaScript | MonySOEURN/mern_todo | /api/todo.api.js | UTF-8 | 2,394 | 2.703125 | 3 | [] | no_license | const express = require('express');
const todoRoutes = express.Router();
// get models
const Todo = require('./../models/todo.model');
const auth = require('./../middleware/auth.middlware');
// @route GET todos/
// @desc Recieve all todo items
// @access Public
todoRoutes.get('/', (req, res) =>{
Todo.find(funct... | true |
babd4db1fc76eea2d8303d697264b5eb5b6f16fc | JavaScript | ProbeDream/163-music | /src/js/admin/eventHub.js | UTF-8 | 982 | 3.140625 | 3 | [] | no_license | window.eventHub = {
events: {},
//发布 参数 事件名 数据
emit(eventName, data) {
//对events对象进行遍历操作
for (let key in this.events) {
//如果说events里面的key等于 传入的事件类型
if (key === eventName) {
//那么将当前的对应key的值 赋值给fnList(函数列表)
let fnList = this.events[key];
//map() 方法创建一个新数组,其结果是该数组中的每个元素都调... | true |
9de104afece9bd3d4a0cb6a2bb710709f3d392b6 | JavaScript | ioneliva/IDEOnline | /ClientFiles/scripts/solutionExplorerUserDiagModals.js | UTF-8 | 5,577 | 2.578125 | 3 | [] | no_license | document.addEventListener("keydown", handleKeyboardForUserDiag);
window.addEventListener("resize", hideModalOnResize);
document.getElementById("UserCancelBtn").addEventListener("click", hideModal);
document.getElementsByClassName("modalCloseBtn")[0].addEventListener("click", hideModal);
//hide modal dialogue
function ... | true |
3815672d6b82ae36017faf92bb1e730eb683b69c | JavaScript | arielskap/TypeScript-basics | /types-typescript/dist/2. type-number-boolean-string.js | UTF-8 | 807 | 3.625 | 4 | [] | no_license | "use strict";
console.log('Hola Platzi keloke');
// Number
// Explicito
var phone;
phone = 1;
phone = 54234567;
// phone = 'hola'; // Error
// Inferido
var phoneNumber = 54234567;
phoneNumber = 123;
// phoneNumber = true; // Error por tipo
var hex = 0xf00d;
var binary = 10;
var octal = 484;
// Tipo: Boolean
// Tipado E... | true |
8eb95ad7b5f558c2f760bf540976d2bc8b8f3db7 | JavaScript | MikhilMC/ICTAKAssignments | /question-3.js | UTF-8 | 1,484 | 3.859375 | 4 | [] | no_license | function question_3() {
for (let i=1; i<=10; i++) {
document.getElementById("question" + i).setAttribute("hidden", true);
document.getElementById("solution" + i).setAttribute("hidden", true);
document.getElementById("question" + i + "Link").classList.remove("active", "bg-primary");
}
... | true |
340caf22d5ecc13166be6a347cac4c2191a48dd6 | JavaScript | slushman/ccb-hr-action-form | /src/components/Fields/__tests__/Textarea.test.js | UTF-8 | 2,436 | 2.5625 | 3 | [] | no_license | import Textarea from '../Textarea';
import { shallowFactory } from '../../../testUtils';
const factory = shallowFactory(Textarea, {
label: '',
name: '',
});
describe('<Textarea/>', () => {
it('renders without crashing', () => {
const wrapper = factory();
expect(wrapper.exists()).toBe(true);
// Wrap... | true |
d59f64fe758ae835a80359a50519a7c9c5de1696 | JavaScript | trangchongcheng/javascript | /concat.js | UTF-8 | 375 | 3.578125 | 4 | [] | no_license | var firstName = "Cheng";
var lastName = "Trang";
var fullName = firstName.concat(lastName);
var numbers = [1,2,3,4,5,6,7,8,9,10];
// numbers.pop();
/*
numbers.shift(): xóa phần tử đầu tiên
numbers.unshift(): thêm vào phần tử đầu tiên
*/
numbers.push({name:"cheng",id:"01"});
numbers.shift();
numbers.unshift(fu... | true |
e389a27567b060a7700d81150c416440a50bf406 | JavaScript | Hermogenes00/newCommerceApi | /controller/VariationController.js | UTF-8 | 1,620 | 2.703125 | 3 | [] | no_license | let variation = require('../model/Variation')
class VariationController {
async findAll(req, res) {
//do working in the validations
let result = undefined
try {
result = await variation.findAll();
} catch (error) {
console.log(error);
result = ... | true |
4c85ce221a6590ed21e59844989a753f6e8d2b53 | JavaScript | mariuswallin/saleor-docs | /website/static/js/script.js | UTF-8 | 1,499 | 2.546875 | 3 | [] | no_license | window.addEventListener(
"DOMContentLoaded",
function() {
const path = location.pathname;
const isHome =
path === "/docs/" ||
path === "/docs/index.html" ||
path === "/docs/next/" ||
path === "/docs/next/index.html";
const onePageNav = document.querySelectorAll("nav.onPageNav");
... | true |
e03a51b0101bdd4302f9bede1d3dce71be135db6 | JavaScript | drygnet/prod-server | /new-app.js | UTF-8 | 1,255 | 2.59375 | 3 | [] | no_license | const inquirer = require('inquirer')
const ncp = require('ncp')
const replace = require('replace-in-file');
var questions = [{
type: 'input',
name: 'name',
message: "App name",
},
{
type: 'input',
name: 'collection',
message: "Main collection name e.g 'cases', do not repeat app name",
},
{
type: 'input',... | true |
2a00502adb282e4397ba6524d0a442e1b2986a3c | JavaScript | MUzairS15/EasyNotes-chrome_extension | /notes.js | UTF-8 | 953 | 3.34375 | 3 | [] | no_license | start();
const save = document.getElementById("save").addEventListener("click",saveNote);
function show(){
let srNo = 1;
let numberOfNotes = localStorage.length;
keys = Object.keys(localStorage)
if(document.getElementsByClassName('cards')[0].innerHTML != ''){
document.getElementsByClassName('cards')... | true |
63c9bdd1a57f080b4e27d5b1a66596ed63ffe9ce | JavaScript | ruslancik/creatella | /src/components/utils/function.js | UTF-8 | 1,409 | 3.5625 | 4 | [] | no_license | //cent to dollars formatter function
export const CentToDollar = amount => {
var dollars = amount / 100;
dollars = dollars.toLocaleString("en-US", {style:"currency", currency:"USD"});
return dollars;
}
// formatting date
export const formatDate = date => {
const monthNames = [
"January",
... | true |
09f845340965c36828e61f39e6a6fc5a11eb7b7d | JavaScript | MD-Aadil-Shafi/softsensorAssignment | /client/src/components/products/Products.js | UTF-8 | 2,230 | 2.625 | 3 | [] | no_license | import React,{useEffect, useState} from 'react'
import './product.css'
import axios from 'axios'
import Prod from './Prod';
import InfiniteScroll from 'react-infinite-scroll-component';
const Products = () => {
const [products, setPrducts] = useState([]);
const [page, setPage] = useState(2)
//const [loadin... | true |
b38310627bfe3c590483f5b8ce12ad50b95b20ee | JavaScript | mlab-upenn/energy-analytics | /Codes/DR-Advisor/drAdvisor.js | UTF-8 | 15,031 | 3.0625 | 3 | [] | no_license | /**
* This skill responds to questions pertaining to power consumption of buildings across Penn's campus.
* It also has the ability to do so with real time data obtained from forecast.io.
* @author: Samarth Shah
*/
var https = require('https');
var http = require('http');
//var Forecast = require('forecast');
... | true |
2df4aa09d5261ede2a5a109caf2f41f6e2cb4394 | JavaScript | olesyaste/codewars-6kyu | /unix-style.js | UTF-8 | 152 | 3.234375 | 3 | [] | no_license | function uniq(a) {
let ar = []
for(let i = 0; i < a.length; i++){
if(a[i] !== a[i+1]){
ar.push(a[i])
}
}
return ar
} | true |
731f4175a8258ca3d83414c222aed75d8c722265 | JavaScript | DevelopByTarun/TODAY-HELP | /REACTJS/ReactJs-With-Redux-JavaScriptLibrary-master/ParentToChild/src/component/child/child.jsx | UTF-8 | 1,412 | 2.609375 | 3 | [
"MIT"
] | permissive | import React, { Component } from "react";
import { Alert, Button, Form, FormGroup, Label, Input, Col } from 'reactstrap';
export class Child extends Component {
constructor(props) {
super(props);
this.state = {
fillText: ''
}
}
takeLastName(event) {
this.setSta... | true |
c027383220a9c782c86366cb45bef5c46fab430d | JavaScript | OleksandrZhezdorf/Homework3 | /script2.js | UTF-8 | 440 | 3.390625 | 3 | [] | no_license | /* Тернарный вариант */
let birthDate = prompt('What is the date of your birthday?');
let age = 2020 - 1 - birthDate;
console.log (age);
let message = (isNaN(age)) ? "Write only number, please" :
(age<12) ? "U are too small, kiddy. Come back after more than 6 years or try another service." :
(age<18) ? "Access declined... | true |
6cae5353c7f0924a47d61bc30b1571c436d278b4 | JavaScript | maa251/BookMeServer | /public/javascript/canvas_anchor.js | UTF-8 | 17,392 | 3.359375 | 3 | [] | no_license | // Draw a circle in a given context with a given radius
function drawCircle(x, y, radius, ctx) {
ctx.fillStyle = "#FF0000";
ctx.beginPath();
ctx.arc(x, y, radius, 0, 2 * Math.PI);
ctx.fill();
}
// Check if a mouse click is within the resize handles
function checkCloseEnough(p1, p2) {
return Math.abs(p1 - p2)... | true |
006a473da4b3402219acc6aa04ff14af588e4920 | JavaScript | hiredtocode/Projects | /AutocompleteJSON/JS/main.js | UTF-8 | 1,201 | 3.375 | 3 | [] | no_license | const search = document.getElementById( 'search' );
const matchList = document.getElementById( 'match-list' );
// Search states.json and filter it
const searchStates = async searchText => {
const res = await fetch( 'data/javascript.json' );
const states = await res.json();
// Get matches to current text input
... | true |
664eaeb843e89479fe4817bfe17d4d0dab3137d8 | JavaScript | laggingreflex/assert-request | /test/unit/mixins/status.js | UTF-8 | 2,023 | 2.75 | 3 | [
"MIT"
] | permissive | 'use strict';
const assert = require('assert');
const okayMixin = require('../../../lib/mixins/status.js').okay;
const statusMixin = require('../../../lib/mixins/status.js').status;
describe('status mixin', function () {
it('should do nothing if the status is equal', function () {
return Promise.all([200, 401, ... | true |
885ba0ece126a65a67902395a5b416968963456e | JavaScript | aizf/deep-snake | /src/game/point.js | UTF-8 | 907 | 3.1875 | 3 | [
"MIT"
] | permissive | 'use strict';
export {Point};
function Point(x = this.rnd(this.size.x), y = this.rnd(this.size.y)) {
this.x = x;
this.y = y;
}
function equals(other) {
if (!other) return;
return other.x === this.x && other.y === this.y;
}
function getHash(size = this.size) {
return this.x + this.y * size.x;
}
... | true |
b7e342343659ddf651508b580dd39a345ee60577 | JavaScript | BLipsett/Pokedex | /app/Controllers/PokemonController.js | UTF-8 | 576 | 2.796875 | 3 | [] | no_license | import { ProxyState } from "../AppState.js";
import { pokemonService } from "../Services/PokemonService.js";
function _draw() {
let template = "";
let pokemonElem = document.getElementById("app");
ProxyState.pokemon.forEach((p) => (template += p.pokemonTemplate));
pokemonElem.innerHTML = template;
}
export cla... | true |
7ced7226b1a5f733510c0873da28b66602fb7f64 | JavaScript | joannaWebDev/exercises-js2 | /exercises-js-extra/exercises/1-loops/3-max.js | UTF-8 | 352 | 4.46875 | 4 | [] | no_license | /*
Max
Given an array of numbers, create a function to return the maximum
*/
function max(numbers){
//your code here
}
const numbersArray1 = [1,3,5,9];
const numbersArray2 = [7,8,5,7,3,6];
console.log("Maximum number in first array is " + max(numbersArray1));
console.log("Maximum number in second a... | true |
1d2cfb3fa387362e7c8873b09e6669cf3ef9a9b2 | JavaScript | Javier2280/coder-house-backend | /ejemplos/06-manejo-archivos/entregable/archivo.js | UTF-8 | 1,576 | 3.109375 | 3 | [] | no_license | const fs = require('fs');
class Archivo {
constructor(rutaArchivo) {
this.ruta = rutaArchivo;
}
async leer() {
await fs.readFile(this.ruta, 'utf-8', (error, contenido) => {
if (error) {
console.log(error.message);
} else {
return con... | true |
c8496ae21b598c05e23613cb25c8a56f7eb164eb | JavaScript | 1NT18IS136/1NT18IS136_sanket_B_jsLab | /LA1_2/sample.js | UTF-8 | 706 | 3.078125 | 3 | [] | no_license | const arry =[];
function onClick(){
var obj={};
obj.Location = document.getElementById('lctn').value;
obj.Date = document.getElementById('dt').value;
obj.Relief_Fund = document.getElementById('rf').value;
//obj.Medical_Facility = document.getElementById('mf').value;
const chars = docume... | true |
5cca4feec2928edd5294c4ca1f58df69a2e43756 | JavaScript | sashapvt/AlgoCasts | /exercises/maxchar/index.js | UTF-8 | 561 | 3.96875 | 4 | [] | no_license | // --- Directions
// Given a string, return the character that is most
// commonly used in the string.
// --- Examples
// maxChar("abcccccccd") === "c"
// maxChar("apple 1231111") === "1"
console.log(maxChar("apple 1231111"));
function maxChar(str) {
let map = {};
let maxVal = 0;
let maxChar = '';
for... | true |
d3443a3a6c617dfc2929f00ea8fb18c6a24bc830 | JavaScript | CaterinaDanizio/vue-hello | /bonus/js/script.js | UTF-8 | 798 | 2.765625 | 3 | [] | no_license | // Bonus: Aggiungere un’immagine presa anch’essa da un data
var app = new Vue({
el: '#app',
data: {
message: ' Abiti da sera in promozione ',
caption: ' Abito prom in raso in maglia con paillettes ',
img: "img/abito1.jpg"
},
// Altro possibile Bonus: gestire una funzione con un evento nel modo Vue... | true |
1a12e05dcedd9d235a2f8c38e37afc2d4a8b07e4 | JavaScript | micakenobi/bus_mall | /app.js | UTF-8 | 5,027 | 2.953125 | 3 | [
"MIT"
] | permissive | 'use strict';
var completeCatalog = [];
var totalCount = 25;
var currentImage1 = 'pic1';
var currentImage2 = 'pic2';
var currentImage3 = 'pic3';
function Item (name, filepath) {
this.name = name;
this.path = filepath;
this.times = 0;
this.totalClick = 0;
}
function initalize(){
completeCatalog.push(new It... | true |
75c04fda895188069faa01ab97384475911410dd | JavaScript | michael-ddavis/endless | /src/components/HowItWorks.js | UTF-8 | 1,806 | 2.640625 | 3 | [] | no_license | import { useState, useEffect } from "react";
import api from "../api/api";
import "react-loader-spinner/dist/loader/css/react-spinner-loader.css";
import Loader from "react-loader-spinner";
function HowItWorks() {
let [steps, getSteps] = useState([]);
let [isError, setError] = useState(null);
let [isLoading, set... | true |