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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ec034380330bde5180a9abd78b403eccdce8118c | JavaScript | ms853/software-engineering-project | /src/main/webapp/resources/js/signup.js | UTF-8 | 5,915 | 2.71875 | 3 | [] | no_license | //-------------------- Attributes --------------------//
var valName = false, valEmail = false, valEmail2 = false, valPassword = false, valPassword2 = false;
// When an error occurs disable submit button, add error class
function doError(id) {
var div = $("#" + id).closest("div");
div.removeClass("has-success");
$... | true |
a3ab4a09ab99f2e1978a6d4d450841bd8675c3a2 | JavaScript | islandtechie/expense_tracker | /client/src/components/AddExpense.js | UTF-8 | 5,764 | 2.734375 | 3 | [] | no_license | import React, { Fragment, useState, useContext, useRef } from 'react';
import globalContext from '../context/globalContext';
const AddExpense = () => {
const GlobalContext = useContext(globalContext);
const [date, setDate ] = useState();
const [payee, setPayee ] = useState();
const [description, setDes... | true |
425b0740e613156d97f4b0cf3b731b3f514602fc | JavaScript | rattandeep1998/countdown_champ | /src/App.jsx | UTF-8 | 2,075 | 2.84375 | 3 | [] | no_license | import React, { Component } from 'react';
import Clock from './Clock';
import StopWatch from './StopWatch'
import './App.css';
import { Form, FormControl, Button} from 'react-bootstrap'
class App extends Component {
constructor(props) {
super(props);
this.state = {
deadline: 'December 25, 2017',
... | true |
6f6e8e65e1a149ca56edbbefc98f923eaa7192f4 | JavaScript | frankcortes/mini-js-bundler | /src/syntax/builders/allExport.js | UTF-8 | 1,163 | 2.859375 | 3 | [
"MIT"
] | permissive | const t = require('@babel/types');
module.exports = function buildAllExports(source) {
// require(source)
const requireNode = t.callExpression(t.identifier('require'), [t.stringLiteral(source.value)]);
// Object.entries
const objectEntriesNode = t.memberExpression(t.identifier('Object'), t.identifier('entries... | true |
ef96668fbf85540d2d87d0494933b4d94d719615 | JavaScript | cristalnaya/solving-javascript-challenges | /challenges/Easy_VeryEasy/retrieve.js | UTF-8 | 373 | 2.890625 | 3 | [] | no_license | function retrieveMajor(semver) {
let split = semver.split('.');
return split[0];
}
function retrieveMinor(semver) {
let split = semver.split('.');
return split[1];
}
function retrievePatch(semver) {
let split = semver.split('.');
return split[2];
}
console.log(retrieveMajor("6.1.9"));
console.log(retrieve... | true |
32d945982f849145565620861efb3b5c0db23eea | JavaScript | namanyash/node-practice | /nodeCourse/notes.js | UTF-8 | 349 | 2.53125 | 3 | [] | no_license | console.log('startig notes.js');
var addNote = (a,b)=>{
console.log(a,b);
};
var getNote = ()=>{
console.log('listing allnotes');
};
var readNote = (a)=>{
console.log('reading ',a);
};
var removeNote = (a)=>{
console.log('removing', a);
};
module.exports = {
addNote,
getNote,
... | true |
fbd1a6d64a3d579c07bd09aeead05c1804dd6200 | JavaScript | jasonLaster/workerjs | /test/fixtures/fibworker.js | UTF-8 | 144 | 2.953125 | 3 | [
"BSD-2-Clause"
] | permissive | self.onmessage = function (msg) {
self.postMessage(fibo(msg.data));
};
function fibo (n) {
return n > 1 ? fibo(n - 1) + fibo(n - 2) : 1;
}
| true |
28afbbf1a4528928c2e08cc79731423af1e9b198 | JavaScript | lauflavell/myface-api-typescript | /public/src/myface-react-app/src/components/PostList.jsx | UTF-8 | 1,777 | 2.609375 | 3 | [] | no_license | import React, { useEffect, useState, useRef } from "react";
import { Posts } from "./Posts";
import { Navbar } from "./Navbar";
import { Link } from "react-router-dom";
export function PostList() {
const [posts, setPosts] = useState([])
const [page, setPage] = useState("/posts/?page=1&pageSize=10");
le... | true |
47d9ab350451ba96f7f54da46adf3e2b98ab3608 | JavaScript | jlato89/VandyBoot_bamazon | /bamazonSupervisor.js | UTF-8 | 3,764 | 3.0625 | 3 | [] | no_license | var mysql = require('mysql');
var Table = require('cli-table')
var inquirer = require('inquirer');
//* MYSQL CONNECTION
var connection = mysql.createConnection({
host: 'localhost',
port: 3306,
user: 'root',
password: 'password',
database: 'bamazon_db',
supportBigNumbers: true,
bigNumberStrings: tr... | true |
76128dd69ed5a7f2c43339b10af1eff4f506e0ee | JavaScript | rpoore/redux_hack | /src/reducers/cartReducers.js | UTF-8 | 316 | 2.609375 | 3 | [
"MIT"
] | permissive | // ./src/reducers/cartReducers.js
export default (state =[], action) => {
switch(action.type){
// Check if action dispatched is
// PROCESS_ORDER and act on that
case 'PROCESS_ORDER':
return [
...state,
Object.assign({}, action.books)
]
default:
return state;
}
} | true |
40b55e73e837a55b1a14b629366d81854293c014 | JavaScript | juanvmr/javaforweb | /ProjetoFinal/backend/api/routes/item.js | UTF-8 | 2,008 | 2.546875 | 3 | [] | no_license | var express = require("express")
var Item = require("../models/Item")
var router = express.Router()
router.use(express.json())
router.get("/:id", function(req, res){
var id = req.params.id
var limiter = req.params.id
var filter = req.params.id
if(!id){
if(!limiter && !filter){
... | true |
3b29749bb52150e4c69428afa69b0fab67f78294 | JavaScript | malcolmlovell19/Rewind | /js/site.js | UTF-8 | 816 | 4.40625 | 4 | [] | no_license | //Get string from page
function getValue(){
//Make sure alert is invisible before button is pressed
document.getElementById("alert").classList.add("invisible");
let userString = document.getElementById("userString").value;
let revString = reverseString(userString);
displayString(revString);
}
//... | true |
fa7942efbce7430af1d445e8cbb2d75b34342cbe | JavaScript | marileitune/robofriends | /src/containers/App.js | UTF-8 | 1,677 | 2.828125 | 3 | [] | no_license | import React, {Component} from 'react';
import './App.css';
import CardList from '../components/CardList';
import SearchBox from '../components/SearchBox';
import Scroll from '../components/Scroll'
import ErrorBoundry from '../components/ErrorBoundry';
class App extends Component {
constructor() {
super ()... | true |
cd7b3de42365bd91820752939551b396edce0885 | JavaScript | epicufscar/epic-ufscar | /core/static/javascripts/forms-validation.js | UTF-8 | 1,458 | 2.5625 | 3 | [] | no_license | $(document).ready(function () {
$("#contact-form").validate({
rules: {
"name": {
required: true,
minlength: 5
},
"email": {
required: true,
email: true
},
"subject": {
... | true |
8abbdc25fc7166271f41258d6efe8e2e98b88339 | JavaScript | Tsubz/TestApp | /app.js | UTF-8 | 1,649 | 3.03125 | 3 | [] | no_license | var express = require('express')
var app = express()
var choice = ['rock', 'paper', 'scissors'],
serverPick,
text;
function serverPlay() {
serverPick = choice[Math.round(Math.random()*3)];
return serverPick;
}
function confrontation(server, player) {
if (server === "rock") {
switch (p... | true |
4f01752ec8ff633fc8a9bb9863b423d1b1c68c22 | JavaScript | EmilyCore/project1 | /src/EncoderComponent.js | UTF-8 | 1,708 | 2.734375 | 3 | [] | no_license | import React, { Component } from 'react';
import { Encoder } from './Encoder';
class EncoderComponent extends Component {
state = {
input: '',
result: '',
history: [],
showHistory: false
}
encoder = new Encoder();
constructor(props) {
super(props);
}
conve... | true |
92dd0a5ac80bc76699cc23bd2b445eb515bbd1b8 | JavaScript | 0r0loo/D.S-Algo | /JavaScript/js200/part3/80~100/090.js | UTF-8 | 627 | 3.96875 | 4 | [] | no_license | // 090 배열의 특정 요소 위치 확인하기 indexOf
/*
Array 객체의 메소드 indexOf는 대입된 값 (첫 번쨰 인자)을 배열 내부에서 검색한다. 값이 일치하는 겨웅 해당 인덱스를 반환한다.
두 번쨰 인자인 시작 인덱스는 필수값은 아니다.
만일 두 번째 인자에 숫자형 값을 넣으면, indexOf는 해당 인덱스부터 값을 찾는다 만일 찾는 값이 없으면
indexOf는 숫자 -1르 반환한다.
배열.indexOf(검색할 값, 시작 인덱스)
*/
const arr = ['spring', 'summer', 'fail', ... | true |
7e84dae04ef25de038430d42dd192b60e612c038 | JavaScript | project-sunbird/sunbird-cms-website | /www/media/system/js/polyfill.classlist-uncompressed.js | UTF-8 | 10,847 | 2.75 | 3 | [
"MIT"
] | permissive | /**
* Polyfill service v3.13.0
* For detailed credits and licence information see http://github.com/financial-times/polyfill-service.
*
* Features requested: Element.prototype.classList
*
* - Object.defineProperty, License: CC0 (required by "Element.prototype.classList")
* - _DOMTokenList, License: CC0 (requir... | true |
6ddb81923e549091ba91c28f5bb9adc67b38f95b | JavaScript | Jamesernator/itertools | /lib/sync/using.js | UTF-8 | 749 | 3.03125 | 3 | [] | no_license | import getIterator from "./iterator.js"
import iteratorClose from "./close.js"
export default function using(...args) {
const iterables = args.slice(0, args.length-1)
const handler = args.slice(-1)[0]
const iterators = []
try {
for (const iterable of iterables) {
iterators.push(get... | true |
5b0f24f475861e8ac9dae90ebe995faa26ebcb91 | JavaScript | AbhijnanVegi/ISS-Website | /js/gallery.js | UTF-8 | 224 | 2.65625 | 3 | [] | no_license | const images = ["foxy.jpg","eagle.jpg","zelda.jpg","island.jpg","deer.jpg"]
let current = 4;
function changeImg()
{
current = (current + 1) % 5;
document.getElementById("gallery").src = "../img/" + images[current]
} | true |
83caf6ae7006d7de8aa20b42001db4b6c76a1ba1 | JavaScript | codemzy/react-todo-redux | /app/reducers/reducers.js | UTF-8 | 1,280 | 2.875 | 3 | [] | no_license | var moment = require('moment');
export var searchTextReducer = (state = '', action) => {
if (action.type === 'SET_SEARCH_TEXT') {
return action.searchText;
}
return state;
};
export var showCompletedReducer = (state = false, action) => {
if (action.type === 'TOGGLE_SHOW_COMPLETED') {
r... | true |
1aa94e2ad4b70791b4957f0fbdb5ba13554c7445 | JavaScript | shrey6/userform | /models/user.js | UTF-8 | 1,816 | 2.53125 | 3 | [] | no_license | const mongoose = require('mongoose')
const validator = require('validator')
const nodemailer = require('nodemailer')
const userSchema = new mongoose.Schema({
name:{
type:String,
trim:true,
},
email:{
type:String,
trim:true,
lowercase:true,
vali... | true |
1fa7773e9dc5179bd8ecd3a9f74e4162342f203a | JavaScript | mbr4477/blog | /src/api/microblog.js | UTF-8 | 960 | 2.5625 | 3 | [
"MIT"
] | permissive | import yaml from "js-yaml"
export class GithubMicroblog {
constructor(user, repo) {
this._user = user
this._repo = repo
}
_getIndexURL() {
return `https://api.github.com/repos/${this._user}/${this._repo}/contents/`
}
async getPostURLs() {
const res = await window.f... | true |
cc094c113d08da2eba14c46f9849e553523c3a22 | JavaScript | sridharhitman/project1.com | /js/script.js | UTF-8 | 575 | 3.53125 | 4 | [] | no_license | // vars
var first_name = " Sridhar";
var last_name = "Hisaria";
var convert_uppercase = first_name.toUpperCase();
var concat = first_name.concat(last_name);
var a = 81;
var b = 92;
var squareroot = Math.sqrt(a);
var power = Math.pow(8, 8);
var wrong = " The class was very bad";
var replaced = wrong.replace("b... | true |
9a3eb641408495da89fef0a2caeea6ec5b4d5163 | JavaScript | jamster10/capstone3-client-GOATful | /src/Utils/Utils.js | UTF-8 | 4,749 | 3.171875 | 3 | [] | no_license | import moment from 'moment'
function swap(arr, idx1, idx2) {
let temp = arr[idx1];
arr[idx1] = arr[idx2];
arr[idx2] = temp;
}
export function shuffle(arr) {
let random;
for (let i=0; i<arr.length; i++) {
random = Math.floor(Math.random() * arr.length);
swap(arr, i, random);
}
return arr;
}
exp... | true |
96d3345cd5a157cac23781c5b0b732928a12532b | JavaScript | Mprado18/js-study | /aulas/9_programacao-assincrona/1_callback/script.js | UTF-8 | 480 | 3.71875 | 4 | [] | no_license | // Callback é uma função que faz uma ação após algum acontecimento no código;
// É possível realizar um callback com uma função setTimeOut
// Callbacks nos permitem executar o código de forma assíncrona
console.log("1");
setTimeout(function(){
console.log("5");
},2000); /*irá executar o console após x tempo defin... | true |
7f8435086c86186674359131ae9ed97a508fcfe6 | JavaScript | ctsanders1/js13k-2018-raven | /src/js/Input.js | UTF-8 | 3,280 | 3.21875 | 3 | [] | no_license | /**
* Input handles game input (keyboard presses and mouse movement), allowing the routing
* of these events to the appropriate place via event handlers.
*/
class Input {
constructor(handlers) {
// Input queue (used only for cheat codes)
this.queue = [];
// Map keys to in-game inputs
... | true |
627d20916eadd458ea56790ec5efd479e87315f4 | JavaScript | OxCom/constraint-validator | /src/Constraints/Regex.js | UTF-8 | 1,783 | 2.90625 | 3 | [
"MIT"
] | permissive | import AbstractConstraint from './AbstractConstraint';
import {trim} from '../Utils/functions';
const MESSAGE_INVALID = 'This value is not valid.';
export default class Regex extends AbstractConstraint {
/**
* @param {{message: string, trim: boolean, match: boolean, pattern: string}} [options]
... | true |
9c698b9810c8c3102e2b19cef08d63a71dbbd2c5 | JavaScript | caspianzx/frontend-techniques | /draggable-element/index.js | UTF-8 | 2,778 | 3.453125 | 3 | [] | no_license | // Make the DIV element draggable:
dragElement(document.getElementById("mydiv"));
function dragElement(ele) {
// pos 1 to 4 will be the coordinate of the mouse location in relation ot the browser screen at the point
// of clicking
// 1 and 2 is used to track initial click
// 3 and 4 is used to track ... | true |
3bda648675a37ff24299d608576b0a1ed9eb122d | JavaScript | robsonmobile/uber-pay-reference-app | /src/merchant/controllers/__tests__/merchantController.test.js | UTF-8 | 1,764 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | const MerchantController = require('../merchantController');
test('run controller', async () => {
const mockUberPaymentsClient = {
createDepositAsync: function() {
return {
status: 200,
data: {},
}
}
};
const mockIdGenerator = {
... | true |
68f5e990a33ac6ca3852f54d95a8578333b1d635 | JavaScript | zsjun/leetcode | /src/deepAndBreadthSearch/37_Sudoku_Solver/index.js | UTF-8 | 3,418 | 3.15625 | 3 | [] | no_license | /**
* @param {character[][]} board
* @return {void} Do not return anything, modify board in-place instead.
*/
[
["5", "3", ".", ".", "7", ".", ".", ".", "."],
["6", ".", ".", "1", "9", "5", ".", ".", "."],
[".", "9", "8", ".", ".", ".", ".", "6", "."],
["8", ".", ".", ".", "6", ".", ".", ".", "3"],
["4", "... | true |
13fee2cd24f2959f5b775ad4da4357da24510750 | JavaScript | jinsung/sva-cc-spring-2017 | /week04/examples/05_pong/sketch.js | UTF-8 | 1,444 | 3.375 | 3 | [] | no_license | var circleX = 10;
var circleY = 20;
var circleSize = 20;
var speedX = 2;
var speedY = 2.1;
var boxWidth = 10;
var boxHeight = 100;
var leftSideBoxY;
var rightSideBoxY;
function setup() {
createCanvas(400, 400);
leftSideBoxY = height / 2 - boxHeight / 2;
rightSideBoxY = height / 2 - boxHeight / 2;
}
function dr... | true |
cad029a76b7a6d463f1cd93dc15353d73c8007ae | JavaScript | Cloudoki/react-redux-donderstarter | /src/containers/Auth/RequireAuth.js | UTF-8 | 1,686 | 2.703125 | 3 | [
"MIT"
] | permissive | /**
* HOC that authorizes users based on their role
* and the component required role
* @module Auth
*/
import React, { Component } from 'react'
import { object, bool, func, string, arrayOf, array } from 'prop-types'
export class RequireAuth extends Component {
constructor (props) {
super(props)
const ... | true |
c78509d966461c129db1b9e4a80eed49966a52a5 | JavaScript | henryRoby/ecomrce-back | /controllers/dashbord/dash.js | UTF-8 | 3,464 | 2.546875 | 3 | [] | no_license | const Produit = require('../../schema/dashbordSchema/dashSchema');
const fs = require('fs');
exports.create = (req, res) => {
Produit.find()
.then(prod => {
//autoincrement
let idautom;
if(prod.length == 0){
idautom = 0
}else {
idautom = parseInt(prod[pro... | true |
29caafcce6f9f8ed0a9dbf6fb757d2a85bfcaa40 | JavaScript | AimanSaad/PIAIC116355assignment-2 | /task 2/task 2.js | UTF-8 | 242 | 3.140625 | 3 | [] | no_license | var lightColor = prompt("Enter color of trafic light");
if (lightColor === "green") {
alert("Move Now!");
}
else if (lightColor === "yellow") {
alert("Get Ready to Move!");
}
else if (lightColor === "red") {
alert("Must Stop!");
} | true |
c0c0b61d48950e3737bbdbc015bc5063913f741f | JavaScript | OgunwoleOluwatobi/mobileforce-gong | /backend/controllers/todoControllers.js | UTF-8 | 4,572 | 2.890625 | 3 | [] | no_license | const Todo = require('../models/todo.js');
// Create and Save a new Todo
exports.create = (req, res) => {
// Validate request
if (!req.body.title) {
return res.status(400).send({
message: "Todo title can not be empty"
});
}
// Create a Todo
const todo = new Todo({
... | true |
b0dd1762e9e5c4652ccd581654ccad39abdcc4c0 | JavaScript | AEhab/Cat_Rescue_Centre | /public/script.js | UTF-8 | 1,428 | 2.890625 | 3 | [
"MIT"
] | permissive | function messagesent()
{
alert("Your message has been sent to us\nThank you for contacting us ^_^ ");
}
function donationdone()
{
alert("Thank you for your donation ^_^ ");
}
function changecatID() {
var catradio = document.getElementById("radiocatID").checked;
if (catradio == true)
{
docum... | true |
aeed7c3a495aac1596487795ac8c8d6e8aa1d80d | JavaScript | M-A-Justice/collatzVisualizer | /server/scripts/script.js | UTF-8 | 422 | 3.21875 | 3 | [] | no_license | /* eslint-disable no-param-reassign */
const collatz = (int) => {
const result = [];
if (int === 1 || int === -1) {
result.push(int);
return result;
}
if (int % 2 === 0) {
result.push(int);
int /= 2;
} else {
result.push(int);
if (int > 0) {
int = (3 * int) + 1;
} else {
... | true |
3b909bd3bd1bf51e7e92d1ef64681d01188b4fa3 | JavaScript | RyanJGibson/_example-FlappyDuck | /framework/trig.js | UTF-8 | 8,208 | 2.796875 | 3 | [] | no_license | define(function(require) {
var Trig = {};
Trig.FindDistanceBetweenTwoPoints = function(nPointAX, nPointAY, nPointBX, nPointBY){
//trace("FindDistanceBetweenTwoPoints");
_nPointAX = nPointAX;
_nPointAY = nPointAY;
_nPointBX = nPointBX;
_nPointBY = nPointBY;
_nABXDist = Math.abs(_nPointAX-_nPointBX);
... | true |
540a2ad698caf2ade8f6606098ddf10229b19960 | JavaScript | richardmable/ng-admin-example | /scripts.js | UTF-8 | 6,769 | 2.546875 | 3 | [] | no_license | var myApp = angular.module('myApp', ['ng-admin','ng-admin.jwt-auth']);
myApp.config(['NgAdminConfigurationProvider', function(NgAdminConfigurationProvider) {
var nga = NgAdminConfigurationProvider;
// create an admin application
var admin = nga.application('My First Admin')
.baseApiUrl('http://jsonplac... | true |
2db92c6b335b77930941df733273dc57cd379b2a | JavaScript | theNikhilMannem/React | /create-controlled-input.js | UTF-8 | 924 | 3.9375 | 4 | [] | no_license | /*
The form control elements such as input and textarea maintain their own state in the DOM as the user types. You can move this to React's component's state with React.
The user's input becomes a part of the application state, so React controls the value of that input field.
*/
// Class Component.
class Controlled... | true |
9c95989042471b1eab2be05cf36aee5ca59febf9 | JavaScript | magkuna/struktury-danych | /appScript.js | UTF-8 | 2,210 | 3.28125 | 3 | [] | no_license | const main = document.querySelector('main')
main.style.display = 'none'
( () => { // definiowanie funkcji i wywoływanie jednocześnie, na końcu strony jest wywowłanie (zamiast const render = )
let fieldNumber; //zadeklarowanie zmiennej
const myArray = [] // zadeklarowanie tablicy
document.querySelector('.butto... | true |
848fd22a31be4cf47e6497deb748037eeeb7d6b6 | JavaScript | jollygoodfellowz/apg_challenge | /js/server.js | UTF-8 | 3,130 | 2.703125 | 3 | [] | no_license | var express = require('express');
var mysql = require('mysql');
var Baby = require('babyparse');
var fs = require('fs');
var multer = require('multer');
var html = require('html');
var ejs = require('ejs');
var upload = multer({dest: '/tmp'});
var app = express();
app.set('json spaces', 2);
app.set('views', __dirname ... | true |
424e014764fd0d4bc012ba26b7e49cbc27f57cb5 | JavaScript | TheSerge/AndroidAuto-Server | /Inner-Api/redis-Api.js | UTF-8 | 16,943 | 2.734375 | 3 | [] | no_license | var util = require('../util.js');
var redis = require('redis');
var redisClient = redis.createClient();
/**
* CONST
*/
var __playlistNames__ = "playlistNames";
/**
* GEOLOCATION
**/
function getGeo(userId, callback){
var key = util.getKeyFor(userId,'geo');
redisClient.get(key, function(err,geo){
... | true |
1eecc88595ccf4eb78ee7ac250963db3ec012e32 | JavaScript | Adjamo/Bike-Fixer | /showResult.js | UTF-8 | 1,263 | 2.828125 | 3 | [] | no_license | function showResult(str)
{
myPos = findPos(document.getElementById('search_res'))
x = myPos[0]
y = myPos[1]
if (str.length==0)
{
document.getElementById("livesearch").innerHTML="";
document.getElementById("livesearch").style.border="0px";
return;
}
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chr... | true |
f777fc0090d549a1a3da6c8629de29e741f0baf3 | JavaScript | jameskulu/calorie-tracker-mern | /client/src/components/main/FoodDetail/FoodDetail.js | UTF-8 | 3,202 | 2.640625 | 3 | [] | no_license | import axios from 'axios'
import React, { useContext, useEffect, useState } from 'react'
import { Link ,withRouter } from 'react-router-dom'
import { toast } from 'react-toastify'
import UserContext from '../../../context/UserContext'
import './food-detail.css'
import Arrow from "../../../images/arrow.png"
const FoodD... | true |
88c3d99caffc94b14e93ee0d316e8607e11d9783 | JavaScript | YashGupta789/Project_31-Raining | /sketch.js | UTF-8 | 2,097 | 2.6875 | 3 | [] | no_license | const Engine = Matter.Engine;
const World = Matter.World;
const Bodies = Matter.Bodies;
const Constraint = Matter.Constraint;
var drops = [];
var maxDrops=120;
var menImage,men;
var umbrella,ground;
var cloud1,cloud2,cloud3;
var thunderbolt,thunderbolt1,thunderbolt2,thunderbolt3,thunderbolt4;
function p... | true |
656583ae04b7da59184c59403cad0cd485522dff | JavaScript | kirtikachouhan/LeetCode | /dist/88.Merge_Sorted_Array.dev.js | UTF-8 | 1,448 | 3.546875 | 4 | [] | no_license | "use strict";
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object... | true |
cb5838ce501a01349c9b7a665c129109e22b1073 | JavaScript | MohJaber93/Skeleton-metronic-dashboard-demo-1- | /src/helpers/api-helper.js | UTF-8 | 625 | 2.5625 | 3 | [] | no_license | /**
* This is API common status RESPONSE
*
*/
const API_COMMON_STATUS = Object.freeze({
SUCCESS: 200,
FAILED: 500,
VALIDATION_ERROR: 422,
RESOURCE_CREATED: 201,
PUT_SUCCESS: 202,
RESOURCE_DELETED: 204,
UNAUTHORIZED: 401,
UNAUTHENTICATED: 403,
ERROR: 404,
BAD_REQUEST: 400
});
/**
* This method w... | true |
5cf60c86606449dd7c3c0d6049175c89e344e028 | JavaScript | Jamrocklord/BattleShip | /battleship.js | UTF-8 | 5,412 | 3.578125 | 4 | [] | no_license | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
//Ship object (Prototype)
function Ship(numhits, location){
this.numhits= 0,
this.location= [
{ locations: [... | true |
89eefbf6515b26c13730e9dfdc340bb8362e0501 | JavaScript | raja2102598/JavaScript-Training | /Movies/Movies.js | UTF-8 | 3,370 | 3.40625 | 3 | [] | no_license |
document.getElementById("btnSearch").addEventListener("click",function (event) {
event.preventDefault()
// resetMovies()
getMovie()
})
// const movieUrl = document.getElementById('imgUrl')
// const movieTitle = document.getElementById('movieTitle')
// const moviePlot = document.getElementById('moviePlo... | true |
4d98704a445fa939d93dbc545fd5edbe49bdfac0 | JavaScript | yk0932/Javascript201612 | /正式课第五周/第一天/enter.js | UTF-8 | 393 | 2.875 | 3 | [] | no_license | var qq = document.querySelector('#qq');
var ctrlDown = false;
qq.onkeydown = function(e){
var keyCode = e.keyCode;
if(keyCode == 17){
ctrlDown = true;
setTimeout(function(){
ctrlDown = false;
},1000);
}
if(keyCode == 13){
if(ctrlDown){
qq.value = qq.... | true |
5b8b3de7e60132022e2d4d2e3512a5154f508f3a | JavaScript | Catherina87/stacks-queues-js | /lib/stack.js | UTF-8 | 501 | 3.140625 | 3 | [] | no_license | const LinkedList = require("./linked-list");
class Stack {
constructor() {
this.list = new LinkedList();
}
push(item) {
this.list.addFirst(item);
}
pop() {
let first = this.list.getFirst();
this.list.delete(first);
return first;
}
isEmpty() {
... | true |
a64c5b54c9c7a15164c60970f1f0b739f410dcc7 | JavaScript | mpx7/dream_palettes | /ran.js | UTF-8 | 407 | 3.015625 | 3 | [] | no_license | const a = document.getElementById('disp')
const jin = "陣内智則"
let cur = ""
const addchar = function(){
const c = jin[ Math.floor(Math.random()*(jin.length)) ]
cur += c
a.appendChild(document.createTextNode(c+" "))
}
const control = function(){
addchar()
if( cur.endsWith("陣内智則") ){
clearInterval(rep... | true |
d8d39c100248921913c86d660c51de127d15388b | JavaScript | rebootacademy-labs/project-sample-code | /scripts/login.js | UTF-8 | 678 | 2.703125 | 3 | [] | no_license | document.getElementById('login_button').addEventListener('click', () => {
const loginInfo = {
user_email: document.getElementById('login_user_email').value,
user_password: document.getElementById('login_user_password').value
}
API
.post('/auth/login', loginInfo)
.then(response => {
localSto... | true |
1bcfa4eaeb1be2d5dc3596e09396f0a8d9abdf09 | JavaScript | naapak/messengerBot | /functions.js | UTF-8 | 462 | 3.109375 | 3 | [
"MIT"
] | permissive |
function getRandomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min; //The maximum is exclusive and the minimum is inclusive
}
function pickRandomProperty(obj) {
var result;
var count = 0;
for (var prop in obj)... | true |
59e8d934a13eead395eaa6af9d3325817ce2ddd3 | JavaScript | rjlowes/retail-rockstars-reloaded | /app/server/modules/customer/models/customer.model.js | UTF-8 | 814 | 2.5625 | 3 | [] | no_license | 'use strict';
const mongoose = require('mongoose');
const bcrypt = require('bcrypt');
let CustomerSchema = mongoose.Schema({
email: String,
password: String,
title: String,
firstname: String,
lastname: String,
fullname: String
});
/**
* Generate a password hash
*/
CustomerSchema.methods.gen... | true |
0305d61f244b2fc0a52b0c0ae446ab1464088ff5 | JavaScript | AleksanderSem/react | /hw_react_02/src/sort.js | UTF-8 | 301 | 3.015625 | 3 | [] | no_license | const customSort = (array, order = "default") => {
const sortArr = [...array];
sortArr.sort((a, b) => {
if (order === 'default') return sortArr;
if (order === 'asc') return a.age - b.age;
if (order === 'desc') return b.age - a.age;
})
return sortArr;
}
export default customSort; | true |
030f381a5de9f6af02e299c8cd0443ed05c4ea17 | JavaScript | VasyaStelmah/Laboratory | /pdp/TASKS/16_search.js | UTF-8 | 944 | 3.640625 | 4 | [] | no_license | //============== Array [ A simple search (case-sensitive)]
{
const persons = [
{ id: 1, name: "Karl", age: 24, group: "editor" },
{ id: 2, name: "Poul", age: 32, group: "admin" },
{ id: 3, name: "John", age: 42, group: "editor" },
{ id: 4, name: "Mark", age: 25, group: "admin" },
... | true |
4be9cd3d162f2090abab98d337ff1af0414e001b | JavaScript | huntingtonnet/project | /Demos/ClientSide/Resource/ClientSideScript.js | UTF-8 | 3,811 | 3.765625 | 4 | [] | no_license | function calculate() {
var inputNumber = document.getElementById("numberInput").value;
if (!isNaN(inputNumber)) {// is a number
if (inputNumber >= 2 && inputNumber <= 10) {
var count = compute(inputNumber);
document.getElementById("Message").innerHTML = '<label class="success">T... | true |
6c389b04540496d887127226ad574fe43452a586 | JavaScript | ganchevdimitarg/JS-Applications | /Modular Applications/Team-Manager/src/views/create.js | UTF-8 | 2,049 | 2.625 | 3 | [] | no_license | import {html} from "../../node_modules/lit-html/lit-html.js";
import {createTeam} from "../api/data.js";
const createTemp = (onSubmit, errorMsg) => html `
<section id="create">
<article class="narrow">
<header class="pad-med">
<h1>New Team</h1>
</header>
... | true |
6e5ad57d2ed897aee82fd88f8f8d491f400530de | JavaScript | dbouwman/site-differ | /checkCss.js | UTF-8 | 2,354 | 2.6875 | 3 | [] | no_license | /**
* We have found some sites with css resources that are borked.
* This script fetches all of them, then checks if they are css or not
*/
let siteService = require('./lib/sites');
var config = require('./lib/config');
var async = require('async');
var jsonfile = require('jsonfile');
var Logger = require('./lib/log... | true |
ed53dcc2cfff272abacda56803240d9aa6b8ef48 | JavaScript | suhrudhDev/my-golden-game | /sketch.js | UTF-8 | 1,181 | 2.875 | 3 | [] | no_license | var soldier, scene1, soldierimg, soldier1img;
var weapon;
var level = 1;
function preload() {
scene1 = loadImage("images/city1.png");
scene2 = loadImage("images/army camp.jpg");
soldierimg = loadImage("images/soldier.png");
soldier1img = loadImage("images/Hammer.png");
}
function setup() {
canva... | true |
1a2116c9fa45ce964a87bf7879a03ade48681c1f | JavaScript | joseMarciano/chat-html-css-JS | /index.js | UTF-8 | 1,025 | 3.171875 | 3 | [] | no_license | const $ = document.querySelector.bind(document);
const btnSendMessage = $('[data-btn-send]');
const template = (message) => {
return `
<div class="chat-container__chat inverse">
<img class="img__profile" src="./assets/img/profile1.png" alt="Imagem de perfil do usuário">
<span class="phrase-chat-contain... | true |
6a75e2934fb700cfd9d30f8802eae101cafec98b | JavaScript | Beav401/CS290 | /Assignment5/server.js | UTF-8 | 1,328 | 2.578125 | 3 | [] | no_license | /*
* Write your routing code in this file. Make sure to add your name and
* @oregonstate.edu email address below.
*
* Name:
* Email:
*/
var path = require('path');
var express = require('express');
var exphbs = require('express-handlebars');
var app = express();
var port = process.env.PORT || 3004;
var twitDa... | true |
bb8e9aa400ca2c36ec869d19be5d7327bd7baf5c | JavaScript | munozadri/Challange-Fullstack | /backend/controllers/user.js | UTF-8 | 1,670 | 2.671875 | 3 | [] | no_license | 'use strict'
var bcrypt = require('bcrypt-nodejs');
var User = require('../models/user');
var jwt = require('../services/jwt');
function saveUser(req, res){
var params = req.body;
var user = new User();
if(params.name && params.surname && params.email && params.password){
user.name = params.name;
user.surname... | true |
87750962e81c96cb6df0a54c3454d733bfb25e8f | JavaScript | maksdk/kata | /mvc/06/src/solution2.js | UTF-8 | 4,138 | 2.671875 | 3 | [] | no_license | //@ts-check
// import 'core-js/stable';
// import 'regenerator-runtime/runtime';
// import _ from 'lodash';
// import { watch } from 'melanke-watchjs';
import axios from "axios";
// Never hardcore urls
const routes = {
usersPath: () => '/users',
}
const errorMessages = {
email: {
valid: 'Value is not... | true |
5f0e8a5e49309dc6d4e8a2e01095f08712fe07a4 | JavaScript | millerkatiej/NSS-FrontEnd | /2013-10-01-jQuery-Checking-Account/js/main.js | UTF-8 | 832 | 3.0625 | 3 | [] | no_license | $(document).ready(initialize)
var balance = 1000;
function deposit(balance, deposit_amt) {
return balance + deposit_amt;
}
function withdrawal(balance, withdrawal_amt) {
return balance - withdrawal_amt;
}
function initialize() {
$('#deposit').click(deposit_btn);
$('#withdrawal').click(withdrawal_btn);
}
fun... | true |
9f591f489aedfbfd3339551fcb1625b346e9b42a | JavaScript | DilmarJuniorCourses/Curso_Web_Moderno | /exercicio-web/objeto/objetoRevisao.js | UTF-8 | 1,213 | 4.1875 | 4 | [] | no_license | //O Objeto é uma coleção de pares chaves/valores
//Formas de criação do objeto:
const produto = new Object
produto.nome = 'Cadeira'
produto['Marca do produto'] = 'generica'
produto.preco = 220 //Podemos acessar um atributo de um objeto com o .
console.log(produto)
//Deletando Objetos
delete produto.preco
delete prod... | true |
c63ed591313cefa30ab704313da4b203d6a9a096 | JavaScript | carlfahl/loanApp | /static_handlers.js | UTF-8 | 1,865 | 2.6875 | 3 | [
"MIT"
] | permissive | //
// Carl A. Fahlstrom
//
var fs = require('fs');
var favicon = function (request, response, data, get_params, post_params, params, use_db, cbf)
{
response.writeHead(200, {'Content-Type': 'text/html'});
console.log('This is the favicon');
response.write('Skiped the favicon.');
response.end();
response.statusCod... | true |
2a363a266fecfc87cc8bae00115c3b41487666e7 | JavaScript | zxenlogics/zxenlogics.github.io | /src/js/src/dateBuilder.js | UTF-8 | 1,558 | 3.34375 | 3 | [] | no_license | export let dateBuilder = function() {
let days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
let date = new Date();
let locale = "en-us";
let newDate = function(d) {
let parts = d.split('-');
date = new Date(parts[0], parts[1] - 1, parts[2]... | true |
0dcf8ed03eea5afb473542f51d097cccb1dbe777 | JavaScript | pg222jx/Pandemaniac | /src/Tests/Highscore.test.js | UTF-8 | 1,062 | 2.578125 | 3 | [] | no_license | import React from 'react'
import ReactDOM from 'react-dom'
import { render } from '@testing-library/react'
import Highscores from '../components/Highscores'
describe('Testing the Highscores component', () => {
it('should render without crashing', () => {
const div = document.createElement('div')
... | true |
92ec5741a10be2a39ef52a69629ca6691d0bb9f7 | JavaScript | shalom-pwc/challenges | /05.Calculate-the-Profit/challenge.js | UTF-8 | 276 | 3.1875 | 3 | [] | no_license |
//Calculate the Profit
let profite = {
costPrice: 55,
sellPrice: 65,
invontory: 1500
};
function totalProfite(profite){
return (profite.sellPrice * profite.invontory) - (profite.costPrice * profite.invontory);
}
console.log(totalProfite(profite));
| true |
beafeb1bc2a0669673d878c9a1e83165de48928a | JavaScript | ManishPoduval/wdft-may21-react-day-3 | /src/components/Items.jsx | UTF-8 | 1,877 | 2.796875 | 3 | [] | no_license | import React, { Component } from 'react'
import AddForm from './AddForm'
import ItemDetail from './ItemDetail'
class Items extends Component {
// Our props will look like this
// available in `this.props`
/*
{
books: [{}, {}, {}],
handleAddTotal: func
}
*/
state = {
... | true |
219c67779394e2f7c3ec3fa86fb79e5079a39683 | JavaScript | JonyEpsilon/gorilla-repl | /resources/gorilla-repl-client/js/renderer.js | UTF-8 | 3,742 | 2.84375 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | /*
* This file is part of gorilla-repl. Copyright (C) 2014-, Jony Hudson.
*
* gorilla-repl is licenced to you under the MIT licence. See the file LICENCE.txt for full details.
*/
/* Takes a data structure representing the output data and renders it in to the given element. */
var render = function (data, element,... | true |
84c4026b59adfb18863bd87c78cabbc1e8b2a2a7 | JavaScript | Joyee/Leetcode | /02_linkedlist/SinglyLinkedList.js | UTF-8 | 2,220 | 3.96875 | 4 | [] | no_license | /**
* 单链表的插入、删除和查找
*/
class Node {
constructor(value) {
this.value = value
this.next = null
}
}
class LinkedList {
constructor() {
this.head = new Node('head')
}
// 根据value查找节点
findByValue (value) {
let currentNode = this.head.next
while (currentNode !== null && currentNode.value !=... | true |
e298ab20aaae19d2c8c4df7f4e86f8bc84fb835d | JavaScript | StrongeLeeroy/freecodecamp-solutions | /bonfires/basic-algorithm-scripting/25-missing-letters.js | UTF-8 | 338 | 3.859375 | 4 | [] | no_license | function fearNotLetter(str) {
var first = str.charCodeAt(0);
var missing = undefined;
for (var i = 1; i < str.length; i++) {
console.log(str.charCodeAt(i));
if (str.charCodeAt(i) != str.charCodeAt(i - 1) + 1) {
missing = String.fromCharCode(str.charCodeAt(i) - 1);
}
}
return missing;
}
fear... | true |
5d657d1bc249d8096d2c390349d3b77e9ae6b296 | JavaScript | GrahamSmith96/Blockchain-Project | /Blockchain Project/Blockchain.js | UTF-8 | 304 | 2.609375 | 3 | [] | no_license | //get the proof of work as the 'heartbeat' of the blockchain
class Blockchain {
constructor() {
this.blocks = [];
}
addBlock(block) {
this.blocks.push(block);
}
blockHeight() {
return this.blocks.length;
}
}
module.exports = Blockchain;
| true |
3c40e2604d3019ed25cf402810f1f2629bca8fb2 | JavaScript | JoshuaCochran/Undertiers | /frontend/src/components/MapTest/CustomButton.js | UTF-8 | 614 | 2.71875 | 3 | [
"MIT"
] | permissive | import React, { useState } from "react";
import Button from "@material-ui/core/Button";
import { makeStyles } from "@material-ui/core/styles";
const useStyles = makeStyles(theme => ({
button: {
color: "white"
}
}));
export default function CustomButton({ name, func }) {
const classes = useStyles();
const ... | true |
e4c53ee7c1a9b348c11a617032b9004620107d3b | JavaScript | newyork-anthonyng/leetcode | /easy/566_ReshapeTheMatrix/index.js | UTF-8 | 1,938 | 4.0625 | 4 | [] | no_license | /*
* You're given a matrix represented by a two-dimensional array,
* and two positive integers r and c representing the row number and column
* number of the wanted reshaped matrix, respectively.
*
* The reshaped matrix need to be filled with all the elements of the original
* matrix in the same row-traversing or... | true |
85a09f1cab01d3f95187378d5d60e5388be233d2 | JavaScript | naumov-web/openapi-core-react | /src/store/auth/reducer.js | UTF-8 | 1,010 | 2.53125 | 3 | [] | no_license | import Immutable from 'seamless-immutable';
import { SET_IS_LOGGED, SET_IS_LOADING, SET_ERROR_MESSAGES } from './actionTypes';
import { getToken } from '../../utils/local_storage/token';
// Initial state
const initialState = Immutable({
error_messages: {},
is_logged: Boolean(getToken()),
is_loading: false
});
/... | true |
610346e21af83a6de3862466e13aa07e6721ac25 | JavaScript | aberenjian89/Challange | /javascript/rotate.js | UTF-8 | 165 | 3.296875 | 3 | [] | no_license | function rotate(s, len) {
for (let i = 0; i < len; i++) {
s = s[s.length - 1] + s.substr(0, s.length - 1);
}
return s;
}
console.log(rotate("Hello", 4));
| true |
44fc92f67d69f7a58d44642557fe105015140409 | JavaScript | TimothyOzeruga/films | /assets/js/dist/Animal.dev.js | UTF-8 | 1,188 | 2.78125 | 3 | [] | no_license | "use strict";
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enu... | true |
05983e3f4775fcd4acc31abbf37c0bbf4043d17b | JavaScript | stanleyisyoung/nh_frontend | /src/App.js | UTF-8 | 2,290 | 2.8125 | 3 | [] | no_license | import React, { Component } from 'react';
import './App.css';
class App extends Component {
constructor(props) {
super(props);
this.state = {
error: null,
isLoaded: false,
doctors: {},
selectedDoctor: null,
};
}
componentDidMount = async () => {
await fetch('http://localho... | true |
533221c687f48ff617936330c1428b37b974cc4d | JavaScript | EricaH-E/StudentCampuses_front | /src/components/studTemp.js | UTF-8 | 437 | 2.59375 | 3 | [] | no_license | import React from 'react';
//passing the state
const studTemp = ({studentList}) => {
//student is just a parameter
const studentId = studentList.map((student) => {
return(
<li key={student.student_id} student={student.first_name} student={student.last_name}>
</li>
);... | true |
10f825490d9e766c9dbcdd1584908b91965da24a | JavaScript | amarcatovic/React-Redux | /src/pages/home.js | UTF-8 | 1,396 | 2.515625 | 3 | [] | no_license | import { useState } from 'react';
import Form from 'react-bootstrap/Form';
import Button from 'react-bootstrap/Button';
import Container from 'react-bootstrap/Container';
import { useHistory } from "react-router-dom";
import { useDispatch } from 'react-redux';
import * as carActions from '../actions/cars';
const Home... | true |
07a06ed7218d8683e7d230696ae51753456195b2 | JavaScript | jpaik/stopwatch | /stopwatch.js | UTF-8 | 2,959 | 3.421875 | 3 | [] | no_license | var time = {'minutes': 0, 'seconds': 0, 'centiseconds': 0};
var timer, running = false, mode = "normal", tournamentStop = false;
var timeDiv = document.getElementById('time'); //Span that hold time string
var modeButton = document.getElementById('mode'); //Clicking mode
document.addEventListener('keydown', handleTimer... | true |
d4325258d83533b385a9114ec14ed571015f997c | JavaScript | JeffreyAsuncion/javascript_review | /js/youtube037.js | UTF-8 | 541 | 3.171875 | 3 | [
"MIT"
] | permissive | {
let grades = [12, 43, 17];
console.log(grades[2]);
let grades2 = [12, "c", {}, function(){console.log("hello")}];
grades2[3]();
let grades3 = [];
grades3[0] = 12;
grades3[1] = 43;
grades3[40] = 2;
console.log(grades3); //(41) [12, 43, empty × 38, 2]
for (let i = 0; i < grad... | true |
1881b2ab621a54d9d799675602e45085264c6362 | JavaScript | asaeed/IsoCubes | /js/blockSelector.js | UTF-8 | 1,989 | 2.8125 | 3 | [
"MIT"
] | permissive |
// various ways to select blocks
// this was separated out from blockGridController
// caller should pass appropriate scope to these functions using .call(scope, params...)
// these functions in turn pass along scope to callback
exports.forAllBlocks = function(callback) {
for (var a = 0; a < this.gridSizeX... | true |
e228e3bd70ea4f1e49e1d4250c8ca9d797b2e6f3 | JavaScript | Aznachang/coding-problems | /removeDuplicates.js | UTF-8 | 560 | 3.34375 | 3 | [] | no_license | var removeDuplicates = (num) => {
if (Array.isArray(num)) {
let result = [];
let storage = {};
for (let i=0; i<num.length; i++) {
if (!storage[num[i]]) {
result.push(num[i]);
storage[num[i]] = num[i];
}
}
return result;
} else if (typeof num === 'string'... | true |
9cfbb3860dbfcdf963359b251d0c96e87c40c732 | JavaScript | R2D221/LabWeb-Flashcards | /public_html/js/profesor.js | UTF-8 | 1,104 | 2.546875 | 3 | [] | no_license | $(document).ready(function(){
var miNombre,miUsuario, miContra, miCnfrm;
$("#alta").click(function(){
miNombre=$("#nombre").val();
miUsuario=$("#usuario").val();
miContra=$("#contra1").val();
miCnfrm=$("#contra2").val();
if(miCnfrm != "" && miN... | true |
7f222c273e4f605a34d0662cebecbcd4465b4ee8 | JavaScript | katerinafedotova/covid-dashboard | /src/index.js | UTF-8 | 4,873 | 2.609375 | 3 | [] | no_license | import './style.css';
import createMap from './map/createMap';
import createDomElement from './utils/createDomElement';
import generateList from './list/generateList';
import searchCountry from './list/searchCountry';
import transformData from './utils/transformData';
const globalCases = createDomElement('span', 'case... | true |
096392082975a45fbc04c40d999e7cda28701747 | JavaScript | millionape/SCB-Pre-Assignment | /controllers/bookController.js | UTF-8 | 625 | 2.640625 | 3 | [] | no_license | var exports = module.exports = {};
// import publisher services
const publisherService = require("../services/bookPublisherServices")
exports.getBooks = async function (req, res) {
var allBooks = await publisherService.getAllBooks();
var recomendedBooks = await publisherService.getRecomendedBooks();
recom... | true |
dd378a2008a9882184d30c9efd1efcdf208cb14d | JavaScript | habonn/covid19-app | /src/App.js | UTF-8 | 2,784 | 2.65625 | 3 | [] | no_license | import './App.css';
import React, { useState, useEffect, useCallback } from "react";
import ChartRace from 'react-chart-race';
import axios from 'axios';
import logoCovid from './Logo/covid-19.png'
import { Grid,Typography } from "@material-ui/core";
function App() {
const [data, setData] = useState([])
const [d... | true |
14cc93ec12f91e066d40b0c5974ddecc652673e1 | JavaScript | polysharp/my-shell-api | /src/middlewares/auth-guard.js | UTF-8 | 633 | 2.546875 | 3 | [
"MIT"
] | permissive | const jwt = require('jsonwebtoken');
const HTTP_CODE = require('http-status-codes');
const authGuard = (req, res, next) => {
let token;
const bearer = req.headers.authorization;
if (!bearer) return res.set(HTTP_CODE.UNAUTHORIZED).json({ msg: 'Access denied.' });
const parts = bearer.split(' ');
if (parts.... | true |
1b1bc096c097dec987b8ce67bec22561d046b33e | JavaScript | philcockfield/js-open.core_dev | /public/javascripts/open.core/trunk/code/testing/backbone_mock_ajax.js | UTF-8 | 3,152 | 2.53125 | 3 | [
"MIT"
] | permissive | goog.provide('core.testing.backbone');
goog.require('lib.backbone');
goog.require('lib.jasmine.mock.ajax');
/**
* Extends Backbone.js with helpers for mocking AJAX responses
* from Models via the 'fetch()' method.
*
* See:
* - Backbone.sync
* - jasmine-ajax
*/
Backbone.mock = function() {
var mockApi, moc... | true |
ee248915b1878a1782ddf7450fb410d295772e65 | JavaScript | tvdijen/OpenConext-engineblock | /theme/base/javascripts/wayf/utility/sortIdpMethods.js | UTF-8 | 2,192 | 3.5625 | 4 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import {getData} from '../../utility/getData';
/**
* Determine which of two idp elements alphabetically comes before the other.
* Sorts in ascending order.
* Titles are taken from the data-title attribute, which is lowercased in twig.
*
* @param firstElement
* @param secondElement
* @returns {number}
*/
export... | true |
6dc632b64efb85f73821ad0dd68ba513bd785f37 | JavaScript | geosolutions-it/MapStore2 | /web/client/api/geoserver/About.js | UTF-8 | 2,010 | 2.609375 | 3 | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | /**
* Copyright 2019, GeoSolutions Sas.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/
import axios from '../../libs/ajax';
import { get, mapKeys, camelCase } from 'lodash';
let cache = {};
// transfo... | true |
5ed0b895802ab4a15cfe0cd517b4910a7fa10cc5 | JavaScript | Carnavos/Exercises | /mjd/cars/javascripts/manufactory.js | UTF-8 | 2,055 | 3.59375 | 4 | [] | no_license | 'use strict';
function Car () {
this.manufactured_date = Date.now();
};
function Make(maker) {
this.manufacturer = maker;
};
// prototype chaining
Make.prototype = new Car();
function Model (model) {
this.modelName = model;
};
// prototype chaining
Model.prototype = new Make();
let Toyota = new Make("Toyota")... | true |
7af48d4617f27e6ffae6ed6235e7b9c6c935fe4b | JavaScript | LiJingfeng98/OnlineShoppingPlatform | /js/search.js | UTF-8 | 4,300 | 2.859375 | 3 | [
"MIT"
] | permissive | var item = '';
var type = 1; //销量排序1,最新排序2,价格降序3,价格升序4
var page = 1;
var maxpage = 1;
//获取get参数方法
function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split("=");
if (pair[0] == variab... | true |