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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
f4b01db04588b46658c2a9fcec3b4c9694c86778 | JavaScript | sabrina2712/04-node-project-stats-cli-sabrina2712 | /project-status/source/cli.js | UTF-8 | 233 | 2.859375 | 3 | [] | no_license |
#!/usr/bin/env node
let fs = require("fs");
fs.readFile("bears.txt", function(err, data) {
console.log(data);
// let bears = data.toString().split("\n");
// let bear = bears[Math.floor(Math.random() * bears.length)];
});
| true |
f0513a1539bb9678359f4f6e6734cf14ed91d8ab | JavaScript | dal01/curso_node | /2_FUNDAMENTOS/5_modulos_externos/index.js | UTF-8 | 231 | 3.078125 | 3 | [] | no_license | // --nome=Matheus --idade=30
const minimist = require("minimist");
const args = minimist(process.argv.slice(2));
console.log(args);
const nome = args["nome"];
const idade = args["idade"];
console.log(nome);
console.log(idade);
| true |
0b7bdd1f9a1060bbff82cb3b588a8bd57531e442 | JavaScript | biud436/weather | /js/ChartComponent.js | UTF-8 | 7,393 | 2.921875 | 3 | [] | no_license | import {
Component
} from "./Component.js";
/**
* @author Uh jinseok
*/
class ChartComponent extends Component {
/**
*
* @param {App} app
*/
constructor(app) {
super(app);
}
initMembers() {
super.initMembers();
this._backgroundPositionX = 0;
this... | true |
f6f3bc57dc146e103fbe0e07129ad8be39426861 | JavaScript | sebascarreram/30DaysOfJavaScript | /day06/Exercise_lvl-3.js | UTF-8 | 4,691 | 3.859375 | 4 | [] | no_license | const { countries } = require("./countries");
const { webTechs } = require("./web_techs");
const { mernStack } = require("./mernStack");
const { fullCountries } = require("./fullCountries");
console.log("~~~~~~~~~~~~");
// Question 1
// Copy countries array(Avoid mutation)
//
const copyCountry = [...countries];
conso... | true |
89a434a228e7b989bc80b162535253ce4abc80f2 | JavaScript | mikeulvila/enm-movie-history | /javascripts/search-all.js | UTF-8 | 2,158 | 2.6875 | 3 | [] | no_license | define(function(require) {
var $ = require("jquery");
var Q = require("q");
var _ = require("lodash");
var firebase = require("firebase");
var searchMyMovies = require("search-my-movies");
var getmoviedata = require("get-movie-data");
var getposter = require("get-movie-poster-data");
var filterSearch = require(... | true |
0d600a14224ef9e8a320a1cecb40c291d6535a7c | JavaScript | Shadytreez/arcade-site | /src/Components/Game/Game.js | UTF-8 | 7,071 | 2.796875 | 3 | [] | no_license | import React, { Component } from "react";
import Hand from "./Hand";
import DealersHand from "./DealersHand";
import cards from "../../assets/cards";
import { Redirect } from 'react-router-dom';
class Game extends Component {
state = {
redirect: null,
deck: [...cards],
playerCards: [],
dealerCards: []... | true |
33d1e53235abd1c21ba2c0241bc3b2f86034cec6 | JavaScript | steven-isbell/dm12-full-demo | /src/ducks/productReducer.js | UTF-8 | 1,348 | 2.921875 | 3 | [] | no_license | // A REDUCER FOR JUST PRODUCTS
// normally I would break cart out into it's own reducer as well
import axios from "axios";
const GET_PRODUCTS = "GET_PRODUCTS";
const ADD_TO_CART = "ADD_TO_CART";
export function getProducts() {
return {
type: GET_PRODUCTS,
payload: axios
.get("/api/products")
.t... | true |
7a40b8bf893dfcceb6a5fb1a3962accc88e4b18b | JavaScript | bjgrosse/mern-blog | /client/src/util/DeferredPromise.js | UTF-8 | 469 | 3.40625 | 3 | [] | no_license | /**
* Class for easily creating a promise for use with
* callback code.
*
* Usage:
*
* let deferred = new DeferredPromise():
* someWorkWithCallback(
* result => deferred.resolve(result),
* err => deferred.reject(err)
* )
*
* return deferred.promise;
*/
class DeferredPromise {
constructor() {
this.p... | true |
d6a68fbc7d1ccdcfbc952ab166aac1f019ede20b | JavaScript | eagleweb/moviestore | /public/app/main/main.controller.js | UTF-8 | 689 | 2.515625 | 3 | [] | no_license | angular
.module('movie-store')
.controller('MainController', [ function (){
var vm = this;
var slideIndex = 1;
vm.plusSlides = function (n) {
vm.showSlides(slideIndex += n);
};
vm.showSlides = function (n) {
var i;
var slides = docume... | true |
97353a0130a1cc8f6a328c137e2c13c96973247e | JavaScript | nagyist/phaser3-examples | /public/src/input/dragging/drag vertically.js | UTF-8 | 1,344 | 2.734375 | 3 | [
"MIT"
] | permissive | class Example extends Phaser.Scene
{
constructor()
{
super();
}
preload ()
{
this.load.image('bg', 'assets/skies/gradient8.png');
this.load.atlas('blocks', 'assets/sprites/blocks.png', 'assets/sprites/blocks.json');
}
create ()
{
this.add.image(400, 300,... | true |
8b6c60350509db9fc27040d28f650dfbf3b96d06 | JavaScript | lazygagaliu/Keep-Learning | /snake/src/view.js | UTF-8 | 401 | 2.671875 | 3 | [] | no_license | import Snake from "./snake.js";
class View {
constructor(){
this.canvas = document.querySelector("canvas");
this.ctx = this.canvas.getContext("2d");
this.score = document.querySelector("#score");
this.highestScore = document.querySelector("#highestScore");
this.snake = new Snake(this);
this... | true |
78659dc32fdac2a3507267d92298df522c8b4401 | JavaScript | Not-A-Chatbot/Dot-or-Alive | /script.js | UTF-8 | 3,836 | 3.359375 | 3 | [] | no_license | /***** CLASS *****/
class Dot {
constructor(color, value, speed, column, row, HTML) {
this.color = color;
this.points = value;
this.speed = speed;
this.column = column;
this.row = row;
this.HTML = HTML;
this.interval = null;
}
dotMove() {
this.interval = setInterval(() => {
... | true |
29cfbca34cc28926aa04bdad0597eb6037991b19 | JavaScript | marcsfel/exercicios-js-udemy | /2.js | UTF-8 | 320 | 3.5 | 4 | [] | no_license | function verificarTriangulo(lado1, lado2, lado3) {
if (lado1 == lado2 && lado2 == lado3)
console.log('Triangulo Equilรกtero')
else if (lado1 == lado2 || lado2 == lado3 || lado1 == lado3)
console.log('Triangulo Isรณsceles')
else console.log('Triangulo Escaleno')
}
verificarTriangulo(2, 3, 2) | true |
c7a2e35a8df57e75e416a8b1db3627a34faa645b | JavaScript | husainkhambaty/taskmanager | /lib/db.js | UTF-8 | 1,291 | 2.578125 | 3 | [] | no_license | /* db.js */
// Load the require libraries // TODO: Make this more generic so that we can load the libraries according to the type of DB
const mongoose = require('mongoose');
var rootPath = global.rootPath;
// Setup the promise
mongoose.Promise = global.Promise;
module.exports = {
// TODO : Setup the creds later. ... | true |
75f06e2215fcf0eda8b73787fe1e3388e171d70e | JavaScript | pedrodevoto/millarville | /admin/media/js/messages_es.js | UTF-8 | 1,101 | 2.796875 | 3 | [] | no_license | /*
* Translated default messages for the jQuery validation plugin.
* Locale: ES
*/
jQuery.extend(jQuery.validator.messages, {
required: "Este campo es obligatorio.",
remote: "Complete este campo.",
email: "Ingrese una direcciรณn de e-mail vรกlida.",
url: "Ingrese una URL vรกlida.",
date: "Ingrese una... | true |
b470a9337d5d849fbc90761a8135fc63bfe4641b | JavaScript | eladiojunior/hooks-react | /src/views/examples/UseEffect.jsx | UTF-8 | 2,622 | 3.125 | 3 | [] | no_license | import React, {useState, useEffect} from 'react'
import PageTitle from '../../components/layout/PageTitle'
import SectionTitle from "../../components/layout/SectionTitle";
function calcularFatorial(n) {
const numero = parseInt(n);
if (numero < 0) return -1;
if (numero === 0) return 1;
return calcularFa... | true |
d0dd75f5714a9c0fc3280c3cf65ecb665dee9213 | JavaScript | alaanescobedo/Projects-React | /react-bases/src/components/HooksScroll.js | UTF-8 | 756 | 2.625 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
export default function HooksScroll() {
const [scrollY, setscrollY] = useState(0);
useEffect(() => {
// console.log("ComponentDidUnmount - Fase de montaje");
}, []);
useEffect(() => {
// console.log("ComponentDidMount - Fase de actualizacion");
... | true |
ad42250d587b49cea8ba9ba69fb33b6681748830 | JavaScript | kim-n/Compiled-Works | /w6d1(1)/w6d1/constructors.js | UTF-8 | 554 | 4.15625 | 4 | [] | no_license | function Cat(name, owner) {
this.name = name;
this.owner = owner;
};
// Cat.prototype.cuteStatement = function () {
// return this.owner + " loves " + this.name;
// }
Cat.prototype.cuteStatement = function () {
return "everyone loves " + this.name
}
Cat.prototype.meow = function () {
return "meow"
}
var ka... | true |
ea9eac84a9220ca7efb4b7c9e7d7f1628ff215fb | JavaScript | arjunasuresh3/training | /static/js/ajax.js | UTF-8 | 2,625 | 2.828125 | 3 | [] | no_license | function ajaxhtml(obj) {
var xmlhttp;
if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
}
else {// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState==4 && x... | true |
3449e23eea5c44acb58a05ec057e131b68a44ca1 | JavaScript | sipsorcery/skillshistory | /skillshistorydata.js | UTF-8 | 46,097 | 2.578125 | 3 | [
"BSD-3-Clause"
] | permissive | /*
INSTALL: If you are using this data for your own site or profile make sure to change set you own data.
The objects below can be used as a starting point. Delete the original data and start from these.
const headerBlockData = {
description: "Your Description",
linkedinprofile: "Your Linkedin Profile... | true |
ef16c6c26cb8acd8b57b1d657c5b0cb82bff9739 | JavaScript | ebalder/frontend-dev-assignment | /build/lib/MathJax/extensions/TeX/mhchem.js | UTF-8 | 7,360 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | /*
* /MathJax/extensions/TeX/mhchem.js
*
* Copyright (c) 2009-2015 The MathJax Consortium
*
* 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... | true |
d83514a5c9ad068940d70ee5fe3f01e296bac5b8 | JavaScript | HoussineYoussef/ayraunemane | /bonus.js | UTF-8 | 2,287 | 2.90625 | 3 | [] | no_license | class bonus {
constructor(type, ctx) {
this.x = Math.floor(Math.random() * 900);
this.y = Math.floor(Math.random() * 400);
this.type = Math.floor(Math.random() * 5);
this.ctx = ctx;
this.bomb = new Image();
this.bomb.src = 'ressource/img/radioactive.png';
t... | true |
639ee2143eb3a81df8dd1d120e5763003a3e0efb | JavaScript | OlegBrazhnichenko/full-stack-dev | /pset2/task5/script.js | UTF-8 | 745 | 4.03125 | 4 | [] | no_license | window.onload = function(){
var age = document.getElementById("age");
age.addEventListener('input',function(event){
display_output(format_age(event.target.value));
})
};
function format_age(age){
var str;
if(age >= 10 && age <= 20 ){
str = "ะปะตั";
}else{
switch (age % 10)... | true |
f6799319906351aa94277c0dae66017446bfdef1 | JavaScript | anderfernandes/ITSE2402 | /circle/circle.js | UTF-8 | 365 | 3.40625 | 3 | [] | no_license | ๏ปฟfunction Circle(r) {
this.radius = r;
this.getArea = getA;
this.getPerimeter = getP;
this.getData = getD;
}
function getA() {
return this.radius * this.radius * Math.PI;
}
function getP() {
return 2 * this.radius * Math.PI;
}
function getD() {
return 'Area: ' + this.getArea() + '<br />Pe... | true |
76503517d42f58c44c72bf8550a94616686ce394 | JavaScript | menor/dbc_oo_dice | /source/js-refactor-to-oo/application.js | UTF-8 | 519 | 3.5 | 4 | [] | no_license | $(document).ready(function() {
$('#roller button.add').on('click', function(){ createDie(); });
$('#roller button.roll').on('click', function(){ rollDice(); });
});
function Die() {
this.value = 0;
this.template = "<div class='die'>" + this.value + "</div>";
this.roll = function(){
return Math.floor((Ma... | true |
14435bd1c77844f9d59ab2b958a7ecb399a85178 | JavaScript | banerjeesouvik/React-Chat-App | /src/components/Chat/index.js | UTF-8 | 3,300 | 2.65625 | 3 | [] | no_license | import React, { Component } from "react";
// import socket from "./socketConnection";
import "./style.css";
import Host from '../../config'
class Chat extends Component {
constructor(props) {
super(props);
this.state = {
user: this.props.user,
messages: [],
sender: "",
isTyping: fals... | true |
f635f0187ecbb9f1cf6717748e6b3ed2a8f11227 | JavaScript | ChengYurou/tw-homework-sanpshot | /src/get-sanpshot.js | UTF-8 | 4,589 | 3.265625 | 3 | [] | no_license | 'use strict';
function getSnapshot(historyData, id) {
const arrayData = splitHistoryData(historyData);
const verifyResult = verifyData(arrayData);
if (typeof verifyResult === 'string') {
console.log(verifyResult);
return;
}
const processedData = convertDataLayout(verifyResult);
... | true |
95d590e823bfa5ba879a840a1cc4e70c4145b96e | JavaScript | stevenyeo99/AIA_Frontend_Test | /index.js | UTF-8 | 4,082 | 2.640625 | 3 | [] | no_license | $(document).ready(function() {
consumeEventTrigger();
storeEventTrigger();
cleanEventTrigger();
$('#btnPull').click();
});
function cleanEventTrigger() {
$('#btnClean').click(function() {
var api_url = "http://localhost:8080/clean";
var id = null;
var ids = null;
... | true |
7dc8b6d1969829ff89a0bd558e68eb0c1d6a3604 | JavaScript | adityapanwar/bookAPI-p | /API/Book/index.js | UTF-8 | 5,211 | 2.84375 | 3 | [] | no_license | //Initialising Express Router
const Router = require("express").Router();
//Database Models
const BookModel = require("../../database/books");
/*
Route /book/
Description get all books
Access PUBLIC
Parameters NONE
Method GET
*/
Router.get("/", async (req,res) => {
const getA... | true |
f67aa4a8469c11cf03717f5168aee20cb12e6fc0 | JavaScript | ufjf-dcc104/dcc104-canvas-exr03-luidgisarto | /sprite.js | UTF-8 | 1,166 | 3.203125 | 3 | [] | no_license | function Sprite(x, y, w, h, cor, imgkey) {
this.x = x;
this.y = y;
this.width = w;
this.height = h;
this.vx = 0;
this.vy = 0;
this.imgkey = imgkey;
this.color = cor;
this.g = 0;
this.checked = false;
}
Sprite.prototype.desenhar = function (ctx, img) {
ctx.fillStyle = this.co... | true |
14d1acc3afedad8f777088b65471e9eeb6834f70 | JavaScript | LubeckFRP/lubeck | /lubeck-drawing/jsbits/fast-renderer.js | UTF-8 | 56,887 | 3.046875 | 3 | [
"MIT"
] | permissive |
/*
A renderer wraps a Canvas API drawing context which may render to an on-screen canvas or an
off-screen buffer.
Create a renderer using createRenderer(canvasApiContext).
Each renderer renders drawings, which are immutable trees (i.e. other primitive shapes
or branches referencing other drawings)
Each ... | true |
4a15b25467fbcf0f357f6ba822712fe3b8635bfd | JavaScript | ianthekirkland/html-element-attributes | /test.js | UTF-8 | 1,158 | 2.8125 | 3 | [
"MIT"
] | permissive | 'use strict';
/* Dependencies. */
var assert = require('assert');
var test = require('tape');
var htmlElementAttributes = require('./');
/* Tests. */
test('htmlElementAttributes', function (t) {
t.equal(
typeof htmlElementAttributes,
'object',
'should be an `object`'
);
t.doesNotThrow(
function... | true |
d5296f3a1fda905ff26ed56a1ed1a03068dde8ef | JavaScript | tavisca-dbhavsar/new_javascript | /bouncing_multi_ balls/ballscript.js | UTF-8 | 1,184 | 3.265625 | 3 | [] | no_license |
var Globalball;
var dx = 5;
var dy = 5;
window.onload=function(){
var btnNew = document.getElementById("btnAdd");
btnNew.addEventListener('click',buttonClick);
}
var buttonClick = function() {
Globalball = new Ball(0,window.innerHeight/2,5,5);
setInterval(Globalball.move,10);
}
var Ball = function(x,y,dx,dy){
var... | true |
cc2a8f33e3324c6d5c28a325a84d739c98a9bb9c | JavaScript | ValentinSteiner/bug-successive-http-requests | /client.js | UTF-8 | 897 | 2.875 | 3 | [] | no_license | const myreq = require("./myreq.js");
let client;
let conn_counter = 0;
const URL = "http://localhost:7070";
function connect_inner() {
myreq.get(URL, (response, rawBody) => {
console.log("2nd HTTP request: " + response.statusCode);
});
}
function connect() {
myreq.get(URL, (response, rawBody) => ... | true |
f8aad5fb95c4e287aafe45dd4bc97b8b0f1af049 | JavaScript | Muddabirchohan/mocha-tests | /test.js | UTF-8 | 1,437 | 3.515625 | 4 | [] | no_license | // Require the built in 'assertion' library
var assert = require('assert');
// Create a test suite (group) called Math
describe('Math', function() {
// Test One: A string explanation of what we're testing
// Test Two: A string explanation of what we're testing
it('should test if (3-4)*8 = -8', function(){
... | true |
acc8bc3505cf1853198951b4e06c16338afac56c | JavaScript | SprengerV/b00kzearch | /client/src/components/book/index.js | UTF-8 | 3,931 | 2.515625 | 3 | [
"BSD-3-Clause"
] | permissive | import React, { useEffect, useState } from 'react';
import { Container, Row, Col, Card, ListGroup, Button } from 'react-bootstrap';
import API from '../../controllers/api';
import './book.css';
const { saveBook, delBook } = API;
const Book = (props) => {
const [book, setBook] = useState({});
useEffect(() => {
... | true |
5bd367e59718fd94b16a27833fa6553be27ecea9 | JavaScript | imclab/demos | /bullrun/javascripts/TrackNode.js | UTF-8 | 531 | 2.71875 | 3 | [
"MIT"
] | permissive | TrackNode = function( veroldApp ) {
this.veroldApp = veroldApp;
}
TrackNode.prototype = {
constructor: TrackNode,
initialize : function( model ) {
var that = this;
//Bind to main update loop
that.veroldApp.on("update", that.update, that );
this.model = model;
},
uninitialize : functi... | true |
40a9c0be197ef4c5f2035e602e3673e9a8c6937b | JavaScript | schahriar/Galleon | /bin/tasks/_questionnaire.js | UTF-8 | 5,834 | 2.703125 | 3 | [
"MIT",
"X11-distribute-modifications-variant"
] | permissive | "use strict";
var inquirer = require('inquirer');
var fs = require('fs');
var path = require('path');
function validateDirectory(input) {
var done = this.async();
fs.access(path.resolve(input), fs.R_OK | fs.W_OK, function (err) {
done(err ? 'NO ACCESS! USE ABSOLUTE PATHS OR CORRECT FILE PERMISSIONS' : true);... | true |
9b9ca906863eef831cf6ab8ec251f2f7b8502e75 | JavaScript | tlcrow/Algorithms | /Fundamentals/SoaringIQ.js | UTF-8 | 529 | 3.796875 | 4 | [] | no_license | //Bogdan, entered with a modest IQ of 101. Let's say that during a 14-week bootcamp, his IQ rose by .01 on the first day then went up by an additional .02 on the second day, then up by .03 more on the third day, etc... all the way until increasing by .98 on this 98th day (the end of 14 full weeks). what is Bogdan's fi... | true |
da7f00ca4558dd6f78e1e36709b6749e5ed9aaec | JavaScript | rohanbatra24/Data-Structures_Algorithms | /arrayIntro.js | UTF-8 | 375 | 4.34375 | 4 | [] | no_license | const strings = [ 'a', 'b', 'c', 'd' ];
// 4*4 = 16 bytes of storage
//access
strings[2]; // O(1)
//METHODS
// push
strings.push('e'); // O(1)
// pop
strings.pop(); // O(1)
//unshift - add item to beginning
strings.unshift('x'); // O(n) because need to iterate over each element and move the indices
//splice - add ... | true |
133cd37644ba86b1905b08c41ad84f003ce1449a | JavaScript | jalapeno-business/suggestions | /client/src/index.jsx | UTF-8 | 1,043 | 2.59375 | 3 | [] | no_license | /* global document */
import React from 'react';
import ReactDOM from 'react-dom';
import axios from 'axios';
import SuggestionsContainer from './components/SuggestionsContainer';
import "./index.css";
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
restaurant: n... | true |
e57cc91c7f4c512c7159f026fdf13f58f1f318b9 | JavaScript | arsonite/webgfx | /beuth/a2/util.js | UTF-8 | 2,618 | 3.3125 | 3 | [] | no_license | /*
* Loose collection of helper functions
*/
let util = {};
// handy shortcut
util.byid = function(id) {
return document.getElementById(id);
};
let _logLevel = 0;
util.setLogLevel = function(level) {
_logLevel = level;
};
util.log = function(msg) {
if (_logLevel <= 0) console.log(`%c${msg}`, 'color: grey');
};
... | true |
fe5f449054b53a283c4b79cd38903d24d3cdbdae | JavaScript | jupardev97/pasarelaAntonella | /public/js/trabajadores/listarTabla.js | UTF-8 | 8,628 | 2.546875 | 3 | [
"MIT"
] | permissive | function listarTabla(objeto, metodo, idTabla) {
var consulta = {
object: objeto,
process: metodo
};
ajax = new ajaxObject(consulta);
ajax.prepareCall().done(function (result) {
var object = JSON.parse(result);
if (object.status == 'complete') {
crearTabla(id... | true |
7d89ea0ea207f3a105428cbdd817ffaf16d98a93 | JavaScript | jedidas/Code-test | /public/js/AppRender.js | UTF-8 | 2,413 | 2.828125 | 3 | [] | no_license | class AppRender {
form;
input;
data;
init(formNode, data) {
this.data = data;
this.form = $(formNode);
this.input = this.form.find('[name="email"]');
this.validateResponse();
}
showMessage(cssClass, message) {
this.input.addClass(cssClass);
this... | true |
20c3ea62c03f2f68f150e2041b30c142e96a817c | JavaScript | hldxlx/es6 | /src/js/promise1.js | UTF-8 | 1,892 | 3.78125 | 4 | [] | no_license | // function asyncFun(a,b,cb){
// setTimeout(function(){
// cb(a + b)
// },200)
// }
// asyncFun(1,2,function(result){
// console.log(result);
// });
// console.log('gg');
// function asyncFun(a,b,cb){
// setTimeout(function(){
// cb(a + b)
// },2000)
// }
// //ๅคๅฑๆถ่ฟๆ ทไธไผ้
๏ผ่ฟไนๆฏpromise... | true |
69483571d8e63fb9e9bddd3efac4038482144296 | JavaScript | yoliskdeveloper/simple_star_rating | /main.js | UTF-8 | 1,645 | 3.75 | 4 | [] | no_license | // Initial Ratings
const ratings = {
sony: 0,
samsung: 0,
vizio: 0,
panasonic: 0,
phillips: 0
}
// Define Total Stars
const starsTotal = 5;
// Run getRating when DOM Loads
document.addEventListener('DOMContentLoaded', getRatings());
// Form Element
const productSelect = document.getElementById('... | true |
cad233197b7e25a77ec9a2861ebf997d6661f703 | JavaScript | CamdenKo/FS03-Sorting | /mergesort.js | UTF-8 | 724 | 3.59375 | 4 | [] | no_license | var split = function(wholeArray){
if(wholeArray.length > 1)
{
var half = Math.ceil(wholeArray.length /2)
return[wholeArray.slice(0,half),wholeArray.slice(half)]
}
return
}
var merge = function(leftArr,rightArr)
{
var out = []
var leftVal
var rightVal
while(leftArr.length && rightArr.length)
{... | true |
5ae015da952e218080d70644037d864f2cde029d | JavaScript | BoiseCodeWorks/spring18-swapi | /app/dragon-controller.js | UTF-8 | 1,405 | 3.140625 | 3 | [] | no_license | function DragonController() {
//private parts
var ds = new DragonService()
function drawGames(games) {
var template = ''
//itterate over obj not array....
for (var id in games) {
var game = games[id]
template += `<div>
<button onclick="app.controllers.dragonController.setActiveGa... | true |
9a1516d8c11da079b1540378a816d58399991f1a | JavaScript | Julian-Calle/taskMaker | /front/src/shared/context/authContext.js | UTF-8 | 1,564 | 2.578125 | 3 | [] | no_license | import React from 'react';
import decodeTokenData from '../utils/decodeTokenData.js';
import { useState } from 'react';
import { login } from '../../https/users';
import { useHistory } from 'react-router-dom';
// 1 Creamos el contexto y exportamos para usar en el hook
export const AuthContext = React.createContext();
c... | true |
97098312177aff6468c08c6e9286e261bae8d9c7 | JavaScript | SeanJM/blush | /src/common/rgbToHex.js | UTF-8 | 158 | 2.640625 | 3 | [] | no_license | function p(n) {
n = n.toString(16);
return n.length === 2 ? n : 0 + n;
}
export default function rgbToHex(r, g, b) {
return "#" + p(r) + p(g) + p(b);
} | true |
6da6406da1129d65b5ebb8898b068ad3bc1e6f6c | JavaScript | abhinavmish96/JAVASCRIPT_BY_EXAMPLE | /loops.js | UTF-8 | 682 | 4 | 4 | [
"MIT"
] | permissive | // Standard for loop
// Do this thing 10 times
for (var i = 0; i < 10; i++) {
console.log(i)
}
// for/in loop
// Used to loop through objects
const friends = {'name': 'Matt', 'name':'Cody', 'name':'Anthony'}
for (friendName in friends) {
console.log(friendName)
}
// ES6 for/of
// Used to l... | true |
19a38bcdf714f49e6e1ff920bc7c112a2665ed22 | JavaScript | cn-panda/JavaCodeAudit | /ใ03ใXSS ๆผๆดๅ็ไธๅฎ้
ๆกไพไป็ป/jeesns-v1.3/jeesns-web/target/jeesns-web/res/plugins/emoji/js/emojis.js | UTF-8 | 4,254 | 2.5625 | 3 | [
"MIT"
] | permissive | (function($) {
var basePath;
var jsonData;
var emojiPath;
var defaults = {
category: ['EmojiCategory-People', 'EmojiCategory-Nature', 'EmojiCategory-Objects', 'EmojiCategory-Places','EmojiCategory-Symbols'],
showbar: true,
trigger: 'click',
insertAfter: function() {}
... | true |
323569f99905605111ca370bdaec92dd45e7b05e | JavaScript | RishiB064/AngryBird_Day5 | /Box.js | UTF-8 | 202 | 2.546875 | 3 | [] | no_license | // give the parent class
class Box extends BaseClass
{
constructor(x,y,width,height)
{
super(x,y,width,height);
// load an image to the box
this.image = loadImage("sprites/wood1.png");
}
}
| true |
87e42848d052ef50291ef8db9bba699b7c217dd7 | JavaScript | katrinkajb/lab-03b-calculator-refactor | /utils.js | UTF-8 | 388 | 3.078125 | 3 | [] | no_license |
export function getAdd(firstNumber, secondNumber) {
return firstNumber + secondNumber;
}
export function getSubtract(firstNumber, secondNumber) {
return firstNumber - secondNumber;
}
export function getMultiply(firstNumber, secondNumber) {
return firstNumber * secondNumber;
}
export function getDivide(f... | true |
d055cc728f955e17ee4f026eb56e5ee1721ec089 | JavaScript | sparksmb/todo-app-classic | /lib/storage/web-storage.js | UTF-8 | 1,684 | 2.8125 | 3 | [] | no_license | /*global app */
app.entity.webStorage = {
create: function () {
'use strict';
var webStorage;
function init() {
if (typeof (Storage) !== "undefined") {
return webStorage;
} else {
throw 'Sorry! No Web Storage support..';
}
}
function throwInvalidStorageOperation() {
throw 'Storage o... | true |
e27af67691a76af24f843d52fc0213a05da7a02b | JavaScript | jackietrillo/Training | /JavaScript/QuoteManager/js/quotes.js | UTF-8 | 3,447 | 3.46875 | 3 | [] | no_license | /* Connor Cheng
ccheng71@my.smccd.edu
CIS 114 OL
quotes.js
Midterm
October 4
*/
// quotes.js
// This script manages a quote list.
// This function does all the work.
// It is immediately-invoked.
(function(){
'use strict';
// Variable that stores the tasks:
var quotes = [];
// Function called when the form is... | true |
e2cfc41a6da73009ba84d3f4e8907f0d02db6abb | JavaScript | nta-leader/bookshop | /public/templates/book/js/cart.js | UTF-8 | 298 | 2.5625 | 3 | [] | no_license | document.addEventListener("DOMContentLoaded",function(){
let addProduct = document.getElementById('add-product');
addProduct.onclick = function(){
let quantity = document.getElementById('quantity').value;
let id_produc = this.getAttribute('data-id_product');
}
},false); | true |
e804b3f64b8c85803dd62b7dd91b508e85e0315b | JavaScript | julienshim/flappy-bird | /sketch.js | UTF-8 | 1,369 | 3.265625 | 3 | [] | no_license | let bird;
let pipes = [];
let score = 0;
let maxScore = 0;
let isGameOver = false;
// maxScore Local Storage
if (localStorage.getItem('maxScore') === null) {
maxScore = 0;
localStorage.setItem('maxScore', 0);
} else {
maxScore = parseInt(localStorage.getItem('maxScore'), 10);
}
function setup() {
createCanvas... | true |
d6257e85f4050576957b6136e8169171af7168ad | JavaScript | huyue2255/javascript-lc | /_222_CountCompleteTreeNodes.js | UTF-8 | 1,807 | 4.1875 | 4 | [] | no_license | /**
* Definition for a binary tree node.
* function TreeNode(val, left, right) {
* this.val = (val===undefined ? 0 : val)
* this.left = (left===undefined ? null : left)
* this.right = (right===undefined ? null : right)
* }
*/
/**
* 222. Count Complete Tree Nodes
* Given a complete binary tree, coun... | true |
df522c5a0814296eb42b5e59f9ab5a7b75ca1748 | JavaScript | abhishekgahlot/intervaltree | /intervaltree.js | UTF-8 | 7,034 | 3.140625 | 3 | [] | no_license | function ConstructIntervalTree(I) {
if (I.length == 0) {
return new IntervalTree();
}
}
function objectCompare (a, b) {
if (a.start < b.start) {
return -1;
} else if (a.start == b.start) {
if (a.end < b.end) {
return -1;
} else {
return 1;
... | true |
16b4c1173a3997a092c197e63a8312ee38a0a8cf | JavaScript | dotnet-foundation/website | /input/js/home.js | UTF-8 | 7,488 | 2.625 | 3 | [
"MIT"
] | permissive |
$(document).ready(function () {
var presetEvents = document.getElementById('PresetVirtualEvents');
let eventsListItem = (event) => (
`<div class="latest_container latest_container--event">
<div class="latest_date d-flex align-items-center justify-content-center text-center"><p style="color... | true |
e5c0cc9c1c0a140879b6aa6e5977f658a9fd16b3 | JavaScript | Substancman/chrome-exts | /odjaaghiehpobimgdjjfofmablbaleem/1.5.0_0/js/plugin_system/js/interfaces.js | UTF-8 | 2,730 | 3.203125 | 3 | [
"MIT"
] | permissive | /**
* This file contains a collection of functions useful for determining whether
* a method is part of an interface or whether a class implements an interface.
*/
var InterfaceUtils = {};
/*
EXAMPLE for a method description:
methodDescription = {
parameters: {
x: 'number',
y: 'number'
},
result: 'n... | true |
f81582fd2f65f92720a393d23dcb44585be274a6 | JavaScript | Muhammadboburshoh/react-slaider | /src/Componints/Slider/Slider.jsx | UTF-8 | 978 | 2.59375 | 3 | [] | no_license | import { useEffect, useState } from "react"
import "./Slider.css"
function Slider () {
const [index, setIndex] = useState(0)
useEffect( () => {
document.documentElement.style.setProperty("--index", index)
},[index,])
return (
<div className="container">
<h2>Slaider</h2>
<div className=... | true |
265bda50a2fa5c24bd38bf750972703d15700fbc | JavaScript | natcobbinah/Online-Javascript-examination-system | /public/js/viewresults.js | UTF-8 | 550 | 3 | 3 | [] | no_license | const highScores_ulList = document.getElementById("highScoresList");
getData();
async function getData(){
const response = await fetch('/testSubmit');
const data = await response.json();
var highScores;
let li= document.createElement('li');
for(users of data){
var test_no = ... | true |
7fc366dbfa80bb49362773493832c8443561ae13 | JavaScript | clapis/sugar | /services/account-service.js | UTF-8 | 2,253 | 2.515625 | 3 | [] | no_license | var validator = require('validator');
var User = require('../model/user');
var ValidationError = require('../error/validation-error');
var LogService = require('./log-service');
var MailService = require('./mail-service');
module.exports = AccountService;
function AccountService() {
var mail = new MailService(... | true |
52fc4780e59118b5461891ede12b785c056edd09 | JavaScript | spryputniewicz/seismic-explorer | /js/core/filtered-earthquakes.js | UTF-8 | 3,361 | 2.875 | 3 | [
"MIT"
] | permissive | import crossSectionRectangle from './cross-section-rectangle'
let cachedValue = null
let props = {}
// Accepts state and returns filtered earthquakes. Since this function might be expensive due to number of
// earthquakes that we need to deal with, the result is cached. There are two important assumptions:
// 1. Stat... | true |
47ddc69db5d35d419226c08b3482bb15e84ae689 | JavaScript | colshacol/fed-boilerplate | /watcher.js | UTF-8 | 563 | 2.96875 | 3 | [] | no_license | // Watch specified paths.
// On change, deactivate watcher.
// Run specified tasks.
// On done, restart watch.
import { observable, action, autorun, computed } from 'mobx';
type StatusString = 'IDLE' | 'WORKING' | 'OFF';
function shout(title: string, messages: any[]) {
console.log(`\n\n\n[ Witness ][ ${title} ]:\n... | true |
b31e0f3002b9e721012be8abf8d0970713c1b21e | JavaScript | kpistor/alist2.0 | /server/api/passengerInfo.js | UTF-8 | 796 | 2.796875 | 3 | [] | no_license | /**
* Using Rails-like standard naming convention for endpoints.
* GET /things -> index
* POST /things -> create
* GET /things/:id -> show
* PUT /things/:id -> update
* DELETE /things/:id -> destroy
*/
'use strict';
var _ = require('loda... | true |
f576c001f9e0d3c170515bec427b3296a8dadbb6 | JavaScript | EdwardBurns/gulp-starter | /docs/gulpfiles-versions/gulpfile-012-callback.js | UTF-8 | 301 | 2.5625 | 3 | [] | no_license | // https://gulpjs.com/docs/en/getting-started/async-completion
/**
* * Signal task completion
* * -------------------------------------
* * Using an error-first callback
*
*/
function callbackTask(cb) {
// `cb()` should be called by some async work
cb();
}
exports.default = callbackTask; | true |
95115984de498595bd05f0e761c5321e9bb16cc7 | JavaScript | x-mo/Apocalypse | /ZombieHunter/soundgame.js | UTF-8 | 1,872 | 2.53125 | 3 | [] | no_license | /*var soundButtonHover = new sound("ZombieHunter/assets/sounds/button_hover.mp3");
var soundButtonClicked = new sound("ZombieHunter/assets/sounds/button_clicked.mp3");*/
var soundPlayAgainButtonClicked = new sound("assets/sounds/button_pa_clicked.mp3");
/*var soundGameStart = new sound("ZombieHunter/assets/sounds/game_... | true |
1f0772979c5524ab8e0722f8206526843f2ba51a | JavaScript | zhengkun1/zhengkun | /zhengkun.js | UTF-8 | 177 | 2.765625 | 3 | [
"MIT"
] | permissive | /*
* 2017.9.14 zhengkun
*/
var arr =[1,2,3];
console.log(arr.length);
arr.length = 6
console.log(arr);
arr.length = 2
console.log(arr);
arr.length = 5
console.log(arr);
| true |
5515151977f295a146d3740bcc81a79693520b3a | JavaScript | SmartZoos/Toolset | /resources/assets/js/geolocation.js | UTF-8 | 637 | 2.8125 | 3 | [
"MIT"
] | permissive | "use strict";
function getLocation(callback, watch, handleError) {
if ( typeof handleError !== 'function' ) {
function handleError(error) {
if ( console && console.error && typeof console.error === 'function' ) {
console.error('Geolocation error', error);
}
}... | true |
e9c2250439e4e35da4aa59eacb9217bb02284ba4 | JavaScript | zixuneer/Interactive-mobile-device | /flower.js | UTF-8 | 2,785 | 2.984375 | 3 | [] | no_license | var tra1=0;
var tra2=0;
function preload(){
// put preload code here
}
function setup() {
// put setup code here
createCanvas(windowWidth,windowHeight);
background(245, 183, 177);
frameRate(500);
angleMode(DEGREES);
}
function draw() {
flower(width/2,height/2);
flower(width/5,height/5.2);
flower... | true |
e683a15cc92cf00d1aac063050f8479d31f686cc | JavaScript | aksy007/Frontend-Projects | /CountDown/app.js | UTF-8 | 1,022 | 3.828125 | 4 | [] | no_license | alert("Countdown tll December 25");
function countdown()
{
const targetTime = new Date("2021, 12 , 25 , 00:00:00").getTime();
const currentTime = new Date().getTime();
const remainingTime = targetTime - currentTime;
console.log(targetTime);
// As getTime() gives time in ms we need to... | true |
bbc60355c9174763bfe3b2744fb645793e9bd124 | JavaScript | gabrielcubasdouat/fundamentosWeb | /labirinto.js | UTF-8 | 1,164 | 3.4375 | 3 | [] | no_license | var player;
var canvas;
var context;
function startGame(id){
loadCanvas(id);
component(10,10,"red",100,100,id)
}
function loadCanvas(id) {
/*creates the variable canvas, which is a html thingy for game dev and other stuff*/
canvas = document.createElement('canvas');
context = canvas.ge... | true |
7214b7a40ea21a4564aa10f1cd5c666eaaf62f3f | JavaScript | jamalelkhdadi/admin | /js/demo.projects.js | UTF-8 | 2,866 | 2.875 | 3 | [] | no_license | // Define a new module for our app
var app = angular.module("instantSearch", []);
// Create the instant search filter
app.filter('searchFor', function () {
// All filters must return a function. The first parameter
// is the data that is to be filtered, and the second is an
// argument that may be passed wi... | true |
7cfaf8398feeedd69e41325c21ec9ce503cd2a16 | JavaScript | chenjunyue/axeTickets | /breakWall/scene/edit/scene_edit.js | UTF-8 | 4,394 | 2.75 | 3 | [] | no_license | class SceneEdit extends GuaScene {
constructor(game) {
super(game)
this.level = 1
this.lifes = 1
this.color = ''
var that = this
e('.lifes').style = 'display:block';
this.addEvent()
this.bandEvent()
}
drawAll() {
var blocks = loadLeve... | true |
67474e54eb11ce7583d30a1eeca2774eb60d1737 | JavaScript | Ramyx947/js-looping-and-iteration-filter-lab-london-web-071618 | /index.js | UTF-8 | 348 | 3.0625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | // Code your solution in this file
function findMatching(drivers, person){
return drivers.filter(user=>user.toLowerCase() === person.toLowerCase())
}
function fuzzyMatch(drivers, person){
return drivers.filter(user=>user[0][0] === person[0][0])
}
function matchName(drivers, person){
return drivers.filter(user... | true |
7937331675a159fac6a688891aa869bfedbcbf64 | JavaScript | rumkin/wharf-app | /server.js | UTF-8 | 525 | 2.546875 | 3 | [] | no_license | const http = require('http');
const isJson = !! process.env.WHARF_OPT_APP_JSON;
const message = 'Hello ' + process.env.WHARF_OPT_APP_GREETING;
http.createServer((req, res) => {
if (isJson || (req.headers['content-type']||'').includes('application/json')) {
res.setHeader('content-type', 'application/json;ch... | true |
3594a545f27dd1e9114f7f193c883e420da6491a | JavaScript | jcbdeguzman/test-full-stack-engineer | /client/src/App/components/Main.js | UTF-8 | 4,523 | 2.53125 | 3 | [] | no_license | import React, { Component } from 'react';
import './Main.css';
import { connect } from 'react-redux';
import { fetchShips, fetchShipCount } from '../../redux/actions/shipActions';
class Main extends Component {
constructor(props) {
super(props);
this.state = {
shipTypes: ["Barge","Cargo","High Speed Cr... | true |
be8559f9405dda232dc891d054b886e60265582e | JavaScript | webdevproformation/react-w3a | /jour1/src/jour1/Quatrieme.jsx | UTF-8 | 857 | 2.78125 | 3 | [] | no_license | import { Component } from 'react';
import "./Quatrieme.css" ;
class Quatrieme extends Component {
state = {
chiffre : 30, // dรฉconseillรฉ de crรฉer un attribut de class
libelle : "like"
}
genererLibelleLike(){
if(this.state.chiffre <= 0){
return <p>Vous n'avez aucu... | true |
5c434992b7d28cce8c0ff67b754b0888c6ee7845 | JavaScript | 8alery/stepik-js | /splayTree.js | UTF-8 | 10,247 | 2.953125 | 3 | [
"Apache-2.0"
] | permissive | const readline = require('readline');
//const OtherSplayTree = require('splaytree');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
const lines = [];
let n = null;
rl.on('line', (line) => {
if (n === null) {
n = +line;
}
lines.push(line);
if (lin... | true |
1126dacca25436d77c695f4c23897c4a418eb1a7 | JavaScript | martam90/Kiwiland | /tab.js | UTF-8 | 723 | 3.078125 | 3 | [] | no_license | const tabBtns = document.querySelectorAll('.tab-btn');
const tabContent = document.querySelectorAll('.tab-content');
function showTab(tabId) {
for (let button of tabBtns) {
if (tabId == button.dataset.tabId) {
button.classList.add('active');
} else {
button.classList.remove(... | true |
0c7bb2a3a19758d1d148fab5ebacbe2191f412b3 | JavaScript | morganbonhomme/Tic-Tac-Toe | /script.js | UTF-8 | 7,427 | 3.484375 | 3 | [] | no_license | const Gameboard = (() => {
let board = [];
const restart = () => {
return board = [];
}
const push = (index, symbol) => {
board[index] = symbol;
}
return {board, restart, push};
})();
const Player = (name, symbol) => {
return {name, symbol};
}
const Play = (() => {
const player1 = Player("Pla... | true |
04cb8e8524fa9d2aae9726aa9a728fed63a4ba13 | JavaScript | yxia521/JS101_Programming_Foundation_with_JS | /lesson_4/practice_problems/7.js | UTF-8 | 432 | 4.25 | 4 | [] | no_license | // What is the return value of map in the following code? Why?
['ant', 'bear'].map(elem => {
if (elem.length > 3) {
return elem;
}
});
// [undefined, 'bear']
// for the first element 'ant', the if condition evaluates to false and elem isn't returned.
// When a function doesn't explicitly return something, it ... | true |
d4b22c1eb4867c310477476eaf2853c6bbc5a91c | JavaScript | marsleite/trybe-exercises | /exercises/introducao-a-javascript-e-logica-de-programacao_3/exercicio_01.js | UTF-8 | 94 | 3.140625 | 3 | [] | no_license | // 1
let n = 5;
let ast = "*";
for (i = 0; i < 5; i += 1) {
console.log(ast.repeat(n))
} | true |
03f3f8203b878c3cbf2ecbcc8046c95e942885cf | JavaScript | Jendnice/react-container-components-lab-online-web-ft-090919 | /src/components/MovieReviews.js | UTF-8 | 1,776 | 2.75 | 3 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | // Code MovieReviews Here
import React from 'react'
// title: reviewsData.results[0].display_title
// short summary: reviewsData.result[0].short_summary
// below "reviews" should equate to reviewsData.results
const MovieReviews = ({ reviews }) => {
return (
<div className="review-list">
{ ... | true |
b80235c52574664810a66750e02c9eee4e49d28c | JavaScript | philihp/boardgame.io | /examples/react/turnorder/example-militia.js | UTF-8 | 1,516 | 2.53125 | 3 | [
"MIT"
] | permissive | /*
* Copyright 2018 The boardgame.io Authors.
*
* Use of this source code is governed by a MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
*/
import React from 'react';
import { Game } from 'boardgame.io/core';
const code = `{
flow: {
setActionPlayers... | true |
bd6aab33aab9834bc348acb9b7aea6e8d875584a | JavaScript | kernel503/CatDog | /src/ServiceContentful/contentful-management.js | UTF-8 | 3,696 | 2.625 | 3 | [] | no_license | import { createClient } from 'contentful-management';
//TOKEN content management
const accessToken = 'CFPAT-wqDaDKUEru4cY5dZhTN1kAg2yg8VIbCbcDuoMgsNu6E';
const environment = 'master';
const space = 'agv5h5fnr06l';
const contentTypeEmployee = 'employee';
const contentTypeDisability = 'disability';
const client = createC... | true |
d0e9dc3ebb16bf46b7164892edcd7b640fbc8532 | JavaScript | erictdobbs/GerbilTales | /Content/javascript/Sprites/TrackEngine.js | UTF-8 | 4,468 | 2.53125 | 3 | [] | no_license | ๏ปฟfunction EditorTrackEngine(x, y, nextNode, startingNode, cargo) {
this.name = "TrackEngine";
this.description = "An engine moves its cargo along a path";
this.startingNode = startingNode;
this.cargo = cargo;
this.powerSource = null;
this.speed = 1;
this.zIndex = 4;
EditorBase.call(this... | true |
2de0542ed299f907f739cc96692518c49c4ad3b9 | JavaScript | iyocmd/killuabot | /commands/Switch story telling.js | UTF-8 | 994 | 3.078125 | 3 | [
"MIT",
"JSON"
] | permissive | exports.run = (client, message, Discord) => {
Message.channel.send("Hello!") //Initial message
.then(() => {
message.channel.awaitMessages(response => response.content, {
max: 1,
time: 10000, // Await time in miliseconds
errors: ['time'],
})
.then((collected) => {
switch (collect... | true |
64e209341e5f524e9dfc4a761504e59a802675e0 | JavaScript | mihretdejong/assignments | /exercise/arraySortExercises/app.js | UTF-8 | 1,574 | 4.28125 | 4 | [] | no_license |
// Sort permanently changes your array
// const myFunction = (arr) => {
// return arr.sort(function(a, b) {return a - b})
//}
// a and b represent the iteration, a the first one and b the second one
// a and b could be an array or an object or a string
// Sort an array from smallest number to largest
// const lea... | true |
35bf64edb9b8e433aa088b095e39647c07b1aacb | JavaScript | SmithJackZuo/vue_cli_gshop | /static/js/paint/paintCircle.js | UTF-8 | 662 | 2.75 | 3 | [] | no_license | import Paint from './paint';
function PaintCircle(eleId) {
Paint.call(this);
this.ctx = document.getElementById(eleId).getContext('2d');
}
PaintCircle.prototype = new Paint();
PaintCircle.prototype.constructor = PaintCircle;
PaintCircle.prototype.bridge = function (x, y, param) {
if (... | true |
73f2c314f62f132eae7f5a74f87d7d037e9d66e3 | JavaScript | mustofaazka/GenerateArticle | /static/index.js | UTF-8 | 988 | 3 | 3 | [] | no_license | function suggestion() {
console.log('Suggestion');
var textarea = document.getElementById("input");
var input = textarea.value;
var formData = new FormData();
formData.append("input", input );
fetch(
"/gpt-2",
{
method: "POST",
body:formData
}
... | true |
2c2dbb6ecb16bf8f9603599585ac1849b1812aaa | JavaScript | annawritescode/ITC230-AdvJS | /index.js | UTF-8 | 2,775 | 2.578125 | 3 | [] | no_license | //server page
'use strict';
const express = require("express");
const app = express();
var Film = require('./models/films');
app.set('port', process.env.PORT || 3000);
app.use(express.static(__dirname + '/public')); // set location for static files
app.use(require("body-parser").urlencoded({extended: true})); // pars... | true |
2bdf446402b34158bb7ca4a5854dfb478e76047e | JavaScript | pilot777sk/Newsscrape | /scripts/scrape.js | UTF-8 | 567 | 2.8125 | 3 | [] | no_license | var request = require('request');
var cheerio = require('cheerio');
var scrape = function(callback) {
request("https://www.nytimes.com", function(error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body);
}
var $ = cheerio.load(body);
var articles = [];
$("article.story... | true |
9f0e7706e905de2cc2eb4a918fde41a6e8e3c215 | JavaScript | gkalms/GK_AplhabetReact | /server/src/Routes/AlphaRoute.js | UTF-8 | 3,246 | 2.671875 | 3 | [] | no_license | const express = require("express");
const WordsApi = require("../Models/WordsModel");
const AlphabetApi = require("../Models/AlphabetModel");
const router = express.Router();
//Create alphabet list
router.post("/alphabet", async (request, response) => {
try {
const createAlphabet = await AlphabetApi.create(re... | true |
31111d47919cb9afc3eb32853a12661c004b6e9d | JavaScript | Sineastra/JS-Advanced-January-2021 | /07 Unit Testing & Error Handling/01 Lab/07 Add Subtract/addSubtract.test.js | UTF-8 | 1,075 | 3.0625 | 3 | [] | no_license | const { expect } = require('chai')
const createCalculator = require('./addSubtract')
describe(`testing calculator functionality`, () => {
it(`returns an object`, () => {
expect(typeof createCalculator()).to.equals('object')
})
it(`return obj has method add`, () => {
expect(createCalculator(... | true |
0c61cc268b01c75cadf5d023e0a6c49f550b2f34 | JavaScript | JayoonKoo/solving-coding-test | /math1/math17087.js | UTF-8 | 547 | 3.140625 | 3 | [] | no_license | let fs = require('fs');
let input = fs.readFileSync('/dev/stdin').toString().split('\n');
const sol = (input) => {
const N = input[0].split(' ')[0];
const S = input[0].split(' ')[1];
let array = [];
const placeInput = input[1].split(' ');
for (let i = 0; i < N; i++) {
array[i] = Math.abs(S - placeInput... | true |
c692250e1b3dd3f0a02f71ea38d7edaa3ca830bc | JavaScript | buffalo704/wiremock-swapi | /src/Films/Films.js | UTF-8 | 1,407 | 2.65625 | 3 | [] | no_license | import React, { useState, useEffect } from 'react';
import { baseApiUrl, env } from '../config';
import { fetchApi } from '../common';
const Films = () => {
const [films, setFilms] = useState();
useEffect(() => {
fetchStarWarsFilms(['1','2','3','4','5','6','7','8','9'])
.then(filmsMeta => ... | true |