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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
1dedb787d8dd01786e45ffe8cedd154adfbd92d8 | JavaScript | ligaya96/MyEmployee-Tracker | /server.js | UTF-8 | 6,509 | 3.078125 | 3 | [] | no_license | const mysql = require('mysql');
const inquirer = require('inquirer');
// const consoleTable = require('console.table');
// mysql connections
const connection = mysql.createConnection({
host: 'localhost',
port: 3306,
user: 'root',
password: 'Pasok253!',
database: 'employee_db',
});
// Connect to th... | true |
1b442ea3cc76d7dd8763f15024def045febdf397 | JavaScript | aldiansyah2701/simplereactprojectmovie | /src/components/Protected.js | UTF-8 | 2,526 | 2.53125 | 3 | [] | no_license | import React from 'react';
import axios from 'axios';
import ShowingData from './ShowingData';
import { Row, Col, Card, Dropdown, Button, Table } from 'react-bootstrap';
import Select from 'react-select';
const optionData = [
{ label: 'Movie', value: 'MOVIE' },
{ label: 'Tv', value: 'TV' },
];
class Protected... | true |
834ecf58786f3121467c27aca6a7c951b0d2dd92 | JavaScript | MrRenter/euler | /prob3/3.js | UTF-8 | 145 | 3.28125 | 3 | [] | no_license | var number = 600851475143;
var x=2;
for (x=x; x<number; x++){
if ((number % x) == 0){
number /= x;
x--;
}
}
console.log(x + " yay");
| true |
835435100e79eb4661adfbbbf7c210dda408cf06 | JavaScript | tomlau1968/WDi23-Homework | /tom_lau/week_01/day_04/js-homework/js/rectangleIsSquare.js | UTF-8 | 391 | 4.03125 | 4 | [] | no_license | // Geometry Function Lab
//
// Part 1, Rectangle
//
// Given the following a rectangle object like the one below, write the following functions:
//
let rectangle = {
length: 4,
width: 4
};
let isSquare = function (rectangle) {
if (rectangle.length === rectangle.width) {
console.log (`${ rectangle.length... | true |
e9b04b0c75f6b1d849d6e13ae82479c63724edff | JavaScript | PerryHuan9/Relearn_JS | /ajax/2_request_method.js | UTF-8 | 389 | 3.28125 | 3 | [] | no_license | //有关post和get请求的说明
//1、get请求可以将参数附加到路径后面,但参数名和值必须经过encodeURLComponent()方法编码后才能追加
//可以使用以下方法追加
function addURLParam(url,name,value) {
url+=url.indexOf("?")==-1?"?":"&";
url+=encodeURIComponent(name)+"="+encodeURIComponent(value);
return url;
}
| true |
7d8261441446c9d8a394236f831e9ebb13792699 | JavaScript | ropello/javascript-objects-bootcamp-prep-000 | /objects.js | UTF-8 | 277 | 2.671875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | var playlist = {
'Rozwell Kid': '3.5 Halloween'
};
function updatePlaylist (playlist, artistName, songTitle) {
return Object.assign (playlist, { [artistName]:songTitle})
}
function removeFromPlaylist (playlist, artistName){
delete playlist[artistName];
return playlist
}
| true |
094c0d76646febb11bb25b9ad3904887708e51fc | JavaScript | branieljose/TrainScheduler | /assets/app.js | UTF-8 | 2,241 | 2.859375 | 3 | [] | no_license | // Initialize Firebase
var config = {
apiKey: "AIzaSyCghdK19GV2rguIfbWtUG9i7WucaUuVKC8",
authDomain: "trainscheduler-92e12.firebaseapp.com",
databaseURL: "https://trainscheduler-92e12.firebaseio.com",
storageBucket: "trainscheduler-92e12.appspot.com",
messagingSenderId: "676872432035"
};
firebase.in... | true |
b7468c66bf6ad790e247d7ad9b930645466b9356 | JavaScript | vojtech-baroch/rohlik-examples | /src/examples/example1/example1.js | UTF-8 | 1,709 | 2.859375 | 3 | [] | no_license | import React from 'react';
const styles = {
product: {
width: '200px', padding: "10px", border: "1px solid #eee", textAlign: "center", position: "relative"
},
inCart: {
marginTop: "10px", position: "absolute", top: "5px", right: "5px", left: "5px", background: "#6da305", fontSize: "12px", padding: "10px", fontW... | true |
44a77e4ce990853bad5ddd6c4d7594cc4bf52461 | JavaScript | DavidDurman/snakes | /client/js/main.js | UTF-8 | 2,211 | 2.515625 | 3 | [] | no_license | /**
* Copyright (c) David Durman & Ales Sturala 2010.
*/
function main(){
// Components initialization.
Timer.init();
Stats.init();
Audio.init();
// Load skin.
skin("css/style.css");
// Global game time.
Timer.create(
function ( time ) {
return time % 1000 ==... | true |
1b63b77868761c274ba5d6f74ef73caef8b6a3f7 | JavaScript | zverbatim/sandbox | /learnnode/functionaljs/apply.js | UTF-8 | 368 | 4.15625 | 4 | [
"MIT"
] | permissive | //source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply
//take an array and apply it as an argument to a function
var numbers = [2,3,4,5,6];
// no clue why null first arg ?
var min = Math.min.apply(null, numbers);
var max = Math.max.apply(null, numbers);
console.lo... | true |
f1ebd9752a4166d1c31a292fb90a0fa777741a43 | JavaScript | greatWeber/jest | /src/leetcode/backtrack.js | UTF-8 | 1,752 | 3.640625 | 4 | [] | no_license | /**
* 题目描述
* 括号生成
* 数字 n 代表生成括号的对数,请你设计一个函数,用于能够生成所有可能的并且 有效的 括号组合。
*/
export const Backtrack = (n)=>{
const backtrack = (list, temp, excess, lcnt, rcnt, n)=>{
if (lcnt > n || rcnt > n) return;
if (temp.length === 2 * n) return list.push(temp);
if (excess > 0) {
temp += ')';
backtrack(lis... | true |
ae714cfc3c533d61fcebddd82e8479282629ef0c | JavaScript | BoldBigflank/kontra-samples | /scratch.js | UTF-8 | 2,951 | 3.109375 | 3 | [] | no_license | kontra.init('canvas')
var sprites = []
// Constants
const COLOR_GREEN = '#33ff33'
let cherry = {
x: 0,
y: 0,
width: 60,
height: 60,
color: '#ff0000',
}
var sketch = {
x: 0,
y: 0,
width: 120,
height:120,
color: COLOR_GREEN,
thickness: 5,
shuffle: fu... | true |
09a685bbbd53011dd5b3e949d029dbcc81114cc9 | JavaScript | otisgbangba/weatherapp | /main.js | UTF-8 | 1,531 | 3.03125 | 3 | [
"MIT"
] | permissive | const api = {
key:"94485746508c528552b6aeb2e6bc6ae5",
baseurl:"https://api.openweathermap.org/data/2.5/"
}
const searchbox = document.querysector('.search-box');
searchbox.addEventListener('keypress', setquery);
function setQuery(tvt) {
if(tvt.keycode == {13) {
getResults(searchbox.value);
}
}
fu... | true |
7864ef57ff984fddf1e2248a073fcd3ecd7ffaf7 | JavaScript | KakadeS/ReactNativeApp1 | /src/actions/fetchBusinessData.js | UTF-8 | 1,005 | 2.53125 | 3 | [] | no_license | import {
FETCH_DATA_ERROR3,
FETCH_DATA_REQUEST3,
FETCH_DATA_SUCCESS3,
} from '../constants/action-types';
import config from '../lib/config';
result=null;
export function fetchBusinessData() {
const parseString = require('react-native-xml2js').parseString;
return (dispatch) => {
return(fetch(confi... | true |
1c8735abe33d8f17124dd9818a53b86598188f45 | JavaScript | luckymore0520/Introduction-to-Algorithms-JavaScript | /Sort/quickSort.js | UTF-8 | 924 | 3.484375 | 3 | [
"MIT"
] | permissive | function myQuickSort(array) {
function quickSort(array,start,end) {
if (start < end) {
var middle = partition(array,start,end);
quickSort(array,start,middle - 1);
quickSort(array,middle,end);
}
function partition(array,start,end) {
var middleVa... | true |
bd6734af86ce60861069457327d261cb141a55c1 | JavaScript | natemc/generic | /lib/index.js | UTF-8 | 2,142 | 3.0625 | 3 | [
"Apache-2.0"
] | permissive | 'use strict'
const _ = () => true
const curryN = (n, bound, f) => {
const curried = function () {
const have = bound.concat([].slice.call(arguments, 0)),
left = n - have.length
return left <= 0
? f.apply(null, have)
: curryN(left, have, f)
}
return Object.defineProperty(curried, '... | true |
0b7ec17903e2a2bfe6c1b838d893ea4e8b3b0f91 | JavaScript | training4developers/bootcamp_10162017 | /client/js/form-control-examples.js | UTF-8 | 695 | 2.734375 | 3 | [
"MIT"
] | permissive | import React from 'react';
export class BaseComponent extends React.Component {
constructor(props) {
super(props);
this.onChange = this.onChange.bind(this);
}
onChange(e) {
const newState = {};
switch (e.target.type) {
case 'number':
newState[e.target.name] = parseInt(e.target.value,10);
bre... | true |
e06393d8296da01a5e07f18b1752e938cfd1706e | JavaScript | Nikhi69/alldemo | /truyummenu2/src/main/resources/static/cart.js | UTF-8 | 761 | 3.046875 | 3 | [] | no_license | /**
* var tdd = document.getElementById(arg1);
var texttd = "Item " + arg1 + " added to cart ";
var text = document.createTextNode(texttd);
tdd.appendChild(text);
*/
var xhttp = new XMLHttpRequest();
function addCart(arg1) {
console.log("id is " + arg1);
xhttp.open("GET", "addcart?id=arg1", true);... | true |
3de6094879046287f112d4c4ff08a95d84fdeae1 | JavaScript | nbrezovskaya/genetic | /ga.js | UTF-8 | 10,492 | 2.609375 | 3 | [] | no_license | define([
"lander",
"command",
"helper"
], function (Lander, Command, Helper) {
var module = function (populationSize, eliteSize, simulationSize, world, initialLanderParams, constraints, landerType) {
this.populationSize = populationSize;
this.eliteSize = eliteSize;
this.simulatio... | true |
2486baca617f1db7c5538388efde928e59b088ef | JavaScript | wizard88mc/CVI-UniPD | /iOS/www/js/TrainingManager.js | UTF-8 | 5,648 | 2.65625 | 3 | [
"MIT"
] | permissive | var ImageForTraining = function() {
this.image = new Image();
this.image.onload = function() {
TrainingExamplesNamespace.imageLoaded();
}
this.image.src = '../images/space_shuttle2.png';
this.element = null;
this.width = 0;
this.height = 0;
this.center = new Point(0, 0);
this.drawPosition = new Point(0,... | true |
01d8f6bfdd75c8a4715076b0304f8263455e4617 | JavaScript | nagyist/phaser3-examples | /public/src/fx/glow/glow post fx.js | UTF-8 | 790 | 2.5625 | 3 | [
"MIT"
] | permissive | class Example extends Phaser.Scene
{
preload ()
{
this.load.image('bomb', 'assets/sprites/bombcolor.png');
}
create ()
{
const bomb1 = this.add.sprite(200, 300, 'bomb');
const bomb2 = this.add.sprite(600, 300, 'bomb');
const fx1 = bomb1.postFX.addGlow(0xffffff, 0, 0... | true |
ee18f12740427aab402143594ffd9a88fdcb3ab4 | JavaScript | its2easy/conway-game-of-life | /js/main.js | UTF-8 | 21,827 | 2.78125 | 3 | [] | no_license | class Cell{
constructor(x, y, node){
this._x = x;
this._y = y;
this._state = "dead";
this._node = node || undefined;
}
set x(new_x) { this._x = new_x; }
get x() { return this._x; }
set y(new_y) { this._y = new_y; }
get y() { return this._y; }
set node(node) { this._node = new_node; }
get node() { return... | true |
c8b088f399958d2f8100a539746d360b091a38ed | JavaScript | erickeiser/Modern-Javascript-Bootcamp | /functions/grade-calc.js | UTF-8 | 697 | 4.34375 | 4 | [] | no_license | // stduent score, total possible score
// 15/20 -> you got a C (75%)
// A 90-100, B 80-89, C 79-70, D 60-69 F 0-59
let grade = function(student, score = 100) {
let percent = (student / score) * 100
if(percent >= 90) {
return `You got an A (${percent}%)`
} else if(percent >= 80 && percent <= 89) {
retur... | true |
4ff25138d98bf8cfbb107981b928c52ad4c8e63b | JavaScript | Danita/x-combo | /app/comms.js | UTF-8 | 2,137 | 2.671875 | 3 | [] | no_license | const _ = require('lodash');
const $ = require('jquery');
const assert = require('assert');
const dgram = require('dgram');
function Comms(options) {
var PORT = 49003;
var HOST = '127.0.0.1';
const sentenceLength = 36;
const prologueLength = 5;
var timer = null;
var server = dgram.createSocket('udp4');
func... | true |
2cd5750cdc1af553aab91835efa6cb65282ee509 | JavaScript | joseumbertomoreira/caoeduapp | /client/js/init.js | UTF-8 | 12,807 | 2.96875 | 3 | [
"MIT"
] | permissive | //tentar remover o layer
//https://gis.stackexchange.com/questions/41928/adding-removing-leaflet-geojson-layers
$(document).ready(function() {
function tableGenerator(features, mun){
var content;
content +=
'<tr> \
<th> Ano </th> \
<th> Municipio </th> \
<th> % Matricula Creche </th> \
<th> M... | true |
3497d4c138f2c233076c57dc70116120b8bdf569 | JavaScript | sjallal/devConnector | /client/src/actions/alert.js | UTF-8 | 704 | 2.546875 | 3 | [] | no_license | import { v4 as uuidv4 } from "uuid";
const { SET_ALERT, REMOVE_ALERT } = require("./types");
// "thunk" is the middleware which allows us to return a function instead of an object
// from a action creator function......
export const setAlert = (msg, alertType, timeout = 5000) => dispatch => {
const id = uuidv4();
... | true |
99ec783968bd6d01d06798affcbf46b0a76bb745 | JavaScript | jkphl/prelink | /build/prelink.js | UTF-8 | 6,482 | 2.546875 | 3 | [
"MIT"
] | permissive | /* eslint no-param-reassign: ['off'], strict: ['error'], func-names: ['off'],
no-new-func: ["off"] */
'use strict';
(function (w) {
// Register a global prelink() function (if not already present)
if (!w.prelink) {
w.prelink = function () { return null; };
}
// If the global prelink() function d... | true |
d92584be310fce8bac04bbed7a280c2124b429a0 | JavaScript | DragonFenixOwi/11-Anotaciones-Practica | /src/promesa/otro_index.js | UTF-8 | 808 | 3.59375 | 4 | [] | no_license |
/*
--------------------------------
ESTRUCTURA DE UNA PROMESA
--------------------------------
*/
//EmaScript 6
const QUE_PASARA = () =>
{
//resolve si se ejecutara de forma correcta
// reject si es rechazada
return new PROMISE((resolve, reject)=>
{
... | true |
32d1ab55992a14a85c31fcc0a302cbc22ed8b026 | JavaScript | drblue/wcm20-cms-us-weather | /assets/js/wcm20-weather.js | UTF-8 | 1,293 | 3.234375 | 3 | [] | no_license | (function(){
const ajax_url = ww_settings.ajax_url;
// find all (if any) weather-widgets
const widgets = document.querySelectorAll('.current-weather');
console.log("Widgets found:", widgets);
widgets.forEach(widget => {
// do stuff with widget
console.log("Widget:", widget);
const location = widget.datase... | true |
b8cb844f299efd21c5f6941d3b324062ee896a02 | JavaScript | sijianian/leetcode | /11.盛最多水的容器.js | UTF-8 | 1,633 | 3.75 | 4 | [
"MIT"
] | permissive | /*
* @lc app=leetcode.cn id=11 lang=javascript
*
* [11] 盛最多水的容器
*
* https://leetcode-cn.com/problems/container-with-most-water/description/
*
* algorithms
* Medium (57.40%)
* Likes: 822
* Dislikes: 0
* Total Accepted: 84.9K
* Total Submissions: 146.3K
* Testcase Example: '[1,8,6,2,5,4,8,3,7]'
*
* ... | true |
b15ca6c439cf7e7e55091261d70577bdca704d2a | JavaScript | utkukocaa/timestampApi | /app.js | UTF-8 | 1,115 | 2.78125 | 3 | [] | no_license | const express = require('express')
const app = express()
const calculate_date = require('./functions.js');
app.use(express.static('public'));
app.get("/", function (req, res) {
res.sendFile(__dirname + '/views/index.html');
});
app.get('/api/timestamp/:date?',(req,res,next)=>{
if(!req.params.date){
... | true |
d253a8581fd152047564825581e7c6cd6c0a6d26 | JavaScript | EugeneSung/js-deli-counter-js-intro-000 | /index.js | UTF-8 | 644 | 3.78125 | 4 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive |
function takeANumber(array, customer){
array.push(customer);
return "Welcome, "+customer+ ". You are number "+ array.length + " in line.";
}
function nowServing(array){
if (array.length==0){
return "There is nobody waiting to be served!"
}else {
var templine = array[0];
array.shift();
... | true |
3d927805d7a33cec1d71a68d8b6bb046886a6cb5 | JavaScript | TatukiKonnami/fuwacorolang | /compiler/src/lexer.js | UTF-8 | 3,167 | 2.6875 | 3 | [
"MIT"
] | permissive | "use strict";
exports.__esModule = true;
/// LexDefinitionsの定義は先述のものと同一
var token_1 = require("./token");
var Lexer = /** @class */ (function () {
function Lexer(def) {
this.def = def;
// 正しいトークン定義が与えられているかチェック
for (var i = 0; i < this.def.length; i++) {
var token_pattern = this.... | true |
ddef2fc7e2a5caf5f3263815747ba13b6331c7f2 | JavaScript | mrunaln/Jigsaw_With_Leap | /jigsaw/src/jigsaw.js | UTF-8 | 23,006 | 2.71875 | 3 | [] | no_license | var puzzleBoardCo_ordinated = {topLeft_X: -662, topLeft_Y : -595,
topRight_X : -471, topRight_Y : -596,
bottomRight_X : -471, bottomRight_Y: -475,
bottomLeft_X: -662 , bottomLeft_Y: -475};
var piece_Dim = {width : 190 , height : ... | true |
bf25303280417cc7768c283449446bff6cb4aaee | JavaScript | larryfang/Bingle | /javascript/maps.js | UTF-8 | 1,115 | 2.75 | 3 | [] | no_license | var maps = (function() {
var geocoder, map;
$(function() {
//init Google maps
var latlng = new google.maps.LatLng(-34.397, 150.644);
var myOptions = {
zoom: 8,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps... | true |
f1b32e973dce4298dc4df4d8b2f778197f66839a | JavaScript | CzerkoMaszynka/REACT-the-DOG | /src/App.js | UTF-8 | 3,306 | 2.703125 | 3 | [] | no_license | import React from "react";
import "./App.css";
import DogListAll from "./Config/DogBreedsAll";
import SearchBar from "./Components/SearchBar";
import BreedList from "./Components/BreedList";
import UnderSearchBarImg from "./Components/UnderSearchBarImg";
import RandomDog from "./Components/RandomDog";
import BreedDropD... | true |
db457e1ffaebe424438a9b60866c0e249f251185 | JavaScript | nikolaynikolo91/SoftUni---JS--Fundamentals | /Exam prep/Final Exam Prep/3/(3)Followers.js | UTF-8 | 3,599 | 3.453125 | 3 | [] | no_license | function solve(input) {
let arr = input.slice();
let users = [];
const comandDictionary = {
["new follower"]: onNewCommand,
["like"]: onLikeCommand,
["comment"]: onCommentCommand,
["blocked"]: onBlockedCommand,
["log out"]: onLogOutCommand,
};
arr.forEach(fu... | true |
2322e68adcbbd548c945feec32cc3ce2ed61985f | JavaScript | artyuhvladislav/artyuhvladislav.github.io | /starter/app.js | UTF-8 | 4,874 | 3.71875 | 4 | [] | no_license | // variables
let scores, roundScore, activePlayer, dice, gamePlaying, diceValueFirstPlayer,diceValueSecondPlayer;
// elements from DOM
const diceFirstElement = document.querySelector('#dice-1'),
diceSecondElement = document.querySelector('#dice-2'),
btnHold = document.querySelector('.btn-hold'),
... | true |
fb8f137d168539ce447c381a777f50a2e71d47ce | JavaScript | alexanderkalinchyk/MA3 | /src/index.js | UTF-8 | 8,683 | 2.515625 | 3 | [] | no_license | require('./style.css');
{
const handleClickHamburger = () => {
const $sitenav = document.querySelector(`.site__nav`);
const $siteheader = document.querySelector(`.site-header`);
if ($sitenav.classList.contains(`nav--full`)) {
$sitenav.classList.add(`nav--responsive`);
$siteheader.classList.ad... | true |
fc63ba085683ff319c2ad13c48413d6c14e4c9a4 | JavaScript | macloo/canvas | /exercises/scripts/animate.js | UTF-8 | 1,928 | 3.578125 | 4 | [
"MIT"
] | permissive | // JavaScript for simple animation on canvas
window.onload = init; // calls the function named "init"
// used in timer, below
var newInterval;
// set up the images and call the main function, "draw"
var bgImage = new Image();
var motoImage = new Image();
function init() {
bgImage.src = "images/sketch.jpg";
m... | true |
1e8607005b69c16bba2b9fb16c6d1a9facc7b011 | JavaScript | bneelon85/Javascript_Exercises | /introExs.js | UTF-8 | 2,651 | 3.890625 | 4 | [] | no_license | //Madlib
function hello (name, subject) {
var output = name + "'s favorite subject in school is " + subject + ".";
console.log(output);
}
hello('Jimmy', 'Science');
//tip calculator
function tipAmount (bill, quality) {
if (quality.toLowerCase() == 'good') {
console.log(bill*.2);
} else if (qu... | true |
931c5cb61979201923447896921cd23add569311 | JavaScript | jahlgren/d18-prototype-exercises | /guess-the-number/guess-the-number-game.js | UTF-8 | 2,841 | 3.6875 | 4 | [] | no_license | class GuessTheNumberGame {
constructor() {
this.reset();
this._eventListeners = [];
}
reset() {
this.isPlaying = false;
this.playerName = 'Unknown';
this.maxRange = 10;
this.guessCount = 0;
this.numberToGuess = Math.round(Math.random() * this.max... | true |
6fdd71fdfa5021d58bd72fd6b139dd0e11ea6bf4 | JavaScript | trave84/ROI-Tasks | /LocalStorageForm/js/localStore.js | UTF-8 | 1,088 | 2.5625 | 3 | [] | no_license | const beforeHtml = new Date().getMilliseconds();
window.addEventListener("DOMContentLoaded", e => {
const afterHtml = new Date().getMilliseconds();
console.log(`Loading all HTML took: ${afterHtml - beforeHtml} milliseconds`);
const form = document.getElementById("form-1");
const formSuccess = document.getElem... | true |
16007e9dba4d3bff2d74417991e58dcc37a772dc | JavaScript | jagannath-swarnkar/jsAlgo | /hckerrank/commonCharacterCount.js | UTF-8 | 638 | 4.34375 | 4 | [] | no_license | // Given two strings, find the number of common characters between them. EX--
// For s1 = "aabcc" and s2 = "adcaa", the output should be
// commonCharacterCount(s1, s2) = 3.
// Strings have 3 common characters - 2 "a"s and 1 "c".
var readline = require('readline-sync')
var s1=readline.question().split('')
var s2 = re... | true |
3b23a8f51a0190b326d5ed270ef13acf5a00eeae | JavaScript | dotsenkodanylo/image-padder | /inputHandlers.js | UTF-8 | 1,860 | 3.28125 | 3 | [] | no_license | const fs = require('fs');
const checkIfImage = (image) => {
let imageReg = /[\/.](gif|jpg|jpeg|tiff|png)$/i;
return imageReg.test(image);
};
// Validation function that ensures that the input passed in is a single
// argument, otherwise reject the script.
const checkIfSingleInput = (input) => new Promise((re... | true |
ff76fcfd61231d2f21af51b3191442f25bf10e16 | JavaScript | Hazama16138/accountManager | /public/js/main.js | UTF-8 | 527 | 3.109375 | 3 | [] | no_license | $(function() {
// 変数定義
let navItem = $(".side-menu .nav-item a");
let currentPath = location.pathname; // 現在のパスの取得
// メニュー内の各要素のリンク先を取得
$(".side-menu .nav-item").each(function(index, value) {
$path = navItem.eq(index).attr('href');
// 現在のパスとリンク先を比較
if (currentPath == $pa... | true |
c049d26db9d58a41fc29d0d2c7e9f49b1b89d65d | JavaScript | Shaima102617/NBICT-LAB-Lecture-05 | /NBICT-LAB-Lecture-05/script.js | UTF-8 | 102 | 2.9375 | 3 | [] | no_license | let js = 'amazing';
if (js === 'amazing') alert('JavaScript is FUN!');
console.log(12 + 45 + 32 - 4); | true |
436b8b42999fd8ec503df44c391ad69872da3a04 | JavaScript | WYoYao/ES5 | /delayOnload/step2/utils.js | UTF-8 | 2,405 | 2.71875 | 3 | [] | no_license | let utils = {
ajax: (cb) => {
// 创建一个xml对象
let xml = new XMLHttpRequest;
// 请求方式 路径 是否异步
xml.open('get', 'index.json', true);
// 监听返回状态
xml.onreadystatechange = () => {
if (xml.readyState === 4 && /^2\d{2}$/.test(xml.status)) {
cb(xml.respo... | true |
8fbfdd76e595dab7aac04b1a35e3113fd246154d | JavaScript | maverickss/ncg | /click.js | UTF-8 | 568 | 2.921875 | 3 | [] | no_license | function foldall () {
var foldall = document.getElementsByClassName('foldall');
for(var i=0; i<foldall.length; i++) {
var foldthis = foldall[i];
if (foldthis.display == "block") {
foldthis.display = "none";
}
}
};
function foldout(fold) {
foldall(); // collapse everything
if (doc... | true |
c28a8bdb8dae9f6a4b01af5f7a174ddff3a6480d | JavaScript | yuri3/postgresql-notes | /server/controllers/notes.js | UTF-8 | 2,453 | 2.546875 | 3 | [] | no_license | const Note = require('../models').Note;
const Tag = require('../models').Tag;
module.exports = {
create(req, res) {
Note.create({
name: req.body.name,
description: req.body.description,
folderId: req.params.folderId,
})
.then(note => res.send(note))
.catch(error => res.status(40... | true |
e9a106686762c227e07e9686aa3542d10a0d0a1b | JavaScript | alfredjordian/the_art_collector | /app.js | UTF-8 | 10,435 | 3.09375 | 3 | [] | no_license | const BASE_URL = 'https://api.harvardartmuseums.org';
const KEY = 'apikey=6b4532ee-c0ec-4add-a1a3-bda19287bc98'; // USE YOUR KEY HERE
async function fetchObjects() {
const url = `${BASE_URL}/object?${KEY}`;
try {
const response = await fetch(url); //<<<--- is it always beneficial to write code with this... | true |
0967a0b2b8c92ae7abffd8dd026db9cde5002932 | JavaScript | trendiguru/fzz-editor | /modules/path.js | UTF-8 | 1,025 | 3.109375 | 3 | [] | no_license | // http://will.thimbleby.net/algorithms/doku.php?id=algorithm:breadth-first_search
import breadthFirstSearch from './breadth-first-search';
export default function findPathToValue (object, query) {
let path;
breadthFirstSearch(
object,
(parent, key) => {
let value = parent[key];
... | true |
12e16a6642c07b93e02cf5802a4f47a2b1b15c3e | JavaScript | gcarling/advent-of-code | /2018/16/2.js | UTF-8 | 3,597 | 2.59375 | 3 | [] | no_license | const _ = require('lodash');
const fs = require('fs');
const utils = require('../util');
let registers;
// all the functions we need
const ops = {
addr: (a, b, c) => {
registers[c] = registers[a] + registers[b];
},
addi: (a, b, c) => {
registers[c] = registers[a] + b;
},
mulr: (a, b, c) => {
reg... | true |
af55128cb6213331d9b635ffa5eecaf841868b95 | JavaScript | Javierhu89/luzon | /src/components/Quiz/Quiz.js | UTF-8 | 5,627 | 2.640625 | 3 | [] | no_license | import React, { Component } from "react";
import './Quiz.scss';
import data from '../../data'
import Modal from '../Modal/Modal'
import ModalBuena from "../ModalBuena/ModalBuena";
import ModalMala from "../ModalMala/ModalMala";
import { Redirect } from "react-router-dom";
class Quiz extends Component {
constructor(p... | true |
9f900cb6f6fae747031438d50938a6d94a252097 | JavaScript | german9304/qubit-cli | /src/lib/get-resource-ids.js | UTF-8 | 1,723 | 2.53125 | 3 | [] | no_license | const _ = require('lodash')
const suggest = require('./suggest')
const parseUrl = require('./parse-url')
const { isUrl, isId } = require('./is-type')
async function getPropertyAndExperienceIds (propertyIdOrUrl, experienceId, pkg) {
// Try to parse command line arguments first
if (isUrl(propertyIdOrUrl)) return par... | true |
2584c97562719a9813b81f71d24128e7dc846af9 | JavaScript | caocong1/shopclientlittleapp | /shopclient.js | UTF-8 | 1,033 | 2.546875 | 3 | [] | no_license | var appgl = getApp().globalData;
function toggle(t) {
(appgl.open) ? t.setData({ open: false }) : t.setData({ open: true });
appgl.open=!appgl.open;
}
function dragstart(e){
appgl.mark = appgl.newmark = appgl.startmarkX = e.touches[0].pageX;
appgl.startmarkY = e.touches[0].pageY;
}
function drag(e) {
appgl.ne... | true |
f01409906b70a1541a16dc7fc6e97f14564a2759 | JavaScript | jesubu/Reference-CleanArchitecture-DotNet | /Mustache.Reports.Data/ReportRendering/NodeApp/excelRender.js | UTF-8 | 442 | 2.515625 | 3 | [
"MIT"
] | permissive | var xlsxTemplate = require('xlsx-template');
function ExcelRender(){}
ExcelRender.prototype.renderAsBase64 = function(templateContent, reportData, sheetNumber){
var template = new xlsxTemplate(templateContent);
var x = 1;
// Perform substitution
template.substitute(x, reportData);
// ... | true |
dcd2dd4f35909118a8fc4a55229c785ba60d5ab2 | JavaScript | relaxwhc/webpage | /tic-tac-toe.js | UTF-8 | 12,071 | 3.515625 | 4 | [] | no_license | // Tic Tac Toe JavaScript
/*
Click function to mark X or O on the grid: playClick()
Conditions to win: winningCriteria()
Announce the winner (X or O): winningMessage()
Reset the game: gameReset()
*/
let gameStatus = "running";
let counter = 1;
// Onclick to activate symbol change (X or O):
// odd counter number: X, ... | true |
381deb614a3e92597df208a397ccb89b784cab9c | JavaScript | Japhethca/c2g | /api/src/routes/handlers/auth.js | UTF-8 | 1,315 | 2.53125 | 3 | [] | no_license | const { UserDAL } = require("../../db/DAL");
const { createToken } = require("../../helpers/jwt");
const { comparePassword, hashPassword } = require("../../helpers/bcrypt");
async function login(req, res) {
const { email, password } = req.body;
let user;
try {
user = await UserDAL.getUserByEmail(email);
} ... | true |
48a45411ca0807fc6a80f114279da5ece753c76a | JavaScript | Alex030389/CertBolt | /src/js/modules/form.js | UTF-8 | 7,077 | 2.625 | 3 | [] | no_license | 'use strict';
// $(function() {
// if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) {
// $('.form__field').addClass('form__field--border-for-safary');
// }
// });
(function () {
let formHintClassName = '.form__hint';
let selectWrapperClass = '.form__select-wr... | true |
1e44e36164d104b41a651f4edc17ec6c80aebf21 | JavaScript | turtle0617/VueTranning | /todolist/index.js | UTF-8 | 642 | 2.734375 | 3 | [] | no_license | new Vue({
el: '.todoapp',
data: {
newTask: '',
tasks: [],
},
methods: {
addTask: function() {
if (this.newTask.length === 0) {
alert("請勿輸入空白");
return
}
this.tasks.push({
id: this.tasks.length,
title: this.newTask,
isEdit:false,
isCom... | true |
3f2bec9f041c6b45abd224ac7e6de7fa8b97bcbc | JavaScript | lucianlature/sm-react | /src/components/Collection/actions.js | UTF-8 | 2,093 | 2.5625 | 3 | [] | no_license | /**
* Created by Lucian on 18/09/2016.
*/
// import { API_ROOT } from '../../../server/config';
// import { callApi } from '../../utils/api';
import {
LOAD_COLLECTION_REQUEST,
LOAD_COLLECTION_SUCCESS,
LOAD_COLLECTION_FAILURE
} from '../../constants';
const collectionRequest = () => ({
type: LOAD_COLLECTI... | true |
c96c492fb98c32a9eb9f10ee186f41afac086717 | JavaScript | fme2525/FedresursParser | /ExportData.js | UTF-8 | 2,892 | 2.765625 | 3 | [] | no_license | class ExportData {
constructor(headers, fileName) {
this.fileName = fileName;
this.headers= headers;
}
save(itemsNotFormatted) {
let itemsFormatted = [];
itemsNotFormatted.forEach((item) => {
let row = {};
Object.keys(this.headers).forEach(function(headerKeyName) {
let... | true |
f9603e1b995df8f93f61d9dab01fc243b820873b | JavaScript | jkichler/algorithms | /selectionSort.js | UTF-8 | 421 | 3.9375 | 4 | [] | no_license | function selectionSort(array) {
// Write your code here.
const swap = (array, idx1, idx2) => {
let tmp = array[idx1];
array[idx1] = array[idx2];
array[idx2] = tmp;
}
for (let i = 0; i < array.length - 1; i++) {
let lowest = i;
for (let j = i + 1; j < array.length; j++) {
if (array[j] <... | true |
ed050ad2e55d2f9e272af40dcfcf08fb5fbaa5da | JavaScript | nataliasabadysh/Frontend-JS | /module - 8 Event/additional/task9 open modal/js/plugin.js | UTF-8 | 1,813 | 2.921875 | 3 | [] | no_license | 'use strict'
/*
На вкладках HTML и CSS уже готовая верстка модального окна.
По умолчанию модальное окно скрыто классом modal-hidden.
Напишите скрипт который реализует следующее поведение:
- При клике на кнопке с надписью "Open Modal"
и классом js-open-modal, модальное окно с классом modal,
... | true |
2cc35b8ec4bbfe9e2b0249610e61071725fec2f2 | JavaScript | jgarmendia/jgarmendia.github.io | /service-worker.js | UTF-8 | 3,324 | 2.546875 | 3 | [
"MIT"
] | permissive | /*****************************************************************************
*
* Service worker
*
****************************************************************************/
// nombre del cache actual
// IMPORTANTE !!! (se debe cambiar el nombre por cada cambio)
// var cacheName = 'jgarmendia-03';
const CACHE... | true |
7bfdfdbcfb899876b5b420985a7ad958de60bc09 | JavaScript | douglas-clarke/frontend-nanodegree-arcade-game | /js/app.js | UTF-8 | 2,576 | 3.4375 | 3 | [] | no_license | //Character prototype parent object
var Character = function(){}
Character.prototype.render = function() {
ctx.drawImage(Resources.get(this.sprite), this.x, this.y);
};
// Enemies our player must avoid
var Enemy = function(yPosition, speed) {
this.sprite = 'images/enemy-bug.png';
this.x=-83;
this.speed = speed... | true |
1511f7812681e27857ffa90ac4203fd464ddcda0 | JavaScript | AlexyGor/js-basics | /lesson1/2.js | UTF-8 | 429 | 2.953125 | 3 | [] | no_license | /*
2 Объявить две переменные: admin и name. Записать в name строку "Василий". Скопировать
значение из name в admin. Вывести в консоль переменную admin (должно вывести "Василий").
*/
"use strict";
let name = prompt("Введите Ваше имя ");
let admin = name;
console.log("Вы ввели имя " + admin); | true |
2e5f1c949822ec43ddd49c72a5679b9aa19e4e19 | JavaScript | ThaiHa1510/nodejs-ecommerce | /db/redis.js | UTF-8 | 494 | 2.59375 | 3 | [] | no_license | 'use strict '
const redis =require('async-redis');
const client = redis.createClient();
client.on("error", function(error) {
console.error(error);
});
client.on('connect',()=>{
console.log("Connected Redis Server");
});
var setValue = async(key, value) => {
return await client.set(key, value);
};
var ge... | true |
d5ae77fbec8339bb14d168b466d387d8fcc506e5 | JavaScript | henrique-roldao/random-dog-api | /assets/js/main.js | UTF-8 | 681 | 3.15625 | 3 | [] | no_license | const text = document.querySelector("#text");
const imagem = document.querySelector("#img");
async function requestMessage() {
const requestMessage = await fetch("https://api.adviceslip.com/advice");
const dataMessage = await requestMessage.json();
const message = dataMessage.slip.advice;
text.innerHTML = `<p... | true |
8095799ab940a59fd31ec9f36fbeb6821d7041b9 | JavaScript | manohar427/reactjs | /app2/App.js | UTF-8 | 696 | 2.640625 | 3 | [] | no_license | import React from 'react';
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
color: props.initialColor
};
console.log("constructor()");
}
componentWillMount(){
console.log("componentWillMount()");
}
componentDidMount(... | true |
848d17f0a9715573a60cf05ced754e48752a300d | JavaScript | Quantum64/SpongebobQuoteFinder | /src/episodes/s6/e114b.js | UTF-8 | 7,468 | 2.75 | 3 | [] | no_license | const data =
`114b
Ditchin'
Mermaid Man: You'll never escape this time, Man Ray! Our molecular bubble is impenetrable!
Man Ray: That's exactly what I was hoping for.
Mermaid Man: Whoa!
Mermaid Man: Stop!
Man Ray: Thanks for making this easy. Till next time!
Narrator: You just enjoyed another exciting episode of... | true |
116f79fca4c428d9b3fe5788e89d8c7daa98bbaf | JavaScript | stanislav222/vanilaJS | /src/components/navigation.component.js | UTF-8 | 785 | 2.84375 | 3 | [] | no_license | import { Component } from "../core/componen"
export class NavigationComponent extends Component {
constructor(id) {
super(id)
this.tabs = []
}
init() {
this.$el.addEventListener('click', tabClickHeandler.bind(this))
}
listTabs(tabs){
this.tabs = tabs
}
}
fun... | true |
fba56822babce3899c6c7372ae2a0d8d490c498f | JavaScript | creationix/gisty | /lib/cgiParser.js | UTF-8 | 2,785 | 3.453125 | 3 | [] | no_license | // This is a mostly fully interruptible parser for http-like data
// It assumes that chunk's are never broken within a single header line
// TODO: make fully interruptible
var EventEmitter = require('events').EventEmitter;
module.exports = Parser;
Parser.prototype.__proto__ = EventEmitter.prototype;
Parser.prototype.i... | true |
1fc512c812100db4160641884f657797392b65f1 | JavaScript | ririro93/catchmind-clone | /public/canvas.js | UTF-8 | 4,419 | 3.125 | 3 | [] | no_license | ////////////////////////////////////////////////////////////////////// global vars
const colorBtns = [...document.getElementsByClassName("color-Btn")];
const widthInput = document.getElementById("widthInput");
const gameCanvas = document.getElementById("gameCanvas");
const drawMode = document.getElementById("drawMode")... | true |
d9f425c946b5ea6437780e1ab870cc9ff50862ba | JavaScript | svvlcrkt/Counter-Example | /withJs/script.js | UTF-8 | 1,308 | 3.734375 | 4 | [] | no_license | // set initial count
let count = 0;
// select value and buttons
const value = document.querySelector('#value');
const btns = document.querySelectorAll('.btn');
//btns like an array, so we can use forEach method
btns.forEach(function(btn){
// console.log(btn);
// If we print the btn to the screen... | true |
5763f230f04c36b1ed110836149a8a3debe6fdb5 | JavaScript | everthis/leetcode-js | /1061-lexicographically-smallest-equivalent-string.js | UTF-8 | 1,141 | 3.25 | 3 | [
"MIT"
] | permissive | /**
* @param {string} s1
* @param {string} s2
* @param {string} baseStr
* @return {string}
*/
var smallestEquivalentString = function (s1, s2, baseStr) {
if (s1.length === 0 || s2.length === 0) return ''
const uf = new UnionFind()
for (let i = 0; i < s1.length; i++) {
uf.union(s1[i], s2[i])
}
let res... | true |
a7d9270a5e6370f60cdeb2e4c237459dd8d27a67 | JavaScript | igurkirat/javascriptBeginner | /.history/myObjects_20210429123841.js | UTF-8 | 413 | 2.921875 | 3 | [] | no_license | //---javascript objects---
// javascript objects are containers for named values called properties.
//The object values are written in key:value or name:value PerformanceObserverEntryList.
let myPlayer = {
name: 'Mason Mount',
age: 22,
club: 'chelsea',
previousClubs: ['Vitesse', 'DerbyCounty'],
position: 'm... | true |
f74c8ab62cfb2982cc8922a22bf5c33e6ac5f3e7 | JavaScript | Ironhack-Miami-PT-Jan-2021/module1 | /week4/dom-selectors/randomColors/index.js | UTF-8 | 723 | 3.53125 | 4 | [] | no_license | const randomColors = document.getElementsByClassName("random-colors");
// const randomColorsNode = document.querySelectorAll(".random-colors");
console.log(randomColors);
// console.log(randomColorsNode);
function randomColor() {
// const colorValue = Math.floor(
// Math.random() * 15 * 15 * 15 * 15 * 15 *... | true |
edf76e487e489394a4fd5e3616bb60cd2b5cdcc6 | JavaScript | rdankhara/nowtv | /src/reducers/messageActions.js | UTF-8 | 840 | 2.578125 | 3 | [] | no_license | import * as actions from './actions';
import {getChatMessages} from '../service';
//classic way function returning function
export const getMessagesAsyncClassic = () => {
return async dispatch => {
dispatch(actions.getMessageAction());
try {
const data = await getChatMessages();... | true |
d2398c814a1c6704a9848e82308cc2ccf59a36be | JavaScript | elunico/elunico.github.io | /projects/old-site/js/common/command-history.js | UTF-8 | 1,738 | 2.96875 | 3 | [] | no_license |
// TODO: persist between pages?
class CommandHistory {
constructor() {
this.backLog = [];
this.foreLog = [];
this.currentCommand = null;
this.storageKey = `${DOMAIN}command-history`;
this.load();
if (window) {
window.onbeforeunload = () => {
... | true |
e832727c8f73e50c1c0b2d729b122868d41dd6cf | JavaScript | joepie91/node-promise-task-queue | /src/index.js | UTF-8 | 3,244 | 2.65625 | 3 | [
"WTFPL",
"CC0-1.0"
] | permissive | 'use strict';
const Promise = require("bluebird");
const events = require("events");
const extend = require("extend");
const createError = require("create-error");
const TaskQueueError = createError("TaskQueueError", {
code: "TaskQueueError"
});
function defaultValue(value, defaultVal) {
if (value != null) {
ret... | true |
d0f4fd819aef19c9da36b84d2059c21e1f748c98 | JavaScript | Tochukz/BackboneJS | /BackboneJS-Essentials/chp3/crud-app/public/js/app.js | UTF-8 | 7,046 | 2.859375 | 3 | [
"MIT"
] | permissive | $(document).ready(function() {
getUserCollection();
$('#clearBtn').css({display: 'none'});
$('#updateBtn').css({display: 'none'});
$('#addBtn').click(addUser);
$('#clearBtn').click(resetForm);
$('#updateBtn').click(updateUser);
$('#fetchBtn').click(fetchUser);
});
/**global variable */
let users = []... | true |
8c6e17d222c7e3b57e6cf249bee7f422fc81b596 | JavaScript | jeanmrtns/api-petshop | /models/atendimentos.js | UTF-8 | 3,200 | 2.984375 | 3 | [] | no_license | const moment = require("moment");
const conn = require("../infra/connection");
class Atendimento {
add(atendimento, resposta) {
const dataAtual = moment().format("YYYY-MM-DD HH:mm:ss");
const dataAtendimento = moment(
atendimento.dataAtendimento,
"DD/MM/YYYY"
).format("YYYY-MM-DD HH:mm:ss");
... | true |
8b85794e98ea7fa1d746b4caabca624fb2f53249 | JavaScript | gabemonteiro/places | /js/scripts.js | UTF-8 | 1,346 | 3.5 | 4 | [
"MIT"
] | permissive | // Business Logic for Places
function Places() {
this.destinations = []
// this.currentId = 0
}
Places.prototype.addDestination = function(destination) {
// destination.id = this.assignId();
this.destinations.push(destination)
}
// Places.prototype.assignId = function() {
// this.currentId += 1;
// retur... | true |
4f606980c40c0ce451252e8b097e8c1c42b24d3e | JavaScript | Salvador-campos/3e20ds | /1p/ej/arrays/potencia.js | UTF-8 | 115 | 3.28125 | 3 | [] | no_license | var p= new Array();
s=0;
for(i=1;i<11;i++){
s=Math.pow(7, i);
p[i]=s;
console.log(p[i]);
} | true |
f39e41fed483628c7f969b936fd6a512432a2eb5 | JavaScript | Leonardo-Ciocan/ProjectTerminal | /terminal/core/build/index.js | UTF-8 | 2,748 | 2.546875 | 3 | [
"MIT"
] | permissive | 'use strict';
var electron = require('electron');
// Module to control application life.
var app = electron.app;
// Module to create native browser window.
var BrowserWindow = electron.BrowserWindow;
var path = require('path');
var ipc = require("ipc");
ipc.on("hello", function (event, msg) {
console.log("browser ... | true |
5eab34b1c3b6bba6f8c6d2b38127369d9f15f17a | JavaScript | SergeAstapov/chat | /public/js/plugins/moderation/view.js | UTF-8 | 1,759 | 2.859375 | 3 | [] | no_license | const template = '' +
'<button class="chat-moderation-btn">Sign in</button>' +
'<form class="chat-moderation-login">' +
'<input name="login" placeholder="Login">' +
'<input name="password" placeholder="Password" type="password">' +
'<input name="submit" type="submit" value="Became Gramma... | true |
d9212b8d741335a935109dd7c5ff2462bf7350bd | JavaScript | winiceo/pm_pmker | /app/extend/filter.js | UTF-8 | 958 | 2.828125 | 3 | [
"MIT"
] | permissive | /**
* Created by leven on 17/2/20.
*/
const moment = require('moment');
moment.locale('zh-cn');
module.exports = {
date(date, format) {
date = moment.unix(date);
if (format == 1) {
return date.fromNow();
}
format = format || 'MM-DD HH:mm';
return date.format(format);
},
dateAt(date, f... | true |
db2bd4fa0689f6f81d8205b8f612846fd7c1e1a1 | JavaScript | LeoSan/Basico_Stack_React_MERN | /Cliente/context/app/appState.js | UTF-8 | 5,941 | 2.578125 | 3 | [] | no_license | import React, {useReducer} from 'react';
import appContext from './appContext';
import appReducer from './appReducer';
import clienteAxios from '../../config/axios';
//Importamos el tipo de accion
import {
MOSTRAR_ALERTA,
OCULTAR_ALERTA,
SPINER_LOADING,
SUBIR_ARCHIVO_EXITO,
SUBIR_ARCHIV... | true |
0f6eddd25b1f57635946587304a15f79fd4585d4 | JavaScript | migimigi/greasemonkey | /ShowDeletedTweetOnTogetter.js | UTF-8 | 854 | 2.578125 | 3 | [] | no_license | // ==UserScript==
// @name Show deleted tweet on togetter.
// @namespace https://github.com/migimigi/greasemonkey
// @version 0.1
// @description enter something useful
// @match http://togetter.com/li/*
// @copyright 2014+, migimigi
// ==/UserScript==
function showTweet(targetItem){
var url = targe... | true |
4590677878a780680e27d5e3a6748eda7686a55a | JavaScript | ProninDP/lesson2 | /src/game.js | UTF-8 | 2,303 | 3.09375 | 3 | [] | no_license | let field = [[0, 0, 0], [0, 0, 0], [0, 0, 0]];
// eslint-disable-next-line no-unused-vars
let currentPlayer = 1;
let status = 'Ok';
function setStatus(string) {
status = string;
}
function setCurrentPlayer(i) {
currentPlayer = i;
}
function getCurrentPlayer() {
return currentPlayer;
}
function setField(x, y) {
... | true |
c38ef93ed08a55f597ccced8b8c838ebb5724e46 | JavaScript | SidraShaikh-2/Saylani-WebDev-BySidra | /Javascript Assignment/app1.js | UTF-8 | 1,096 | 3.8125 | 4 | [] | no_license | // Chapter 1
//1. Write a script to greet your website visitor using JS alert box.
alert ("Hello world!");
//2. Write a script to display following message on your web page:
alert ("Error! Please enter valid password.");
// 3. Write a script to display following message on your web page: (Hint : Use... | true |
f911829c42e8030f988efe192b921909562fa6c6 | JavaScript | reichert621/learning | /algorithms/sorting/bubble-sort.js | UTF-8 | 513 | 4.21875 | 4 | [
"MIT"
] | permissive | /**
* Utility to swap two elements of an array
*/
const swap = (arr, i, j) => {
let tmp = arr[i];
arr[i] = arr[j];
arr[j] = tmp;
return arr;
};
/**
* Bubble sort
* Complexity: O(n^2)
* @param {Array} arr - array to sort
* @return {Array} sorted array
*/
module.exports = function bubblesort(arr) {
l... | true |
a60d49d6fdab8b065adf9a712f2c1f380aaad691 | JavaScript | dinavinter/gojs-editor | /src/fakebknd.js | UTF-8 | 369 | 2.90625 | 3 | [
"MIT"
] | permissive | let realFetch = window.fetch;
window.fetch = function (url, opts) {
return new Promise((resolve, reject) => {
// wrap in timeout to simulate server api call
setTimeout(() => {
// pass through any requests not handled above
realFetch(url, opts).then(response =>... | true |
97ddb0af0ed71b54a49f8c34d4e15eaf0df31475 | JavaScript | steffen-liersch/jint | /Jint.Tests.Test262/test/built-ins/Promise/S25.4.3.1_A5.1_T1.js | UTF-8 | 562 | 2.640625 | 3 | [
"BSD-2-Clause",
"BSD-3-Clause",
"LicenseRef-scancode-ecma-no-patent"
] | permissive | // Copyright 2014 Cubane Canada, Inc. All rights reserved.
// See LICENSE for details.
/*---
info: |
Promise executor has predictable environment
'this' should be global object in sloppy mode,
undefined in strict mode
es6id: S25.4.3.1_A5.1_T1
author: Sam Mikes
description: Promise executor gets default ha... | true |
ebc9d41d01fac54acf95c644fdfca532bff4ee2c | JavaScript | zxx178239/buildingblock | /assets/scripts/manager/AudioManager.js | UTF-8 | 3,680 | 2.515625 | 3 | [] | no_license | /*
* @Author: xxZhang
* @Date: 2019-07-05 15:00:18
* @Description: 音效管理器
*/
export var AudioManager = (function() {
var instance;
var AudioManager = function() {
if(!instance) {
instance = this;
this.init();
}
return instance;
};
AudioManager.prototy... | true |
e6fe1f8337ff9027b68cd3e71d7ac700dd188481 | JavaScript | gx1123/Eshopping | /pages/cart/cart.js | UTF-8 | 4,524 | 2.703125 | 3 | [] | no_license | Page({
/**
* 页面的初始数据
*/
data: {
hasList: true, //购物车是否有数据
totalMoney: 0, //总金额
selectAllStatus: false, //是否全选
uid: 0, //用户ID
totalCount: 0, //数量
carts: [{
name: '中天酒庄官方旗舰店',
content: [{
goods_name: '111',
guige: '200',
price: 300,
goods_img:... | true |
09d246bafb061ea65e73ef655bd9d02a8d905f00 | JavaScript | cferdinandi/atomic | /test/spec/atomic-spec.js | UTF-8 | 2,230 | 2.671875 | 3 | [
"MIT"
] | permissive | /**
* atomic.js
*/
describe('atomic', function () {
/**
* xhr
*/
describe('xhr', function () {
beforeEach(function () {
spyOn(XMLHttpRequest.prototype, 'open').and.callThrough();
spyOn(XMLHttpRequest.prototype, 'send');
spyOn(XMLHttpRequest.prototype, 'setRequestHeader');
});
it('should open a... | true |
b4c4f42e53f07017734af103358d1311ab435276 | JavaScript | ryandens/GuessThePrice | /test/integration-test.js | UTF-8 | 1,525 | 2.65625 | 3 | [] | no_license | require("babel-polyfill");
require("dotenv").config();
const assert = require("chai").assert;
const vds = require("virtual-device-sdk");
describe("GuessThePrice Integration Test", function() {
this.timeout(120 * 1000);
describe("Onboarding Test", function () {
it("Runs through game with two players", ... | true |