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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
a6130067277fc1fc8b74bcb13d5292d8761c7935 | JavaScript | shuradrozd/react-proj | /src/containers/App.js | UTF-8 | 2,272 | 2.953125 | 3 | [] | no_license | import React, { Component } from 'react';
import classes from './App.css';
import Person from '../components/Persons/Person/Person';
// import ErrorBoundary from './ErrorBoundary/ErrorBoundary';
export default class App extends Component {
magicCount = 100;
state = {
persons: [
{name: 'Alex', age: 26... | true |
efee8198f4f53c93de54ac38439a6c630e0bd4ed | JavaScript | HDKHALILI/JS101-small-problems | /list_processing/sum_of_sums.js | UTF-8 | 908 | 4.96875 | 5 | [] | no_license | // Sum of Sums
// Write a function that takes an array of numbers, and returns the sum of the
// sums of each leading subsequence for that array. You may assume that the
// array always contains at least one number.
// Examples:
// sumOfSums([3, 5, 2]); // (3) + (3 + 5) + (3 + 5 + 2) --> 21
// sumOfSums([1, 5... | true |
ea74be47d89ab968246d2666462514766ff120a3 | JavaScript | anefsky/snake-game-old | /src/components/Snake.js | UTF-8 | 1,640 | 3.265625 | 3 | [] | no_license | import { ScreenObject } from './ScreenObject.js';
import { Utils } from './Utils.js';
class Snake extends ScreenObject {
constructor(boardSize) {
super(boardSize);
this.cells= [];
this.addRandomCell();
this.direction = null;
}
setDirection(newDirection) {
const oldDirection = this.direction;... | true |
79e3ff7447e01ef02e029a878e77f7096aaa1ce6 | JavaScript | AaiiNa/furit-shop | /shop.js | UTF-8 | 1,538 | 3.265625 | 3 | [] | no_license | let total = 0;
let balance = 0;
let priceApple = 10;
let qnApple = 0;
let tbudget = document.getElementById("budget");
budget = parseInt(tbudget.value);
balance = budget;
let showBalance = document.getElementById("balance");
showBalance.innerHTML = balance;
document.getElementById("total").innerH... | true |
734b4858109fd337203ce58bf290f52737d0f442 | JavaScript | maurocampos98/CursoIngresoJS | /9-Parciales/2018_1Cuatri_Recu_fuentes/siete.js | UTF-8 | 757 | 3.25 | 3 | [] | no_license | function mostrar()
{
var nota;
var edad;
var sexo;
var cont=0;
var acumNota=0;
var promedioNota;
while(cont<5)
{
nota=prompt("Ingrese la nota:");
nota=parseInt(nota);
while(nota<0 || nota>10)
{
nota=prompt("Los datos ingresados no son correctos, intente nuevame... | true |
747242d8f443d147ac2fa2d93e5c3e7f1ffddff6 | JavaScript | ganeshkumar269/node-server | /routes/login.js | UTF-8 | 1,855 | 2.5625 | 3 | [] | no_license | //importing packages
require('module-alias/register')
var bodyParser = require('body-parser');
var jwt = require('jsonwebtoken');
//importing custom files
var userExists = require('@userExists');
var authenticateUser = require("@authenticateUser")
var getUserInfo = require('@getUserInfo')
//declaring app variables
... | true |
8164321fe646be7f4b43b38d82973ab14673ae43 | JavaScript | brsanjita/Project_Radiance_CEC | /RadianceProject/static/js/main-tool-js/decision-support/during-event.js | UTF-8 | 5,173 | 2.546875 | 3 | [] | no_license | /**
* Copyright © Prof. Anurag Srivastava, Gowtham Kandaperumal, Linli Jia, and Dr. Sanjeev Pannala.
* No image or information should be reproduced, transmitted, or copied without the prior agreement with Prof. Srivastava.
*/
//Decision During Map
var decision_during_map = L.map('decision-during-mapid').setView([60.... | true |
e38b25ba2383d242718289b425713bcf1490027d | JavaScript | getconversio/object-ops | /lib/objectOps.js | UTF-8 | 3,993 | 3.546875 | 4 | [
"MIT"
] | permissive | 'use strict';
/**
* @private
*
* Gets or sets a possibly nested value on an object. Accepts an object and a
* string path (eg: 'a.b.c') and applies it to the object.
*
* If given a third argument, that value is set at the given path.
*
* When getting, expects all depths in path to exist. When setting, will cre... | true |
af2059f34071535b0fa7687d63921e76c1a4046b | JavaScript | arangodb/arangodb | /3rdParty/V8/v7.9.317/test/mjsunit/compiler/inline-accessors2.js | UTF-8 | 11,946 | 2.640625 | 3 | [
"Apache-2.0",
"BSD-3-Clause",
"ICU",
"Zlib",
"GPL-1.0-or-later",
"OpenSSL",
"ISC",
"LicenseRef-scancode-gutenberg-2020",
"MIT",
"GPL-2.0-only",
"CC0-1.0",
"BSL-1.0",
"LicenseRef-scancode-autoconf-simple-exception",
"LicenseRef-scancode-pcre",
"Bison-exception-2.2",
"LicenseRef-scancode... | permissive | // Copyright 2012 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of ... | true |
aface6fce6d807557eeb8e7141c5efc4065f3481 | JavaScript | corymharper/object-oriented-tasklister-lite-houston-web-career-021819 | /src/taskList.js | UTF-8 | 350 | 2.8125 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | class TaskList {
constructor(){
this.items = TaskListItem.all
};
render(){
const ul = document.createElement("ul")
this.items.forEach(function(taskListItem, i){
let li = ul.appendChild(taskListItem.description)
removeButton(ul, i)
prioritySelection(li, taskListItem)
})
priorityS... | true |
65e4b66030ba86b77ba594f2dcf3f74de25bfd62 | JavaScript | peachpellen/titanium-first-steps | /Resources/app.js | UTF-8 | 880 | 2.921875 | 3 | [
"Apache-2.0"
] | permissive | // Hide the status bar
Titanium.UI.iPhone.hideStatusBar()
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor("#f00");
// create a new window called "screen1" and make the background color light blue
var screen1 = Titanium.UI.createWindow(... | true |
29581401a007b04d5d21704cc3709e93da061821 | JavaScript | Classactg/fsw-105 | /week3/pNp-buildingJSfunctionsToKeepCode/project-JavaScriptLoops.nestingLoops/buildingJSfunctionsToKeepCodeAssignment.js | UTF-8 | 1,243 | 3.375 | 3 | [] | no_license | var officeItems = ["stapler", "monitor", "computer", "desk", "lamp", "computer", "lamp", "stapler", "computer", "computer"]
var count = 0
for (var i = 0; i < officeItems.length; i++){
if (officeItems[i] === "computer"){
count++
}
}
console.log(count) // -> 4
var peopleWhoWantToSeeMadMaxFuryRoad = [
{... | true |
93a7efcde409783a648614adb51327f6d6ae5e55 | JavaScript | impactlab/oeem-client | /dashboard/static/dashboard/js/src/histogram.js | UTF-8 | 5,393 | 3.109375 | 3 | [] | no_license | var histogram = {};
histogram.create = function(el, props, state) {
this._w = $(el).parent().width();
this._h = props.height;
var shape = this._shape();
var svg = d3.select(el).append('svg')
.attr('class', 'histogram')
.attr('width', shape.w)
.attr('height', shape.h);
var g = svg.append... | true |
621be134799530334d64089141ec87869bd1f4de | JavaScript | ywyhero/tools | /miniprogram/pages/historyToday/index.js | UTF-8 | 1,244 | 2.859375 | 3 | [] | no_license | Page({
data: {
lists: [],
date: ''
},
onLoad() {
wx.showNavigationBarLoading()
let date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1;
let day = date.getDate();
let week = date.getDay();
let weekVal = ''
... | true |
7caa72a007104dd7310f7af5114a0151a37bbcf3 | JavaScript | Duk4/Algorithms | /Sort-and-star/twoSort.js | UTF-8 | 251 | 3.40625 | 3 | [] | no_license | function twoSort(s) {
s.sort();
let f = s[0]; // first array element
// splitting the string to array of characters and then concatenating characters with 3 starts in-between them
return f.split('').join('***');
} | true |
cf35115d65b782fb1e6ff7d3fa79bcc064b42e1b | JavaScript | magicznyleszek/tdd | /test/romanizerSpec.js | UTF-8 | 1,638 | 2.921875 | 3 | [] | no_license | describe('Romanizer', () => {
const myRomanizer = new window.Romanizer();
// it('should know simple roman digits', () => {
// expect(myRomanizer.convert(1)).toEqual('I');
// expect(myRomanizer.convert(5)).toEqual('V');
// expect(myRomanizer.convert(10)).toEqual('X');
// expect(m... | true |
a289366f2513b3323b4e5c52ee4df9be598590df | JavaScript | JosephRhines/Readme-Generator | /Develop/index.js | UTF-8 | 1,621 | 3.25 | 3 | [] | no_license | // TODO: Include packages needed for this application
const inquirer = require('inquirer');
const fs = require('fs');
const generateMarkdown = require("./utils/generateMarkdown");
// TODO: Create an array of questions for user input
const questions = [
{
type: 'input',
message: 'What is the title of your project',
name... | true |
2ab71f42ed36ae979ce2a1ea70b70d783127fd9e | JavaScript | chromium/chromium | /third_party/google-closure-library/closure/goog/testing/style/style.js | UTF-8 | 2,431 | 2.625 | 3 | [
"BSD-3-Clause",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"GPL-1.0-or-later",
"MIT",
"LGPL-2.0-or-later"
] | permissive | /**
* @license
* Copyright The Closure Library Authors.
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @fileoverview Utilities for inspecting page layout. This is a port of
* http://go/layoutbot.java
* See {@link http://go/layouttesting}.
*/
goog.setTestOnly('goog.testing.style');
goog.provide('goog.t... | true |
47a59177c4893fb8c50326c6f311a5a4cb19e114 | JavaScript | ironhack-berlin-2018-october-ft/technical-interview-test-pokemon | /src/utils.js | UTF-8 | 164 | 2.765625 | 3 | [] | no_license | // To reuse this file
// import { capitalize } from '../path/to/utils.js'
export function capitalize(str) {
return str.charAt(0).toUpperCase() + str.substr(1);
} | true |
5c1bcac58ca2287b6138bf15184ca8effe0d9e6e | JavaScript | anujshankar/functional-javascript-workshop | /function-spies.js | UTF-8 | 393 | 2.625 | 3 | [] | no_license | function Spy(target, method) {
var spy = {
count: 0
}
var originalMethod = target[method];
target[method] = function() {
var argumentsArray = Array.prototype.slice.call(arguments);
spy.count++;
//return originalMethod.apply(target,argumentsArray);
return origin... | true |
c4853d1320604580ee7495c1ae63bb50676b8774 | JavaScript | pnykaza/examples | /examples/counter/counter.js | UTF-8 | 1,247 | 3.890625 | 4 | [] | no_license | function newCounter() {
var counter = {
value: 0,
increment: function(something) {
this.value += something
},
decrement: function(something) {
this.value -= something
},
resetCounter: function() {
this.value = 0
}
}
return counter
}
var c = newCounter()
var d = new... | true |
ecb508eebce8b4013b2ca357c4aea27dce302a23 | JavaScript | codiumsa/react-toolkit | /src/epics/datatable-params-constructor.js | UTF-8 | 857 | 2.5625 | 3 | [
"MIT"
] | permissive | /**
* Construye un objeto que contiene los params de filtrado, paginado y ordenamiento
* en el formato esperado por el persistent data parser.
*
* @param {Object} queryData - informacion de filtrado.
* @param {Object} pagerData - informacion de paginado.
* @param {Object} orderData - informacion de ordenamiento.
... | true |
28313c8e7adc4e23e2f4c58b266efc90d4f7517e | JavaScript | Ghussy/houser | /src/component/Wizard/Wizard.js | UTF-8 | 2,851 | 2.828125 | 3 | [] | no_license | import React, { Component } from 'react';
import { Link } from 'react-router-dom';
import './Wizard.css';
import axios from 'axios';
export default class Wizard extends Component {
constructor() {
super()
this.state = {
name: '',
address: '',
city: '',
... | true |
d20526672b8d393b3fcdec6ff1122a3924943ab2 | JavaScript | sadia110/SportsQuiz | /script.js | UTF-8 | 3,918 | 3.015625 | 3 | [] | no_license | // for next button
var nextButton = document.getElementById('btnNext');
// for quiz box
var quizbox = document.getElementById('questionBox')
// for options
var opt1 = document.getElementById('opt1')
var opt2 = document.getElementById('opt2')
var opt3 = document.getElementById('opt3')
var opt4 = document.getEleme... | true |
8e19416b1bd1db88d5b61ab9f846de783ceaeea4 | JavaScript | stevoland/grunt-es6-module-wrap-default | /tasks/es6_module_wrap_default.js | UTF-8 | 2,171 | 2.734375 | 3 | [
"MIT"
] | permissive | /*
* grunt-es6-module-wrap-default
* https://github.com/stevoland/grunt-es6-module-wrap-default
*
* Copyright (c) 2014 Stephen J. Collings
* Licensed under the MIT license.
*/
'use strict';
var path = require('path');
module.exports = function (grunt) {
grunt.registerMultiTask('es6_module_wrap_default', 'Wr... | true |
32f7f2774484347eaad76b15abd0f7e98a40ab5c | JavaScript | joebegley15/opensponsorship_code_exam | /routes/athletes.js | UTF-8 | 1,782 | 2.515625 | 3 | [] | no_license | var express = require('express');
var router = express.Router();
var mongojs = require('mongojs');
var db = mongojs('mongodb://joe:pa$$word@ds241019.mlab.com:41019/jb_sports_db')
//Get All Athletes
router.get('/athletes', function(req,res,next){
db.athletes.find(function(err,athletes){
if(err){
res.send(err);
... | true |
73f416fc0b4c966b2bf411d2bfa6e170219fdcda | JavaScript | daoos/plat-manager-pc | /src/utils/manager.js | UTF-8 | 6,906 | 2.6875 | 3 | [] | no_license | import _ from 'lodash'
import request from './request'
import { Message } from 'element-ui'
import utils from './utils'
export default class HelpService {
static getForm(form) {
return new Form(form)
}
static getReport(report) {
return new Report(report)
}
static utils = utils
static ajax = reques... | true |
26b8789bcbbf4c2968a11b419e17dc207978d093 | JavaScript | nonmanifold/dijkstra-shortest-path | /tests.js | UTF-8 | 496 | 2.890625 | 3 | [] | no_license | const dijkstra = require('./dijkstra');
const findDistances = dijkstra.findDistances;
const assert = require('assert');
function getGraph() {
const verticies = [
"1 2,1 3,4",
"2 1,1 3,2 4,6",
"3 2,2 1,4, 4,3",
"4 2,6 3,3"
];
var nodes = {};
verticies.forEach(function (lin... | true |
9a8f29bcfb0637888d71108cf37c0ab8822bfc66 | JavaScript | louis1001/sym_cargas | /field.js | UTF-8 | 1,036 | 2.96875 | 3 | [] | no_license | class ParticleField {
constructor(initials = {}) {
this.charges = initials
}
addCharge(name, chr) {
this.charges[name] = chr
return chr
}
calculateForce(name) {
const mainCharge = this.charges[name]
if (!mainCharge) return -1
this.everyCharge((other_charge, n) => {
if (n == name) return
... | true |
c8f97c02837c275c4b2e2a5c939ad34636f52e7c | JavaScript | toneil/parliament-corpus | /metadata/filters.js | UTF-8 | 1,074 | 2.796875 | 3 | [] | no_license |
/*
* Returns a function that will return true iff {speech} was held before {upToOptional}
* {upToOptional} may be null.
*/
const notAfter = upToOptional =>
speech => {
const upTo = !!upToOptional ? new Date(upToOptional) : new Date();
const speechDate = new Date(speech.date);
return upTo... | true |
9794a545919240e02b1ae02124367dbca4033f9c | JavaScript | mahabub998/Es6-parictis | /template.js | UTF-8 | 406 | 3.390625 | 3 | [] | no_license | const fristName = "jastin"
lastName = "timberLake"
// fullname=fristName+ " "+lastName + "is a good boy";
fullname2 = `${fristName} ${20 + 100} is good boy .`;
console.log(fullname2);
// const maltilai="i love you /n"
// +" i haye yopu /n"
// +"guya mara you"
// console.log(maltilai)
const maltilaine = ... | true |
b1ab94ab9423b2fa91d893e64ed782c1aa736305 | JavaScript | sahashra78/QuickGames | /quickgames/src/Components/MathGenius.js | UTF-8 | 6,064 | 2.96875 | 3 | [] | no_license | import React, { useEffect, useState, useReducer } from 'react'
import { Link } from 'react-router-dom'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
function MathGenius() {
const [popUp, setPopUp] = useState(false);
const [firstVariable, setFirstVariable] = useState(null);
const [secon... | true |
d996c682055d4f0aece87a5c7add6b4ca7829ac2 | JavaScript | pokle/grep-bench | /node/harness.js | UTF-8 | 544 | 2.828125 | 3 | [] | no_license |
module.exports = function run(callback) {
if (process.argv.length < 3) {
console.error("usage: " + process.argv[0] + " TERM Files...");
process.exit(1);
}
process.stdout.bufferSize = 1024
var term = process.argv[2]
var files = process.argv.slice(3)
var grep = function grep(li... | true |
ea640ecde8e688ef00e5950241a4c16424999f4a | JavaScript | mklabs/blog.mklog.fr | /assets/img/js-oo-et-manipulation-prototype-via-call-apply/basic-oo.js | UTF-8 | 128 | 3.28125 | 3 | [] | no_license | var Citizen = function Citizen(name){
this.name = name;
};
var george = new Citizen('Abitbol');
george.name
// > "Abitbol" | true |
594065c729486632d873bc0d739ad13b3a7f0c7e | JavaScript | giorgimode/webdev-bootcamp | /chapter-8-js/todo.js | UTF-8 | 333 | 3.59375 | 4 | [] | no_license | var input = ask();
var todos = ["el1"];
while (input !== "quit") {
if (input === "list") {
console.log(todos);
} else if (input === "new") {
todos.push(prompt("Enter new item"));
}
input = ask();
}
console.log("YOU QUIT THE APP.");
function ask() {
return prompt("what do you want ... | true |
454b97486879c74ebb8b6376d991e4ff102d96eb | JavaScript | zvictor/meteor-issue-536 | /client/client.js | UTF-8 | 539 | 2.609375 | 3 | [] | no_license |
Meteor.subscribe("observer");
Meteor.subscribe("mycolletion");
Meteor.startup(function(){
$("body").append("<button>click me</button>");
$("button").click(function() {
//each click add or change (and then remove) an entry, alternately.
var entry = MyCollection.findOne();
if(entry){
//change
... | true |
41a242170171ec058b419b163fa8fffeee886903 | JavaScript | lanamaxic/JS-Exercise | /TASK_LIST/Step-2/app.js | UTF-8 | 5,629 | 3.640625 | 4 | [] | no_license | //Define UI Variables
const form = document.querySelector('#task-form')
const taskList = document.querySelector('.collection')
const clearBtn = document.querySelector('.clear-tasks')
const filter = document.querySelector('#filter')
const taskInput = document.querySelector('#task')
// console.log(form, taskInput, clear... | true |
3efc1d2a3b3f0204f854e95efd14ef5c0d39b6a7 | JavaScript | js-tasks-ru/jsbasic-20200727_anna409 | /4-module/3-task/index.js | UTF-8 | 1,105 | 3.421875 | 3 | [] | no_license | /**
* Метод устанавливает необходимые по условию аттрибуты таблице
* @param {Element} table
*/
function highlight(table) {
let tbodyElement = table.querySelector('tbody');
let trElements = tbodyElement.querySelectorAll('tr');
for (let trElement of trElements) {
let tdElements = trElement.querySel... | true |
d97454eac335e9280715c4e99c9b41c528f28607 | JavaScript | PrawiraGenestonlia/anti-coronavirus-backend | /api/preventions.api.js | UTF-8 | 1,127 | 2.8125 | 3 | [] | no_license | const path = require('path');
const fs = require('fs');
class Preventions {
async walkSync(dir, filelist) {
var self = this; // Get a reference to your object.
let files = fs.readdirSync(dir);
filelist = filelist || {};
files.forEach(async function (file) {
if (fs.statSync(path.join(dir, file))... | true |
2faa0bc6ea153758a3f2c72c92c0f0fc9a821fcf | JavaScript | chappy1138/bootcamp | /lib/formattedPrice.js | UTF-8 | 747 | 2.6875 | 3 | [] | no_license | define(['handlebars'], function (Handlebars) {
Handlebars.registerHelper('formattedPrice', function (priceValue) {
var html
= '<span class="tvFinderUsDollars">'
+ dollars(priceValue)
+ '</span><span class="tvFinderUsCents">'
+ cents(pri... | true |
a65b4db7b50637d0c06362a8d0fe8f74408ecedf | JavaScript | sahir2008/Infinite-Scroll-Gallery | /client/src/components/Images.js | UTF-8 | 1,189 | 2.53125 | 3 | [] | no_license | import React, { useState, useEffect } from 'react';
import axios from "axios";
import InfiniteScroll from "react-infinite-scroll-component";
import Image from "./Image";
function Images() {
const [images, setImages] = useState({
count: 30,
start: 1,
photos: []
});
useEffect(() => ... | true |
839d587fd721b1a4f9b6b3c3464b4f169197fe3e | JavaScript | Reid-Finn/Dinder_frontend | /src/Components/Register.js | UTF-8 | 1,795 | 2.65625 | 3 | [] | no_license | import React, {SyntheticEvent, useState} from 'react';
import { Redirect } from 'react-router-dom';
const Register = () => {
const[username, setUsername] = useState('');
const[person1name, setPerson1Name] = useState('');
const[person2name, setPerson2Name] = useState('');
const[city, setCity] = useState(''... | true |
52298a43902e26262a11ef3a1f64a20cfcde76b4 | JavaScript | yayobyte/burger-app | /src/store/reducers/burgerBuilder.reducer.js | UTF-8 | 2,912 | 2.578125 | 3 | [] | no_license | import * as actionTypes from '../actions/actionTypes.actions';
const {
PURCHASE_BURGER_FAIL,
PURCHASE_BURGER_SUCCESS,
PURCHASE_BURGER_REQUEST,
ADD_INGREDIENT,
REMOVE_INGREDIENT,
GET_INGREDIENTS_REQUEST,
GET_INGREDIENTS_SUCCESS,
GET_INGREDIENTS_FAIL,
} = actionTypes;
const initialState=... | true |
3190c9446e8ee92287a1308a1e24d9d0b85464bd | JavaScript | Ayonijakaushik19/Dictu-Playground | /backend/routes/execute.js | UTF-8 | 1,190 | 2.53125 | 3 | [
"MIT"
] | permissive | const express = require('express');
let router = express.Router();
const fs = require('fs');
const path = require('path');
const { spawn } = require('child_process');
const { v1: uuidv1 } = require('uuid');
router.post('/', function(req, res, next) {
const reqObj = req.body;
console.log(reqObj);
const temp... | true |
a55170bb7a9aa12d648095e8589fce08d7192d7b | JavaScript | qwe917102/React_Blog | /resources/js/src/reducers/member.js | UTF-8 | 895 | 2.515625 | 3 | [] | no_license | import { redirect } from '../utility/global';
const initstate = {
userToken: '',
memberInfo: {},
}
export function memberState(state = initstate, action) {
state = JSON.parse(JSON.stringify(state));
switch (action.type) {
case 'SUBMIT_REGISTER_FORM': {
redirect('/register-success');
return sta... | true |
c1616d00b478bdd4a2b637ab91ffa1e1a15311b1 | JavaScript | xezian/wonderful-box | /assets/js/javascript.js | UTF-8 | 1,962 | 2.890625 | 3 | [] | no_license | var canvas = document.getElementById("myCanvas");
var ctx = canvas.getContext('2d');
var cw = canvas.width;
var ch = canvas.height;
var canvases = document.getElementsByClassName("myCanvas");
for (var i = 0; i < canvases.length; i++) {
canvases[i].onclick = function(e) {
var oldcan = document.getElementById("myCanv... | true |
74e967c0117fc22622bafedf2e1cd9a803f7e4cc | JavaScript | yaoguozhi/react-template | /src/utils/T/core/auth.js | UTF-8 | 1,994 | 2.53125 | 3 | [] | no_license | import cookiesUtil from 'js-cookie';
import queryString from 'query-string';
import _ from 'lodash';
import * as store from './storage';
const EnumLoginInfoKey = '__login_info__';
class Auth {
constructor() {
// 登录成功的cookie key
this.loginSuccessCookieKey = window.ENV.login.cookieKey;
}
/... | true |
2af1c53894a1bbe5b1c4bc0fc61a5adb259f6ea5 | JavaScript | berkozturk97/Blog | /src/API/blogApi.js | UTF-8 | 1,211 | 2.5625 | 3 | [] | no_license | import axios from 'axios';
//Add blog
export const addBlog = ({body=null}) => {
return new Promise((resolve, reject) => {
let REQUEST_URL = "https://filterio.herokuapp.com/blogPackage/addBlog";
axios.post(REQUEST_URL,body)
.then((response) => {
resolve(response.data)
... | true |
d4cf2a3d2d287c3fc435d3f642e38832ed85b9c1 | JavaScript | Bhashitha1428/Webis-Original-backend | /Controllers/userController.js | UTF-8 | 4,900 | 2.65625 | 3 | [] | no_license | const bcrypt=require('bcryptjs');
const config = require('../config/database');
const User=require('../models/user');
const crypto = require('crypto');
function getUserById (id, callback){
User.findById(id, callback);
}
function getUserByEmail (email, callback){
const query = {email: email}
User.findOn... | true |
d2238fb12ec0863189403c3a3567e90e566e33a3 | JavaScript | xiaojimao18/leetcode | /251-300/283-Move Zeroes.js | UTF-8 | 425 | 3.4375 | 3 | [] | no_license | /**
* @param {number[]} nums
* @return {void} Do not return anything, modify nums in-place instead.
*/
var moveZeroes = function(nums) {
let zeroP = 0;
for (let i = 0, len = nums.length; i < len; i ++) {
if (nums[i] !== 0) {
nums[zeroP ++] = nums[i];
}
}
for (let i = zeroP, len = nums.length; i... | true |
20003e7ba1b328be526ea932a51b95287e34761a | JavaScript | bschug/poedit | /js/urlArgs.js | UTF-8 | 1,996 | 2.859375 | 3 | [] | no_license | function UrlArgs() {
this.codePastebin = new Pastebin();
this.itemsPastebin = new Pastebin();
this.hasCodePastebin = function() {
// If we already know that the code pastebin id is invalid, we treat it as not having one.
if (this.codePastebin.status === 'Error') {
return false;
... | true |
9db452665bb1ad8b672a7f8e716a1d9e6bae2254 | JavaScript | Code-Institute-Submissions/TWCoulsdon | /static/js/messages.js | UTF-8 | 1,192 | 3.296875 | 3 | [
"MIT"
] | permissive | /*
* Provides code to show and hide information messages
*/
// Shows any messages on page load
$( document ).ready(function() {
$( '.message' ).each(function() {
const current = $( this );
const timeout = current.data('timeout');
current.addClass('show');
if (timeout) setTimeout(() => closeMessage(c... | true |
d3019f68267fd81f7afa75784f60be9a5867590f | JavaScript | JethroGibbsN/BuildIT | /Server/controllers/question.controller.js | UTF-8 | 21,131 | 2.5625 | 3 | [] | no_license | const Question = require("../models/question.model.js");
const inarray = require("inarray");
const xlsx = require("xlsx");
// const Base64 = require('js-base64').Base64;
// Create and Save a new question
exports.create = (req, res) => {
// Validate request
if (!req.body.questionName) {
return res.status(400).s... | true |
9e2523d8384d8f42147e8958d9ddc24e728d353f | JavaScript | sabina929/character_app | /src/forms/AddCharacter.js | UTF-8 | 6,596 | 2.5625 | 3 | [] | no_license | import React, { Component } from 'react';
import './AddCharacter.css';
import posed from "react-pose";
import CharacterConsumer from "../context";
import axios from "axios";
// https://my-json-server.typicode.com/sabina929/character-json-server/characters
const Animation = posed.div({
visible: {
opacity: 1,
... | true |
086e2aace9b9207c4a8cd288e288c9dc88b0241f | JavaScript | LexLoneWolf/DAW-2019-2020 | /DWEC/UT01/Ejercicios/JavaScript1/07.js | UTF-8 | 128 | 3.421875 | 3 | [] | no_license | let n = 0
let res = 0;
do {
n = parseInt(prompt("Introduzca número"));
res += n;
} while (n!=0);
document.write(res); | true |
aed0e9a228b9bf1cc971572fc482395fcb346db3 | JavaScript | gguaderrama/all_rh_ipsos_1 | /src/reducers/catalogs/paises.js | UTF-8 | 1,246 | 2.515625 | 3 | [] | no_license |
const initialState = {
menu: '',
paises: [],
alertPais: false,
countryById: [],
showAllPaisesEdit: []
}
const MenuAdmin = (state = initialState, action) => {
switch (action.type) {
case "CALL_MENU":
return {
...state,
menu: action.value
... | true |
807c51b772bc474af9cb37a035557c57453479ca | JavaScript | djoverbeatz29/scrabble | /src/components/Rack.js | UTF-8 | 1,555 | 2.765625 | 3 | [] | no_license | import { useState } from 'react';
import Tile from './Tile';
export default function Rack(props) {
const isVisible = props.isVisible;
const [rack, setRack] = useState(props.rack);
function shuffleRack() {
const N = rack.length;
const indices = [...Array(N).keys()];
for (l... | true |
5bcb58a7a690ff4aa2c0565361fbb04f3d3c7987 | JavaScript | ihh/bracery | /test/parser.js | UTF-8 | 1,971 | 2.515625 | 3 | [
"BSD-3-Clause"
] | permissive | var assert = require('assert')
var bracery = require('../index')
var initJson = { abc: 'def',
hello: '[hello|hi]',
world: ['world', 'planet'],
test1: 'testing',
test2: '~TEST1',
test3: 'x~test3',
test4: '"e{~TEST1... | true |
da860a7a4f2466956659c730e00454fd6b8c9d08 | JavaScript | Tejaswini-Ekkaldevi/JSExercises | /array-1/make2.js | UTF-8 | 626 | 4.3125 | 4 | [] | no_license | // 26> Array-1 -- make2
// Given 2 int arrays, a and b, return a new array length 2 containing, as much as will fit, the elements from a followed by the elements from b. The arrays may be any length, including 0, but there will be 2 or more elements available between the 2 arrays.
function make2(a, b){
let newArr ... | true |
0ba4fdede518c7e0506f069345bb682a34b21715 | JavaScript | btmash/feathers-js-tutorial | /public/client-original.js | UTF-8 | 515 | 2.78125 | 3 | [] | no_license | /* global io */
// Create a websocket connecting to our Feathers server
const socket = io('http://localhost:3030');
// Listen to new messages being created
socket.on('messages created', message =>
console.log('Someone created a message', message)
);
socket.emit('create', 'messages', {
text: 'Hello from socket'
}... | true |
4ee69e583b00be0569001de82d440cd5beba1dec | JavaScript | MaxBpn/WW1 | /app/components/movie-list.js | UTF-8 | 9,441 | 2.59375 | 3 | [] | no_license | if (!window.VueMovies) {
window.VueMovies = {};
}
window.VueMovies.movieList = {
data: function() {
return {
filterName: '',
filterGenre: '',
filterPlateformeDiffusion: '',
filterSalle: '',
filterNote: '',
movies:[],
};
... | true |
39bc2969974fde36af005c909d54f420b4c1ebf7 | JavaScript | EFanZh/efanzh.github.io | /projects/tab-pages/tab-pages.js | UTF-8 | 1,539 | 2.890625 | 3 | [] | no_license | document.addEventListener("DOMContentLoaded", function ()
{
"use strict";
function $(id)
{
return document.getElementById(id);
}
function tabs(tab_page_titles_children, tab_page_contents_children)
{
var current_tab_page = 0;
function set_page_selected(i, value)
... | true |
e2a3f74abe9eb2f036bd3754268ef6d00e100c41 | JavaScript | NYUAD-IM/Comm-Lab | /09_PaperJS/svg_handler.js | UTF-8 | 1,874 | 3.4375 | 3 | [
"Unlicense"
] | permissive | //first, we declare two variables, to keep track of our canvas
let canvas;
//and to keep track of our image
let myImage;
//here, we grab our <canvas> element from the index.html
canvas = document.getElementById('myCanvas');
//and we set its position and its dimensions
canvas.style.position = 'absolute';
canvas.style.... | true |
57b1e04aae4344ddda2198151a96d3c21eec0409 | JavaScript | drewferris/kata | /hacker_rank/javascript/algorithms/implementation/bon_appetit.js | UTF-8 | 629 | 3.109375 | 3 | [] | no_license | function processData(input) {
var split = input.split('\n');
var firstLine = split[0].split(' ').map(function(string) {
return Number(string);
});
var secondLine = split[1].split(' ').map(function(string) {
return Number(string);
});
var thirdLine = split[2].split(' ').map(function(string) {
ret... | true |
d22aa67ced2b21334a4134890db41912c5432749 | JavaScript | ceciliaGeraldo/SCL011-Social-Network | /src/assets/js/validation.js | UTF-8 | 1,167 | 2.78125 | 3 | [] | no_license | import {templateSendingMail} from '/assets/views/sendingEmail.js'
//Enviar mensaje de verificación al usuario
export const checkEmail = () =>{
let user = firebase.auth().currentUser;
user.sendEmailVerification().then(function() {
// Email sent.
console.log("enviando correo");
temp... | true |
ec4f88c22fcf2fc0f24a57d885ef0adf4ec5dd62 | JavaScript | b1ff/html-rewriter | /rewriters/labelRewriter.js | UTF-8 | 837 | 2.515625 | 3 | [
"MIT"
] | permissive | 'use strict';
const _ = require('lodash');
const TEXT_NODE = 3;
module.exports = {
template: '<label>${ text }</label>',
selector: 'form td',
process: function (tableCell, $, template) {
let processed = _.chain(tableCell.childNodes)
.filter((child) => child.nodeType === TEXT_NODE)
... | true |
4d7a17a4e8afc176d3b758f04d4e1283fefb0d96 | JavaScript | D4WKINS/M3-D8 | /home.js | UTF-8 | 1,717 | 2.71875 | 3 | [] | no_license | const endpoint = "https://striveschool-api.herokuapp.com/api/product/"
const products = document.getElementById("products")
window.onload = async () =>{
const getData = async () =>{
try{
const response = await fetch(endpoint,{
method: 'GET',
headers:{
'Conten... | true |
8dd7e96dac719172107f0ca31ba434fd8194d279 | JavaScript | jainmohit2001/NodeJs_Pratice_Projects | /project_2/routes/contact.js | UTF-8 | 1,412 | 2.6875 | 3 | [] | no_license | const express = require('express');
const router = express.Router(); //this helps us to modularise or in simple terms, make the code general
const nodeMailer = require('nodemailer'); //helps to use mailing system
/* GET users listing. */
router.get('/', (req, res, next) => { //on get method
res.render('contact', { t... | true |
d89c9084dbdc63484f6ba2fe2781856610f74de2 | JavaScript | hermsicle/DataStructure-Algorithms | /answers/linearSearch.js | UTF-8 | 1,707 | 4.40625 | 4 | [] | no_license | // function findElement(array, elementYourLookingFor) {
// for(let i = 0; i <= array.length; i++){
// if(array[i] == elementYourLookingFor) {
// return i
// }
// }
// }
// function findElement(array, element){
// let index = 0;
// for(const items of array) {
// if(it... | true |
59b557766ecf1df1563a91d0d88bffcb55892aaf | JavaScript | Jesman12/cible-escrime | /js/jeu.js | UTF-8 | 2,387 | 2.546875 | 3 | [] | no_license | var a = 0;
var b = 0;
var c = 0;
FIN = false;
function getRandomInt(max){
return Math.floor(Math.random() * Math.floor(max));
}
function MARATHON()
{
if(seg){
start();
document.getElementById('J_Marathon').disabled = true;
document.getElementById('J_Contrat').disabled = true;
document.getE... | true |
d0aa1abf96b73dbe38be4611b8f9aaa76b0920c2 | JavaScript | MSMD67/MSMD67.github.io | /week4/homework/99_bottles_DOM/99_bottles_hmwk/99.js | UTF-8 | 1,413 | 2.90625 | 3 | [] | no_license | function printLyrics() {
var line1 = " bottles of beer on the wall";
var line1s = " bottle of beer on the wall";
var line2 = " bottles of beer";
var line2s = " bottle of beer";
var line3 = " Take it down";
var line4 = " pass it around";
var last = " No bottles of beer on the wall";
for (counter... | true |
5d3006e055fa20965e95aa0112c7d176e6328e1e | JavaScript | klintzz/some-roguelike | /trial.js | UTF-8 | 6,549 | 3.25 | 3 | [] | no_license | // Create the canvas
var canvas = document.createElement("canvas");
var ctx = canvas.getContext("2d");
canvas.width = 512;
canvas.height = 480;
document.body.appendChild(canvas);
// Background image
var bgReady = false;
var bgImage = new Image();
bgImage.onload = function () {
bgReady = true;
};
bgImage.src = "image... | true |
9c4e64212fae8427f909c56df825842fd1aef524 | JavaScript | mjneil/CruftEngine | /cruft/net/Cache.js | UTF-8 | 995 | 2.78125 | 3 | [] | no_license | export default class Cache {
constructor() {
this.assets = {};
this.loaders = {};
}
register(loaders) {
for(var name in loaders){
this.loaders[name] = loaders[name];
}
}
get(path){
return new Promise((resolve, reject) => {
var assets = this.assets;
if(assets[path]!==undefined){
resolv... | true |
cb0a01b8541d14c7f86fcf9eb46b51f28bb7ea12 | JavaScript | omarsilvayepes/gestion-militar | /gestion-militar-front/src/application/actions/OperacionAction.js | UTF-8 | 1,003 | 2.625 | 3 | [] | no_license | import { GET_OPERACION, ADD_OPERACION, ADD_OPERACION_ERROR } from "../types/OperacionTypes";
import EndPointAxios from "../../infrastructure/services/api/axios";
export function operacionAction(){
return async (dispatch) =>{
const response = await EndPointAxios.get('/operacion');
dispatch(listarOpe... | true |
3da58332a5b19a6b6808056321fc9252cb268b3b | JavaScript | BorislavTserovski/JSFundamentals | /jQuery/formValidation.js | UTF-8 | 2,369 | 2.640625 | 3 | [] | no_license | function validate() {
let userNameRegex = /^[a-zA-Z0-9]{3,20}$/g
let passwordRegex = /^[\w]{5,15}$/g
let emailRegex = /(.)*[@](.)*\.(.)*/g
let confirmPasswordRegex = /^[\w]{5,15}$/g
console.log($('#companyNumber').val())
$('#submit').on('click', function (event) {
if (!userNameRegex.test... | true |
33bcbfe1120fd5a5829c620d245a3f26110bb40b | JavaScript | AndresFPerezG/JS-basico | /ciclos.js | UTF-8 | 690 | 4.28125 | 4 | [] | no_license | // Loop for
var estudiantes = ["carlos", "Andres", "Rosa", "Daniel"];
function saludarEstudiantes (estudiante){
console.log(`Hola, ${estudiante}`);
}
for (var i = 0; i < estudiantes.length; i++){ //estudiantes.length determina el # de estudiantes del array (4)
saludarEstudiantes(estudiantes[i]); //mi... | true |
bbc5970dc3913bb234df9b3a9dacf46bcb7e8185 | JavaScript | lvLokkie/codsen | /packages/charcode-is-valid-xml-name-character/test/validSecondCharOnwards.js | UTF-8 | 1,002 | 2.59375 | 3 | [
"MIT"
] | permissive | /* eslint no-unused-vars:0 */
import tap from "tap";
import {
isProduction4,
isProduction4a,
validFirstChar,
validSecondCharOnwards,
} from "../dist/charcode-is-valid-xml-name-character.esm.js";
// -----------------------------------------------------------------------------
// validSecondCharOnwards
// -----... | true |
5d437db6ffddd640809d699621a8635047985214 | JavaScript | dustinpfister/test_threejs | /views/forpost/threejs-camera/s2-1-orthographic/main.js | UTF-8 | 930 | 2.96875 | 3 | [] | no_license | //-------- ----------
// CAMERA
//-------- ----------
const left = -3.2,
right = 3.2,
top2 = 2.4,
bottom = -2.4,
near = 0.01,
far = 100,
camera = new THREE.OrthographicCamera(
left,
right,
top2,
bottom,
near,
far);
camera.position.set(2, 2, 2); // position camera
camera.l... | true |
aaa8877c8302399b4721edb01536ccf5d40929bc | JavaScript | freebz/RxJS-Programming | /Appendix A/exA-58.js | UTF-8 | 188 | 3.140625 | 3 | [] | no_license | // 코드 A-58 Promise.all을 사용한 비동기 작업 코드
Promise.all([async1(), async2(), async3()])
.then(result => console.log('작업의 결과는 %s, %s, %s', ...result));
| true |
9262b5a43e57eb608d45e4bf6f6fe6e37a48889b | JavaScript | mpodboreski/mpodboreski.github.io | /js/add-greeting.js | UTF-8 | 676 | 4.375 | 4 | [] | no_license | /*This script displays a greeting to the user based upon the current time.
It is an example implemented from the Javascript & jQuery book */
var today = new Date(); // Create a new date object
var hourNow = today.getHours(); // Find the current hour
var greeting;
//Display the appropriate greeting based on the curre... | true |
ec90397d17f903b227003f76f45c1a342621837a | JavaScript | bernardogava/bot_discord | /index.js | UTF-8 | 1,434 | 2.875 | 3 | [] | no_license | const Discord = require('discord.js')
const client = new Discord.Client()
const config = require('./config.json')
client.on('ready', () => {
//A função e ativada quando o bot e iniciado
console.log('Iniciando sistema')
console.log('Sistema iniciado')
})
client.on('guildMemberAdd', async member => {
// A funçã... | true |
20de651f44fd05f32c0171dc47b2585dadb31ad8 | JavaScript | acucciniello/the-muse-jobs | /intents/category-intent-function.js | UTF-8 | 1,439 | 2.75 | 3 | [
"MIT"
] | permissive | var getJobsData = require('../helpers/get-jobs-data.js')
var formatOutput = require('../helpers/format-output.js')
var formatURL = require('../helpers/format-url.js')
module.exports = CategoryIntentFunction
// Purpose: To find the top 5 newest job postings on themuse.com based on category
// param (in): intent: given... | true |
0d08d977df2037b5c35f0fc23e9c42f632794961 | JavaScript | anfepar/starwars-planets-search | /src/frontend/utils/jsonUtilities.js | UTF-8 | 2,066 | 3.046875 | 3 | [] | no_license | import ORDER_TYPES from "../constants/orderTypes";
export function getAttributeValues(jsonArray, attributeName, splitBy = false) {
const reducer = (accumulator, currentValue) => {
let attributeValues = currentValue[attributeName];
let result = accumulator;
if (attributeValues) {
if (splitBy) {
... | true |
a99a74a387121536f3c44e63d94e9be940e8930e | JavaScript | BillyOsvaldo/e-presensi_backend | /src/helpers/utils.js | UTF-8 | 2,406 | 2.90625 | 3 | [
"MIT"
] | permissive | const moment = require('moment-timezone')
moment.tz.setDefault('Asia/Jakarta')
module.exports.getFullName = (docProfile) => {
if(!docProfile.name) return ''
let name = docProfile.name
var firstTitle
if(name.first_title) {
firstTitle = name.first_title + '. '
} else {
firstTitle = ''
}
var last... | true |
06116f7cf233bcc93f96bfe939a362d989230843 | JavaScript | edcarstens/JugglePro | /src/props/Ball.js | UTF-8 | 4,465 | 3.0625 | 3 | [
"MIT"
] | permissive | /**
* @author Ed Carstens
*/
/**
* A Ball extends Prop, having a list of sprites associated
* with it for drawing the ball in the animation.
*
* @class Ball
* @extends Prop
* @constructor
* @param viewer {Viewer} the viewer object
* @param pos {Vec} optional initial position
* @param color {Number} 24-bit R... | true |
23d29b48ac2291a22626b07acba7f9631ca499b6 | JavaScript | Tdunc/RockPaperScissors-TOP | /app.js | UTF-8 | 4,979 | 3.796875 | 4 | [] | no_license | let userScore = 0;
let computerScore = 0;
const userScore_span = document.getElementById("user-score");
const computerScore_span = document.getElementById("computer-score");
const scoreBoard_div = document.querySelector(".score-board");
const result_p = document.querySelector(".result > p");
const rock_div = docu... | true |
37b4ecd21822159367f4adc1c34824131b820ae5 | JavaScript | green-fox-academy/berentez | /week-13/day-01/sith-reverser/app.js | UTF-8 | 1,552 | 3.3125 | 3 | [] | no_license | const express = require('express');
const app = express();
const PORT = 3000;
app.use(express.json());
app.post('/sith', (req, res) => {
const { text } = req.body;
const fillerList = ['Arrgh', 'Uhmm', 'Err..err.err', 'Mmgh', 'Stop it now', 'SEAGULLS']
const arrgh = function() {
const randomIndex ... | true |
0e0f8510dd25bd873cf4572ccc5ddc25852beeea | JavaScript | FOC96/paperPlanes | /funciones.js | UTF-8 | 6,379 | 2.65625 | 3 | [] | no_license | /* Del inicio de sesión al registro */
function irARegistro(){
document.getElementById('inicio').style.transition="1s all";
document.getElementById('inicio').classList.remove('medio');
document.getElementById('inicio').classList.add('arriba');
document.getElementById('registro').style.transition="1... | true |
58e26dc2980e577243b242e0d391a76ff31a1265 | JavaScript | jguidry/SEE_2017_RFID_Pathways | /Terminal/sally-ride/js/question-biologist.js | UTF-8 | 948 | 2.90625 | 3 | [
"MIT"
] | permissive | /*
* File Name: question-biologist.js
* Author(s): Bryle Castro
* Date: 7 September 2017
* Description: Contains the questions and answer option to be used in the quiz
* for this pathway.
*/
var questions = [{
"question":"What does ROV stand for?",
"option1": "Remotely Ordering Vehicles",
"option2": "Remotely Oper... | true |
d528b8549a701f1ebe5b790fa9bc7b8c7fac1630 | JavaScript | entrptaher/monorepo-example-lerna-parcel-mobx | /packages/react-mobx/stores/Title.js | UTF-8 | 440 | 2.78125 | 3 | [] | no_license | import autobind from "react-autobind";
import { observable, action } from "mobx";
// prepare our store (to store the data)
class Store {
constructor() {
// no more arrow functions everywhere
autobind(this);
}
// look out for title to be updated
@observable title = "Hello Mobx";
@action
updateTitl... | true |
f6404f9added43757324013d2aff893c37d66287 | JavaScript | nss-day-cohort-41/nutshell-my-pretty-rose-tree | /src/scripts/Task/taskToDom.js | UTF-8 | 573 | 3.109375 | 3 | [] | no_license | // this is printing thing to the dom
// there is a checkbox and and a remove button
const makeTaskComponent = (taskList) => {
const taskHTMLRepresentation = `<div class="taskItem">
Task: ${taskList.tasks}<br>
Compeletion Date: ${taskList.date}<br>
UserID: ${taskList.userId}
<div>
<input ty... | true |
84044f22756c7db46ac1569066fe3e8bf87615df | JavaScript | rabid-fish/JSPilot | /test/util/CommonUtilTest.js | UTF-8 | 595 | 2.828125 | 3 | [] | no_license |
function HtmlMessageAppenderTest() {
var appender = new HtmlMessageAppender(null, 2);
test(appender.getMessageCount() == 0, 'messages array starts empty');
appender.append('test1');
appender.append('test2');
test(appender.getMessageCount() == 2, 'messages array has two values');
appender.append('test3');... | true |
85278383b65e89114c0f4ad658e2ce9f193e25d1 | JavaScript | liuyangjiayou/houseBook | /server/server.js | UTF-8 | 1,280 | 2.578125 | 3 | [] | no_license | let fs = require('fs');
let path = require('path');
let dirname = path.resolve();
['mkdir','rmdir','readdir','readFile','copyFile','unlink'].forEach(item=>{
exports[item] = function(pathname,copypath = ''){
pathname = path.resolve(dirname,pathname);
copypath = path.resolve(dirname,copypath);
... | true |
5a1d1f2e1683854c72080c6cc26c1f4de7be5579 | JavaScript | stephaniedeleon/site_life_tracker | /api/models/nutrition.js | UTF-8 | 2,468 | 2.96875 | 3 | [] | no_license | const db = require("../db");
const { BadRequestError } = require("../utils/errors");
class Nutrition {
/** Fetch all nutritions */
static async listNutritionForUser(user) {
//return all orders that the authenticated user has created
const query = `
SELECT * FROM nutritions
... | true |
3c83629f02f39cbe8701cb7aa2d99821f520225c | JavaScript | hydraChaosu/myTasksFromExercism | /clock/a.js | UTF-8 | 295 | 3.515625 | 4 | [] | no_license | const min = 0;
const max = 100;
function showOdd(min = 0, max = 100) {
if (min % 2 === 1) {
for (let i = min; i <= max; i = i + 2) {
console.log(i);
}
} else {
for (let i = min + 1; i <= max; i = i + 2) {
console.log(i);
}
}
}
showOdd(1, 100);
showOdd(0, 100);
| true |
c9e80cf809ff117484d7ebcbcbd8cf434ac822f6 | JavaScript | EmiliaPavlova/Telerik-Academy | /JavaScriptFundamentals_June2016/Homeworks/11. Strings/03. Sub-string in text/03.SubStringInText.js | UTF-8 | 490 | 3.28125 | 3 | [] | no_license | function solve(input) {
var search = input[0].toLowerCase(),
text = input[1].toLowerCase(),
occurences = 0,
pos = text.indexOf(search);
while(pos !== -1) {
occurences++;
pos = text.indexOf(search, ++pos);
}
console.log(occurences);
}
solve([
'in',
'We a... | true |
637fbbb83b5c12709eefe9d29c18fcf8f28e19de | JavaScript | angelikaSajani/text-match | /src/Components/TextMatchResult.js | UTF-8 | 1,425 | 3.09375 | 3 | [] | no_license | import React from "react";
// expects either a property called results (array) OR
// error (string)
function TextMatchResult(props) {
console.log(`Now in TextMatchResult: ${props.error}`);
console.log(`Now in TextMatchResult: ${props.results}`);
const error = props.error;
const results = props.results;
/... | true |
da2a816e4d4f54aa83fb464a63e1565e9249bb4e | JavaScript | sergiofgonzalez/eloquent-js | /chapter09-regular-expressions/e02-quoting-style.js | UTF-8 | 666 | 3.609375 | 4 | [] | no_license | 'use strict';
var text = 'And then she said: \'What are you implying?\'\n' +
'and he replied: \'You don\'t know what you\'re doing.\'\n' +
'I\'ve been hearing the same thing all my life.';
console.log('original text:\n' + text);
var lines = text.split(/\r?\n/);
var quotePattern = /(^|\W)'|'(\W... | true |
ad9e10e4e0d6a19477fbcdcc12e23c43572aa213 | JavaScript | itstep-msk/W41818 | /APP/PUCCI/pucci.js | UTF-8 | 630 | 3.203125 | 3 | [] | no_license | function colorNeuralNetwork(color) {
var colors = {
blue: [0, 0, 255],
lightblue: [0, 255, 255],
red: [255, 0, 0],
yellow: [255, 255, 0],
green: [0, 255, 0],
orange: [255, 128, 0],
violet: [255, 0, 255],
black: [0, 0, 0],
white: [255, 255, 255]
}
var inter = {}
for(key in colors) {
inter[key] =... | true |
0f7450d6257a6f9eb5bb8b16b4b3626b12908a9a | JavaScript | Night-ai/tyrn-bot | /commands/others/premium+.js | UTF-8 | 1,015 | 2.53125 | 3 | [
"MIT"
] | permissive | const db = require("../../database")
const Discord = require('discord.js')
module.exports = {
name: ["prem+","premium+"],
async run (client, message, args) {
if (message.author.id !== "551120440584699904") {
message.channel.send("You are not <@551120440584699904> ")
} else {
const user = mes... | true |