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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
608b9a3e84786b9e316fbb64f1001de0b24be688 | JavaScript | iliyaML/addressbook | /validation/validateBodyInput.js | UTF-8 | 1,016 | 2.8125 | 3 | [] | no_license | const isEmpty = value =>
value === undefined ||
value === null ||
(typeof value === 'object' && Object.keys(value).length === 0) ||
(typeof value === 'string' && value.trim().length === 0);
module.exports = validateBodyInput = data => {
const errors = {};
const tmpData = {}
tmpData.fullnam... | true |
9a2b1d7c5692cce35773ec321d799f46d8a8998c | JavaScript | amoncruz/frontendDesafio | /src/Pages/CadastroCurso.js | UTF-8 | 2,704 | 2.65625 | 3 | [] | no_license | import React, { useState, useEffect } from 'react';
import Axios from 'axios';
import {Form,FormGroup,Input,Label,Button,Container} from 'reactstrap';
import {semestres as arraySemestres} from '../utils/semestres';
const CadastroCurso=()=>{
const [initialState,setInitalState]=useState();
const [curso,setCurso]... | true |
f162a8f946051d0f3c0d86e3721979f34eee8708 | JavaScript | 17862656392/happyBuy-imitation | /two/public/js/category.js | UTF-8 | 1,600 | 2.90625 | 3 | [
"MIT"
] | permissive | // 更新显示一级分类
function updateMainCategory(data) {
data.forEach(function(item) {
$(`<li data-id="${ item.id }" data-avatar="${ item.avatar }"><span>${ item.name }</span></li>`).appendTo('.category-main')
});
$('.category-main>li').click(function() {
if($(this).hasClass('active')) return;
$(this).addClass('active'... | true |
1aae7716c9a7a58ca9866324a4f0b4581f447120 | JavaScript | lordpaulthomas/Word-Guess-Game | /assests/javascript/game.js | UTF-8 | 3,109 | 3.46875 | 3 | [
"MIT"
] | permissive | lives = 12;
wins = 0;
losses = 0;
lives = 12;
guessedLetters = [];
var answerArray = ['advice', 'aflame', 'cooler', 'convex', 'devout', 'falcon', 'gazers', 'gloomy', 'insure', 'insult', 'joyful', 'lizard', 'lentil', 'mumble', 'normal'];
var hiddenArray = [];
var openArray = [];
var playGame = confirm('Wanna Guess My Wo... | true |
f00baa8224d24286cc6e7b46fd66e38e2c8f4123 | JavaScript | hdennen/HackerRank | /twoStrings.js | UTF-8 | 1,544 | 4.375 | 4 | [] | no_license | //my first method involved looping through a string, and then for each char, looping through the subsequent string to look for a match. this was stupid. Very, very stupid.
//new approach: create an array of potential matches. ie, the alphabet. then see if any of them exist in both strings. Way better approach.
function... | true |
486e81668942c048243bc5a14b6a92e6875ca541 | JavaScript | Tazri/Learn-Java-Script | /chapter two/datefunction.js | UTF-8 | 544 | 3.796875 | 4 | [] | no_license | // date function
var date = new Date();
console.log(date);
console.log(date.toString());//date to string
console.log(date.toTimeString());//Time to string
console.log(date.toDateString());//Date to String
console.log(date.toLocaleDateString());//Locale Date String
console.log(date.getDay());//Day
console.log(date.getDa... | true |
3edbd6a58006fc39cb2e848d734000f7504d6394 | JavaScript | tongjieGit/duokan_new | /js/comm.js | UTF-8 | 6,247 | 2.609375 | 3 | [
"MIT"
] | permissive | /*Ajax对象封装*/
function AjaxClass(_url, _successCallback, _failureCallback, _urlParameters, _callbackParams, _async, _charset, _timeout, _frequency, _requestTimes, _frame) {
this.url = _url || "";
this.successCallback = _successCallback || function(_xmlHttp, _params) {};
this.failureCallback = _failureCallback || func... | true |
d73ed30263a2704c4fd2c28c8ff2a4f54da3a557 | JavaScript | xzxldl55/DataStruct-Of-JS | /线性表/SqList.js | UTF-8 | 853 | 4.09375 | 4 | [] | no_license | function SqList(){
this.elem = [];
this.length = 0;
}
// init
SqList.prototype.InitList = function(array){
this.elem = array;
this.length = array.length;
}
// 查找元素
SqList.prototype.LocateElem = function(e){
for(let i=0;i<this.length;i++)
if(e == this.elem[i])
return i;
retu... | true |
7adffa01d6f159599ab306144977c72f95a14416 | JavaScript | qwop/userscript | /monolith/120/51488.user.js | UTF-8 | 571 | 2.5625 | 3 | [] | no_license | // ==UserScript==
// @name Anime Planet Auto Forward
// @description When there is an exact-text match for the search, it forwards to user to that.
// @include http://www.anime-planet.com/search.php*
// ==/UserScript==
var area = document.body.childNodes[1].childNodes[9];
var search = area.childNodes[8... | true |
532b930d1da86fe4cc8daee1fe680c79506c134c | JavaScript | PerryCS-19-20/HypoInTravicle | /sitemap.js | UTF-8 | 1,975 | 2.75 | 3 | [] | no_license | function buildMap(id){
var container = document.getElementById(id);
var unorderedList1 = document.createElement("ul");
container.appendChild(unorderedList1);
var unorderedList2 = document.createElement("ul");
var li1 = append("https://perryma.tk/HypoInTravicle/index.html", "Home Page");
... | true |
49df318b2b0db5d095f29885d797c004ad9b604d | JavaScript | yanlele/node-index | /books/专题知识库/04、js设计模式/04篇、行为型设计模式/25、迭代器模式/02、同步变量迭代器.js | UTF-8 | 1,905 | 2.875 | 3 | [] | no_license | /**
* create by yanle
* create time 2019/1/3 下午2:15
*/
/*
* 同步变量迭代器
* 我们操作页面中的同步变量的内的某些属性值的时候, 我们不知道服务器端是否将该属性或者该属性的上级正确的打印到页面中。
* 所以直接调用会报错, 因此需要每一层做安全校验这样是非常麻烦和臃肿的。
* */
// 同步变量
let A = {
common: {},
client: {
user: {
username: '颜乐',
uid: '123'
}
},
server:... | true |
3b090372778aafaabec43aa5ec213235d7057ec9 | JavaScript | WesTrinhKL/ActiveCards | /react-app/src/components/QuizCardDetails/QuizCardDetails.js | UTF-8 | 13,677 | 2.53125 | 3 | [] | no_license | import React, {useState} from 'react'
import './QuizCardDetails.css'
import ViewPreviousModal from '../ViewPreviousModal'
import { setNewActiveRecallAnswer } from '../../store/quiz_deck'
import { useDispatch, useSelector } from 'react-redux';
import { useHistory } from 'react-router';
import { createQuizCardThunk, upda... | true |
cd276fe774664d6c24da2c5cd92289c3a688a6eb | JavaScript | Lakshya2610/Fortnite-2d | /a3/app/src/models/Resources.js | UTF-8 | 2,189 | 2.625 | 3 | [] | no_license | import { StaticObjects } from "./GameObject";
import { AABB, Pair } from './utils';
import BrickImage from '../assets/brick.png';
import IronImage from '../assets/iron.png';
import AR_Ammo_Image from '../assets/ar-ammo.png';
import SMG_Ammo_Image from '../assets/smg-ammo.png';
const RESOURCE_IMG_SIZE = {
'Rock': n... | true |
6bed8682e8b407767943519e8eddb14e09c57114 | JavaScript | Edward-alan/js-jquery | /JS + JQ笔记/JQ技能/拖拽购物车(1)/js/index.js | UTF-8 | 1,977 | 3.21875 | 3 | [] | no_license | //鼠标按下,阻止浏览器默认行为,获取鼠标的位置,增加监听事件
var arr = [];
$('figure').on('mousedown', function(e) {
e.preventDefault();
var clone = this.cloneNode(true);
$(clone).addClass('copy');
$(this).parent().append(clone);
var left = e.pageX - $(this).position().left;
var top = e.pageY - $(this).position().top;
... | true |
cf4e2970514a15fa518ec8987e0448c7df151f60 | JavaScript | BlackSyforce/barandi-training | /routers/ProjectRouter.js | UTF-8 | 1,498 | 2.609375 | 3 | [] | no_license | var ProjectRouter = function(app, Mongoose) {
var Project = Mongoose.models.Project;
var User = Mongoose.models.User;
/**
* Get all projects.
*/
app.get("/projects", function(request, response) {
Project.find(function(error, result) {
response.status(200).json(result);
});
});
/**
* Save a new proj... | true |
2804b063cc6e21291923c62ee3e6bd1ed5360100 | JavaScript | afrozek/notekeeper | /app/routes/notesRouter.js | UTF-8 | 1,657 | 2.78125 | 3 | [] | no_license | //dependencies
var Note = require('../models/note.js');
//api
module.exports = function(app,express){
var notesRouter = express.Router();
//get all notes
notesRouter.get('/',function(req,res){
Note.find(function(err,notes){
if(err)res.send(err);
res.json(notes);
})
})
//get a single note
notesRouter.get('/... | true |
14caffa8e0a3f6a537393e2e7e52cc9b99be014b | JavaScript | jesus-seijas-sp/nlp-course | /03-algorithms/02-language-prediction.js | UTF-8 | 1,369 | 3.3125 | 3 | [] | no_license | const { NGrams } = require('@nlpjs/utils');
const fs = require('fs');
const ngrams = new NGrams();
const languageTrigrams = {};
function processFile(fileName, locale) {
const lines = fs.readFileSync(fileName, 'utf-8').split(/\r?\n/);
const trigrams = ngrams.getNGramsFreqs(lines, 3, true);
languageTrigrams[local... | true |
8257681fa4ef04887d53ee63d577763fe16c2c7b | JavaScript | Miquiis/ofdp | /src/components/ficha/ProgressBar.js | UTF-8 | 2,155 | 2.5625 | 3 | [] | no_license | import React from 'react'
import styled from 'styled-components'
const ProgressTitle = styled.div`
font-size: 20px;
margin-bottom: 5px;
`
const ProgressBarContent = styled.div`
margin: 10px 0px;
`
const ProgressBarBox = styled.div`
display: flex;
justify-content: center;
align-items: center;
... | true |
893d0250b0cbb1191797361bb45613479fdf3731 | JavaScript | Fan0u/diginamic-node | /digi-readline/index.js | UTF-8 | 387 | 3.03125 | 3 | [] | no_license | const readline = require('readline')
const interface = readline.createInterface(
{
input : process.stdin,
output : process.stdout
}
)
interface.question('Donnes moi des chiffres, je vais les additionner ! ', (reponse) => {
const addition = reponse.split(' ').reduce((acc, val) => acc + +val... | true |
cb2efa6dfaf2bf7da940552ed8c131faf0a55776 | JavaScript | RomaneGreen/lambada | /lambada/static/js/main.js | UTF-8 | 422 | 3.09375 | 3 | [] | no_license |
setTimeout(() => {
$('message').fadeOut('slow')
}, 3000);
function getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
} else {
console.log("NOT SUPPORTED")
}
}
function showPosition(position) {
let lat = position.coords.latitude
let lon = p... | true |
21ca8280641cfb806f1a9b18b5d947f80c0d3c3f | JavaScript | engagespark/pushabutton | /assets/logs.js | UTF-8 | 1,160 | 2.703125 | 3 | [
"MIT",
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | $(function() {
function formatTimestamp(unix_timestamp) {
var date = new Date(unix_timestamp*1000)
var year = date.getFullYear()
var month = "0" + date.getMonth()
var hours = "0" + date.getHours()
var day = "0" + date.getDate()
var minutes = "0" + date.getMinutes()
var seconds = "0" + da... | true |
652d35fd25e2806511160ce16eec524f6c2afd09 | JavaScript | painkuter/mahjong | /static/game/preparation.js | UTF-8 | 4,606 | 2.890625 | 3 | [
"MIT"
] | permissive | // логирование
window.logger = document.getElementById("log");
console.debug = function (msg) {
window.logger.innerHTML += msg + '\n';
console.log(msg);
}
// проверка поддержки WebSocket
if (!window["WebSocket"]) {
alert("WebSocket problem")
}
// проверка доступности WebGL
let type = "WebGL";
if (!PIXI.uti... | true |
a807eacfc1a2dc171ebfe6bcedeabf9330b7f779 | JavaScript | goodalls/code-practice | /equalSidesOfArray.js | UTF-8 | 801 | 4.53125 | 5 | [] | no_license | // Let's say you are given the array {1,2,3,4,3,2,1}:
// Your function will return the index 3, because at the 3rd position of the array, the sum of left side of the index ({1,2,3}) and the sum of the right side of the index ({3,2,1}) both equal 6.
function findEvenIndex(arr) {
const map = arr.map((ele, index, array... | true |
fa207455fe8cbedb051af147dd038f187e49ebc3 | JavaScript | LiShuxue/BackEnd-Base | /jsp-servlet/代码/web6/HotelManager/WebRoot/js/script.js | GB18030 | 2,994 | 3.484375 | 3 | [] | no_license | function $(id){
return document.getElementById(id);
}
//ԶMap
function Map(){ //js췽Դ
//洢ֵ
this.put = function(key,value){
var s = "this." + key + '="' + value + '";';
//this.key="value"; ǰһԣkeyֵַvalue
//ãput("my",200) ʵִ this.my = "200";
eval(s);
};
//ȡֵ
this.get = function(key){
var v = eval("this." ... | true |
c260f985b233c7056537b4795d7c32943dfccd7d | JavaScript | mindovermiles262/codecademy-javascript | /05 More Control Flow in JS/08_all_on_your_own.js | UTF-8 | 358 | 3.953125 | 4 | [] | no_license | // Write your code below!
var answer = prompt("How old are you?");
switch (answer){
case '1':
console.log("Wow you're already 1 year old!");
break;
case '13':
console.log("First year of being a teenager!");
break;
case '21':
console.log("Have a beer for me!");
break;
default:
console.log("Must feel g... | true |
688c21f93dbc841b324163001f6b992f98e6272f | JavaScript | suzhoupanda/RSVPInvitationWebApp | /rsvp_app.js | UTF-8 | 3,974 | 2.859375 | 3 | [] | no_license | document.addEventListener('DOMContentLoaded', () => {
const form = document.getElementById('registrar');
const input = form.querySelector('input');
const mainDiv = document.querySelector('.main');
const ul = document.getElementById('invitedList');
const div = document.createElement('div');
const filterLabel =... | true |
52e86476887e321813bdd12e6949b4f771ce3069 | JavaScript | ashna99/captcha-based-authentication | /server/routes/users.js | UTF-8 | 1,054 | 2.515625 | 3 | [] | no_license | var router = require("express").Router();
var app = require('express');
var axios = require('axios');
const dotenv = require('dotenv');
dotenv.config();
//body-parser deprecated... middlewares are now part of express as methods
app.json();
app.urlencoded({ extended: true });
console.log('hi');
router.post("/signup-wit... | true |
78f21cc6b4a44bc91e575a925f6b16d9bdb3d139 | JavaScript | gengxin1995/leetcode | /algorithm/12_Dynamic Programing/139_Word Break.js | UTF-8 | 1,640 | 3.84375 | 4 | [] | no_license | /**
* Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine if s can be segmented into a space-separated sequence of one or more dictionary words.
Note:
The same word in the dictionary may be reused multiple times in the segmentation.
You may assume the dictionary do... | true |
89eef382d5d20b3d590e9bcc8d6153069bffdbf9 | JavaScript | markcronin/jstutorial | /Minefield.js | UTF-8 | 842 | 3.265625 | 3 | [] | no_license | var explodes = false
var trigger = 32
var count = 1
for (x = 1; x <= 8; x++){
if (count % 2 === 0){
if (explodes === false){
for ( y = 8; y >= 1; y--){
var fuse = Math.floor(Math.random() * 65)
if (fuse === trigger){
console.log ("row " + x + "; position " + y + " BANG!!!")
... | true |
d185195fdd14f54a049a708e1dd4d170bc3273b4 | JavaScript | wlivengood/learnyounode_exercises | /myFirstIO.js | UTF-8 | 179 | 2.75 | 3 | [] | no_license | var fs = require('fs');
var path = process.argv[2];
function countNewLines() {
return fs.readFileSync(path).toString().split("\n").length - 1;
}
console.log(countNewLines(path)); | true |
42d6efe5abcb26bbeab8d34ff0f5b8c76a0a2521 | JavaScript | nacaceres/navioTool | /src/App.js | UTF-8 | 1,341 | 2.859375 | 3 | [
"MIT"
] | permissive | import React from "react";
import Viz from "./NavioComp.js";
import appcss from "./App.css";
class App extends React.Component {
constructor(props){
super(props);
this.state = {
datos : "https://www.datos.gov.co/resource/fgp3-4nha.json",
navios: []
};
this.link = React.createRef();
th... | true |
21da39353c68f63f286dcd9b12fbfa6cb6bf50e2 | JavaScript | rpuspana/eric-clapton-i-wiki | /js/script.js | UTF-8 | 11,569 | 3.90625 | 4 | [
"MIT"
] | permissive | /*
* Game developer Radu Puspana
* Developed in August 2017
* Game version 1.0
*/
// arary of Strings, the questions
var questions;
// the answers for each question that will be displayed on the page. The link between this structure and the questions array is the index. From these questions a user must select the co... | true |
2bcfb007e8fab574cf3f2b6b045d3db5301176ac | JavaScript | Emily-Till/random-animal-facts | /functions/fact.js | UTF-8 | 424 | 2.71875 | 3 | [] | no_license | const catFacts = [
"cats spend 70% of their lives asleep",
"In 1963 a called called Felicette went to space",
"The oldest cat, Creme Puff, reached 38 years of age",
"Cats can rotate their ears 180 degrees",
"Most cats have no eyelashes",
];
exports.handler = async (events) => {
const random = catFacts[Math... | true |
e23b32488f3c94a27c293b6aa27214fcdaef7a26 | JavaScript | Trintusly/vistora-gs | /classes/Vector3.js | UTF-8 | 237 | 2.59375 | 3 | [] | no_license | 'use strict'
class Vector3 {
constructor(x = 0, y = 0, z = 0) {
this.x = x
this.y = y
this.z = z
}
toObject() {
return { x: this.x, y: this.y, z: this.y }
}
}
module.exports = Vector3
| true |
bf1db4bcdeb8ffce45ce503906821258281ab53b | JavaScript | gagarin880120/node-course | /src/resources/boards/board.memory.repository.js | UTF-8 | 837 | 2.546875 | 3 | [] | no_license | const Board = require('./board.model');
let boardsData = [];
const getAll = async () => boardsData;
const getById = async id => boardsData.find(element => element.id === id);
const postBoard = async data => {
const newBoard = new Board(data);
boardsData.push(newBoard);
return newBoard;
};
const d... | true |
1a00adc61477b1aae5a89e022df6dadcecb2e2ae | JavaScript | mjbenefiel/tutorials | /js_weird_parts/iife.js | UTF-8 | 650 | 4.4375 | 4 | [] | no_license | // function statement
function greet(name) {
console.log("Hello " + name);
}
greet("mike1");
// function expression
var greetFunc = function(name) {
console.log("Hello " + name);
};
greetFunc("mike");
// IIFE
var greeting = (function(name) {
console.log("Hello " + name);
})("Mike the IIFE");
// valid JS expres... | true |
bc7b06ef0303835a607118cc1322654ed9a98f0d | JavaScript | LavaTime/Forms-master-DB | /hww/CanvasScript.js | UTF-8 | 442 | 3 | 3 | [] | no_license | function drawRect(xPos, yPos, rectWidth, rectHeight, fillStyle, strokeStyle, ineWidth) {
var canvas = document.getElementById("myCanvas");
var context = canvas.getContext("2d");
context.beginPath();
context.rect(xPos, yPos, rectWidth, rectHeight);
context.fillStyle = fillStyle;
context.fill()... | true |
0a473c1435cba2973d2997a5a3cfa105508b55aa | JavaScript | stevengangano/aldrich-photography | /routes/live_events.js | UTF-8 | 4,398 | 2.8125 | 3 | [] | no_license | var express = require("express");
var router = express.Router();
var LE = require("../models/live-events");
//Live Events
//(INDEX) - displays list of all campgrounds (linked to campgrounds.ejs)
//displays all the campgrounds found in the mongo database
router.get("/live-events", function(req, res) {
//Grabs the cam... | true |
943e080ac698a225166b21b3e49e84e89cb9e36d | JavaScript | DiegoKramerDeSouza/laravel | /public/js/controllers/LoadingController.js | UTF-8 | 1,154 | 2.65625 | 3 | [
"MIT"
] | permissive | /**
* Classe voltada ao tratamento de chamadas de carregamento de tela
*
* Instancia:
* LoadingView
*/
class LoadingController {
constructor() {
this._loading = new LoadingView();
this._load = doc.ALL(dom.LOAD_ELEM);
this._loadCancel = doc.ALL(dom.LOAD_CANCEL_ELEM);
}
deploy... | true |
ef1071ce53e88626c546f60bda184d8473076e2f | JavaScript | Neeraj-Radhakrishnan/Neeraj-Radhakrishnan | /JAVAScript/Assignment3/main.js | UTF-8 | 1,127 | 4.28125 | 4 | [] | no_license | //Q1
class Rectangle{
width;
height;
constructor(width,height){
this.width = width;
this.height = height;
}
}
let rectangle = new Rectangle(4,5);
console.log(rectangle.width);
console.log(rectangle.height);
//Modified the properties
rectangle.height = 60;
console.log(rectangle.wi... | true |
7011fd7c884d45448bec5e14ee2de609a9951be0 | JavaScript | bcgov/ltema | /app/lib/gps.js | UTF-8 | 2,900 | 2.703125 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | //Location Services Dialog
var gpsDialog = Titanium.UI.createAlertDialog({
title : 'Location Services Disabled',
message : 'You currently have all location services for this device disabled. If you would like to proceed please reenable location services.',
buttonNames : ['OK', 'Help'],
ok : 0,
help : 1
});
//How ... | true |
24f6efbbc28def5bcf2f9a1aa3dfb2fb963e910d | JavaScript | anjayluh/Fresh | /js1/calculators.js | UTF-8 | 2,528 | 3.40625 | 3 | [] | no_license | // JavaScript Document
<!-----///////////---!!Calculators!!---/////////---->
function calculateBMI(w,ht)
{
var weight = parseFloat(w);
var height = parseFloat(ht);
var total = weight * height;
document.getElementById('paid').innerHTML = total
}
function calculateWHR(w,ht,sex)
{
var waist = parseFloat(w);
var... | true |
054c0941ab8f1e8f8c0bb1cbd95a4025c65a770e | JavaScript | Mongolfiera/hj-homeworks | /canvas/star-field/js/stars.js | UTF-8 | 1,147 | 3.5625 | 4 | [] | no_license | 'use strict';
const canvas = document.querySelector('canvas');
const ctx = canvas.getContext('2d');
const colors = ['#ffffff', '#ffe9c4', '#d4fbff'];
document.addEventListener('DOMContentLoaded', generateSky);
canvas.addEventListener('click', generateSky);
function randomValue(min, max) {
return Math.random() * (ma... | true |
2bc932300d260c7a9046d26730ee4de4646ea37f | JavaScript | upstash/latency-comparison | /newsapis/mongoHandler.js | UTF-8 | 2,383 | 2.515625 | 3 | [] | no_license | // Import the MongoDB driver
const MongoClient = require("mongodb").MongoClient;
const { performance } = require("perf_hooks");
const Redis = require("ioredis");
// Once we connect to the database once, we'll store that connection and reuse it so that we don't have to connect to the database on every request.
let cach... | true |
cb0b52901dc19133d168501f96bca96b07ae80c5 | JavaScript | andrewlidong/aA_interview_questions | /unique_subs/uniqSubs.js | UTF-8 | 304 | 3.5625 | 4 | [] | no_license | // uniq subs
// Write a method that finds all the unique substrings for a word.
function uniqSubs(str) {
const subs = new Set();
for (let i = 0; i < str.length; i++) {
for (let j = 0; j < str.length; j++) {
subs.add([str.slice(i, j+1)]);
}
}
return Array.from(subs.values());
}
| true |
12020052f653f8dae8507d12e7f25a17d6c191ac | JavaScript | irenekyc/clone-netflix-faq | /index.js | UTF-8 | 853 | 2.890625 | 3 | [] | no_license | const allQuestions = document.querySelectorAll('[data-role="question"]');
let currentlyOpen = "faq-1";
const toggle = () => {
allQuestions.forEach((questionDiv) => {
if (questionDiv.id === currentlyOpen) {
questionDiv.classList.add("faq-open");
questionDiv.classList.remove("faq-close");
} else {
... | true |
4feb2d635f2074a3e84242fa7ef5ada1d3edb07c | JavaScript | VinayakHegde/slot-mixer-platform | /src/app/services/hammer.service.js | UTF-8 | 1,696 | 2.625 | 3 | [
"MIT"
] | permissive | (function () {
'use strict';
angular
.module('serviceWindow')
.factory('hammerService', hammerService);
// hammerService
// This service hosts the hammer.js routines.
// The hammer library is used to 'fix' issues on the touch device where touching the screen was not being register... | true |
db4861264cef595f23405f7ae9d58dd6cbe482aa | JavaScript | dvill03/final-project-fourdudebros | /frontend/Sarcix/assets/js/heatmap.js | UTF-8 | 4,967 | 3.03125 | 3 | [] | no_license | //example provided by https://bl.ocks.org/officeofjane/11b54880abcb6b844637cb1d7a120cd5
var dataset;
var days = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
times = d3.range(24);
var margin = {top:40, right:50, bottom:70, left:50};
// calculate width and height based on window size
var w = Math.max(Ma... | true |
c2d69f8a34550b0560738b757b90621e210b2a7f | JavaScript | tomasz-kwietniewski/tomasz-kwietniewski.github.io | /src/js/index.js | UTF-8 | 2,014 | 2.578125 | 3 | [] | no_license | import "../scss/main.scss";
console.log("Hi, I'm Tomasz - nice to meet You 🚀");
fetch(
"https://api.github.com/users/tomasz-kwietniewski/repos?sort=created&direction=asc"
)
.then((res) => res.json())
.then((res) => {
const container = document.querySelector(".projects-grid--js");
for (let repo of res) ... | true |
ffa61fb4da9b0e75309193605be05012a0f7a23b | JavaScript | leminhviett/im4717 | /week9/CaseStudy_3/case_study/js/menu.js | UTF-8 | 1,495 | 3.25 | 3 | [] | no_license | function clicked_test() {
console.log("menu clicked");
}
function calculate_price() {
//grp1
var grp1 = document.getElementsByName("price_1");
var chosen_price_1;
for (var i = 0; i < grp1.length; i++) {
if (grp1[i].checked) {
chosen_price_1 = grp1[i].value;
break;
}
}
var quant_1 = doc... | true |
daa56405a9f6cec4bec69686293213fb956914f6 | JavaScript | chimanaco/GoogleAppsScriptsForWOTD | /dev/libs/GAS/Google/GASSpreadsheets.js | UTF-8 | 3,597 | 3.109375 | 3 | [
"MIT"
] | permissive | export default class GASSpreadsheets {
/**
* Get a spreadsheet
* @param { string } spreadSheetId
* @return { Spreadsheet } spreadsheet
*/
static getSpreadSheetById(spreadSheetId) {
const spreadsheet = SpreadsheetApp.openById(spreadSheetId);
Logger.log(`getSpreadSheetById() shspreadsheeteet=, ${s... | true |
f9d4a1f41eb8088fae28d6e5818726212b90010f | JavaScript | divashuthron/HBD_Front_End_Repository | /resources/js/TopBar.js | UTF-8 | 908 | 3.546875 | 4 | [] | no_license | var dateTarget = document.getElementById("text_getDate");
var dOWTarget = document.getElementById("text_getDow");
var clockTarget = document.getElementById("text_getClock");
var date=new Date();
function getDate() {
var month=date.getMonth();
var clockDate=date.getDate();
dateTarget.innerText=`${month+1}월 ${clo... | true |
20645a8c68e7d60810b22704a83c3228df3f1d9e | JavaScript | monget/TristanMonget_5_08032021 | /public/js/productsList.js | UTF-8 | 2,506 | 3.609375 | 4 | [] | no_license | // Récupére un array parcouru avec la méthode forEach et chacune des variables est crée avec creationProducts() puis inséré en html dans une balise a
function bindProductsToView(data) {
let products = data;
let productsList = document.getElementById("products");
products.forEach(function (product) {
... | true |
6c1e61c5df74a951e9aab5272521bafda18effd6 | JavaScript | 2oe/project | /1602B/React/month/src/components/Input.jsx | UTF-8 | 2,381 | 2.5625 | 3 | [] | no_license | import React from 'react';
import {connect} from 'react-redux';
import {Link} from 'react-router-dom';
class Input extends React.Component{
constructor(){
super();
this.control = true; //true表示受控 false表示非受控
}
add(){
// 判端当前组件是受控还是非受控
let username, password;
if (t... | true |
f0c3c37845ec083e0d7daa3b8ccbb63c112b59aa | JavaScript | MCFrank16/javascript-challenge-solution | /find-longest-string.js | UTF-8 | 1,115 | 3.96875 | 4 | [] | no_license | // // learning sliding window pattern algorithm.
// // this function will return the longest substring with all distinct characters.
// // if the string is empty or not provided return O.
function findLongestSubstring(str){
// add whatever parameters you deem necessary - good luck!
if(typeof(str) !== "string" ... | true |
2f3328c8deec4e970f6b529861ba28866bfc184c | JavaScript | hankeliu2015/algorithmPractice2.github.io | /javascript/findOddOccurence.js | UTF-8 | 1,226 | 4.1875 | 4 | [] | no_license |
// function findOddOccurence(arr) {
// var arrHash = {};
// for (var i = 0; i < arr.length; i++) {
// if (arrHash[arr[i]] !== undefined) {
// arrHash[arr[i]] ++
// } else {
// arrHash[arr[i]] = 1
// }
// }
// console.log(arrHash)
// let counter = 0
// for ( var key in arrHash) {
//
... | true |
1b33ceec71cc8b7b80314067219f38038ce1bc98 | JavaScript | guizenifarouk/rebktn1-toy-problems | /nonrepeatedCharacter/nonrepeatedCharacter.js | UTF-8 | 472 | 4.40625 | 4 | [] | no_license | /**
* Given an arbitrary input string, return the first nonrepeated character in
* the string. For example:
*
* firstNonRepeatedCharacter('ABA'); // => 'B'
* firstNonRepeatedCharacter('AACBDB'); // => 'C'
*/
var firstNonRepeatedCharacter = function(string) {
// TODO: your solution here
for(var i = 0 ;... | true |
f2d119d2798096b31a411fe6a1921c06044195d9 | JavaScript | Mik13/AoC18 | /day6_1.js | UTF-8 | 2,189 | 3.109375 | 3 | [] | no_license | const input = require('fs').readFileSync('day6_input.txt', 'ascii');
const _ = require('lodash');
const coords = input.trim()
.split('\r')
.map((log, index) => {
const [x, y] = log.trim().split(', ').map(Number);
return {x, y, index};
});
const maxX = _.maxBy(coords, 'x').x + 1;
const maxY = ... | true |
8b6b3fac99f8637c0a1b3406ee5ba4d13c567a74 | JavaScript | ZuzaJak/kodovani-pro-deti | /src/Game/Game3/game3.jsx | UTF-8 | 2,675 | 2.53125 | 3 | [] | no_license | import React, { useState } from 'react';
import { Link } from 'react-router-dom';
import unicorn from '../../img/FIN_picture/position/fin_unicorn/unicorn_ballon.svg';
import './game3.css';
const Game3 = () => {
const [flex, setFlex] = useState('');
const [usedFlex, setUsedFlex] = useState({});
const drag = (eve... | true |
ec7731b4008353ed1396e2dbd0967f13dca38c54 | JavaScript | ThisWillGoWell/stock-simulator-frontend | /scripts/stocks.js | UTF-8 | 12,114 | 2.515625 | 3 | [] | no_license | var vm_stocks_tab;
function load_stocks_tab() {
// Vue for all stocks tab data
vm_stocks_tab = new Vue({
el: "#stocks--view",
data: {
sortBy: "ticker_id",
sortDesc: 1,
sortCols: ["ticker_id", "open_shares", "change", "current_price"],
sortDirections: [-1, -1, -1, -1],
reSort: ... | true |
d68803eae11136e65d6e81f3314e0b6f75c1ee5d | JavaScript | MichaelTSS/sweetwork-utils | /documents/feeds/instagram-feed.js | UTF-8 | 3,482 | 2.65625 | 3 | [] | no_license | 'use strict';
const md5 = require('blueimp-md5');
const _ = require('lodash');
class InstagramFeed {
/**
* constructor
*
* @param {Object} data
*/
constructor(data) {
if (data === undefined) throw Error('Missing data');
if (!_.isObject(data)) throw Error('Wrong type data')... | true |
c8d715d2c617dd87a9ba44429af2ae04d5b389e1 | JavaScript | DopamineDriven/ProjectOne | /script.js | UTF-8 | 3,537 | 2.90625 | 3 | [] | no_license | let day = $("#day")
let month = $("#month")
let dayValue = day.val()
let monthValue = month.val()
$(day).on("change", function(){
dayValue=this.value;
console.log(dayValue);
if (!isNaN(dayValue) && !isNaN(monthValue)) {
let sign=signFinder(dayValue, monthValue)
}
})
$(month).on("change", f... | true |
949c31110b3a947994551f9589f53fc489a1c05c | JavaScript | cyulin17/m1-321-code-solutions | /array-manipulation-3/src/equal.js | UTF-8 | 279 | 3.375 | 3 | [] | no_license | /* exported equal */
function equal(first, second) {
var flag = true;
if (first.length !== second.length) {
flag = false;
} else {
for (var i = 0; i < first.length; i++) {
if (first[i] !== second[i]) {
flag = false;
}
}
}
return flag;
}
| true |
c0c4aff878350fd2dc01bb7437527926b0f15d74 | JavaScript | altiusx/dice-website | /index.js | UTF-8 | 463 | 3.484375 | 3 | [] | no_license | function randomNum() {
return Math.floor(Math.random() * 6) + 1;
}
randomNumber1 = randomNum();
randomNumber2 = randomNum();
let image1 = "images/dice" + randomNumber1 + ".png";
let image2 = "images/dice" + randomNumber2 + ".png";
document.querySelector(".img1").setAttribute("src", image1);
document.querySelector(... | true |
739a6f82fd455709956d61c5bf12851f83b12bcb | JavaScript | thomas-ayissi/internet_monitor | /public/cache_thumbs.js | UTF-8 | 3,690 | 2.515625 | 3 | [] | no_license | $( function () {
if ( $( '#cacheThumbs' ).length ) {
var map = $( '#cacheThumbs' ).geomap( {
tilingScheme: null,
bboxMax: [-180, -85, 180, 85],
services: [
{
id: 'map-countries-service',
type: 'shingled',
src: ""
}
],
center: [ 0, 20 ],
... | true |
d6b5f7ff31d871da84974d3d151e97ba3645bf99 | JavaScript | AbdelliNasredine/masters_project | /SmartParkingSurvaillance/server/controllers/parking.controller.js | UTF-8 | 5,642 | 2.59375 | 3 | [] | no_license | const Parking = require("../models/parking.model");
const Reservation = require("../models/reservation.model");
const User = require("../models/user.model");
// ==> /admin/parking/create -> creating new parking
// ==> /admin/parking/{id}/view -> view Parking
// ==> /admin/parking/{id}/update -> update parking
// =... | true |
86224e84a64d99fa06f80b72532ab8511312c4d7 | JavaScript | spragati/helloworld | /Test/script.js | UTF-8 | 1,085 | 4.15625 | 4 | [] | no_license | // "use strict";
// var hasDriverLicense = false;
// var passTest = true;
// if (passTest) var ticket = (hasDriverLicense = true);
// console.log(ticket);
// //function declaration
// function processJuice(apples, strawbarry) {
// const juice = `i made a juice of ${apples} apples and ${strawbarry} straw... | true |
b89fcd74461d572e4aa73b3a3d20f39bd348e19b | JavaScript | Simmigon-flagg/movieMatcher | /API/api.js | UTF-8 | 4,154 | 3.0625 | 3 | [] | no_license |
// constructing a queryURL variable we will use instead of the literal string inside of the ajax method
var movieTitleRelease = [];
function searchDate(movie) {
var queryURL = "https://www.omdbapi.com/?s=" + movie + "&y=&plot=short&apikey=trilogy";
// Creating an AJAX call for the specific movie butto... | true |
a24b950a623632267748e7686416605097cb4dff | JavaScript | alka-si/ReacTest | /src/Containers/App.js | UTF-8 | 3,958 | 2.75 | 3 | [] | no_license | import React, { Component } from 'react';
import classes from './App.css';
import Persons from '../Components/Persons/Persons';
import Cockpit from '../Components/Cockpit/Cockpit';
import Aux from '../Hoc/Aux'
import withClass from '../Hoc/withClass';
import AuthContext from '../Context/auth-context';
// import Radium... | true |
ea7dc276cd203532b2ef92d8736d978b48fc8d17 | JavaScript | marioIncandeza/exercism | /javascript/luhn/luhn.js | UTF-8 | 1,244 | 3.53125 | 4 | [] | no_license | function Luhn(number){
this.checkDigit = checkd(number);
this.addends = doobler(number);
this.checksum = this.addends.reduce(function(prev,cur){
return cur + prev;
});
this.valid = (this.checksum%10 === 0);
}
function checkd(number){
var broken = number.toString().split("");
return Number(broken[broken.len... | true |
e3962f696ba37f2da2af73a5ce44bbed02579b0c | JavaScript | JeffersontelleSZ/Web-aprendizado | /jquery/scripts/script.js | UTF-8 | 279 | 2.609375 | 3 | [] | no_license | // Meus Scripts
$(document).ready(function() {});
// RECUPERANDO ATRIBUTOS
/*
console.log($("img").attr("src", "imagens/esfera_2.png"));
console.log(
$("div").attr("style", "background-color: blue; width: 200px; height: 200px")
);
*/
// RECUPERANDO CONTEUDO INTERNO DO HTML
| true |
591c7f48760ace721ac4f6c2babd64a7b10e585a | JavaScript | henry9779/JavaScript_pratice | /pastleo-js-lesson-async-fetch/07_async-restaurant/main.js | UTF-8 | 2,997 | 3.203125 | 3 | [] | no_license | const startTask = (orderDiv, name, ms, callback) => {
const stepP = document.createElement('p');
stepP.textContent = name;
orderDiv.appendChild(stepP);
if (callback && ms) {
setTimeout(() => {
callback();
}, ms);
}
}
const startTaskPromise = (orderDiv, name, ms) => {
... | true |
440755159b0744c5df0c48bc700e002d0217b1f6 | JavaScript | joaquinfq/vue-prop-sep | /index.js | UTF-8 | 2,900 | 2.875 | 3 | [] | no_license | /**
* Add `get`, `has`, `remove` and `set` methods to Vue componentes.
*/
const propSep = require('@jf/prop-sep');
module.exports = {
/**
* Instala el plugin.
*
* @param {Object} Vue Referencia de la clase Vue.
* @param {Object} options Opciones del plugin.
*/
install(Vue, option... | true |
fd0c44b6c1a45688829203b9eb6fa914325da6b7 | JavaScript | 1Fungi99/javascript | /dom/inject.js | UTF-8 | 874 | 3.171875 | 3 | [] | no_license | /*Exercise instructions : take the html code from the following CodePen : https://codepen.io/ayunas-the-scripter/pen/WNQgpqB,
and use JavaScript DOM manipulation to inject the html into the inject id element of inject.html
*/
let inject = (data) => {
document.getElementById("inject").innerHTML = data;
// docum... | true |
08522d3ce8254c439b91bdfdb1b5ae66c8137194 | JavaScript | notyes/sf_folder | /assets/js/google-script.js | UTF-8 | 5,722 | 2.515625 | 3 | [
"MIT"
] | permissive |
var map;
var marker;
var geocoder;
var initPos = new google.maps.LatLng(lat_bk, long_bk);
var initZoom = 6;
if(typeof(zoom) != "undefined" && zoom !== null) {
var initZoom = zoom;
}
var infowindowArray = [];
var markersArray = [];
var dataObjs = [{ lat: initPos.lat(), lng: initPos.lng(), img: '', desc: '', ... | true |
6b8787f0f765c963a62755be8477b42c7c43e482 | JavaScript | THyodo/FBTestProject | /testProject/assets/Scripts/FbMatchGame.js | UTF-8 | 12,235 | 2.90625 | 3 | [] | no_license |
cc.Class({
extends: cc.Component,
properties: {
},
// LIFE-CYCLE CALLBACKS:
onLoad() {
this.myPlayerID = null; // 自身のID取得
this.entryPointData = null; // エントリポイントデータ(対戦を申し込んだユーザー情報、スコア)
this.applyMath = false; // 対戦を申し込むフラグ
this.joinMath = false; // 対戦を受けるフラグ
... | true |
98e3ef44c907d91981e31a781e890f3ad4600c67 | JavaScript | sam15jain/snake_game | /snake.js | UTF-8 | 11,643 | 3.265625 | 3 | [] | no_license | /*
Author : Samyak Jain
Created on : 20 June 2020
*/
/// Theme class definition, this class stores the color scheme
class Theme {
constructor(background_color, canvas_color, snake_color, snake_head_color, food_image_src) {
this.background_color = background_color;
this.canvas_color = canvas_color;
this.snake_... | true |
b7a66e50fda0a1e9289f92b32824e12f9b98aa9b | JavaScript | VictorSheep/LeapZik | /src/utils.js | UTF-8 | 650 | 2.734375 | 3 | [] | no_license | import * as canvas from './canvas';
function coordTo2d(frame,leapPoint){
let iBox = frame.interactionBox;
let normalizedPoint = iBox.normalizePoint(leapPoint, true);
let x = normalizedPoint[0] * canvas.getWidth();
let y = (1 - normalizedPoint[1]) * canvas.getHeight();
return {x,y};
}
function drawCircle(ctx,c... | true |
285759af33cbf4de18d3f9fd6caa963c0f30e973 | JavaScript | kingebere/Bend-and-Select | /public/publicJavascript/addReview.js | UTF-8 | 2,370 | 3.015625 | 3 | [] | no_license | const reviewHandle = (elem) =>{
const prodId = document.querySelector('[name=productId]').value
const csrf = document.querySelector('[name=_csrf]').value
// select the element of input value that will be sent to backend
let formReviewValue = elem.parentNode.previousElementSibling
const elemReviewId = ... | true |
261e0cfad186d41f79d7a5e3855840ba8f7631ab | JavaScript | kendru/kadence | /test/RoutingTable.test.js | UTF-8 | 3,329 | 2.78125 | 3 | [] | no_license | const { expect } = require('chai');
const NodeID = require('../NodeID');
const KademliaNode = require('../KademliaNode');
const { Entry, Node } = require('../RoutingTable');
const { K } = require('../constants');
describe('RoutingTable', () => {
describe('Entry', () => {
it('should stringify an entry', (... | true |
34878c785f8547c654a63781e9d6312ba9a304bc | JavaScript | AlexisFabianCarranza/Rest-Socket-adapter | /helper/httpService.js | UTF-8 | 1,506 | 2.53125 | 3 | [] | no_license | const axios = require("axios");
const get = (url) => {
try {
return axios.get(url);
} catch (e) {
console.error(e);
}
};
const post = async (url, body, options) => {
try {
const res = await axios.post(url, body, options);
return res.data;
} catch (e) {
console.error(e);
const message... | true |
e3f8f3504c7f69d8e25dff65933133454ee8ca5e | JavaScript | fulkules/codewars-js | /kata-7/simple-fun-#74-growing-plant/index.test.js | UTF-8 | 416 | 2.765625 | 3 | [] | no_license | const growingPlant = require('./index');
describe(growingPlant, () => {
it('should return a number', () => {
expect(typeof growingPlant(100,10,910)).toBe('number');
});
it('should return the number of days it takes for the plant to reach the desired height', () => {
expect(growingPlant(100,... | true |
8dfed3fc426cc435aadb0adbc4a6accb203bc0b6 | JavaScript | bohma/FilmsApp-Node-Mongo-Http-Rest | /app.js | UTF-8 | 4,076 | 2.578125 | 3 | [] | no_license | const express = require("express");
const MongoClient = require("mongodb").MongoClient;
const objectId = require("mongodb").ObjectID;
const multer = require("multer");
const fs = require("fs");
const app = express();
const jsonParser = express.json();
const mongoClient = new MongoClient("mongodb://loc... | true |
6ff3e6896a9302e7b86d4173cb0e2f861ff2b803 | JavaScript | shaunak1488/WikiForum-1 | /client/src/redux/reducers/articleReducer.js | UTF-8 | 1,409 | 2.65625 | 3 | [] | no_license | import {getAllArticle} from '../../api/article'
import { LOAD_ARTICLES_LOADING, LOAD_ARTICLES_SUCCESS, LOAD_ARTICLES_ERROR } from '../actions/action-types';
//dummy data
// const initState =
// {
// articles: [
// // {id: '1', title: 'Article 1 from reducer', content:'1 nice little apple'},
// // ... | true |
ad6ad16c1155052681a2f2a8033c6be716c3f061 | JavaScript | DGerald12/Front-End-Practice3 | /script.js | UTF-8 | 2,176 | 2.78125 | 3 | [] | no_license | class Employee {
constructor(name, salary, hireDate) {
this.name = name;
this.salary = salary;
this.hireDate = hireDate;
}
getName() {
console.log(this.name);
}
getSalary() {
console.log(this.salary);
}
getHireDate() {
console.log(this.hireDate);
}
}
... | true |
42c76d49d8b3b9edcb8d0eaddfaa14d47734bc11 | JavaScript | venskou/codex-test-task | /src/components/paint/paint.component.jsx | UTF-8 | 8,606 | 3.171875 | 3 | [
"MIT"
] | permissive | import React, { Component } from 'react';
import Information from '../information/information.component';
import CommandLine from '../command-line/command-line.component';
import Artboard from '../artboard/artboard.component';
class Paint extends Component {
state = {
error: null,
paintCommands: [],
can... | true |
d064b5276cc1546fba8e88e58842eb8637a99459 | JavaScript | szefipetya/umlproject | /src/js/script.js | UTF-8 | 1,760 | 2.828125 | 3 | [] | no_license | let edit_box = document.querySelector(".edit-box");
let d_class = document.querySelector(".d-class");
edit_box.addEventListener("mousedown", click);
edit_box.addEventListener("mouseup", release);
edit_box.addEventListener("dragenter", dragEnter);
edit_box.addEventListener("onmousemove", move);
//edit_box.addEventListen... | true |
23ab144907370b392d258253b0c179c0e81ffc37 | JavaScript | gkjohnson/threejs-sandbox | /blue-noise-generation/src/BlueNoiseGenerator.js | UTF-8 | 3,173 | 3 | 3 | [
"MIT"
] | permissive | import { shuffleArray, fillWithOnes } from './utils.js';
import { BlueNoiseSamples } from './BlueNoiseSamples.js';
export class BlueNoiseGenerator {
constructor() {
this.random = Math.random;
this.sigma = 1.5;
this.size = 64;
this.majorityPointsRatio = 0.1;
this.samples = new BlueNoiseSamples( 1 );
thi... | true |
e049882c39d6c5f8b906b207ba6aaa2da4ee17e8 | JavaScript | stuartfulton/react-webpack-babel | /src/components/FrequencyDistribution.js | UTF-8 | 1,674 | 3.875 | 4 | [] | no_license | // This is the core of React. ReactDOM is not loaded here because we're not
// rendering to the DOM in this file.
import React from 'react';
// This simple React component has no internal state. It renders a series of
// divs displaying a character and listing how many times that character
// appears in the entered te... | true |
5384b20a9f1150f4ea6e0d52d96c9ca8a6398f21 | JavaScript | kaidouji85/janken | /janken.js | UTF-8 | 919 | 3.15625 | 3 | [] | no_license | function janken(){
var that = {};
that.ROCK = 1;
that.SCISSORS = 2;
that.PAPER = 3;
that.play = function(command){
var player1 = command.player1;
var player2 = command.player2;
var ret = null;
if(player1===that.ROCK && player2===that.SCISSORS) {
... | true |
d57dd922237ac222deafe9fcc189abe33570f3c0 | JavaScript | sweet-jh/my-react-app | /server/db.js | UTF-8 | 1,348 | 2.609375 | 3 | [] | no_license | const faker = require('faker');
const dateFormat = require('dateformat');
function generateInitData() {
let userInfo = {
"name": faker.name.findName(),
"picture": faker.image.avatar()
};
let properties = [];
for (let id = 0; id < 5; id++) {
properties.push({
"id": ... | true |
707a1c09b550ac1f87a6fdd6397ac9647ba3015b | JavaScript | PWhittle86/CodeclanHomework | /week11/day2/hw_tdd_jurassic_park_start/specs/park_spec.js | UTF-8 | 1,728 | 2.90625 | 3 | [] | no_license | const assert = require('assert');
const Park = require('../models/park.js');
const Dinosaur = require('../models/dinosaur.js');
describe('Park', function() {
beforeEach(function () {
park = new Park("Jurassic Park", 10);
stegosaurus = new Dinosaur("Stegosaurus", "Vegetarian", 10);
triceratops = new Dino... | true |
399924b42bfb00687e345ea1be987011d39e3c04 | JavaScript | davidrac/node-course-2-chat-app | /server/utils/users.test.js | UTF-8 | 1,956 | 2.859375 | 3 | [] | no_license | const expect = require('expect');
const { Users } = require('./users');
describe('Users', () => {
beforeEach(() => {
users = new Users();
users.users = [{
id: 1,
name: 'Mike',
room: 'Node course'
},{
id: 2,
name: 'Jen',
... | true |
21ad66d812453489fddb8562cabe01024ebf14f0 | JavaScript | anonymoucode/arboretum | /browser/js/chat.js | UTF-8 | 10,191 | 2.6875 | 3 | [] | no_license | class Chat {
get COMMANDS() {
return [{
name: 'clear',
description: 'Clear the chat window',
action: _.bind(this.clear, this)
}, {
name: 'title',
description: 'Set the title of the task (use ampersands before variable names, like *&var*)',
... | true |
077b384b6c74b549fcf5a12a643d6f082105ff92 | JavaScript | francescocambi/News | /src/main/resources/webapp/app/js/NewsRelevancesDatailsCtrl.js | UTF-8 | 1,938 | 2.59375 | 3 | [] | no_license | angular.module("NewsApp")
.controller("NewsRelevancesDetailsCtrl", function ($scope, $http, SERVER_URL, loadingSpinner, $routeParams) {
$scope.chartOptions = {
scaleShowGridLines: false,
pointDot: false,
pointDotRadius: 3,
pointHitDetectionRadius: 5,
... | true |
07110eb915ab9a5d2460ba3ecc8540574c4432d7 | JavaScript | vituenrique/CGT2 | /app/scripts/line.js | UTF-8 | 6,289 | 3.3125 | 3 | [] | no_license | function Line (startPt, endPt){
this.startPt = startPt;
this.endPt = endPt;
this.color = getColor();
this.ID = "LINE";
}
Line.prototype.draw = function(context, dashed = false){
context.beginPath();
context.moveTo(this.startPt.x,this.startPt.y);
context.lineTo(this.endPt.x,this.endPt.y);
context.strokeStyle = ... | true |
96987a156927254f16c6bf0b33dbac1dfdde9c2c | JavaScript | aculver28/alfred | /src/app/js/stores/TemplateStore.js | UTF-8 | 1,541 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | /*
* Copyright 2018 CapTech Ventures, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or... | true |
05872f45bce439e29d0608f7073f6fa96a8f22f4 | JavaScript | Tucknologies1/neothinc | /src/Pages/CareerForm.js | UTF-8 | 3,289 | 2.78125 | 3 | [] | no_license | import React, { Component } from 'react';
import { Modal, Form} from 'semantic-ui-react';
class CareerForm extends React.Component {
constructor(props) {
super(props)
this.state = {
id: null,
jobTitle: ' ',
jobDesc: ' ',
jobLocation: ' ',
J... | true |
bf89fcc5dcc66a23bd47580135f37d20517216b8 | JavaScript | ZamurVedovatto/rentacar-mean | /models/fornecedorModel.js | UTF-8 | 1,039 | 2.515625 | 3 | [
"MIT"
] | permissive | const mongoose = require('mongoose');
//usado para Seguradora e Oficina Mecânica
const fornecedorSchema = new mongoose.Schema( {
tipo: { type: String, required: true},
nomeFantasia: { type: String, required: true },
email: { type: String, required: true },
endereco: {
logradouro: String,
... | true |
52ae0db0e7f97146d7a0ade29e16890f6418bfe6 | JavaScript | gongyuh/InterviewQuestions | /8.9/和为S的连续正整数序列.js | UTF-8 | 1,120 | 3.234375 | 3 | [] | no_license | function FindContinuousSequence(sum) {
let child = [1, 2];
let res = [];
let curSum = 3;
let small = 1;
let big = 2;
while (big < sum) {
while (curSum < sum && big < sum) {
child.push(++big);
curSum += big;
}
while (curSum > sum && small < big) {
child.shift();
... | true |