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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
0d26836d23fd1507decea7ecaeb22e46dd214dfa | JavaScript | e-truman/honey-rae-repairs | /src/components/employees/EmployeeList.js | UTF-8 | 1,372 | 3.046875 | 3 | [] | no_license | import React, { useEffect, useState } from "react"
import { Link, useHistory } from "react-router-dom"
export const EmployeeList = () => {
const [employees, changeEmployee] = useState([])
const [specialties, setSpecial] = useState("")
const history = useHistory()
useEffect(
() => {
... | true |
eeb043da8293db8d3f4d56879e0a9c9c52d681fb | JavaScript | bosoy83/Alideria | /htdocs/js/days_timer.js | WINDOWS-1251 | 2,794 | 2.765625 | 3 | [] | no_license | var show_timer_title = false;
function GetTimeStr( a, b, c, d )
{
d0 = new Date( );
a = a + ( b - d0.getTime( ) ) / 1000;
a=Math.round(a);
if( a <= 0 )
{
eval( d );
window.top.document.title = window.top.tstr;
return -1;
}
d = Math.round( ( a / 3600 - 0.5 ) / 24 );
h = Math.round( a / 3600 - 0.5 );
... | true |
4e09477f6d7f300d3855bd454ad43f9e9f0c8d1b | JavaScript | AndreBClark/skills-assessment | /src/js/app.js | UTF-8 | 4,117 | 2.625 | 3 | [] | no_license | const view = {
status: {
online: '#04f621',
away: '#b1b11a',
offline: '#fb0101',
busy: '#fdfd00',
},
};
const model = [{
status: view.status.online,
name: 'Christian',
email: 'christian@yahoo.com',
phone: '323-555-1234',
},
... | true |
e7f5cc5ccf73023719541a7466c33a3f5504a1da | JavaScript | dfgp01/ecs2 | /src/framework/lib/collide/utils/box.js | UTF-8 | 4,761 | 2.640625 | 3 | [] | no_license | import { GetRectHalfHeight, GetRectHalfWidth } from "../../../foundation/structure/geometric";
import { Abs } from "../../../foundation/structure/math";
/**
* 碰撞位置关系
*/
export const COLLIDE_LR = 1; //左右
export const COLLIDE_RL = 2; //右左
export const COLLIDE_X = 3; //x轴
export const COLLIDE_UD = 4; //上下... | true |
47f72e83269a6e2cf7536c2b0dfd52e851675f3d | JavaScript | anchvy/bills-exchange-calculator | /src/utils/currency.js | UTF-8 | 756 | 2.859375 | 3 | [] | no_license | import { DOLLAR_TO_PENNY } from '../config/currency'
import { getFloatNumber, numberFormat } from './number'
/**
* Calculate bills count with given dollar
* @param {number} dollar
* @param {boolean} [withFormatNumber = false]
* @return {Bills}
*/
export const calculateBillCount = (dollar, withFormatNumber = false... | true |
dc51c02b15149254b1a3258c76be94dd02dffb99 | JavaScript | rsbondi/hbook | /src/renderer/store/modules/library.js | UTF-8 | 4,120 | 2.546875 | 3 | [
"MIT"
] | permissive | const state = {
currentBook: -1,
currentCollection: 1,
books: [],
collections: [],
settings: {},
preload: ""
}
const mutations = {
set_books (state, payload) {
state.collections = payload.collections,
state.books = payload.books,
state.settings = payload.settings
},
set_current_book (stat... | true |
325b2df09c4d85bd011eddf27c179577c1114ad0 | JavaScript | XccelerateTech/melodywong | /08-ajax/H/script.js | UTF-8 | 870 | 3.125 | 3 | [] | no_license | /*Once the user hovers over the 4 icons, they should increase in size by 40%,
once the users mouse leaves the icons their size should decrease to normal again*/
window.onload = function() {
var resize=document.getElementsByClassName("icon");
[...resize].forEach(function(resize){
resize.addEventL... | true |
cc236faea0b71b9f734761da426e4f0cbc70da50 | JavaScript | SmallURL/SmallURL-v2 | /assets/global/js/smallurl.js | UTF-8 | 8,812 | 2.625 | 3 | [] | no_license | /* SmallURL Javascript Core by Thomas Edwards
* Copyright 2013-14 SmallURL
* Do not attempt to exploit the SmallURL Service
*/
function generate_smallurl() {
var url = encodeURIComponent($('#url_box').val());
var api_url = "http://"+document.domain+"/api/?url="+url;
// Check if someones trying to make a cus... | true |
e082c7b6cfa6c78908144a60892ae3f56353af61 | JavaScript | kristenkrofchik/pirate-chicks-vintage | /backend/models/user.js | UTF-8 | 4,754 | 2.859375 | 3 | [] | no_license | //User class for Pirate Chicks Vintage
"use strict";
const db = require('../db');
const bcrypt = require('bcrypt');
const { sqlForPartialUpdate } = require('../helpers/sql');
const { NotFoundError, BadRequestError, UnauthorizedError } = require('../expressError');
const { BCRYPT_WORK_FACTOR } = require('../... | true |
9af5e115bcf7092153c63ced25775d2b89732164 | JavaScript | jdvolk/frontend-module-0-capstone | /day_7/my_website/script.js | UTF-8 | 283 | 2.859375 | 3 | [] | no_license | function addPara(){
var newPara = document.createElement("p");
var addInfo = document.createTextNode("paragraph goes here");
newPara.appendChild(addInfo);
var getFooter = document.getElementById("footer");
document.body.insertBefore(newPara, getFooter);
}
| true |
81e1229a35a290988fd7a2de1e4232a79fd3a500 | JavaScript | sadpeach/trello | /src/Component/boardForm.js | UTF-8 | 3,903 | 2.515625 | 3 | [] | no_license |
//react import
import React, { useEffect, useState } from 'react';
//material ui import
import TextField from '@mui/material/TextField';
import Dialog from '@mui/material/Dialog';
import DialogActions from '@mui/material/DialogActions';
import DialogContent from '@mui/material/DialogContent';
import DialogTitle from ... | true |
b8f9d3e95acee830994fb95ca74c984e2dfcfcc2 | JavaScript | Shubham92166/WebdriverIo | /test/pageobjects/firstSearchElement.page.js | UTF-8 | 1,050 | 2.515625 | 3 | [] | no_license | const { expect } = require('chai')
const firstElementOfSearch=require('../elements/clickFirstElemOfSearch.element')
class FirstSearchElement
{
contentOfFirstSearchElement()
{
const b=firstElementOfSearch.textOfTitle.getText()
console.log(b)
return b
}
firstSearchElement(... | true |
f026cbeb44763b0861e732880af232cc6b73784e | JavaScript | rgarimella0124/JS-Scripts | /kelvin.js | UTF-8 | 403 | 3.453125 | 3 | [] | no_license | var readline = require("readline");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.question("Enter The Current Weather in Kelvin Scale ", kelvin => {
const celsius = kelvin - 273;
let fahrenheit = celsius * (9 / 5) + 32;
fahrenheit = Math.floor(fahrenheit);
conso... | true |
9d23d9f993714ae83efe2328c93c9cc1509b962b | JavaScript | ShaharDawnAl/reactCapabilities | /src/components/MemoComp.js | UTF-8 | 280 | 2.53125 | 3 | [] | no_license | import React from 'react'
//Memo is like pure component for class only for a Functional component
function MemoComp({name}) {
console.log('Rendering Memo Component');
return (
<div>
{name}
</div>
)
}
export default React.memo(MemoComp);
| true |
3bbfae785e40a54f51792a09324dc319a783ba16 | JavaScript | Sam152/Sams-Canvas-RTS | /res/js/map-maker/PaintBucket.js | UTF-8 | 4,892 | 2.765625 | 3 | [] | no_license | /**
* Represents an encounter between a group of players.
*/
var PaintBucket = klass(function(settings) {
this.settings = _.extend({
'context' : false,
'terrain' : false,
'grid' : false
}, settings);
this.active_paint = false;
this.map_state = new MapState({
'grid' : this.settings.grid,
... | true |
d29d78c92986e56a5dab85a85623d4d8ffbb69fa | JavaScript | cadeburkett/Weather-Dashboard | /script.js | UTF-8 | 6,069 | 3.03125 | 3 | [
"MIT"
] | permissive | function getSearchVal() {
var searchValue = document.querySelector("#search-value").value;
searchWeather(searchValue);
makeRow(searchValue);
}
function makeRow(searchValue) {
var liEl = document.createElement("li");
liEl.classList.add("list-group-item", "list-group-item-action");
var text = searchValue;
... | true |
6a6ecb5a478130a8ad336d56e6f518e9622763ae | JavaScript | jadefalcon51/persanal-portfolio | /Pokemon/pokemon.js | UTF-8 | 6,904 | 3.328125 | 3 | [] | no_license | import { removeChildren } from "../utils/index.js";
const pokeGrid = document.querySelector(".pokeGrid");
const loadButton = document.querySelector(".loadPokemon");
const fetchButton = document.querySelector(".fetchPokemonByID");
const newButton = document.querySelector(".newPokemon");
let offset = 251;
let limit = 2... | true |
d2f5ba2016d68ad8c5538e56fa21878bbb167335 | JavaScript | harjothkhara/scripts | /commands/companies.js | UTF-8 | 3,270 | 2.8125 | 3 | [
"MIT"
] | permissive | 'use strict'
/**
* Dependencies
*/
const fs = require('fs');
const path = require('path');
const chalk = require('chalk');
const meow = require('meow');
const cheerio = require('cheerio');
const scrape = require('./scrape');
const showHelp = require('../helpers/showHelp');
const lastModified = require('../helpers/l... | true |
475a55437e0361a741ea728737d0e92474ced264 | JavaScript | megcho/wanderout | /index.js | UTF-8 | 2,307 | 3.625 | 4 | [] | no_license | window.addEventListener('DOMContentLoaded', () => {
console.log('DOM fully loaded and parsed')
getParks()
addEventListeners()
})
// Fetch
let parks
function getParks() {
const url = 'https://developer.nps.gov/api/v1/parks?api_key=wSlcKl1LSOpHXf164FTShbQZC4cmu1VWTJiipnFk&limit=500'
fetch(url)
.then(r... | true |
34c10216803eaf24bf99bd485811d39cbe54aba0 | JavaScript | parsakafi/khanacademy-video-downloader | /functions.js | UTF-8 | 2,307 | 2.953125 | 3 | [
"MIT"
] | permissive | const fs = require('fs');
const URL = require('url').URL;
const path = require('path');
const https = require('https');
String.prototype.trimLeft = function (charlist) {
if (charlist === undefined)
charlist = "\s";
return this.replace(new RegExp("^[" + charlist + "]+"), "");
};
String.prototype.trimR... | true |
423b4e9aca140f6c371889b4ae3ef18f99416261 | JavaScript | lihubadboy/webpack-demo | /src/hello.js | UTF-8 | 161 | 2.9375 | 3 | [] | no_license | var name = "";
function setName(n) {
name = n;
}
function printName() {
console.log(name);
}
exports.setName = setName;
exports.printName = printName;
| true |
ff6a7965b7ba8094dc3df72044face4357f034be | JavaScript | elax102/Helsinki_Course | /exercise1-1/src/App.js | UTF-8 | 1,097 | 3.1875 | 3 | [] | no_license | import React from 'react'
const Header = (props) => {
console.log(props);
return(
<h1>{props.course}</h1>
)
}
const Content = (props) => {
return(
<div>
{props.parts.map(part => (
<Part pNum={part.name} eNum={part.exercises} />
))}
</div>
)
}
const Part = (props) => {
retu... | true |
20d84b3ed5c1ac4b8d3a1accd54025431d65d3ed | JavaScript | airqinc/airq-web-server | /routes/index.js | UTF-8 | 741 | 2.5625 | 3 | [] | no_license | const path = require('path');
var dataModel = require('../models/data');
module.exports = function(app)
{
app.get("/", function(req, res)
{
console.log(dataModel.msg);
res.end();
});
app.get("/parametros/:nombre", function(req, res)
{
dataModel.parametros(req.params.nombre... | true |
907c62bae1dfd6e518933523a330f136a760f94d | JavaScript | PBRT/timgur | /client/reducers/reducer.js | UTF-8 | 3,299 | 2.578125 | 3 | [] | no_license | import { combineReducers } from 'redux';
import { routeReducer } from 'redux-simple-router';
import { REQUEST_IMAGES, RECEIVE_IMAGES, LIKE_IMAGE, DISLIKE_IMAGE, RESET_IMAGES, SET_TAG, SET_SORT } from 'images.js';
import { SET_VIEWPORT } from 'viewport.js';
// Handle the image object state
function imageItem(state = {}... | true |
2f4e63528d5f950e5574195a9281eb8400f82ab6 | JavaScript | jonathangjertsen/songwriting_tools | /tuner.js | UTF-8 | 1,238 | 3.15625 | 3 | [
"MIT"
] | permissive | document.querySelectorAll('.note').forEach(note_cell => {
note_cell.addEventListener('mousedown', click_event => {
playNoteNow(click_event.target.textContent, "guitar", 4);
});
});
document.querySelectorAll('.up').forEach(up_cell => {
up_cell.addEventListener('mousedown', click_event => {
... | true |
68fcb5184f6437ce1b657aa166cdafa0be6f3241 | JavaScript | Suhesong/expressAll | /JavaScript Feature Test/this.js | UTF-8 | 512 | 3.625 | 4 | [
"MIT"
] | permissive | //this的指向
// const user={
// name:'xiaosu',
// greet(){
// console.log(`hello everyone I a'm ${this.name}`)
// },
// mother:{
// name:'xiaoyang',
// greet(){
// console.log(`${this.name}`);
// }
// }
// }
// user.mother.greet();
function greet(xx,yy){
... | true |
0f8f0bb1f432febe7d47c61ea0cffe958327b844 | JavaScript | raineorshine/promise-guard | /index.js | UTF-8 | 930 | 3.03125 | 3 | [
"ISC"
] | permissive | var Promise = require('bluebird')
var id = function(x) { return x }
// guard a single promise
function guard(promise, map, filter, passThrough) {
if(!promise) {
throw new Error('No promise provided')
}
else if(!promise.then) {
throw new Error('Received non-thenable')
}
filter = filter || id.bind(nu... | true |
7405c25d402b61b9a28321302c494c5ec5c18c07 | JavaScript | geakstr/node-named-modules | /index.js | UTF-8 | 1,177 | 2.609375 | 3 | [
"MIT"
] | permissive | 'use strict';
var fs = require('fs');
var path = require('path');
module.exports = function() {
var config = {
name: 'namedModules',
description: 'Allows you to specify aliases for your module paths'
};
var pkg = JSON.parse(
fs.readFileSync(path.join(process.cwd(), 'package.json'))
);
var modu... | true |
696e3bf8883ae36cc6a82ba3511fdb9584c4084e | JavaScript | retrosight/formtojson | /app.js | UTF-8 | 505 | 3.0625 | 3 | [
"MIT"
] | permissive | function handleSubmit(event) {
console.log("handleSubmit");
event.preventDefault();
const data = new FormData(event.target);
const value = Object.fromEntries(data.entries());
const jsonText = JSON.stringify(value, null, 1);
result.textContent = jsonText;
}
function addHandler() {
console.log("addHandler"... | true |
ed679623f8bb274c41c253623b75c8034319a546 | JavaScript | fac22/BAgency | /script.js | UTF-8 | 9,567 | 2.78125 | 3 | [] | no_license | /* eslint-disable strict */
'use strict';
const btnFindOutMore = document.querySelector('.btn--find-out-more');
const sectionAbout = document.querySelector('#chapter-about');
const navbar = document.querySelector('.navbar');
const modal = document.querySelector('.modal');
const overlay = document.querySelector('.over... | true |
fe777b56f822bd167f28986fbc5e801fb511c72e | JavaScript | Chazz-Michaels/react-workout-builder | /src/components/selectMainExercises.jsx | UTF-8 | 1,487 | 2.640625 | 3 | [] | no_license | import React, { Component } from 'react';
class SelectMainExercises extends Component {
handleClickedMainExercise = (e) => {
e.preventDefault();
let name = e.target.name;
//console.log("main exercise clicked: " + name);
this.props.onClickedMainExercise(name);
};
render() {
return (
<d... | true |
f7a1531e904383c3cb473e536088e873b676093c | JavaScript | bruno303/app_teste_worker_thread | /src/server.js | UTF-8 | 1,013 | 2.625 | 3 | [
"MIT"
] | permissive | 'use strict'
const port = 3000;
const express = require('express');
const app = express();
const log = require('./logger.js')(false);
const Pool = require('./Pool.js');
const pool = new Pool();
/* Async Route */
app.route('/async/:num')
.get((req, res) => {
log.registerLogExec('Execução assíncrona iniciada.');
... | true |
6fbe16400117ccd514e0b19029636b5ab503d5f3 | JavaScript | femiarkh/covid-dashboard | /src/js/utils/count-per-100k.js | UTF-8 | 385 | 3.265625 | 3 | [] | no_license | /**
* Turn absolute parameter into relative per 100k population.
* @param {number} absoluteValue - Absolute parameter.
* @param {number} population - Population number.
* @returns {number} Parameter value per 100k population, two digits after dot.
*/
export default function countPer100k(absoluteValue, population) ... | true |
f3357f804c18e6562a00b6ae25c8f1006f28c8df | JavaScript | idoyudha/parcel-panda-ui | /src/actions/authActions.js | UTF-8 | 3,295 | 2.515625 | 3 | [] | no_license | import axios from "axios"
import { URL_API } from "../helper"
import { toast } from 'react-toastify';
toast.configure()
const handleNotify = () => {
toast.success('Hey 👋 Login Success!', {position: toast.POSITION.TOP_CENTER, autoClose: 3000})
}
export const authLogin = (username, password) => {
return a... | true |
f6b67dba99aba517c9126ba96509e5344fa3eb74 | JavaScript | Yandex-Practicum/web-test-task | /step-2/middlewares/validation.js | UTF-8 | 939 | 2.65625 | 3 | [] | no_license | const validator = require('validator');
const BadRequest = require('../errors/BadRequest');
module.exports.urlValidation = (value) => {
const result = validator.isURL(value);
if (result) {
return value;
}
throw new BadRequest('Ссылка не обнаружена');
};
// эта регулярка не пропускает неверное значение,
// ... | true |
d3320588d0447d80477da53c33f7b55e73cdc08d | JavaScript | ngmoco/daida.js | /handlers/test.js | UTF-8 | 894 | 2.90625 | 3 | [
"MIT"
] | permissive | /**
* The test task handler module
* This module supports the bar and foo task types.
* NOTE: all task type handler functions must take a callback
* as their last parameter and execute that callback when the
* task is finished. If no callback is passed you can simply
* call a noOp function defined in the fashion ... | true |
754eb88a6f899a96da51f42e201a056351b7288a | JavaScript | danlubbers/codewars-problems | /Kata-8/kyu8-lost-without-map.js | UTF-8 | 464 | 4.5 | 4 | [] | no_license | // https://www.codewars.com/kata/beginner-lost-without-a-map/train/javascript
// Given an array of integers, return a new array with each value doubled.
// For example:
// [1, 2, 3] --> [2, 4, 6]
// For the beginner, try to use the map method - it comes in very handy quite a lot so is a good one to know.\
const ma... | true |
bb74818690118da4a3cca28c58744195edf18fd5 | JavaScript | heidichen7/openpose-editor | /star/index.js | UTF-8 | 4,283 | 2.609375 | 3 | [] | no_license | // import interact from 'interactjs';
document.addEventListener('DOMContentLoaded', () => {
const sns = 'http://www.w3.org/2000/svg'
const xns = 'http://www.w3.org/1999/xlink'
const root = document.getElementById('svg-edit-demo')
// const lines = document.getElementById('edit-star')
// console.log(lines1)
... | true |
5b560db8c48827d19cd3179c6287b1ebbeae7205 | JavaScript | amirai92/currency-rates | /src/App.js | UTF-8 | 1,390 | 2.734375 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
import "./App.css";
const url = "https://www.live-rates.com/rates?key=44008999cd";
function App() {
const [isLoading, setIsLoading] = useState(true);
const [updateHourly, setUpdateHourly] = useState([]);
useEffect(() => {
async function fetchMyAPI() {
... | true |
8ae10f4dbb2be7102129d9c2357fd5c64f6054c3 | JavaScript | niroojen-thambimuthu/seng513.github.io | /A2/A2_JS.js | UTF-8 | 2,845 | 3.890625 | 4 | [] | no_license | /*
* Niroojen Thambimuthu 10153928
* Seng513 A2 - JavaScript file
* Feb 15, 2019
*
* A2_JS.js
*/
// Variables declaration
var x = "";
var total = "";
var ansTemp = "";
var loop = false;
var error = false;
var ans = false;
var operations = ["/", "*", "+", "-"];
/*
* Function when user clicks numbers and operands bu... | true |
cbb44c8c32eb9d465beba1098b293cec574bb004 | JavaScript | wppattonjr/dino-kennel | /javascripts/components/buttons.js | UTF-8 | 892 | 2.703125 | 3 | [] | no_license | import { showDinos } from './showDinos.js';
//import moment from 'moment';
const petDinoButton = (index, item, array) => {
$(`#pet-${index}`).click( () => {
if (item.health > 0 || item.health === 0) {
item.health += 5;
if (item.health > 100){
item.health = 100;
... | true |
f7e3c23935cad43c521da3c48b0fc48c7a6aa899 | JavaScript | wildabeast/completeui | /javascripts/src/client/treegrid/js/nitobi/treegrid/rowEventArgs.js | UTF-8 | 1,777 | 2.8125 | 3 | [
"MIT"
] | permissive | /*
* Nitobi Complete UI 1.0
* Copyright(c) 2008, Nitobi
* support@nitobi.com
*
* http://www.nitobi.com/license
*/
nitobi.lang.defineNs('nitobi.treegrid');
/**
* Constructs a RowEventArgs object.
* @class Encapsulates event arguments that are passed to event handlers subscribed to
* Grid events that deal with... | true |
d44e4005040ca3e4a6281eca51784e201a00a4a8 | JavaScript | zodun/info2180-lab3 | /tic-tac-toe.js | UTF-8 | 4,815 | 3.296875 | 3 | [] | no_license | var gameboard;
var winners;
var button;
window.onload= function(){
gameboard=document.querySelectorAll('#board div');
button= document.getElementsByClassName("btn")[0];
for (i=0; i<gameboard.length; i++){
gameboard[i].classList.add("square");
gameboard[i].addEventListener("clic... | true |
59e6d864e7f38fa2a095f89fab3c80c501c2fc6c | JavaScript | Aete/d3-60days-challenge | /src/Day18/Chord.js | UTF-8 | 3,877 | 2.5625 | 3 | [] | no_license | import * as d3 from 'd3';
import example from '../utils/data/chord_data.json';
export default function Chord(element) {
const height = 900;
const width = 900;
const svg = d3.select(element).append('svg').attr('width', width).attr('height', height);
const outerRadius = 380;
const innerRadius = 370;
const ch... | true |
1f6fcdf5ff594ce84d612c18795a3da15cf176cd | JavaScript | go-shiori/shiori-web-ext | /js/content-script.js | UTF-8 | 1,473 | 3.03125 | 3 | [
"MIT"
] | permissive | async function getPageContent() {
var html = document.documentElement.innerHTML,
title = document.title;
if (typeof html !== "string") {
throw new Error("html content not available");
}
return {
title: title,
html: html.replace(/\s+/g, " "),
};
}
async function showError(msg) {
// Remove old error dial... | true |
7020153fadc4972890f353dc5a0dd1c44185200c | JavaScript | sunnysetia93/competitive-coding-problems | /LeetCode/All/js/435.non-overlapping-intervals.js | UTF-8 | 548 | 3.15625 | 3 | [
"MIT"
] | permissive | /**
* @param {number[][]} intervals
* @return {number}
*/
var eraseOverlapIntervals = function(intervals) {
intervals.sort((a,b) => a[1] - b[1]);
if(intervals.length <= 1)
return 0;
let initialIntervals = intervals.length;
for(let i = 1;i<intervals.length;i++){
let prev = intervals[i... | true |
f9ae635848cfbeb43745854bf799fb4822ebe282 | JavaScript | electrotiti/tyboost-example | /src/models/todo.js | UTF-8 | 662 | 2.578125 | 3 | [
"MIT"
] | permissive | const uuid = require('uuid')
class Todo {
constructor (database) {
this.db = database
}
async getAll () {
const keys = await this.db.keys()
if (keys.length > 0)
return this.db.mget(keys)
else
return []
}
async create (message) {
const id = uuid.v4()
let todo = {id, mess... | true |
56d35c9e14188978b6cd878af164aead446c75fd | JavaScript | Natalija09/avrm-node | /domasna1/handlers.js | UTF-8 | 501 | 2.796875 | 3 | [] | no_license | var fs = require('fs')
fs.readFile('lica.json', 'utf8',(err,data)=>{
if(err) throw err;
const students = JSON.parse(data);
console.log(students);
var studentArray = [];
students.forEach(e => studentArray.push(e.ime + ' ' + e.prezime + '<br>'));
return flatArray = studentArray.join('');
});
con... | true |
5266737d3ffcabe6fe9462ac1ef17b4c66aaa9db | JavaScript | cakoshakib/full-stack-open | /part7/blog-frontend/src/reducers/blogReducer.js | UTF-8 | 1,770 | 2.875 | 3 | [] | no_license | /* eslint-disable indent */
import blogService from '../services/blogs'
const reducer = (state = [], action) => {
switch (action.type) {
case 'LIKE': {
const id = action.data.id
const blogToChange = state.find(blog => blog.id === id)
const changedBlog = {
...blogToChange,
likes... | true |
9ca55d353fa6de4a44aac99376a226b6fc333b2c | JavaScript | bluebrid/base-knowledge | /javascript/base/高级前端面试/20.删除字符串中的所有相邻重复项.js | UTF-8 | 282 | 3.40625 | 3 | [] | no_license | const removeDuplicates = (s) => {
let queue = [];
for(let l of s) {
const pre = queue.pop()
if (l !== pre) {
queue.push(pre)
queue.push(l)
}
}
return queue.join('')
}
const s = 'addada'
console.log(removeDuplicates(s)) | true |
fd2dc35f6f3c177d0b70e369a29fa685e6e6f8e4 | JavaScript | arbyte-br/Arbyte-Atividades | /turma-1/davipanico/Lista_3/E14.js | UTF-8 | 1,306 | 4.5 | 4 | [] | no_license | /* Fazer um algoritmo que receba 8 idades do usuário e no final ele imprimir
qual é a menor idade. */
// Variável onde chamamos o 'readline-sync'
var readline = require('readline-sync')
// Variável onde definimos o inicio do nosso contador que sera utilizado como condição para o while.
var contador = 1
// Var... | true |
80664c552bbbb52286309fa2a294b4a92b1d2271 | JavaScript | xiaoyuqing/leetcode | /leetcode/557/ReverseWordsinaStringIII.js | UTF-8 | 283 | 3.625 | 4 | [] | no_license | /**
* @param {string} s
* @return {string}
*/
// 先把字符串变成数组再反转数组,再合并数组为字符串
var reverseWords = function(s) {
let array1 = s.split(' ');
let map = array1.map((item) => item.split('').reverse().join(''));
return map.join(' ');
}; | true |
cc02b09e09e7698123c034ce92ba7fe3a2dfb069 | JavaScript | AndrewBogdanovTSS/jsenv | /src/index.js | UTF-8 | 181 | 2.640625 | 3 | [] | no_license | import './index.css';
import numeral from 'numeral';
const courseValue = numeral(1000).format('$0,0.00');
console.log(`I would earn ${courseValue} after I'll learn this course!`);
| true |
f96da2a5dc8cdf0b6ca8c83e0e8bda96886edf15 | JavaScript | erikapessoa/IoTWebAvancado | /UltimaVersao/sensor-perigo/models/user.js | UTF-8 | 1,922 | 2.640625 | 3 | [] | no_license | var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var addressSchema = new Schema ({
publicPlace: { type: String, required: true},
number: {type: Number, required: true },
neighborhood: {type: String, required: true },
city: {type: String, required: true },
state: {type: String, required: true... | true |
95989aa11402c060f805721c096f7f6667acd183 | JavaScript | jvalen/dstruct-algorithms-examples-js | /src/Queue/Queue.js | UTF-8 | 516 | 3.375 | 3 | [
"MIT"
] | permissive | /**
* Queue class
* @constructor
*/
class Queue {
constructor() {
this._data = [];
}
add(node) {
// console.log("add: " + node.value());
this._data.push(node);
}
remove() {
// console.log("shift");
return this._data.shift();
}
length() {
return this._data.length;
}
empty() {... | true |
757ddcb86fe3fbaa382c50ff2298db9e12899426 | JavaScript | chenji336/OwnAngular | /myangular/test/loader_spec.js | UTF-8 | 2,292 | 2.796875 | 3 | [] | no_license | /* jshint globalstrict: true */
/* global setupModuleLoader: false */
'use strict';
describe('setupModuleLoader',function(){
// 在其他操作前线删除这个angular属性
beforeEach(function(){
delete window.angular;
});
// The angular Global
it('exposes angular on the window',function(){
setupModuleLoader(window);
expect(windo... | true |
7ea9669723dfd0827f46fb5e04f1be7a074a57e7 | JavaScript | roxen/led-strip | /client/src/shared/Stage.js | UTF-8 | 900 | 2.78125 | 3 | [] | no_license | import StripObject from "./StripObject";
import Color from "color";
import LoopingWorm from "./LoopingWorm";
export default class Stage extends StripObject {
constructor() {
super();
this.slowWorm = new LoopingWorm({origin: 0, length: 7, speed: 2, color: Color.rgb(0, 255, 0, .2)});
this.worm3 = new Loopi... | true |
a8a3201476e4cd1e5b9eaffc5fd1499d57b7c644 | JavaScript | saimaar/react-using-callbacks-to-pass-information-lab-dumbo-web-111819 | /src/ColorSelector.js | UTF-8 | 802 | 2.59375 | 3 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import React, { Component } from 'react';
export default class ColorSelector extends Component {
// handleClick=(str) => {
// console.log(this.props);
// }
makeColorSwatches = () => (
["#F00", "#F80", "#FF0", "#0F0", "#00F", "#508", "#90D", "#FFF", "#000"].map((newColor, idx) => {
//here the s... | true |
2f41969155421773a0987424041c1bc3aa31b195 | JavaScript | sanjaybh/htmltosvg | /src/algo-utils/queue.js | UTF-8 | 563 | 3.25 | 3 | [] | no_license | 'use strict';
class Queue {
constructor() {
this.queueArr = [];
this.queueCounter = 0;
}
enqueue(items) {
this.queueArr.push(items);
}
dequeue() {
var ret;
if(this.queueCounter < this.queueArr.length) {
ret = this.queueArr[this.queueCounter];
... | true |
8d17318ac77d4926292b35b29d2b31431b657d86 | JavaScript | risduljis/praxis-academy | /novice/02-04/latihan.js | UTF-8 | 815 | 3.828125 | 4 | [] | no_license | // function main(param1,param2,callBack){
// console.log(param1, param2)
// callBack()
// }
// function myCallback(){
// console.log ('hello callback')
// }
// main(1,2,myCallback)
// const promise1 = new Promise(function(resolve, reject) {
// setTimeout(function() {
/... | true |
b8c7c37683b4ce5702699e8fbee945ab53a413d8 | JavaScript | foxovskij44/get | /script.js | UTF-8 | 511 | 2.578125 | 3 | [] | no_license | let money = prompt('Ваш бюджет на месяц?');
let time = prompt('Введите дату в формате YYYY-MM-DD');
let ob = prompt('Введите обязательную статью расходов в этом месяце');
let skok = prompt('Во сколько обойдется?');
let appData = {
money: money,
timeData: time,
expenses: {
ob : skok,
},
... | true |
adefa652640e43e6e792bcc90a743f9741d159e9 | JavaScript | nstrn-prsh/student-test-react-project | /src/test/Fetch.jsx | UTF-8 | 499 | 2.5625 | 3 | [] | no_license | import { useState, useEffect } from "react";
import axios from "axios";
const FetchComponent = (props) => {
const [data, setData] = useState(null);
useEffect(() => {
axios.get("props.url")
.then((res) => setData(res.data))
.catch((error) => console.log(error));
}... | true |
e442e0f470b78655026f72f54bd0259a8f0aaefe | JavaScript | schniedan/mapapp | /server/webapp/js/triptoken.js | UTF-8 | 1,626 | 3.015625 | 3 | [] | no_license | class TripToken {
constructor(location, textLocation, text, textSize, textColor, textFont) {
textSize = textSize ? textSize : "20";
textColor = textColor ? textColor : "#FFFFFF";
textFont = textFont ? textFont : "Arial";
this._id;
this._relatedTextId;
this._location = location;
this._textLocation ... | true |
76214c5e2bae90d217a0b14362a86ef729330b1c | JavaScript | tramynn/props-practice | /src/components/Welcome.js | UTF-8 | 256 | 2.5625 | 3 | [] | no_license | import React from 'react';
const Welcome = (props) => {
return (
<div>
<h1>Welcome {props.name}, you are currently {props.age}.</h1>
</div>
)// whatever is returned is displayed on the screen
}
export default Welcome; | true |
48295b63e9c5b94d9b658bea026f27fb77afa9c5 | JavaScript | Code-Cacophony/fortune2 | /js/scripts.js | UTF-8 | 1,108 | 3.296875 | 3 | [
"MIT"
] | permissive | $(document).ready(function(event){
$("#form").submit(function(event){
event.preventDefault();
var luckyArray= [];
var unluckyArray = [];
$("input:checkbox[name=lucky-sign]:checked").each(function() {
var luckySign = $(this).val();
luckyArray.push(luckySign);
});
$("input:checkbo... | true |
ccdcbf834aedede4054ea502b2631dbfac4863e4 | JavaScript | shailza85/DotNet-React | /ClientApp/src/components/Layout.js | UTF-8 | 866 | 2.515625 | 3 | [] | no_license | import React, { Component } from 'react';
import { Container } from 'reactstrap';
import { NavMenu } from './NavMenu';
export class Layout extends Component {
static displayName = Layout.name;
// This sets up the layout of the page. We'll have a nav menu at the top, and then this.props.children will be popula... | true |
03592b8c16c395dbc326ceda93948d175c77e1db | JavaScript | gvaitkevicius/DynamicForms | /wwwroot/Functions/Script/Coletor/Coletor.js | UTF-8 | 619 | 3.1875 | 3 | [] | no_license | window.onload = function () {
//se existe um campo de código de barras, adiciona um evento nele
let cod = document.getElementById('codigo_de_barras');
if (cod != null) {
//foca o código de barras sempre que carregar a tela
cod.focus();
//se digitar os 29 digitos do código de barra... | true |
69a8020201fdd8912844f4ca63f9c06362ec09b5 | JavaScript | narenkvns/assesment3 | /main.js | UTF-8 | 9,990 | 2.953125 | 3 | [] | no_license | /*var arrHead = new Array();
arrHead = ['DEGREE', 'INSTITUTION','YEAR OF PASSING',"MARKS"];
function getJson(file,callback){
var xhr = new XMLHttpRequest();
xhr.overrideMimeType("application/json");
xhr.open("GET",file,true);
xhr.onreadystatechange=function(){
if (xhr.readyState===4 && x... | true |
a8b61de16d0b1b1c28aa5734f3cab1eab8eda0a1 | JavaScript | LiaozhiCheng/CramSchoolApp | /static/assets/js/teacher_grade.js | UTF-8 | 8,084 | 2.671875 | 3 | [] | no_license | var globalData;
function uploadData(grade_no) {
var data = JSON.stringify(globalData[grade_no]);
$.ajax({
url: api_edit_course_grade, //後端的URL
type: "POST", //用POST的方式
dataType: "json", //response的資料格式
contentType: 'application/json; charset=utf-8',
data: ... | true |
03f5b39f4dc167a86bcf8947ff02439a524b251e | JavaScript | dtollett1/color-picker | /src/App.jsx | UTF-8 | 1,983 | 3.015625 | 3 | [] | no_license | import React, { Component } from 'react'
class App extends Component {
state = {
hue: 75,
saturation: 75,
lightness: 75,
}
handleMoveHueSlider = event => {
this.setState({ hue: event.target.value })
console.log(event.target.value)
}
handleMoveSaturationSlider = event => {
this.setSta... | true |
13291039fcdbc338d59c92ab2ae09def410de467 | JavaScript | PatrikBichis/telepresence-robot-web | /index.js | UTF-8 | 2,032 | 2.765625 | 3 | [] | no_license | const request = require('request');
const express = require('express')
const app = express()
const MegaPi = require("./src/megapi").MegaPi;
const port = 3000
var bot = undefined;
var servo1 = 90;
var servo2 = 90;
/* Route for static files */
app.use(express.static('public'));
/* Proxy route for web camera */
app.get... | true |
5d67ce8405881a1b2da63f787da7ed39f8d7320e | JavaScript | juanchetti/juanchetti.github.io | /snake/snake2.js | UTF-8 | 3,713 | 3.640625 | 4 | [] | no_license | var body, step;
// Properties __________________________________________________
var xMin = 0;
var xMax = 500;
var yMin = 0;
var yMax = 500;
var speed = 1;
var fps = 60;
var interval = 1000 / fps;
var direction = 38 // direccion es la variable en donde se esta movinedo la tecla
var key =
{... | true |
66fc791518f73f7529e4ea56da6bf3ae78193535 | JavaScript | ortizmas/www.psi.com.bs | /default/public/javascript/psi/valida-forms.js | UTF-8 | 1,675 | 2.5625 | 3 | [] | no_license | $(function(){
$('input[placeholder], textarea').placeholder();
});
/***********Validar formulario*************/
$.validator.setDefaults({
errorElement: "label",
onfocusout: function(element) { $(element).valid(); },
success: function(label)
{
/*
var temp... | true |
ba3768e985393d2d3848a899e9159e6f2582c4ff | JavaScript | EbertAndrew/week1Basics | /Week 4/object.js | UTF-8 | 801 | 4.125 | 4 | [] | no_license | /**
* Shoes
* SHOE PROPERTIES
* material = canvas
* color = blue
* type = running
* vintage? = false
* laces? = true
* size = 10.5
* brand = undefined
*
* SHOE FUNCTIONS:
* tie
* untie
* clean
* wear
*
*/
var enomaShoe = {
material: "canvas",
color: "blue",
type: "running",
vintage ? ... | true |
de730bfc7d1315229dcc254957b6fc1806acfdb5 | JavaScript | lawrencehan650/react-boilerplate | /server/routes/categories.js | UTF-8 | 1,999 | 2.546875 | 3 | [] | no_license | const express = require('express');
const expensesController = require('../controllers/expensesController');
const incomeController = require('../controllers/incomeController');
const savingsController = require('../controllers/savingsController');
const router = express.Router();
// READING CATEGORIES
router.get('/... | true |
5104ffd1ce554ad4538b718dce9c95821867b672 | JavaScript | onethreefive/JavaScriptRaytracer | /raytracer.js | UTF-8 | 7,754 | 2.953125 | 3 | [] | no_license | var CANVAS_WIDTH = 400;
var CANVAS_HEIGHT = 400;
var AMBIENT_COEFF = 0;
var SPECULAR_COEFF = 0;
var DIFFUSE_COEFF = 2;
//Vector Class
function Vec3 (x, y, z)
{
if( !(this instanceof Vec3) ){
alert( 'Vec3 constructor was called without "new"');
}
this.x = x;
this.y = y;
this.z = z;
}
//Vec... | true |
c5fe1c7516333a4ab78c6f2ab18639f925a39c9b | JavaScript | lisaolson/general-animals | /js/main.js | UTF-8 | 2,201 | 2.65625 | 3 | [] | no_license | // Add rotation to pawprint, fill in circle color, add gradient to bar
function cartClick() {
TweenMax.to("#icon", 1.5, { left: "29.7%", rotation: 0})
TweenMax.to(".bar", 5, { background: "linear-gradient(to right, #ededed 0%,#ededed 43%,#ededed 50%,#ededed 100%)" })
TweenMax.to(".cart", 1.5, { backgroundC... | true |
aafc9a008f3d671e55fffc05e20d4bb06e72c532 | JavaScript | rodrigocdfidencio/Trybe_ex | /exercises/Fundamentos Desenvolvimento Web/bloco_4/dia_1/ex4/salario.js | UTF-8 | 1,010 | 3.21875 | 3 | [] | no_license | let salarioBruto = 3000
if (salarioBruto <= 1556.94) {
salarioINSS = salarioBruto - (salarioBruto * 0.08)
} else if (salarioBruto >= 1556.95 & salarioBruto <= 2594.92) {
salarioINSS = salarioBruto - (salarioBruto * 0.09)
} else if (salarioBruto >= 2594.93 & salarioBruto <= 5189.82) {
salarioINSS = salarioB... | true |
da56ea415254c58ba19ff1e9ecb3791e0ca82b5c | JavaScript | simran61/mark12-Triangle-quiz | /javascript/area.js | UTF-8 | 4,388 | 3.546875 | 4 | [] | no_license | const ques1 = document.querySelector('.ques1');
const ques2 = document.querySelector('.ques2');
const ques3 = document.querySelector('.ques3');
const base = document.querySelector('.base');
const height = document.querySelector('.height');
const sidea = document.querySelector('.sidea');
const sideb = document.querySe... | true |
04a7d6480052255808a07f6a3d24b6d9092aedb7 | JavaScript | bng44270/bng44270.github.io | /js/pluscode.js | UTF-8 | 1,508 | 3.71875 | 4 | [] | no_license | /*
PlusCode : Generate Plus Codes for geolocation from lat/long
Usage:
var loc = new PlusCode(40.710947,-74.836253);
// loc.plus = "87G7P567+9F"
loc.lat = 50.432
// loc.plus = "9727C5J7+RF" <==== Automatically updates
loc.lng = 60.123
// loc.plus = "9J22C4JF+R6" <==== Automatically updates
*/
cla... | true |
648033c495b341efa599d134fed8a70a7a6aa579 | JavaScript | hyderly/expense-tracker | /src/providers/budegt.provider.jsx | UTF-8 | 1,350 | 2.703125 | 3 | [] | no_license | import React, {useState, useEffect, createContext} from 'react';
import {addItems, removeItems, getBalance, getIncome, getExpense} from './utilities';
export const BudgetContext = createContext({
transactions : [],
addItem : () => {},
removeItem : () => {},
changeText: () => {},
changeAmount : (... | true |
3d4cd15be6e0c7e18f726b2d433df468eb3bc1ac | JavaScript | sophieluo/wechat-todo | /pages/index/index.js | UTF-8 | 2,897 | 2.59375 | 3 | [
"MIT"
] | permissive | //index.js
//get app
var app = getApp()
Page({
data: {
todo: '',
todos: [],
filterTodos: [],
filter: 'all',
userInfo: {},
activeCount: 0,
},
bindTodoInput(e) {
this.setData({
todo: e.detail.value
});
},
saveTodo(e) {
const { todo, todos, filterTodos, filter, activeCou... | true |
c680920e446a4cf6402f2eacd15b67d74c6548f1 | JavaScript | antrikshmisri/weather-app | /app.js | UTF-8 | 1,245 | 3.125 | 3 | [] | no_license | const form = document.querySelector('form');
const input = document.querySelector('.search');
const apikey = '148f3b7cdd7266c62d316dd05a19cb36';
const countryname = document.querySelector('.country h1');
const weather = document.querySelector('.weather');
const temperature = document.querySelector('.temp p span');
cons... | true |
4edd43deb9eb649a43cfbf33b41de8835f0bded0 | JavaScript | sentinel-official/sentinel | /master-node-nodejs/__mocks__/factories/user.factory.js | UTF-8 | 544 | 2.671875 | 3 | [
"MIT"
] | permissive | /**
* Create fake user for testing
*/
import faker from 'faker';
import BaseFactory from './base.factory';
class UserFactory extends BaseFactory {
/**
* Create a user
*
* @public
* @param {Object} attrs of user
* @returns {Object} a fake user
*/
generate(attrs) {
return {
name: `${f... | true |
c1dabfdcec5c781a5108819c35071cb4210ba32c | JavaScript | snmsoodan/service-learning | /public/client/views/admin/forms/forms.controller.js | UTF-8 | 2,828 | 2.625 | 3 | [] | no_license | (function(){
"use strict";
angular.module("ServiceLearningApp")
.controller("FormController",FormController);
function FormController(FormService,$rootScope){
var vm = this;
vm.addForm = addForm;
vm.updateForm = updateForm;
vm.deleteForm = deleteForm;
vm.sel... | true |
b4c6925742072d32ab2c645f3e2875392c15ede1 | JavaScript | Eruanne2/TracNova | /frontend/src/components/charts/scattered_chart.jsx | UTF-8 | 2,022 | 2.578125 | 3 | [] | no_license | // This will be for the shared datapoint scatter chart.
// It will show the correlation line (a reference line).
import React from 'react';
import {
ResponsiveContainer,
ScatterChart,
Brush,
XAxis,
YAxis,
ReferenceLine,
Scatter,
Tooltip,
ComposedChart,
Baseline
} from 'recharts';
// import '../../... | true |
c9083be6e8a9d8c5f8cdf5901453fd66bc05a7f6 | JavaScript | huigao80/autotest | /izppy/static/js/select-user.js | UTF-8 | 4,800 | 3.203125 | 3 | [] | no_license |
function addNewCase(test)
{
for (var k=0;k<test.length;k++)
{
if (test =='')
{alert("请选择用例!");}
else
{
var temp = getalldata('casetable');
var name = test[k].split('=')[1];
if (!temp.in_array(name))
{
//先创建行tr
... | true |
314b2c3d648a18ea2fbc9952c07d6acdb7a81e7e | JavaScript | stuartm/buttercup-importer | /source/importers/KeePass2XMLImporter.js | UTF-8 | 3,680 | 2.609375 | 3 | [
"MIT"
] | permissive | const fs = require("fs");
const xml2js = require("xml2js");
const VError = require("verror");
const { Vault } = require("buttercup");
function extractString(obj) {
if (typeof obj === "string") {
return obj;
} else if (Array.isArray(obj)) {
var first = obj.length > 0 ? obj[0] : false;
if... | true |
edae58322abaa3f8b4ad06b7775e848ede4f8e87 | JavaScript | viprs/html_for_selenium | /js/common_form.js | UTF-8 | 3,926 | 2.9375 | 3 | [] | no_license | // 全局变量a和b,分别获取用户框和密码框的value值
var a = document.getElementsByName("user")[0].value;
var b = document.getElementsByName("password")[0].value;
//用户框失去焦点后验证value值
function oBlur_1() {
a = document.getElementsByName("user")[0].value;
if (!a) { //用户框value值为空
document.getElementById("remind_1").innerHTML = "请输入用户名!";... | true |
9da51e67553d7d94327a64248c173911b2674383 | JavaScript | mimvdb/fat-flappy | /src/renderer.js | UTF-8 | 1,918 | 2.84375 | 3 | [
"MIT"
] | permissive | import { EntityRenderer } from './renderers/entity';
import State from './state';
import { BackgroundRenderer } from './renderers/background';
import { UiRenderer } from './renderers/ui';
export class RenderingContext {
constructor(ctx, interpolation, width, height) {
this.ctx = ctx;
this.interpolation = in... | true |
127abe832a6bf347a4934455ccdc8cca8acfc003 | JavaScript | hybridables/relike-value | /test.js | UTF-8 | 4,246 | 2.96875 | 3 | [
"MIT"
] | permissive | /*!
* relike-value <https://github.com/hybridables/relike-value>
*
* Copyright (c) 2016 Charlike Mike Reagent <@tunnckoCore> (http://www.tunnckocore.tk)
* Released under the MIT license.
*/
/* jshint asi:true */
'use strict'
var fs = require('fs')
var test = require('assertit')
var isArray = require('isarray')
... | true |
8a84a42f7c5bfa0d94eaa3ad9f4191d4d5e532a5 | JavaScript | fedechiappero/job-test-backend | /routes/post.js | UTF-8 | 1,157 | 2.515625 | 3 | [] | no_license | var express = require('express');
var router = express.Router();
var Post = require('./../models/post');
router.all('*', function(req,res,next){
res.set('Access-Control-Allow-Origin','*');
res.set('Access-Control-Allow-Methods','GET,POST');
res.set('Access-Control-Allow-Headers','X-Requested-With,Content-Type')... | true |
de21ba0c365e367390f6d994a639733ad2823ba3 | JavaScript | ChallaSumanth/rock_paper_scissor | /c.js | UTF-8 | 2,366 | 2.828125 | 3 | [] | no_license | function rps(yourchoice)
{
console.log(yourchoice);
var humanchoice,schoice;
humanchoice=yourchoice.id;
schoice=numbertochoice(randtorpsint());
console.log('computer choice', schoice);
results=decidewinner(humanchoice,schoice);
message=finalmessage(results);
console.log(results)... | true |
82de566654cd719259fda680ff10365cebb5cc50 | JavaScript | broezer/20210218 | /sketch_210218a.js | UTF-8 | 5,979 | 2.75 | 3 | [] | no_license | const Y_AXIS = 1;
const X_AXIS = 2;
let pg;
let c1, c2, c3;
let b1, b2, b3;
let t1, t2 , t3;
let cols02, rows02;
let scl02 = 40;
let w02 = 1600;
let h02 = 1200;
function setup() {
createCanvas(400, 400, WEBGL);
c1 = color(255, 204, 36);
c2 = color(255, 36, 117);
c3 = color(255, 18, 216);
b1 = color(1... | true |
69aae069ad79886a2b36487d1d80236365818883 | JavaScript | MaJunChaoGit/javascript-interview | /coding/实现一个table拖拽组件/index.js | UTF-8 | 3,450 | 3.015625 | 3 | [] | no_license | class TableDragger {
constructor(el, firstRowControl = false) {
this.table = document.querySelector(el);
this.firstRowControl = firstRowControl;
// 虚拟TR
this.vTR = null;
if (this.table) this.initEvent();
}
initEvent() {
this.initMouseDown();
}
initMouseDown() {
let downControl = (e... | true |
b4488d985624eaf9a299217d4b1dd43dab478809 | JavaScript | fresher-batch-2021/bookshop-ui | /Shipment Address.js | UTF-8 | 2,329 | 2.609375 | 3 | [] | no_license | function Shipment_validation() {
console.log("okay");
event.preventDefault() ;
var Firstname = document.getElementById("Firstname").value;
var Lastname = document.getElementById("Lastname").value;
var email = document.getElementById("email").value;
var password = document.getEl... | true |
a506176d3a1696403242264ce5a87e08c048d53e | JavaScript | trevormast/phlache_card | /app/assets/javascripts/components/_card.js.jsx | UTF-8 | 1,111 | 3.015625 | 3 | [] | no_license | class Card extends React.Component {
// create the card
constructor(props) {
super(props);
// the question will be showing when the card is first created
this.state = { questionShowing: true }
this.handleCardClick = this.handleCardClick.bind(this);
}
// when the card is clicked
handleCardCl... | true |
9f0a6d5d90a9c4599f6c8bfd9b96b3de7bb54095 | JavaScript | Chocobe/-Study-Algorithm-Solve | /백준/08_기본_수학_1/01_손익분기점.js | UTF-8 | 1,856 | 3.65625 | 4 | [] | no_license | /**
* @description
* * 월드전자는 노트북을 제조하고 판매하는 회사이다.
* * 노트북 판매 대수에 상관없이 매년 임대료, 재산세, 보험료, 급여 등 A만원의 고정 비용이 들며,
* 한 대의 노트북을 생산하는 데에는 재료비와 인건비 등 총 B만원의 가변 비용이 든다고 한다.
*
* * 예를 들어 A=1,000, B=70이라고 하자.
* 이 경우 노트북을 한 대 생산하는 데는 총 1,070만원이 들며, 열 대 생산하는 데는 총 1,700만원이 든다.
*
* * 노트북 가격이 C만원으로 책정... | true |
ea1951611d4a4dddc0665607d80fcd9b72ca50ff | JavaScript | S035779/mozu | /extension/js/background.js | UTF-8 | 782 | 2.71875 | 3 | [] | no_license |
chrome.runtime.onMessage.addListener(
function (request, sender, sendResponse) {
resrest(request.type, sendResponse);
}
);
function resrest(type, callback) {
var resturl = chrome.extension.getURL('csv/' + type);
var restres;
$.ajax({
url: resturl,
async: false,
success: function(data) {re... | true |
38e484a5a5db45a3f4a76aa6da736d812b880449 | JavaScript | leandronunescorreia/simplevectorjs | /index.js | UTF-8 | 350 | 2.734375 | 3 | [] | no_license | "use strict";
var Vec3 = require('./simplevectorjs/vec3.js');
var a = new Vec3();
a.setup(1.0, 0.0, 0.0);
var b = new Vec3();
b.setup(0.0, 1.0, 0.0);
console.log(a.dot(b));
console.log(a.vecToString());
console.log('vec a('+a.vecToString()+') + vec b('+b.vecToString()+') = '+ a.add(b).vecToString());
a = a.cross(b);... | true |