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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
7338ebb61adb36ae0a159d630e0043ccc4146272 | JavaScript | paulkunitsky/share-it | /client/src/utils/token-checker.js | UTF-8 | 1,578 | 2.703125 | 3 | [] | no_license | /* under development */
import AuthService from '@/services/AuthService'
import store from '@/store'
import notify from '@/utils/notify'
/**
* TokenChecker instance checks if token is valid
* checkEvery():
* runs check() recursively
* check():
* gets token from vuex state, makes request to server
* ... | true |
d5507f1b8194ed23468963dc280c7d58f650f652 | JavaScript | paiv/latynka | /src/js/jaaml.js | UTF-8 | 11,393 | 2.796875 | 3 | [
"MIT"
] | permissive |
const hex = require('./hex')
const fromCodePoint = (typeof String.fromCodePoint !== 'undefined') ?
String.fromCodePoint : String.fromCharCode
class JaamlParserError {
constructor(offset, message) {
this.offset = offset
this.message = message
}
toString() {
return `JaamlPars... | true |
ba2d97631816962e80fa17c9472cedfe498f89bb | JavaScript | daishagolden/rental-app | /src/components/Make.js | UTF-8 | 1,793 | 2.515625 | 3 | [] | no_license | import React from 'react'
class Make extends React.Component {
constructor(){
super();
this.state = {
products: []
}
}
componentDidMount(){
fetch('http://localhost:8000/api/product/make/' + this.props.match.params.make)
.then(results => resul... | true |
071420c4b520a9aaac346c7597bbb991c8d30445 | JavaScript | jescoevas/AppLibros | /back/controllers/user.controller.js | UTF-8 | 1,745 | 2.578125 | 3 | [] | no_license | const User = require('../models/user.model')
const Book = require('../models/book.model')
const bcryptjs = require('bcryptjs')
let userController = {}
userController.newUser = async (req, resp) => {
const { user, nickname } = req.body
const userFound = await User.find({user})
const nicknameFound = await U... | true |
04690bce83a8aee9d44618550be68ae1f532ba80 | JavaScript | sophistikaty/MonarchAtlas | /js/modal.js | UTF-8 | 5,590 | 2.875 | 3 | [] | no_license | // Create an immediately invoked functional expression to wrap our code
(function() {
// Define our constructor
this.Modal = function() {
// Create global element references
this.closeButton = null;
this.modal = null;
this.overlay = null;
// this.finished = modalBuilt();
// Dete... | true |
7ec965a6007d2a6ba468b5800e91b366945b475b | JavaScript | elpinsaputra1993/nodejsdasar1 | /index2.js | UTF-8 | 2,052 | 2.671875 | 3 | [] | no_license | // const fs = require("fs");
// const http = require("http");
// const textnya = fs.readFileSync("./hello.txt", "utf-8");
// console.log(textnya);
// const tulisan = " ini tulisan yang ditambahkan";
// fs.writeFileSync("./testoutput.txt", tulisan);
// const server = http.createServer((req, res) => {
// console.lo... | true |
ea9a361b038f5e0e1457a7d9320db7330fab9ca7 | JavaScript | Brooke-Horrocks/V-School-Assignments | /exercises/loops-and-arrays-practice/app.js | UTF-8 | 1,866 | 3.40625 | 3 | [] | no_license | var peopleWhoWantToSeeMadMaxFuryRoad = [
{
name: "Mike",
age: 12,
gender: "male"
},{
name: "Madeline",
age: 80,
gender: "female"
},{
name: "Cheryl",
age: 22,
gender: "female"
},{
name: "Sam",
age: 30,
gender: "male"
},{
na... | true |
c774a3ea0101dad935fb7d466eb69749ce65e813 | JavaScript | toddg3s/freccamp | /template/site/js/jquery.rd-calendar.js | UTF-8 | 12,302 | 2.625 | 3 | [
"BSD-3-Clause",
"MIT"
] | permissive | /**
* RD Calendar
* @version 1.0.0
* @author Evgeniy Gusarov (Stmechanus | Diversant)
* @license The MIT License (MIT)
*/
;
(function ($, window, document, undefined) {
'use strict';
/**
* Creates a calendar.
* @class The RD Calendar.
* @public
* @param {HTMLElement|jQuery} element - ... | true |
788d9ad196d1f38ecd26c7a49dea1c7c681ddf1c | JavaScript | caiotorrez/instagram-clone-vue | /src/api/client.js | UTF-8 | 367 | 2.546875 | 3 | [] | no_license | export const getStories = () => {
return fetch("https://jsonplaceholder.typicode.com/users")
.then((response) => response.json())
.then((json) => {
return json;
});
};
export const getPosts = () => {
return fetch("https://jsonplaceholder.typicode.com/posts")
.then((response) => response.json())... | true |
2ed07feb8c8dd6802b763f989b7cc1858b85adff | JavaScript | dested/react-native-safe-style | /dist/utils.js | UTF-8 | 1,243 | 2.765625 | 3 | [
"MIT"
] | permissive | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.safeEntries = exports.safeKeys = exports.fromEntries = void 0;
exports.fromEntries = Object.fromEntries ||
function fromEntries(iterable) {
var entries = Array.isArray(iterable)
? createEntries(iterable)
... | true |
ebb31596aacb14fe9b851769ecae4977a88f7086 | JavaScript | Erkomxtil/OpenClassRoom | /chapitre_07/js/ballon.js | UTF-8 | 957 | 3 | 3 | [] | no_license | let demarrer = document.getElementById("demarrer")
let arreter = document.getElementById("arreter")
let vitesse = 5
let direction = 1
let interval = null
let cadre = document.getElementById("cadre")
let ballon = document.getElementById("ballon")
let largeurCadre = parseFloat(getComputedStyle(cadre).width)
let largeurBa... | true |
9a0338077efd598e3c52dd72b3cbc9916aac2970 | JavaScript | zhangbenber/logical-json | /test/functions.logic.test.js | UTF-8 | 4,202 | 2.984375 | 3 | [] | no_license | const assert = require('assert');
const LogicParser = require('../');
describe('Logic Functions', () => {
describe('`and` function', () => {
let parser = new LogicParser({
n: [[0, 'and']],
i: [[1, 'a'], [2, 'b'], [3, 'c']],
o: [[4, 'o']],
l: [[1, [0, 'i... | true |
5f6339a71c4315d18d78f4ef7f6c0ca73b48dd47 | JavaScript | jelenaDedskin/telephony_server | /app/helpers/stateHandler.js | UTF-8 | 678 | 2.671875 | 3 | [] | no_license | const stopped = 'STOPPED';
const paused = 'PAUSED';
const started = 'STARTED';
let state = stopped;
const isValidStateSwitch = (value) => {
switch (value) {
case started:
return state !== started;
case stopped:
return state !== stopped;
case paused:
return state === started;
default... | true |
9ca706f0a41dfc71e0d45766f7cc8c9bcc95d89d | JavaScript | amir-hossein-mohammadi/class-employee-js | /js/scripts.js | UTF-8 | 1,067 | 3.484375 | 3 | [] | no_license | class Employee{
constructor(
fullName ,
age ,
nationalId ,
employmentId ,
grade ,
workExperience ,
salary ,
retirement
){
this.fullName = fullName;
this.age = age;
this.nationalId = nationalId;
this.employmentId... | true |
0790c1f5ebeb3f09d8d8ef7aa4fc839322430fd8 | JavaScript | Rachit-3850/Devsnest-THAs | /Day27/todo/src/reducers/count.js | UTF-8 | 315 | 2.71875 | 3 | [] | no_license |
const userReducer = (state=[], action) => {
if(action.type === "UPDATE_ADD") {
return [...state , action.payload]
}
if(action.type === "DELETE_ITEM") {
return state.filter((item,index) => index !== action.payload)
}
return state
}
export default userReducer | true |
a49b131f6c561cbf6596c55356248a72d6aa4c1a | JavaScript | keepitreal/babel-plugin-js-macros | /test/fixtures/break-in-loop.expected.js | UTF-8 | 1,588 | 2.953125 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive |
export default function demo() {
const _arr = [1, 2, 3];
let _some;
_SOME: {
var _result = false,
_ended = false;
if (!_arr.length) {
_some = _result;
break _SOME;
}
for (var _i = 0; _i < _arr.length; _i++) {
if (_arr[_i] > 2) {
_result = true;
break;
... | true |
2bd90fc1a4f46a81d864def1299bb15f3e4f5efe | JavaScript | neighlyd/expensify-app | /src/selectors/expenses-total.js | UTF-8 | 498 | 2.734375 | 3 | [] | no_license | const expenses = [{
id: '1',
description: 'Gum',
note: '',
amount: 195,
createdAt: 0
}, {
id: '2',
description: 'Rent',
note: '',
amount: 999,
createdAt: -1000
}, {
id: '3',
description: 'Lunch',
note: '',
amount: 150,
createdAt: 1000
}]
export default ((expe... | true |
1a9dfc57624620b7f4559433b60c8bab8456576f | JavaScript | Augmentedjs/presentation-table | /src/functions/pagination.js | UTF-8 | 1,024 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive | /*
* << First | < Previous | # | Next > | Last >>
*/
export const directDOMPaginationControl = (el, currentPage, totalPages) => {
let d, n, t;
d = document.createElement("div");
d.classList.add("paginationControl");
n = document.createElement("span");
n.classList.add("first");
t = document.createTextNode... | true |
9fbd0b76e6ac8df03acd6a6ddfecbde41b30a373 | JavaScript | zacharylandes/geda_ride | /app/assets/javascripts/map/gmap.js | UTF-8 | 1,983 | 2.765625 | 3 | [
"MIT"
] | permissive |
var rideDistance = 0;
function initMap() {
var directionsService = new google.maps.DirectionsService;
var directionsDisplay = new google.maps.DirectionsRenderer;
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 3,
center: {lat: 41.85, lng: -87.65}
});
directionsDisplay.setMap(... | true |
0b6e8ec68b5d9e62123b3ae9a4352de8d5bc7cdb | JavaScript | roukaour/s-your-reality-my-own | /script.user.js | UTF-8 | 13,041 | 2.890625 | 3 | [
"MIT"
] | permissive | // ==UserScript==
// @name s/your reality/my own/
// @namespace https://github.com/roukaour/
// @description I reject your reality and substitute my own!
// @include *
// @version 1.1
// @grant none
// @run-at document-end
// ==/UserScript==
function handleText(textNode) {
var v... | true |
decfc0349d5a5b2603c49c31c1e2c5e2050a9875 | JavaScript | yyfx168/webcalendar | /calendar.js | UTF-8 | 2,467 | 3.609375 | 4 | [] | no_license | /* calendar.js */
var daysInMonthLeap = [31,29,31,30,31,30,31,31,30,31,30,31]; // 闰年
var daysInMonthNormal=[31,28,31,30,31,30,31,31,30,31,30,31]; // 非闰年
var monthName=["January","Febrary","March","April","May","June","July","Auguest","September","October","November","December"];
var container = document.getEle... | true |
3bbdddb1577725285e382474217cf506efed2b58 | JavaScript | ayunas/LambdaTimes-PM | /index.js | UTF-8 | 728 | 3.15625 | 3 | [] | no_license | const dateTag = document.querySelector('span');
// const date = new Date();
// dateTag.textContent = `${date.getMonth()}/${date.getDate()}/${date.getFullYear()}`;
const date = moment().format('MMM Do YYYY');
dateTag.textContent = date;
//attempt to do an GET request in Vanilla Javascript using XMLHttpRequest(); CORS ... | true |
bb21a5759115d214e80f7f5b0231c8386fef0170 | JavaScript | kvirma/randomColorGenerator | /script.js | UTF-8 | 589 | 3.6875 | 4 | [] | no_license |
let body = document.querySelector('body')
let btn = document.querySelector('#btn')
let h1 = document.querySelector('#h1')
function changeColor(){
let rgb1 = Math.floor(Math.random() * 256)
let rgb2 = Math.floor(Math.random() * 256)
let rgb3 = Math.floor(Math.random() * 256)
let newColor = `rgb(${rgb1}... | true |
8ff58480023917303a0a12aa8a2f8ed29fd57122 | JavaScript | BruceWeng/Leetcode-JavaScript | /547. Friend Circles.js | UTF-8 | 3,432 | 4.0625 | 4 | [] | no_license | /**
There are N students in a class. Some of them are friends, while some are not.
Their friendship is transitive in nature. For example, if A is a direct friend
of B, and B is a direct friend of C, then A is an indirect friend of C. And we
defined a friend circle is a group of students who are direct or indirect fr... | true |
db03fcf4262021b5f0b9468a361efa7236c5f673 | JavaScript | asjson/react-delicacies | /src/utils/__tests__/tools_test.js | UTF-8 | 13,598 | 2.734375 | 3 | [] | no_license | /*
* @Author: 廉恒凯
* @Date: 2020-01-12 06:39:48
* @LastEditTime: 2020-09-12 10:08:45
* @LastEditors: 廉恒凯
* @Description: test Utils
* @FilePath: /react-delicacies/src/utils/tests/tools.test.js
*/
import * as tools from '../tools';
let undefinedVar;
describe('tools utils', () => {
describe('isString', () => {... | true |
a5ae7805481fd1a24417d1e0396323c8c5dc6dac | JavaScript | siphesande/ITEMISED-BILL | /products.js | UTF-8 | 1,503 | 3.203125 | 3 | [] | no_license |
var fs = require("fs");
// two Asyncronous methods:
module.exports = function(filePath){
this.productNames = function(callback){
var productList = [];
var fileContent = fs.readFileSync(filePath, "utf8");
var rows = fileContent.split('\n');
var productMap = {};
rows.... | true |
16febe6dc001bf0c58f8ae02aac8e5fd32f24301 | JavaScript | madoos/functional-javascript-workshop | /examples/src/core.js | UTF-8 | 778 | 3.328125 | 3 | [
"MIT"
] | permissive | // curryN :: Number → (* → a) → (* → a)
const curryN = (n, f) =>
function curried(...args) {
return args.length >= n
? f(...args)
: (...rest) => curried(...args, ...rest)
}
// curry :: (* → a) → (* → a)
const curry = f => curryN(f.length, f)
// compose2 :: (b -> c) -> (a -> b) -> (a -> c)
const c... | true |
352b6e1b7db3ac2eb80732c87ade9b6e34d2c8b2 | JavaScript | Maxim-Savchuk/practize-react-5 | /src/components/PokemonInfo/PokemonInfo.jsx | UTF-8 | 1,606 | 2.84375 | 3 | [] | no_license | import { Component } from "react";
export class PokemonInfo extends Component {
state = {
pokemon: null,
error: null,
status: 'idle',
}
componentDidUpdate(prevProps, prevState) {
const nextName = this.props.pokemonName;
const prevName = prevProps.pokemonName;
... | true |
88d058057c69b2ca7753195b65b6cea8a0c6655c | JavaScript | BobbyOldani/11-Express-Homework | /public/assets/js/noteclass.js | UTF-8 | 355 | 2.703125 | 3 | [] | no_license | const fs = require("fs");
class Notepad {
writeToJson(newNote) {
fs.readFile("db.json", function (err, data) {
let jsonData = JSON.parse(data);
jsonData.append(newNote);
JSON.stringify(jsonData);
fs.writeFile("db.json", jsonData);
})
}
... | true |
31dc4fb8fe292bd1a7b6e3bb410e3b8785698a1d | JavaScript | berengers/WeatherDashboard | /front/src/js/utils/index.test.js | UTF-8 | 896 | 2.71875 | 3 | [] | no_license | import { displayUnit, convertSpeed } from './index'
describe('Utils', () => {
describe('displayUnit', () => {
it('return "°F" for imperial unit', () => {
expect(displayUnit('imperial')).toBe('°F')
})
it('return "°C" for metric unit', () => {
expect(displayUnit('metric')).toBe('°C')
}... | true |
78cbd478745ccd23d0d7d6afc15a2f94d1df376f | JavaScript | chris-dickson/neighbourhoods | /client/scripts/main.js | UTF-8 | 6,463 | 2.71875 | 3 | [
"MIT"
] | permissive | /**
* Created by cdickson on 8/24/14.
*/
var directionsDisplay;
var map;
var markers = [];
// Add a marker to the map and push to the array.
var addMarker = function(location,title) {
var marker = new google.maps.Marker({
position: location,
map: map,
title : title
});
markers.push(marker);
}
// Removes th... | true |
ffe0bd574cb35d05d47f5e42b9ff1eaac0d1e0ac | JavaScript | evrenesat/mouse-dictionary | /src/options/lib/utils.js | UTF-8 | 680 | 2.84375 | 3 | [
"CC-BY-SA-3.0",
"MIT",
"LicenseRef-scancode-public-domain"
] | permissive | /**
* Mouse Dictionary (https://github.com/wtetsu/mouse-dictionary/)
* Copyright 2018-present wtetsu
* Licensed under MIT
*/
export default {
decideInitialLanguage(languages) {
if (!languages) {
return "en";
}
const validLanguages = ["en", "ja"];
let result = "en";
for (let i = 0; i < l... | true |
258b5ca845a1a5cec978dfbf2b42e46862ff27c4 | JavaScript | awu100/claude | /src/bot/reaction/clearSale.js | UTF-8 | 1,388 | 2.875 | 3 | [] | no_license | async function clearSale({ message }, user) {
if (message.channel.name !== "sales-queue") {
return
}
if (message.mentions.users.has(user.id)) {
message.delete()
}
// early return check for total reactions?
const reactionUsers = await Promise.all(
message.reactions.map(... | true |
9488ad60797f3498dc9454a55990f744e66d498e | JavaScript | vasIvanov/JavaScript-Fundamentals | /JS DOM Manipulations/Table-Search-Engine/solution.js | UTF-8 | 918 | 3.03125 | 3 | [] | no_license | function solve() {
function containsQuery(array, query){
return array.filter(x => x.textContent.toLowerCase().includes(query)).map((x) => array.indexOf(x));
}
let tdValue = [];
Array.from(document.querySelectorAll('tbody tr td'))
.forEach(x => tdValue.push(x));
Array.from(docum... | true |
1113030c543b2408b700e060ee013b2cc3bfe737 | JavaScript | poorboi94/poorboi94-FrontEndNotes | /copyObject.js | UTF-8 | 593 | 3.65625 | 4 | [] | no_license |
const arr1 = [1, 2, 3];
const arr2 = Array.from(arr1);
arr2.push(3);
const arr3 = [ ...arr1 ];
arr3.push(19);
console.log(arr1);
console.log(arr2);
console.log(arr3);
const ob1 = {
first: 'rich',
last: 'last'
};
// deep copy
const ob2 = ob1;
ob2.mid = 'H';
// ways to shallow copy an object
const ob3 = JSO... | true |
4db0354c3faafa3faff2e85c5b5295dd4c3ff307 | JavaScript | atlantiz8/cag | /Ascentis.Ecommerce.BuddiesPortal/JS/libs/jquery.jsoncookie.js | UTF-8 | 949 | 2.71875 | 3 | [
"BSD-3-Clause"
] | permissive | (function ($) {
var isObject = function (x) {
return (typeof x === 'object') && !(x instanceof Array) && (x !== null);
};
$.extend({
getJSONCookie: function (cookieName) {
var cookieData = $.cookie(cookieName);
return cookieData ? JSON.parse(cookieData) : {};
},
setJSONCookie: function (cookieName, d... | true |
c787c24b5e8ac95ec3c48d77a87360885dc47432 | JavaScript | Ziges/Series-of-73-js-exercises | /04-dates/03-age-by-select/script.js | UTF-8 | 1,289 | 3.96875 | 4 | [] | no_license | /* becode/javascript
*
* /04-dates/03-age-by-select/script.js - 4.3: calculateur d'âge
*
* coded by leny@BeCode
* started at 26/10/2018
*/
// NOTE: don't focus on the existing code structure for now.
// You will have time to focus on it later.
(function () {
// your code here
document.getElementById("... | true |
758776048c858297df0b989498fd099e58e4038d | JavaScript | rcellas/redux-1 | /redux/src/actions/items.js | UTF-8 | 1,722 | 3.40625 | 3 | [] | no_license | /* el export nos permite que podamos usar la acción en otras partes del codigo*/
/* En hasErrored y IsLoading tenemos 2 action creators: bool (true/false) como argumentos y devuelven un objeto con un significado type
y el bool asignado a la propiedad*/
export function itemsHasErrored(bool){
return {
... | true |
eb149fd48722314314608cd789724235d69634e5 | JavaScript | DanielTotev/JavaScriptFundamentals | /RegexAndStringsLab/p11_simpleEmailValidation.js | UTF-8 | 211 | 2.8125 | 3 | [
"MIT"
] | permissive | function validate(potentialEmail) {
let emailPattern = /^[a-zA-Z0-9]+@[a-z]+\.[a-z]+$/g;
console.log(emailPattern.test(potentialEmail) ? 'Valid' : 'Invalid');
}
validate('valid@email.bg');
validate('invalid@emai1.bg'); | true |
cf204a33dd70f311de8bd6ad92a54d5b0cf6f461 | JavaScript | meet02/student-api | /utils/password-handler.js | UTF-8 | 3,294 | 2.953125 | 3 | [] | no_license | 'use strict';
var crypto = require('crypto');
var algorithm = 'aes-256-ctr';
var password = '0123456789abcdefghijklmnopqurstuvwxyzABCDEFGHIJKLMNOPQURSTUVWXYZ';
const {
generateString,
cardFormatter,
} = require('../utils/random-string-generator');
var self = module.exports = {
_saltLength: 16,
_saltSe... | true |
eaefe7908db12f420911214f7374dedee8162bfc | JavaScript | bota21/homework_58 | /homework_58_1/src/App.js | UTF-8 | 1,631 | 2.8125 | 3 | [] | no_license | import React, { Component} from 'react';
import { v4 as uuidv4 } from "uuid";
import './App.css';
import Form from './components/Form/Form';
import List from './components/List/List';
class App extends Component {
constructor(props) {
super(props);
this.onInputChange = this.onInputChange.bind(this);
this... | true |
010ac63c720439e45380628cdf426e9e09b282a8 | JavaScript | LopaB/OnlineShopping | /app/components/controllers/BasicController.js | UTF-8 | 789 | 2.53125 | 3 | [] | no_license | angular.module('CollaborationApp').controller('BasicController',function(BasicService,$scope){
var me=this;
me.user={};
//me.greeting='This message is comming from angular controller';
//if it resolve from backend then only the value would be assigned to this variable
/* BasicService.getGr... | true |
7eb33014d628999ba1b13021165258778b8aef2b | JavaScript | emilioJUA23/mongo_managment | /routes/api/v1/survey/answer.js | UTF-8 | 1,905 | 2.53125 | 3 | [] | no_license | const express = require('express');
const app = express();
const {
verificarToken
} = require('../../../../middleware/authentication');
var MongoClient = require('mongodb').MongoClient;
//declaracion de los servicios API
app.get("/api/v1/survey/answer",[verificarToken], (req, res) => {
GetSurveys().then(functi... | true |
fef09902267b9d15b940b9f338e2897a912dc23c | JavaScript | Apinkpig/- | /js/bullet.js | UTF-8 | 963 | 3.40625 | 3 | [] | no_license | /**
* 子类:子弹类
*/
var Bullet = function (opts) {
var opts = opts || {}
Element.call(this, opts);
}
//继承父类的方法
Bullet.prototype = new Element();
/**
* 方法:向上移动
*/
Bullet.prototype.fly = function () {
this.move(0, -this.speed);
return this;
}
/**
* 方法:绘制子弹线条
*/
Bullet.prototype.draw = function () {
... | true |
937fbcc88c08983fbfe1c9bd6a59616aef6e6182 | JavaScript | djordje47/contactmanager | /src/components/layout/Header.js | UTF-8 | 1,642 | 2.71875 | 3 | [] | no_license | // Imports React
import React from 'react';
// Imports prop-types
import PropTypes from 'prop-types';
//
import { Link } from 'react-router-dom';
// Creates functional component
const Header = props => {
const { branding } = props;
return (
<nav className="navbar navbar-expand-sm navbar-dark bg-success mb-3 py... | true |
31db1cffaf4a7a32518f1e7edc92d432e84e7ab7 | JavaScript | Joshua-Gaspar/Infinite-Scroll | /script.js | UTF-8 | 2,265 | 3.5 | 4 | [] | no_license | const imageContainer = document.getElementById('image-container');
const loader = document.getElementById('loader');
let readyToLoad = false;
let imagesLoaded = 0;
let totalImgLoaded = 0;
let photosArray = [];
let isInitialLoad = true
let initialCount = 5;
const apiKey='L4Qp5FS6iiEvAElP_iQIv2y0cGTvYqSJg62h3S7nsWM';
... | true |
70d605c2252fc606b12f39383e217e1b5006af17 | JavaScript | mickaelcampos/bridgeChallenge | /backend/src/routes.js | UTF-8 | 897 | 2.875 | 3 | [] | no_license | import { Router } from 'express';
const routes = new Router();
let requestId = 0; // this is used for 'generate' a id for result
function checkIsPrime(req, res, next) {
const isPrime = (num) => {
for(let i = 2; i < num; i++)
if(num % i === 0) {
return false
};
return num > 1;
}
... | true |
efb1cfc0dcf5a8ea0824e0e4a1467dba9919dbc6 | JavaScript | asmaafayed02/node-course | /notes-app/notes.js | UTF-8 | 1,593 | 3.046875 | 3 | [] | no_license | console.log('notes.js')
const chalk = require('chalk');
const fs = require('fs')
const getNotes = ()=> 'notes is ....';
const addNotes = function (title, body){
const notes = loadNotes()
const dataFilter = notes.filter((note)=> note.title === title)
debugger
if(dataFilter.length === 0){
notes.p... | true |
4fd6f3e92c4deb8242c16f6b1ff11e9a0bae9ee8 | JavaScript | TheAllen/Recherche-d-image | /Recherche D Image/Vanilla/main.js | UTF-8 | 1,318 | 3.125 | 3 | [] | no_license | const API_KEY = '12546187-917a6f0406e6efeddf50f9728';
const API_URL = `https://pixabay.com/api/?key=${API_KEY}`;
const form = document.querySelector('form');
//Input variable
const input = document.querySelector('input');
const loadingImage = document.querySelector('#loadingImage');
const imageSection = document.qu... | true |
bacf4a402bff0dda6548d336720839b957d23959 | JavaScript | Miles-Windu/unit-4-game | /assets/javascript/game.js | UTF-8 | 11,357 | 3.703125 | 4 | [] | no_license | // Create Variables for each random event on the page.
var computerGuess = Math.floor(Math.random() * 120) +19;
var rubyGuess = Math.floor(Math.random() * 12) +1;
var sapphireGuess = Math.floor(Math.random() * 12) +1;
var crystalGuess = Math.floor(Math.random() * 12) +1;
var emeraldGuess = Math.floor(Math.random() * ... | true |
3f2a0682c59a80bbc7745a632c378bd555e43ff5 | JavaScript | Lazlov/RiotApi | /frontend/src/components/PlayerStats.js | UTF-8 | 693 | 2.734375 | 3 | [] | no_license | import React from "react";
export const PlayerStats = ({ stats }) => {
const winrate = (w, l) => {
const wr = (parseInt(w, 10) / (parseInt(l, 10) + parseInt(w, 10))) * 100;
return Math.round(wr);
};
return (
<div className="container">
<div>{`Ranked ${stats.queueType.split("_")[1].toLocaleLow... | true |
6da9b58507d7750ee747ea5c4a3b4830861f9bdf | JavaScript | eddie0329/Study__JavaScript | /Study__DataStructure/queue.js | UTF-8 | 743 | 4.46875 | 4 | [] | no_license | class Queue {
constructor() {
this.queue = [];
}
enqueue(element) {
this.queue.push(element);
return this;
}
dequeue() {
return this.queue.shift();
}
front() {
return this.queue[0];
}
isEmpty() {
return this.queue.length === 0;
}
circuit() {
this.queue.forEach((ele... | true |
3e7dc011f043d412b94b9f9e6fbd7ee62c011ef4 | JavaScript | konstantin-kolomiets/fe_course | /4. Asynchronous_JS_part2/4. Async_Await/app.js | UTF-8 | 785 | 3.40625 | 3 | [] | no_license | // function getTodo3(id) {
// return Promise.resolve().then(() => {
// const [userType, userId] = id.split('-');
// return fetch(`https://jsonplaceholder.typicode.com/users/${userId}`)
// .then(response => response.json());
// })
// }
async function getTodo(id) {
try {
... | true |
ce63b6284760a4036add921bec85d867799173f9 | JavaScript | sdl60660/nba_origins | /static/js/timeline.js | UTF-8 | 1,657 | 2.890625 | 3 | [
"MIT"
] | permissive |
Timeline = function(_parentElement) {
this.parentElement = _parentElement;
this.initVis();
}
Timeline.prototype.initVis = function() {
var vis = this;
// Create an SVG inside of hidden slider element, but with additional height so ticks are visible
vis.svg = d3.select(vis.parentElement)
... | true |
1c1287d1744825f04ec1f2d429f55be0af82cfea | JavaScript | KapilYaswanth/calendar | /src/reducers/index.js | UTF-8 | 491 | 2.640625 | 3 | [] | no_license | import {createStore,combineReducers} from 'redux'
const INITIAL_STATE={isSignedIn:null,payload:null}
const authReducer= (state=INITIAL_STATE,action)=>{
switch(action.type)
{
case 'SIGN_IN':
return {...state,isSignedIn:true,payload:action.payload}
case 'SIGN_OUT':
return... | true |
2444612320b6805862d68be61f1d8f8a902801a1 | JavaScript | jwfe/util.js | /libs/function.js | UTF-8 | 256 | 2.703125 | 3 | [] | no_license | /**
* 是否函数
* @module utils/function
* @param {Function} dirtyFunction 函数对象
* @returns {Boolean} 是否函数类型
*/
exports.is = (dirtyFunction) => {
return Object.prototype.toString.call(dirtyFunction) === '[object Function]';
} | true |
dd3cb1695f6043c5035423d5288a42bbe98d0d30 | JavaScript | itswithk/Project-2 | /efectos.js | UTF-8 | 494 | 2.890625 | 3 | [] | no_license | const nombreCancion1 = () =>{
/* let nombre = "Lalala";*/
alert(Lalala);
}
const nombreCancion2 = () =>{
let nombre = "Pogo";
alert(nombre);
}
const nombreCancion3 = () =>{
let nombre = "Spaceships";
alert(nombre);
}
const nombreCancion4 = () =>{
let nombre = "Monalisa";
alert(n... | true |
65b57b4e96fe27567abe20765bf78be1786eeaad | JavaScript | Take-22/js3_takeuchi_15 | /js/entry.js | UTF-8 | 8,651 | 3.1875 | 3 | [] | no_license | // Your web app's Firebase configuration
var firebaseConfig = {
apiKey: "AIzaSyDnQWu3iIQ1wtQaSqOSECb9zwN1l3KerCU",
authDomain: "gsdemo-73ced.firebaseapp.com",
projectId: "gsdemo-73ced",
storageBucket: "gsdemo-73ced.appspot.com",
messagingSenderId: "921699418572",
appId: "1:921699418572:we... | true |
9823a0b90017dcce922a584c0c7ba92ccfa262b8 | JavaScript | matthewmorgan/veni-vidi-vici | /roman-numerals.spec.js | UTF-8 | 3,092 | 3.28125 | 3 | [] | no_license | import RomanNumerals from './roman-numerals';
const roman = new RomanNumerals();
describe('RomanNumerals', () => {
function convert(n) { return roman.fromDecimal(n) }
it('converts 1 to I', () => {
expect(convert('1')).toEqual("I");
});
it('converts 2 to II', () => {
expect(convert('2')).toEqual("II... | true |
a37287b803105aa7c254efe105ef749bd1a7154c | JavaScript | DScheglov/some-js-code | /task-2/index.js | UTF-8 | 159 | 3.03125 | 3 | [
"MIT"
] | permissive | function haveSameItems(arr1, arr2) {
return (
arr1.length === arr2.length &&
arr1.every(a => arr2.includes(a))
);
}
export default haveSameItems; | true |
5f433b1e354a2fc63a8815779afcfcaac92ef789 | JavaScript | PavloPashchevskyi/sais | /application/modules/sais/views/includes/js/interview_result.js | UTF-8 | 852 | 2.578125 | 3 | [] | no_license | function outputInterviewResult() {
$('form[name="forminterview"]').ajaxForm({
dataType:"json",
success: function(response) {
var resptext = '',
i = 0;
for(clause in response) {
resptext += response[clause];
if(i<Object.keys(resp... | true |
a5dd7c8c8c17d08b6ba0eb62bbe9fd2606082c90 | JavaScript | mandarinx/audia | /lib/plugins/audia.js | UTF-8 | 1,858 | 2.5625 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-2-Clause"
] | permissive | /*
Audia: <audio> implemented using the Web Audio API
by Matt Hackett of Lost Decade Games
*/
// ig.Audia = (function () {
ig.module(
'plugins.audia'
)
.requires(
'impact.impact',
'plugins.audia-web-audio',
'plugins.audia-audio'
)
.defines(function(){
ig.Audia = ig.Class.extend({
delegate: null,
... | true |
eb55da1e2d897a02534aac7423e46b1ea79a8934 | JavaScript | nramirez/trackforme | /chrome/lib/scripts/background.js | UTF-8 | 6,016 | 2.5625 | 3 | [] | no_license | /**
* Init TrackForMe.
*/
import TrackForMe from './core/trackforme';
import Actions from './core/actions';
import Store from './core/store';
import TrackingRunner from './core/trackingRunner';
let currentTabId;
let trackingTimeout;
let tracker = new TrackForMe();
chrome.runtime.onMessage.addListener(
function(... | true |
eadcb770efd45a99fcbf4969b385e5f20eebd5c2 | JavaScript | yeldiRium/gen-z | /src/async/search/find.test.js | UTF-8 | 1,259 | 3.0625 | 3 | [
"MIT"
] | permissive | const find = require("./find");
const from = require("../create/from");
const range = require("../../sync/create/range");
describe("async.search.find", () => {
it("returns the first value in the asynchronous generator that satisfies the asynchronous predicate", async () => {
const asyncSourceGenerator = from(ran... | true |
78a8dc0397d3231b2897bbc485579276f1cb9e58 | JavaScript | bupt519/CAAIN-master | /src/main/webapp/script/result-view.js | UTF-8 | 3,676 | 2.546875 | 3 | [
"MIT"
] | permissive | let awardId = 1;
let expert_id = 0;
let fetchUnvoteInterval;
let fetchNoPreVotedInterval;
function getQueryVariable(variable) {
let query = window.location.search.substring(1);
let vars = query.split("&");
for (let i=0;i<vars.length;i++) {
let pair = vars[i].split("=");
if(pair[0] === varia... | true |
87d9e229a0454b7d877aaf91508b554ae89f8713 | JavaScript | yishengaiziyou/dazigame | /index.js | UTF-8 | 5,502 | 3.078125 | 3 | [] | no_license | /*
* 属性
* 字母表、几个字符、生命、关卡、速度
* 方法
* 开始、产生、下落、消失、进入下一关、重新开始
*/
class Code {
constructor() {
this.bbq = [['A','img/A.png'],['B','img/B.png'],['C','img/C.png'],['D','img/D.png'],['E','img/E.png'],['F','img/F.png'],['G','img/G.png'],['H','img/H.png'],['I','img/I.png'],['J','img/J.png'],['K','img/K.png'],['L'... | true |
8d4a6e6539d5d100024ccd2be47ef837f162857b | JavaScript | toastier/srf | /src/modules/core/services/pagination.client.service.js | UTF-8 | 1,367 | 2.6875 | 3 | [
"MIT"
] | permissive | (function () {
'use strict';
/**
* @returns {{paginator: {currentPage: number, itemsPerPage: number, maxSize: number, paginationOptions: *[]}, paginate: Function}}
* @constructor
*/
function Pagination() {
var output = {
records: undefined
};
/**
* paginator configuration object... | true |
7432c86d1ba7994d3383d908daa47940af577cfd | JavaScript | Mensae/frontend-interview-questions | /coding-harder/BinarySearchTree.js | UTF-8 | 653 | 3.609375 | 4 | [] | no_license | /**
* Implement a BinarySearchTree class.
* It should support 4 methods: add, has, remove, and size
* @see {@link https://en.wikipedia.org/wiki/Binary_search_tree}
*/
class BinarySearchTree {}
/// tests
import { test } from 'ava';
test('BinarySearchTree', t => {
let tree = new BinarySearchTree();
tree.add(1... | true |
c5bca180d0762c91e1bec409eda0aeefbfdfa310 | JavaScript | lgilders/cattywumpus | /js/carouselScript.js | UTF-8 | 484 | 2.875 | 3 | [] | no_license | $(document).ready(function() {
var carousel = $('#carousel ul');
var resetList = function(){
// This code runs after the animation completes
$(this).find("li:last").after($(this).find("li:first"));
// Now we've taken out the left-most list item, reset the margin
$(this).css({marginLeft:0});
};
var animat... | true |
3646cff58c72fa8a448ec645045c0b740b7648f5 | JavaScript | phoenixTW/gauge-js | /step_implementation.js | UTF-8 | 252 | 2.765625 | 3 | [] | no_license | var gauge = require("./gauge");
gauge.step("say <greeting> to <person>", function (greeting, person) {
console.log(greeting + "!!! " + person);
});
gauge.step("step with table <table>", function (table) {
console.log(table.rowByIndex(1));
}); | true |
694d0b9eb5b6749f0b336cc8c1bcc8d8d9b95bb7 | JavaScript | SeregPie/JustMyLuck | /src/JustMyLuck.pickCombination.js | UTF-8 | 1,097 | 2.625 | 3 | [
"MIT"
] | permissive | import './JustMyLuck.chance';
import './JustMyLuck.pick';
import './JustMyLuck.pickIndex';
import JustMyLuck from './JustMyLuck';
import Array_fromExceptLike from './core/Array/fromExceptLike';
JustMyLuck.extend({
pickCombination(collection, k) {
let array = Array_fromExceptLike(collection);
let n = array.length... | true |
b6dae051f2b2e7ebb0227833e3e16f7b4354597d | JavaScript | fahimshahrierrasel/amovieplex | /frontend/static/frontend/js/slider.js | UTF-8 | 948 | 2.640625 | 3 | [] | no_license | // Main/Big Carousel Initailization
new Glide('.glide', {
type: 'carousel',
autoplay: 5000,
animationDuration: 3000,
hoverpause: true
}).mount()
// New In Carousel Initialization start
var newInGlide = new Glide('.slider', {
type: 'carousel',
startAt: 0,
perView: 5,
peek: {
bef... | true |
8aa8294adbf43e6e2e6827850beb8a8e3f7b752e | JavaScript | Silverman42/grant | /js/app.js | UTF-8 | 4,889 | 3.015625 | 3 | [] | no_license | var body = document.querySelector('body');
var vm = new Vue({
el: '#app',
data:{
/**
* navIsOpen
* @description: Toggled state of the navbar
*/
navIsOpen: false,
/**
* capData
* @description: List of cap Data
*/
capData: caps... | true |
9256be3ed545b83039464efcc0ee5c08a2fe1c5c | JavaScript | sydoruk89/cookie-stand | /js/app.js | UTF-8 | 3,844 | 3.46875 | 3 | [
"MIT"
] | permissive | 'use strict';
var table = document.getElementById('table');
var time = ['6AM','7AM','8AM','9AM','10AM','11AM','12PM','1PM','2PM','3PM','4PM','5PM','6PM','7PM','8PM'];
// constructor for locations
function Location(name, minCustomer, maxCustomer, averageCookies){
this.name = name;
this.minCustomer = minCus... | true |
d350152bee8ecd5c3e21fd7e54c73a09609fec2e | JavaScript | fedeghe/DSmvc | /htdocs/js/objs/sphere.js | UTF-8 | 984 | 3.0625 | 3 | [] | no_license | var Sphere = function (size){
//if the size is not set then give a default
if (size === undefined){
size = 10;
}
var grad = 2*Math.PI/360;
function g(n){return grad * n;}
//e inversa
function _g(r){return r / grad;}
//make3dpoint is a function inherited from
//DisplayObject3D
this.poin... | true |
c6e1c11f7bef616e9ba37b41bc586bb2462822cd | JavaScript | prakash20kumar/React | /add_two_number/src/App.js | UTF-8 | 1,034 | 2.953125 | 3 | [] | no_license | import React, { Component } from 'react';
class App extends Component {
state = { fn: '', sn: '', res: '' };
handleFirst = (evt) => {
// console.log("first :", evt.target.value);
this.setState({ fn: evt.target.value });
}
handleSecond = (evt) => {
// console.log("Second : ", evt.target.value);
... | true |
bcd8ccc78cf948cbbf850be3599992ab164ae4ff | JavaScript | waldonUB/gc-base | /base_js/pattern/factory/factory.js | UTF-8 | 467 | 3.1875 | 3 | [
"MIT"
] | permissive | class P {
constructor() {}
init() {
console.log(`I am the init method:${this.name}`)
}
}
class Div {
constructor() {}
init() {
console.log(`I am the init method:${this.name}`)
}
}
/** 用不到实例化的class直接用static关键字 */
class Factory {
static create(type) {
switch (type) {
case 'div':
re... | true |
7d46fbc2bc1bb374278644ba0d96b8ddaf517740 | JavaScript | charlesharvey/p5_experiments | /3arrows/scripts.js | UTF-8 | 2,362 | 3.375 | 3 | [] | no_license |
class Arrow {
constructor(color) {
this.col = color;
this.points = [
[0, 0],
[0, 100],
[200, 100],
[200, 200],
[300, 50],
[200, -100],
[200, 0],
]
}
show() {
fill(this.col);
stro... | true |
9d632153b747f4faaa217a3fd731068464b5d2f9 | JavaScript | isaac1995514/TA-Registration-System | /resources/script/viewApplication.js | UTF-8 | 2,139 | 2.875 | 3 | [] | no_license | window.onload = () => {
"use strict";
var randomValueToAvoidCache = (new Date()).getTime(); // Random value used to avoid cache
let removeBtns = document.getElementsByTagName('img');
for(let btn of removeBtns){
let buttonId = String(btn.getAttribute('id'));
let appId = buttonI... | true |
f2a9aa998d65f484a25914d48533c2844affa43b | JavaScript | collaco/jogo-da-velha-backend | /src/strategy/Play.js | UTF-8 | 1,071 | 2.578125 | 3 | [] | no_license | const StrategyEnum = require("./strategyEnum.js");
const StrategyLevel1BeginCenter = require("./StrategyLevel1BeginCenter.js");
const StrategyLevel1BeginCorner = require("./StrategyLevel1BeginCorner.js");
const StrategyLevel2 = require("./StrategyLevel2.js");
const StrategyLevel3 = require("./StrategyLevel3.js");
cla... | true |
f02f4a2757c23fb55606e8197a5437ce14064d30 | JavaScript | handlerda/accredii-react-app | /src/store/company.js | UTF-8 | 2,601 | 2.546875 | 3 | [] | no_license | import axios from "axios";
const CREATE_NEW_COMPANY = "company/addNew";
const CREATE_NEW_EMBEDDED_DOCUMENT = "company/newEmbedded";
const GET_COMPANY_STATUS = "company/getStatus";
const api_path = process.env.REACT_APP_SERVER_URI_PROD;
// helpers
const createNewCompanyHelper = (payload) => {
return {
type: CREA... | true |
480e60b39c334f2c6e19f3fbe3e4b91d74e97a7b | JavaScript | kumek/fiablo | /src/app/resources/TileImage.js | UTF-8 | 268 | 2.78125 | 3 | [] | no_license | export default class TileImage {
constructor(url) {
this.image = new Image();
this.url = url;
}
load() {
return new Promise((resolve, reject) => {
console.log(`Loading ${this.url}`);
this.image.onload = resolve;
this.image.src = this.url;
});
}
} | true |
09cdc00d03edf82106dff94bb6e0d0560b986c52 | JavaScript | KalmykovAnatoly/expo2 | /functions.js | UTF-8 | 219 | 3.359375 | 3 | [] | no_license | export function deleteFromArray(arr, object){
const result = [];
for (let i in arr){
if (arr[i].x!==object.x || arr[i].y!==object.y){
result.push(arr[i]);
}
}
return result;
} | true |
64ad8147b1bf50b2bd8133fedb271e6d823ca295 | JavaScript | marcusbalbi/study | /javascript/nodejs/sequelize/index.js | UTF-8 | 2,109 | 2.609375 | 3 | [
"MIT"
] | permissive | const Client = require('./Client')
const Base = require('./Base')
// running sql directely
// Client.sequelize.query('SELECT * FROM clientes').then((r) => {
// console.log(r);
// })
// specific class method
// Client.getClientsByBase(3).then((result) => {
// console.log(result[0].get('cli_nome'));
// })
// updatin... | true |
5e45a4119d64be67aeb95c12ec4daf42da5da321 | JavaScript | atd-schubert/old-yaga | /client/scripts/yaga-storage.js | UTF-8 | 2,642 | 2.640625 | 3 | [
"ISC"
] | permissive | /*jslint browser: true*/
/*globals window, define, Class */
/**
* @module yaga-storage
*/
define('yaga-storage', ['yaga'], function (Yaga) {
'use strict';
var Storage;
/**
* Basic Storage super class for yaga
*
* @alias yaga-storage
* @name Storage
* @constructor
* @augment... | true |
9dd7259a70dc0bc5f1beb7d60cd61635118e039b | JavaScript | MarcelSchmidberger/Felsformation | /index.js | UTF-8 | 3,170 | 3.09375 | 3 | [] | no_license | const fs = require('fs');
let fileContents = fs.readFileSync('a_example.in', { encoding: 'utf8' });
let rows = fileContents.split('\n');
// Remove empty last row
rows.pop();
let firstRow = rows.shift();
let rowStuff = firstRow.split(' ');
const NUMBER_OF_ROWS = rowStuff[0];
const NUMBER_OF_COLUMNS = rowStuff[1];
const... | true |
74e5d68d1836142d5de5a17c3846d2016a9fc3b4 | JavaScript | Pushker-stark/Portfolio | /main.js | UTF-8 | 2,771 | 2.5625 | 3 | [] | no_license | import './style.css'
// Find the latest version by visiting https://cdn.skypack.dev/three.
import * as THREE from 'https://cdn.skypack.dev/three@0.130.1/build/three.module.js';
import { OrbitControls } from 'https://threejs.org/examples/jsm/controls/OrbitControls.js';
const scene = new THREE.Scene();
const came... | true |
416478a144e26f50c9aa0612b30f8b23c3307bd9 | JavaScript | iamkeerthanareddy/ng-gk-quiz | /index.js | UTF-8 | 2,817 | 3.265625 | 3 | [] | no_license | var rl = require('readline-sync');
const chalk = require('chalk');
var userName = rl.question(chalk.greenBright.bold("What is your Name?\n"));
console.log(chalk.blueBright.bold("\n"+ "Hello "+ userName + ", Welcome To the General knowledge quiz.\n"));
console.log(chalk.bgCyan.bold("Quiz Instructions"));
console.log(... | true |
b98e1bf79c239c336b68662145cb7590c0fdb194 | JavaScript | mckreddi/sdgs-api | /middleware/githubGetter.js | UTF-8 | 3,575 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | const request = require('request').defaults({gzip: true, json: true});
module.exports = function (req, res, next) {
console.log('req.parsedParts', req.parsedParts);
const githubBaseUrl = 'https://raw.githubusercontent.com/UNStats-SDGs/sdgs-data/master';
const githubBaseUrlSuffix = '.json?raw=true';
req.initi... | true |
6e67184d4c4e90df6db10af2d87bf7cd9cfc5563 | JavaScript | kernsinator/frostykernel | /scripts/puzzle-scripts/tajik.js | UTF-8 | 1,391 | 3.203125 | 3 | [] | no_license | let answers = ['B', 'D', 'C', 'A'];
let accuracy = [false, false, false, false];
let answered = [false, false, false, false];
let q1 = document.getElementById('q1');
let q2 = document.getElementById('q2');
let q3 = document.getElementById('q3');
let q4 = document.getElementById('q4');
let userInputs = [q1, q2, q3, q4... | true |
aa7f10b52ddfc0f054d6cfb803909b0c2d53e7ae | JavaScript | Carrie-lyj/Carrie-lyj.github.io | /pipe.js | UTF-8 | 976 | 2.953125 | 3 | [] | no_license | function Pipe(option) {
this.ctx = option.ctx,
this.topimg = option.topimg,
this.bottomimg = option.bottomimg,
this.x = option.x,
this.w = option.topimg.width,
this.h = option.topimg.height,
this.space = 150,
this.speed = 2,
this.ty = 0,
this.... | true |
fb9d3daa28ae287cf5c65002567830e83f687714 | JavaScript | jianghongyun/ordering-server | /controllers/financeController.js | UTF-8 | 4,161 | 2.75 | 3 | [] | no_license | /**
* created by jianghy on 2019/04
* 财务操作
*/
const order = require('../models/orderModel')
const sequelize = require('sequelize')
let responseData = {}
/**
* 当前年月日总收入
* @param {*} req
* @param {*} res
* @param {*} next
*/
exports.grossIncome = (req,res,next) => {
const yearly = timeforma... | true |
f37b0663b90468330909966020779cb0062db007 | JavaScript | kevinwsbr/PhysicsSimulator | /js/main.js | UTF-8 | 5,110 | 2.59375 | 3 | [
"MIT"
] | permissive | // miscs webgl
var width = window.innerWidth;
var height = window.innerHeight;
var scene = new THREE.Scene();
//var camera = new THREE.PerspectiveCamera(45, width/height, .1, 500);
var camera = new THREE.PerspectiveCamera(45, width / height, 0.1, 10000);
var renderer = new THREE.WebGLRenderer();
renderer... | true |
975bfa6edb73ed68a746ae8fe1e792ffaf703cbc | JavaScript | scottcarpenter28/365-day-coding-challenge | /365 day code challenge/scripts/pentagonPoints.js | UTF-8 | 288 | 3.390625 | 3 | [] | no_license | $(document).ready(function() {
$("#output").click(function() {
var n = parseInt($('#gen').val());
var points = pentagonal(n);
$('#ans').text(points);
});
});
function pentagonal(n){
var res=0;
for(var i=1; i<=n; i++)
res+=((3*Math.pow(i,2))-i)/2;
return res;
}
| true |
4c8f61df5a7fea0723e2f55e38f458d9e893bbf1 | JavaScript | beatriz-ag/feup-cgra | /TPS/tp2/MyUnitCubeQuad.js | UTF-8 | 2,183 | 2.65625 | 3 | [] | no_license | import {CGFobject} from '../lib/CGF.js';
import { MyQuad } from "./MyQuad.js";
/**
* MyUnitCubeQuad
* @constructor
* @param scene - Reference to MyScene object
*/
export class MyUnitCubeQuad extends CGFobject {
constructor(scene) {
super(scene);
this.initBuffers();
}
initBuffers() {
this.myQuad = new My... | true |
acc4fac348263b91d236d0119e442af13f277d84 | JavaScript | morganbrooke/Full-MEAN-Orders-and-Customers | /client/js/controllers/orders.js | UTF-8 | 713 | 2.53125 | 3 | [] | no_license | co_app.controller('ordersController', function (orderFactory){
console.log('in orders controller');
var that = this;
that.orders = [];
orderFactory.getOrders(function(data){
that.orders = data;
})
this.addOrder = function (){
console.log('clicked add')
orderFactory.addOrder(that.newOrder... | true |
a49e5c4e8adbc8a430d0e1323cd78869eae7f6f0 | JavaScript | shubhamagarwal/NodeJS-GMP | /user/userService.js | UTF-8 | 1,189 | 3.015625 | 3 | [] | no_license | let users = [
{
id: "1",
login: "Shubham",
password: "Password321",
age: 30,
isDeleted: false,
},
{
id: "2",
login: "rootUser",
password: "password123",
age: 30,
isDeleted: false,
},
];
export const findByUserId = (findUserId) => {
const user = users.find(({ id }) => i... | true |
5e81cc33f2581f3b7056ec96cec9d2138ee2d4d5 | JavaScript | marshmeryl/JavaScriptExercises | /shuffle.js | UTF-8 | 1,107 | 4.0625 | 4 | [] | no_license | function shuffle(array) {
var result = array.slice();
var length = result.length - 1;
var randIndex;
for (var i = length; i > 0; i--) {
randIndex = Math.floor((i + 1) * Math.random());
_swap(result, i, randIndex);
}
return result;
}
function _swap(arr, indexOne, indexTwo) {
var temp = arr[indexOne];
... | true |
a0d186108abd08d1fd30b5fcc44622d97bcdf6b0 | JavaScript | VinylFox/JavaScript | /JavaScript.js | UTF-8 | 497 | 2.5625 | 3 | [] | no_license | /**
* @class JavaScript
* The base javascript functions.
*/
JavaScript = Ext.extend({},{
decodeURI: function(){},
decodeURIComponent: function(){},
encodeURI: function(){},
encodeURIComponent: function(){},
/**
*
* @param {String} val JavaScript code to be evaluated.
* @return {*} Ret... | true |
84c9d501ffede3bc3e11bff899bfe2fcd24ecc6f | JavaScript | micoli/qdmmmdb | /lib/3rd_js/ux/array.js | UTF-8 | 426 | 2.609375 | 3 | [] | no_license | Ext.ux.array = new(function() {
var that = this;
that.insertAt = function(array, index) {
var arrayToInsert = Array.prototype.splice.apply(arguments, [2]);
Array.prototype.splice.apply(array, [index, 0].concat(arrayToInsert));
return array;
}
that.insertArrayAt = function(array, index, arrayToInser... | true |