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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
9c40e6304d2918bf3820a09a145aba8acce6032c | JavaScript | vhtml/algorithm-actual-combat | /examples/classic7.js | UTF-8 | 3,110 | 4.1875 | 4 | [] | no_license | /**
* 堆排序(Heap Sort)
* 基本思想:是指利用堆这种数据结构所设计的一种排序算法。
* 堆积是一个近似完全二叉树的结构,并同时满足堆积的性质:即子结点的键值或索引总是小于(或者大于)它的父节点。
* 时间复杂度O(nlogn),最坏O(nlogn),最好O(nlogn),空间复杂度O(1),不稳定
* 算法描述:
* 1. 将初始待排序关键字序列(R1,R2….Rn)构建成大顶堆,此堆为初始的无序区;
* 2. 将堆顶元素R[1]与最后一个元素R[n]交换,此时得到新的无序区(R1,R2,……Rn-1)和新的有序区(Rn),且满足R[1,2…n-1]<=R[n];
* 3. 由于交换后新的堆顶R[1... | true |
09065313c389245be48861ddffed1727940da1c9 | JavaScript | ken-okabe/stateless-react | /index.jsx | UTF-8 | 4,933 | 2.84375 | 3 | [
"MIT"
] | permissive | (() => {
'use strict';
var React = require('react');
var ReactDOM = require('react-dom');
var Immutable = require('immutable');
var __ = require('timeengine');
var __Component = require('timeengine-react');
//================================
var HelloComponent = () => (<div>HelloComponent!!</div>);
... | true |
b917289afdfd1eb5c959f570e69df46a89bbd71f | JavaScript | reireynoso/node-notes-app | /notes.js | UTF-8 | 2,045 | 3.25 | 3 | [] | no_license | const fs = require('fs')
const chalk = require('chalk')
const getNotes = () => {
return "Your notes..."
}
const addNote = (title, body) => {
const notes = loadNotes()
// const duplicateNotes = notes.filter(note => note.title === title)
const duplicateNote = notes.find(note => note.title === title)
... | true |
fd031a9df30aa5b915904ea615a0bfe924cac736 | JavaScript | shinsato/twitwiki | /index.js | UTF-8 | 534 | 2.53125 | 3 | [] | no_license | var http = require("http");
var url = require("url");
var fs = require('fs');
function start() {
function onRequest(request, response) {
var pathname = url.parse(request.url).pathname;
console.log("Request for " + pathname + " received.");
response.writeHead(200, {"Content-Type": "text/html"});
var h... | true |
78ef605d179cd5cd08f1e8edd8fafe15b257c38e | JavaScript | team-map-makers/Cartographers-Chisel | /src/uicomponents/NoteBox/NoteBox.js | UTF-8 | 3,413 | 2.703125 | 3 | [] | no_license | import React, { Component } from 'react';
import './NoteBox.scss';
class NoteBox extends Component {
constructor(props) {
super(props);
this.state= {noteMode: "view" , noteText:"note text", noteTitle:"title text"}
this.setEdit = this.setEdit.bind(this);
this.setView = thi... | true |
2c8e5f5517d9a798d9ab6cbbee5c7691b2d4b8e6 | JavaScript | ErickJManuel/myAngularApp2 | /Example 12/Note Wrangler/js/controllers/notes-edit-controller.js | UTF-8 | 1,673 | 2.875 | 3 | [] | no_license | <!--
/*
Editing below code to show how to use a custom function off of $resource
angular.module("NoteWrangler").controller("NotesEditController", [$scope, 'Note', function($scope, Note){
$scope.deleteNote = function(note){
// below logic should actually be put in services under our application so that it can be reu... | true |
65c42dc3eaf19eaac9cc60994e842d4f54a633dd | JavaScript | malik-lakhani/whoisLookup | /whois.js | UTF-8 | 3,958 | 2.734375 | 3 | [] | no_license | const whois = require('whois')
const parser = require('parse-whois');
const dns = require('dns');
const { exec } = require('child_process');
const assert = require('assert');
// Domain passed as command line argument.
const domain = process.argv[2];
assert.ok(domain, 'Domain is required');
assert.ok(domain.match(/^(?... | true |
a92554005d76040a6ab785e396509bd36308904d | JavaScript | DenMantm/college_project_new | /pub/js/script.js | UTF-8 | 1,306 | 2.65625 | 3 | [] | no_license | //function for the side menu
function toggleMe(index){
var ele = "#" + index;
$(ele).toggle("slide");
};
//slide status bar::::
var slideStatusBar = function(){
if( $('#status_bar').css('display') === 'block'){
$('#menu_status_bar').html('Show Status Bar');
}
else{
$('#menu_status_bar').html('Hide Status B... | true |
3424761579ff840c9ef10862078c3611ae02d53f | JavaScript | usma7/bioticket | /src/test/CrearEvento.test.js | UTF-8 | 542 | 2.671875 | 3 | [] | no_license | import React from 'react'
import { mount } from 'enzyme'
import CrearEvento from '../componentes/CrearEvento'
const add = (x,y) => x+y
test("Ejemplo de suma", () => {
expect(add(2,3)).toBe(5)
});
test('Test basico de un componente', () => {
const wrapper = mount(<CrearEvento />)
//console.log(wrapper.deb... | true |
2198e9f652871f2ae688435341115afa0ffcf231 | JavaScript | SlyDeGout/todo-client | /src/components/Task.js | UTF-8 | 1,490 | 2.84375 | 3 | [] | no_license | import React from "react";
// class Task extends React.Component {
// //let { index, title, done, onCloseClick, onTitleClick } = props;
// state = {
// done: false
// };
// render() {
// return (
// <p>
// <button
// onClick={e => {
// console.log("TASK INSIDE CLOSE... | true |
1bade74db2cdb233b337d7092ff6558d712db6c7 | JavaScript | weirdestnerd/mesa_blocking | /public/javascripts/utils.js | UTF-8 | 2,876 | 2.640625 | 3 | [] | no_license | function Utils() {
const COLORS = ['#f7fbff', '#f7fcf5', '#ffffff', '#fff5eb', '#fcfbfd', '#fff5f0', 'f7fcfd', 'f7fcfd', 'f7fcf0', 'fff7ec', 'fff7fb', 'fff7fb', 'f7f4f9', 'fff7f3', 'ffffe5', 'ffffd9', 'ffffe5', 'ffffcc', '#08306b', '#00441b', '#000000', '#7f2704', '#3f007d', '#67000d', '00441b', '4d004b', '084081',... | true |
c03f928af3d9cc2c8b224977f153f949032923d5 | JavaScript | codervince/coffeestore | /client/components/App.js | UTF-8 | 2,522 | 3.15625 | 3 | [] | no_license | const React = require('react');
import CoffeeList from './CoffeeList';
import Coffee from './Coffee';
//ajax library
import axios from 'axios'; //can also use fetch?
//format of presentational component
// const App = () => {
// return (<h2> Hello Components! </h2>);
// };
//CoffeeList
//Coffee
//better syntax
cla... | true |
d38f896a48bfb442d4b5f80f33f86b169fd3fc12 | JavaScript | Raj-04/web-sprint-challenge-advanced-web-applications | /src/components/Article.test.js | UTF-8 | 1,927 | 2.578125 | 3 | [] | no_license | import React from 'react';
import '@testing-library/jest-dom';
import { render, screen, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import MutationObserver from 'mutationobserver-shim';
import Article from './Article';
const testArticle = {
id: 'aMqwd',
head... | true |
306aa90a6640b61875ca6d61fc588af1977c2d8e | JavaScript | gaholanda/utils | /regex/formatters/index.js | UTF-8 | 581 | 2.96875 | 3 | [] | no_license | /*
Formata variados números
Autor: @brunomacedo
*/
const formatNumber = (
_number,
_locale = 'pt-BR',
_format = 'BRL',
_currency = 'currency', // decimal, currency
) => (
new Intl.NumberFormat(_locale, {
style: _currency,
currency: _format,
minimumFractionDigits: 2,
})).format(parseFloat(_nu... | true |
9c0ca1e729ac78be830b90da09641d368481342d | JavaScript | fangtoby/node-fw | /extends/cache.js | UTF-8 | 1,018 | 2.71875 | 3 | [] | no_license | var fs = require('fs');
module.exports = {
path: '',
cacheStatus: false,
cacheObject: {
//path:content
},
addToCache: function(path) {
var self = this;
var stat = fs.lstatSync(path);
if (!stat.isDirectory()) {
this.cacheObject[path] = fs.readFileSync(path, 'utf-8');
} else {
var files = fs.readdirS... | true |
c74442e43678a42831395fe0a50110135693c0b8 | JavaScript | maxmagee/exercismio | /javascript/secret-handshake/secret-handshake.js | UTF-8 | 2,005 | 3.578125 | 4 | [] | no_license | // Node apparently doesn't yet support String.prototype.padStart, so I'm adding a polyfill
// https://github.com/uxitten/polyfill/blob/master/string.polyfill.js
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padStart
if (!String.prototype.padStart) {
String.prototype.padS... | true |
7ad77d17cf0764881740b9ec98d8543f68dbf65c | JavaScript | gaborzay/datastructures-and-algorithms | /topics/examples/promises.js | UTF-8 | 677 | 3.140625 | 3 | [] | no_license | const promise = new Promise(function (resolve, reject) {
console.log('Promise Example');
setTimeout(function () {
const num = Math.floor(Math.random() * 100);
num % 2 === 0 ? resolve({even: num}) : reject({odd: num});
}, 1000);
}).then((result) => {
console.log({first: result});
const even = result.ev... | true |
e5268fb3961f678c2802e25cf65e1f4c7a840fe9 | JavaScript | francescoagati/ecolect-js | /language/en/month.js | UTF-8 | 1,435 | 2.828125 | 3 | [
"MIT"
] | permissive | 'use strict';
const Parser = require('../../parser');
const utils = require('../dates');
const addMonths = require('date-fns/add_months');
function currentTime(encounter) {
if(encounter.options.now) {
return encounter.options.now;
} else {
return encounter.options.now = new Date();
}
}
function adjustedMonth(... | true |
c25d5aac854512ac3078ad83d354867f47e7b187 | JavaScript | tlccpd/tlc_service | /front_dev/webapp/kr/co/tlccpd/webapp/common/script/errorView.js | UTF-8 | 296 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive |
<script>
var state = 'hidden';
function btnClick() {
if (state == 'visible') {
state = 'hidden';
document.getElementById('info_area').style.display = 'none';
} else {
state = 'visible';
document.getElementById('info_area').style.display = 'block';
}
}
</script> | true |
46de05715a59c1efabaaa9424476258a4d6da506 | JavaScript | Code-Institute-Submissions/Mobile_Central_MP4 | /templates/preserveScroll.js | UTF-8 | 830 | 2.953125 | 3 | [] | no_license | document.addEventListener("DOMContentLoaded", keepScroll);
// takes the local storage var scrollpos value and sets it as the page scrolling position if the current page and the refer are the same
function keepScroll(){
var elem = document.getElementById("contenuto");
var scrollpos = localStorage.getItem('scro... | true |
38530a003d8b0ebe690544b702a65fc633c5a618 | JavaScript | Ellenstarbuck/react-hook-forms | /models/user.js | UTF-8 | 1,576 | 2.921875 | 3 | [] | no_license | const mongoose = require('mongoose')
const bcrypt = require('bcrypt')
const userSchema = new mongoose.Schema({
username: { type: String, required: true , unique: true },
email: { type: String, required: true , unique: true },
password: { type: String, required: true }
})
userSchema.methods.validatePassword = fu... | true |
be4b2dd0ec0e4ae08504a6417220ab6e0482beb8 | JavaScript | jainsuchita/react-query-examples | /server.js | UTF-8 | 1,378 | 2.953125 | 3 | [] | no_license | const express = require("express");
const cors = require("cors");
const app = express();
app.use(express.json());
app.use(cors());
app.use(express.static("public"));
const port = 3000;
// Languages
const favLangs = ["html", "css", "react"];
app.get("/api/get-records", (req, res) => {
res.json(favLangs);
});
app.p... | true |
0ea1870c5fa362bf8fe73741dd993cd9dcce215e | JavaScript | jkabore/simple-card | /src/_internals/getCardType.js | UTF-8 | 540 | 2.828125 | 3 | [
"MIT"
] | permissive | import find from 'kyanite/find'
import range from 'kyanite/range'
import some from 'kyanite/some'
// Our function that goes through our number and tries to find the type it belongs to
export default ccNumber => {
const types = {
amex: [34, 37],
// 6011, 622126-622925, 644-649, 65
discover: [6011... | true |
124fbdd1c5f418a0e4abc79a35d815f3f02ee5d2 | JavaScript | oneblink/forms-cli | /packages/forms-transformer/lib/normalisations/from-json-files.js | UTF-8 | 539 | 2.6875 | 3 | [
"MIT"
] | permissive | 'use strict'
const fs = require('fs')
const debugLogger = require('../logger/loggers.js').debugLogger
function normalise (fileList) {
if (!Array.isArray(fileList)) {
fileList = [fileList]
}
const options = {encoding: 'UTF-8'}
return fileList.reduce((memo, jsonPath) => {
try {
const json = JSON... | true |
8c894f4438e08500c249096845054d3f0a242932 | JavaScript | DmytryjK/Infopulse_Univer | /11/HW11/js/game.js | UTF-8 | 1,764 | 3.109375 | 3 | [] | no_license |
let game = (userAnswer) => {
let answers = ['rock', 'paper', 'scissors'],
m = 0,
n = answers.length - 1, //length = 3 а индексы с 0 по 2
randIndex = Math.floor(Math.random() * (n - m + 1)) + m,
computerAnswer = answers[randIndex],
table = {
'rock' : {
'rock' : 0,
'paper' : -1,
... | true |
f87d0cae0572e2d1d9894336455a1efec5aaf73f | JavaScript | mcabrerapf/SkylabCoders | /JavaScript/JavaScriptChallenge2/5.FindLongestWord.js | UTF-8 | 400 | 3.625 | 4 | [] | no_license | //find longest word()
function longestWord (words){
var currentWord;
var numWords = words.length;
var longestWord = "";
for(var i=0; i<numWords; i++){
currentWord = words[i];
if(currentWord.length > longestWord.length){
longestWord = currentWord
}
}
return ("The longest word is: " + longestWord + " and ... | true |
6c47b399a9f78d9bcf6851452407ba0f997dedf6 | JavaScript | jDomantas/jDomantas.github.io | /ldprep/script/main.js | UTF-8 | 2,682 | 2.578125 | 3 | [] | no_license | var app = playground({
width: 640,
height: 480,
smoothing: false,
container: document.getElementById("container"),
preventKeyboardDefault: false,
create: function() {
this.pixelScale = 4;
this.viewScale = 10;
this.screen = cq(this.width / this.pixelScale, this.height / this.pixelScale);
this.world = new... | true |
3ea20428040861770785f88b5272375e8d051292 | JavaScript | Kazap/academy2019-vuejs | /1-javascript-fundamentos/4-functions/js/main.js | UTF-8 | 264 | 3.328125 | 3 | [
"MIT"
] | permissive | /*
soma
subtrai
multiplica
divide
full-name
*/
function minhaFuncao(name) {
return `Olá, ${name}`
}
// const minhaFuncao = function (name) {
// return `Olá, ${name}`
// }
// const minhaFuncao = name => `Olá, ${name}`
console.log(minhaFuncao()) | true |
6cba22c5003064f998ee882442f8f2939804d46b | JavaScript | GCheung55/Neuro-Sync | /src/sync/main.js | UTF-8 | 665 | 2.546875 | 3 | [] | no_license | /**
* Sync, inherits Request.JSON methods, providing additional CRUD methods
*
* @requires [MooTools-Core/Class, MooTools-Core/Request/Request.JSON]
*/
var REST = function(type){
return function(){
this[type].apply(this, arguments);
return this;
};
};
var Sync = new Class({
Extends: Req... | true |
9ae2f3665c471fe26bd8b34760da0e6a418729cc | JavaScript | snamper/acsm-farmcloud | /supply/off.js | UTF-8 | 1,461 | 2.625 | 3 | [] | no_license | //点击弹出修改窗口
function bounced(id){
detailMess(id);
jquery("#myModal").modal('show');
jquery('#myModal').on('shown.bs.modal', function () {
jquery('html').css({'overflow':'hidden'});
});
jquery('#myModal').on('hide.bs.modal', function () {
jquery('html').css({'overflow':'auto'});
});
}
//提交报价信息
function submitS... | true |
0326877c6a2d23f0a027408c908da725c31c6bbe | JavaScript | simonwong/leet-code-algorithms | /explore/array-and-string/rotate.js | UTF-8 | 1,485 | 3.859375 | 4 | [] | no_license | // 旋转矩阵
// https://leetcode-cn.com/leetbook/read/array-and-string/clpgd/
/**
* @param {number[][]} matrix
* @return {void} Do not return anything, modify matrix in-place instead.
*/
const swap = (matrix, sx, sy, ex, ey) => {
const temp = matrix[ex][ey]
matrix[ex][ey] = matrix[sx][sy]
matrix[sx][sy] = temp
}
... | true |
77aa4ff25a51965a7d5bb72025664203276d6712 | JavaScript | djherondhy/scac | /js/request-gets.js | UTF-8 | 7,937 | 2.703125 | 3 | [] | no_license | function getsAnimal(){
$.ajax({
url: '../config/select.php',
method: 'POST',
data: {tabela: 'animal'},
dataType: 'json'
}).done(function(result){
console.log(result);
var box = document.querySelector('.animal-table');
while(box.firstChild){
... | true |
8a90926d1d482f374d039339eee54b1eb76acfa6 | JavaScript | g33tar/more-nodes | /lib.js | UTF-8 | 225 | 2.703125 | 3 | [] | no_license | module.exports = {
getStrongest: function(arr){
var strong = arr[0];
for(var i = 0; i < arr.length; i++){
if(arr[i].strength > strong.strength){
strong = arr[i];
}
}
return strong;
}
}
| true |
b50f4bc7ddb6b9ce90cc38805b173abd6352118b | JavaScript | IITII/VNSTAT-DASHBOARD | /index.js | UTF-8 | 7,098 | 2.796875 | 3 | [
"MIT"
] | permissive | /** VnStat To Visual Chart
* @copyright IITII
* @author IITII
* @license MIT
* @description
* At First, Using bash to generate data,
* then using JavaScript to deal whit it.*/
'use strict';
const fs = require('fs');
const path = require('path');
const moment = require('./public/js/moment');
//const {exec} = requ... | true |
f046f2b51c115d822490a62c26435a3cfe2214dc | JavaScript | leowu2000/mytrash | /UTF8_Client/WebContent/help/help.js | UTF-8 | 27,931 | 2.671875 | 3 | [] | no_license | function startMenu() {
// /菜单参数
imageDirectory = 'img'; ////图片目录
menuTree = new obj_collection()
defineMenuItems(menuTree)
if (definitionsHaveErrors(menuTree) == false) {createAppearanceArray(menuTree,menuTree.itemWithID('root'));
treeVariable = menuTree;
expandNode('root');
... | true |
b8aad1c92a23009c281446844d343612010fd705 | JavaScript | joesalerno/react-apollo-graphql-express | /testclient - Copy.js | UTF-8 | 6,180 | 3.203125 | 3 | [] | no_license | const net = require("net")
const sleep = ms => new Promise (done => setTimeout(done, ms))
class Genesis {
constructor(port, host) {
this.port = port || 1337
this.host = host || "localhost"
this.data = []
this._init()
}
async _init () {
await this._connect()
var msg = await this._in()
... | true |
d188bdccfa0489051bc9e24911e4b5443480dd9a | JavaScript | NguyenVanToi/abcxyz | /scripts.js | UTF-8 | 1,576 | 2.8125 | 3 | [] | no_license | /**
* Created by vinamilk26 on 06/08/2017.
*/
var app = angular.module("myobject", []);
app.controller("content", function ($scope, $http) {
$http.get("types.json").then(function (response) {
$scope.objects = response.data.object;
function typevarialble(x) {
if(Object.prototype.toStrin... | true |
eb5f72f1bb89cb2843d100ab341668f7d53004af | JavaScript | Kumar-Achuth/OOPS | /companyList.js | UTF-8 | 3,981 | 3.765625 | 4 | [] | no_license | "use strict"
var prompt = require('prompt-sync')();
class Node {
// constructor
constructor(element) {
this.element = element;
this.next = null
}
}
class LinkedList {
constructor() {
this.head = null;
this.size = 0;
}
add(element) {
// creates a new node... | true |
c4a94ec243425e13e145735cb250be7103807e85 | JavaScript | rexrainbow/phaser3-rex-notes | /plugins/utils/object/DeepClone.js | UTF-8 | 713 | 3.140625 | 3 | [
"MIT"
] | permissive | import IsPlainObject from './IsPlainObject.js';
var DeepClone = function (inObject) {
var outObject;
var value;
var key;
if ((inObject == null) || (typeof inObject !== 'object')) {
// inObject is not an object
return inObject;
}
// Create an array or object to hold the value... | true |
38d590d02d4251a1474f6e019c4d14058f45e326 | JavaScript | Dicta-Israel-Center-for-Text-Analysis/search-ui | /Services/TreeService.js | UTF-8 | 4,262 | 2.765625 | 3 | [] | no_license | // loads the tree of the Dicta corpus
// also provides a utility function 'treeSort' which sorts a list according to an in-order traversal of the tree
jTextMinerApp.factory('TreeService', function ($http, $q, StateService) {
function initService() {
return $http.get(
StateService.isBibleMode
... | true |
243d31f0c053587cf5aac5793757064df24a889b | JavaScript | alnn/sandbox-js | /exercises-practice-solutions/allergies/allergies-2.js | UTF-8 | 698 | 2.984375 | 3 | [] | no_license | 'use strict';
var allergens = [
'eggs', 'peanuts', 'shellfish', 'strawberries',
'tomatoes', 'chocolate', 'pollen', 'cats'
],
total = allergens.length;
module.exports = function(score) {
var bitMap = ('0'.repeat(total) + score.toString(2)).slice(-total);
return {
list: function(... | true |
8958339daca80ecc8070219fa9f9375fd7ad67fe | JavaScript | xorgnz/SceneGen | /src/main/webapp/resources/scripts/ae/AE_Lens.js | UTF-8 | 4,263 | 2.890625 | 3 | [] | no_license | /**************************************************************************
Class - AE Lens
Keeps track of entity selection and view states . That is, selections, hovering, and focus
Triggers changes to display of objects using scene manager
****************************************************************... | true |
f19846ef3361e049ad6af4ddd50ffea1d47881a9 | JavaScript | ineuv/Integration--des--nouveaux--etudiant.io | /acceuil.js | UTF-8 | 2,544 | 2.96875 | 3 | [] | no_license | function requiredElement() {
var nom = document.getElementById("Nom").value;
var prenom = document.getElementById("prenom").value;
var email = document.getElementById("email").value;
if(nom=="") {
alert("Veillez insérer votre Nom");
document.getElementById("nom").style.backgroundColor="red";
document.getElemen... | true |
be5feed1772908fb3db78426873aab1391a7fc83 | JavaScript | boriskondev/softuni-js | /js-web/01-express-and-templating-ws/models/cube.js | UTF-8 | 1,569 | 3.03125 | 3 | [] | no_license | const uniqid = require("uniqid");
const fs = require("fs");
class Cube {
constructor(name, description, imageURL, difficulty) {
this.id = uniqid();
this.name = name || "Unknown name";
this.description = description || "No description yet";
this.imageURL = imageURL || "https://lunawo... | true |
539cf34c6c9721604bf89a33e62acb0a02bfe80e | JavaScript | sachin6699/Css-Variables-color | /main.js | UTF-8 | 395 | 3.3125 | 3 | [] | no_license | const inputs = document.querySelectorAll(".controls input");
const handleUpdate = (event) => {
console.log(event.target.value);
};
// function handleUpdate() {
// console.log(this.value);
// }
// const handleUpdate = ({ target }) => {
// const { value } = target;
// console.log(value);
// }; // cool stuff
... | true |
682a7ddb38b8c74f1bd8a5a9f2c07e8dd86ba223 | JavaScript | NazarethAguileraMeanStack/JavaScriptAlgorithms | /addStringDigits.js | UTF-8 | 340 | 3.515625 | 4 | [] | no_license |
function addStringDigits(strNums){
let strNumsArray = strNums.split("").map((element)=>{return parseInt(element)}).reduce((total, nums)=>{return total + nums});
return strNumsArray;
}
console.log(addStringDigits("48"));
console.log(addStringDigits("34"));
console.log(addStringDigits("29"));
console.log(add... | true |
880afe4632da6bc784adf1a21906a5469405987b | JavaScript | dann95/utils | /js/stringToHexColor.js | UTF-8 | 803 | 3.796875 | 4 | [] | no_license | // Hash any string into an integer value
// Then we'll use the int and convert to hex.
function hashCode(str) {
var hash = 0;
for (var i = 0; i < str.length; i++) {
hash = str.charCodeAt(i) + ((hash << 5) - hash);
}
return hash;
}
// Convert an int to hexadecimal with a max length
// of six cha... | true |
15fef0de51bab43fad675813ca5bf9123ea009a7 | JavaScript | jscho13/leetcode | /permutations-ii.js | UTF-8 | 589 | 3.09375 | 3 | [] | no_license | /**
* @param {number[]} nums
* @return {number[][]}
*/
const permuteUnique = (nums) => {
let ans = [];
let map = new Map();
const bt = (ary, build) => {
let key = ary.slice().join('');
if (build.length === 0 && !map.has(key)) {
map.set(key);
ans.push(ary.slice());... | true |
45f8cc201fcaf13808806790fcd42d5fd9b74d28 | JavaScript | FreedomWriter/javascript-deepdive | /algorithms/ztm/trappingRainwater.js | UTF-8 | 2,911 | 4.1875 | 4 | [
"MIT"
] | permissive | // console.log("TRAPING RAINWATER");
// /*
// Given an arraw of integers representing an elevation map where the width of each bar is 1, return how much rainwater can be trapped
// 0 1 2 3 4 5 6 7 8 9 10
// [0, 1, 0, 2, 1, 0, 3, 1, 0, 1, 2]
// STEP ONE - VERIFY THE CONSTRAINTS
// -------------------------... | true |
28cd90792cb535f159de806cdabcb1cbb965e804 | JavaScript | wyclodash/lodashFunction | /lib/flattendepth.js | UTF-8 | 765 | 3.671875 | 4 | [] | no_license | /**
*Recursively flatten array up to depth times.
*
* @memberof _
* @since 0.1.0
* @category Array
* @param {Array} array The array to flatten.
* @param {Number} [depth=1] The values to exclude.
* @returns {Array} Returns the new flattened array.
* @example
*
* _.flattenDeep([1, [2, [3, [4]], 5]])
* // => ... | true |
fb483c29be47d4e02f02c96a136db7c058b9e1a4 | JavaScript | aarpon/obit_flow_core_technology | /core-plugins/flow/4/as/webapps/flow-viewer/html/js/dataviewer.js | UTF-8 | 34,531 | 2.78125 | 3 | [
"Apache-2.0"
] | permissive | /**
* DataViewer class
*
* A viewer to display DataModel entities to the html page.
*
* @author Aaron Ponti
**/
define(["d3", "c3"], function (d3, c3) {
"use strict";
// Constructor
function DataViewer() {
// Make sure we are using it as a class
if (!(this instanceof DataViewer)) {... | true |
c005d643a36392371ec0d30772a81586a9f9d596 | JavaScript | Jaimierl/city-explorer-api | /modules/weather.js | UTF-8 | 2,043 | 3.234375 | 3 | [] | no_license | 'use strict';
const axios = require('axios');
let cache = require('./cache.js');
async function handleWeather(request, response) {
// response.status(200).send('Weather Route Works');
// Search Query Listening
let { lat, lon, partyTown } = request.query;
let cacheKey = 'weather-lat-' + lat + '-lon-' + lon;
... | true |
777aca5121279148a4c843428939a50ef09b341b | JavaScript | Ironraptor3/Purtorqlack-IMGD-3900 | /IMGD-3900/A03/daniel/game.js | UTF-8 | 18,293 | 2.640625 | 3 | [] | no_license | // game.js for Perlenspiel 3.3
// The following comment lines are for JSHint. You can remove them if you don't use JSHint.
/* jshint browser : true, devel : true, esversion : 6, freeze : true */
/* globals PS : true */
"use strict";
/*
name: Daniel Charles Ribaudo
user: dcribaudo
team: Purtorqlack
class: I... | true |
d3a0b3f9ff27cdbd99b3194927522ab441e9829c | JavaScript | nilvon9wo/MediusDB | /samples/NotesDatabase/scripts/lib/MediusElement.js | UTF-8 | 1,139 | 2.78125 | 3 | [
"MIT"
] | permissive | var MediusElement = {
create: function (config) {
'use strict';
var tag = config.tag;
var attributes = attributes || {};
var innerContent = config.innerContent;
var newString = '';
function addAttributes(attributes) {
var attributeString = '';
... | true |
bf106a16887cb0486d86ac9b7cb6b919a932a554 | JavaScript | andrIvash/node-template | /public/js/main.js | UTF-8 | 1,807 | 2.53125 | 3 | [] | no_license | $(document).ready(function(){
$('#form').on('submit', function(e){
e.preventDefault();
$('.msg').remove();
var formData = new FormData($('#form')[0]);
$.ajax({
type: "POST",
processData: false,
contentType: false,
url: "./upload",
data: formData
})
.done(... | true |
c1eaf7e4a9e15ad436dae67a48487bd90258d79e | JavaScript | Dator4ik/NovaLabs | /Custom_ls.gs | UTF-8 | 2,222 | 2.53125 | 3 | [] | no_license | version=1.0
//This program was made by the NovaLabs Dev team.
//This program is made for the purpose of being used for all greyhack players.
//Our Discord can be found at https://discord.gg/37WH8vRyzR
clear_screen
shell=get_shell
computer=shell.host_computer
map={}
map.folders=[]
binary=function(file)
if file.is_... | true |
77daf770076daaf4aef6bf76cb6fdffa3a6bb8d9 | JavaScript | AlisherZakir/js-data-structures-arrays-lab-online-web-sp-000 | /index.js | UTF-8 | 528 | 3.421875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | // Write your solution here!
const drivers = ["Milo", "Otis", "Garfield"];
const destructivelyAppendDriver = name => drivers.push(name);
const destructivelyPrependDriver = name => drivers.unshift(name);
const destructivelyRemoveLastDriver = () => drivers.pop();
const destructivelyRemoveFirstDriver = () => drivers.shi... | true |
c4a226cd95daf0a5e89d221e3846c6c059a2873a | JavaScript | Francisca105/Fastly-Network-Bot | /commands/banir.js | UTF-8 | 1,917 | 2.78125 | 3 | [] | no_license | const Discord = require('discord.js')
module.exports.run = async (client, message, args) => {
if (!message.member.hasPermission('BAN_MEMBERS')) return message.reply("⚠️ | Você não tem permissão para utilizar este comando.")
let member = message.mentions.members.first()
if... | true |
8459fc2e9fd858689d93e56596b806306f6b5df1 | JavaScript | isatalkin/isatalkin.github.io | /projects/cherkizon/js/directors.js | UTF-8 | 1,276 | 2.609375 | 3 | [] | no_license | 'use strict';
(function () {
var directorsList = document.querySelector('.directors__list');
var directors = directorsList.querySelectorAll('.directors__item');
var closeAllAccordeons = function () {
directors.forEach(function (item) {
item.classList.remove('directors__item--opened');
item.styl... | true |
1524226729d07c9e609ffe50227f2d05c44e5a61 | JavaScript | FITRIWULANDARII15/javascript | /alert_prompt_confirm.js | UTF-8 | 136 | 2.6875 | 3 | [] | no_license | <html>
<body>
<script>
var name = prompt("Enter your name:");
alert(name);
</script>
</body>
</html>
| true |
cea98d14cd1920fd7e7c9470a78211121daec98a | JavaScript | spaik11/todom | /deleteTodo.js | UTF-8 | 316 | 2.921875 | 3 | [] | no_license | const deleteTodo = index => todo.splice(index, 1);
const indexInput = document.querySelector('.index-input');
document.querySelector('.remove-todo').addEventListener('click', function() {
deleteTodo(indexInput.value, 1);
todoUl.removeChild(todoUl.childNodes[indexInput.value]);
indexInput.value = '';
}) | true |
ed8446669a1d494a91fa2e16616244f3c2d4bbdd | JavaScript | kayanoma/websocket_server | /script.js | UTF-8 | 1,587 | 2.59375 | 3 | [] | no_license | function client(){
// var connection=new WebSocket('wss://6191df17.ngrok.io');
var connection=new WebSocket('wss://kayanoma.github.io/websocket_server/');
// document.getElementById('state').innerText=connection.readyState;
// connection.send('Hello');
// connection.onmessage=function(e){
// document.getE... | true |
26e2b2ed7432553b378c982097768da7eae0a02f | JavaScript | tanhauhau/damu | /packages/babel-transform-damu-plugin/src/transform/class.js | UTF-8 | 3,592 | 2.59375 | 3 | [
"MIT"
] | permissive | import * as t from '@babel/types';
import {
transform as transformElement,
injectTransformer,
} from './trasnformers';
injectTransformer('ClassDeclaration', transformClassDeclaration);
function transformClassDeclaration(path) {
// remove super
removeSuper(path);
const setStateMap = {};
path.traverse({
... | true |
0685641d17c1522c39ca08580b606b0445cc9980 | JavaScript | zomaish/data_structures | /data-structs-2/cracking-coding/16.1-number-swapper.js | UTF-8 | 206 | 3.4375 | 3 | [] | no_license |
const swap = (a, b) => {
console.log('a', a, 'b', b)
let x = a;
let y = b;
y = x^y;
x = x^y;
y = x^y;
console.log('now x', x, 'y', y)
}
const a = 25;
const b = 43;
swap(a, b); | true |
b5ecdb65e6ce0018e709e16bd85c16c2b8cbea15 | JavaScript | henry397966594/new-repository | /VuePractice/promise2.js | UTF-8 | 1,162 | 3.765625 | 4 | [] | no_license | // console.log(1);
// let promise = new Promise((resolve, reject) => {
// console.log('成功')
// setTimeout(() => {
// let num = Math.ceil(Math.random() * 10)
// if (num <= 3) {
// console.log(num);
// resolve()
// } else {
// console.log('数字太大了');
// ... | true |
2a2f58699fda951415e554a70d6fbd6f2baaee3f | JavaScript | phutngo/chainshot-js-crashcourse | /2-Network/50-ChainshotCallback.js | UTF-8 | 1,521 | 4.84375 | 5 | [] | no_license | /**
* For Each Callbacks
Let's create our own forEach function!
Your Goal: Complete the ForEach function
This function will take two parameters:
An array of elements
A callback function that we want to run for each element in the array
Be sure to call the callback function with both the current element in the array... | true |
8f258444d94c2219a6f03bdccb5101b887fb0f1f | JavaScript | faizan-tahir/todo-list | /java.js | UTF-8 | 838 | 3.09375 | 3 | [] | no_license | function add() {
var val = document.getElementById("val");
var list = document.getElementById("list");
var li = document.createElement("LI");
// var b = document.getElementById("B");
var span = document.createElement("SPAN");
var btn = document.createElement("BUTTON");
var btnText = document... | true |
82ed99b157cadb5f98d121bd942cabbcc578cd36 | JavaScript | user0dev/itmo-js | /lessons4/draznilka.js | UTF-8 | 468 | 3.390625 | 3 | [] | no_license | /*jslint devel: true */
function draznilka() {
"use strict";
function randomInt(max) {
max = +max;
return Math.floor(Math.random() * (max));
}
var arr1 = ["Ты", "Вы", "Она"],
arr2 = [" грязная", " мокрая", " вонючая", " глупая"],
arr3 = [" курица", " утка", " жаба"];
... | true |
a8298be8c4e307c3cf1a929f3de65edea13b991a | JavaScript | michaelhintz16/in-class | /_archive/week09m/hello-npm/server.js | UTF-8 | 661 | 3.359375 | 3 | [] | no_license | // Load the built-in `http` module
const http = require('http');
// Create and configure an `http` server
const server = http.createServer(function(request,response) {
// Code in this block will execute every time a request is received.
// console.log(request.headers);
// Set the response HTTP header with HTTP ... | true |
e4cc7adecc9a668ccff80b9d040479edf9f3fff1 | JavaScript | LeahGee/Leah-2020 | /W6-payCalc/JavaScript/payCalc.js | UTF-8 | 642 | 3.640625 | 4 | [] | no_license | var salary=0;
var taxRate=0;
var bonus=0;
var taxFreeAllowance=0;
var taxableIncome=0;
var incomeAfterTax=0;
var weeklyIncome=0;
salary = parseFloat(prompt("Input your basic Salary: ", "0")).toFixed(2);
bonus = parseFloat(prompt("Input your bonus: ", "0")).toFixed(2);
taxFreeAllowance = parseFloat(prompt("Input your t... | true |
7747fd42c0dec4873a7b413788a5b5d5896f6dc9 | JavaScript | FiveBright/VColleBiz | /src/finelets/CreateStore.js | UTF-8 | 602 | 2.546875 | 3 | [] | no_license | import __ from 'underscore'
function createGetters (items) {
const obj = {}
__.each(items, (item) => {
obj[item] = (state) => state[item]
})
return obj
}
function createMutations (mutations) {
const obj = {}
__.each(mutations, (m) => {
obj[m] = (state, data) => {
state[m] = data
}
})
... | true |
03ffdd6848ab63acdf327cc40aff1c9fc59d0d9b | JavaScript | felayo/Simple-Js-Calc | /index.js | UTF-8 | 1,030 | 4.15625 | 4 | [] | no_license | // functions for each of the operations
function add()
{
let num1 = document.getElementById("first-input").value;
let num2 = document.getElementById("second-input").value;
if(num1 === '' || num2 === ''){
alert('input your values')
}
document.getElementById("result... | true |
1d3283e90048c1f784c2307d1b50c6368fcbcc8c | JavaScript | yoyoyachu/reactBootcamp | /CRA/lottery-game/src/Lottery.js | UTF-8 | 1,059 | 2.640625 | 3 | [] | no_license | import React,{Component} from 'react';
import LottoBall from './LottoBall';
import './Lottery.css';
class Lottery extends Component {
static defaultProps = {
maxNum:70,
title: "Lottery",
maxBalls:6
}
constructor(props) {
super(props);
this.state = {
nums... | true |
fdc0b36b206b6eb0ac84e6b61e30488bff57ec45 | JavaScript | GuilhermeKAC/estudos_JavaScript | /JavaScript - inicio/tiposdedados/script.js | UTF-8 | 249 | 3.46875 | 3 | [] | no_license | /*
JavaScript
Guilherme Kruszynski
*/
// Array
var numero = 6;
var decimal = 4.5;
var texto = "olá mundo";
var lista = ["laranja", "maçã", "banana", 1234];
alert(lista);
alert(lista[0]);
alert(lista[3]);
for (i in lista) {
alert(i);
} | true |
73b41c81413db7dddb5f45b8fe85dca7af711e3a | JavaScript | Frozen-Potato/OAMK-y1-18-js | /nodeJs/BigLetters_complete.js | UTF-8 | 2,020 | 3.328125 | 3 | [] | no_license | const letter_A_data = [ " XX ",
" XXXX ",
" XX XX ",
"XX XX ",
"XXXXXXXX ",
"XX XX ",
"XX XX " ] ;
const letter_B_data = [ "XXXXX... | true |
54199dbb85facfc7c40fb296f1d5dc73a806d551 | JavaScript | RohanG0407/hackilli | /src/gsap/menu.js | UTF-8 | 3,481 | 2.5625 | 3 | [] | no_license | import { gsap } from "gsap";
import { ScrollToPlugin } from "gsap/ScrollToPlugin";
import barba from "@barba/core";
gsap.registerPlugin(ScrollToPlugin);
//LOCAL DECLARATIONS
let homeMenuLink = document.getElementById("homeLink");
let worksMenuLink = document.getElementById("worksLink");
let aboutMenuLink = document.g... | true |
c0d46dc1d4f64dea1f7ccf2be4d882c512efdb6d | JavaScript | poplu4ever/koa2Weiblog | /src/service/user.js | UTF-8 | 2,300 | 2.640625 | 3 | [] | no_license | /**
* @description user service
* @author neolu
*/
const User = require('../db/model/User');
const {formatUser} = require('./_format');
/**
* @param {string} userName
* @param {string} password
*/
async function getUserInfo(userName,password){
const whereOpt = {
userName
};
if(password)... | true |
2fea4cdbaba632bc6919436e40d0cc8e584e60d9 | JavaScript | zahidhassanshaikot/redux-practice | /src/store/reducers/rootReducer.js | UTF-8 | 387 | 2.6875 | 3 | [] | no_license |
const initialState={
count:100
}
function rootReducer(state=initialState, action) {
switch (action.type) {
case "ADD":{
return{
count:state.count +1
}
}
case "SUB":{
return{
count:state.count -1
}
}... | true |
ec74b077b9c456144921b18f30881aaaf45f8162 | JavaScript | Guvanch99/Regex | /regexType/07-asteric.js | UTF-8 | 165 | 3.109375 | 3 | [] | no_license |
//Match character occurs zero more times
let text="go"
let text1='goooo'
let text3='fdsfds'
const regex=/go*/ig
const result=text3.match(regex)
console.log(result) | true |
4b6908ac191cd6c7d8746f490fd5d633fac188bf | JavaScript | jlee7802/ChatApp | /src/pages/mainApp/TileComp.js | UTF-8 | 2,575 | 2.53125 | 3 | [] | no_license | import React from 'react';
import { TileDiv, Tile, TileSpan } from './styles.js';
class TileComp extends React.Component {
constructor(props){
super(props);
this.getGroupsByUser();
var defaultClickProc = this.getChats.bind(this);
this.state = {dataReady: false, result:[], clickProc: defaultClickProc... | true |
40bf1fd87359c49c5545a709783b150bee80d301 | JavaScript | roro-02/PROJECT-77 | /main.js | UTF-8 | 297 | 3 | 3 | [] | no_license | console.log("my first console project");
var name = "Rohini Arya";
console.log(name);
var a = 10;
var b = 5;
var add = a + b;
console.log(add);
var subtract = a - b;
console.log(subtract);
var multiplication = a * b;
console.log(multiplication);
var division = a / b;
console.log(division); | true |
73d55bcfa9831639d14403ba67657145b523e953 | JavaScript | zhuwen1/weixin_test | /lib/wechat_material.js | UTF-8 | 6,598 | 2.546875 | 3 | [] | no_license | 'use strict';
// 素材增删改查
const config = require('../config/config.json');
const AccessToken = require('./wechat_access_token.js');
const utils = require('./utils.js');
const prefix = config.wechat.prefix;
// 素材接口
const api = {
upload: prefix + 'media/upload?', // 新增临时素材 api
addNews: prefix + 'material/add_news... | true |
2b0ee782c3ed73a5804f81d88a8dc5f2c1af4153 | JavaScript | jcmedina1/Talle-de-JavaScript | /public_html/11/js/code_js.js | UTF-8 | 167 | 3.09375 | 3 | [] | no_license | var x = '*';
var final = 6;
var posicion = 1;
var c = "";
do {
c = c + x;
if (posicion < final) {
console.log(c);
}
posicion++;
} while (posicion <= final)
| true |
686cfc1f1d13029002d32371d7185bfbf9d781a6 | JavaScript | day0ff/WEB-API | /Speech_API/speech_01_basic/public/js/script.js | UTF-8 | 1,874 | 2.765625 | 3 | [] | no_license | window.onload = ()=>{
const language = document.querySelector('select');
const save = document.querySelector('button');
const content = document.querySelector('content');
// TODO Implement check for support. Gecko is currently not support it.
window.SpeechRecognition = window.SpeechRecognition || w... | true |
bab7bef76f710cb9e9fff0dc3fa5f4cc7fd0fa18 | JavaScript | xlzy520/leetcode | /91学算法/二分专题/examples/367. 有效的完全平方数.js | UTF-8 | 1,166 | 4.0625 | 4 | [] | no_license | // 给定一个 正整数 num ,编写一个函数,如果 num 是一个完全平方数,则返回 true ,否则返回 false 。
//
// 进阶:不要 使用任何内置的库函数,如 sqrt 。
//
//
//
// 示例 1:
//
// 输入:num = 16
// 输出:true
// 示例 2:
//
// 输入:num = 14
// 输出:false
//
//
// 提示:
//
// 1 <= num <= 2^31 - 1
//
// 来源:力扣(LeetCode)
// 链接:https://leetcode-cn.com/problems/valid-perfect-square
// 著作权归领扣网络所... | true |
343ecc56349ae4d974abe01387406b12773e6551 | JavaScript | bereczb/zerda-exam-web | /test.js | UTF-8 | 1,395 | 2.78125 | 3 | [] | no_license | 'use strict';
var test = require('tape');
var validator = require('./validator.js');
test('validator accepts valid email, a scale of 15 and positive feedback', function (t) {
t.equal(validator('ineffable mirthful outstanding', 15, 'alma@alma.hu'), true);
t.end();
});
test('validator rejects unfilled email, a sca... | true |
7989970f2a80698052953cbffc2d5475f11bc33f | JavaScript | MichaelLubow/capital_one_coding_challenge | /requests.js | UTF-8 | 10,455 | 2.84375 | 3 | [] | no_license | var request = require('superagent');
function makeDeleteRequest(apiEndpointURL){
request
.delete(apiEndpointURL)
.set('Accept', 'application/json')
.end(function(err, res){
if(!err){
console.log("Inside success of DELETE Request");
console.log("The results are:");
console.lo... | true |
ef1e163817e6c0eff991555dadfaedfd488fdb5c | JavaScript | jdafforn072/lab5 | /grocerylist.js | UTF-8 | 311 | 3.21875 | 3 | [] | no_license | var myList = [{
item: "Coffee ",
price: 2.95,
},
{
item: "Milk ",
price: 1.99,
},
{
item: "Hot Dogs ",
price: 2.15,
},
{
item: "Bananas ",
price: .99,
}]
var total = 0
myList.forEach (function(list){
console.log(list.item + "= $" + list.price);
total += list.price;
})
console.log("Total = $" + total) | true |
b5b05602029a0f3b6cd837e81f57b1bd31aeda31 | JavaScript | mukulrider/ranging_frontend | /app/components/BarChart2/index.js | UTF-8 | 2,425 | 2.625 | 3 | [
"MIT"
] | permissive | /**
*
* BarChart2
*
*/
import React from 'react';
import * as d3 from 'd3';
import styles from './style.scss';
class BarChart2 extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
createChart = (data) => {
var svg = d3.select("#barChart2"),
margin = {top: 20, rig... | true |
3c1c40b2faf536efeedf645262016e21872ee2f6 | JavaScript | MobyusJava/JQDemo | /WebContent/scripts/jquery-ajaxcalls2.js | UTF-8 | 1,576 | 2.96875 | 3 | [] | no_license | //executed on load, couple all buttons with the handlers.
$(function() {
//validate form and call servlet when valid
$("#button-1").click(function(){
$("#data-from").validate();
if($("#data-form").valid()){
showName();
}
}
);
$("#data-form2").validate( {
debug:... | true |
067d0a5652f1286ec4f956ebc8221de5af1aa47d | JavaScript | seanhess/MarketHealth | /lib/common.js | UTF-8 | 1,510 | 2.640625 | 3 | [] | no_license | (function() {
var addToProto, copy, partial, partialr, toProto,
__slice = Array.prototype.slice;
toProto = exports.toProto = function(method) {
return function() {
Array.prototype.unshift.call(arguments, this);
return method.apply(null, arguments);
};
};
addToProto = exports.addToProto... | true |
4568e8350dcf18f51119507af589e60ae147262f | JavaScript | decookr/weekend-challenge-2 | /server/routes/math.js | UTF-8 | 1,185 | 2.890625 | 3 | [] | no_license | var express = require('express');
var router = express.Router();
var guessArray = [];
var addedNumbers = [];
router.post('/addition', function(req, res){
guessArray = req.body.numbers;
console.log('guessArray', guessArray);
addedNumbers = [Number(guessArray[0])+Number(guessArray[1])];
res.sendStatus(20... | true |
2065b686375e4d1dbad2293e39cee1ad74b8842a | JavaScript | delateurj/multi_user_poker_manager | /server/poker/readLog.js | UTF-8 | 3,696 | 2.515625 | 3 | [] | no_license | const fs = require("fs");
const { forEach } = require("p-iteration");
const getEventLogList = require("./mavensAPI").getEventLogListAxios;
const getEventLog = require("./mavensAPI").getEventLog;
async function processLogs() {
try {
let result = await getEventLogList();
let output = "";
let players = {};... | true |
ec5ffde74273583bd63058e0b7200ebbfb847f0f | JavaScript | sidhu111/reactfiles | /my-react-app/src/components/Order.js | UTF-8 | 1,187 | 2.78125 | 3 | [] | no_license | import React, { Component } from "react";
export default class Order extends Component {
state = {
cart: ["Muni", "Babu"],
};
saveInput = (e) => {
this.setState({ input: e.target.value });
};
addNewItem = () => {
let { cart, input } = this.state;
cart.push(input);
... | true |
c0fc78f80b96c0e44ad665be9fd20a2c814fb9f4 | JavaScript | rajitaroy/Quiz-App | /src/App.js | UTF-8 | 2,735 | 2.8125 | 3 | [] | no_license | import React, { useState } from 'react';
export default function App() {
const questions = [
{
questionText: '____ JavaScript is also called client-side JavaScript.',
answerOptions: [
{ answerText: 'Microsoft', isCorrect: false },
{ answerText: 'Navigator', isCorrect: true },
{ answerText: 'LiveWi... | true |
37d96d1f9d4d9167f949b0a3280c0fa4eddd8d86 | JavaScript | nguyenque/mazegame | /demo.js | UTF-8 | 1,151 | 2.75 | 3 | [] | no_license | const { Engine, Runner, World, Render, Bodies, MouseConstraint, Mouse } = Matter
const engine = Engine.create()
// when you create engine you get world object along with it
const { world } = engine
const width = 800
const height = 600
const render = Render.create({
element: document.body,
engine: engine,
options:... | true |
7d3abc48ee726690e6ecac86f02d7043fc0ac360 | JavaScript | crazydev901/esports-platform | /resources/assets/src/core/boot/js/pubsub.js | UTF-8 | 2,057 | 2.625 | 3 | [] | no_license | /**
*------------------------------------------------------------------------------
*
* Reusable Event/PubSub System
*
*/
bind('pubsub', {
singleton: false,
value: function() {
'use strict';
let events = new Map();
const dispatch = (key, data, context) => {
let ke... | true |
41592ca912926eeac00bb4499a2e47a49e8ef92e | JavaScript | ceciCoding/Donuts-store | /Scripts/main.js | UTF-8 | 1,859 | 3.015625 | 3 | [] | no_license | 'use strict';
const images = ['../Images/pink.jpg', '../Images/blue.jpg', '../Images/yellow.jpg', '../Images/white.jpg', '../Images/boston.jpg', '../Images/apple.jpg', '../Images/choco.jpg'];
const cartAddContainer = Array.from(document.querySelectorAll('.cart-add'));
//handle plus and less signs in store elements
ca... | true |
86b891e0aa1c7ce33b926c2dd5e49418f4eae879 | JavaScript | Diego-Luna/Fundamentos-de-Node.js | /modulos/globales.js | UTF-8 | 320 | 3 | 3 | [] | no_license | let i = 0;
let intervalo = setInterval(function () {
console.log("Hola");
if(i==3){
//
clearInterval(intervalo);
}
i++;
},1000)
setImmediate( function() {
console.log("Hola como estas");
})
console.log(__dirname);
console.log(__filename);
global.miVariable = 'elValor';
console.log(miVariable);
| true |
2a9614716df3cf252e9a87a88a4540f538dd3de1 | JavaScript | pierrealainkeyser/JANetRunner | /ANR/src/main/resources/static/js/anr/inputmanager.js | UTF-8 | 2,218 | 2.71875 | 3 | [] | no_license | define([ "mix", "mousetrap", "geometry/point" ], function(mix, Mousetrap, Point) {
function InputManager(boardstate) {
this.boardstate = boardstate;
Mousetrap.bind("up", this.up.bind(this));
Mousetrap.bind("down", this.down.bind(this));
Mousetrap.bind("left", this.left.bind(this));
Mousetrap.bind("ri... | true |