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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
a8223e683ff3b13e6c5f54e761aa893ee50b7e29 | JavaScript | alexandresoueu/hapi-api-structure | /src/tests/db/strategies/mongodb.test.js | UTF-8 | 1,747 | 2.53125 | 3 | [] | no_license | const assert = require('assert')
const MongoDB = require('../../../db/strategies/mongodb/mongodb')
const heroesSchema = require('../../../db/strategies/mongodb/schemas/heroesSchema')
const Context = require('../../../db/strategies/base/contextStrategy')
const MOCK_REGISTER_HEROES = {
names: 'O miranha',
power: 'S... | true |
42a3929212d25e22e9fecfdc85fcb2d2f7932e64 | JavaScript | CallMeSaltyF1sh/jsCodingExercises | /leetcode/Array/16-three-sum-closest.js | UTF-8 | 958 | 3.640625 | 4 | [] | no_license | /**
* Problem desc:
* 给定一个包括n个整数的数组nums和一个目标值target。找出nums中的三个整数,使得它们的和与 target 最接近;
* 返回这三个数的和(假定每组输入只存在唯一答案)。
*/
/**
* @param {number[]} nums
* @param {number} target
* @return {number}
*/
var threeSumClosest = function(nums, target) {
if(!nums || nums.length < 3) {
return null;
}
l... | true |
145241b10c6c350c55305733d83f04e141f14a48 | JavaScript | fixtheclouds/bomberman-js-remake | /src/game/beings/Being.js | UTF-8 | 1,919 | 2.734375 | 3 | [] | no_license | import { MAP_TOP_MARGIN, UNIT_HEIGHT, UNIT_WIDTH } from '../../constants';
import { gridMethods } from '../../utils/gridMethods';
export default class Being {
constructor(scene) {
this._scene = scene;
this.isAlive = true;
this.x = null;
this.y = null;
this.sprite = null;
}
update(frame) {
... | true |
64f8991ba50782f4d9dc7650492e19320b49a23f | JavaScript | koobcbc/frontend_project3 | /src/components/routes/PastOrders.jsx | UTF-8 | 2,462 | 2.5625 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
import { Link } from "react-router-dom";
import axios from "axios";
import Layout from '../shared/Layout'
import apiUrl from "../apiConfig"
const PastOrders = (props) => {
console.log('PastOrder')
const [ICorders, setICOrders] = useState([]);
const [MSorders... | true |
7d351efb25c6fc4fa9e6581b88082434421f8f69 | JavaScript | vatsShivam/Pundrik-Shastri- | /biography.js | UTF-8 | 256 | 2.6875 | 3 | [] | no_license |
var images=[
'satyam.jpg',
'shiva1.jpg',
'shivam.jpg'
];
var time=3000;
function changeImg(){
const a=images.pop();
document.slide.src=a;
images.unshift(a);
setTimeout(changeImg,time);
}
window.onload=changeImg;
| true |
6a57a8ff97f34357b98f0e1a867e8b6572ee76d6 | JavaScript | NelliBtn/iss_spotter | /index.js | UTF-8 | 572 | 2.703125 | 3 | [] | no_license | const { nextISSTimesForMyLocation } = require('./iss');
passTimesTranslate = function(passTimes) {
for (let pass of passTimes) {
let date = new Date(pass.risetime)
date.setUTCSeconds(pass.risetime);
const seconds = pass.duration;
console.log(`Next pass at ${date} for ${seconds} seconds!`)
}
}
// ... | true |
00152a4e58a4d3fba5c0d39cafb78d07616c7d26 | JavaScript | ZoeWang/js | /es6/exercise/destruction.es6 | UTF-8 | 1,291 | 4.65625 | 5 | [] | no_license | // 只要某种数据结构具有Iterator接口,都可以采用数组形式的解构赋值。 ???
function* fibs() {
var a = 0;
var b = 1;
while (true) {
yield a;
[a, b] = [b, a + b];
}
}
var [first, second, third, fourth, fifth, sixth] = fibs();
sixth // 5
// fibs是一个Generator函数,原生具有Iterator接口。解构赋值会依次从这个接口获取值。
// ES6内部使用严格相等运算符(===),判断一个位置是否有值。所以,如果一个数... | true |
39228ca1f8c69b1997dda3b9f4a9400f6994954e | JavaScript | jonnyleealas/music-website | /app.js | UTF-8 | 875 | 3.375 | 3 | [] | no_license | 'use strict';
var areYouTigerKing = '';
function numberOfTigers() {
var correctAnswer = 10;
for(var i = 0; i < 8; i = i + 1){
var numberGuess = prompt('You are now pregnant with Tigers. 1-11, How many will you have?');
if(numberGuess == correctAnswer){
alert('10 BRUH! YOU WILL BE... | true |
752fa71cf4f09d770eea8fe79fb57a575af50fa7 | JavaScript | ipheghe/More-Recipes | /client/src/utils/validator/changePasswordValidator.js | UTF-8 | 820 | 2.921875 | 3 | [
"MIT"
] | permissive | /**
* changePasswordValidator
*
* @returns {object} status message
*/
const changePasswordValidator = (
oldPassword,
newPassword,
confirmPassword,
) => {
const error = { errorStatus: false, message: '' };
if (oldPassword === '') {
error.status = true;
error.message = 'old password field cannot b... | true |
1d7b5c46293395d3287d6cc2d94e00528f82d809 | JavaScript | klamping/Darts | /server/bootstrap.js | UTF-8 | 640 | 2.578125 | 3 | [] | no_license | // if the database is empty on server start, create some sample data.
Meteor.startup(function () {
if (Matches.find().count() === 0) {
var data = [
{
games: [
{
pid: 1,
rounds: [
[1,2,1,1,3,3,2],
[1,2,1,1,3,3,2],
[1,2,1,1,3]... | true |
247e6c19ea5c6a7b1813abf85c77e8a3687b145a | JavaScript | wiseminds/Yum-food | /integration-test/web/product/getAll.test.js | UTF-8 | 11,643 | 2.65625 | 3 | [
"MIT"
] | permissive | const { request } = require("../../index");
const { Product } = require("../../../server/model");
const db = require("../../setup/db_setup");
const userData = {
name: "Zell",
email: "test@gmail.com",
password: "Password2@",
phone: "09036040503",
};
const productData = {
name: "Jellof rice",
price: 2000,
... | true |
467313641b8f8f48a85b5ab6e6b581d430e59940 | JavaScript | ColHAPABLAP/todolist | /tailor/test/fragment/index.js | UTF-8 | 1,065 | 2.84375 | 3 | [] | no_license | 'use strict';
const http = require('http');
// Fragment server - Any http server that can serve fragments
http.createServer((req, res) => {
// just some js
if (req.url === '/script.js') {
res.setHeader('Content-Type', 'application/javascript');
return res.end('c=!setInterval(\'document.getElementById(... | true |
6d24f55a89524a33a67ee639b74c85402d6bdc43 | JavaScript | astuanax/fun | /src/boolean/F.js | UTF-8 | 256 | 2.5625 | 3 | [
"MIT"
] | permissive | /**
* Always returns a function with a False boolean
*
* @function F
* @description Always returns a function with a False boolean
* @since v1.0.2
* @param {*} a
* @return {Function}
**/
import always from '../always'
export default always(false)
| true |
3e80550463a6f6c19213cbfde88ebaec239aef32 | JavaScript | nobuti/performance-talk | /src/hooks/useFetchVolcanos.js | UTF-8 | 1,014 | 2.53125 | 3 | [] | no_license | import { useState, useEffect } from "react";
const useFetchVolcanos = (initialState) => {
const [volcanos, setVolcanos] = useState(initialState);
useEffect(() => {
fetch("/significant-volcanic-eruption-database.json")
.then((v) => v.json())
.then((v) => {
const volcanos = v.map((volcano) =... | true |
61ccd6ff5dbba6483f7a20385db99e86a900d701 | JavaScript | NatanaelRazzotto/PlaceHolder | /src/application/useCase/commentsUseCase/createCommentsUseCase.js | UTF-8 | 1,052 | 2.578125 | 3 | [] | no_license | //const { RepositoryComment } = require('../../../infrastructure/repository/repositoryComment');
const { Comment } = require('../../../domain/comment');
class CreateCommentsUseCase {
constructor({ repositoryComment }) {
this.repositoryComment = repositoryComment;
}
async execute(dataComment) {
... | true |
ab4d43468b8240f540a4b213d8b7051ac17ba91c | JavaScript | zakski/thunderjaw | /parser-js/src/test/js/TestLexer.js | UTF-8 | 3,389 | 2.96875 | 3 | [
"Apache-2.0"
] | permissive | const antlr4 = require("antlr4");
const Lexer = require("./PrologLexer").PrologLexer;
const assert = require('assert');
const StringType = require("./StringType").StringType
function testVariables(){
let input = "_ + A + _B is _1 + _a + _+"
let chars = new antlr4.InputStream(input);
let lexer = new Lexer(c... | true |
3a6142bb6bd64553bbb1bf45ff8baa408021b7c5 | JavaScript | paulojorgepvh/sisupa | /src/main/resources/static/layout/javascripts/UPA.js | UTF-8 | 846 | 2.515625 | 3 | [
"MIT"
] | permissive | $(function() {
/*Muda Status do Profissional de Saúde*/
$('.js-atualizar-status').on('click',function(event){
event.preventDefault();
var botaoReceber = $(event.currentTarget);
var urlReceber = botaoReceber.attr('href');
var response = $.ajax({
url:urlReceber,
type:'PUT'
});
response.do... | true |
3700c2807b55c88ba5ae68821bd19c4954d8735d | JavaScript | johanley/astro | /js/general-graphics.js | UTF-8 | 4,708 | 3.34375 | 3 | [
"BSD-2-Clause"
] | permissive | /* Tools of general utility for HTML5 canvas graphics.*/
var GRAPH = (function(){
/**
Set a standard font for a canvas.
The intent is that this is called for all canvas objects.
(Setting the canvas font can't be done in CSS.)
If the browser has a hard minimum size of font, then it will take
preced... | true |
1d37340dce541227e6e2748aeaf3bf1d7ee657e4 | JavaScript | ttran6943/Project---Decoder-Ring | /tests/polybius.test.js | UTF-8 | 1,329 | 3.171875 | 3 | [] | no_license | const expect = require("chai").expect;
const polybius = require('../src/polybius');
describe("polybius", () => {
it("should encode a message by translating each number to number pairs", () => {
const actual = polybius('abc');
expect(actual).to.be.equal('112131');
});
it("should tran... | true |
35e59c535a6c03fa2976c14cd170789b808434d2 | JavaScript | zoecode26/distanceCalculator | /distanceCalculator.js | UTF-8 | 4,790 | 2.8125 | 3 | [] | no_license | let map, popup, Popup;
var markers = []
var line;
function initMap() {
map = new google.maps.Map(document.getElementById("map"), {
center: { lat: 25, lng: 0 },
zoom: 2,
gestureHandling: 'cooperative',
});
if (window.matchMedia("(min-height: 1000px)").matches) {
map.setCenter({lat: 0, ... | true |
fa058c568507f41409debe3dc2f4a5c77fc4a0a8 | JavaScript | mumford/s3-stats | /index.js | UTF-8 | 3,733 | 2.609375 | 3 | [] | no_license | var AWS=require('aws-sdk'),
async=require('async');
AWS.config.loadFromPath('./aws_config.json');
function LogDownloader() {
var that = this;
var s3;
initializeAws();
function initializeAws() {
console.log('Initializing the AWS and S3 instances.');
that.s3 = new AWS.S3({params:{B... | true |
8d0c9054b25cbe543a2bc7b15b17a6f8c4d059c7 | JavaScript | johnmorrisQADeveloper/webdriverjsgeneral | /promises/web_mocha_promiseManager.js | UTF-8 | 1,005 | 2.5625 | 3 | [] | no_license | var webdriver = require('selenium-webdriver'),
{describe, it, after, before} = require('selenium-webdriver/testing');
By = require('selenium-webdriver').By,
until = require('selenium-webdriver').until,
promise = require('selenium-webdriver').promise;
var assert = require("chai").assert;
describe('checking'... | true |
28fbed3a05a6489881a9a656114a68f585663854 | JavaScript | mgellis91/simple_meteor_blog | /client/templates/partials/newCategory.js | UTF-8 | 354 | 2.515625 | 3 | [
"MIT"
] | permissive | Template.newCategory.events({
"submit #new-category-form": function(e){
e.preventDefault();
var category = e.target.newCategoryName.value;
if(category === ""){
alert("category name must be entered");
return;
}else{
console.log(category);
Meteor.call("createNewCategory",category);
$("#category-mo... | true |
c6bbc3f035cc9be84c06f794c2519fdbab1e86a6 | JavaScript | Louis-vd/teletravail | /Entrainement-JS/Javascript/1.exercises/04-dates/05-get-spooky-fridays/script.js | UTF-8 | 875 | 3.46875 | 3 | [] | no_license | /* becode/javascript
*
* /04-dates/05-get-spooky-fridays/script.js - 4.5: calcul des vendredi 13
*
* 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.
(() => {
// your code here
document... | true |
de407160dae18845286600d9039a78025c9c6525 | JavaScript | zoubingwu/gobang | /gobang(dom)/script/main.js | UTF-8 | 858 | 2.59375 | 3 | [
"MIT"
] | permissive | window.onload = function() {
boardRendering()
boardTable.addEventListener('click', function(e) {
if (gameOver) return;
var i = e.clientX - boardDiv.offsetLeft;
var j = e.clientY - boardDiv.offsetTop;
i = Math.floor(i / 30);
j = Math.floor(j / 30);
if (board[i][j] ... | true |
a55cc72f242321120f5f567412116ef14e3bcf51 | JavaScript | ljazminsc205/Portafolio-web | /Tecnologias/PruebaVue/01.js | UTF-8 | 1,175 | 3.203125 | 3 | [] | no_license | //instancia de Vue
const app = new Vue({
el: '#app',
data: {
titulo: 'Hola mundo con Vue',
frutas: ['Manzana', 'Pera', 'Uva'],
//Con objetos:
nombres: [
{ nombre: 'Juan', cantidad: 10 },
{ nombre: 'Juan2', cantidad: 0 },
{ nombre: 'Juan3', cant... | true |
18db06106d083deb2b7eb664e4b16005c39188dd | JavaScript | mbanakova/1351465-code-and-magick-21 | /js/dialog.js | UTF-8 | 1,298 | 2.765625 | 3 | [] | no_license | 'use strict';
(function () {
const userIcon = document.querySelector(`.setup-open`);
const setupCloseButton = document.querySelector(`.setup-close`);
const userNameInput = window.variables.userNameInput;
const wizardSetupWindow = window.variables.wizardSetupWindow;
const ESCAPE = `Escape`;
const onPopupEsc... | true |
632a6153c27c0dafdf4bfd50cdd3ae1887d6c09e | JavaScript | phdinserver/retriever | /src/handler/HandlerCenter.mjs | UTF-8 | 500 | 2.515625 | 3 | [] | no_license | export default class HandlerCenter {
static #handlers = new Map();
static registerHandler(packetConstructor, handler) {
if (!this.#handlers.has(packetConstructor))
this.#handlers.set(packetConstructor, []);
this.#handlers.get(packetConstructor).push(handler);
}
static handl... | true |
f018bc9df2d09141fac1f478e522ecd8888a3846 | JavaScript | sts-sadr/covid2019hub | /server/controllers/api/index.js | UTF-8 | 1,415 | 2.640625 | 3 | [] | no_license | const users = require('../../models/users');
const createUser = function(req, res, next) {
users.createUser(req.body, function(err, user){
if (err) {
console.log('Error when creating user');
console.error(err);
res.status(500);
res.json({err: err});
} else if (!user){
console.log('No user was creat... | true |
c83c77b3b2248fc8f946cfd6f8419eb9a4e79980 | JavaScript | linux-lewis/launch-school-exercises | /JS100_Basics/Variable_Scope/q3.js | UTF-8 | 269 | 3.65625 | 4 | [] | no_license | if (true) {
let myValue = 20;
}
console.log(myValue);
/*
** The above code will throw a ReferenceError because myValue is declared within the code block of the
** if statement but not returned. Therefore there is no reference myValue for console.log() to access.
*/ | true |
ae0f48c0c896444300967c58e2528333f07e2141 | JavaScript | TamandeepSingh/Doctor-app | /server/controllers/auth.js | UTF-8 | 4,271 | 2.59375 | 3 | [] | no_license | const mysql = require("mysql");
const jwt = require('jsonwebtoken');
const bcrypt = require('bcryptjs');
const {promisify}= require('util');
const db = mysql.createConnection({
host: process.env.HOSTNAME,
user: process.env.USER_NAME,
password: process.env.PASSWORD,
database: process.env.DATABASE
})
exports.re... | true |
2c61b7ea048cdaaebdef3e265031ad0618ec53e3 | JavaScript | elephantzhai/htmlLearn | /nodejs/basic.js | UTF-8 | 474 | 3.765625 | 4 | [] | no_license | var name = "www.elephant.com"
var age = 3;
var male = true;
console.log(typeof(name));
console.log(typeof(age));
console.log(typeof(male));
console.log(typeof(undifined));
console.log(typeof(null));
name = "jason";
if(name ==="jason"){
console.log("yes");
}else{
console.log("no");
}
switch(name){
case "1111":
c... | true |
acdc9060345a9dcc6dfbbdfbec1dccd1331b64d5 | JavaScript | yohm/p5js_simulations | /ov_model/sketch.js | UTF-8 | 4,024 | 2.640625 | 3 | [
"MIT"
] | permissive | class OVmodel {
constructor( num_cars ) {
this.params = {
car_a: 1.0,
num_cars: num_cars,
max_v: 1.0,
lane_length: 20.0,
car_size: 0.25,
dt: 0.01
};
this.cars = [];
for( var i=0; i<num_cars; i++) {
var pos = (i*0.9 + 0.4*Math.random() ) * this.params.lane_len... | true |
bfd0733689b92d8a4e3670642a5e36306571afd8 | JavaScript | tianyan10086/medicine-spider-1 | /common/console.js | UTF-8 | 908 | 2.65625 | 3 | [] | no_license | const chalk = require("chalk");
const DraftLog = require("draftlog").into(console);
function unifyStringLength(str, length = 8) {
if (typeof str !== "string") str = str.toString();
return " ".repeat(length - str.length);
}
function getConsoleText({ id, status = -1, text }) {
let _text = chalk.cyan(" > ") + chal... | true |
0b7aefae8e792e5f67fd293a9ed46f0ccf7f28f2 | JavaScript | TumashukMV/Practice | /Calculator of colories/app.js | UTF-8 | 3,107 | 3.375 | 3 | [] | no_license | /*Новая задача - Счётчик стоимости блюда (написать его нужно используя объект и методы этого объекта для подсчёта)
Некая сеть ресторанов предлагает несколько видов коробок с ланчем:
маленький (300р, 250 калорий)
большой (380р, 400 калорий)
Коробка может быть с одним из нескольких видов соусов и топпингов(обязательн... | true |
0a083183b3185269724e440334605e82bc2894fc | JavaScript | VitAn1999/moduleC6_homework | /C6.6/scripts/main.js | UTF-8 | 1,710 | 3.03125 | 3 | [] | no_license | const btnMessage = document.querySelector('.message-btn');
const btnGeo = document.querySelector('.geo-btn');
const inputText = document.querySelector('.message-text');
const messageSpace = document.querySelector('.message-space');
const url = 'wss://echo.websocket.org/';
let sentMessage = ``;
let webSocket = new... | true |
f716b7ec9347ddf764e129ae0047c0af5dc38484 | JavaScript | Ilya-Valasiuk/mat-mod | /mat-mod/src/services/discrete-random-values.jsx | UTF-8 | 5,415 | 2.953125 | 3 | [
"MIT"
] | permissive | import { format } from 'd3-format';
import Random from 'random-js';
const sum = (r, a) => r.map((b, i) => a[i] + b);
const findMXY = (matrix, { X, Y }) => {
const format1f = format('.1f');
let MXY = 0;
for (let i = 0; i < matrix.length; i++) {
for (let j = 0; j < matrix[0].length; j++) {
MXY += +(for... | true |
434fe86e633fdb8565e68eeaff44efff54725e04 | JavaScript | amakowiecki/vscode-evernote | /converter.js | UTF-8 | 2,827 | 2.875 | 3 | [
"MIT"
] | permissive | "use strict";
//pass ENML to md, and back
// const xml2js = require('xml2js');
const util = require("util");
const toMarkdown = require("to-markdown");
const marked = require("marked");
const MAGIC_SPELL = "%VSCODE_EVERNOTE%";
const customRenderer = new marked.Renderer();
customRenderer.heading = (text, level) => {
... | true |
a69c5793a5fe649d72b024e95169130300c69b72 | JavaScript | dpk-developer/wish-list-node-js | /routes.js | UTF-8 | 2,523 | 2.515625 | 3 | [] | no_license | const mongoose = require("mongoose");
const { mongoUrl } = require('./config/keys');
const wishModel = mongoose.model('wishes');
mongoose.connect(mongoUrl, {
useUnifiedTopology: true,
useNewUrlParser: true
});
const address = {
initialRoute: '/',
about: '/about',
home: '/home',
profile: '/pr... | true |
97c1c693a46836943cfa8874ab91c7fbd384bc7e | JavaScript | catperso/giphy-api-1 | /src/index.js | UTF-8 | 1,551 | 2.703125 | 3 | [] | no_license | import $ from 'jquery';
import 'bootstrap';
import 'bootstrap/dist/css/bootstrap.min.css';
import './css/styles.css';
import JiphyGif from './jiphy.js';
$(document).ready(function() {
$('#wordGif').click(function() {
$('.showGif').html("");
const word = $('#word').val();
console.log(word);
$('#word')... | true |
06a9ead08a6fa7059926efeb40679368f9f0ec2a | JavaScript | JohnDeved/p2pt | /test/different-messages.js | UTF-8 | 1,482 | 2.59375 | 3 | [
"MIT"
] | permissive | const test = require('tape')
let P2PT
if (process.env.BROWSER_TEST) {
P2PT = require('../p2pt')
} else {
P2PT = require('../node')
}
const announceURLs = [
'ws://localhost:5000'
// 'wss://tracker.btorrent.xyz:443/'
]
const randomString = (length) => {
return [...Array(length)]
.map(() => (~~(Math.rando... | true |
18dd68806296e6f639df46c406aa4b2f0aca341c | JavaScript | linong1526/ReactRouter | /src/utils/hoc.js | UTF-8 | 2,654 | 2.59375 | 3 | [] | no_license | import React from 'react'
import { Redirect } from 'react-router-dom';
export function withUser(InputComponent){
// 接收组件InputComponent作为参数返回一个新的组件OutputComponent
return function OutputComponent(props){
// console.log('OutputComponent',props)
let userInfo = localStorage.getItem('userInfo');
... | true |
04f4bc4bd531ee80463ba4772a680bf851fe356d | JavaScript | Abderrazekthabet/sante-tunisie | /js/perso.js | UTF-8 | 705 | 2.5625 | 3 | [] | no_license | function affichInsc(test)
{
if(test)
{
document.getElementById("tabsInsc").style.visibility="visible";
document.getElementById("tabsInsc").style.height="150px";
affichCnx(false);
}
else
{
document.getElementById("tabsInsc").style.visibility="hidden";
document.getElementById("tabsInsc").style.height="0px";
}
... | true |
4eb184b05785b0d796ae6d6cd54c6f7ea9c17a81 | JavaScript | scottcaldwell/Syncline | /app/assets/javascripts/layers_pdf.js | UTF-8 | 5,365 | 2.609375 | 3 | [] | no_license | $(function () {
var layers = $('#layers-log');
layers.find('.layer').each(function() {
var _self = $(this);
var height = parseFloat(_self.data('height')) * 100 + 'px';
_self.css('height', height);
});
// Constructs the layer_log ruler based on combined height of all layers
var layersHeight = ... | true |
3bb0b8b9275b9da960a4a4a0b3eeebb8e3b03b27 | JavaScript | clickalicious/ci-github-bot | /dist/parser/url/github.js | UTF-8 | 3,027 | 2.515625 | 3 | [
"MIT",
"CC-BY-3.0"
] | permissive | 'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
/**
* ci-gitHub-bot
*
* Github communication bot for CI/CD workflows.
*
* Simplified abstraction on Github's PR/Review-Comment API.
* Supports templates for comments based on PUG template engine.
*
* MIT License
*
* @copyright 2017 c... | true |
27ccf67e0e936970f39582053d2a4f70744a073b | JavaScript | qinqiang888/canva | /js/shape.js | UTF-8 | 9,817 | 3.09375 | 3 | [] | no_license | function shape(canvas,canvas1,cobj,xpobj,selectobj){
this.canvas=canvas;
this.canvas1=canvas1;
this.cobj=cobj;
this.bgcolor="#fff";
this.borderColor="#fff";
this.lineWidth=1;
this.type="stroke";
this.shapes="line";
this.history=[];
}
shape.prototype= {
init: function () {
... | true |
d13d122309b03e643265df80ec981fb72bb9879c | JavaScript | TonyShanc/Classroom_Reservation | /WebContent/script/room_select.js | UTF-8 | 2,322 | 2.921875 | 3 | [
"MIT"
] | permissive | function displaySelect(event, ele) {
var table = ele.parent().find("table");
if (event.type == "mouseenter") {
table.show();
} else {
table.hide();
}
}
function changeUseTime(event) {
var target = event.target;
if (target.nodeName == "TD") {
var useTimeInput = $("#use_ti... | true |
f82e61dd3b3ead31abea32c8d9c27421be26d234 | JavaScript | gerardo-ramirez/ReactUdemy | /src/services/transformWeather.js | UTF-8 | 2,032 | 3.421875 | 3 | [] | no_license |
//importamos libreria para cambio de grados centigrados.
import convert from 'convert-units';
import {
CLOUD,
SUN,
RAIN,
SNOW,
THUNDER,
DRIZZLE,
} from './../constans/weather'; // se importo cada constante los archivos de constantes y funciones van en minuscula solo los componentes comienzan co... | true |
87b40a53de5657617ebb47807bcf8a317f5c5621 | JavaScript | phongctnguyen/Fullstack-Javascript | /complete-javascript-course/06-Modal/starter/script.js | UTF-8 | 874 | 2.796875 | 3 | [] | no_license | 'use strict';
const modalElement = document.querySelector('.modal');
const overlayElement = document.querySelector('.overlay');
const btnCloseModalElement = document.querySelector('.close-modal');
const btnOpenModalElement = document.querySelectorAll('.show-modal');
const openModal = () => {
modalElement.classList.... | true |
34226f523af882373edb5cb56bdbc2834e430fad | JavaScript | humorean/AlgorithmChallenge | /test/palindrome.js | UTF-8 | 412 | 2.703125 | 3 | [] | no_license | const assert = require('assert'); //assert is a mocha function
const palindrome = require('../palindrome/palindrome');
describe('palindrome', function(){
it('The result should be true when string is mirrored', function(){
assert.equal(palindrome('abbbba'), true);
});
it('The result should be false when str... | true |
f57cfc4ebe5914fe2c67b4709464e27a33676e09 | JavaScript | morris-ribs/CodingQuestions | /101-150/126-150/138_min_coins/index.js | UTF-8 | 694 | 3.703125 | 4 | [] | no_license | const DENOMINATIONS = [1, 5, 10, 25];
function mininumCoinsDp(N) {
const cache = [];
let i = 0;
while (i < (N+1)) {
cache.push(0);
i++;
}
for (let d = 0; d < DENOMINATIONS.length; d++) {
const denomination = DENOMINATIONS[d];
if (denomination < cache.length) {
cache[denomination] = 1;
... | true |
803fc11e26cbd8f51de66b8be113e9d5e8f734d5 | JavaScript | wi73b-praktisk-web/Hi-Fi-Christoffer-Saaby | /Hi-Fi/Frontend/Public/javascript/produkter.js | UTF-8 | 2,066 | 3.265625 | 3 | [
"MIT"
] | permissive | var urlparametre = hentAlleUrlParametre();
console.log(urlparametre.gruppe);
// hvis vi har modtaget en gruppe i url så viser den produkter ellers viser den grupperne.
if (urlparametre.gruppe !== undefined) {
// udskriv produkter
fetch(`http://localhost:1337/produkter/varegrupper/${urlparametre.gruppe}`)
.then... | true |
ca62a433f627962e74e7fa16237219ea452907dc | JavaScript | hanwei3/zhimei | /env.js | UTF-8 | 1,044 | 2.59375 | 3 | [] | no_license | /* 获取编译时候的配置 */
const chalk = require("chalk");
const envConf = require("./env.json");
if (!envConf) {
throw new Error("未找到根目录下env.json,请检查");
}
function getConfig(type, mode = "release", schema = {}) {
if (!type) {
console.log(chalk.red("请传入type类型"));
return;
}
const configUnit = envConf[type];
if ... | true |
63fd1deaeadbe6c61fb98de6ad75f9d240b04dbe | JavaScript | Yeshuya/CLEFinal | /Canvas/js/stove.js | UTF-8 | 2,102 | 2.765625 | 3 | [] | no_license | var canvas = document.getElementById("stove");
var ctx = canvas.getContext("2d");
/*Layer 1*/
ctx.beginPath();
ctx.moveTo(30,190);
ctx.lineTo(30,40);
ctx.lineTo(170,40);
ctx.lineTo(170,190);
ctx.closePath();
ctx.fillStyle = "#5B5A59";
ctx.fill();
/*Layer 2*/
ctx.beginPath();
ctx.moveTo... | true |
d91bbcbd52e771e01da106e18ffb2ef2a286d442 | JavaScript | veercg/Live-D3 | /public/dist/ngd3.js | UTF-8 | 4,624 | 2.578125 | 3 | [
"MIT"
] | permissive | (function() {
'use strict';
angular
.module('ngd3', []);
})();
(function() {
'use strict';
angular
.module('ngd3')
.directive('donutChart', directive);
/* @ngInject */
function directive() {
var directive = {
restrict: 'E',
scope: {
data: '=... | true |
2f7a07e9cff2ab15967a4b52a2796ca8404a3e2c | JavaScript | cbrannen9a/cryptokeeper | /src/components/List.js | UTF-8 | 1,702 | 2.59375 | 3 | [] | no_license | import React from 'react';
import Pagination from './Pagination';
import Loading from './Loading';
import Table from './Table';
import { getCurrencies, getAllCurrencies } from '../actions';
class List extends React.Component {
constructor() {
super();
this.state = {
page: 0,
perPage: 5,
currencies: []... | true |
dc5a49cff2ab6b6e772bcb80e7792d5495e3322c | JavaScript | elysiaroscoe/LoopChallenges | /1/script.js | UTF-8 | 183 | 3.703125 | 4 | [] | no_license | //Print odds 1-20
//Using a loop write code that will console.log all of the odd values from 1 up to 20.
for(var i=1; i<=20; i++){
if(i % 2 == 1){
console.log (i);
}
} | true |
da12c7cb3ce142e5c74d04d95c6369e2f30eeacf | JavaScript | paul-ndm/Chat-front | /src/utils/api.js | UTF-8 | 2,738 | 2.59375 | 3 | [] | no_license | import { fireBase, db } from "../firebase/firebase"
const URL = 'https://eventchating.herokuapp.com'
// const URL = 'http://localhost:5000'
export const checkAccount = (currentUser) => {
const docName = currentUser.displayName + ' '+ currentUser.uid
return db.collection('user-info').doc(docName).get().then((doc... | true |
6bac5ff5eff9208ecbc7843f372ed754bb700824 | JavaScript | lmontero88/JavaScript-DOM | /exercises/12-Dynamic-HTML-String/index.js | UTF-8 | 102 | 2.828125 | 3 | [] | no_license | let fecha = new Date().getFullYear();
let text = document.createElement("p");
text.innerHTML = fecha;
| true |
4343a09d8d9512b55620c76931ea1194c58c18fb | JavaScript | utkgrover/rock-paper-scissors | /src/pages/bot/calculateWinner.js | UTF-8 | 355 | 2.765625 | 3 | [] | no_license | export default function calculateWinner( botMove , playerMove ){
if (botMove === playerMove){
return "tie";
}
if ((botMove === "stone" && playerMove === "paper") ||
(botMove === "scissors" && playerMove === "stone") ||
(botMove === "paper" && playerMove === "scissors")
){return... | true |
b1fa71473db0a8f3d2d06589f0e8443016888a4b | JavaScript | hilelley/my-shop | /src/component/ProductUpdate.js | UTF-8 | 1,608 | 2.59375 | 3 | [] | no_license | import React, { useContext, useState, useEffect } from "react";
import axios from "axios";
import DataContext from "./DataContext";
import FormProduct from "./FormProduct";
import Products from "./Products";
const ProductUpdate = () => {
const [productId, setProductId] = useState(0);
const [productValue, setProduc... | true |
8657a139a14bf3b59c70f1e770de2d142cc47167 | JavaScript | Evalastersstudent/FeedbackFlamingo | /_harp/assets/js/scripttarieven.js | UTF-8 | 1,468 | 2.53125 | 3 | [
"MIT"
] | permissive | function main() {
if ($('a[rel*="external"]').prop("target", "_blank"));
var DEMOnav = document.getElementById("DEMOnav");
var pijlDEMOnav = document.getElementById("pijlDEMOnav");
var tekstDEMOnav = document.getElementById("tekstDEMOnav");
DEMOnav.addEventListener("mouseover", function()... | true |
3ea9548355ea4bbb1205e9fe21eb0fa1fcd7628b | JavaScript | noura1993/games | /Hangman/hangman.js | UTF-8 | 4,909 | 3.96875 | 4 | [] | no_license |
let firstWord;
let secondWord;
let gameStarted = false;
let player1Guesses = [];
let player2Guesses = [];
let player1Turn = false;
let player2Turn = false;
const getUnderscores = (word, guessed) => {
let result = [];
for (let i = 0; i < word.length; i++) {
if (guessed.includes(word[i])) {
... | true |
ce24cd1baa95b3b9a23d7f32c1f6703896b9dc22 | JavaScript | hingsir/jquery-case-plugin | /jquery.case.js | UTF-8 | 439 | 2.71875 | 3 | [] | no_license | ;(function($){
$.fn.case = function(boolean_expression,true_callback,false_callback){
if(boolean_expression){
if(true_callback && $.isFunction(true_callback)){
true_callback.apply(this[0]);
}
}else{
if(false_callback && $.isFunction(false_callbac... | true |
0f322a6077d6c6259303568ff8d4c51efdbd040c | JavaScript | SharifPaget/senior_project | /fulwrong/main.js | UTF-8 | 3,366 | 2.53125 | 3 | [] | no_license | //Store all tags user clisks on
var filterTags = [];
//Store all my programs
var programs = [{
id: "BKPrideCenter",
tags: ["leisure", "classes", "substance", "career", "hiv", "community", "active", "bkpride"]
},
{
id: "EdieWindsorSAGECenter",
tags: ["classes", "meals", "leisure", "health", "legal", ... | true |
e618e4b39524718af019bf3e9aac8badce7e99b3 | JavaScript | jacksbox/summon-files | /dist/src/utils.js | UTF-8 | 375 | 2.6875 | 3 | [
"ISC"
] | permissive | "use strict";
exports.__esModule = true;
exports.lcFirst = function (string) {
return string.charAt(0).toLowerCase() + string.slice(1);
};
exports.ucFirst = function (string) {
return string.charAt(0).toUpperCase() + string.slice(1);
};
exports.lc = function (string) { return string.toLowerCase(); };
exports.uc... | true |
4446a0435c0091d046d739d33f50aa805f5bd95b | JavaScript | gamkedo-la/Spell-Spiel | /js/UIMessages.js | UTF-8 | 3,383 | 3.09375 | 3 | [] | no_license | // UI. This will mostly include everything relating text on screen, which has to be drawn directly on the scaled canvas
var msgTime;
var msgOnDisplay = [];
function Message() {
this.text = "";
this.x = 32 * PIXEL_SCALE_UP; //Should be outside the main class if we want other messages
this.y = 145 * PIXEL_S... | true |
e4fcb376156c2453fd64ffcfcd7b7bfb8dd1fac0 | JavaScript | antonoden/hackathon | /server/Weapon.js | UTF-8 | 1,099 | 2.828125 | 3 | [] | no_license | var Projectile = require("C:/Users/Anton/Documents/workspace/hackathon/server/Projectile.js");
var Weapon = function(name,player)
{
this.name = name;
this.setWeaponAttributes(name);
Object.defineProperty(this,'player',
{
value:player,
wri... | true |
f98850c26ec29b857e9bf2789f3d0c1e0bea7302 | JavaScript | hemingyeah/PLPcFe | /src/filter/filter.js | UTF-8 | 2,836 | 2.796875 | 3 | [] | no_license | import TaskStateEnum from '../model/enum/TaskStateEnum';
import EventStateEnum from '../model/enum/EventStateEnum';
export default {
//格式化地址显示
"prettyAddress": function(value = {}) {
let province = value.adProvince || value.province || '';
let city = value.adCity || value.city || '';
le... | true |
af9a5619b27cb00a6f2a4a9022c4cbea4290b190 | JavaScript | SOUMITRA1208/aarambh2020-MediLink | /static/medilink/js/buybooks.js | UTF-8 | 4,179 | 3.15625 | 3 | [] | no_license |
let carts = document.querySelectorAll('.add-cart');
let products =
[
{
name: 'Dictionary',
tag: 'dictionary',
price: 100,
inCart: 0
},
{
name: 'Forensic',
tag: 'forensics',
price: 100,
... | true |
ca12e69f2ef0df67222c6ed8ea5da48a546eb75e | JavaScript | aguayorj/superdraft-exercise | /src/api/fetchHelper/fetchCall.js | UTF-8 | 595 | 2.671875 | 3 | [] | no_license | const debug = require('debug')('fetchCall')
const fetch = require('node-fetch')
/**
* calls api
* @param {string} url
* @param {object} requestInitInfo
* @return {object} HTTP Response
*/
const fetchCall = async (url, requestInitInfo) => {
const rawResponse = await fetch(url, requestInitInfo)
const response =... | true |
2c86e03b2c1cbde6921dfb3c7bd7daa0f433118e | JavaScript | susancolour/js-green-book-3 | /chapter-7/s-7.3.1.5/1.js | UTF-8 | 750 | 4.0625 | 4 | [] | no_license | // sleep <n> ms, and resolve <value >
function sleep(tag, n, value) {
console.log(tag);
return new Promise(resolve => setTimeout(()=>resolve(value), n));
}
async function* myAsyncGenerator() {
yield sleep("yield 1st", 10000, 'value 1 delay 10s');
yield sleep("yield 2nd", 1000, 'value 2 now');
}
// 示例:在异步的过程中输... | true |
5094ddf23d7397eda9adf16951ccdc0e69447e6a | JavaScript | Klusmo/SemanaOmniS | /backend/src/controllers/DevController.js | UTF-8 | 2,497 | 3.28125 | 3 | [] | no_license | const axios = require('axios');
const Dev = require('../models/Dev')
const parseStringAsArray = require('../utils/parseStringAsArray');
// Controllers são uma abstração na parte de back-end
// São criados um para cada recurso do sistema, no caso os desenvolvedores
// normalmente possuem no maximo 5 funções: index, sh... | true |
f92a3465ea337b99c8bd407b6e9c74a2111ee6b8 | JavaScript | dwivediparas/dwivediparas777.github.io | /JS/CheckFileType.js | UTF-8 | 1,093 | 3.203125 | 3 | [] | no_license |
function validation(fileNames, _acceptableExtension){
var arrInput = fileNames.getElementsByTagName("input");
alert("test validation at js");
console.log("fileNames", fileNames);
for(var i=0; i<arrInput.length; i++){
var inputData = arrInput[i];
if(inputData.type == "file"){
... | true |
c0076eeabe784b670f72bf39bd79d36ce6a60ecb | JavaScript | angnah/icia_promans | /promans/src/main/webapp/resources/javascript/myPage.js | UTF-8 | 708 | 2.84375 | 3 | [] | no_license | function getAjax(jobCode,clientData,fn){
let ajax = new XMLHttpRequest();
ajax.onreadystatechange = function(){
if(ajax.readyState==4 && ajax.status==200){
window[fn](JSON.parse(ajax.responseText));
}
}
if(clientData != ""){
jobCode += "?" + clientData;
}
ajax.open("GET", jobCode);
ajax.send();
... | true |
1708a1a14209afaf09c12ec2ab6aeb9d4cb0f9dd | JavaScript | srenault-efrei/React-native | /day_3/Exercice_2/App.js | UTF-8 | 2,435 | 2.53125 | 3 | [] | no_license | import React from 'react';
import { StyleSheet, Text, View, SafeAreaView, ScrollView } from 'react-native';
import Constants from 'expo-constants';
import { retryWhen } from 'rxjs/operator/retryWhen';
export default class App extends React.Component {
constructor(props) {
super(props);
this.state = ({
... | true |
8b9faaf43c54777c020a55e48eec279acd64f666 | JavaScript | histefanov/SoftUni-JS-Advanced | /Arrays and Nested Arrays - Lab/04-negative-positive-numbers.js | UTF-8 | 229 | 3.28125 | 3 | [
"MIT"
] | permissive | function arrange(arr) {
const result = [];
for (const item of arr) {
if (item < 0) {
result.unshift(item);
} else {
result.push(item);
}
}
console.log(result.join(" "));
}
arrange([7, -2, 8, 9]);
| true |
bc698ed669b30113a5df4b6ae01e8e2e8c226323 | JavaScript | jeremybwilson/algorithms | /basic_13/remove_duplicates.js | UTF-8 | 1,453 | 4.40625 | 4 | [] | no_license | // Array: Remove Duplicates
// Sara is looking to hire an awesome web developer and has received applications from various sources.
// Her assistant alphabetized them but noticed some duplicates. Given a sorted array, remove duplicate values.
// Because array elements are already in order, all duplicate valu... | true |
70de058c8e7c537fd6c3fb9d5db098eba010fd40 | JavaScript | angelicamolero/CarInsuranceStimator | /src/components/helper.js | UTF-8 | 732 | 3.34375 | 3 | [] | no_license | export function getYearDifference(year) {
return new Date().getFullYear() - year;
}
//calculating the total depending on the brand
export function calculateBrand(brand) {
let increase;
switch(brand){
case 'european':
increase = 1.30;
break;
case 'american':
in... | true |
bbed2c16295435325da6986edbd670397c2b6257 | JavaScript | Adamm285/clickit | /src/components/Todos.js | UTF-8 | 1,380 | 3.015625 | 3 | [
"MIT"
] | permissive | import React, {Component} from "react";
import TodoItem from './TodoItem';
// creates the components that is imports to app.js
import PropTypes from 'prop-types';
//
class Todos extends Component {
Shuffle = (todos) => {
todos.sort(() => Math.random() - 0.5);
return todos;
}
render(){
// this.Shuffle... | true |
3ca4300230284d5d68c71711103d2155b06c6cd5 | JavaScript | itmo-it-group-305/sergey.poliakov-js | /classwork/25112015-objects/js/03-twodimension.js | UTF-8 | 438 | 3.390625 | 3 | [] | no_license | /**
* Created by sergeypoliakov on 25.11.15.
*/
var arr = [ [1,2], [1,3]];
//Вот так обращаться к элементу двухмерного массива
arr[0][1];
var obj = {};
var str = 'age';
obj.age=10;
//Так присвоится str
//obj.str=10;
obj[str]=100;
//Так задается метод
obj.sum=function(x,y){ return x+y;}
console.log (obj.sum(10,23))... | true |
6a176451c57cf203897b834330da69f22da7cea4 | JavaScript | gjp0609/Scripts | /js/tampermonkey/dmhy.js | UTF-8 | 2,145 | 2.515625 | 3 | [] | no_license | // ==UserScript==
// @name * 动漫花园批量复制下载地址
// @namespace https://github.com/gjp0609/Scripts/
// @version 0.1
// @description 动漫花园批量复制下载地址
// @author onysakura
// @include https://dmhy.org/*
// @icon https://www.google.com/s2/favicons?domain=dmhy.org
// ==/UserScript==
(function () {
... | true |
83c530635a32d931ec2da58d46deea6d84687e58 | JavaScript | LenoxJung/tweeter | /public/scripts/app.js | UTF-8 | 4,895 | 2.53125 | 3 | [] | no_license | $(document).ready(function() {
function createTweetElement(tweet, user) {
let $tweet = $('<article>').addClass('tweet');
$tweet.append(`
<header>
<img src=${tweet.user.avatars.small}>
<h2>${tweet.user.name}</h2>
<span>${tweet.user.handle}</span>
</header>
<span>${twe... | true |
e517cea30afd9b3784b37cd91bcb639020c87fe3 | JavaScript | yangfeng002/nodeJs-demo | /module/requireTest.js | UTF-8 | 1,115 | 2.921875 | 3 | [] | no_license | /*
* 一个文件就是一个模块,每个模块都有自己的作用域
* 我们使用var定义的变量不是全局的,它属于当前模块下的
* */
var a = 100;
//console.log(a);
global.a = 200;
//console.log(global.a);
/*
* _filename变量表示当前文件被解析之后的绝对路径(属于当前模块,非全局的)
*/
//console.log(__filename);
/*
*模块加载路径机制 nodejs下
* 绝对路径:
* 相对路径:./是必须的,否则它会加载nodeJs核心的模块,或者是nodeJs的node_modules下面的模块
*
* */
//... | true |
0f12e04eda81085c9ddf98fed8950d35d9cc6ede | JavaScript | lucasfrsi/gsn_server | /controllers/authControllers.js | UTF-8 | 3,989 | 2.6875 | 3 | [
"MIT"
] | permissive | const bcrypt = require('bcryptjs');
const jwt = require('jsonwebtoken');
const authServices = require('../services/authServices');
const { createError } = require('../middleware/helpers/error');
const login = async (req, res, next) => {
const { email, password } = req.body;
let user;
if (!email || !password) ... | true |
fd5d3c69aa4a4215fa1ccb6ea3591b629448622a | JavaScript | olek-hl/GraphQL | /server/src/resolvers/Mutation.js | UTF-8 | 1,140 | 2.53125 | 3 | [] | no_license | function postMessage(parent, args, context, info) {
return context.prisma.createMessage({
messageText: args.messageText
});
}
async function postReply(parent, args, context, info) {
const messageExists = await context.prisma.$exists.message({
id: args.messageId
});
if (!messageExists)
throw new ... | true |
51a158cf29c4bb3af0aedd19569117a87b9806c7 | JavaScript | li-renjie/simple-admin | /src/utils/user.js | UTF-8 | 530 | 2.515625 | 3 | [] | no_license | export const getToken = () => {
return localStorage.getItem('token');
}
export const setToken = (token) => {
return localStorage.setItem('token',token);
}
export const removeToken = () => {
return localStorage.removeItem('token');
}
export const getUserName = () => {
return localStorage.getItem(... | true |
49dd66cdafe87911b036ca7d857b9adf735190b4 | JavaScript | ulfat-dawood/nxn | /dr-card/app.js | UTF-8 | 2,454 | 2.625 | 3 | [] | no_license | const cardsContainer= document.querySelector('#dr-cards-container');
const docList= [
{name:'عبدالمنعم الغامدي', avatarURL:'./img/dr-male.svg', specialty:'طبيب أسنان',specialtyURL:'dentist',fee:'200',hospital:'مستشفى الملك فهد'},
{name:'سهى السابعي', avatarURL:'./img/dr-female.svg', specialty:'طبيب مسالك بولية... | true |
6816f34a7cf1b25b53a757f183aac4f59d56e525 | JavaScript | Spongebobgao/fitness-tracker | /server/src/models/Users.js | UTF-8 | 759 | 2.609375 | 3 | [
"MIT"
] | permissive |
const bcrypt = require('bcrypt')
function hashPassword (user, options) { // eslint-disable-line
const SALT_FACTOR = 8
if (!user.changed('password')) {
return
}
user.setDataValue('password', bcrypt.hashSync(user.password, SALT_FACTOR))
}
module.exports = (sequelize, DataTypes) => {
const User = sequeliz... | true |
22c2825552405ef4f0fe3c69e254abdffbbe3e05 | JavaScript | zzeni/sa-homeworks-08 | /HristinaDocheva/final-test-Hristina-Dotcheva/task2/script.js | UTF-8 | 1,727 | 3.390625 | 3 | [] | no_license | /*globals document, window, $ */
/*jslint esnext: true*/
/*jslint browser: true*/
/*jslint jquery: true*/
"use strict"
// задача 1 (4т.)
// Сортирайте следния списък от числа във възходящ ред:
var arr = [2, 5, 8, 4, 1, 12];
arr.sort(function compare (a, b) {return a-b;});
//...
// задача 2 (4т.)
// Напишете функци... | true |
9bce2e8f648a5ef947aa4b652f84c1694badb371 | JavaScript | Cubik65536/ebook-viewer | /sw.js | UTF-8 | 1,326 | 2.71875 | 3 | [] | no_license | const filesToCache = ['./', './index.html']
const cacheName = 'ebook'
// install
self.addEventListener('install', (event) => {
console.log('installing…')
event.waitUntil(
caches.open(cacheName).then((cache) => {
console.log('Caching app ok')
return cache.addAll(filesToCache)
})
)
})
// activ... | true |
216144a8fcba31398b13a8c91613afb8b9b4c0d1 | JavaScript | ryanxmccarthy/leetcode | /javascript/1-99/70-79/70 - Climbing Stairs.js | UTF-8 | 281 | 3.203125 | 3 | [] | no_license | /**
* @param {number} n
* @return {number}
*/
var climbStairs = function(n) {
//initializing fibonacci sequence
const memo = [1,1,2];
for (let i = 3; i <= n; i++) {
//fibonacci sequence
memo[i] = memo[i-1] + memo[i-2];
}
return memo[n];
}; | true |
2d1055c901c9890b4ca6494ced24da0b0e45d092 | JavaScript | nguyenn8/CS493-final-project-oregon-humane-society | /models/photo.js | UTF-8 | 3,585 | 2.875 | 3 | [] | no_license | /*
* Photo schema and data accessor methods.
*/
const fs = require("fs");
const crypto = require("crypto");
const { ObjectId, GridFSBucket } = require("mongodb");
const { getDbReference } = require("../lib/mongo");
const { extractValidFields } = require("../lib/validation");
/*
* Schema describing required/option... | true |
515af8f4f43a3a6c0d46cecf5748995344c24dff | JavaScript | swordguard/codility | /Lessons/PrefixSums/CountDiv/solution.js | UTF-8 | 476 | 3.09375 | 3 | [] | no_license | function solution(A) {
// write your code in JavaScript (Node.js 8.9.4)
if (B < A || K < 1) {
return 0
}
if (A === B && A === 0) return 1
if (K > B) return A === 0 ? 1 : 0
if (K === B) return 1 + (A === 0 ? 1 : 0)
if (K < B && K >= A) {
return Math.floor(B / K) + (A === 0 ?... | true |
a5faa38dcef52249a4349ba64e42dcb9725570c4 | JavaScript | zakariazafar/stest | /app/assets/javascripts/base.js | UTF-8 | 1,876 | 2.703125 | 3 | [] | no_license | if (!window.App) { window.App = {}; }
App.Base = class Base {
constructor() {
if (window.jQuery) { this.setClearEventHandlers(); } // clearing application event handlers only possible with jQuery
return this;
}
/*
Run the new action for the create action. Generally the create action will 'render :ne... | true |
57d4b009782c581085f7e16744d64420b5ee98ee | JavaScript | n-ckr-ch-rds-n/notebook-js | /lib/single-note-view.js | UTF-8 | 280 | 2.734375 | 3 | [] | no_license | (function(exports) {
function SingleNoteView(note) {
this.note = note;
};
SingleNoteView.prototype.noteHtmlString = function () {
var htmlstring = `<div>` + this.note.read + `</div>`;
return htmlstring;
};
exports.SingleNoteView = SingleNoteView;
})(this)
| true |
b82ffe9d9fd0a5cec86b75840c994a4cbf326adb | JavaScript | andycanderson/tictactoe | /js/main.js | UTF-8 | 4,174 | 2.734375 | 3 | [] | no_license | var app = angular.module('tRexToe', ["firebase"]);
app.controller('boardController', ['$scope','$firebase', function($scope, $firebase){
$scope.q = {};
$scope.q.scoreKeeper=[0,0];
$scope.q.initiate = false;
$scope.q.player= 1;
$scope.q.end_game;
$scope.q.over = false;
$scope.q.swc = [["","",""],["","",""],[""... | true |
0e91f5b00b46150e58713d77e520671bd9f69ac1 | JavaScript | gonmastronardi/js-normalizer | /classes/fields/SpeedProcessorNormalizer.js | UTF-8 | 1,578 | 3.09375 | 3 | [] | no_license | import FieldNormalizer from "./FieldNormalizer.js";
export default class SpeedProcessorNormalizer extends FieldNormalizer {
constructor() {
super();
//words to remove from title description
this.unusefulWords = ["Procesador", "Processor"];
}
normalize(anObject, attribute) {
let speedProcessor = ... | true |
465c46d87a2d5aa6f11002ccba670d747265db1f | JavaScript | mjzefeldt/outerwear | /client/components/PasswordReset.js | UTF-8 | 1,978 | 2.828125 | 3 | [
"MIT"
] | permissive | /*
We will redirect our user to this component if we
need them to change their password
*/
import React, {Component} from 'react'
import {connect} from 'react-redux'
import {resetPassword} from '../store'
/**
* COMPONENT
*/
class PasswordReset extends Component {
constructor(props) {
super(props)
this.sta... | true |
207b7f9229662a8d3aba8b13084e32b578536699 | JavaScript | snucalendar/snucalendar_frontend | /src/components/DayEventList/DayEventList.js | UTF-8 | 2,034 | 2.640625 | 3 | [] | no_license | import React, { Component } from "react";
import EventDetail from '../EventDetail/EventDetail';
import EventBlock from '../EventBlock/EventBlock'
import './DayEventList.css'
class DayEventList extends Component {
state = {
clickedEvent: null,
events : [],
modal : null,
}
component... | true |