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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
08c6df1a665810925920af8054eaccc8e354feb0 | JavaScript | jevgenig/BabelReactCanvasExperiment | /Test.jsx | UTF-8 | 3,490 | 2.96875 | 3 | [] | no_license | let React = null;
let Easel = window.createjs;
let bindValue = (value) => typeof value === "function" ? value : ()=>value;
class DisplayObject {
constructor(props = {}) {
this.children = [];
this.left = bindValue(props.left);
this.top = bindValue(props.top);
console.debug(props)
... | true |
4c55f08809d10a7f3beefc149064133bed6aef12 | JavaScript | alenny/leetcode | /src/self-dividing-numbers/index.js | UTF-8 | 591 | 3.40625 | 3 | [
"MIT"
] | permissive | /**
* @param {number} left
* @param {number} right
* @return {number[]}
*/
const selfDividingNumbers = function (left, right) {
let ret = [];
for (let num = left; num <= right; ++num) {
let n = num;
let passed = true;
while (n > 0) {
let digit = n % 10;
if (di... | true |
4eda4e8a4d0b441004e8496e9490e1bf7e0e18b2 | JavaScript | AzenoX/SlidesJS | /SlidesJS.js | UTF-8 | 4,462 | 2.875 | 3 | [] | no_license | class SlidesJS{
working = false;
constructor(el) {
this.el = el;
}
slideUp(duration = 500, origin = 'top', from, to) {
if(this.working) return;
this.working = true;
this.el.style.overflow = 'hidden';
this.el.style.transform = 'scaleY(1)';
... | true |
cd0dfd17837c67dadb804f34c9de896169990da7 | JavaScript | gixxerblade/practice | /VWC Coding Challenges/2020/2-14-2020/script.js | UTF-8 | 535 | 3.328125 | 3 | [] | no_license | let body = document.querySelector("body");
let title = document.getElementById("title");
let changeColor = () => {
let r1, g1, b1, r2, g2, b2;
let random = rgb => Math.floor(Math.random() * 255);
title.style.color = `rgb(${random(r1)}, ${random(
g1
)}, ${random(b1)})`
body.setAttribute(
"style"... | true |
b2f975605b5d7201f8e5a67460af2a52f6549b06 | JavaScript | saraFadel/MyReads-App-Udacity | /src/Book.js | UTF-8 | 1,918 | 2.828125 | 3 | [] | no_license | import React, {Component} from 'react';
import PropTypes from 'prop-types';
class Book extends Component {
static propTypes = {
book: PropTypes.object.isRequired,
updateList: PropTypes.func.isRequired,
}
state= {
//If in ListBooks view, use shelf state depending on getAll API
shelf: this... | true |
2c8358b6d5b297343aef096db1afc64f1c589c33 | JavaScript | lucy3505/0202jsAdvance | /对象/6包装类2.js | UTF-8 | 900 | 4.25 | 4 | [] | no_license | //包装类得过程 var a =124 console.log(a.str)
a.len=3//照理说原始值是没有属性得,应该不能去设置属性值,但是你是客户你最大,系统自动帮你new
Number(123) 是看到.len才去做new
Number这件事,但是我没法保存你这个对象,所以就删除了 new Number(123).len=2
console.dir(a) console.log(a.len)//undefined 系统看到.len 就去自动帮你new
Number(a)去找.len var str = 'abc' console.log(str.length) //如果我们把new
Number()保存起来 那么就是个对... | true |
48e5dfec30d356408a477858e52b84ffa5e76f4b | JavaScript | OpenAcousticDevices/AudioMoth-Configuration-App | /settings/durationInput.js | UTF-8 | 11,097 | 2.78125 | 3 | [
"MIT"
] | permissive | /****************************************************************************
* durationInput.js
* openacousticdevices.info
* November 2019
*****************************************************************************/
'use strict';
/* global document, HTMLElement, customElements, Event */
const DEFAULT_MAX_CHAR... | true |
df1bc987a7e8b1d3de38b4708edacb0a6f572676 | JavaScript | 123luckybing/Blog_node | /src/router/user.js | UTF-8 | 1,128 | 2.609375 | 3 | [] | no_license | // 用户接口
const { ErrorModal, SuccessModal } = require('../model/resModal')
const { login, register } = require('../Controller/user')
const userRouer = (req, res) => {
const method = req.method
const url = req.url
const path = url.split('?')[0]
// 登陆
if (method === 'POST' && path === '/api/user/login') {
c... | true |
6acc640c01c44ce2b41b6ec59017e45ecb6625a4 | JavaScript | royprashant800/github_users | /src/components/UseEffectAPI.jsx | UTF-8 | 2,327 | 2.5625 | 3 | [] | no_license | import React, { useEffect, useState } from 'react'
const UseEffectAPI = () => {
const [users, setusers] = useState([]);
const getUsers = async () => {
const response = await fetch('https://api.github.com/users');
const jsonData = await response.json();
setusers(jsonData)
consol... | true |
1a0863f2d36f6b7e5bc86cd165591fb46610d368 | JavaScript | tribune/countchocula | /countchocula.js | UTF-8 | 3,460 | 2.96875 | 3 | [] | no_license | /* v0.1.0 - infuse plugin for character counts */
// # Count Chocula
//
// _..._
// .' '.
// ; __ __ ;
// |/ \ / \|
// |\| -- ' -- |/|
// |(| \o| |o/ |)|
// _\| > |/_
// .-' | ,.___., | '-.
// \ ; V'-'V ; /
// `\ \ / /`
// `\ '-...-' /... | true |
2a4c455d0e858d96098d57541aa0c912bdcaa960 | JavaScript | nathankerr96/TODO | /reading.js | UTF-8 | 10,122 | 3.0625 | 3 | [] | no_license | window.onload = function () {
//redirect to login if session variable not set
if (sessionStorage.getItem('loginName') === null) {
window.location.replace('login.html');
}
};
$(document).ready(populate);
//Take in the id of the book and add the onclick listner to the title title card
//that expands the expan... | true |
9c58a40b8314269d070940078bc0ee7a6733935b | JavaScript | maheshraju2020/Tetris-Game | /Scripts/NextAreaHelperFunctions.js | UTF-8 | 923 | 2.984375 | 3 | [
"MIT"
] | permissive | export function initNextPieceArea() {
const nextPiece = document.getElementById("nextPiece");
for (let i = 0; i < 6; i++) {
for (let j = 0; j < 6; j++) {
let square = document.createElement("div");
square.className = "next-box";
square.id = "next-" + String(i) + "-" + String(j);
nextPiece.appendChild(sq... | true |
885b5df24eb4d95fc058c6c70959a2ff3878f9a0 | JavaScript | agunghanifan/sugoku-mobileApp | /client/src/pages/GameBoard.jsx | UTF-8 | 4,111 | 2.53125 | 3 | [] | no_license | import React, { useEffect } from 'react'
import { StyleSheet, Text, View, Button, KeyboardAvoidingView,
TouchableWithoutFeedback, Keyboard, Platform, ActivityIndicator } from 'react-native';
import RowBox from '../components/RowBox'
import { useDispatch, useSelector } from 'react-redux'
import { fetchBoard, solveSel... | true |
6742bf1075fbea037fba940b81fb612924c25717 | JavaScript | wikimedia/oojs-ui | /src/widgets/ActionWidget.js | UTF-8 | 2,604 | 2.953125 | 3 | [
"MIT"
] | permissive | /**
* An ActionWidget is a {@link OO.ui.ButtonWidget button widget} that executes an action.
* Action widgets are used with OO.ui.ActionSet, which manages the behavior and availability
* of the actions.
*
* Both actions and action sets are primarily used with {@link OO.ui.Dialog Dialogs}.
* Please see the [OOUI d... | true |
3df3e97bc3e25e4d4261897fc1faa4f88abe843d | JavaScript | ramakrishnapokuri/Deque | /src/util/helperService.js | UTF-8 | 478 | 2.609375 | 3 | [] | no_license |
class HelperService {
static get(url) {
return window.fetch(url)
.then((response) => {
if (response.ok) {
return response.json();
}
else {
throw `Error searching for books with term: ${searchKey}`;
... | true |
fb200502e34212d7dab705c2aa209f0a029e3f4c | JavaScript | loaialaddien/node-under-the-hood | /9.Events&EventsEmmters.js | UTF-8 | 4,607 | 4.09375 | 4 | [] | no_license | //event is something that happened in our app that we can respond to
//in node there's two kind of events
//1- system events
//comes from c++ core, from the library libuv (finished reading a file, recieved http request) things that javascript doesn't have
//2- custom events
//inside the javascript core, event Emitter ... | true |
1afbdb24fedb4aa2f1feded7c50d67f8af62a149 | JavaScript | tejasrsuthar/organeasy | /DOCS/Prototipo/js/script.js | UTF-8 | 1,015 | 3 | 3 | [] | no_license | // Página de cadastro
function chooseAvatar() {
let img = document.getElementById("select").value;
if (img)
document.getElementById("avatar").src = "img/avatar/" + img;
else
document.getElementById("avatar").src = "img/avatar/none.svg";
}
// Novo Curso
function addMateria() {
let input =... | true |
237a65b80632820ecb7479392907bb9af2343dff | JavaScript | CesiumGS/cesium | /packages/engine/Source/Core/HermitePolynomialApproximation.js | UTF-8 | 9,992 | 2.71875 | 3 | [
"MPL-2.0",
"LicenseRef-scancode-warranty-disclaimer",
"MIT",
"BSD-3-Clause",
"ISC",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-free-unknown",
"OFL-1.1",
"CC-BY-3.0",
"JSON",
"LicenseRef-scancode-proprietary-license",
"CC-BY-4.0",
"CC-BY-SA-2.0",
"... | permissive | import defaultValue from "./defaultValue.js";
import defined from "./defined.js";
import DeveloperError from "./DeveloperError.js";
import CesiumMath from "./Math.js";
const factorial = CesiumMath.factorial;
function calculateCoefficientTerm(
x,
zIndices,
xTable,
derivOrder,
termOrder,
reservedIndices
) {... | true |
13adf0e2bb41fcf617b41fcebc4e6b89aed18559 | JavaScript | 85phantom/csie-backend | /user/middleware.js | UTF-8 | 2,892 | 2.671875 | 3 | [] | no_license | const _ = require('lodash')
const newError = require('../error');
class usersMiddleware{
constructor(options){
this.usersAction = options.usersAction;
}
createUsers(){
return async (req, res) => {
try {
const body = this.validateUsers(req.body);
c... | true |
dd349300d74beac60bf7d74cb377e0606dac8b6d | JavaScript | Alexandre-Georges/alpha-beta | /tic-tac-toe/index.js | UTF-8 | 786 | 3.125 | 3 | [
"MIT"
] | permissive | const readline = require('readline');
const { firstMove, recordPlayerTurn } = require('./tic-tac-toe-state');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
const playerTurn = () => {
rl.question('Position? ', (answer) => {
let x = -1;
if (answer.startsWith('a')... | true |
6209a60c640c84162359ad90323e8efe5905aca3 | JavaScript | wanda0254/MobileWeb-js | /public/data/readnote.js | UTF-8 | 286 | 3.046875 | 3 | [] | no_license | var URL="data/catatan.txt";
fetch(URL)
.then(function(response){
if (response.status !== 200) { //HTTP Status
console.log('Ada masalah. Status Code: ' +
response.status);
return;
}
return response.text()
})
.then( text => console.log(text) )
.catch( err => console.log(err) ); | true |
3bae55b70e234ced5067b758a801ff8c3c9bafc5 | JavaScript | Stevie921/Phone-Comparison | /src/App.js | UTF-8 | 15,238 | 3.140625 | 3 | [] | no_license | import React from 'react';
import './App.css';
class App extends React.Component{
constructor(props){
super(props);
this.state = {
pixel: "",
iphone: "",
galaxy: "",
P30: "",
select: ""
}
}
componentDidMount(){
this.setState({
pixel: document.getElementById("pixel"),... | true |
a272a3eae0d466986ec2d43bbe67df1e701da16a | JavaScript | kevk22/Algorithms | /237_Delete_Node_Linked_List.js | UTF-8 | 731 | 3.9375 | 4 | [] | no_license | /**
* Definition for singly-linked list.
* function ListNode(val) {
* this.val = val;
* this.next = null;
* }
*/
/*
* @param {ListNode} node
* @return {void} Do not return anything, modify node in-place instead.
*/
// Only given node
var deleteNode = function (node) {
node.val = node.next.val;
... | true |
053f8e6e55e3e8418884dda5f3baa1a42ccfc468 | JavaScript | jaguilarweb/travel-planner-app | /src/server/server.js | UTF-8 | 3,122 | 2.765625 | 3 | [] | no_license | const path = require('path');
const express = require('express');
const bodyParser = require('body-parser');
const cors = require('cors');
const dotenv = require('dotenv');
const axios = require('axios');
dotenv.config();
// Apis keys
const GEON_USER = process.env.GEON_USER;
const WEATHER_API= process.env.WEATHER_API... | true |
63ab666442a63ff372cac1e6c1ffa8a2f68bebc6 | JavaScript | techris45/ftx-cli | /tests/bin/options/price.test.js | UTF-8 | 3,681 | 2.734375 | 3 | [
"MIT"
] | permissive | import {
composeCommand,
expectChildProcessToError,
expectChildProcessToSucceed,
} from '../helpers/index.js';
const baseOptions = '--market btc/usd --side buy --type market --size 1';
async function testValidArguments(validArguments) {
for (const argument of validArguments) {
test(`SUCCEEDS: --price ${ar... | true |
63bf8a564f7b205a074e0c14a5818d6f0e1259ac | JavaScript | dudds6699/PowGame | /index.js | UTF-8 | 1,426 | 2.5625 | 3 | [] | no_license | // Setup basic express server
var express = require('express');
var app = express();
var port = 3000;
var server = require('http').createServer(app);
var io = require('socket.io')(server);
var bodyParser = require("body-parser");
var mysql = require("mysql");
var secret = "sad;lkfja;klj;laskdjf;ljlaskdjf;laksjdf;lasdjf... | true |
6099682f5bab466b5ef7ec51c365ce1d2852b33e | JavaScript | mikerawth/lab-mongoose-movies | /starter-code/bin/movieSeed.js | UTF-8 | 980 | 2.796875 | 3 | [] | no_license | const mongoose = require('mongoose');
const Movie = require('../models/Movie');
mongoose
.connect('mongodb://localhost/lab-mongoose-movies', { useNewUrlParser: true })
.then(x => {
console.log(`Connected to Mongo! Database name: "${x.connections[0].name}"`)
})
.catch(err => {
console.error('Error conn... | true |
1631a61bd18122d612d4d5c403b18442ead8606f | JavaScript | phuhien92/hienluong.dev | /components/ClipboardCaption/index.js | UTF-8 | 2,005 | 2.53125 | 3 | [] | no_license | import React from 'react';
import styled from 'styled-components';
const Wrapper = styled.div`
position: relative;
`;
const ClipboardMessage = styled.div`
position: absolute;
opacity: 0.5;
text-align: left;
font-weight: 500;
font-size: ${props => `${props.fontSize}px`};
width: ${props => `... | true |
c0272c081ef5ac48aef3123b6540e2c16eb871ab | JavaScript | yangxi8492/vitektv | /js/productlist.js | UTF-8 | 1,624 | 2.734375 | 3 | [
"MIT"
] | permissive |
function initMouseEvent(targetDivName){
try{
var divObjs =document.getElementsByTagName('div');
for(var i=0; i<divObjs.length; i++)
{
if(divObjs[i].getAttribute("name") == targetDivName)
{
(
function (obj)
{
obj.onmouseover = function(){
onMouseOver(obj);
}... | true |
804be9a6465c96d97fe0345046dbfaf5983eed03 | JavaScript | tonynguyenit18/chat-api | /services/S3UploadImage.js | UTF-8 | 2,255 | 2.984375 | 3 | [] | no_license | /**
* This gist was inspired from https://gist.github.com/homam/8646090 which I wanted to work when uploading an image from
* a base64 string.
* Updated to use Promise (bluebird)
* Web: https://mayneweb.com
*
* @param {string} base64 Data
* @return {string} Image url
*/
const imageUpload = async (base64, typ... | true |
56934c842aed2a0227f5c5a6fe0fe25f23ea111b | JavaScript | MArt-2202/LearnJavascript | /Guide/PART 1/5. Data-types/5.10 Destructuring-assignment/js/scripts.js | UTF-8 | 1,821 | 3.671875 | 4 | [] | no_license | document.addEventListener("DOMContentLoaded", function(event) {
/*
=======================================================================
TASK-1: Напишите деструктурирующее присваивание
=======================================================================
*/
function task1() {
... | true |
044640a0e31f8b14cce082e4f6ca27e357086f5e | JavaScript | cloverstudio/UserRegistrationTemplate | /src/client/js/lib/utils.js | UTF-8 | 6,741 | 2.8125 | 3 | [] | no_license | (function(global) {
"use strict;"
// Class ------------------------------------------------
function Utils() {
};
// Header -----------------------------------------------
Utils.prototype.l = logging;
Utils.prototype.goPage = goPage;
Utils.prototype.ie8Fix = ie8Fix;
Utils.prototyp... | true |
99f86cbb220d06d2d4f5eb6f1cf1f2e3fb5b446b | JavaScript | whs-njrotc-compsci-team/lessons | /loops.js | UTF-8 | 955 | 4.71875 | 5 | [] | no_license | /* ====================
* LOOPS LESSON
* ====================
*
* DESCRIPTION:
* What would you do if you want to repeat code but not
* have to copy and paste your code over and over again?
* That's right, you would use a loop. A loop will repeat
* your code over and over again as long as it meets a
* cond... | true |
569935c9db55573befe106e19fb93c56395a3e58 | JavaScript | JonasBronselaer/DWD-portfolio-JonasBronselaer | /Les5-6/js/scripts3.js | UTF-8 | 1,119 | 2.796875 | 3 | [] | no_license | document.getElementById('login__form').setAttribute('novalidate', 'novalidate');
document.getElementById('login__form').addEventListener('submit', function(e){
e.preventDefault();
e.stopPropagation();
let isValid = true;
let inpUname = docume... | true |
acfbeadf76b0d1d8ee9e0dc1bd2118300a13c31a | JavaScript | TatyanaFomina/booksApp | /app.js | UTF-8 | 9,540 | 2.890625 | 3 | [] | no_license | const root = document.getElementById('root');
let booksList = JSON.parse(localStorage.getItem('books'));
function createBookList() {
const listContainer = document.createElement('div');
listContainer.className = 'list-container';
const list = document.createElement('ul');
const addButton = document.crea... | true |
2855ae68dfa6a98a0e21c37c7fbbc3b39c03fee9 | JavaScript | llanoxdewa/javascript | /javascript-dasar/rekursif.js | UTF-8 | 432 | 3.5625 | 4 | [] | no_license | // kondisi akhir dari sebuah rekursif disebut base case
// rekursif adalah fungsi yang akan memanggil dirinya sendiri sampai lama
// berfungsi untuk menggantikan loop
// function tampil(n) {
// if(n>10){
// return;
// }
// console.log(n)
// tampil(n+1)
// }
// contoh penerapan konsep rekurs... | true |
b286d2a4a1aeef4b74ce284856a193eba615faaa | JavaScript | iamlos/vue-examples | /calculator/js/app.js | UTF-8 | 2,623 | 3.03125 | 3 | [] | no_license | var calculator_button = Vue.component('calculator-button', {
template: '<button>{{ this.text }}</button>',
props: {
text: '',
}
});
var calculator = Vue.component('calculator', {
template: '<div class="calculator">' +
'<p><input type="text" v-model="displayContents" readonly /></p>... | true |
18e2526e8b2be8ae9958cd9e217701a77e11324d | JavaScript | 2gnc/alrorythms-js-implementation | /src/other/04-caesar-cipher.test.js | UTF-8 | 1,163 | 2.921875 | 3 | [] | no_license | const caesar = require('./04-caesar-cipher');
describe('шифр Цезаря', () => {
it('сдвиг на положительное число', () => {
expect(caesar('zoo keeper', 5)).toEqual('ett pjjujw');
});
it('есть большие буквы', () => {
expect(caesar('Zoo keeper', 5)).toEqual('Ett pjjujw');
});
it('сдвиг на отрицательное чи... | true |
eff23d8e94a0da59ffd75e2655bd864fc2c878c5 | JavaScript | rakshithbellamane/toyproblems | /5-BitManipulation/04-NextNumber/NextNumberSol3.js | UTF-8 | 741 | 3.921875 | 4 | [] | no_license | const getNext = n => {
let c = n, c0=0, c1=0;
while (((c & 1) === 0) && (c !== 0)) {
c0++;
c >>= 1;
}
while ((c & 1) === 1) {
c1++;
c >>= 1;
}
if (c0+c1 === 31 || c0+c1 === 0) return null;
return n + (1 << c0) + (1 << (c1 - 1)) - 1;
}
const getPrev = n => {
let c = n, c0 = 0, c1 = 0... | true |
74da210a2f1afb7366c113d05178c0f8fa9538b4 | JavaScript | jrwstevenson/profile-site | /routes/playground.js | UTF-8 | 4,021 | 2.59375 | 3 | [] | no_license | var express = require("express");
var router = express.Router();
router.get("/", function(req, res) {
var projects = [
{
name: "Real time Clock",
description: "A clockface with live and accurate time.",
slug: "clock",
image: "jsclock.jpg"
},
{
name: "Drum Kit",
descrip... | true |
48b1b0e25c9323e5dc1c6bc6a55f05d5e6b8ddea | JavaScript | DanielWGross/minibank | /store/store.js | UTF-8 | 1,108 | 2.71875 | 3 | [] | no_license | function Store({ actions, mutations, state }) {
this.actions = actions || {};
this.mutations = mutations || {};
this.state = state || {};
this.dispatch = function({ action: actionType, payload = {} }) {
return new Promise(async (resolve, reject) => {
if (typeof this.actions[actionType] !== "function"... | true |
404c0bb818098c132a1cf17df079e3ce9f692584 | JavaScript | yang0817gj/h5wzry | /server/models/Article.js | UTF-8 | 845 | 2.515625 | 3 | [] | no_license | const mongoose = require('mongoose')
const Category = require('./Category')
const schema = new mongoose.Schema({
title: { type: String },
categories: [{ type: mongoose.SchemaTypes.ObjectId, ref: Category }], // 上级分类 可能回事多级
body: { type: String }// 详情
}, {
timestamps: true
})
/**
* type: mongoose.Sche... | true |
306f80ed6493463a6c7459086ebdf69fee5019c9 | JavaScript | marklbentley/imagemanipulation | /script.js | UTF-8 | 4,340 | 2.75 | 3 | [] | no_license | $(document).ready(function(){
document.querySelector('#fileSelect').addEventListener('click', function(e) {
// Use the native click() of the file input.
document.querySelector('#input').click();
}, false);
});
var clear_button = document.getElementById('clear');
window.onload = function() {
var input = do... | true |
29cb246e4d5db896f71cd6aef08a3de2080a3729 | JavaScript | vishnyakovava/labProjA | /src/main/resources/static/js/main_styles.js | UTF-8 | 1,522 | 2.71875 | 3 | [
"MIT"
] | permissive | // var productName = 0;
// var productQuantity = 0;
// $(function(){
// $('#addButton').click(function(){
// productName++; productQuantity++;
// console.log(productQuantity);
// var div = $('<div class="row" id="addingTab">\n' +
// ' <div class="col-sm-8">\n' ... | true |
2dd268e6f1de4f48881deb8b40289a4756ce3179 | JavaScript | goifproject/molde_sever | /models/newsSchema.js | UTF-8 | 3,239 | 2.84375 | 3 | [] | no_license | var mongoose = require("mongoose");
var Schema = mongoose.Schema;
var photoSchema = new Schema({
filename: {type: String, default: null},
filepath: {type: String, default: null},
size: {type: String, default: null}
});
var newsSchema = new Schema({
news_id: {type: String, required: true},
category... | true |
470a7f39ebb3f31cdcaf8f8e32400cb42be3b279 | JavaScript | doppelganger9/blog | /src/lib/speech.js | UTF-8 | 2,188 | 3.15625 | 3 | [
"MIT"
] | permissive | export class Speech {
constructor({ synth, pitch = 1, rate = 1, volume = 1, lang }) {
this.synth = synth || global.speechSynthesis;
this.pitch = pitch;
this.rate = rate;
this.volume = volume;
this.lang = lang ? lang : getDefaultLangFromGlobalObject();
this.voice = undefined;
this.init();
... | true |
35242f593a2eef4cb11c182a03f7f0dd63f8dc8a | JavaScript | SaravananV97/Expense-Tracker | /DBModel/userModel.js | UTF-8 | 1,688 | 2.59375 | 3 | [] | no_license | const mongoose = require("mongoose");
const Schema = mongoose.Schema;
const date = new Date().toLocaleDateString;
const bcrypt = require("bcrypt");
const userSchema = new Schema({
name:{
type:String,
},
email:{
type:String
},
password:{
type:String
},
date: {
... | true |
dd95d78f01b545ee611386fb54c11c08b4d57376 | JavaScript | rizama/my-nodejs | /express-beginner/index.js | UTF-8 | 298 | 2.578125 | 3 | [] | no_license | const express = require('express');
const router = require('./router');
const app = express();
const port = 3000;
// Routes
app.get('/', (req, res) => {
res.send('Hello World')
})
// With Router
app.use(router);
app.listen(port, () => console.log(`Server Run On Port ${port}`)); | true |
f9a579687ca24d29e6bdae24cfba4bb645ef1948 | JavaScript | Johnrae/assignment-18 | /js/main.js | UTF-8 | 995 | 2.578125 | 3 | [] | no_license | import $ from 'jquery';
import _ from 'underscore';
import moment from 'moment';
import Backbone from 'backbone';
$.ajaxSetup({
headers:{
'X-Parse-Application-Id': 'NKQ0EaAwxrKfDTv4oD41FK5qM4HuoF67E3ClO0Hg',
'X-Parse-REST-API-KEY': 'sUMur3NnKVo2VyZaxBEY5EdFsu2lj2fNjESEm8fu'
}
});
let Person = Backbone.Mo... | true |
58232777cb1a1a95a21f2e6441c5268261feadef | JavaScript | andynormancx/aoc2017 | /day13-2.js | UTF-8 | 4,230 | 3 | 3 | [] | no_license | var _ = require('lodash');
require('sugar');
let testInput = [
'0: 3',
'1: 2',
'4: 4',
'6: 4',
];
let tests = [
{ program: "2", connections: 6},
];
/*
tests.forEach(input => {
var output = solve(testInput);
if (output.connections == input.connections) {
console.log("PASS: '... | true |
d57a7bc8406353f562f54d381c470e37f7f0f148 | JavaScript | Carly-Schaaf/algorithms | /implemented/airbnb.js | UTF-8 | 1,767 | 3.703125 | 4 | [] | no_license | function Model () {
this.hash = {};
this.callbacks = [];
}
Model.prototype.set = function(key, value) {
let prevValue;
if (this.has(key)) { prevValue = this.hash[key]; }
this.hash[key] = value;
if (this.has(key) && (prevValue !== value)) {
this.callbacks.forEach(cb => {
cb(... | true |
f1c0e889a893c6ea4f9796b59d64e07dc218d460 | JavaScript | vinaypagaria/elogame | /js/strategylearn.js | UTF-8 | 18,041 | 2.609375 | 3 | [] | no_license | // Create Global Variable for this page.
var MyGlobals = {};
// $(function() {
// });
$(document).ready(function() {
MyGlobals.strategy = new elearnoptions.Strategy();
var id = getParameterByName("id");
MyGlobals.strategy.initStrategy(id);
createDescriptions();
... | true |
2e55c96831a5f3f61027fe1a197522857cbc55c1 | JavaScript | lpeabody/KineticGrid | /grid.js | UTF-8 | 5,411 | 3.546875 | 4 | [] | no_license | /**
* Cubic Bezier Equation
* Source: http://en.wikipedia.org/wiki/B%C3%A9zier_curve#Animation
*/
function cubicBezier(p0,p1,p2,p3,t) {
return (Math.pow(1-t,3) * p0) + (3 * Math.pow(1-t,2)*t*p1) + (3 * (1-t) * Math.pow(t,2) * p2) + (Math.pow(t,3) * p3);
}
/**
* Function creates and places the composite... | true |
0d00affa14c19e7e94789ccf80dfdf187f9e8740 | JavaScript | emarukyan/undo-redo-swift-way | /src/undoable.js | UTF-8 | 2,541 | 2.84375 | 3 | [] | no_license | class Undoable {
pendingUndoableActions = [];
pendingRedoableActions = [];
past = [];
future = [];
actionChecker(action) {
if (typeof action.callback !== 'function' || typeof action.oldValue === 'undefined') {
throw new Error('WTF!!?')
}
}
debugInfo() {
consol... | true |
ab8896093b08df92aac65cd5a5fc99c4b1b21bb2 | JavaScript | jpanagiotidis/node-examples | /source/aws/index.js | UTF-8 | 1,242 | 2.71875 | 3 | [] | no_license | 'use strict';
import _ from 'underscore';
import {createReadStream} from 'fs';
export async function uploadFile(s3, file_path, options){
try {
options.Body = createReadStream(file_path);
return await s3.putObject(options).promise();
} catch (e) {
throw e;
}
}
export async function getObjects(s3, bu... | true |
072f5cda9a9ffbb32c1b72f129431c9de1ac3a36 | JavaScript | gsvendsen/spotify-to-youtube | /public/scripts/youtube.js | UTF-8 | 4,878 | 2.734375 | 3 | [
"MIT"
] | permissive | let GoogleAuth;
let SCOPE = 'https://www.googleapis.com/auth/youtube.force-ssl';
const handleClientLoad = () => {
// Load the API's client and auth2 modules.
// Call the initClient function after the modules load.
gapi.load('client:auth2', initClient);
}
const initClient = () => {
var discoveryUrl = 'https:... | true |
ce1642398d8d7e0d0de719f44ad39e462cbae04f | JavaScript | drewmoore/nss-cohort-iv | /lecture/2014-01-15-JQuery.Intro/public/js/main.js | UTF-8 | 743 | 2.96875 | 3 | [] | no_license | $(document).ready(initialize);
function initialize(){
// $ means JQuery
//$('css or jquery selector')
$('h1').css('color','red');
$('h1').css('font-size','15px');
var currentH1Text = $('h1').text();
console.log(currentH1Text);
$('h1').text('Welcome to Javascript');
$('div').css('color', '#ff00ff');
... | true |
0c7c0f4093df02ba2d660a849fe8f989208661e7 | JavaScript | daniloxxv/js-algorithms-data-structures | /__tests__/helpers/compareLists.js | UTF-8 | 456 | 3.15625 | 3 | [] | no_license | function compareLists(list1, list2) {
if (list1.length !== list2.length) return false;
let currentList1Element = list1.head;
let currentList2Element = list2.head;
while (currentList1Element && currentList2Element) {
if (currentList1Element.val !== currentList2Element.val) return false;
currentList1Eleme... | true |
0f5747566b7ac4231cbe07374273797d3b0e34d6 | JavaScript | cjh804263197/Koa2RestApi | /service/CorpService.js | UTF-8 | 1,897 | 2.515625 | 3 | [
"MIT"
] | permissive | const {Corp, sequelize} = require('../model')
const {APIError} = require('../rest')
const {queryConditionParser} = require('../common/util')
/**
* 保存企业 (若params中带有id,则为修改,否则为添加)
*/
let saveCorp = async params => {
let corp = null
if (params.id !== undefined && params.id !== null) {
corp = await Corp... | true |
258fc0c53190282fb4ea4cbfe4042e5f1263a122 | JavaScript | Alequin/javascript-learning-gauntlet | /tests-to-fix/functions/repeat/repeat.test.js | UTF-8 | 422 | 3.03125 | 3 | [] | no_license | import repeat from "./repeat";
describe("repeat", () => {
it("Calls the given function the requested number of times", async () => {
const mockFunction = jest.fn();
await repeat(5, async () => {
await sleep(100);
mockFunction();
});
expect(mockFunction).toHaveBeenCalledTimes(5);
});
})... | true |
632a249c6cc7b7131e884c64b3dcb81a3d76317a | JavaScript | masonhalstead/kinetic-ui | /src/components/Debounce.js | UTF-8 | 647 | 2.546875 | 3 | [
"MIT"
] | permissive | import PropTypes from 'prop-types'
import { useCallback, useEffect } from 'react'
export const useDebounce = (fn, value, debounce, delay, dependency) => {
const callback = useCallback(fn, dependency)
useEffect(() => {
if (value === debounce) {
return
}
const handler = setTimeout(() => {
if... | true |
931c8efdc3d3661226f210c978a1431a1d86f19f | JavaScript | venkatsai2020/frashersbatch1-oct16 | /node.js-Assignments/node.js/operations/sub.js | UTF-8 | 90 | 2.515625 | 3 | [] | no_license | module.exports.sub=function(){
console.log("The substraction of 3 & 7 is: "+(3-7));
}; | true |
ba0aad14d3574c5d928c5a35779c12e88c7bd296 | JavaScript | riponcv/rpd-local | /assetsLms/js/test.js | UTF-8 | 78 | 2.828125 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | if(!isNaN(44)){
console.log("Number");
}else{
console.log("Not number");
} | true |
f6a309acc4d715dd3c211f1026fa1227b3c42c8e | JavaScript | jorgec/socnet-ajax | /assets/js/ajax/status.js | UTF-8 | 950 | 2.515625 | 3 | [
"MIT"
] | permissive | $(function() {
function post_status(){
var formdata = {};
var processor = $("#post-status-form").attr("action");
formdata["content"] = $("#status-content").val();
return $.ajax({
url: processor,
type: "post",
data: formdata
});
}
$... | true |
11aa459df8c91332485a123bb4cf49d502732780 | JavaScript | faical-yannick-congo/MDCS | /static/inc/controllers/js/curate.js | UTF-8 | 33,848 | 2.75 | 3 | [
"LicenseRef-scancode-public-domain"
] | permissive | /**
*
* File Name: curate.js
* Author: Sharief Youssef
* sharief.youssef@nist.gov
*
* Guillaume SOUSA AMARAL
* guillaume.sousa@nist.gov
*
* Sponsor: National Institute of Standards and Technology (NIST)
*
*/
/**
* AJAX call, checks that a template is selected
* @param selectedLink r... | true |
226b526ec8225dee1dbcef1003b240dd9cdbe8a2 | JavaScript | codevarz/RegistrationApp | /Registration app/exam.js | UTF-8 | 377 | 2.53125 | 3 | [] | no_license |
var execute = function (){
};
var wrap = function(execute){
return (
function (){
try {
var func = execute();
return func;
}
catch(err){
return null;
}
finally{
throw new Error("... | true |
a6f2f65961449220cab5bf129e1c1b9baf74153c | JavaScript | kingToyo/music | /js/index.js | UTF-8 | 4,712 | 2.546875 | 3 | [] | no_license | // 广告轮播样式
$(function() {
//定义两个全局变量
var $ulIds = $(".indicators");
var $ul = $(".banner-img"),
//设置图片的宽.滑动时间.定时器.和悬停事件
LIWIDTH = 1200,
interval = 500,
wait = 3000,
moved = 0,
timer = null;
//发送AJAX请求
$.ajax({
type: "get",
url: "data/ind... | true |
ebf62c2e90caa6bf58c4368fe9f239330a4d410a | JavaScript | FabianMauz/react_playground | /example2/react-api/src/App.js | UTF-8 | 748 | 2.8125 | 3 | [] | no_license | import React, {Component} from 'react';
class App extends Component {
state = {contacts: [],loading:true}
render () {
const listItems = this.state.contacts.map((d) => <li key={d.name}>{d.name}</li>);
if(!this.state.loading){
return (<div className="pulsate">{listItems}</d... | true |
3f4c03c62fc6c3bee3ee1ec605d35334faadd5ab | JavaScript | dvprz/Basket | /src/scripts/app/suggested.js | UTF-8 | 978 | 2.546875 | 3 | [] | no_license | import { loadStorage } from '../store/localStorage'
import { makeSuggestedItem, ACTIONS } from './suggested-item'
import { create } from 'create-elem'
export function suggested(app, events) {
const el = app.querySelector('.suggested')
const list = el.querySelector('.suggested__list')
el.addEventListener('click'... | true |
309de7915042995482b068e2bd52affe2b7cede8 | JavaScript | ignavila13/listaDeTareas | /js/main.js | UTF-8 | 3,078 | 3.359375 | 3 | [] | no_license | var contador = 0;
function crearTarea(){
var inputAgregarTarea = document.getElementById("inputTarea");
if(inputAgregarTarea.value != ""){
var listaTareas = document.getElementById("listaTareas");
//creo los elementos
var divTarea = document.createElement("div");
var ... | true |
a1660dc0ba5abf1778637c121b651c0ee2641fa1 | JavaScript | MOPineyro/tic-tac-toe2 | /spec/specs.js | UTF-8 | 4,088 | 3.28125 | 3 | [] | no_license | describe("Player", function() {
describe("initialize", function() {
it("is initialized with a symbol", function() {
var testPlayer = Object.create(Player);
testPlayer.initialize("X");
testPlayer.symbol.should.equal("X");
});
});
describe("create", function() {
it("creates a new play... | true |
3cb8434aeee32beed6fc44e94986ed1e67d81dfe | JavaScript | niccor83/unit-4-game | /assets/javascript/game.js | UTF-8 | 4,984 | 4.125 | 4 | [] | no_license | //variables
var randomNum = 0;
var wins = 0;
var losses = 0;
var userGuess = 0;
var redCrystNum = 0;
var blueCrsytNum = 0;
var yellowCrystNum = 0;
var greenCrystNum = 0;
var randomCrystNum = 0;
var redClicked = false;
var yellowClicked = false;
var blueClicked = false;
var greenClicked = false;
//functions
//generate... | true |
304f8c7ad980ab4903594871514269dc1b42df27 | JavaScript | EdisonDevadoss/js_practics_execrise | /1-part/1-exercise.js | UTF-8 | 431 | 4.15625 | 4 | [] | no_license | // Exercise 1:
// Write a JavaScript program to check two numbers and return true if one of the number is
// 100 or if the sum of the two numbers is 100
const isEqualTo100 =(a,b)=> a === 100 || b === 100 || (a + b) === 100;
console.log(isEqualTo100(100, 0))
console.log(isEqualTo100(0, 100))
console.log(isEqualTo100... | true |
cc01da3e3721f808c6091f0d01e483f5966f8ae7 | JavaScript | JustTheice/FlowerDating | /src/utils/phoneConvertUtil.js | UTF-8 | 392 | 2.515625 | 3 | [] | no_license | // 像稿宽度 / 像稿中元素宽度(px) = 手机宽度 / 手机中元素宽度(dp)
// 手机中元素宽度 = 手机宽度 * 像稿中元素宽度 / 像稿宽度
import {Dimensions } from "react-native";
export const pxToDp = pxWidth => screenWidth * pxWidth / 375;
export const screenWidth = Dimensions.get('window').width;
export const screenHeight = Dimensions.get('window').height; | true |
f1c7df99f831adfadaf8098b9dbd7ee1a867f3ae | JavaScript | yardfarmer/bone | /playground/day-to-day/2017-05-12/dd.ready.js | UTF-8 | 224 | 2.796875 | 3 | [
"MIT"
] | permissive | var dd = {
ready: function(cb) {
setTimeout(function() {
console.log('dd.ready')
cb && cb()
}, 100)
}
}
dd.ready = function() {
setTimeout()
}
function foo() {
console.log('foo')
}
dd.ready(foo) | true |
299890ccb3d550151a25584d3de8993391322418 | JavaScript | guitargulley/fall-gregs-list | /server-assets/routes/instrument-routes.js | UTF-8 | 1,094 | 2.71875 | 3 | [] | no_license | var Instruments = require('../models/instrument')
var router = require('express').Router()
// WHAT IS AUTOS? RESOURCE
// WHERE IS EXPRESS
router.get('/api/instruments', (req, res, next) => {
// FIRST JOB is to go get the autos from the db
Instruments.find({})
.then(instruments => res.send(instruments))
... | true |
b9d1d431708aa8002b3ab55659e68c28348e9826 | JavaScript | Njabulo-Mbuli/build_a_burger_react | /src/containers/Checkout/ContactData/ContactData.js | UTF-8 | 3,584 | 2.53125 | 3 | [] | no_license | import React, {Component,Fragment} from 'react'
import Button from '../../../components/Layout/UI/Button/Button';
import axiosInstance from '../../../axios-order';
import Spinner from '../../../components/Layout/UI/Spinner/Spinner';
import './ContactData.css';
import Input from '../../../components/Layout/UI/Input/Inp... | true |
29068e6f15ad82217550b738423eb308491cc359 | JavaScript | SimonKempf/coding | /p5-tuto/8_HTML_CSS_DOM/8.12_parent_child/sketch.js | UTF-8 | 496 | 2.828125 | 3 | [] | no_license |
var happy = ['surf', 'chocolate','friends'];
// function setup() {
// var canvas = createCanvas(100, 100);
// canvas.parent('canvasp');
// }
// function draw() {
// background(0);
// ellipse(50,50,random(100), random(100));
// }
function setup() {
noCanvas();
var button = select('#button');
button.mousePres... | true |
f90642e15a47077d4b358a22afe5a6dc9d114635 | JavaScript | mritunjayz/node-stt | /http_get.js | UTF-8 | 566 | 2.703125 | 3 | [] | no_license | var https=require('https')
var fs=require('fs')
var req=https.get('https://en.wikipedia.org/wiki/MS_Dhoni',function(res){
var resBody = "";
console.log("we get it")
console.log(`Server Satus:${res.statusCode}`);
//console.log("response headers:%j",res.headers);
res.setEncoding("UTF-8");
res.on("data",function(chunk)... | true |
4b0c561d8c5611d8067a7d0557807a35b34d93dc | JavaScript | rogeraraujochagas/PW3-aula3 | /impl/problema3.js | UTF-8 | 578 | 3.171875 | 3 | [] | no_license | var fc = 0.7;
var vl = 120;
var vc;
var calc = function (vlc) { return 300 * (1 / vlc - 1); };
var x = calc(fc);
var vla = vl * 1.2;
var multa = function (fc) {
if (fc <= vl) {
console.log(" A velocidade do carro: " + fc.toFixed(2) + " o valor da multa \u00E9 de R$ 0,00 ");
}
else if (x > 120 && cal... | true |
57f4684b83855d22bb957e5c9b2bf5502c6d628e | JavaScript | marko-st-bl/express-chat | /public/js/main.js | UTF-8 | 3,159 | 2.875 | 3 | [] | no_license | var messages = document.querySelector('.messages');
var form = document.querySelector('.new-message-form');
var input = document.querySelector('.message-input');
var usersUL = document.querySelector('.online-users');
var onlineUsers = [];
const socket = io();
form.addEventListener('submit', (e) => {
e.preventDefa... | true |
41bf53475f426dacd88a82470c90ed5604674a0b | JavaScript | LucianBuzzo/curly-braces | /src/nonStackRec.js | UTF-8 | 341 | 3.015625 | 3 | [] | no_license | const pairs = {
'(': ')',
'[': ']',
'{': '}'
}
const parse = ([...items], pointer = -1) => {
const isPair = pairs[items[pointer]] === items[pointer + 1];
if (isPair) {
items.splice(pointer, 2)
pointer--;
} else {
pointer++;
}
return pointer >= items.length - 1 ? pointer < 0 : parse(items, pointer)
}
e... | true |
ad2429791725c8118729325db1f43255ab19be3c | JavaScript | sqrtqiezi/tdd-katas | /day01/bowling-game.test.js | UTF-8 | 2,600 | 2.96875 | 3 | [] | no_license | const Game = require('./bowling-game')
describe('Bowling Game', function() {
let game
beforeEach(() => {
game = new Game()
})
it('start with 0 score', function() {
expect(game.score).toBe(0)
})
it('roll pins', () => {
game.roll(1)
game.roll(1)
game.roll(1)
game.roll(1)
exp... | true |
53b8c6005baff8f1db2c43781636ddddbead6451 | JavaScript | mweibel/lcov-result-merger | /test/test-unit/brda-spec.js | UTF-8 | 1,464 | 2.984375 | 3 | [
"MIT"
] | permissive | /* eslint-env mocha */
const chai = require('chai');
chai.should();
const BRDA = require('../../lib/entries/brda');
describe('Unit | BRDA', function () {
it('should be constructable with the new operator', async function () {
const instance = new BRDA(10, 20, 30, 40);
instance.should.be.instanceOf(BRDA);
... | true |
aae826375aa0123b3edd2ac7e195d139721443ee | JavaScript | omni360/3DViewer | /js/AxisViewer.js | UTF-8 | 7,669 | 3.09375 | 3 | [] | no_license | /**
Creates an axis in the bottom left corner of the screen,
which is actually another viewport with a camera that copies
the rotation of the original scene's camera
**/
// Inset window with axes showing world orientation
// Useful with Trackball controls when zooming
// WestLangley
// three.js r.60
AxisViewer = ... | true |
a981f27b7d0800cbce141150e8da63f684754d7b | JavaScript | ng-shubham/Array | /reduceRight.js | UTF-8 | 316 | 3.5625 | 4 | [] | no_license | const fun = (currentValue, addedValue) => addedValue + currentValue;
const array = [2, 5, 4, 3];
let reducer = array.reduceRight(fun);
console.log(reducer); //14
let reducerValue = array.reduceRight(fun, 10);
console.log(reducerValue); //24
| true |
27b87c504f6bc6183c778d143f1ed4f1c2fe76f9 | JavaScript | Kondo-Taro/kms_html | /mtd4/js/headerfix.js | UTF-8 | 355 | 2.671875 | 3 | [] | no_license |
const burgerFix = ()=>{
const win = $(window);
const burger = $('.burger');
const fix = 'burger-Fix';
win.on('scroll',()=>{
let topScroll = $(this).scrollTop();
if (topScroll > 10){
burger.addClass(fix);
}else{
burger.removeClass(fix);
... | true |
8358dd3f4d3e901c1d30bd8fae4014abf6e813bc | JavaScript | PacktPublishing/Learning-JavaScript-Data-Structures-and-Algorithms-Third-Edition | /LearningJavaScriptDataStructuresandAlgorithmsThirdEdition_Code/src/js/others/hanoi.js | UTF-8 | 1,437 | 3.25 | 3 | [
"MIT"
] | permissive | // @ts-check
import Stack from '../data-structures/stack';
function towerOfHanoi(plates, source, helper, dest, sourceName, helperName, destName, moves = []) {
if (plates <= 0) {
return moves;
}
if (plates === 1) {
dest.push(source.pop());
const move = {};
move[sourceName] = source.toString();
... | true |
012d4844df38cb4bf8f99291b3c543e276b66375 | JavaScript | Alex-JS-team/advanced-js | /04/HOME_WORK/index.js | UTF-8 | 481 | 2.515625 | 3 | [] | no_license | /*
Реализовать иерархию классов синтаксисом ES 5 согласно
диаграммы классов приведенной в презентации home_oop
*/
// usage
const cd = new CDProduct("Abbey road", 30, 45.20);
console.log(cd.getInfo()); // Product: Abbey road, price: 30, length: 45.2
const book = new BookProduct("React", 60, 125);
cons... | true |
59614716c8dadbe6d32d16b801d70c4c50bb8181 | JavaScript | wildoak/logawesome | /src/transformer-coalesce.js | UTF-8 | 1,839 | 2.53125 | 3 | [
"MIT"
] | permissive |
import debug from './debug';
const placeholderToString = placeholder => {
if (placeholder === null) {
return '<null>';
}
if (placeholder === undefined) {
return '<undefined>';
}
if (placeholder instanceof Error) {
return placeholder.stack || (placeholder.toString && place... | true |
c9869d7e95be0de1d10c24eadf17974d9a6013c7 | JavaScript | JPlante9117/crud-lab-online-web-ft-100719 | /src/reducers/manageRestaurant.js | UTF-8 | 1,110 | 2.640625 | 3 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive |
import cuid from 'cuid';
import { combineReducers } from "redux";
export const cuidFn = cuid;
const rootReducer = combineReducers({
restaurants: manageRestaurants,
reviews: manageReviews
})
export default rootReducer
function manageRestaurants(state=[], action) {
switch (action.type){
case "ADD... | true |
697aaa57811438fcc035465a62f41f1f1d052cec | JavaScript | satosansato3/screenshot-for-evidence | /content.js | UTF-8 | 6,493 | 3.0625 | 3 | [] | no_license | // This will parse a delimited string into an array of
// arrays. The default delimiter is the comma, but this
// can be overriden in the second argument.
function CSVToArray(strData, strDelimiter) {
// Check to see if the delimiter is defined. If not,
// then default to comma.
strDelimiter = (strDelimiter... | true |
fe3249e715805c939b590dc0a7a31845446e438a | JavaScript | roksolanaPyshyeva/front-end-lab-8 | /homework_05/tower-of-babel/iterator_for_of.js | UTF-8 | 800 | 3.5625 | 4 | [] | no_license | const max = process.argv[2];
let FizzBuzz = {
[Symbol.iterator](){
let number = 1;
let returnWords = ['Fizz','Buzz','FizzBuzz'];
return{
next(){
if(number <= max){
if(((number % 3) === 0) && ((number % 5) === 0) ){
number++;
return { done: false, value: retu... | true |
82b54fb10aedd73fb05587fad83411763f1102a1 | JavaScript | dckc/ERTP | /util/makePromise.js | UTF-8 | 869 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | import harden from '@agoric/harden';
export default function makePromise() {
let res;
let rej;
const p = new Promise((resolve, reject) => {
res = resolve;
rej = reject;
});
// Node.js adds the `domain` property which is not a standard
// property on Promise. Because we do not know it to be ocap-saf... | true |
6b85135e0d85a83d142b330e830650fb87096cbb | JavaScript | Mokshi02/JavascriptAuribises | /my-script.js | UTF-8 | 503 | 3.734375 | 4 | [] | no_license | // Day-2 Work
var prompt = require('prompt-sync')();
console.log("This is from my-script")
// alert("Hello JS")
a = 10
var b = 10
let c = 10
let name = "Mokshi"
console.log("a is: " +a+ " type of a is: "+ typeof a);
console.log("b is: " +b+ " type of b is: "+ typeof b);
console.log("c is: " +c+ " type of c is: "+ ... | true |
f83a5f301d203427a48e44c719fc8bcd4aa14b2f | JavaScript | shiling/testing-zero-to-hero | /tests_solutions/2_api_tests/2_pokedex_api.test.js | UTF-8 | 2,144 | 2.953125 | 3 | [
"MIT"
] | permissive | import chai from "chai"
import chaiHttp from "chai-http"
chai.use(chaiHttp)
import { expect } from "chai"
describe("/api/pokedex", function(){
it("should return a list of pokemon as a json array using /list", async function(){
let res = await chai.request("localhost:3000").get("/api/pokedex/list").send()
// co... | true |
05859b8dd6f405a92c5329ed326f9015d848c80a | JavaScript | shima9397/js-start | /6/script.js | UTF-8 | 473 | 3.703125 | 4 | [] | no_license | let getSmallestWordSize = (myString) => {
let myArray = [];
myArray = myString.split(" ");
let smallestLength = myArray[0].length;
for (let i = 0; i < myArray.length; i++) {
if (myArray[i].length < smallestLength) {
smallestLength = myArray[i].length;
}
}
return smallestLength;
//return get... | true |
49ba1eb1691b3082d51718a466e7a69989eb1311 | JavaScript | berensp/berensp.github.io | /strava-js.js | UTF-8 | 843 | 3 | 3 | [
"MIT"
] | permissive | import StravaApiV3 from "./strava-api.js";
const stravaClient = new StravaApiV3({
clientId: "111503",
clientSecret: "9abdda73b9cf15100b12faefcae56d4c8343a378",
accessToken: "0bd0d49161189cc7bf570a01eeb1833a8f6df06d",
});
const getMostRecentActivity = async () => {
const activities = await stravaClient.getActi... | true |
4d58002b70d426442cfa8464b56ab18db6bd21be | JavaScript | subtirelumihail/pixie | /src/utils/createEndpoints.js | UTF-8 | 2,155 | 2.921875 | 3 | [] | no_license | import { jwtRequest } from 'lib/request';
import { api } from 'config';
/**
* Creates CRUD endpoints from a given base URL
*
* @param {string} endpointURL
*
* @returns {object} the CRUD endpoints
*/
export const createDefaultEnpoints = endpointURL => ({
list: () => jwtRequest.get(`${endpointURL}`),
create: d... | true |
48592018292cd1f6205403d172a92b42c197b180 | JavaScript | fedehuguet/TodoList | /js/config.js | UTF-8 | 1,555 | 2.953125 | 3 | [] | no_license | document.addEventListener("DOMContentLoaded", function(){
document.getElementById("btnSubmit").addEventListener("click", function(e){
e.preventDefault();
var to_do = document.getElementById("newTodo");
//Validation
if(!to_do.value || to_do.value.length < 1) {
window.alert("Text is mandato... | true |