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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
a6660b65e73196de155f4ef1bf495ac2601e8d2e | JavaScript | dtcan/book-search | /src/components/SearchResult.test.js | UTF-8 | 2,846 | 2.859375 | 3 | [] | no_license | import { render } from '@testing-library/react';
import { Provider } from 'react-redux';
import { createStore } from 'redux';
import { nextPage, searchFailure, searchRequest, searchSuccess } from '../app/actions';
import { BOOKS_PER_PAGE, reducer } from '../app/reducer';
import SearchResult from './SearchResult';
it('... | true |
352be19b07880e65073d8ec6c207487495f23218 | JavaScript | sleex723/mvp-foodfinder | /database/app.js | UTF-8 | 1,369 | 2.640625 | 3 | [] | no_license | const firebase = require('firebase');
const api = require('../config/yelp.js');
var config = {
apiKey: api.FIREBASE_API,
authDomain: "hrmvp-75480.firebaseapp.com",
databaseURL: "https://hrmvp-75480.firebaseio.com",
projectId: "hrmvp-75480",
storageBucket: "hrmvp-75480.appspot.com",
messagingSenderId: "788... | true |
2bdfa1161ef230acc286a93ea6f65c337d506c57 | JavaScript | cgraaaj/stock_analyzer | /src/reducers/uptrendReducer.js | UTF-8 | 1,773 | 2.71875 | 3 | [] | no_license | import { UPTREND, CHANGE_OPTION, CHANGE_DATE } from "../actions/types";
import _ from 'lodash'
const INTIAL_STATE = {
data: [],
dates: [],
selectedDate: {},
option: "nifty",
uptrend: undefined,
uptrendWithVolume: undefined
};
const setUptrendData = (data, dateObj, option) => {
console.log(... | true |
36121e03edeb4488ae665f2897a8b4b493d534e2 | JavaScript | AsiaTitova/landing-page-bicycles | /build/js/main.js | UTF-8 | 577 | 2.578125 | 3 | [] | no_license | 'use strict';
(function () {
var body = document.querySelector('body');
var header = document.querySelector('.page-header');
var toggler = document.querySelector('.toggler');
var navigation = document.querySelector('.navigation__list');
body.classList.remove('no-js');
toggler.addEventListener('click', fu... | true |
c0f7ca9cd92d4c579d981f1686aef22de985a560 | JavaScript | marcromotarre/7meeples_office | /utils/number-of-players.js | UTF-8 | 2,100 | 2.546875 | 3 | [] | no_license | import { isBest, isRecommended } from "./bgg";
export const playersPoll = (gameData) => {
if (
gameData.boardgames.boardgame.poll.filter(
(elem) => elem["@attributes"].name === "suggested_numplayers"
)[0]["@attributes"].totalvotes === "0"
) {
return {
min: 0,
max: 0,
best: [0],
... | true |
3568d4f54caceedf7b82748b85fbd1944a7d4392 | JavaScript | yashjain28/bandwidth-sms-library | /code/libraries/BandwidthSMSLib/BandwidthSMSLib.js | UTF-8 | 2,357 | 2.984375 | 3 | [] | no_license | /**
* Type: Library
* Description: A library that contains a function which, when called, returns an object with a public API.
*/
/**
* Sends a text message using Bandwidth's REST API.
* @typedef {Object} BandwidthConfig
* @param {string} APITOKEN - Bandwidth API apiToken ex. "BC218b72987d86855a5adb921370115a20"... | true |
9fe653b14babccd2eaba6c2eccdf67e7a5693d03 | JavaScript | dmax1447/vue-todo_restapi | /express.js | UTF-8 | 2,114 | 2.8125 | 3 | [] | no_license | // импортируем express
const express = require('express');
const { v4 } = require('uuid');
// импортируем моки
const mockUsers = require('./mock/users.js')
// моки и настройки
const PORT = 3000;
let CONTACTS = [...mockUsers];
// создаем сервер
const app = express();
app.use(express.json()) // for parsing applicati... | true |
ee90c28266862241d94aa583bd0dabdc331c0cd8 | JavaScript | stathis125/frontend-statistics | /frontend/src/components/Home.js | UTF-8 | 1,610 | 2.59375 | 3 | [] | no_license | import React, { Component } from 'react';
import Grommet from 'grommet';
import { lowerCase } from 'lodash';
import 'grommet/grommet.min.css';
import EmployeesList from './EmployeesList';
import Header from './Header';
import { fetchEmployees, deleteEmployee } from '../lib/httpClient';
let initialList = [];
class Hom... | true |
906ee66a36a94f924c38f02fc93e58c5a3e555dd | JavaScript | rico-c/wechat-final | /src/redux/store.js | UTF-8 | 708 | 2.625 | 3 | [] | no_license | import { createStore } from 'redux';
const initialState = {
username: '',
users:[]
}
const nameReducer = function(state = initialState, action) {
let username = state.username;
let users = state.users;
switch(action.type) {
case 'USER_NAME':
state.username = action.username;
return state;
... | true |
84610ab5cc0592b32636d84e6382e133552ca74d | JavaScript | s-piovesan/FacturationManager | /FactureManagerAPI/controllers/InvoiceService.js | UTF-8 | 2,944 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | 'use strict';
var Invoice = require('../models/invoice');
exports.addInvoice = function(args, res, next) {
/**
* Ajoute une nouvelle invoice
*
*
* body Body_5 description d'une invoice à ajouter a la base de données
* no response value expected for this operation
**/
var invoice = new Invoice(a... | true |
ff98bcd95e29429e99a488486ec32c50e230b6a1 | JavaScript | Rafael020202/Algorithms-Problems | /prob_1180/app.js | UTF-8 | 416 | 3.546875 | 4 | [] | no_license | const input = require('fs').readFileSync('dev/stdin/file.txt', 'utf-8');
const line = input.split('\n');
line.shift();
const value = line.shift().split(' ');
let val = parseInt(value[0]), pos = 0;
for (let i = 0; i < value.length; i++) {
if (parseInt(value[i]) < val) {
val = parseInt(value[i]);
po... | true |
97a5f6d0bc70991c118627515c265aacd11ec070 | JavaScript | Tyrell0502/Javascript-Practice | /minutesToSeconds.js | UTF-8 | 221 | 3.703125 | 4 | [] | no_license | function minutesToSeconds() {
var minutes = prompt("Enter the amount of minutes: ");
var seconds = minutes * 60;
console.log("The minutes entered equates to ", seconds, " seconds.");
return seconds;
} | true |
dbd4272ec286e32573c37cbcff84baf785e568cd | JavaScript | Mriidul/Crud_App | /src/components/AddPosts.js | UTF-8 | 1,781 | 2.78125 | 3 | [] | no_license | import React, { useState } from "react";
import axios from "axios";
import TextField from "@material-ui/core/TextField";
import Button from "@material-ui/core/Button";
const AddPost = () => {
const [title, setTitle] = useState("");
const [body, setBody] = useState("");
const [userId, setUserId] = useState("");
... | true |
fe9626b107f00ef303586183bc055ade487d1eae | JavaScript | AndriySikora/sleep | /script/index.js | UTF-8 | 1,153 | 3.3125 | 3 | [] | no_license | window.onload = function(){
var app = {
fillTheStar: function(){
var star = document.getElementsByClassName('stars');
for(var i = 0; i < star.length; i++){
star[i].onclick = this.onclick;
}
},
onclick: function(e) {
var clickedStar = e.target;
var numberOfStar = parseInt(clickedStar.dataset.st... | true |
fde7a30aa33d91d76517400a45d0542aa64801e6 | JavaScript | yapawa/publicsite-grid | /makeContent.mjs | UTF-8 | 2,818 | 2.515625 | 3 | [] | no_license | 'use strict'
import got from 'got'
import { readFileSync, rmSync, mkdirSync, writeFileSync } from 'fs'
import { join, dirname } from 'path'
const contentPath = 'content'
import {parse} from 'toml'
const parseConfig = () => {
const hugoConfig = parse(readFileSync('./config.toml'))
if (process.env.HUGO_PARAMS_API)... | true |
7bbccd82c68d92847ff30baa619564730636fc77 | JavaScript | loganlsr/lab-03-fs-readfile | /test/index-test.js | UTF-8 | 1,546 | 2.703125 | 3 | [] | no_license | 'use strict';
const readFileHelper = require('../lib/filesystem.js');
// const assert = require('assert');
//
// describe('Testing readFileHelper module', function(){
// it('Should return 8 bytes in hex from each file', function(done){
// readFileHelper(function(text){
// assert.equal(text[0], '6c756c77617... | true |
8e8a73db1c1e2fc9987dce3737eaa45dd97b4b10 | JavaScript | null-br/react-study | /src/components/Redux/ReduxWithOutReact.js | UTF-8 | 1,306 | 3.5 | 4 | [] | no_license | /*
* 这个文件放在React项目下,但是和React没有任何关系
* 本文件只为了演示Redux是如何工作的
* 我们需要在生产环境安装npm i redux --save
* 使用node直接执行该文件可查看结果
*
* 如果我们的项目没有依赖babel,则我们需要使用require 将redux引入
* const { createStore } = require('redux');
*
* 思路:
* (1)创建store
* (2)store包含state 和reducer
* (3)reducer需要action
* (4)dispatch action
* (5)发布订阅通知UI更新
*... | true |
a9ffdce11d78baca771b6d9e41f8a0464939a216 | JavaScript | fadialset/pomodoro-clock | /index.js | UTF-8 | 2,682 | 3.484375 | 3 | [] | no_license | /////// BUTTONS////////////////
const start = document.getElementById('play');
const pause = document.getElementById('pause');
const reset = document.getElementById('reset');
const arrowUp = document.getElementById('arrow_up');
const arrowDown = document.getElementById('arrow_down');
/////////// VARIABLES ////////////... | true |
2e9f27534c1b008f389cb395170a8f35ba45d226 | JavaScript | gcode101/Sprint-Challenge--Redux | /smurfs/src/reducers/smurfs.js | UTF-8 | 2,302 | 2.71875 | 3 | [] | no_license | /*
Be sure to import in all of the action types from `../actions`
*/
import {
FETCHING_SMURFS,
SMURFS_FETCHED,
ERROR_FETCHING_SMURFS,
CREATING_SMURF,
CREATE_SMURF_SUCCESS,
CREATE_SMURF_FAILURE,
DELETING_SMURF,
DELETE_SMURF_SUCCESS,
DELETE_SMURF_FAILURE,
UPDATING_SMURF,
UPDATE_SMURF_SUCCESS,
UP... | true |
120aae0bdcda4fed42d9aae284736620246f5e16 | JavaScript | klonikar/object-detection-codeland | /sketch.js | UTF-8 | 1,229 | 2.890625 | 3 | [] | no_license | // Real-Time Object Detection with TensorFlow.js + p5.js
// Made at Codeland Conference in Workshop
// https://codelandconf.com/speakers/nicholas-bourdakos/
const MODEL_URL = 'model_web/'
const LABELS_URL = MODEL_URL + 'labels.json'
const MODEL_JSON = MODEL_URL + 'model.json'
let video;
let model;
let thumbs = [];
le... | true |
6584705a47083aabf9e14209e6140b2271483c21 | JavaScript | lxw-peter/JavaScript-Design-Patterns | /18-状态模式/3.超级玛丽.js | UTF-8 | 646 | 3.453125 | 3 | [] | no_license | // 单一动作 , 一个动作一个判断条件
var lastAction = ''
function changeMarry (action) {
if (action === 'jump') {
// 跳跃
} else if (action === 'move') {
// 移动
} else {
// 默认情况
}
lastAction = action
}
// 复合动作, 判断条件的开销翻倍
var lastAction1 = ''
var lastAction2 = ''
function changeMarry2 (action1, action2) {
if (act... | true |
1a595dfa2a451a77a0f909126e9354fa1369e95c | JavaScript | fwg/morphene | /interpreter/stack.js | UTF-8 | 472 | 2.796875 | 3 | [] | no_license | function Stack() {
this.data = [];
this.push = this.data.push.bind(this.data);
this.pop = this.data.pop.bind(this.data);
Object.defineProperties(this, {
'top': {
get: function () {
return this.data[this.data.length - 1];
}
},
'... | true |
3118d9dca52802be54202d01769118b5ab2c1b43 | JavaScript | tg911/Blockly_IchigoJam | /build/blockly/generators/ichigojambasic/if_else.js | UTF-8 | 2,957 | 2.8125 | 3 | [
"Apache-2.0"
] | permissive | Blockly.IchigoJamBASIC['if_else'] = function(block) {
var value_boolean = Blockly.IchigoJamBASIC.valueToCode(block, 'boolean', Blockly.IchigoJamBASIC.ORDER_ATOMIC);
var statements_contents = Blockly.IchigoJamBASIC.statementToCode(block, 'contents');
var statements_elsecontents = Blockly.IchigoJamBASIC.statemen... | true |
437d334bed84912d8e888dfefbb725d66fa263f8 | JavaScript | henriquebelias/trybe-exercises | /bloco_26/dia_2/exercise4.js | UTF-8 | 1,991 | 4.03125 | 4 | [] | no_license | /*
4. Realize o download deste arquivo e salve-o como simpsons.json . Utilize o arquivo baixado para realizar os requisitos abaixo.
Você pode utilizar then e catch , async/await ou uma mistura dos dois para escrever seu código. Procure não utilizar callbacks.
1. Crie uma função que leia todos os dados do arquivo ... | true |
f27bf9b5db425d5dcaead3fc40e7e97994e076db | JavaScript | username40/Education | /GeekBrains/js/lvl-1/06/04/04.js | UTF-8 | 4,208 | 3.59375 | 4 | [] | no_license | 'use strict';
/*
4*. Вопрос есть такой, ответить надо будет просто текстом...
Есть два куска из нашего приложения, которое мы делали на занятии (галерея):
```
document
.querySelector(this.settings.previewSelector)
.addEventListener('click', event => this.containerClickHandler(event));
```
```
closeImageElement.a... | true |
131ff224efbdd725656e6554efcce144871e2cb3 | JavaScript | johnathanlund/Told-Handyman | /server/models/UserModel.js | UTF-8 | 1,092 | 2.546875 | 3 | [] | no_license | var mongoose = require('mongoose');
var bcrypt = require('bcryptjs');
var Schema = mongoose.Schema;
var User = new Schema({
name: {type: String},
email: {type: String, unique: true, required: true},
password: {type: String},
});
User.methods.generateHash = function( password ) {
console.log('In UserModel, gen... | true |
890323ddfe0c5b832dacbc10d8ca73c2c69af70e | JavaScript | tingyugetc/tingyugetc.github.io | /task17/task17.js | UTF-8 | 6,327 | 3.359375 | 3 | [] | no_license | /* 数据格式演示
var aqiSourceData = {
"北京": {
"2016-01-01": 10,
"2016-01-02": 10,
"2016-01-03": 10,
"2016-01-04": 10
}
};
*/
// 以下两个函数用于随机模拟生成测试数据
function getDateStr(dat) {
var y = dat.getFullYear();
var m = dat.getMonth() + 1;
m = m < 10 ? '0' + m : m;
var d = dat.getDate();
d = d < 10 ? '0' ... | true |
d4686ec70bf2fed78a6951374e55ca4360c7b430 | JavaScript | ashlinaronin/mycoweb | /inject-styles.js | UTF-8 | 523 | 2.75 | 3 | [] | no_license | drawMycelium();
function drawMycelium() {
const canvas = document.createElement('canvas');
canvas.width = 800;
canvas.height = 600;
canvas.className = "mycelium-canvas";
debugger;
fract = new Fractal.HTree(canvas, {x: 0, y: 0}, 14, "black", "rgba(91,0,144,0.3)", true);
start = {x: canvas.width / 2, ... | true |
6eb2b48ab7d2f8eaeafaedca475bdccc45599bcf | JavaScript | mmedvescig/data-services | /collector.js | UTF-8 | 2,069 | 2.890625 | 3 | [] | no_license | /*
This app get the data from a mqtt server and save it to a mysql db
*/
var mqtt = require('mqtt');
var client = mqtt.connect('mqtt://test.mosquitto.org');
mqttTopic = 'technetium';
var mysql = require('mysql');
var connection = mysql.createConnection({
host : 'localhost',
user : 'technetium',
... | true |
f74b2b3530feba6075b9147352cc4e22953976a3 | JavaScript | haroldpark/hunkybot | /routes/commands/blackjack.js | UTF-8 | 1,898 | 2.84375 | 3 | [
"MIT"
] | permissive | module.exports = (bot, msg) => {
let userTag = msg.member.user.username + msg.member.user.discriminator;
let gameStarted = false;
let blackjack = new Blackjack(userTag);
msg.channel.sendMessage(userTag + ' has started a blackjack game! Type in "$blackjack join" to play');
bot.on('message', sss => {
i... | true |
d01c3eeb6c96fc94f7e0e9563417e5b704445e25 | JavaScript | jtorrespdx/pig_latin | /js/scripts.js | UTF-8 | 1,110 | 3.546875 | 4 | [] | no_license |
var pigLatin = function(phrase){
var splitPhrase = phrase.split(" ");
var wordArray = new Array();
var index = 0;
while(index < splitPhrase.length){
var word = splitPhrase[index];
if (word.substring(0,2).match(/qu/)) {
word = word.substring(2, word.length) + word[0] + word[1... | true |
790f33362573e108a025624a6851496463fea9d6 | JavaScript | antihax/antihax.github.io | /atlastools/lookforthingsRegion.js | UTF-8 | 3,006 | 2.765625 | 3 | [
"MIT"
] | permissive | 'use strict';
require('tty')
const fs = require('fs');
const {
nextTick
} = require('process');
let rawdata = fs.readFileSync('./json/islands.json');
let islands = JSON.parse(rawdata);
rawdata = fs.readFileSync('./json/resourceTypes.json');
let types = JSON.parse(rawdata);
var regions = {};
for (var island in is... | true |
0ad27752acbf7ac0b6b8193fd8c1d238fdcbcb67 | JavaScript | StayRealMayDay/StockTrade | /target/ventureassess/static/adStyle/global/js/register.js | UTF-8 | 11,352 | 3.078125 | 3 | [
"MIT"
] | permissive | function account() {
var account = $("#account").val();
}
/**
* 账号检查
*/
function accountChecks() {
$("#accountFlag").val('');
var account = $("#account").val();
$("#accountRequired").hide();
$("#accountNum").hide();
$("#accountRule").hide();
$("#accountY").hide();
$("#accountR").hide();
/**
* if(charStati... | true |
5a84be2c0033fdbc97b33c09d57160fa362a892d | JavaScript | bencsbalazs/XPFarm-orange_belt | /packages/2021-04-23-FindLongWords/test/index.spec.js | UTF-8 | 786 | 2.90625 | 3 | [] | no_license | import {expect} from 'chai'
import {longWords} from '../index.js'
describe("Filter long words", ()=>{
describe("Check input parameters", ()=>{
it("Check the sentence is a string",()=>{
expect(longWords(2, 1)).equal(false);
});
it("Check the input number is not 0",()=>{... | true |
39f51de1fc116f5e9362782e5a2f657eb6566875 | JavaScript | garrison90/Test-task | /src/components/Month/Month.js | UTF-8 | 1,379 | 2.609375 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
import UsersList from "../UsersList/UsersList";
import "./Month.css";
import PropTypes from "prop-types";
function Month({ month, users, index }) {
const [isHovered, setIsHovered] = useState(false);
const [color, setColor] = useState("");
useEffect(() => {
... | true |
2d796a8cfb82484b36f3868b1db1c5a722ddb919 | JavaScript | jprofijt/BioView | /src/main/resources/static/js/FolderManager.js | UTF-8 | 9,724 | 2.859375 | 3 | [] | no_license | /**
* Scripts that manage the basic folder manager actions
*
* @author Kim Chau Duong
* @version 1.0
*/
// Submits on double click
$(document).on('dblclick', '.folder-manager ul li form div', function() {
$(this).addClass('folder-active');
$(this).parents('form').submit();
});
// Shows the folder select ... | true |
c51d5e9499b84073cb3f4af070a841e07a4f13c9 | JavaScript | gunht/gunht.github.io | /Game_Javascript/Exercises/01/main.js | UTF-8 | 3,653 | 3.46875 | 3 | [] | no_license | const canvas = document.getElementById("canvas");
const ctx = canvas.getContext("2d");
canvas.width = innerWidth - 23;
canvas.height = innerHeight - 23;
class BorderWall {
resize() {
this.x = 10;
this.y = 10;
this.width = canvas.width - 18;
this.height = canvas.height - 18;
}
... | true |
09f18970b3000367ac00c8047e962f29f14a68bc | JavaScript | MicrosoftEdge/css-usage | /src/recipes/archive/unsupportedBrowser.js | UTF-8 | 1,890 | 2.8125 | 3 | [
"LicenseRef-scancode-generic-cla",
"MIT"
] | permissive | /*
RECIPE: unsupported browser
-------------------------------------------------------------
Author: Morgan Graham, Lia Hiscock
Description: Looking for phrases that tell users that Edge is not supported, or to switch browers.
*/
void function() {
window.CSSUsage.StyleWalker.recipesToRun.push( fu... | true |
85ff4b1459c90ca04b1097f53feba8ca99864c0a | JavaScript | DevelopIntelligenceBoulder/hello-backbone-underscore | /src/js/hello-view.js | UTF-8 | 753 | 2.6875 | 3 | [] | no_license | (function() {
/**
* Backbone view to handle UI rendering.
*/
DI.App.HelloView = Backbone.View.extend({
//Utilizing Underscore to create a template
// that takes model properties
template: _.template($('#hello-template').html()),
/**
* Render the element via ... | true |
228d00607d0da2a209b0b5b8d544a8203240636a | JavaScript | yanbai/leetcode | /236.lowest-common-ancestor-of-a-binary-tree.js | UTF-8 | 1,230 | 3.4375 | 3 | [] | no_license | /*
* @lc app=leetcode id=236 lang=javascript
*
* [236] Lowest Common Ancestor of a Binary Tree
*/
// @lc code=start
/**
* Definition for a binary tree node.
* function TreeNode(val) {
* this.val = val;
* this.left = this.right = null;
* }
*/
/**
* @param {TreeNode} root
* @param {Tr... | true |
e3f1f237ec2034cdeaa4fbf04a96ea205f25f13c | JavaScript | ivanhet/parcial-hecho-3 | /parcial febrero/uno.js | UTF-8 | 2,110 | 3.796875 | 4 | [] | no_license | /*
Debemos realizar la carga de 5(cinco) productos de prevención de contagio,
de cada una debo obtener los siguientes datos:
el tipo (validar "barbijo" , "jabón" o "alcohol") ,
el precio (validar entre 100 y 300),
la cantidad de unidades (no puede ser 0 o negativo y no debe superar las 1000 unidades),
la Marca y el fab... | true |
63a63e7896082ffd053535598824f3de57560f45 | JavaScript | VVVerbitsky/jsProjects | /rightOrderClick/rightOrderClick.js | UTF-8 | 3,219 | 3.328125 | 3 | [] | no_license | //make for es6
//unic random style for each cell
!function(){
var size=2;
const from=1;
var timerId;
var time=document.getElementById('timer');
var rightOrderClickGame=document.getElementById('rightOrderClickGame');
gameStart();
function gameStart(){
time.innerHTML=20;
... | true |
d1527681e6cf25de3d8192ca2e929e8328771e52 | JavaScript | monstaro/Flashcards-App | /test/Round-test.js | UTF-8 | 5,800 | 3.15625 | 3 | [] | no_license | const chai = require('chai');
const expect = chai.expect;
const Round = require('../src/Round');
const Deck = require('../src/Deck');
const Card = require('../src/Card');
const Turn = require('../src/Turn');
describe('Round', function() {
it('should be a function', function() {
const card1 = new Card(1, 'What ... | true |
e30fc1a01d213cff9f0f71cf5f16bfc712027dbe | JavaScript | SeanLuo-FSWD/midterm_Q6_promises | /fileIo.js | UTF-8 | 1,551 | 3.046875 | 3 | [] | no_license | const readlineSync = require("readline-sync");
const fs = require("fs");
const path = require("path");
const mathHelpers = require("./mathHelpers.js");
let getUserInput = () => {
const userInput = readlineSync.question(
"Please enter your two points as follows: x1,y1,x2,y2\n"
);
console.log("You entered: " +... | true |
0e3a72e092eedccfe307143a178d52f20f48d13e | JavaScript | MajoDurco/RISCVisualization | /app/containers/HomePage/cpu/instructions/checkers.js | UTF-8 | 967 | 2.921875 | 3 | [] | no_license | import {
REGISTER_REGEX,
MEM_LENGTH,
DATA_REGS,
} from '../../constants'
/*
* @desc check if register exitst and has right format
* @param {String} reg - register name
* @return {Boolean} - true(valid)
*/
export function regCheck(reg){
const match = reg.match(REGISTER_REGEX)
if(match != null && Number(ma... | true |
decd892bbd4fa37ae6c1d80b71110b57e267d628 | JavaScript | tessereact/tessereact-demo | /src/PageLayout/listGroup.scenarios.jsx | UTF-8 | 2,267 | 2.53125 | 3 | [] | no_license | import React from 'react'
import { context, scenario as scenarioFn } from 'tessereact'
import { ListGroup, ListGroupItem } from 'react-bootstrap'
const scenario = (name, fn) => scenarioFn(name, fn, {css: true, screenshot: true})
context('Page layout: List group', () => {
scenario('Centers by default', () =>
<Li... | true |
8eeb5f60b9ea492ea2a78f4c62e1dd94c4136693 | JavaScript | JeffreyMeijer/javascriptv2 | /scripts/studieblok1/opdracht2.js | UTF-8 | 289 | 3.046875 | 3 | [] | no_license | var a = 3;
var b = 4;
var c = 5;
document.getElementById('a+b+c').innerHTML = a+b+c;
document.getElementById('a+c-b').innerHTML = a+c-b;
document.getElementById('c/a').innerHTML = c/a;
document.getElementById('a-c*b').innerHTML = a-c*b;
document.getElementById('b+c/a').innerHTML = b+c/a;
| true |
b5a65d82e9698a30f8e80b266153e0d58004375c | JavaScript | hamdaankhalid/MonoRepo | /leftover-frontend/src/pages/shopper/ShopperHome.js | UTF-8 | 3,903 | 2.515625 | 3 | [] | no_license | import { Form, Button, Modal } from 'react-bootstrap';
import NavigationBar from '../../components/NavigationBar';
import { useState } from 'react';
export default function ShopperHome(props){
const shopperHomeNavBar = [
{
link: "/shopper/home",
name: "Home",
index: 1,
... | true |
0690718de0a12ea93384e50c2359b519e44ee11e | JavaScript | IgorHalfeld/recordall | /src/js/modules/logger-helper.js | UTF-8 | 411 | 2.984375 | 3 | [] | no_license |
/**
* Logger helper
* @param {String} message a message to log
* @param {String} type logger type
*/
export default function logger (message = 'Pass a message to logger', type = 'normal') {
switch (type) {
case 'normal':
console.log(message)
return
case 'info':
console.info(message)
... | true |
819bd1d7f78ea3912a4534e23c2b3afcdc05ae3d | JavaScript | marvinxu99/crown-winter-saga-hook-server | /client/src/agnostics/components/menu-and-popup/popups-component.jsx | UTF-8 | 917 | 2.609375 | 3 | [] | no_license |
import React from "react";
import Popup from "reactjs-popup";
export const WarningPopup = ({ content }) => (
<Popup trigger={<button> Trigger</button>} position="right center">
<div> {`Popup content: ${content}`} </div>
</Popup>
);
export const InfoPopup = ({ content }) => (
<Popup trigger={<button> Trig... | true |
247a64c69bc07b1b60924d1411875dcf58629ac9 | JavaScript | badasscuber/p5.js-programs | /programs/sketch/img.js | UTF-8 | 167 | 2.53125 | 3 | [] | no_license | var img;
function setup() {
createCanvas(1000, 1000,WEBGL);
}
function preload(){
img = loadImage("");
}
function draw() {
background(51);
texture(img);
} | true |
f013062fc4179e7247fc12ee010eaa341de7baac | JavaScript | TiagoEsdras/trybe-exercises | /Modulo_1-Fundamentos-Desenvolvimento-Web/bloco_4/dia_1/exercises_7.js | UTF-8 | 286 | 4.65625 | 5 | [] | no_license | //Faça um programa que retorne o maior de três números. Defina no começo do programa três variáveis com os valores que serão comparados.
let a = 27, b = 19, c = 15;
if (a > b && a > c) {
console.log(a);
}
else if (b > c) {
console.log(b);
}
else {
console.log(c);
} | true |
7940470272cb2c5d727b953fa8f9b0f564e513e8 | JavaScript | bgarrido7/feup-cgra | /projeto_B/MySphere.js | UTF-8 | 2,789 | 2.984375 | 3 | [] | no_license | /**
* MyQuad
* @constructor
* @param scene - Reference to MyScene object
*/
class MySphere extends CGFobject {
constructor(scene, radius, slices, stacks) {
super(scene);
if (slices < 10) this.slices = 10;
else if (slices > 200) this.slices = 200;
else this.slices = slices;
if (s... | true |
57bb5265e04f8a1f2d36f843006a9f61d15c12b1 | JavaScript | AlexYam94/personal_page | /src/Components/Todo/Todo.js | UTF-8 | 4,886 | 2.78125 | 3 | [] | no_license | import React, { useState, useEffect } from 'react';
import classes from './Todo.module.css'
const Todo = (props) => {
const [todo, setTodo] = useState([]);
const [errorText, setErrorText] = useState([]);
const [event, setEvent] = useState("");
const [dueDate, setDueDate] = useState("");
const [id, ... | true |
5325ae818eb7f99fb08ad6a38cd13a99395694b1 | JavaScript | chailijia/booms | /examples/server1/src/callback.js | UTF-8 | 366 | 2.90625 | 3 | [
"MIT"
] | permissive |
const fn = async function(hi, cb) {
// The cb is the callback comes from the client.
// The cb has wrapped as an asynchronous function by Booms automatically.
// You should use keyword await when invoke it.
// The cbResult is the result returned after the cb is executed.
const cbResult = await cb(2);
return h... | true |
ffd7ac2527f4148976338dd6acd2d07b229103d9 | JavaScript | ch-hassansaeed/reactjs_add_form_value_dynamic_table | /src/App.js | UTF-8 | 4,529 | 2.984375 | 3 | [] | no_license | import React, { useState } from 'react';
import ReactDOM from 'react-dom';
//style sheet for form and table
const style = {
table: {
borderCollapse: 'collapse'
},
tableCell: {
border: '1px solid gray',
margin: 0,
padding: '5px 10px',
width: 'max-content',
minWidth: '150px'
},
form: {... | true |
4db9549858f1a96247ecf1fa92fd3c7a167ed89e | JavaScript | B-Atai/freshcom | /src/components/sidebar/sidebar.js | UTF-8 | 823 | 2.78125 | 3 | [] | no_license | const Sidebar = (title, listItems, buttonText) =>{
const sidebar = document.createElement('div');
sidebar.className = 'sidebar__menu'
sidebar.innerHTML = `
<h1 class="sidebar__title">${title}</h1>
<ul class="sidebar__list">
${listItems.map((item) => {
const li = d... | true |
04978dbc870eea8842ac3b0adc8ad7cbc9b3d8a5 | JavaScript | LRCong/markdown-blog-lite | /src/components/GradualPicture.js | UTF-8 | 871 | 2.65625 | 3 | [] | no_license | import React, { useEffect, useState } from 'react'
import './GradualPicture.css'
export default function GradualPicture(props) {
const [state, setState] = useState({ cnt: 0, max: props.words.length });
useEffect(() => {
const id = setInterval(() => {
setState(state => ({
... | true |
dd27196368edf622795a836f8247ef4e1663b7a8 | JavaScript | fliphub/chain-able | /src/deps/reduce/reduce.js | UTF-8 | 708 | 3.375 | 3 | [
"MIT"
] | permissive | const ArrayFrom = require('../util/from')
/**
* @desc Map -> Object
* @since 4.0.0
*
* @param {Map} map map to reduce, calls entries, turns into an array, then object
* @return {Object} reduced object
*
* @see ArrayFrom
*
* @example
*
* var emptyMap = new Map()
* reduce(emptyMap)
* // => {}
*
... | true |
2040bbd43f96e4aa85d1d7208ec2a74f9c19791e | JavaScript | J1marotta/node-ATM-Machine | /index.js | UTF-8 | 6,727 | 2.890625 | 3 | [] | no_license | const fs = require("fs")
const say = require("say")
const S = f => say.speak(f, null, 1.55)
const { speech } = require("./speech")
const prompt = require("prompt-sync")({ sigint: true })
const wait = ms => {
return new Promise(resolve => setTimeout(resolve, ms))
}
const sp = speech(0)
const police = async () => {
... | true |
ed2cad997bfeeba647dccdfddd9532d5bb544cd4 | JavaScript | U-WISE/Front-End-Capstone | /client/src/components/RatingsAndReviews/StarRating.jsx | UTF-8 | 1,157 | 2.515625 | 3 | [] | no_license | import React from 'react';
import { getStarRating } from './utils/RatingsAndReviews.utils.js';
const StarRating = ({ rating }) => {
const ratings = getStarRating(rating);
return (
<div className="starRating">
<span className="individualStar emptyStar" id="firstStar">☆</span>
<span className="filled... | true |
b7aa6e36ddc6be066d667954f57c6f4b8be0c3c2 | JavaScript | mayconbenito/stmusic-web | /src/helpers/isStringEmpty.js | UTF-8 | 138 | 2.828125 | 3 | [] | no_license | function isStringEmpty(str) {
const isEmpty = str.length > 0 && /[^\s]/.test(str);
return !isEmpty;
}
export default isStringEmpty;
| true |
6a2c0fda48de94ece7c31a13c8d127e2f9530fc7 | JavaScript | es-ex/core | /index.js | UTF-8 | 1,239 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive | import Pump from 'src/Pump';
import Validator from 'src/Validator';
import Drivers from 'src/Drivers';
/**
* Runs a data transfer from on location to another if all options are valid.
* @param {Options} optionsList - A list of options that should include at least sink and faucet type options.
* @return {Resu... | true |
571f05cc702bf5dea9054949985c4973f427e6a9 | JavaScript | jcarroll2007/STEM | /app/scripts/views/searchFilterAsItem.js | UTF-8 | 3,591 | 2.640625 | 3 | [
"MIT"
] | permissive | /*global Stem, _, Backbone, JST*/
// Basic Backbone view that renders
// a search filter as a list item.
Stem.Views = Stem.Views || {};
(function () {
'use strict';
Stem.Views.SearchFilterAsItem = Backbone.View.extend({
template: JST['app/scripts/templates/searchFilterAsItem.ejs'],
tagName... | true |
a5317d82a8e6c8e04afcc96ed8577de3905a0ee1 | JavaScript | kschan1/wdiconfapi | /public/jwt.js | UTF-8 | 1,501 | 2.5625 | 3 | [] | no_license | console.log("hello world");
$('form.login').submit(function(event) {
event.preventDefault();
$.ajax({
url: "/authenticate",
method: "post",
data: {
email: $('form.login input:eq(0)').val(),
password: $('form.login input:eq(1)').val()
}
}).done( function(result) {
console.log(resul... | true |
17fd23b09bdd5f5a2827d036def4fbd45bc2e622 | JavaScript | aqahtani/CapableIT | /app/updates/0.1.3-sfia-v6-skills-create.js | UTF-8 | 2,787 | 2.671875 | 3 | [] | no_license | /**
* Updates skills to match SFIA v6
*/
var keystone = require('keystone'),
async = require('async'),
HardSkillCategory = keystone.list('HardSkillCategory'),
HardSkillSubCategory = keystone.list('HardSkillSubCategory'),
HardLevel = keystone.list('HardLevel'),
HardSkill = keystone.list('Har... | true |
6da5b7b924f3c767db3ba788d901dca6c04684c6 | JavaScript | vpvnguyen/regex-reference | /validation/address/script.js | UTF-8 | 1,035 | 3.65625 | 4 | [
"MIT"
] | permissive | function validate() {
// dirty string
const dirtyString = "some@some~!@#$%^&*()_+`-=~!@#$%^&*()_+`-=.com";
var phoneNumber = document.getElementById("phone-number").value;
const address1 = document.getElementById("address1").value;
var postalCode = document.getElementById("postal-code").value;
var phoneRGE... | true |
d8592be2270eebc2cf4e2fb5f3f1a63c4b600517 | JavaScript | nguni52/pearson | /daassets_repo/interactivetool/questions/G12_003.js | UTF-8 | 1,809 | 2.8125 | 3 | [
"Apache-2.0"
] | permissive | // JavaScript Document
var quiz = {
fill:
[
{
ques: "<strong>Question 1</strong><br/>The second longest river in Africa is the _. <br/><br/><code><p>Congo<p>Amazon<br/><p>Nile<p>Chang Jiang",
ans: "Congo"
}, {
ques: "<strong>Question 2</strong><br/>The second longest river in the world is the ... | true |
5f7f9807684abadd0fd82d046b470acc1852f3f8 | JavaScript | tblazina/analytics_project | /app/containers/MainDashContainer/reducer.js | UTF-8 | 1,696 | 2.59375 | 3 | [
"MIT"
] | permissive | /*
*
* MainDashContainer reducer
*
*/
import {
LOCATION_LIST_FETCH_SUCCESS,
DATA_FETCH_SUCCESS_1,
DATA_FETCH_SUCCESS_2,
DATA_FETCH_SUCCESS_3,
DATA_FETCH_SUCCESS_4,
DATA_FETCH_SUCCESS_5,
} from './constants';
import { LOCATION_CHANGE } from 'react-router-redux';
const update = (state, mutations) =>
Object.ass... | true |
f32283c4bfd1a0fedd71453b44371d945504312b | JavaScript | alvin-2002/Hex-Board-Game | /src/Level_2Ai.js | UTF-8 | 2,071 | 3.109375 | 3 | [] | no_license | class Level2AI extends Player{
constructor(player) {
super();
this.player = player;
}
getMove() {
let priorityQueue = [];
let copy = [];
let gameFun = new GameFunction();
for (let i = 0; i < boardSize; i++){
for (let j = 0; j < board... | true |
c45dcd9db46d83ed243174d3d40f672f2447af17 | JavaScript | lucianomiller/Ecommerce | /api/src/routes/dev.js | UTF-8 | 2,148 | 2.734375 | 3 | [] | no_license | const { Router } = require("express");
const { Category, Product } = require("../db.js");
const axios = require("axios");
const getRandomNumber = () =>
axios
.get("https://random-data-api.com/api/number/random_number")
.then((response) => response.data);
const getRandomAddress = () =>
axios
.get("http... | true |
cb086847f9451acf1de74cf5864b685afe14a7f4 | JavaScript | MaryjanesMayhem/GenMZBlackjack | /ui/src/App.js | UTF-8 | 1,635 | 2.625 | 3 | [] | no_license | import React, { Component } from 'react';
import './App.css';
class App extends Component {
constructor(props) {
super(props);
this.state = {
hands: undefined
};
}
render() {
return (
<div className="App">
<div className="App-header">
{this.state.hands === undefined... | true |
23955c06d1b5bfa3b2b8f015b350ae7064c7d262 | JavaScript | stffrd/stackpack | /src/entry.js | UTF-8 | 2,066 | 2.75 | 3 | [
"MIT"
] | permissive | var m = require('mithril');
/*
This CSS is now scoped to the things in this module via file-hash
and accessible via css.your_class_name;
This will output to site.css in dist/css as a bunch of classes with
unique prefixes (jkfjei32jlsd_example) (so they target whichever element you want perfectly)
*/
var... | true |
4739165d1beded158a83946a073e845314f788bb | JavaScript | chiel/informal | /src/pagers/named.js | UTF-8 | 457 | 2.53125 | 3 | [] | no_license | 'use strict';
/**
* Named page tabs
*/
var Named = function(spec){
if (!(this instanceof Named)) return new Named(spec);
this.spec = spec;
this.build();
};
/**
*
*/
Named.prototype.build = function(){
this.wrap = document.createElement('ul');
var i, html = [];
for (i = 0; i < this.spec.length; i++){
html... | true |
0b76da3189001c7d73ab2cd310e2186ae54bece4 | JavaScript | tvolk131/basic-web-app | /spec/socketHandler.js | UTF-8 | 3,498 | 2.65625 | 3 | [] | no_license | const { expect } = require('chai').use(require('chai-as-promised'));
const SocketHandler = require('../server/socketHandler').constructor;
class StubbedSocket {
constructor(id = 'testId') {
this.request = { user: { id } };
this.messages = [];
}
emit(dataType, data) {
this.messages.push({dataType, da... | true |
7893539a855ce27284afbe7c4cce295ee2108347 | JavaScript | Butt3r/sort-visualizer-vanilaJS | /src/utills/visualize.js | UTF-8 | 2,808 | 2.640625 | 3 | [] | no_license | import timer from "./animation.js";
const MOVE_COLOR = "#62d6c3";
const ORIGIN_COLOR = "#b162d6";
const PNT_COLOR = 'red';
let isSorted = false;
export async function bubbleSortVisualize(trace, i) {
disable();
for(let [curr, next, mark] of trace){
const bars = [...document.querySelectorAll('.bar')];
... | true |
63f63f0e8e82c8782c83567e5353340014406380 | JavaScript | daishihmr/socket-san | /socket/bullet.js | UTF-8 | 1,229 | 2.78125 | 3 | [] | no_license | var unitJs = require("./unit");
var bullets = [];
var Bullet = function(data) {
this.owner = data.owner;
this.x = data.x;
this.y = data.y;
this.dx = data.dx;
this.dy = data.dy;
this.age = data.ageLimit;
this.power = data.power;
bullets.push(this);
};
Bullet.prototype.update = function... | true |
656f012a228809e77b2e9c190a4ae354f3d97ac1 | JavaScript | GabrielMartinsps/martinspsn | /exercicios/aula-19/index.js | UTF-8 | 979 | 3.96875 | 4 | [] | no_license | // function converterParaDolar(valorEmReais){
// return valorEmReais * 5.25
// }
// var valor = 100 + 37*2 - 90
// var valorEmDolar = converterParaDolar(valor)
// console.log(valorEmDolar)
function consultarCotacaoDolar(algoQueVaiAcontecerNoFuturo) {
console.log('consultarCotacaoDolar: iniciando consulta da c... | true |
f8df6a897b41d6f1d3d9a20b8e45d62000a04f08 | JavaScript | lounres/thetruesoundtest | /server.js | UTF-8 | 40,489 | 2.6875 | 3 | [] | no_license | #!/usr/bin/node
"use strict"
const config = require("./config.json");
const argv = require("yargs")
.option('pidfile', {
default: config.serverPIDPath
})
.argv;
const PORT = config.port;
const WRITE_LOGS = (config.env === config.DEVEL) ? false : true;
const WORD_NUMBER = config.wordNumber;
const... | true |
79cd0fd4bccdf6222f93b62bce1f44711df45374 | JavaScript | cyberpirate92/react-todo | /src/components/TodoList/TodoList.js | UTF-8 | 3,885 | 2.6875 | 3 | [
"MIT"
] | permissive | import React, { Component } from 'react';
import TodoItem from '../TodoItem/TodoItem';
import {writeToLocalStorage} from '../../utils';
import {LOCAL_STORAGE_KEY} from '../../constants';
class TodoList extends Component {
constructor(props) {
super(props);
this.state = {
list: this.pro... | true |
6525d7c19a98030e44f0f2ed83c555d3ef83cec5 | JavaScript | QingHui653/reacttime | /src/views/pager/ReactApi/ReactApi.js | UTF-8 | 1,189 | 2.90625 | 3 | [] | no_license | import React,{Component} from 'react';
class ReactApi extends Component {
constructor(props) {
super(props);
this.state = {clickCount: 0};
}
setStateClick=()=>{
//setState(object nextState[, function callback])
//nextState,将要设置的新状态,该状态会和当前的state合并
//callback,可选... | true |
a932d4bac78902f02d16f624726dec2c07a01db1 | JavaScript | Qurbaan77/lodgly-app-fe | /src/utils/index.js | UTF-8 | 493 | 2.59375 | 3 | [] | no_license | import getSymbolFromCurrency from 'currency-symbol-map';
const currenciesList = ['ALL', 'EUR', 'AMD', 'AZN', 'BYN', 'BAM', 'BGN', 'HRK', 'CZK', 'DKK', 'GEL', 'HUF',
'ISK', 'CHF', 'MDL', 'MKD', 'NOK', 'PLN', 'RON', 'RUB', 'RSD', 'SEK', 'TRY', 'UAH', 'GBP'];
currenciesList.forEach((currency, i) => {
const symbol = ... | true |
264d136b42485c0ab24d35d048b99b1e3ea8d74d | JavaScript | snowbot3/wall | /test/frame-page.mjs | UTF-8 | 510 | 2.96875 | 3 | [] | no_license | /**
* JavaScript Module with default function that returns a WallPage object, for testing.
*/
import wall_elem from '../js/elem.mjs';
export default function() {
const elem = wall_elem('div');
elem.append('Hello Frames!?');
elem.onload(function(){
elem.append('Loaded!');
});
elem.onunload(function(){
elem.... | true |
dd2f229aa1194ad47bbe84d001ac4d537b7af336 | JavaScript | jesseokeya/leetcode | /JavaScript/091. Decode Ways.js | UTF-8 | 1,347 | 4.09375 | 4 | [] | no_license | // A message containing letters from A-Z is being encoded to numbers using the following mapping:
//
// 'A' -> 1
// 'B' -> 2
// ...
// 'Z' -> 26
// Given a non-empty string containing only digits, determine the total number of ways to decode it.
//
// Example 1:
//
// Input: "12"
// Output: 2
// Explanation: It could b... | true |
4d73806d545d0f481fb8701aa4f109c292f4fa8a | JavaScript | chao-boop/c3andh5 | /炫酷照片列表/js/index.js | UTF-8 | 673 | 2.625 | 3 | [] | no_license | var ul=document.querySelector('#wrap ul');
var lis=document.querySelectorAll('#wrap li');
var closeBtns=document.querySelectorAll('#wrap .close');
var last=null; //上一个选中的对象
var timer=setTimeout(function(){
ul.className='';
},200);
lis.forEach(function(li,index){
li.onclick=function(){
ul.setAttribut... | true |
8df6d7c7b11d10f9ff662ff5409ef8e4b2880874 | JavaScript | Xotic750/vuix | /src/Utils/scroll.js | UTF-8 | 993 | 2.71875 | 3 | [
"MIT"
] | permissive | const easeInOutQuart = function _easeInOutQuart(t) {
if (t < 0.5) {
return 8 * t ** 4;
}
const u = t - 1;
return 1 - 8 * u ** 4;
};
export default function scroll(el, container, diff, duration, done) {
const start = Date.now();
const startingY = container.scrollTop;
let stopScroll = false;
const ... | true |
2b3ee27f30a73966007258c285285e11d1662651 | JavaScript | schpitz/nodejs_chat_server_test1 | /server.js | UTF-8 | 3,392 | 2.5625 | 3 | [] | no_license | /**
* Created by Schpitz on 02-Jun-16.
*/
console.log('server work!!!');
var mongo = require('mongodb').MongoClient;
var client = require('socket.io').listen(8080).sockets;
var fs = require('fs');
var http = require('http');
fs.readFile('chat.html', function (err, html) {
if (err) {
throw err;
}
... | true |
711676dac0451060c8cfdd5b65df076a440560e8 | JavaScript | tungeric/W5D4-javascript-intro | /skeleton/phase_4_recursion.js | UTF-8 | 1,354 | 4.0625 | 4 | [] | no_license |
// Range
const range = function range (start, end) {
// start with start value
// push value + 1 into result until value is end
if (end < start) { return []; }
let result = range(start, end - 1);
result.push(end);
return result;
};
console.log(range(5,10));
// SumRec
const sumRec = function sumRec (arr... | true |
b1c5c0ae390f0566bb4001351c6fb77dc365a035 | JavaScript | mohiuddinem/Blog-site_with_nodeJS | /controllers/postController.js | UTF-8 | 5,696 | 2.609375 | 3 | [] | no_license | const mongoose = require('mongoose')
const Post = require('../models/Post')
// create post controller
const createPost = (req, res, next) => {
const post = new Post({
title: req.body.title,
body: req.body.body,
author: req.body.author,
catagory: req.body.catagory || 'General',
... | true |
69fdf77653a9f4d87884fcd273d833eaa0368bbc | JavaScript | kliuchyk/codewars | /sumOfArraySingles/index.js | UTF-8 | 732 | 4.53125 | 5 | [] | no_license | /**
* Task
Given an array of numbers in which two numbers occur once and the rest occur only twice.
Your task will be to return the sum of the numbers that occur only once.
For example, repeats([4,5,7,5,4,8]) = 15 because only the numbers 7 and 8 occur once, and their sum is 15.
*/
function repeats(arr) {... | true |
a2f9e7f722f293fadc259b0d87772a92ee7d070a | JavaScript | shawn0531-max/Memory | /memory.js | UTF-8 | 5,319 | 3.359375 | 3 | [] | no_license | const gameContainer = document.getElementById("game");
let card1 = null;
let card2 = null;
let flipped = 0;
let clickable = false;
let turnCount = 0;
let highScore = JSON.parse(localStorage.getItem("bestScore"));
let score = 0;
if (highScore>0){
let highscoreText = document.querySelector('#highScoreText');... | true |
e32299b3de366f58f312ac5445b21f323e301179 | JavaScript | interakcjo/Blurred-text-animation | /main.js | UTF-8 | 183 | 2.890625 | 3 | [] | no_license | const letters = document.querySelectorAll(".letter");
let delay = 0;
letters.forEach(letter => {
delay += 100;
letter.setAttribute("style", `animation-delay: ${delay}ms`);
});
| true |
90c7934598d9c0a1206becfff756fb86c283aa4d | JavaScript | jackkellerk/nhi | /web/Windows/moveWindowAroundScreen.js | UTF-8 | 2,109 | 3.375 | 3 | [
"MIT"
] | permissive | // This is the code for moving a window around the screen
/* Global Variables */
// This will be the array of open windows
var windowArray = [];
// This variable is an integer that specifies which value in windowArray should be moved
var windowSelected = null;
// These coordinates refer to the top left c... | true |
3bccb32e13ff268d1444051f2f4b2d26b0235d29 | JavaScript | TwoDirectionFoil/LoveTree | /config.js | UTF-8 | 872 | 2.609375 | 3 | [] | no_license | // 霸都丶傲天 2019/7/9 https://Github.com/AJLoveChina
var config = {
// 下面的句子不一定非要7句, 你也可以改成4句,2句话都可以
lines: [
"17岁的鲜露",
"你都已经回家好几天啦",
"我在学校里好无聊",
"想给你个小惊喜",
"却被你猜的一清二楚",
"实在是不好玩",
"下次我会想想其他好玩的方式的",
"在家里玩的开心哟",
],
// 相爱的时间 记住格式不能写错了, 非常重要
/... | true |
ebe93000785dd1f31c38f809be553ec3df6bfdb2 | JavaScript | yanmeiYang/nodejs | /4-npm/module-staticNameAndFunction/foo.js | UTF-8 | 700 | 3.453125 | 3 | [] | no_license | var _name,_age;
var name='',age=0;
// 模块对象的构造函数
var foo = function(name,age){
_name=name;
_age=age;
}
// 获取私有变量_name的变量值
foo.prototype.GetName = function(){
return _name;
};
// 设置私有变量_name的变量值
foo.prototype.SetName = function(name){
_name = name;
};
// 获取是右边梁_age的变量值
foo.prototype.GetAge = function(){
return ... | true |
87dd9bf9e7a02d37b87ba7a1381162044ee85353 | JavaScript | rengo540/Movie_Web | /login/code.js | UTF-8 | 879 | 2.59375 | 3 | [] | no_license |
$all =[
{
name: 'admin',
pass:1234,
},
{
name: 'user',
pass:12345,
},
]
var adminame =$all[0]['name'];
var adminpass =$all[0]['pass'];
var username = $all[1]['name'];
var userpass = $all[1]['pass'];
document.getElementById('login').addEventListener('submit', function(e){... | true |
03f25ccf1f28a07eb5b36c9debf08361eca7a7fe | JavaScript | bweisberger/w02d05-calculator | /js/app.js | UTF-8 | 7,480 | 3.984375 | 4 | [] | no_license | console.log('window is loaded');
const calculator = {
enteredValue: "0",
lastValue: "",
resultValue: "",
calculate: function(num1, num2, operation) {
if (operation === '+') {
return num1 + num2;
}
else if (operation === '-') {
return num1 - num2;
}
else if (operation === 'X') {... | true |
a0b3623001d092e940c65f088f1860bce162954d | JavaScript | jgallred/QuestionBuilder | /drivers/controls/questionBuilder/driver.js | UTF-8 | 3,698 | 2.75 | 3 | [] | no_license | /**
* QuestionBuilderDialog Driver
*
* Provides an API for using the instance of questionBuilder on the page.
*/
define(['views/controls/questionBuilder/dialog',
'views/shared/alert',
'models/exam/questions/question',
'drivers/exam/questions/datastore'],
function(QuestionBuilderDia... | true |
7af7596497d908f7720cf59cd62fb0653e5d442f | JavaScript | mconner991/merit-badge | /nim/nim-super-duper-simple-2.0.js | UTF-8 | 1,133 | 4.6875 | 5 | [] | no_license | /* Nim Super Duper Simple */
// declare variables for count (integer) and winner (string) as 0 and null.
var count = 0,turn = 0, winner = null;
// set a loop to run until someone loses (counts 21 or over).
while (count < 21){
// the computer's turn is a random integer between 1 and 3
turn = Math.floor(Math.random()... | true |
8382826ad490237332cc21f98ff0705c75622ebd | JavaScript | rishabh-saxena/CFG-Bengaluru | /team-6-master/js/reg.js | UTF-8 | 1,782 | 2.765625 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | function val()
{
var p = document.forms["reg"]["reg_fname"].value;
if (p == null || p == "") {
alert("First name must be filled out");
return false;
}
var q = document.forms["reg"]["reg_lname"].value;
if (q == null || q == "") {
alert("Last name must be filled out");
ret... | true |