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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
8ac0f84d6a459b042906a2b2d9ef3a9d37c4d8e5 | JavaScript | icewanee/ComSecurityProject | /backend/services/post/index.js | UTF-8 | 2,146 | 2.578125 | 3 | [] | no_license | const PostModel = require("../../models/post");
const { handleError, ErrorHandler, HttpStatus } = require("../../utils/error");
const getAllPosts = () => async (req, res) => {
try {
const result = await PostModel.find();
return res.json({
data: result,
});
} catch (error) {
console.log(error... | true |
c3f1117fb5edfdc22c771ff670189b41abe52f17 | JavaScript | rrivaden03/HackerRank | /Algorithms/Implementations/theTimeInWords.js | UTF-8 | 1,592 | 3.21875 | 3 | [] | no_license | process.stdin.resume();
process.stdin.setEncoding('ascii');
var input_stdin = "";
var input_stdin_array = "";
var input_currentline = 0;
process.stdin.on('data', function (data) {
input_stdin += data;
});
process.stdin.on('end', function () {
input_stdin_array = input_stdin.split("\n");
main();
});
func... | true |
d9117aee0c4d7c5d71453007dd282ff6b732de1a | JavaScript | 0Simba/ISART_PRD_Reporting | /scripts/calendar.js | UTF-8 | 2,324 | 2.8125 | 3 | [
"MIT"
] | permissive | define([
'jquery',
'config'
], function ($, config) {
'use strict';
var projectDurationInDay = 0
var msToDay = 1 / (1000 * 60 * 60 * 24)
function set () {
setProjectDaysDuration()
for (var i = 0; i < config.calendar.length; i++) {
addDate(config.calen... | true |
3c19239063dcecc080edb5fb726d5d49c7191e46 | JavaScript | ProgramistaZpolski/nougatter | /modules/sadownictwo.js | UTF-8 | 3,988 | 2.875 | 3 | [
"MIT"
] | permissive | exports.run = (message, Discord, pozwijmode, pozwijmodev) => {
if(pozwijmode[message.author.id] == true) {
// pozwij mode etap 1: wychwytuje mention kogo chcesz pozwac i pyta o powod
if(pozwijmodev[message.author.id] == 1) {
if(message.mentions.members.first()) {
pozwany ... | true |
2cc5c34d3da38fcaad0806840b923a6d6376ca93 | JavaScript | chriscn/mihome | /lib/api.js | UTF-8 | 7,470 | 2.765625 | 3 | [
"ISC"
] | permissive | const request = require('request-promise');
const USER_AGENT = 'npmjs/mihome';
const BASE_URL = 'https://mihome4u.co.uk';
let accessEmail = '';
let accessKey = '';
/**
* If you already have an API key use this function.
* @param email Your email to login to https://mihome4u.co.uk/
* @param apiKey Your API key that... | true |
3bff8e5f8c4562f74edcdcb7f301e07033c22d64 | JavaScript | ArtmenV/films_spa | /src/movie-list/reducer.js | UTF-8 | 446 | 2.578125 | 3 | [] | no_license | import types from './actionTypes'
const initialState = {
items: [],
isLoading: false
}
const movieList = (state = initialState, action) => {
switch ( action.type ) {
case types.MOVIE_IS_LOADING:
return {
...state,
isLoading: action.payload
}
case types.SET_MOVIES:
re... | true |
61b4ee807afee096200cc1f7ac41d184da1cdd89 | JavaScript | dkdlel/OnlineJudge | /BackJoon/node/1735.js | UTF-8 | 453 | 3.390625 | 3 | [] | no_license | const fs = require("fs");
const filepath = process.platform === "linux" ? "/dev/stdin" : "./input.txt";
let [a1, a2, b1, b2] = fs.readFileSync(filepath).toString().trim().split(/\s+/).map(Number);
const GCD = (a, b) => {
while (b != 0) {
let n = a % b;
a = b;
b = n;
}
return a;
}
... | true |
22c1946116005b3bdfb4a4b667f17f9f3b17d9a2 | JavaScript | edave64/MooLang | /js-runtime/string.js | UTF-8 | 1,023 | 2.78125 | 3 | [] | no_license | (function () {
"use strict";
var proto, constructor,
func, obj, str;
constructor = function (str) {
this.__s = str;
};
/* node switch */
if (typeof module !== 'undefined') {
module.exports = constructor;
obj = require('./object');
func = require('./funct... | true |
cb5a30ffa8890b5ef9b0e9172b1ed0e356ba362a | JavaScript | a-better/mafia | /server/src/room/mafiaRoomManager.js | UTF-8 | 1,691 | 2.671875 | 3 | [] | no_license | var GameObjectManager = require('../../core/objects/gameObjectManager');
var MafiaObjectFactory = require('../factory/mafiaObjectFactory');
var StateFactory = require('../factory/mafiaStateFactory');
var MafiaRoomManager = function(){
GameObjectManager.call(this);
this.gameObjectFactory = new MafiaObjectFactory(... | true |
f23a432032fe53ffe119161961a72d8d0433500f | JavaScript | diegoandcontroll/passwordGenerator | /src/modules/geradores.js | UTF-8 | 741 | 3.25 | 3 | [] | no_license | const rand = (min, max) => Math.floor(Math.random() * (max - min) + min);
const upperCase = () => String.fromCharCode(rand(65,91));
const lowCase = () => String.fromCharCode(rand(97,123));
const number = () => String.fromCharCode(rand(48,58));
const symbol = ',.;:-=+_(){}@!#$%"&*~[]';
const symbolGenerate = () => symbo... | true |
b26394757aa3b9c77a5cb0ce6afdd9b6b02dbb26 | JavaScript | krysmarsh/blue-badge-folder-setup | /react-classroom/react-lessons/src/App.jsx | UTF-8 | 1,002 | 2.578125 | 3 | [] | no_license | import logo from './logo.svg';
import './App.css';
// import Header from "./components/Day1/Header";
// import AboutMe from "./components/Day1/AboutMe";
// import Footer from "./components/Day1/Footer";
// import State from "./components/Day1/State";
// import Effect from "./components/Day1/Effect"
// import TenLittleM... | true |
158aef18f00b39163f5b6581bf0253aea7a6948b | JavaScript | loune/ble-bean | /lib/ScratchThree.js | UTF-8 | 752 | 2.59375 | 3 | [
"MIT"
] | permissive | var SCRATCH_UUID = 'a495ff20c5b14b44b5121370f02d74de';
var SCRATCH_THREE = 'a495ff23c5b14b44b5121370f02d74de';
function ScratchThree() {
}
ScratchThree.prototype.readThree = function(callback) {
this.readDataCharacteristic(SCRATCH_UUID, SCRATCH_THREE, callback);
};
ScratchThree.prototype.writeThree = function(data... | true |
31599a56f63088a75f9db578feda2d6c9a1213ea | JavaScript | Vladimirx16/vladimirx16.github.io | /school/libs/hyphenation/hyphenation.js | UTF-8 | 893 | 2.75 | 3 | [] | no_license | $.fn.hyphenate = function() {
var all = "[абвгдеёжзийклмнопрстуфхцчшщъыьэюя]",
glas = "[аеёиоуыэю\я]",
sogl = "[бвгджзклмнпрстфхцчшщ]",
zn = "[йъь]",
shy = "\xAD",
re = [];
re[1] = new RegExp("("+zn+")("+all+all+")","ig");
re[2] = new RegExp("("+glas+")("+gl... | true |
4f81e94a3eeb89617fa4a05a8c84891e20b23a90 | JavaScript | Michael-Z/heads-up-poker | /src/ui/server/src/js/services/card-service.js | UTF-8 | 2,414 | 3.25 | 3 | [] | no_license | function Cards($rootScope) {
var cards;
function createDeck() {
var cs = [];
for(var i = 0; i < 52; i++) {
cs.push(i);
}
return cs;
}
/* http://stackoverflow.com/questions/2450954/how-to-randomize-shuffle-a-javascript-array */
function shuffle(array) {
... | true |
59fc9eb17bf8f367151f83615cebfe35ecb2e9d0 | JavaScript | HalfMadd/marmiton_frontend | /src/pages/DelCategorie.js | UTF-8 | 1,728 | 2.6875 | 3 | [] | no_license | import React, {Component} from 'react';
import CategorieService from '../services/categories.services';
class DelCategorie extends Component{
constructor(props){
super(props);
this.state = {
categories: [],
};
}
async componentDidMount(){
//Récup categories
let response = await Catego... | true |
00b5ab2b69a798d104734aeef844a1dbc4c4d676 | JavaScript | cskidz99/node-assessment-v2 | /server.js | UTF-8 | 3,643 | 2.609375 | 3 | [] | no_license | var express = require('express');
var bodyParser = require('body-parser');
var accounts = require('./accounts.json');
var app = express();
app.use(bodyParser.json());
app.get('/api/accounts', function(req,res,next){
// console.log(req.query.cardtype);
if (req.query.cardtype){
var result = accounts.filter(
... | true |
e6bc608fecb5d9a791d86a56eed92b2cd86310c3 | JavaScript | Anna-Bala/makeup-app | /src/Components/ProductList.js | UTF-8 | 1,370 | 2.65625 | 3 | [] | no_license | import React, {useEffect, useState} from 'react';
import axios from 'axios';
import SingleProduct from './SingleProduct';
const ProductList = () => {
const [productData, setProductData] = useState([]);
const [isLoaded, setIsLoaded] = useState(false);
const [isError, setIsError] = useState(false);
... | true |
00a3b340f80759edbaa7202bb65ce0726042b8df | JavaScript | Elena-Sergienko/Codewars-solutions-of-7th-level | /Number of Decimal Digits.js | UTF-8 | 342 | 4 | 4 | [] | no_license | // 7 kyu
// Number of Decimal Digits
// Determine the total number of digits in the integer (n>=0) given as input to the function. For example, 9 is a single digit, 66 has 2 digits and 128685 has 6 digits. Be careful to avoid overflows/underflows.
// All inputs will be valid.
function digits(n) {
return (n+'... | true |
f58e61142b6b4631c02c36fec3200f5c19f84374 | JavaScript | kun82/node-course-chat-app | /server/utils/message.js | UTF-8 | 672 | 2.8125 | 3 | [] | no_license | var moment =require('moment')
var someTimestamp = moment().valueOf()
// create function (take in 2 agrs 'from' & 'text')
var generateMessage = (from,text)=>{
return { //return an object with 3 properties
from,
text,
createAt: someTimestamp
}
}
// create function (take in 3 agrs FROM, L... | true |
d44ad0221fc4f65c660a833515d4f9c670d71088 | JavaScript | ugate/templeo | /lib/cachier.js | UTF-8 | 48,938 | 2.53125 | 3 | [
"MIT"
] | permissive | 'use strict';
const TemplateOpts = require('./template-options');
const Sandbox = require('./sandbox');
const Director = require('./director');
// TODO : ESM uncomment the following lines...
// TODO : import * as TemplateOpts from './template-options.mjs';
// TODO : import * as Sandbox from './sandbox.mjs';
// TODO : ... | true |
d323a3e9400c3dba3cc4b961a75563652bb427c4 | JavaScript | sudhirmishra/tictactoe | /js/game.js | UTF-8 | 4,644 | 3.671875 | 4 | [] | no_license | // Cell representation
var Button = function(element){
// Reference to DOM element
this.element = element;
// Make UI changes for a particular cell
this.markChange = function(symbol){
this.element.innerText = symbol
this.element.className = this.element.className + " disabled"
}; ... | true |
2d02ce40c0f7f9ace58596c44feb7e5168df5cd9 | JavaScript | Yarden-Tal/fullstack-itc-may21 | /05-Node/99-Assignments/03-checkup-01/tal/controlers/controlerStudents.js | UTF-8 | 1,032 | 2.578125 | 3 | [] | no_license | "use strict";
exports.__esModule = true;
exports.getRandomStudents = exports.addStudent = exports.getStudents = void 0;
var students_1 = require("../model/students");
var students = new students_1.Students();
function getStudents(req, res) {
res.send({ students: students.studentsArray });
}
exports.getStudents = ge... | true |
2541919a84f69a2d69909ef48eca419ff067c23e | JavaScript | JPMendoza/cs6460 | /src/components/FunFacts.js | UTF-8 | 2,495 | 2.96875 | 3 | [] | no_license | import React from "react";
import funfact from '../jsonfolder/funfact.json';
import putLink from './HelperFunctions.js';
export default class FunFacts extends React.Component {
constructor(props) {
super(props);
this.state = {isToggleOn: true};
// This binding is necessary to make `this` work in the cal... | true |
ffb34e7f1aa0613ae74c47fe3cac7730d82bdf90 | JavaScript | e-oloughlin/market-trade-processor | /mock/request.js | UTF-8 | 1,627 | 2.953125 | 3 | [
"MIT"
] | permissive | /**
* Handy for posting a random, valid message object
* to the api
*/
const request = require('request');
const moment = require('moment');
const _ = require('lodash');
const countries = require('country-data').countries;
const currencies = require('country-data').currencies;
function getRandomCountry() {
let ... | true |
46f77aba1560a0f31ba2f3973c8fa5da8065a972 | JavaScript | AngelikaNowak/companiesBrowser | /js/company-details.js | UTF-8 | 7,092 | 2.734375 | 3 | [] | no_license | $(function () {
const datepickerFrom = $("#datepicker_from");
const datepickerTo = $("#datepicker_to");
// search for company ID from URL (copied from stack overflow)
let urlSearchParams = new URLSearchParams(document.location.search);
const companyId = urlSearchParams.get("companyId");
if (!... | true |
47e52bdc58a4e458b5970927f8d048f8a00a26a4 | JavaScript | chasemthomas/SoapDay_v2 | /src/scraper.js | UTF-8 | 4,185 | 2.875 | 3 | [] | no_license | import "./styles.css";
import { baseUrl } from "./urls.js";
import { wsUrl } from "./urls.js";
import { vrsUrl } from "./urls.js";
import { firstOpUrl } from "./urls.js";
// Scraping Modules
const rp = require("request-promise");
const $ = require("cheerio");
// Pretty XML Format
let format = require("xml-formatter")... | true |
f31b1aeeaa9e13926371901a5f66f15f47302ee2 | JavaScript | hpstream/node_all | /vue/view/util/ajax.js | UTF-8 | 464 | 2.6875 | 3 | [] | no_license | // 采用同步函数进行书写,房子嵌套过于严重。
export default async function ajax(url) {
return new Promise(function (resolve, reject) {
let ajaxSetting = {
url: url,
type:'get',
success: function (response) {
resolve(response);
},
error: function () {
... | true |
49625cd6a7bc6d643fd57ff63bf5818e1ca322d9 | JavaScript | DorneeanWebApps/dez-polymer | /server-data/controllers/appelements.controller.js | UTF-8 | 1,612 | 2.5625 | 3 | [] | no_license | var config = require('../config.json')
var express = require('express');
var router = express.Router();
var elementsService = require('../services/appelements.service.js');
router.get('/',getAll);
router.get('/:_id', get);
router.post('/', create);
router.put('/:_id', update);
router.delete('/:_id', _delete);
module... | true |
968a91480e365ef1dd2778dcc9c5ca27dc4e4707 | JavaScript | kishorenc/plankton | /bin/planktoncli.js | UTF-8 | 1,043 | 2.671875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env node
var program = require('commander');
var mkdirp = require('mkdirp');
var plankton = require('../');
program
.version('0.0.0')
.option('-src, --src [type]', 'Path to directory where posts are found')
.option('-dest, --dest [type]', 'Path to directory where plankton will write files to')
... | true |
c43ecf1bc31cbacd4c7db685d0198518de21fb5f | JavaScript | aniacichocka/Coders_Lab_React | /1_Zadania/Dzien_4/4_Formularze_kontrolowane/js/zadanie04.jsx | UTF-8 | 1,285 | 2.5625 | 3 | [] | no_license | import React from 'react';
import ReactDOM from 'react-dom';
document.addEventListener('DOMContentLoaded', function(){
class MixedData extends React.Component{
constructor(props){
super(props)
this.state = {
selected: 'Ananasy'
}
}
handl... | true |
05a2759306eca59adad39fa9d1da6c02a6405416 | JavaScript | piekay-zz/startster | /firefox/assets/js/options.js | UTF-8 | 2,898 | 2.78125 | 3 | [
"BSD-3-Clause"
] | permissive | var saved = chrome.i18n.getMessage("saved");
function saveOptions(e) {
browser.storage.sync.set({
search: document.querySelector("#search").value,
engine: document.querySelector("#engine").value
});
showSaved();
e.preventDefault();
}
function showSaved() {
var status = document.getE... | true |
c44b50c6dc7cfe052c3d1867892992ac6771d27f | JavaScript | SKhan1211/OpenStable | /server/schema/mutations/tour_mutations.js | UTF-8 | 3,196 | 2.65625 | 3 | [] | no_license | /********** TOUR MUTATIONS ************
DONE
- Add new Tour
TO BE DONE:
= Remove Tour
- Edit Tour
- Add horse
- Remove Horses
/********** TOUR MUTATIONS ************/
const graphql = require("graphql");
const { GraphQLString,
GraphQLNonNull,
... | true |
c4608cee3b185f0e8460cc35fb1442e612af06f3 | JavaScript | vagsy/201710node | /week3-day1/src/plugin/notify.js | UTF-8 | 1,141 | 2.546875 | 3 | [] | no_license | import modal from './notify.vue';
let notify = { // 需要在此对象中拥有一个install方法
};
// this.$notify('吃饭了吗?',{delay:1000})
notify.install = function (Vue,options={delay:3000}) {
Vue.prototype.$notify = function (message,opt={}) {
if(notify.el) return;
options = {...options,...opt}; // 用自己调用插件时传递过来的属性 覆盖掉默认设... | true |
fec1fd371aa4804e847a784c8b36a70f17f6dfe3 | JavaScript | pdkyll/study-algorithm | /problems/freeCodeCamp/basicAlgorithmScripting/title-case-a-sentence.js | UTF-8 | 272 | 3.40625 | 3 | [] | no_license | function titleCase(str) {
const arr = str.split(" ").map((val, index) => {
const semiResult = val[0].toUpperCase() + val.substring(1).toLowerCase();
return semiResult;
})
const result = arr.join(" ");
return result;
}
titleCase("I'm a little tea pot");
| true |
decdff6cd64d8bc77081d6a657ced479d3aa1875 | JavaScript | yukiej/recast.ly | /src/components/VideoList.jsx | UTF-8 | 816 | 2.765625 | 3 | [] | no_license | import VideoListEntry from './VideoListEntry.js';
var VideoList = (props) => {
const videos = props.videos.map(element => {
return (
<VideoListEntry
key={element.etag}
video={element}
handleClick={props.handleClick}
/>
);
});
// console.log(props.videoList);
return... | true |
9d775ec6c978d022d05ef772e673e69c0a9c72fc | JavaScript | Rafayasad/JavaScript-Complete-book-solves | /JS complete/chapter6to9.js | UTF-8 | 2,356 | 3.3125 | 3 | [] | no_license | // var num = 10;
// document.write("<h3>Result</h3>");
// document.write("<br />the value of num is:"+num);
// document.write("<br />...........");
// document.write("<br /><br />the value of ++num is :"+(++num));
// document.write("<br />Now the value of num is:"+num);
// document.write("<br /><br />the value of a++ i... | true |
e7d5f8bd4e6d2348fd7c928ccdc7f688750ec540 | JavaScript | alfathdirk/postman-to-vscode-rest-client | /lib.js | UTF-8 | 2,577 | 2.5625 | 3 | [] | no_license | let fs = require('fs');
let result = '';
let dir = 'collections';
let defaultEnv = `
@url = https://sample.com/
@token = token
@contentType = application/json
`;
let parseDataToRest = (val) => {
const baseUrl = val?.request?.url?.raw;
let str = ''
str += '### '+ val.name+ '\n';
let urls = val?.request... | true |
d574f9e61207a802f6dd0aa2e73d5ce3dec0c504 | JavaScript | wpantoja/Programacao_Imperativa_prova | /chekpoint.js | UTF-8 | 3,181 | 3.1875 | 3 | [] | no_license | //microondas
let microondas = (comida, tempo) => {
if (comida == 'pipoca') {
if (tempo < 10) {
console.log('Tempo insuficiente');
}
else if (tempo >= 10 && tempo < 20) {
console.log('Prato pronto, bom apetite!!!');
}
else if (tempo >= 20 && tempo ... | true |
0d2718229e80a6399ef2fd0ed976ae98b4fe6325 | JavaScript | s0phr0syn3/algorithms | /intermediateAlgorithms/sumAllPrimes.js | UTF-8 | 804 | 3.9375 | 4 | [] | no_license | function sumPrimes(num) {
var primes = [];
// Start looping at 2 since 1 by itself is not prime
for (var i = 2; i <= num; i++) {
// 2 and 3 are known primes, no need to loop
if (i === 2 || i === 3) {
primes.push(i);
} else {
var isPrime = true;
// brute force test to see if i is divi... | true |
2f57179c6e85bc00340e4ebce2a84b1c2e6e8efd | JavaScript | amarnath091/eptesting.net | /wpscripts/jsWPFrame.js | UTF-8 | 526 | 2.625 | 3 | [] | no_license | //jsWPFrame.js
function GetFrameUrl( frameid )
{
var docframe = document.getElementById(frameid);
if(docframe==null) return;
var sURL = window.location.href;
if (sURL.indexOf("?") > 0)
{
var arrParams = sURL.split("?");
var arrURLParams = arrParams[1].split("&");
for (var i=0;i<arrURLParams.length;... | true |
5d7299dc85060db2f1ce0305037687b12b4c690d | JavaScript | arunprabu/contact-mgr-api | /routes/contacts.js | UTF-8 | 1,919 | 2.6875 | 3 | [] | no_license | var express = require('express');
var contactService = require('../services/contactsService');
var authUtil = require('./util/authUtil');
var router = express.Router();
/* GET contacts listing. */
router.get('/', authUtil.optional, function(req, res, next) {
//1. connect to service
contactService.getContacts(fu... | true |
1b4c4f775977ee939a747c51651fa70056f7884c | JavaScript | Ani23ii/Ani-Babayan | /script.js | UTF-8 | 1,370 | 3.21875 | 3 | [] | no_license | function calculateGrade(){
var ParticipationPercent=parseInt(document.getElementById("ParticipationPercent").innerHTML)
var HWPercent=parseInt(document.getElementById("HWPercent").innerHTML)
var PM1Percent=parseInt(document.getElementById("PM1Percent").innerHTML)
var PM2Percent=parseInt(document.getElementById(... | true |
6cb0aedcd1cf8059e773ed40d8f22b78bb575c28 | JavaScript | hems/bfx-api-client-generator | /src/generator.js | UTF-8 | 947 | 2.640625 | 3 | [] | no_license | const P = require('bluebird')
const path = require('path')
const mkdirp = P.promisify(require('mkdirp'))
const ls = require('./lib/list_files')
const render = require('./lib/render')
const write = require('./lib/write')
module.exports = async (data, templatePath, outputPath) => {
// normalize the path
templatePat... | true |
268b6fc33e1c2cbed7bbe3e98f66cd407db2a6e1 | JavaScript | hammer-code/http-server-example | /tests/unit/model.test.js | UTF-8 | 4,108 | 2.8125 | 3 | [] | no_license | import init from 'src/model';
import data from 'src/data';
import { ModelNotFound } from 'src/error';
let model;
beforeEach(function () {
model = init(data);
})
describe('findAllStudent', () => {
test('return correct data', () => {
expect(model.findAllStudent()).toEqual(data.students);
});
});
describe('f... | true |
dd76054125592f86aa356dba248bbfe6aa6401a5 | JavaScript | kimberlyrora/hero-digital-challenge | /src/components/Checkbox.jsx | UTF-8 | 673 | 2.546875 | 3 | [] | no_license | import React, {useState} from "react";
import "../styles/checkbox.scss";
const Checkbox = ({name, label, values, id, setValues, ariaLbl}) => {
const [checked, setChecked] = useState(false);
const onChange = () => {
setChecked(!checked);
setValues({
...values,
[name]: !checked
});
};
return (
<lab... | true |
e5fb085d400c7d4097cfb8f240361de2a1653b37 | JavaScript | touchatoms/DesignPatternJavascript | /9-Facade/FacadeTest.js | UTF-8 | 1,727 | 3.171875 | 3 | [] | no_license |
class Light {
constructor(name) {
this.name = name;
}
turnOn() {
return this.name + "开启";
}
turnOff() {
return this.name + "GB";
}
}
class TV {
constructor(name) {
this.name = name;
}
turnOn() {
return this.name + "开启";
}
turnOff(... | true |
88c74e0d17c252b0e2dedd91eef2b03e4556883d | JavaScript | kkh1178/circles | /script.js | UTF-8 | 4,853 | 3.3125 | 3 | [] | no_license | "use strict";
//Select the myCanvas element
const c = document.getElementById("myCanvas");
// Set the canvas width and height to the window objects width and height
c.width = window.innerWidth - 5;
c.height = window.innerHeight - 5;
// getContext returns a drawing to the canvas
const ctx = c.getContext("2d");
// wi... | true |
018266ba4490865c4aca93c6eb9933ac56129562 | JavaScript | ThomasPJR/Brouwwereld | /js/Shopping.js | UTF-8 | 628 | 3.21875 | 3 | [] | no_license | document.querySelectorAll(".item").forEach((item)=>{
item.addEventListener("click", (element) => {
const elementName = element.currentTarget.getAttribute("name");
let newWinkelmandje = (sessionStorage.getItem("Winkelmandje") != null)
?sessionStorage.getItem("Winkel... | true |
89bd8143c77922aa281f535c347e5b2b839fcbcc | JavaScript | wovert/WebFullStack | /node/events/events.js | UTF-8 | 451 | 2.890625 | 3 | [] | no_license | const EventEmitter = require('events')
class CustomEvent extends EventEmitter {
}
const ce = new CustomEvent()
// 绑定test事件
ce.on('test', () => {
console.log('this is a test')
})
function fn2() {
console.log('fn2');
}
ce.on('test', fn2);
ce.on('error', (err, time) => {
console.log(err)
console.log(time)
... | true |
eb8d1d150f6cc6bf967864603083b7300bd3b67f | JavaScript | itsmebeanie/coursework | /applied-internet-technology/final/public/js/github.js | UTF-8 | 1,336 | 3.140625 | 3 | [
"MIT",
"BSD-3-Clause"
] | permissive | document.addEventListener('DOMContentLoaded', main);
function main() {
var lookUp = document.getElementById("lookUp");
lookUp.addEventListener('click', handleLookUp);
}
function handleLookUp() {
var repoName = document.getElementById("testing").value;
console.log(repoName);
var url = "https://api.... | true |
5e69b1ffc60288e1284d0133f2b16aa78bdf3b93 | JavaScript | MairaGalvao/DI_Bootcamp | /W5_HTTP_JSON_AJAX/Day5_Mini_Project_Day/exercises_class.js | UTF-8 | 216 | 2.765625 | 3 | [] | no_license | let p = new Promise ((res, rej) => {
setTimeout (() => {
console.log('good morning')
}, 4000)
})
console.log(p)
Promise.resolve(setTimeout(() => {
console.log('good morning students')
}, 4000))
| true |
1917cff681e87d918e21ac270c7ad089143b322e | JavaScript | madanadi0305/JavaScript-Basics-and-Advanced-Strings | /task26.js | UTF-8 | 834 | 3.28125 | 3 | [] | no_license | const isAnagram=(A,B)=>{
var arr1=[],arr2=[];
arr1=A.split("");
arr2=B.split("");
var k=0;
for(var i=0;i<=arr1.length-arr2.length;i++)
{
for(var j=0;j<arr2.length;j++)
{
if(B.indexOf(arr1[i+j])!=-1)
k=k+1;
}
if(k==arr2.length)
return true;
k=0;
}
return false
}
const ... | true |
d14ba0c14d4124e7b6b3521cceca5376e11e2326 | JavaScript | it-labs9/flexiblog | /js/script.js | UTF-8 | 1,972 | 2.859375 | 3 | [] | no_license | 'use strict';
/////////////////////////////////////////////
// Making a burger Menu
var burgerButton = document.querySelector('.header-nav__buttons_item.menu');
var header = document.querySelector('.header');
var menu = document.querySelector('.header-nav__buttons_item.menu');
var closeIcon = document.querySelector('.... | true |
7d2d5a612f7bf03e8c7cc0720dff1d0e2527bbcb | JavaScript | JesseLeung97/TLoUIICountdown | /src/QuoteGenerator.js | UTF-8 | 4,163 | 2.5625 | 3 | [] | no_license | import React, { Component } from 'react';
class QuoteGenerator extends Component {
constructor(props) {
super(props)
this.state = {
display: "",
preload: true,
quotes: [
"Endure and survive.",
"It can't be for nothing.",
"Everyone I have ever cared for ha... | true |
25331e1785b1af8685fb7634ea76816104824065 | JavaScript | andela/fargo-ah | /middlewares/validateProfile.js | UTF-8 | 1,208 | 2.84375 | 3 | [] | no_license | const validateProfile = (req, res, next) => {
const {
username, bio, image, firstname, lastname
} = req.body.user;
const error = [];
const alphaNumeric = /^[a-zA-Z0-9]+$/;
const alphabetsOnly = /^[a-zA-Z ]{2,30}$/;
const validUrl = /(http|https):\/\/(\w+:{0,1}\w*)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%!\-/]... | true |
db62d170610b2b16e0998ffb6629d3b2ac9151f8 | JavaScript | joekir/lskey | /src/db/db.js | UTF-8 | 1,646 | 2.75 | 3 | [
"MIT"
] | permissive | const sqlite3 = require('sqlite3'),
fs = require('fs');
function randomInt(min, max) {
if(max <= min)
throw new Error("Invalid Inputs!");
return Math.floor(Math.random() * (max - min) + min);
};
// ctor
function db(dbPath){
if(!(this instanceof db)){
return new db(dbPath);
};
this.dbPath = d... | true |
5819c574644c2af4fab6d39d04c5f990d7ceeb60 | JavaScript | eraynai/ecommerce-crud | /controllers/item.js | UTF-8 | 1,433 | 2.765625 | 3 | [] | no_license | const Item = require('../models/item')
function index(req, res) {
Item.find(function (err, items) {
if (err) {
console.log(err)
} else {
res.json(items)
}
})
}
function show(req, res) {
let id = req.params.id
Item.findById(id, function (err, item) {
res.json(item)
})
}
function ... | true |
69763a19b46586fd9306686c2b816946a556a866 | JavaScript | chromium/chromium | /chrome/browser/resources/chromeos/accessibility/common/paragraph_utils.js | UTF-8 | 26,138 | 2.71875 | 3 | [
"BSD-3-Clause"
] | permissive | // Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import {WordUtils} from './word_utils.js';
var AutomationNode = chrome.automation.AutomationNode;
var RoleType = chrome.automation.RoleType;
export class ParagraphUtils {
/... | true |
4b62d2c9865506533136e859aa63ba181e497c57 | JavaScript | azul-de-prusia/Bellotero | /src/actions/productoActions.js | UTF-8 | 2,572 | 2.6875 | 3 | [] | no_license | import {
AGREGAR_PRODUCTO,
AGREGAR_PRODUCTO_EXITO,
AGREGAR_PRODUCTO_ERROR,
COMENZAR_DESCARGA_PRODUCTOS,
DESCARGA_PRODUCTOS_EXITO,
DESCARGA_PRODUCTOS_ERROR
} from '../types';
import clienteAxios from '../config/axios';
import Swal from 'sweetalert2';
import Productos from '../component... | true |
7618fde3d265eed7994c8a303f15fd5951a8feb0 | JavaScript | jacksky007/play-babel | /browser-test/src/main.js | UTF-8 | 1,178 | 2.546875 | 3 | [] | no_license | console.log('log from main.js')
try {
f()
} catch(e) {
if(false) {
document.body.innerHTML += '<pre>--------------------------</pre>'
document.body.innerHTML += '<pre>error from try catch</pre>'
var keys = ['message', 'line', 'column', 'stack', '_stack']
for (var i = 0; i < keys.length; i++) {
... | true |
9b36c416de988841648e645c63f5d99ab389cb06 | JavaScript | robertoAguilar1993/backend-server-udemy-AAvanzado | /routes/busqueda.js | UTF-8 | 2,963 | 2.65625 | 3 | [] | no_license | var express = require('express');
var app = express();
var Hospital = require('../models/hospital');
var Medicos = require('../models/medico');
var Usuario = require('../models/usuario');
app.get('/todo/:buscar', (req, res)=> {
var buscar = req.params.buscar;
var regex = new RegExp(buscar, 'i');
Promis... | true |
f595b2946658647719a2b9abb877cd3a025a396e | JavaScript | HexClan-dev/EDMS | /source/WEB_Application/web/assets/js/application_form.js | UTF-8 | 5,161 | 2.515625 | 3 | [
"MIT"
] | permissive |
function changePosition(){
document.getElementById('first-part_application-form').className += " hidden";
document.getElementById('second-part_application-form').className = '';
location.href= '#second-part_application-form';
}
function goBack(){
document.getElementById('first-part_application-for... | true |
3c284e4510d01f0fc25a59831529e7673663a427 | JavaScript | lymcho/beauty | /js/slideup.js | UTF-8 | 354 | 2.796875 | 3 | [
"MIT"
] | permissive |
var book = document.querySelectorAll(".book");
var overlay = document.querySelector("#overlay");
book[0].addEventListener("click", function(){
//pull up overlay
overlay.style.opacity="0.5";
overlay.style.zIndex="2";
});
overlay.addEventListener("click", function(){
//pull up overlay
overlay.style.opacity="0"... | true |
ff25d6623541138757878e11cd12fd84e5184c97 | JavaScript | dianestephani-201/cookie-stand | /app.js | UTF-8 | 10,840 | 3.46875 | 3 | [
"MIT"
] | permissive |
var hours = ['6am', '7am', '8am', '9am', '10am', '11am', '12pm', '1pm', '2pm', '3pm', '4pm', '5pm', '6pm', '7pm', '8pm'];
var seattle = {
name: 'seattle',
minCustomersEachHour: 23,
maxCustomersEachHour: 65,
averageCookiesSoldPerCustomer: 6.3,
customersPerHour: [],
cookiesSoldPerHour: [],
totalCookiesPe... | true |
11f0e3f0cee857c5a6edadb97b1680d888b78030 | JavaScript | ColoSRJones/BusMallCart | /js/cart.js | UTF-8 | 1,279 | 2.828125 | 3 | [
"MIT"
] | permissive | 'use strict';
var cartItems = [];
function renderCart () {
if (localStorage.cartArray) {
cartItems = JSON.parse(localStorage.cartArray);
var cart = document.getElementById('cart');
cart.innerHTML = '';
for (var i = 0; i < cartItems.length; i++) {
var productFig = document.createElement('figure... | true |
da4487df08c8ed3c745993bd845f0fd9759bf587 | JavaScript | amirkarimi/Haraka | /outbound/timer_queue.js | UTF-8 | 1,631 | 2.953125 | 3 | [
"MIT"
] | permissive | 'use strict';
const logger = require('../logger');
function TQTimer (fire_time, cb) {
this.fire_time = fire_time;
this.cb = cb;
}
TQTimer.prototype.cancel = function () {
this.cb = null;
};
function TimerQueue (interval) {
const self = this;
interval = interval || 1000;
this.queue = [];
... | true |
fcd62a5da29ce77a89b7983284c7f22d0a06e642 | JavaScript | mateuscamargodev/gerenciador-de-tarefas | /js/controllers/TarefaController.js | UTF-8 | 858 | 2.671875 | 3 | [] | no_license | class TarefaController {
cadastraTarefa() {
this._inputNome = document.querySelector('#nome-tarefa');
this._inputInicio = document.querySelector('#inicio-tarefa');
this._inputTermino = document.querySelector('#termino-tarefa');
let dataInicio = new Date(this._inputInicio.value).getTi... | true |
875281181e5a523880ada9437b364c5a8a5847df | JavaScript | nilnilnull/simpleChain | /Classes/Blockchain.js | UTF-8 | 5,299 | 3.0625 | 3 | [] | no_license |
const SHA256 = require('crypto-js/sha256');
const db = require('../levelSandbox.js')
const BlockClass = require('./Block.js')
/* ===== Blockchain Class ==========================
| Class with a constructor for new blockchain |
| ================================================*/
class Blockchain{
constructo... | true |
17bcdaef9ccb47929e1e690a4f73b76226ba2e01 | JavaScript | paularolim/javascript-object-oriented | /Customer.js | UTF-8 | 368 | 2.84375 | 3 | [] | no_license | export class Customer {
constructor(name, cpf, password) {
this._name = name;
this._cpf = cpf;
this._password = password;
}
get name() { return this._name; }
get cpf() { return this._cpf; }
set name(name) { this._name = name; }
// canAuthenticate(password) {
// ... | true |
8f2103ca6b8d65107915d14f379081ac3d6e4fa5 | JavaScript | davidenq/bitmap-image | /src/components.js | UTF-8 | 1,483 | 2.546875 | 3 | [
"MIT"
] | permissive | 'use strict';
/**
* @package bitmap-image
* @author David Núñez
* @license https://github.com/davidenq/bitmap-image/blob/master/LICENSE
*/
/* Module dependences */
var dec2hex = require('./helpers/dec2hex');
var hex2dec = require('./helpers/hex2dec');
var components = {};
var buffer;
var info =... | true |
81f4fe22e3c2b1df889ed162612f5827ca54b8e0 | JavaScript | ohisee/Web-JavaScript-Projects | /js-data-structures/src/concepts/review/jsReviewHashTable1.js | UTF-8 | 2,125 | 3.96875 | 4 | [] | no_license | /**
* @fileoverview JavaScript hash table
*
*/
class HashTable {
/**
* @param {number} size
*/
constructor(size) {
if (size < 0) {
this.keyMap = new Array(97);
} else {
this.keyMap = new Array(size);
}
}
/**
* @param {string} key
*/
_hash(key) {
const prime = 3... | true |
38123f80d0debbf317294aec1b4cb63d93505cd1 | JavaScript | alc080341/mars_rovers | /UI/index.js | UTF-8 | 1,651 | 3.609375 | 4 | [] | no_license |
initalise();
// Grab initial display from API and display on screen
function initalise()
{
setInterval(function(){
getRovers()
.then((response) => {
let returnHTML = ''
response.forEach(rover =>
{
returnHTML += `<div class='rover_info'>`;
returnHTML += `<div class='rover_info top'>${rover.na... | true |
75e93fdbd860b5231ba7b0be58c50913a8b6ae9b | JavaScript | gabriellimma/bootcamp_santander | /basic-conditionals/ex06.js | UTF-8 | 4,289 | 3.59375 | 4 | [] | no_license | // ************************************************************************** //
// //
// ::: :::::::: //
// ex06.js :+: :+: :+... | true |
4f6a6160a3352a6b740514885638b975d24e3872 | JavaScript | ravinduu/Service-Throttle-Web | /Service-Throttle-Frontend/service-throttle-admin-dashboard/src/services/srserviceservice.js | UTF-8 | 1,077 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | const fetcservice = async (authAxios, type) => {
const res = await authAxios.get(`/vehicle/service/all`);
const _servicess = await res.data;
return _servicess;
};
const _addservices = async (authAxios, service) => {
await authAxios.post(`/vehicle/service/add`, service).catch((err) => {
console.log(err);
... | true |
530feba57d5c526bec40edd5f45b6f86d30920bf | JavaScript | SwingWithGoyf/DraftBot7000 | /cardPrice.js | UTF-8 | 4,143 | 2.703125 | 3 | [] | no_license | var request = require('request');
var cheerio = require('cheerio');
var exports = module.exports = {};
// Gets all prices and all editions, buy and sell, for a given card name
exports.getSingleCardPrices = function (cardName, callback) {
var options = {
url: 'http://cardkingdomcache.azurewebsites.net/both... | true |
9b5a82d84e72b36932222abc0f10867b5856efdf | JavaScript | Rodr1go/twilio-sms | /src/SMS.js | UTF-8 | 495 | 2.59375 | 3 | [] | no_license | const config = require('../config');
class SMS {
constructor(accountSid, authToken, myNumber) {
this.accountSid = config.accountSid;
this.authToken = config.authToken;
this.myNumber = config.myNumber;
}
enviaSMS(numero, msg) {
const client = require('twilio')(this.accountSid, this.authToken)
... | true |
9f822e9e728c791fd189d7421fdfb90b76af1cff | JavaScript | AndrewTownsley/BeginnerJS-DOM-Cardio | /29 - Events/events.js | UTF-8 | 582 | 3.140625 | 3 | [] | no_license | const butts = document.querySelector('.butts');
const coolButton = document.querySelector('.cool');
function handleClick() {
console.log('!@#it got clicked');
}
const hooray = () => console.log('Hoorat');
butts.addEventListener('click', function() {
console.log('Im an anonymous function...');
})... | true |
a71da2d58f61d5598b5c135bd337f7abc1640500 | JavaScript | cenoura/reactnd-project-myreads-starter | /src/BookSearch.js | UTF-8 | 2,794 | 2.546875 | 3 | [] | no_license | import React, { Component } from "react";
import { Link } from "react-router-dom";
import { DebounceInput } from "react-debounce-input";
import * as BooksAPI from "./BooksAPI";
import Book from "./Book";
class BookSearch extends Component {
state = {
query: "",
books: []
};
updateResults =... | true |
bbbf013551196cbfd9c122392a2fb17da0a873b4 | JavaScript | phuonganhbs98/computer-review | /client/src/components/Register.js | UTF-8 | 3,399 | 2.546875 | 3 | [] | no_license | import React, { Component } from 'react'
import { register } from './UserFunctions'
class Register extends Component {
constructor() {
super()
this.state = {
name: '',
email: '',
password: '',
image: '',
imagePreviewUrl: '',
errors: {}
}
this.onChange = this.onCha... | true |
49c518598e395d800bbe230c66002f6149d265c9 | JavaScript | ezxmora/sticky-it-prw | /jobs/tasks.js | UTF-8 | 1,339 | 2.671875 | 3 | [] | no_license | const Task = require('../models/Task');
const email = require('./email');
const solve = async (taskName) => {
await Task.findOneAndUpdate({ task: taskName }, { solved: true }, (err, task) => {
if (err) return false;
if (!task) return false;
return true;
})
}
module.exports = {
cr... | true |
e8eff92c9b913cdbc59b5a820adbd30448c0a2fa | JavaScript | little-isaac/saas-platform | /React/Reducers/Address/GetAddressReducer.js | UTF-8 | 505 | 2.734375 | 3 | [
"MIT"
] | permissive | const GetAddressReducer = (
state = {
CurrentCountry: 1,
CurrentState: "",
Countries: [],
States: []
},
action
) => {
switch (action.type) {
case "SET_CURRENT_COUNTRY":
state = {
...state,
CurrentCountry: action.payload
};
break;
case "SET_COUNTRIES":
state = {
...state,
Coun... | true |
f58d60f6ca550effe4b36f046362dab64796d4a7 | JavaScript | Kirill-Filonchuk/goit-js-hw-11-color-switch | /js/index.js | UTF-8 | 1,587 | 3.890625 | 4 | [] | no_license | // Array of colors
const colors = [
"#FFFFFF",
"#2196F3",
"#4CAF50",
"#FF9800",
"#009688",
"#795548",
];
//Step 1 Function generate Random
const randomIntegerFromInterval = (min, max) => {
return Math.floor(Math.random() * (max - min + 1) + min);
};
//Step 2 refs of elements
const refs = {
btnStart: d... | true |
e41388aec411b175a65c99348cccc69326f54b32 | JavaScript | HitarthChudgar/weather-detect | /scripts/forecast.js | UTF-8 | 989 | 3.8125 | 4 | [] | no_license | //storing the key in a string
const key = 'S7A2q9xE4lAi1WOUUx9GYxi7HnUyRKTP';
//get weather information
const getWeather = async (id) => {
const base = 'https://dataservice.accuweather.com/currentconditions/v1/';
const query = `${id}?apikey=${key}`;
const response = await fetch(base + query);
con... | true |
1ee52ee3380d99e257f2f2942b35695ea2b050e7 | JavaScript | contartec/generic-model | /lib/models/GenericModel.js | UTF-8 | 2,850 | 2.703125 | 3 | [
"MIT"
] | permissive | const QueryBuilder = require('../utils/QueryBuilderUtils')
const QUERY_ATTR_NAMES = [
'page',
'pageSize',
'orderBy',
'genericSearch'
]
/**
* Contains a set of chewed methods to handle documents
*
* @class GenericModel
*/
class GenericModel {
/**
* The `attrs` list to (build the `query`) fetch the `do... | true |
a8ce642d88a3c4687db3e34c468e03248de44859 | JavaScript | yarindeoh/crackingTheCodingIntreview | /chapter06-MathLogic/6.2Basketball.js | UTF-8 | 592 | 4.03125 | 4 | [] | no_license | /**
* You have a basketball hoop and someone says that you can play one of two games.
Game 1: You get one shot to make the hoop.
Game 2: You get three shots and you have to make two of three shots.
If p is the probability of making a particular shot, for which values of p should you pick one game
or the other?
2 of 3... | true |
e53e82f8972315c0fd27e91cbfb08b09def4d942 | JavaScript | maxild/css-the-complete-guide-example | /js/main.js | UTF-8 | 1,698 | 2.65625 | 3 | [] | no_license | (function() {
let b = document.querySelector(".backdrop");
// mobile-nav (can only be closed by clicking backdrop...not good)s
var closeMobileNav = (function(backdrop) {
let hamburgerButton = document.querySelector(".toggle-button");
let mobileNav = document.querySelector(".mobile-nav");
... | true |
bbd755452468392bdf1943bc52f220f1ce5ebe00 | JavaScript | AmitVaranasi/kaios | /appindex.js | UTF-8 | 7,628 | 2.828125 | 3 | [] | no_license | var language = localStorage.getItem('lan' );
var lang = ""
if(language === '0'){
console.log(language)
fetch("./IN-EN.json")
.then(response => response.json())
.then(data => {
document.getElementById("title").innerText = data.Fishing_Sites_Title;
});
}
else if(language === '1'){
lang = "telugu"
console.lo... | true |
81f644d4cd7f9f4706aa553ee5daf799b53e0641 | JavaScript | Coders-of-The-Lost-Ark/Shared-code | /role.thief.js | UTF-8 | 2,043 | 2.953125 | 3 | [] | no_license | module.exports = {
// a function to run the logic for this role
run: function(creep) {
// if creep is bringing energy to a structure but has no energy left
if (creep.memory.working == true && creep.carry.energy == 0) {
// switch state
creep.memory.working = false;
... | true |
37c8ed3fae71b2f1c351b032ea58f438402a495c | JavaScript | shivamgupta2017/react-dummy-project-with-crud-single-page | /src/components/Signup.js | UTF-8 | 2,965 | 2.65625 | 3 | [] | no_license | import React from 'react';
import { NavigationAfterLogin } from './NavigationAfterLogin';
import { AuthService } from '../services/Auth.service';
export class Signup extends React.Component {
constructor(props) {
super(props);
this.state = {
emailAddress: '',
password: ... | true |
c00f58d2677cf26caaeadad372cc29aa0b7fe1e0 | JavaScript | halkim44/react-my-library | /src/components/modal.js | UTF-8 | 3,754 | 2.953125 | 3 | [] | no_license | import React from 'react';
import './modal.css';
class Modal extends React.Component {
constructor(props) {
super(props);
this.state = ({
show: false
})
}
componentDidMount() {
this.checkFormValidity();
}
checkFormValidity(){
let submitBtn = do... | true |
2165af4fd3c28ff7c887fca19d3742c9991b7227 | JavaScript | knightryder098/RNG | /myScript.js | UTF-8 | 251 | 3.28125 | 3 | [] | no_license | function Hello()
{
var number1 = document.getElementById("num1").value;
var number2 = document.getElementById("num2").value;
const ans=+Math.floor(Math.random()*(number2-number1))+ +number1;
document.getElementById("answer").innerHTML=ans;
}
| true |
8466bb3d796ce55346a6b67e5014d8fc8917d3d1 | JavaScript | leeboardtools/bythelee | /public_html/js/leeboard/sailsim-phaser/SailSimPhaserView.js | UTF-8 | 18,015 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | /*
* Copyright 2017 Albert Santos.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agree... | true |
0bffb3d283adaea84c900bd130e428c231e4ea0e | JavaScript | MarcoOrtizHdz/Web-Development | /ClassExercises/NodeJS Examples/02-Arguments/arguments.js | UTF-8 | 418 | 3.6875 | 4 | [] | no_license | // process.argv will print out any command line arguments.
// process.argv nos regresará un arreglo
// la posición 0 es en dónde está instalado nodejs
// la posición 1 es en dónde está el archivo que se está ejecutando
// node .\arguments.js 1999 "Esto es una prueba" "Agosto" 2021
console.log(process.argv); // Regres... | true |
c258a6916ef891144ae22821bb41350e302b1728 | JavaScript | tassiotfc/web-moderno-js | /exercicios/fundamentos, controle e funcao/28 - imprimirParesEImpardeVetor.js | UTF-8 | 301 | 3.65625 | 4 | [
"MIT"
] | permissive | const vetor = [1, 2, 3, 4, 5, 6, 7, 8]
let qtdPares = 0
let qtdImpar = 0
for (let i = 0; i < vetor.length; i++) {
if (vetor[i] % 2 === 0) {
qtdPares++
} else {
qtdImpar++
}
}
console.log('Qtd valores pares: ', qtdPares, '- Qtd valores ímpares: ', qtdImpar) | true |
865cc38738fa520352bb5221286cd11df3b26fca | JavaScript | jusbrasil/graysql | /extensions/load-from-dir/index.js | UTF-8 | 1,074 | 2.71875 | 3 | [
"MIT"
] | permissive | 'use strict';
const fs = require('fs');
const path = require('path');
function _loadInterfaces(ifacesDir, overwrite) {
try {
fs.readdirSync(ifacesDir)
.map(filename => require(`${ifacesDir}/${filename}`))
.map(iface => this.registerInterface(iface, overwrite));
}
catch (err) {
console.warn(... | true |
ec0eaf3403d147ce29c28ea886856121db29d9e4 | JavaScript | cchalla1/health-app123 | /src/graph.js | UTF-8 | 3,548 | 2.84375 | 3 | [] | no_license | import React, { useEffect, useRef } from 'react';
import * as d3 from 'd3';
import { PanZoom } from 'react-easy-panzoom'
function Graph(props) {
const graph = useRef(null);
useEffect(() => {
initGraph();
});
function zoom(event, svg) {
svg.attr("transform", "translate("
+ event.translate
... | true |
f2ae8c739c9d5e7f62ce674b1a7789e3140e2f04 | JavaScript | kevinstonge/DOM-II | /stretch-assignment/index.js | UTF-8 | 3,418 | 3.15625 | 3 | [] | no_license | class Block {
constructor(props) {
this.el = props.el;
this.pos = props.pos;
this.el.style.top = `calc(${this.pos}*5rem + ${this.pos}*0.5rem)`
this.el.style.transition = `top 1s`;
this.el.style.fontSize = `2rem`;
this.el.innerText = characters[this.pos];
this.... | true |
742b84b496d9e0e2a3af0e120090633d5a761db3 | JavaScript | pujyajain/pro-36 | /food.js | UTF-8 | 752 | 2.859375 | 3 | [] | no_license | class Food {
constructor(){
this.foodStock = ("7")
this.image = loadImage("images/Milk.png");
// this.lastfed;
}
updatefoodStock (foodStock){
this.foodStock=foodStock
}
//getfedTime (lastfed){
// this.lastfed=lastfed
//}
dedutfood (){
if(this.foodStock... | true |
4a19d310f24994b6692658e369e460ce514f0fb7 | JavaScript | tamsay/Background-Generator | /script.js | UTF-8 | 1,652 | 3.125 | 3 | [] | no_license | let css = document.querySelector("h3");
let color1 = document.querySelector("#picker1");
let color2 = document.querySelector("#picker2");
let body = document.getElementById("mainBody");
// let gradientType = document.querySelector("#linear input")
let typeSelector = ()=>{
let directionLinear = [...document.querySe... | true |
b0709c03d2d6e57814dcc472a54cc312560ede82 | JavaScript | jacksonmsantana1/BaseWebComponent | /app/components/Base/Base.test.js | UTF-8 | 606 | 2.578125 | 3 | [] | no_license | import chai from 'expect.js';
import Base from './Base.js';
describe('Component: Base =>', () => {
it('Should show a welcoming phrase', () => {
let component = document.createElement('pw-base');
component.id = 'nathan';
document.body.appendChild(component);
let shadow = document.getElementById('nat... | true |