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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
e57905357227a38295b1ef2d6316d405327d68b6 | JavaScript | reactjs-andru1989/redux_comments | /src/reducers/comments.js | UTF-8 | 573 | 2.609375 | 3 | [] | no_license | const comment = (state, action) => {
switch (action.type) {
case 'ADD_COMMENT':
return {
id: action.id,
author: action.author,
text: action.text
}
break;
default:
return state;
}
}
const comments = (state = [], action) => {
switch (action.type) {
case ... | true |
bd6d3ab3324ca6f12f8fd6f507d8c6f7f0d44a7d | JavaScript | mbaiges/foodwayz-frontend | /api/extras/main.js | UTF-8 | 2,783 | 3.09375 | 3 | [] | no_license | /*
import { RoomApi, Room } from './room.js';
var currentRoom;
var createButton, updateButton, deleteButton, getButton, getAllButton, abortButton;
var resultTextArea;
var abortController;
function toggleButtons(disabled) {
createButton.disabled = disabled;
updateButton.disabled = !disabled;
deleteButton.disable... | true |
f4b0e4c8ed9e44a89938d431dd7355e686e282ab | JavaScript | michaellorzing/Hot-Restaurant | /public/assets/js/reserve.js | UTF-8 | 972 | 3.03125 | 3 | [] | no_license | var $submitBtn = $(".submit");
var handleSubmitClick = function(event) {
event.preventDefault();
// Get reservation info from the form
var newReservation = {
name: $("#reserve-name").val().trim(),
phone: $("#reserve-phone").val().trim(),
email: $("#reserve-email").val().trim()
};
// POST the re... | true |
55baad62ab573e13b30b66fd7b3907f9fcd5e53f | JavaScript | kuaishou/JS-algorithm | /11sort/selectionSort.js | UTF-8 | 519 | 3.984375 | 4 | [] | no_license | //选择排序方法---时间复杂度为O(n2)比较差
Array.prototype.selectionSort = function(){
for(let i=0; i<this.length; i++ ){
let minIndex=i
for(let j=i; j<this.length; j++ ){
if(this[j]<this[minIndex]){
minIndex=j
}
}
if(i!==minIndex){
let temp=this[i... | true |
fa99bef4f5156229e0451b1e6d478a50e944bdcb | JavaScript | dilipcse/coursera_week_2 | /app.js | UTF-8 | 1,625 | 2.546875 | 3 | [] | no_license | (function(){
'use strict';
angular.module('ShoppingListCheckOff',[])
.controller('ToBuyController',ToBuyController)
.controller('AlreadyBoughtController',AlreadyBoughtController)
.service('ShoppingListCheckOffService',ShoppingListCheckOffService);
ToBuyController.$inject=['ShoppingListCheckOffService'];
funct... | true |
6bdfbb7bfa2c961175d6731b26b2e62ee8b1af8a | JavaScript | IvMarie/basic-js | /src/st-mine-sweeper.js | UTF-8 | 1,711 | 3.65625 | 4 | [
"MIT"
] | permissive | import { NotImplementedError } from '../extensions/index.js';
/**
* In the popular Minesweeper game you have a board with some mines and those cells
* that don't contain a mine have a number in it that indicates the total number of mines
* in the neighboring cells. Starting off with some arrangement of mines
* we ... | true |
7507d027b2e33248e07c01626466ae09b5eb5348 | JavaScript | xaquingv/basichartool | /src/components/section4Panel/paletteDropColorHack.js | UTF-8 | 1,367 | 2.546875 | 3 | [] | no_license | import {rgbToHex} from '../../lib/utils'
export function isHighlight(step) {
if (step!==4) {
return false
} else {
const elLegend = document.querySelector(".legend")
const noColors = elLegend ? elLegend.querySelectorAll(".legend-item").length === 0 : false
return elLegend && noColors
}
}
export ... | true |
cc85bf69f2637b5ffceee1cf65f969c8ce3c294b | JavaScript | yuong1979/reactproject | /src/frontend/src/components/leadmanager/store/reducers/leads.js | UTF-8 | 1,096 | 3.09375 | 3 | [] | no_license | import { GET_LEADS, DELETE_LEAD, ADD_LEAD, GET_TESTS } from '../actions/types.js'
const initialState = {
//the leads here are what you have in your backend that you feed in here
leads: []
}
export default function (state = initialState, action ) {
switch (action.type) {
case GET_LEADS:
return {
...sta... | true |
cb39265b42b080abefd83ade1efd34d7ed241323 | JavaScript | thodges314/williams-sonoma-challange | /src/services/loadProductData.js | UTF-8 | 561 | 2.59375 | 3 | [] | no_license | import jsonData from 'resources/index.json'
export function loadProductData () {
// const targetUrl = 'https://www.westelm.com/services/catalog/v4/category/shop/new/all-new/index.json'
// const targetUrl = 'https://www.westelm.com/services/catalog/v4/category/shop/new/all-new/index.json'
// let productData
// ... | true |
915f57428b768a3cc24e553fec949bad0374d127 | JavaScript | alfonsog714/leet-code | /exercises/LC242_isAnagram/index.js | UTF-8 | 1,314 | 3.84375 | 4 | [] | no_license | // First solution
// ===========================
// function isAnagram(s, t) {
// const letters1 = {};
// const letters2 = {};
// if (s.length !== t.length) return false;
// for (let char of s) {
// if (!letters1[char]) {
// letters1[char] = 1;
// } else {
// le... | true |
d3316f6611acd919fbc9801d68543883cacbeefa | JavaScript | dianakaminska/swdt_selenium | /BasePage.JS | UTF-8 | 3,525 | 2.96875 | 3 | [] | no_license | 'use strict';
class BasePage {
constructor(webdriver, driver, timeout = 5000) {
this.timeout = timeout;
this.driver = driver;
this.webdriver = webdriver;
}
async quit() {
await this.driver.quit();
}
async get(url) {
await this.driver... | true |
70e47adcbf07f962bbc2067d5dbba9408b1ac52e | JavaScript | dachun-tech/WeixinHoney2nd | /backend/assets/js/shop.js | UTF-8 | 13,164 | 2.515625 | 3 | [
"MIT"
] | permissive | /*
fileName: shop.js
description: process Shop
*/
// Code included inside $( document ).ready() will only run once the page Document Object Model (DOM) is ready for JavaScript code to execute
$(document).ready(function () {
$('#searchContinent').on('change', function () {
var country_list = $('#country... | true |
82c51669c3f6648c192d46abdf1f86c7e29d60ec | JavaScript | kryptocewl/react-app1 | /src/index.js | UTF-8 | 880 | 2.75 | 3 | [] | no_license | import React from "react";
import ReactDom from "react-dom";
import { data } from "./books"; // named export/import
import SpecificBook from "./Book"; // default export/import : can be renamed as SpecificBook for example
import { greeting } from "./testing/testing";
//CSS
import "./index.css";
/*
const names = ["john"... | true |
376328382c3d76c980b8eaaee8909e9b938ff358 | JavaScript | tangweikun/javascript-design-pattern | /structural/decorator/Sample-5.js | UTF-8 | 1,057 | 4.3125 | 4 | [] | no_license | // Decorating Constructors With New Functionality
// A vehicle constructor
function Vehicle(vehicleType) {
this.vehicleType = vehicleType || 'car'
this.model = 'default'
this.license = '00000-000'
}
// Test instance for a basic vehicle
// Outputs: vehicle: car, model:default, license: 00000-000
const testInstan... | true |
62fc899ca22f0d41096f58f149eba5eb87bc2b2c | JavaScript | tomfjug/Visualizing-3D-geology-with-React-and-X3DOM | /src/terrain.js | UTF-8 | 1,372 | 2.515625 | 3 | [] | no_license | import React from 'react';
class Terrain extends React.Component {
constructor(props) {
super(props);
this.state = {
isVisible: this.props.render
};
this.toggleRef = React.createRef();
this.changeVisibility = this.changeVisibility.bind(this);
}
componentDidMount() {
//The size attribute of ... | true |
d7000370b6d7af660e7f6222ad2f100e5badd346 | JavaScript | PieterGrabijn/BoterKaasEnEieren | /screens/HomeScreen.js | UTF-8 | 7,649 | 2.515625 | 3 | [] | no_license | import React from 'react';
import {
Image,
Linking,
Platform,
ScrollView,
StyleSheet,
Text,
TouchableOpacity,
View,
TouchableHighlight
} from 'react-native';
import { MonoText } from '../components/StyledText';
export default class HomeScreen extends React.Component {
constructor(props) {
super... | true |
2203e6c3e19dbb6481417292dc5b1d0d41f4b325 | JavaScript | SigneLuque17/Proyecto-POO-III2018 | /js/controlador-calificaciones.js | UTF-8 | 2,414 | 2.921875 | 3 | [
"MIT"
] | permissive | $(document).ready(function(){
console.log("Se ha cargado el DOM");
$.ajax({
url:"ajax/calificaciones.php?accion=1",
method:"GET",
data:"numDocente="+$("#txt-empleado").val(),
dataType:"json",
success:function(respuesta){
console.log(respuesta);
$("#sl-clases").append(`<option valu... | true |
f330f6319066724b8b0ecefc471ae8b02f99689b | JavaScript | kma3a/Assessment | /zooKeeper.js | UTF-8 | 5,274 | 3.078125 | 3 | [] | no_license | var sget = require('sget');
function Tiger(name) {
this.name = name;
this.hungry = 5;
this.energy = 6;
this.healthy = true;
this.tired = 5;
this.dead = false;
}
Tiger.prototype.sleep = function(){
if (this.tired > 0) {
this.hungry +=1;
this.tired -=2;
this.energy += 1;
console.log(this.name + " ... | true |
d44238bf27720df1be13f55f803f76fa5d5a6923 | JavaScript | Oliviao/blogs | /vue响应式原理/code/js/k.js | UTF-8 | 422 | 3.34375 | 3 | [] | no_license | if(index == 0){
return 0;
}
var uglyArray = [1],
two = 0,
three = 0,
five = 0;
for(var i=1;i<index;i++){
uglyArray[i] = Math.min(uglyArray[two]*2,uglyArray[three]*3,uglyArray[five]*5);
if(uglyArray[i]==uglyArray[two]*2){
two++;
}
if(uglyArray[i]==uglyArray[three]*3){
thre... | true |
5e4baa3458b2b7e9c8a20a6cb8f1bf0ce9da33fb | JavaScript | DanAmador/web | /3/public/assets/js/ajax.js | UTF-8 | 6,145 | 2.578125 | 3 | [
"MIT"
] | permissive | let API_URL = 'http://localhost:3000'
function pad(n) {
n = n + '';
return n.length >= 3 ? n : new Array(3 - n.length + 1).join(0) + n;
}
function getFullTable() {
$.ajax({
type: "GET",
url: `${API_URL}/items`,
async: true,
dataType: 'json',
success: function (data) {
$("#table_body").h... | true |
ef690c945dbe515923b5c261e65a15f4cd515f9b | JavaScript | vinibanaco/masti-education | /api/routes/user.router.js | UTF-8 | 3,225 | 2.546875 | 3 | [] | no_license | const express = require('express');
const passport = require('passport');
const jwt = require('jsonwebtoken');
const { db } = require('../database/db');
const { secret, validatePermission } = require('../handlers/authentication.handler');
const router = express.Router();
const secure = [passport.authenticate('jwt', ... | true |
761805509416aa2675d1db1782c34cafc8c4edef | JavaScript | miestwin/mean_app | /public/js/filters/car-checkbox.filter.js | UTF-8 | 658 | 2.515625 | 3 | [] | no_license | angular.module('CarCheckboxFilter',[])
.filter('carCheckboxFilter', function() {
return function(items, types, name) {
var filtered = [];
var values = [];
for(t in types) {
if(types.hasOwnProperty(t)) {
values.push(types[t]);
}
... | true |
0ad1a5ad2017b0895cc2b8d120db34a37d50ccd2 | JavaScript | christianparke37/codeup-web-exercises | /js/for_loops.js | UTF-8 | 967 | 3.5625 | 4 | [] | no_license | // returnMultiplicationTable function
function returnMultiplicationTable(num) {
timesTable = '';
for (var i = 1; i < 11; i++) {
var product = num * i;
for (let i = 1; i < 11; i++) {
let product = num * i;
timesTable += num + " x " + i + " = " + product
if (i != 10) ti... | true |
a5994b672cbc705fee30ca782f40eaf320e0809c | JavaScript | ghsi10/capbreaker | /src/main/resources/static/scripts/upload-text.js | UTF-8 | 295 | 2.53125 | 3 | [
"MIT"
] | permissive | $(document).ready(function () {
$("#terms").click(function () {
var checked_status = this.checked;
if (checked_status === true)
$("#upload-file-btn").removeAttr("disabled");
else
$("#upload-file-btn").attr("disabled", "disabled");
});
}); | true |
c96a8083e9a2ef310d883b9bf6f1a0b406c9c97a | JavaScript | Theehawau/artisan-hub | /public/js/utils.js | UTF-8 | 3,128 | 2.578125 | 3 | [] | no_license | const showResults = debounce(function (arg) {
var value = arg.trim();
if (value === "" || value.length <= 0) {
$("#search-results").fadeOut();
return;
} else {
$("#search-results").fadeIn();
}
var jqxhr = $.get("/search/?q=" + value, function (data) {
$("#search-results").html("");
})
.done(function (da... | true |
7bd39af40f47609ce1fbb14f0a231dab5c72ea36 | JavaScript | Yeti-or/my_stream_adventure | /lines.js | UTF-8 | 394 | 2.5625 | 3 | [] | no_license | var through = require('through'),
split = require('split'),
odd = true,
stream = through(function write(buf) {
//console.log((odd = !odd) ? buf.toUpperCase() : buf.toLowerCase());
this.queue(((odd = !odd) ? buf.toUpperCase() : buf.toLowerCase()) + '\n');
});
proc... | true |
9ed058f0e2393fafea0c1e21de3f9a0aa83af1e2 | JavaScript | aljaywhite/Color-Rut | /JS/app.js | UTF-8 | 2,664 | 3.5 | 4 | [
"MIT"
] | permissive | const alphabet = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"];
const colorDots = document.getElementById("dots-container");
let red;
let green;
let blue;
let rgbColor;
//Gets Rand... | true |
c1f14f855201b93f9d87e71ab61380e71e9cfebd | JavaScript | lily-white/domScripting | /Lily-0.3.js | UTF-8 | 4,677 | 2.765625 | 3 | [] | no_license | if(!String.repeat){
String.prototype.repeat = function (count){
return new Array(count + 1).join(this);
}
}
if(!String.trim){
String.prototype.trim = function (){
return this.replace(/^\s+|\s+$/g, '');
}
}
(function(){
//命名空间
var Lily = {}
if(!window.Lily){
window['Lily'] = Lily
}
function isCompatible(... | true |
9d688d67a19dd36c48884d35ec7e6f14741c2293 | JavaScript | fulalsayab/CODE-CHALLENGES-INTERMEDIATE-JAVASCRIPT | /reverseArray/reverseArray.js | UTF-8 | 1,685 | 5.125 | 5 | [] | no_license | /** Different ways to reverse an array in javaScript */
//First: simple for..loop
// This way takes more memory and basic
let sentence = ["sense.", "make", "all", "will", "This"];
const reverseArray = (array) => {
// create a new empty array to hold the the reverse element of the given array
let newArray = [... | true |
23ec91b495533c8c73f47563c85a73f839a3e2b0 | JavaScript | irvelervel/first-react-app | /src/App.js | UTF-8 | 986 | 2.65625 | 3 | [] | no_license | import logo from './logo.svg'
import './App.css'
import MyComponent from './MyComponent'
import ClassComponent from './ClassComponent'
function App() {
return (
// JSX
<div className="App">
{/* will be converted into <div class="App"> */}
<header className="App-header">
<img src={logo} cl... | true |
a923c17883ef2a8e9107c81a2ee178d78b0e4102 | JavaScript | robertostaszewski/shopping-list | /src/App.js | UTF-8 | 4,850 | 2.515625 | 3 | [] | no_license | import React from 'react';
import { Client, } from '@stomp/stompjs';
const URL = 'http://localhost:8080/rest'
const client = new Client({
brokerURL: 'ws://localhost:8080/gs-guide-websocket',
debug: function (str) {
console.log(str);
}
})
const App = () => {
const [featchedLists, setLists] = React.useStat... | true |
0dcdb6c2e18b4641828ed79cd5c82fe5dd33d3aa | JavaScript | PavelZagzin/sspu | /controllers/reports/utils/Status.js | UTF-8 | 1,182 | 2.78125 | 3 | [] | no_license | class Status {
constructor() {
this.active = {
ctr: 0,
sd: 0,
nd: 0
};
this.active6m = {
ctr: 0,
sd: 0,
nd: 0
};
this.expired = {
ctr: 0,
sd: 0,
nd: 0
};
}
add(otherStatus) {
this.active.ctr += otherStatus.active.ctr;
this.ac... | true |
7106bdb81a459d0c01c595dd0dfa627a86a5c4c2 | JavaScript | cfware/random-passwd | /test.cjs | UTF-8 | 1,066 | 3.078125 | 3 | [
"MIT"
] | permissive | 'use strict';
const t = require('libtap');
const randomPasswd = require('./lib.cjs');
const requireNumberError = new TypeError('The argument must be a whole number if provided');
const badRangeError = new RangeError('The argument must be >= 6 && <= 256 if provided');
t.type(randomPasswd, 'function');
t.test('error... | true |
d1ff133538423ccd113e29310ff3ff4fd88966ca | JavaScript | arunasSlenderis/Work_hours | /shared/addUserValidation.js | UTF-8 | 775 | 2.78125 | 3 | [] | no_license | import Validator from "validator";
import isEmpty from "lodash/isEmpty";
export default function validateInput(data) {
const errors = {};
if(Validator.isEmpty(data.name)) {
errors.name = "First name is required";
}
if(Validator.isEmpty(data.lastName)) {
errors.lastName = "Last name is required";
}
... | true |
e71790cbadb1406de41f240ccbe57cc12f600ad1 | JavaScript | helgasitanggang93/LogicExcersise | /pushRank/codewars3.js | UTF-8 | 1,201 | 3.671875 | 4 | [] | no_license | function alphabetPosition(text) {
var alphabet = 'abcdefghijklmnopqrstuvwxyz' // 1. buat variabel kamus alphabet a-z di variabel 'alphabet'
var newarr = [] // 2. buat array kosong dengan nama 'newArr'
for(var i = 0; i < text.length; i++){ // 3. buat perulangan dengan variabel i dengan nilai 0, dengan limit... | true |
2dff31cb1209b91045d1b951f24d8fcb3341e4ea | JavaScript | IronPTSolutions/js-es6-oop | /assets/js/models/student.js | UTF-8 | 459 | 3.34375 | 3 | [] | no_license | class Student extends Person {
constructor(name, lastName, age, subjects = []) {
super(name, lastName, age);
this.subjects = subjects;
}
addSubject(name, note) {
this.subjects.push({
name: name,
note: note
})
}
getCourseAvg() {
const sum = this.subjects.reduce((acc, subject)... | true |
38bf4228c875e0bc5142adc673f4c6f94a4a8b79 | JavaScript | lenatran/belly_button_biodiversity | /static/index.js | UTF-8 | 3,628 | 3.078125 | 3 | [] | no_license | // Reference to the dropdown select tag
function getOptions() {
var selector = document.getElementById("selDataset");
Plotly.d3.json("/names", function(error, sampleNames){
for (var i=0; i < sampleNames.length; i++) {
var currentOption = document.createElement("option");
currentO... | true |
677c07df77259488f9c62b7c87116105f3d94862 | JavaScript | demianalonso/challonge-dashboard | /server/modules/challonge/index.js | UTF-8 | 2,211 | 2.703125 | 3 | [] | no_license | const fetch = require('isomorphic-fetch')
const { apiKey, baseURL, subdomain } = require('./constants')
const parsePlayers = ({ participants }) => participants.map(parsePlayer)
const parsePlayer = ({ participant }) => ({
id: participant.id,
name: participant.name
})
const parseMatches = ({ matches, participants }... | true |
fb005f6933b6eca33783e14aa74077a159dbe70a | JavaScript | RebekahKlemm/HLD | /reducers/user-reducer.js | UTF-8 | 2,522 | 2.625 | 3 | [] | no_license | import React from 'react'
import {ADD_USER, RECEIVE_USERS, UPDATE_CURRENT_USER, UPDATE_USER, EDIT_USER, REFRESH_USERS, DELETE_USER} from '../actions/constants';
const initialState = {
allUsers: [],
currentUser: {}
}
export default function (state = initialState, action) {
let newState = Object.assign({},... | true |
2cd1c4ce050ee965df03e2d6a50da3f87594146d | JavaScript | araviel-io/Solly-Wallet | /src/pages/VerifyMnemonicPage.js | UTF-8 | 2,352 | 2.765625 | 3 | [] | no_license | import { useEffect, useState } from 'react';
import { useHistory, useLocation } from 'react-router-dom';
import { ordinalSuffixFormatter } from '../utils/utils';
import { validateMissingMnemonicPhrase } from '../utils/validators';
const VerifyMnemonicPage = () => {
const location = useLocation();
const history... | true |
48b350db272f4d2b5300b4e3598434efae2f7ded | JavaScript | dallegro/jQuery | /06_실습/05.jQuery_flow/js/main_210209.js | UTF-8 | 3,060 | 3 | 3 | [
"MIT"
] | permissive | // main.js
//신상품 정보 전역변수 셋팅
var sinsang = {
"m1": "[남성]카모전판프린트 PQ 티셔츠^DMTS7K731-MG^99,000원",
"m2": "[남성]빅로고 컬러 블럭 PQ 티셔츠^DMTS7G731-BK ^89,000원",
"m3": "[남성]빅로고 컬러 블럭 PQ 티셔츠^DMTS7G731-WH ^89,000원",
"m4": "[남성]부분 스트라이프 PQ 티셔츠^DMTS77731-NY ^99,000원",
"m5": "[남성]웰딩포인트 트레이닝 하프팬츠^DMTB61731-MD ^89,000원",
... | true |
934bc5b4a3eebb20fb780b12de2c4935c430c130 | JavaScript | blckt/pl | /Player.WebApp/src/reducers/userReducer.js | UTF-8 | 479 | 2.515625 | 3 | [
"MIT"
] | permissive | import { REGISTER, LOGOUT } from '../constants/userContants';
let user = {
token: null
}
const userReducer = (state = user, action) => {
switch (action.type) {
case REGISTER: {
if (action.token) {
return Object.assign({}, state, action.token);
}
bre... | true |
feaca138174ebcd17f52fba19acc2e57a4e1e721 | JavaScript | GuoQichen/pure-node-notebook | /test/buffer.js | UTF-8 | 1,286 | 3.28125 | 3 | [] | no_license |
const assert = require('assert')
const fs = require('fs')
/**
*
* Usage:
*
* Buffer.from(array)
* returns a new Buffer containing a copy of the provided octets.
*
* Buffer.from(arrayBuffer[, byteOffset [, length]])
* returns a new Buffer that shares the same allocated memory as the given ArrayBuffer.
* ... | true |
4dc3196da2a5542dca32dda3eb1a12f626ae3260 | JavaScript | MikeAustin71/jspmBabelReact | /src/main.jsx | UTF-8 | 452 | 2.6875 | 3 | [] | no_license | import React from 'react';
import ReactDOM from 'react-dom';
var App = React.createClass({
render: function(){
return (
<h1>Hello from component-1 </h1>
);
}
});
class HelloMessage extends React.Component{
render() {
return <h1>Hello from component-2!</h1>
}
}
Reac... | true |
0a661010f9508e04a9586d9e572a8cb69cf5c7f6 | JavaScript | MicroStrategy/embedding-sdk-samples | /library_browsing/js/main.js | UTF-8 | 7,707 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | /**
* Display list of report which came in search result by user search criteria.
*/
function startReport() {
const baseURL = sessionStorage.getItem("baseURL");
const token = sessionStorage.getItem("token");
getSession(baseURL, token)
.then(session => {
extendSession(baseURL,token);
... | true |
679483c26ccbec5df7fa7299f2ac9bcd15412de4 | JavaScript | patrickhuang94/javascript-leetcode | /zumper.js | UTF-8 | 1,219 | 3.921875 | 4 | [] | no_license | // [2, 7, 3] => [2, 7, 4]
// [9, 9, 9] => [1, 0, 0, 0]
var addOne = function(arr) {
//Solution 1
var num = parseInt(arr.join('').toString()) + 1; //num = 273 + 1 => 274
//Integer -> string -> array of strings
num = num.toString().split(''); ['2', '7', '4']
var result = num.map(function(x)... | true |
0afbab8c5da6ab486d1b3352db2ed9d2c3943dc8 | JavaScript | CodeCoreYVR/lab_solutions_mar_2021 | /js_manipulating_the_DOM/making_a_simpler_createElement/solution.js | UTF-8 | 963 | 4.0625 | 4 | [] | no_license | // Create a function, H, that takes a tagName as argument
// and returns a new node of tagName type.
function H(tagName) {
return document.createElement(tagName);
}
// Add support for another argument to pass it html attributes as a plain old object
function H(tagName, attributes) {
let node = document.createElemen... | true |
18be52b4c285bb0b6b878a20ea5e623cebfcab34 | JavaScript | davidbecker6081/HeadCount2.0 | /test/DistrictCard.test.js | UTF-8 | 6,468 | 2.5625 | 3 | [] | no_license | import React from 'react';
import ReactDOM from 'react-dom';
import DistrictCard from '../src/DistrictCard';
import { mount, shallow } from 'enzyme'
import DistrictRepository from '../src/DistrictRepository'
import kinderData from '../data/kindergartners_in_full_day_program.js';
describe('DistrictCard', () => {
let ... | true |
80cee79c472854b5055780dcdcd39900ea941002 | JavaScript | metaclass-nl/switch-language-example-globalize | /src/App.js | UTF-8 | 6,366 | 2.671875 | 3 | [
"CC0-1.0",
"MIT"
] | permissive | /** In order to simplify removing this demo code this
* class has not been refactored into SOLID components.
*/
const localeSettings = require("../localeSettings.json");
import Globalize from "globalize";
// supplementals are loaded by LocaleDataLoader
// remove this if you do not need timezones, it's 2,9 Mb!
Glob... | true |
feb4e5c2396dba10203160191600a553e0345f51 | JavaScript | Ltricha/examen_herkansing | /bookzure-backend/public/js/script.js | UTF-8 | 1,178 | 3.25 | 3 | [] | no_license | /*
const bookList = {
book1: { name: "A", date: "2019", author: "a" },
book2: { name: "B" },
book3: { name: "C"}
};
*/
//let addToCartBtn = document.getElementsByClassName("");
/*
function addToCart() {
}
var bookList = [
{ name: "A", author:"", img:"2001", price:""},
{ name: "B", author:"", img... | true |
b04339725e2ffba3b596795702cf2f3824abc757 | JavaScript | tfarida/CS572 | /Homework 01 - ECMAScript 6/prob3_applyCoupon.js | UTF-8 | 674 | 3.5625 | 4 | [] | no_license | //we want to create a curryable function that takes args in this orders
//Category
//Discount between 0 and 1
//And item
//and returns the item with correct price
//implement applyCoupon as a curryable function
const item = {
"name": "Biscuits",
"type": "regular",
"category": "food",
"price"... | true |
8e99719427c3cdc467d7ad02fe8a4ad63c6cf308 | JavaScript | aurindo/crudVue | /src/logger/index.js | UTF-8 | 1,397 | 3.0625 | 3 | [
"MIT"
] | permissive | class Logger {
// Log levels as per https://tools.ietf.org/html/rfc5424
static get ERROR () { return 0 }
static get WARN () { return 1 }
static get INFO () { return 2 }
static get DEBUG () { return 3 }
static get LEVEL_NAMES () { return ['ERROR', 'WARN', 'INFO', 'DEBUG'] }
constructor (options) {
th... | true |
26ff1258f37302afefdaf709160d96ba84c5e282 | JavaScript | freebz/Refactoring | /ch07/ex7-20.replace-primitive-with-object.js | UTF-8 | 226 | 3.328125 | 3 | [] | no_license | // 기본형을 객체로 바꾸기
// Replace Primitive with Object
orders.filter(o => "high" === o.priority
|| "rush" === o.priority);
// ▼
orders.filter(o => o.priority.heigherThan(new Priority("normal")))
| true |
9ec7fd14cc5b343067fec0c22a7f3a1789975789 | JavaScript | kingmxiii/star_wars_react_client | /src/components/App.js | UTF-8 | 2,424 | 2.8125 | 3 | [] | no_license | import React, { Component, Fragment } from 'react'
import { fetchResults } from '../helpers/helper'
import Header from './Header'
import SearchInput from './SearchInput'
import Characters from './Characters'
import Footer from './Footer'
import Loadable from './Loadable'
const baseUrl = 'https://swapi.co/api/people'
... | true |
f72f20a745b52da28a4b6f957b75f70ffdfef18a | JavaScript | snehalharde/Angular-Module2 | /script/app.js | UTF-8 | 2,076 | 2.640625 | 3 | [] | no_license | (function (){
'use strict'
angular.module('ShoppingListCheckOff', [])
.controller('ToBuyController',ToBuyController)
.controller('AlreadyBoughtController', AlreadyBoughtController)
.service('ShoppingListService', ShoppingListService);
var shoppingList =[
{
name: "cookies",
... | true |
9eeb100b1dd1b97fea5a318b46f679f558f8d146 | JavaScript | smitGaikwad/craddle | /sketch.js | UTF-8 | 1,079 | 2.6875 | 3 | [] | no_license |
const Engine = Matter.Engine;
const World = Matter.World;
const Bodies = Matter.Bodies;
const Body = Matter.Body;
const Constraint = Matter.Constraint;
function preload()
{
}
function setup() {
createCanvas(800, 400);
engine = Engine.create();
world = engine.world;
//Create the Bodies Here.
roof1 = new roof... | true |
77a22f56a5c86a88ffd785dfa314162eee72e286 | JavaScript | harelgross/educationGames | /math/highlow/highlow.js | UTF-8 | 3,506 | 3.078125 | 3 | [] | no_license | let maxOperand;
let correctAnswer, pickedAnswer;
let operand1, operand2;
let sounds = {};
let draggableData = {
disabled: false,
containment: $("#overallContainer"),
cursor: 'move',
helper: 'clone'
};
function reset() {
updateDraggables(true);
getRandomNumbers();
updateDisplay();
$("#m... | true |
4e8bc48dc5db9a1638da4033bc7f85e744c0bb70 | JavaScript | Jarmahent/article-2-voice | /helpers/03_chunkify.js | UTF-8 | 322 | 2.609375 | 3 | [] | no_license | module.exports = function(article){
console.log("Chunking...")
return new Promise((resolve, reject) =>{
data = article.replace(/(\r\n|\n|\r)/gm, '');
var chunks = [];
var m;
var re = /(.{1,4800})(\s+|$)/g;
while (m = re.exec(data)) {
chunks.push(m[1]);
}
return resolve(chunks)
})... | true |
f002e5bd2ff4fe0af2effe813ff152317db8d39b | JavaScript | vstasiv74/Thrivetalk | /js/script.js | UTF-8 | 513 | 2.625 | 3 | [] | no_license | var open = document.getElementById("open")
var close = document.getElementById("close")
var links = document.getElementById("links")
// console.log(close)
open.addEventListener("click", function () {
this.style.display = "none"
close.style.display = "block"
links.style.display = "block"
})
close.addEventL... | true |
5220c5d2105b81149af8613802088c0eba9e87fe | JavaScript | sandylykova/algo | /oddEvenLinkedList.js | UTF-8 | 664 | 4.0625 | 4 | [] | no_license | // Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes.
// You should try to do it in place. The program should run in O(1) space complexity and O(nodes) time complexity.
// Input: 1->2->3->4->5->NULL... | true |
16b6e2305ddd795a692d0e2ea3c5d57d265c5753 | JavaScript | ryanjeske14/list-assist-api | /src/recipes/recipes-service.js | UTF-8 | 6,255 | 2.59375 | 3 | [] | no_license | const xss = require("xss");
const RecipesService = {
// retrieve recipes with owner_id matching either admin ID (1) or current user ID
getRecipes(db, userId) {
return db.raw(`select json_agg(rec)
from (
select r.id, r.name, r.description, r.instructions, r.owner_id,
(select json... | true |
dd4c65da7abb2866b630232f9c2e0af4f1316292 | JavaScript | jamesnicholls/ionic-project | /www/js/services.js | UTF-8 | 1,601 | 2.71875 | 3 | [] | no_license | angular.module('starter.services', [])
/**
* A simple example service that returns some data.
*/
.factory('Transactions', ['$window', function($window) {
// Might use a resource here that returns a JSON array
// Some fake testing data
// var transactions = [
// { id: 1, description: 'Lunch, Pret a Manger'... | true |
da9161a92ee27f68295707b03d8e3fbbd979afba | JavaScript | Rogger-Vera/practica-codoacodo-nodejs | /router.js | UTF-8 | 957 | 2.671875 | 3 | [] | no_license | const express = require('express')
const router = express.Router()
const productos = require('./productos')
//enviamos mensajes al servidor
// router.get('/', (req, res) => {
// res.send('Hola Express')
// })
// router.get('/productos', (req, res) => {
// res.send('Lista de Productos')
// })
// router.get(... | true |
e6220163e5956bdc3700730daa3fb0b8bf8610b7 | JavaScript | imronha/codingdojoprojects | /MEAN/JS Fundamental Assignments/JSmath.js | UTF-8 | 786 | 3.9375 | 4 | [] | no_license | function zero_negativity(arr){
for (var i = 0; i<arr.length-1; i++){
if(arr[i] % 2 ===0){
return true;
}
return false;
}
}
zero_negativity([1,2,3,4,5,6]);
zero_negativity([2,4,6,8,10]);
function is_even(num){
if(num%2 ===0){
return true;
}
return false;
}
is_even(5)
is_even(6)
functio... | true |
96a9d1b7e606619a62e2f3d3c6a6b02f9cc88b8c | JavaScript | alephist/edabit-coding-challenges | /js/hurdleJump.js | UTF-8 | 439 | 3.234375 | 3 | [] | no_license | // Create a function that takes an array of hurdle heights and a jumper's jump height,
// and determine whether or not the hurdler can clear all the hurdles.
// A hurdler can clear a hurdle if their jump height is greater than or equal to the hurdle height.
// https://edabit.com/challenge/Hp9FitGXpKqdCW6Fd
const jump ... | true |
8defd69f7fae888ff40b08cb685642a2132ff808 | JavaScript | jakub-szczepanski/Gains-For-Days | /js/userprofilepage.jsx | UTF-8 | 2,847 | 2.546875 | 3 | [] | no_license | import React from 'react';
import ReactDOM from 'react-dom';
import fire from './fire.js';
class UserInfoForm extends React.Component {
constructor(props) {
super(props);
this.state = {
user: {},
sex: '',
height: '',
weight: ''
}
... | true |
c0cc260683da2aacf110529ec331893dd4d5fadc | JavaScript | evandersar/Ignite_JS_solutions | /lesson_29/Classwork/class29_1.js | UTF-8 | 718 | 3.578125 | 4 | [] | no_license | /*
###Задача 1
Создайте HTTP сервер, который выводит в консоль HTTP метод запросв и путь, по которому был сделан запрос.
*/
const http = require('http');
const port = process.env.port || 1337;
const server = http.createServer();
server.on('request', function(req, res) {
// request.method - возвращает http мето... | true |
f43fbe038611576308800ab0ea5f5305114a3caa | JavaScript | evanschris/live-streams | /src/helpers.js | UTF-8 | 1,277 | 3.453125 | 3 | [] | no_license | export function formatDate(date) {
var d = new Date(date),
month = '' + (d.getMonth() + 1),
day = '' + d.getDate(),
year = d.getFullYear().toString().substr(-2);
if (month.length < 2)
month = '0' + month;
if (day.length < 2)
day = '0' + day;
return [day,month,... | true |
fe340c869934c0326d507fe847f071e024d5a234 | JavaScript | AshWilliams/Sga_Dev | /SGA_test/SGA_test/Scripts/scriptIsapre.js | UTF-8 | 4,673 | 2.578125 | 3 | [] | no_license | var delIsapre;
var editIsapre;
$(document).ready(function () {
$("#dialog").hide();
$("#dialog-confirm").hide();
$("#Div1").hide();
/* Validamos form
$('#myForm').validate({
rules: {
describe: {
required: true
}
},
messages: {
describe: { required: "Debe llenar el ca... | true |
8ec4f1aeb40a6c606606d0856b5323f6ddf23aef | JavaScript | Commander7/JSLABS | /9. Lab9/script.js | UTF-8 | 984 | 4.21875 | 4 | [] | no_license |
/* Function 1:
-----------------------------------
const hello = function () {
console.log('Hello World');
}*/
// Function 1 omvandlad till Arrow
const hello = () => "Hello World";
console.log(hello());
/* Function 2:
-----------------------------------
const greet = function(name){
console.log('H... | true |
e24b028006879a10f4e9aedb942d394e4af8aad0 | JavaScript | jonnylee-401Night-advanced-javascript/notes | /__test__/notes.test.js | UTF-8 | 598 | 2.71875 | 3 | [] | no_license | ('use strict');
// supergoose uses a fake memory database for testing purposes
require('@code-fellows/supergoose');
// always require the page you are testing
const Notes = require('../lib/notes.js');
// create a new notes obj to interact with
// testing execute
// describe takes string and a function
describe('execut... | true |
b4822b1961dbb26d21f1d65ae7a624c520c38c42 | JavaScript | bidule21/Shoot-together | /src/main/resources/static/js/components/Target.js | UTF-8 | 7,599 | 2.90625 | 3 | [] | no_license | function Target (canvas, width, height) {
this.canvas = new Konva.Stage({
container: canvas,
width: width,
height: height
});
this.bgLayer = new Konva.Layer();
this.shotLayer = new Konva.Layer();
this.dragLayer = new Konva.Layer();
this.textLayer = new Konva.Layer();
... | true |
7808b1114431796a58678b990387e01229c41a67 | JavaScript | AssafMashiah/create | /projects/frontend/cgs-frontend-war/src/main/webapp/admin/js/services/locksService.js | UTF-8 | 1,613 | 2.6875 | 3 | [] | no_license | define([
'jquery',
'underscore',
'backbone',
'models/lockModel'
], function ($, _, Backbone, LockModel) {
var GET_LOCKS_REST = "/publishers/{publisherId}/locks";
var RELEASE_LOCK_URL = "/publishers/{publisherId}/locks/{entityType}/{entityId}";
var initialize = function (restBasePath, publisherId) {
t... | true |
76cfc4554825960d172bd1d1e73fee694a45af84 | JavaScript | Psychopoulet/simpletts | /lib/cjs/parseVoicesEspeak.js | UTF-8 | 1,378 | 2.640625 | 3 | [
"ISC"
] | permissive | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
;
// module
function parseVoicesEspeak(voices) {
const PTY_LENGTH = 4;
const LANGUAGE_LENGTH = 15;
const AGE_GENDER_LENGTH = 3;
const VOICENAME_LENGTH = 21;
const FILE_LENGTH = 14;
voices.shift(); // remove headers
... | true |
5f0d2802dcb8240971c42e068eda34630d76659b | JavaScript | jordanranson-archive/PuzzleGame | /vectorEngine2d/animation.js | UTF-8 | 866 | 3.25 | 3 | [] | no_license | var Animation = function(sx, sy, swidth, sheight, frames, duration, loops) {
this.sx = sx;
this.sy = sy;
this.swidth = swidth;
this.sheight = sheight;
this.frames = frames;
this.frame = 0;
this.duration = 2.5;
this.loops = loops;
this.loop = 0;
this.timePlaying = 0;
this.last... | true |
57516db4023ae66a52c835c2850daaaa9746d9f2 | JavaScript | satvikpatnala/Newtons-Cradle | /sketch.js | UTF-8 | 1,330 | 2.71875 | 3 | [] | no_license |
const Engine = Matter.Engine;
const World = Matter.World;
const Bodies = Matter.Bodies;
const Body = Matter.Body;
const Constraint = Matter.Constraint;
function preload()
{
}
function setup() {
createCanvas(800, 800);
engine = Engine.create();
world = engine.world;
//Create the Bodies Here.
roof = new ROO... | true |
2da2739a441d5364437c1ef19bbb986b19918a60 | JavaScript | Needrent/library | /loop.js | UTF-8 | 1,023 | 3.796875 | 4 | [] | no_license | "use strict";
/*let counter;
for (counter = 0; counter < 10; counter++) {
console.log(counter);
}
console.log(`we are a count of ${counter}`);*/
/*for (let counter = 0; counter < 10; counter++) {
console.log(`This counts 0 to 9 | ${counter}`);
}
for (let counter = 1; counter < 11; counter++) {
console.log(`Th... | true |
d1dec43b286c326550bb6c3f58f5b9d3e4344f8e | JavaScript | m5mat/website_source | /content/media/js/osgridref.js | UTF-8 | 11,864 | 2.6875 | 3 | [] | no_license | /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* Convert latitude/longitude <=> OS National Grid Reference points (c) Chris Veness 2005-2010 */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/*
* convert ge... | true |
168f93b7c3266a5d170a87b5052bb279c414b614 | JavaScript | ljo1719/code-academy- | /Manejador de Tareas/constructor.js | UTF-8 | 515 | 2.53125 | 3 | [] | no_license | class Task_card{
constructor({id, title, description,priority}) {
this.id = id || 0;
this.title = title;
this.description = description;
this.priority = priority;
this.estado = 'Pendiente'
}
progreso() {
this.estado = 'Progreso'
}
completar() {
this.esta... | true |
72db055d50f2dc6172a0719ca9aa84292c3c529b | JavaScript | marissa27/sorting-suits | /scripts/merge-sort.js | UTF-8 | 737 | 3.421875 | 3 | [] | no_license | const merge = (arrayLeft, arrayRight) => {
let completedArray = [];
while(arrayLeft.length && arrayRight.length) {
if (arrayLeft[0] < arrayRight[0]) {
completedArray.push(arrayLeft.shift())
} else if (arrayRight[0] < arrayLeft[0]) {
completedArray.push(arrayRight.shift())
}
}
return c... | true |
c2a126252f37c5bef79882cfd056e25bd113c860 | JavaScript | Ludlowm/pig-game-edited | /js/scripts.js | UTF-8 | 1,845 | 3.75 | 4 | [] | no_license | //Business Logic
function player(n, tot) {
this.name = n;
this.tot = tot;
this.rollArray = [];
}
function diceRoll(currentRoll) {
return Math.floor(Math.random() * 6 + 1);
}
var sum;
var currentPlayer = 0;
var playerCount = 2;
function gameboy(){
this.players = [];
for (i = 0; i < playerCount; i++){
... | true |
b38119bc00764db29a3571bf8905ec5b50b0a4e0 | JavaScript | Mstaso/React-Practice-Code-Challenge-nyc01-seng-ft-060120 | /sushi-saga-client/src/App.js | UTF-8 | 1,045 | 2.734375 | 3 | [] | no_license | import React, { Component } from 'react';
import SushiContainer from './containers/SushiContainer';
import Table from './containers/Table';
// Endpoint!
class App extends Component {
state = {
sushis: [],
emptyPlates: []
}
componentDidMount = () => {
fetch("http://localhost:3000/sushis")
.then(... | true |
9d7ccca0ec9bc2d308cb2b216858aa2fdc9f5549 | JavaScript | lostsquirrel/blog_pages | /js/init.js | UTF-8 | 594 | 2.53125 | 3 | [] | no_license | urlBase = "http://localhost";
(function($) {
$(function(){
load_template();
});
function load_template() {
var url = urlBase + '/templates.html?_'+(new Date().getTime())
$.ajax({
url: url,
success: function(data){
var templates = $(data);
$.each(templates, function(k, v){
console.log(v)
... | true |
f1c2527c974c36f6f388976003ce2452f4ca88e5 | JavaScript | zoe30/ello | /assets/game/ellojump/ScaleAnim.js | UTF-8 | 1,265 | 2.609375 | 3 | [] | no_license | pc.script.create('ScaleAnim', function (app) {
// Creates a new ScaleAnim instance
var ScaleAnim = function (entity) {
this.entity = entity;
};
ScaleAnim.prototype = {
// Called once after all resources are loaded and before the first update
initialize: function ()
{
... | true |
3716ca28d7b33c23b25e7aa4486d7a47fa88e72a | JavaScript | LuisAraujo/BIRDS-Bibliographic-review-design-software | /script/findMode.js | UTF-8 | 4,327 | 2.5625 | 3 | [
"MIT"
] | permissive |
//ready
$(document).ready( function(){
carregamentoInicial();
$("#buscaFichamento").bind('input propertychange', function(){
// if($("#login-preferencia:checked").val() == "")
// else if($("#login-preferencia:checked").val() == "")
// else if($("#login-preferencia:checked").val() == ""... | true |
e26ac4dcd1e0fed6b8f449cb141af95e0d4fadab | JavaScript | imamfarisi19/Learning-Javascript | /5-data-types/5-10-destructing-assignment/5-10-2-object-destructuring/object-destructuring-1.js | UTF-8 | 178 | 3.140625 | 3 | [] | no_license | let options = {
title: "Menu",
width: 100,
height: 200
};
let {title, width, height} = options;
alert(title); // Menu
alert(width); // 100
alert(height); // 200
| true |
bbb17eb442d5e1058a369f8c2043cdbfe0423244 | JavaScript | German969/Panoptico | /js/reg-emp.js | UTF-8 | 4,065 | 2.796875 | 3 | [
"MIT"
] | permissive | function registrare() {
v1 = document.getElementById("i1").value;
v2 = document.getElementById("i2").value;
v3 = document.getElementById("i3").value;
v4 = document.getElementById("i4").value;
v5 = document.getElementById("i5").value;
v6 = document.getElementById("i6").value;
v7 = document.getElementById("i7").... | true |
0e602de54239113804347141ef2ec985aa3ba4f3 | JavaScript | WaffleCohn/wafflecohn.github.io | /FallingBoulders/FallingBouldersGame.js | UTF-8 | 5,073 | 3 | 3 | [
"MIT"
] | permissive | var bcolor = "lightgrey";
var boulderamount = 15;
var myBoulders = new Array();
var score = 0;
var loseMessage = "GAME OVER! Your Score is ";
var loseScoreMessage = loseMessage + score;
var lost = false;
var boulderArray = new Array();
function onPageLoad() {
// When window loads, changes all cell backgro... | true |
078e49b9adea7ae5990843d2f6d2b0b16fff3aaf | JavaScript | reed-jones/TicTacToe | /server/game/gameLobby.js | UTF-8 | 1,239 | 2.71875 | 3 | [] | no_license | import { Game } from './'
class GamesRoom {
static _games = []
static AddGame(game) {
this._games = [...this._games, game]
// this._games.push(game)
game.startGame()
}
static get Games() {
return this._games
}
static get GamesCount() {
return this._games.length
}
static RemoveGame... | true |
f6276280b62c74f4cb7cfc06302952de7b042e4b | JavaScript | Kalunge/DSA | /all.js | UTF-8 | 3,525 | 4.6875 | 5 | [] | no_license | // 1. STRING REVERSAL
// --- Directions
// Given a string, return a new string with the reversed
// order of characters
// --- Examples
// reverse('apple') === 'leppa'
// reverse('hello') === 'olleh'
// reverse('Greetings!') === '!sgniteerG'
// SOLUTION 1
function reverse(str) {
return str.split('').reverse()... | true |
6e81142e89488326fcfd787f4cd35e7b87a0041c | JavaScript | RJFryman/nss-node-lectures | /2014-02-06-TDD.E-Commerce/app/js/source/person.js | UTF-8 | 561 | 2.78125 | 3 | [] | no_license | /* exported Person */
/* global Cart:false */
var Person = (function(){
'use strict';
function Person(name, cash){
this.name = name;
this.cash = cash;
this.cart = new Cart();
}
Person.prototype.checkOut = function(){
var receipt;
if(this.cash - this.cart.total >= 0){
receipt = _.m... | true |
ae9fdc2862ed43f30fff08f47550ef10f244dd40 | JavaScript | ddesan/Seinfield | /assets/javascript/gamec.js | UTF-8 | 1,383 | 4.125 | 4 | [] | no_license | //Define word to be guess by user
var hiddenWordArr = ["cosmo", "seinfield", "elaine", "george", "newman"];
var hiddenWord = hiddenWordArr[Math.floor(Math.random() * hiddenWordArr.length)];
var answerString = "";
var answerArray = [];
var countR = 1;
var countG = 9;
var wins = 0;
var lost = 0;
var choosenLette... | true |
5baf0782e949c7313804af0fbfefcc81d8fa0a0e | JavaScript | ChrisOnions/Sql_Employee_Tracker | /server.js | UTF-8 | 7,840 | 2.921875 | 3 | [
"MIT"
] | permissive | const mysql = require('mysql');
const inquirer = require('inquirer');
const Choices = require('inquirer/lib/objects/choices');
const connection = mysql.createConnection({
host: 'localhost',
// Your port; if not 3306
port: 3306,
// Your username
user: 'root',
// Be sure to update with your own MySQL pas... | true |
3d620ae856917107a28b1713fa64ce77699607b3 | JavaScript | KennethRHMortensen/WebDev-GroupTasks | /Assignments_JS.Loops/Assignment_JS.Loops.74/myFuncLib.js | UTF-8 | 143 | 3.25 | 3 | [] | no_license | 'use strict'
function facti(n) {
for(let i = n - 1; i >= 1; i--) {
n = n * i;
}
return n;
}
console.log(facti(5)); | true |
217afbc0f3de35edb30806caac95d78f1b4cb0e4 | JavaScript | andrerodrigue5/naofalamaldobozo | /public/contador.js | UTF-8 | 1,450 | 3.328125 | 3 | [] | no_license | window.addEventListener('load', () => {
const pegarDataComeco = () => {
const data = document.getElementById('data').value;
if (/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])\ ([0-1][0-9]|2[0-3]):(0[0-9]|[1-5][0-9]):(0[0-9]|[1-5][0-9])$/.test(data)) {
return data;
}
... | true |
b65dd95dc4c5d01f506aeb0f7db92923749c16a2 | JavaScript | processing/p5.js-website | /src/data/examples/es/01_Form/00_Points_and_Lines.js | UTF-8 | 858 | 3.328125 | 3 | [
"MIT",
"LicenseRef-scancode-proprietary-license"
] | permissive | /*
* @name Puntos y líneas
* @arialabel Contorno blanco de un cuadrado sobre un fondo de color negro
* @description Puntos y líneas pueden ser usados para dibujar geometría básica.
* Cambia el valor de la variable 'd' para escalar la figura. Las cuatro
* variables definen las posiciones basadas en el valor de 'd'.... | true |
c6922637e9b1f9d581d7358b25272a13036fdf05 | JavaScript | imd2019/project-team-007 | /interactiveObject.js | UTF-8 | 9,567 | 2.546875 | 3 | [] | no_license | import MainScreen from "./MainScreen.js";
export default class InteractiveObject extends MainScreen {
constructor(
x,
y,
zone,
imgWidth,
btnAx,
btnAy,
btnBx,
btnBy,
imgHeight,
objectScale,
btnA,
btnB,
btnScale,
interactX,
interactY
) {
super(x, y);
... | true |
cb6b3dc9b86066bddc597ecf4aeff89a145e8bd2 | JavaScript | moanaFang/nodeJs | /node_mfee14/src/http_server1.js | UTF-8 | 1,375 | 2.796875 | 3 | [] | no_license | // https://nodejs.org/dist/latest-v14.x/docs/api/http.html#http_response_writehead_statuscode_statusmessage_headers
// const server = http.createServer(requestListener: (req: http.IncomingMessage, res: ServerResponse) => {
// res.writeHead(statusCode: 200, headers:{
// 'Content-Type' : 'text/html'
// }); //狀態 ... | true |
1d9561b0530dd6682b7c94877806a44069e89e8b | JavaScript | sassansh/Trading-Cards | /backend/api/cards.js | UTF-8 | 2,176 | 2.765625 | 3 | [
"MIT"
] | permissive | import Card from "../models/Card.js";
import express from "express";
import { v4 as uuidv4 } from "uuid";
const router = express.Router();
router.get("/", (req, res) => {
// Grab queries
const electricOnly = req.query.electricOnly;
const searchName = req.query.searchName;
// Build query object for mongoose
... | true |
31764619e340f1e1a8812ed5ed63269a0efd5a3a | JavaScript | chestozo/faviconer | /options.js | UTF-8 | 1,583 | 2.765625 | 3 | [
"MIT"
] | permissive | (function($){
const SETTINGS_KEY = 'settings';
var Options = function() {}
Options.prototype.init = function() {
this.$rules = $(".js-rules");
this.$save = $(".js-save")
.bind("click", this.save.bind(this));
this.firstTimeLoad();
return this;
}
Options.prototype.firstTimeLoad = async funct... | true |