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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
dd82e06ac8a3eb584e118ec344f50e7e4b937d9e | JavaScript | felipenaf/js_udemy2019 | /fundamentos/notacao.js | UTF-8 | 218 | 3.734375 | 4 | [] | no_license | // funções são objetos no js
function Pessoa(nome){
this.nome = nome
this.exec = function(){
return "Executando ..."
}
}
var p1 = new Pessoa("Felipe")
console.log(p1.nome)
console.log(p1.exec()) | true |
fd15bf6f1a1fde54afb26747036133edbfb996c6 | JavaScript | laurenashleigh/evaluate-news-article | /projects/weather-journal-app/website/app.js | UTF-8 | 3,089 | 3.359375 | 3 | [
"MIT"
] | permissive | /* Global Variables */
const apiKey = '&appid=e417b88cc12c7202f273a0b0af0e5ed7&units=metric';
const baseUrl = 'http://api.openweathermap.org/data/2.5/weather?zip=';
// Create a new date instance dynamically with JS
let d = new Date();
let month = new Array();
month[0] = "January";
month[1] = "February";
month[2] = "Ma... | true |
1f952c1232432d555ac30ca19ea00e0748e24af9 | JavaScript | Fred78560/pile_face | /pile_face/pile_face.js | UTF-8 | 343 | 2.765625 | 3 | [] | no_license |
exports.action = function(data){
var randomNumber = Math.random();
//Check the random number to determine heads or tails
if (randomNumber < 0.5) {
console.log("C'est pile!");
JarvisIASpeech("Je lance une pièce... c'est pile")
} else {
console.log("C'est face!");
JarvisIASpeech("Je lance une pièce... c... | true |
2b0a0831d863fe82acf7b437b63d9e008de71edd | JavaScript | Keatles/Keatles.github.io | /nuomi/vue/data-bind-1.js | UTF-8 | 968 | 3.3125 | 3 | [] | no_license | class Observer{
constructor(data){
this.data = data;
this.walk(data);
}
walk(obj){
let val;
for(let key in obj){
if(obj.hasOwnProperty(key)){
val = obj[key];
if(typeof(val) === 'object'){
this.walk(val);
... | true |
4c8a6af13764a30e57ff40a79f1cbfb0e1ff7174 | JavaScript | JeanLuc-Noah/Site-vitrine-Smarter-complet | /js/slide.js | UTF-8 | 631 | 3.125 | 3 | [] | no_license | // Veriables globales
let compteur = 0;
let timer, slides , diaporama, slideLargeur;
window.onload = () => {
const slider = document.querySelector(".slider")
slides = document.querySelector(".slides")
diaporama = Array.from(slides.children)
//Calcul de largeur du slide
slideLargeur = diaporama.getBoundingCli... | true |
9275de6dd08698145cd4733bcf116d7031c2fc88 | JavaScript | ribastudio/Trybe-Exercises | /fundamentos-do-desenvolvimento-web/bloco-4-introducao-a-js-e-logica-programacao/dia-4-js/exercise_2.js | UTF-8 | 424 | 4.75 | 5 | [] | no_license |
/* Crie uma função que receba um array de inteiros e retorne o índice do maior valor.
Array de teste: [2, 3, 6, 7, 10, 1]; .
Valor esperado no retorno da função: 4 .
*/
function bigValue (numberArray) {
let numberMore = 0;
for (let indx in numberArray){
if (numberArray[numberMore] < numberArray[indx]) {
... | true |
85679326f0a439e4f76dbfc3620172411d596188 | JavaScript | Taimakh/BackgroundGenerator-.github.io | /script.js | UTF-8 | 1,373 | 2.96875 | 3 | [] | no_license | var css=document.querySelector("h3");
var color1=document.querySelector(".color1");
var color2=document.querySelector(".color2");
var color3=document.querySelector(".color3");
var color4=document.querySelector(".color4");
var color5=document.querySelector(".color5");
var color6=document.querySelector(".color6");
var co... | true |
a5e51e9f61c56a5dbf3fd049ba589167d52b9e04 | JavaScript | rc21net/js-DropDown | /drop-down.js | UTF-8 | 1,444 | 2.65625 | 3 | [] | no_license | (function( $ ) {
$.fn.dropDown = function (params) {
params = params || {};
params.activeClass = params.activeClass || 'active';
// класс открытого контейнера
params.droppedClass = params.droppedClass || 'dropped';
params.thisClass = params.thisClass || 'drop-down';
var dropped = '.' ... | true |
d5069352f6af89be3392e2981f5c4882ea220ad2 | JavaScript | KennethDelaCruz/c0121-code-solutions | /javascript-functions-practice/get-square-of-number.js | UTF-8 | 83 | 2.84375 | 3 | [] | no_license | /* exported getSquareOfNumber */
function getSquareOfNumber(x) {
return x * x;
}
| true |
17f8f186afe2787247b0550c6f953238adb26f73 | JavaScript | creativesites/condonow-scraper | /temp.js | UTF-8 | 3,822 | 2.65625 | 3 | [] | no_license | let propLinks = []
const scraperObject = {
url: 'https://condonow.com/Toronto-New-Condos-VIP-Coming-Soon',
async scraper(browser){
let page = await browser.newPage();
console.log(`Navigating to ${this.url}...`);
await page.goto(this.url, {timeout: 0});
const cc = '#searchre... | true |
d5529f66b2552c6091f08996c3e9091b6c16e0f8 | JavaScript | jyotman/hackernews | /service/hackernews.js | UTF-8 | 636 | 2.625 | 3 | [] | no_license | 'use strict';
const request = require('request');
const BASE_API = 'https://hacker-news.firebaseio.com/v0';
exports.getTopStoryIds = () => {
return fetch('topstories.json')
}
exports.getStoryById = (storyId) => {
return fetch(`item/${storyId}.json`);
}
function fetch(path) {
const URL = `${BASE_API}/${... | true |
19a5eeddba471499b5511637a09ecc9fd061c12c | JavaScript | prinze77/capsrvd | /server/packet.js | UTF-8 | 1,117 | 2.6875 | 3 | [] | no_license | const u = require("../unit");
const connection = require("./connection.js");
module.exports = class packet {
constructor(timestamp, connId) {
this.timestamp = timestamp;
this.connId = connId;
this.method = null;
this.exchange = null;
// пакет еще не готов
this.ready = false;
this.error =... | true |
a81a4e6677083ad31a038e2bda43e12062e5a052 | JavaScript | yacine-21/exos_js | /assets/js/lib/dom.js | UTF-8 | 1,457 | 3.59375 | 4 | [] | no_license | // let heure_avant = document.getElementById("heure")
// let heure = document.getElementById("bouton")
// heure.addEventListener("click", buttonClicked)
// heure_avant.innerHTML = new Date().toLocaleTimeString('fr')
// function buttonClicked (){
// heure_avant.innerText = new Date().toLocaleTimeString('fr')
// ... | true |
30259bba42708b458782dda9671c442f59821d5f | JavaScript | GBegazo/sw2 | /static/js/trivia/info.js | UTF-8 | 1,956 | 2.53125 | 3 | [
"MIT"
] | permissive | $(document).ready(function () {
var preguntas = [];
var respuestas = [];
var rel = [];
var docs2 = [""];
//Remplazar el 127.0.0.1 por el link publico
var url = "https://apuestaperusia.herokuapp.com/api/trivia";
// var url = "http://127.0.0.1:8000/api/trivia"
var jqxhr = $.get(url, funct... | true |
bd339b387140084c05399a41863faead55ba6512 | JavaScript | JohnHAOCENG/WebProject | /controllers/userController.js | UTF-8 | 1,181 | 2.546875 | 3 | [] | no_license | const bcryptjs = require("bcryptjs");
var User = require("../models/userModel");
exports.userRegister = function(req,res){
const{givenName,familyName,email,password} = req.body;
User.findOne({email:email}).then((user)=>{
if(user){
res.status(409).json({error:"Email already registered!"})
... | true |
dec980a283a67e162fdbeb204a08408b91d4b9cb | JavaScript | bouncingbumble/dog-breed-guessing-game | /src/Form.js | UTF-8 | 1,673 | 2.75 | 3 | [] | no_license | import React, { Component } from 'react';
import DogAnswer from './DogAnswer';
import DogChoices from './DogChoices';
import DogPic from './DogPic';
const QuestionStates = {
QUESTION: 0,
ANSWER_WRONG: 1,
ANSWER_CORRECT: 3
}
class Form extends Component {
constructor(props){
super(props);
... | true |
c74d90d7d31ee587831c8fd089fef9f2a11b28d9 | JavaScript | sum1991/Algorithms | /sorted_element_rotated.js | UTF-8 | 1,198 | 3.53125 | 4 | [] | no_license | class rotatedElementSearch{
constructor(){
console.log("hello")
}
findingPivot(arr,low,high)
{
if(high<low)
return -1;
if(high==low)
return low;
let mid = Math.floor((low+high)/2)
if(mid<high && arr[mid] > arr[mid+1])
return mid;
if(mid>low && arr[mid] < arr[mid-1])... | true |
a25cfd574fa8111b95897fd1fcce3e80551f7ef0 | JavaScript | MichaelWrobelPersonal/Hangman-node-app | /index.js | UTF-8 | 2,182 | 3.9375 | 4 | [
"Unlicense"
] | permissive | // dependency for inquirer npm package
let inquirer = require("inquirer");
let Word = require("./Word");
// variables
let gameWord = null;
let guessedLetter = false;
let availableLetters = "abcdefghijklmnopqrstuvwxyz";
let wrongGuesses = 0;
const MAX_GUESSES = 10;
const ALPHABET = "abcdefghijklmnopqrstuvwxyz";
// co... | true |
2d5d78b0a5763eb6bb51e83abad160c10b20cc64 | JavaScript | bAvenir/vicinity-agent | /src/_persistance/_models/dataurls.js | UTF-8 | 1,999 | 2.90625 | 3 | [
"MIT"
] | permissive | // Global packages
const services = require('../services');
/**
* dataurls.js
* dataurls model
* [dataurls] list in REDIS contains strings with info to request data from known objects
* oid:interaction:interaction_id
* oid is the VICINITY object id
* interaction can be property, event or action
* interaction_id... | true |
d690ffa1de8d4d25d8d253ee0629268fea158b95 | JavaScript | yusufabdillahputra/hapi | /src/helper/generator.js | UTF-8 | 3,762 | 2.515625 | 3 | [
"ISC"
] | permissive | module.exports = {
searchGenerator: (req, like = true) => {
const prop = {
column: req.query.column || null,
columnField: req.query.columnField || null,
limit: req.query.limit || null,
offset: req.query.offset || null,
sort: req.query.sort || null,
sortOption: req.query.sortOp... | true |
a68ec1d6fcc359cf5da67e0088b64e28427d3895 | JavaScript | TehShrike/spreadsheet-page-break-app | /client/service/googleApi.js | UTF-8 | 2,700 | 2.640625 | 3 | [] | no_license | const EventEmitter = require('eventemitter')
const DISCOVERY_DOCS = [ 'https://sheets.googleapis.com/$discovery/rest?version=v4' ]
const SCOPES = 'https://www.googleapis.com/auth/spreadsheets.readonly'
module.exports = async function googleApiWrapper({ config, mediator }) {
const googleApi = gapi // eslint-disable-l... | true |
31edfa7b19a8ae74965eebb630900afbfd0be0ad | JavaScript | Mrkoffi/Campus-TV | /src/main/webapp/js/facultynewsloader.js | UTF-8 | 3,738 | 2.796875 | 3 | [] | no_license | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
$(document).ready(function () {
//$(".mThumbnailScrollers").mThumbnailScroller({
// axis:"y" //change to "y" for vertica... | true |
fa726aa45c114771954468470cbb40a86074684e | JavaScript | CodyMaughan/Mask-RCNN | /venv/Lib/site-packages/pycoco/coverage.js | UTF-8 | 7,440 | 2.609375 | 3 | [] | no_license | function get_children(node, type)
{
if (type)
type = type.toLowerCase();
var result = [];
for (var i = 0; i < node.childNodes.length; ++i)
{
var child = node.childNodes[i];
if (child.nodeType == 1 && (!type || (child.nodeName.toLowerCase() == type)))
result.push(child);
}
return result;
}
function get_n... | true |
74bcbecae3117b5c3624ba49d7bb3986eb6e1f3a | JavaScript | Klaillton/Estudos | /AlgaworksProject/JavaScript/funcoes_fabrica/funcoes_fabrica.js | UTF-8 | 241 | 2.90625 | 3 | [] | no_license | var criarCarro = function(nome, placa) {
return {
nome: nome,
placa: placa,
fabricante: 'VW'
};
}
var fox = criarCarro('Fox', 'AAA-1111');
console.log('fox', fox);
var gol = criarCarro('Gol', 'AAA-2222');
console.log('gol', gol); | true |
d049ee42e69d45f24b3b54b4816eca49a396c2e5 | JavaScript | swkoubou/GA_crx | /button.js | UTF-8 | 451 | 2.65625 | 3 | [] | no_license | window.onload = function() {
document.getElementById('ToSHA1').addEventListener("click", function ToSHA1() {
var seed = document.getElementById('input1').value;
document.getElementById('input3').value = CybozuLabs.SHA1.calc(seed);
});
document.getElementById('cut16').addEventListener("click", function hogehog... | true |
7f231f13630c10e92e995970f9dbbd4ba47edbd4 | JavaScript | kolinkuang/algoCamp | /src/171.titleToNumber/case2.js | UTF-8 | 1,373 | 4.1875 | 4 | [] | no_license | //给你一个字符串 columnTitle ,表示 Excel 表格中的列名称。返回该列名称对应的列序号。
//
//
//
// 例如,
//
//
// A -> 1
// B -> 2
// C -> 3
// ...
// Z -> 26
// AA -> 27
// AB -> 28
// ...
//
//
//
//
// 示例 1:
//
//
//输入: columnTitle = "A"
//输出: 1
//
//
// 示例 2:
//
//
//输入: columnTitle = "AB"
//输出: 28
//
//
// 示例 3:
//
//
//输入: ... | true |
a0040369d966ed6ef704d46e82788d0361c06379 | JavaScript | laurentchasserat/laurentchasserat.github.io | /docs/poly-spirals/drawer.js | UTF-8 | 27,213 | 2.546875 | 3 | [
"MIT"
] | permissive | /* Init variables */
// Retrieve canvas
var canvas = document.getElementById("the-canvas");
// var canvasSVGContext = new CanvasSVG.Deferred();
// canvasSVGContext.wrapCanvas(canvas);
var ctx = canvas.getContext('2d');
var width = canvas.width;
var height = canvas.height;
var theColor = "#ddd"
// Normalized polygon... | true |
dca01d5836d0e10e8b591d7df65f19e9b760527d | JavaScript | thomasatp/animate | /src/VisualStory.jsx | UTF-8 | 2,787 | 2.6875 | 3 | [] | no_license | import React, {useRef, useState, useEffect} from 'react';
import img2 from './medias/img2.jpg'
import img3 from './medias/img3.jpg'
export default function VisualStory({direction}) {
const elt1 = useRef();
const elt2 = useRef();
const elt3 = useRef();
const init = window.innerHeight / 2
const [r... | true |
beb9d4d6db375d469341f5c5696cde2e876e9733 | JavaScript | nmyers217/advent_of_code_2018_es6 | /src/day07.js | UTF-8 | 3,284 | 3.171875 | 3 | [] | no_license | const chalk = require('chalk');
const fs = require('fs');
const path = require('path');
const WORKER_COUNT = 5;
const SECOND_PENALTY = 60;
const filePath = path.join(__dirname, '..', 'res', 'day07.txt');
const input = fs
.readFileSync(filePath)
.toString()
.split('\n');
const instructions = input.map(function ... | true |
545357f65742095bb87cfc3f8696c4af39dd6d77 | JavaScript | akari0624/drinkOrderSystem_server- | /index_websocket.js | UTF-8 | 3,374 | 2.84375 | 3 | [] | no_license | const WebSocket = require('ws');
const Client = require('./models/ws/Client');
const ChatRoom = require('./models/ws/ChatRoom');
const WebSocketServer = WebSocket.Server;
const wsPort = 8090;
const server = new WebSocketServer({ port: wsPort });
console.log(`webSocket server is up on port:${wsPort}`);
const generate... | true |
c3248e77bcacb7a24a13ba02317762fe42886052 | JavaScript | Pratheekl22/CMGame1 | /Character.js | UTF-8 | 657 | 3.28125 | 3 | [] | no_license | //Class that defines character objects and their attributes
class character {
name;
type;
personality;
weapon;
attacks;
health;
constructor(name, type, personality, weapon, attacks, health) {
this.name = name;
this.type = type;
this.personality = personality;
... | true |
44758b839e2deef6e32e623b87e66bc934cf5be8 | JavaScript | Raj-04/web-sprint-challenge-advanced-react | /src/components/CheckoutForm.test.js | UTF-8 | 1,493 | 2.546875 | 3 | [] | no_license | import React from "react";
import MutationObserver from 'mutationobserver-shim';
import { screen, render, waitFor } from "@testing-library/react";
import CheckoutForm from "./CheckoutForm";
import userEvent from '@testing-library/user-event';
// Write up the two tests here and make sure they are testing what the title... | true |
3c90336192b4795a7fcbde793a48143d324141c5 | JavaScript | SamStonehouse/advent-of-code-2019 | /day-4/main.js | UTF-8 | 1,547 | 3.53125 | 4 | [
"MIT"
] | permissive | const MIN_PASSWORD = 387638;
const MAX_PASSWORD = 919123;
// const validRange = (password) => {
// return password < MAX_PASSWORD && password > MIN_PASSWORD;
// }
const validInc = (password) => {
const passwordLength = Math.log(password) * Math.LOG10E + 1 | 0;
let previous = password % 10;
for (let i = 0; i < pas... | true |
07af783863e7650f32f1b5c96d0aa0c597ff6fed | JavaScript | CharlesHolbrow/synk-js | /src/Synk.es6.js | UTF-8 | 3,746 | 2.96875 | 3 | [] | no_license | import Objects from './Objects';
import Connection from './Connection';
/**
* Synk represents a connection to the synk server. Its responsibilities:
* - create a connection to the server
* - track a set of subscriptions keys
* - store objects retrieved from the server
*
* The objects stored in this.objects will ... | true |
6ca17b6c10de4f767ec7b369207b57b18b288129 | JavaScript | lfelberg/movie-list | /src/lib/searchMovieDB.js | UTF-8 | 666 | 2.65625 | 3 | [] | no_license | import API_KEY from '../../config/keys.js';
const searchMovieDB = (
{ query = '', key = API_KEY} = {},
successCB = (data) => { console.log(data); },
errorCB = () => console.log('We\'ve got a problem!')
) => {
let requestURL = `https://api.themoviedb.org/3/discover/movie?api_key=${key}&sort_by=popularity.desc`;... | true |
1d828299e0626f1b9a1417ee64692f5062d9404b | JavaScript | TheCraftedGem/thecraftedgem.github.io | /inclass_client/src/reducers/teacherReducer.js | UTF-8 | 1,188 | 2.65625 | 3 | [] | no_license | const defaultState = {
teacher: null,
loggedIn: false,
authenticatingTeacher: false,
failedLogin: false,
error: null
}
const teacherReducer = (state=defaultState, action) => {
switch (action.type) {
case 'SAVE_TEACHER':
return { ...state, teacher: action.payload, loggedIn: false, authenticatingTe... | true |
022c82c0150bfe70988c9edfa4c888bb7766c75a | JavaScript | CarShopEcom/CarShop | /js/main.js | UTF-8 | 1,351 | 2.828125 | 3 | [
"MIT"
] | permissive | /* eslint-disable indent */
'use strict';
// console.log(allCar);
let indeximage = 1;
for (let i = 0; i < 4; i++) {
console.log('image-' + indeximage,'ssssssssssssssssssss', allCar[i].filePath);
document.getElementById('image-' + indeximage).setAttribute('src', allCar[i].filePath);
document.getElementById('... | true |
38838dee366acedf744e9848302abed9f4422224 | JavaScript | theopolisme/ReadingOptions | /resources/ext.ReadingOptions.js | UTF-8 | 6,242 | 2.640625 | 3 | [] | no_license | ( function ( $ ) {
var DEFAULTS = {
'color-mode': -1, // no styles applied
'font-size': false // uses current size
},
// Prefix for localStorage keys
lsPrefix = 'readingoptions-',
// Main body content area. If on mobile, $main is page-center so
// that styles/positions won't mess with the left naviga... | true |
0299a15ceca41055b6faa539920a501ce510877a | JavaScript | yxxcrtd/jitar2012 | /WebContent/js/jitar/marquee.js | UTF-8 | 1,972 | 2.703125 | 3 | [] | no_license | if (!!!window.MarqueeScroll) {
var MarqueeScroll = function(containerId, contentId, step, speed) {
var Container = document.getElementById(containerId);
var Content = document.getElementById(contentId);
var Guid = ("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".replace(/[x]/g,
function(c) {
var r = Math.r... | true |
44b115089bc721b7a200b3aafb6f94e79514e441 | JavaScript | yuanjli/testing_repo | /search_insert_position.js | UTF-8 | 792 | 4.28125 | 4 | [] | no_license | /*
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.
You may assume no duplicates in the array.
Example 1:
Input: [1,3,5,6], 5
Output: 2
Example 2:
Input: [1,3,5,6], 2
Output: 1
Example 3:
Input: [1,3,5,6], 7
Ou... | true |
a547bb7881095c7be41b2042d5ff217da8feb7c6 | JavaScript | WebVoid/AWSELBtoGoAccess | /custom.js | UTF-8 | 422 | 2.65625 | 3 | [
"MIT"
] | permissive | function findGetParameter(parameterName) {
var result = null,
tmp = [];
location.search
.substr(1)
.split("&")
.forEach(function (item) {
tmp = item.split("=");
if (tmp[0] === parameterName) result = decodeURIComponent(tmp[1]);
});
return result;
}
if(findGet... | true |
4283392c16137711766edb83561e0700b3ea8afc | JavaScript | TrevorPawlewicz/react-magic-8ball | /src/playground/counter-state.js | UTF-8 | 2,664 | 3.703125 | 4 | [] | no_license | class Counter extends React.Component {
constructor(props){
super(props);
this.handleAddOne = this.handleAddOne.bind(this);
this.handleMinusOne = this.handleMinusOne.bind(this);
this.handleReset = this.handleReset.bind(this);
// state is an OBJECT:
this.state = {
... | true |
dcdf723260bad1adfd61ef6d424bf8bd8ed34d94 | JavaScript | Pacman29/ExpPlaning | /app/services/model.js | UTF-8 | 727 | 2.90625 | 3 | [] | no_license | export default class Model{
static experiment(N, lambda, myu){
let dT = 0.0001;
let queue = [];
let next_m = lambda();
let next_w = myu();
let t_free = true;
let time_res = 0;
let n = N;
for(let t = 0; (n > 0) || (queue.length > 0); t+=dT ){
if((next_m <= t) && (n>0)){
... | true |
7ca62193dfe374ea550e648c18b318f84b6798bb | JavaScript | arthurysong/swriter_api | /routes/helpers/fetchAccessTokenUsingRefreshToken.js | UTF-8 | 797 | 2.59375 | 3 | [] | no_license | const request = require('request');
require('dotenv').config();
function fetchAccessTokenUsingRefreshToken(refreshToken) {
return new Promise ((res, err) => {
const form = {
refresh_token: refreshToken,
client_id: process.env.MEDIUM_CLIENTID,
client_secret: process.env.... | true |
a29daeeba983581d8ce70118c7553e1719365412 | JavaScript | latinawhocodes/fewpjs-class-extensions-extends-lab-online-web-ft-061019 | /index.js | UTF-8 | 1,230 | 3.875 | 4 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | // Your code here
class Polygon {
constructor(sides){
this.sides = sides;
this.count = this.sides.length;
}
get countSides(){
return this.sides.length;
}
get perimeter(){
let totalPerimeter = 0;
for (let i = 0; i < this.countSides; i++){
let side... | true |
f2300c55ce2788f96e3a57ffd466feeae2ce027f | JavaScript | soul-wish/grunt-stats | /tasks/stats.js | UTF-8 | 5,661 | 2.765625 | 3 | [
"MIT"
] | permissive | /*
* grunt-stats
* https://github.com/soul-wish/grunt-stats
*
* Copyright (c) 2016 Sergey Lysenko
* Licensed under the MIT license.
*/
'use strict';
var fs = require('fs'),
path = require('path'),
CliTable = require('cli-table'),
fileSize = require('file-size');
module.exports = function (grunt) {
... | true |
6623217b3ca7aabcb51aa4b27aefe99e97afff96 | JavaScript | jayfbeast/Home-Assistant-Picture-Elements-UI | /www/custom-lovelace/rgb-light-card/rgb-light-card.js | UTF-8 | 3,607 | 2.75 | 3 | [] | no_license | class RGBLightCard extends HTMLElement {
set hass(hass) {
this._hass = hass;
if (!this.content) {
this.init();
this.update();
}
}
init() {
let shadow = this.attachShadow({ mode: 'open' });
shadow.appendChild(RGBLightCard.getStaticCSS());
... | true |
87cf66c55f0e2301bed24ae28b7f949e5fe1a8ee | JavaScript | t0taL/external-courses | /finalTask/js/model/constructors.js | UTF-8 | 6,847 | 3.40625 | 3 | [] | no_license | // -------------------------------------
// -----------Constructors--------------
// -------------------------------------
// book constructor
class Book {
constructor () {
// getting elem
this.wrap = document.querySelector('.main-container__content');
// creating elems
this.item = document.createElement('di... | true |
5beffa29cdd7b6d799dbaf9fe17dbee4f7c39132 | JavaScript | AnnaBreton/ACuteGhostAnimation | /animationTest1/index.js | UTF-8 | 6,882 | 2.859375 | 3 | [] | no_license | /*
Attempting to bring a version of Jordan Jenkins' Halloween ghost to life in the browser. Check out the inspiration and originals at https://dribbble.com/shots/3055734-Have-a-Happy-Halloween and https://dribbble.com/shots/3878696-Happy-Halloween!
*/
class Ghost {
constructor(el) {
this.scene = el;
... | true |
b685071322be3e49f5d4ff345334bea1fe87f690 | JavaScript | ipolekhin/674919-keksobooking-19 | /js/pin.js | UTF-8 | 3,230 | 2.953125 | 3 | [] | no_license | 'use strict';
(function () {
var MOCKS_LENGTH = 8;
// Создаем пустой массив
var pins = [];
// С помощью функции генерируем случайное число от и до
var generateNumbersOfRange = function (min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
};
// С помощью функции генерируем массив с... | true |
7a9931310f2240061d219b951a334274517218c0 | JavaScript | DavionPAG/caps | /vendor.js | UTF-8 | 545 | 2.515625 | 3 | [
"MIT"
] | permissive | 'use strict';
const {events} = require('./events');
var store = process.env.STORE || 'Puma';
events.on('order', newOrder)
events.on('delivered', () => console.log('Vendor: Thank you!'))
function newOrder() {
let order = {
storeName: store,
orderId: 1,
customerName: 'Joe Ward',
ad... | true |
43582ac682bf861ac2a48dccf8b7479bd3d17a54 | JavaScript | Slavenzka/272763-cinemaddict-11 | /src/utils/render.js | UTF-8 | 1,672 | 2.734375 | 3 | [] | no_license | import {RenderPosition} from '../const';
export const renderSectionElement = (container, className, type = `section`) => {
const sectionElement = document.createElement(type);
sectionElement.classList.add(className);
container.appendChild(sectionElement);
return container.querySelector(`.${className}:last-of-t... | true |
66770ce522dbeec286704615b5a6002535af202a | JavaScript | JongSeokJang/ECMAScript_practice | /library_string.js | UTF-8 | 1,254 | 4.1875 | 4 | [] | no_license |
console.log("hi".repeat(6));
var str = "hi, I'm developer";
console.log(str.includes("I'm",4));
console.log(str.startsWith("hi",2));
let str1 = `hihihi!!!`;
let str2 = "hihihi!!!";
console.log( str1 === str2 )
let a = 20;
let b = 10;
let c = "javascript";
let str3 = `i\'m ${a+b} year\'s old and like ${c}`;
co... | true |
b63d24002e05ec94b73764da76178967e5b1dff0 | JavaScript | emma-metodieva/SoftUni_JS_Advanced_202109 | /01. Syntax, Functions and Statements - Lab/04. Circle Area.js | UTF-8 | 262 | 3.5 | 4 | [] | no_license | function circleArea(r) {
if (typeof r == "number") {
console.log((Math.PI * r ** 2).toFixed(2));
} else {
console.log(`We can not calculate the circle area, because we receive a ${typeof r}.`);
}
}
circleArea(5);
circleArea('name'); | true |
e5249a6f03381b350d84f8ae1bab61f7b6efc69b | JavaScript | helent8n/BellyButtonBioDashboard | /static/js/app.js | UTF-8 | 3,044 | 3.390625 | 3 | [] | no_license | function buildMetadata(sample) {
// using d3.json to fetch the metadata for a sample == @app.route("/metadata/<sample>")
// http://learnjsdata.com/read_data.html
var url = `/metadata/${sample}`;
d3.json(url).then(function(sampleMetadata){
console.log(sampleMetadata);
// use d3 to select the panel with i... | true |
9e3f7d21d1a6a9e5b06f31a120ba6ec4afca63ea | JavaScript | scalalang2/terra-dapp-samples | /src/components/react/CounterSample.js | UTF-8 | 801 | 2.984375 | 3 | [] | no_license | import Page from 'components/Page';
import { useState } from 'react';
/*
* [직접 해보기]
* 1. 카운터 감소하기 버튼 만들기 (단, 카운터가 음수가 되면 안된다)
* 2. 여러개의 카운터를 만들어보기
*/
export default function CounterSample(){
let [counter, setCounter] = useState(1);
function handleClick() {
setCounter(counter + 1)
}
return... | true |
9372f400e9cf9972e4aca0316255aa61c49689f2 | JavaScript | arafat877/barbot-7 | /server/server.js | UTF-8 | 860 | 2.609375 | 3 | [] | no_license | 'use strict'
const IO = require('socket.io')
const tweets = require('./tweets')
const ioServer = IO(8000)
let socket = null
console.log('io server created')
ioServer.on('connection', newSocket => {
console.log(`Socket ${newSocket.id} connected`)
if (socket) {
console.log(`Socket already connected, ... | true |
60dfbf76eb8b973518f4f9d5c5cdc108ac8e059b | JavaScript | corvalanlara/covid19 | /grafica.js | UTF-8 | 5,968 | 2.625 | 3 | [] | no_license |
const totalpais = 19107216;
const d = 14;
const bus = new Vue();
const formato = {year: 'numeric', month: 'long', day: 'numeric'};
var svgWidth = 600;
var svgHeight = 480;
var margin = {top: 20, right: 20, bottom: 30, left: 50};
var width = svgWidth - margin.left - margin.right;
var height = svgHeight - margin.top - ... | true |
d520445a0665af22d653d009702842bcb0ea8584 | JavaScript | moniqueking57/JavaScript-Core-1-Coursework-Week1 | /exercises/G-numbers/exercise.js | UTF-8 | 331 | 3.734375 | 4 | [] | no_license | // Start by creating a variables `numberOfStudents` and `numberOfMentors`
let numberOfStudents = 15;
let numberOfMentors = 3;
let total = numberOfStudents + numberOfMentors;
console.log(`Number of students: ${numberOfStudents}`);
console.log(`Number of mentors: ${numberOfMentors}`);
console.log(`Total no of s and m: ... | true |
4bfdf25fa2c2d5f0a589db01e4da0b38d4349536 | JavaScript | Tafsan-Mahmud/es6-practice | /template.js | UTF-8 | 560 | 3.4375 | 3 | [] | no_license |
//** very very importent topic in this video --->
// 22-4 Template string, multiple line string */
//pore dekhe felte hobe abr o
const firstname = 'montu';
const midelname = 'biri';
const lastname = 'khay'
// const output = firstname +' '+ midelname+' ' + lastname+' but he is a good boy';
c... | true |
eeb148c83d46fd90fa1104e11ad0fc8f36f62906 | JavaScript | Jihyun-Jang/Calculator | /script.js | UTF-8 | 3,465 | 3.59375 | 4 | [] | no_license | const buttons = document.querySelectorAll('button');
const curDisplay = document.querySelector('#current-display');
const clacDisplay = document.querySelector('#calculation-display');
buttons.forEach(el => el.addEventListener('click', calculate));
let calculatingArr = [];
let result;
let isCalculating = false;
func... | true |
a8cc48ab99a1dc0aaab9ddd1048cf347170b153c | JavaScript | doiko123/paiza_js | /B6-5.js | UTF-8 | 393 | 4.0625 | 4 | [] | no_license | // 与えられた文字列sの n 文字目と n + 1 文字目を半角スペース区切りで出力
// sの中にn + 1文字目が存在しなければ何も出力しない
const fs = require("fs");
const input = fs.readFileSync("/dev/stdin", "utf-8").trim();
const lines = input.split("\n")
const n = Number(lines[0])
const s = lines[1]
if (s[n]) {
console.log(`${s[n-1]} ${s[n]}`)
}
| true |
d8b5dc6a85e59f285fb1b772e36d25d97dfbd570 | JavaScript | debrayperalta/DIDI-Ronda | /app/src/utils/localization.js | UTF-8 | 522 | 2.671875 | 3 | [] | no_license | export const monthNames = [
"Enero",
"Febrero",
"Marzo",
"Abril",
"Mayo",
"Junio",
"Julio",
"Agosto",
"Septiembre",
"Octubre",
"Noviembre",
"Diciembre",
];
export const monthNamesShort = [
"Ene.",
"Feb.",
"Mar.",
"Abr.",
"May.",
"Jun.",
"Jul.",
"Ago.",
"Sep.",
"Oct.",
"Nov... | true |
5e624f4e08af62bee393c5f731adf631b7cfbdd4 | JavaScript | Gauthamjm007/ggtable | /src/globalStore/reducers/analytics.js | UTF-8 | 380 | 2.640625 | 3 | [] | no_license | const initialStateValue = [];
const analyticsReducer = (state = initialStateValue, action) => {
switch (action.type) {
case "SET_ANALYTICS":
return [...action.payload];
case "ADD_ANALYTICS":
return [...state, { ...action.payload }];
case "RESET_ANALYTICS":
return [];
default:
... | true |
5df5b88b75745e7e8e39440e44ba6e10a2d66997 | JavaScript | Developers-Institute-Classrooms/sulekh-prog | /data/people.js | UTF-8 | 669 | 2.53125 | 3 | [] | no_license | /**
* Notice how this syntax is very similar to mongo shell commands
* except the syntax is also valid JavaScript.
*
* You can copy and paste this code into Robo 3T and it should execute
* like it would if you tried to run the same commands in the shell.
*/
db = db.getSiblingDB('bookAPI');
db.people.insert([
{... | true |
1b4f361b677380604e539f99091142e6fe29850f | JavaScript | atlp-rwanda/c4-barefoot-frontend | /src/redux/reducers/bookAccommodationReducer.js | UTF-8 | 1,224 | 2.515625 | 3 | [] | no_license | import {BOOK_ACCOMMODATIONS_PENDING , BOOK_ACCOMMODATIONS_SUCCESS,BOOK_ACCOMMODATIONS_ERROR,CLEAR_BOOK_SNACKBAR} from '../actions/bookAccommodationAction'
const initialState = {
pending: false,
snackBarMessage: {
open: false,
severity: '',
message: null
}
}
export function bookAccommodationsReducer(... | true |
a0df2d018fe007fdcb009ccc8ab60c0232f7b35a | JavaScript | Reynicke/screeps | /game_factory.js | UTF-8 | 2,220 | 2.671875 | 3 | [] | no_license | var gameInfo = require('game_info');
var creepRole = require('creep_role');
var names = ['Liam', 'Milan', 'Elias', 'Levi', 'Julian', 'Jonas', 'Linus', 'Daniel', 'Alex', 'Luca', 'Jan', 'Samuel', 'Tim', 'David', 'Michael', 'Lukas',
'Anna', 'Lina', 'Laura', 'Emilia', 'Mila', 'Julia', 'Lea', 'Vanessa', 'Sarah', 'Lena... | true |
df2b7a9afaa7cdf6a3066e509d032ae13e307b0f | JavaScript | tomastoloza/movies-app | /src/components/Search.jsx | UTF-8 | 1,855 | 2.59375 | 3 | [] | no_license | import React, {useState} from 'react';
import Section from "./Section";
import Spinner from "./Spinner";
const {fetchMoviesBySearch} = require("../requests")
const Search = ({searchMovies, setSearchMovies}) => {
const [searchTerm, setSearchTerm] = useState("");
const [cargando, guardarCargando] = useState(fals... | true |
fb26fb92bf5b32dc7a23c4d2e79c2ee840d1f679 | JavaScript | heyderpd/javascript-sandbox | /src/scoped-objects.js | UTF-8 | 2,702 | 2.984375 | 3 | [
"MIT"
] | permissive | const objectMap = (obj, fx, def = {}) => Object
.keys(obj).reduce(
(acc, key) => {
const value = obj[key]
return ({
...acc,
[key]: value(fx)
})
},
def)
const createObject = (state = {}, fxs = {}) => {
return objectMap(
fxs,
() => state,
state)
}
const list... | true |
af3d4167d87b1e9173fd26d3f40f60116b58605a | JavaScript | Olia1011/goit-js-hw-07 | /js/task-7.js | UTF-8 | 237 | 2.765625 | 3 | [
"Unlicense"
] | permissive | 'use strict'
const input = document.querySelector('#font-size-control');
const span = document.querySelector('#text');
function fun1(e) {
span.style.fontSize = e.currentTarget.value +'px';
}
input.addEventListener("change", fun1);
| true |
f19e84e229769551d65421d383606aabc9d2693a | JavaScript | ugandan-bois/Primer-Sprint | /src/js/components/registerEnrollment.js | UTF-8 | 1,011 | 2.640625 | 3 | [] | no_license | class RegisterEnrollment {
constructor() {
this.registerButton = document.getElementById('registerEnrollments')
this.events()
}
events() {
this.registerButton && this.registerButton.addEventListener('click', this.registerenroll)
}
registerenroll() {
const id = docum... | true |
7b98e84498e3afb6a7d6d2ae4a68f55439324749 | JavaScript | a2vena/a2vena.github.io | /static/script.js | UTF-8 | 14,319 | 2.734375 | 3 | [] | no_license | //------------------------ALL PAGES--------------------------//
// Project page is too slow on mobile devices without a loading screen
// window.addEventListener('load',function(){
// document.body.style.display='block';
// })
//-- Vertical Navigation Menu --
let navBtn = document.querySelector('#navBtn');
let na... | true |
637870e3f25e466ddd3f57ea69b7033bba2fb5ee | JavaScript | zverbatim/sandbox | /learnnode/functionaljs/recurssion3.js | UTF-8 | 263 | 3.296875 | 3 | [
"MIT"
] | permissive | function sumArray ( arr ) {
// end condition
if ( !arr.length ) return 0
// operation
var tempS = arr[0]
// next elem
tempArray = arr.slice(1)
// step
return tempS + sumArray( tempArray )
}
console.log( sumArray( [1,2,3] ) );
| true |
1f14e928c3f88cb4a81f25f615f6a199a276c690 | JavaScript | yd160513/learn-algorithm-javascript | /3. 选择排序/选择排序.js | UTF-8 | 1,986 | 4.3125 | 4 | [] | no_license | /**
* 选择排序 时间复杂度: O(n方)
* @param {array} list 无序数组
* @returns list
*
* 假设第一个元素是当前数组中最小的,将其索引存起来
* 继续遍历后边的元素,如果有其他元素小于记下的这个元素的话则将记下的元素索引替换为这个元素的索引,
* 遍历完成一遍之后将记下的这个索引对应的元素替换至数组第一位,遍历完成第二遍后,将记下的元素替换值数组第二位,
* 也就是说每遍历完成第几遍,替换的位置就是第几个
*/
function test(list) {
let cacheIndex
const len = list.length
/**
* ... | true |
b945553da03c2124ca8d75cbe01323e4a6490632 | JavaScript | ceidloc/imad-2016-app | /ui/main.js | UTF-8 | 3,324 | 2.6875 | 3 | [] | no_license | //load's list of categories and insert inside ol whoes id=home_page_categories
var log_details = document.getElementById('log_in_details');
var categories = document.getElementById('home_page_categories');
if (categories)
{
var request = new XMLHttpRequest();
request.onreadystatechange = function(){
if(request... | true |
43eff8e6604c59ac4e81224da434e69047976258 | JavaScript | DavidCibin/NASA-Images-API | /controllers/nasa.js | UTF-8 | 1,531 | 2.671875 | 3 | [] | no_license | const axios = require('axios')
module.exports = {
nasaMars,
nasaDaily,
nasaRandom,
myDate, // using GET
// myDatePost // using POST
}
// using GET
async function myDate(req, res) {
console.log(req)
axios.get(`https://api.nasa.gov/planetary/apod?api_key=${process.env.REACT_APP_API_KEY_NASA}&date=${... | true |
cb6567307b451abd22ac8fb27a9cabfd8344da73 | JavaScript | bassjobsen/pleeease | /lib/processors/opacity.js | UTF-8 | 922 | 2.609375 | 3 | [
"MIT"
] | permissive | 'use strict';
/**
*
* Fallback opacity property
*
*/
module.exports.processor = function (css) {
var PROP = 'opacity';
var PROP_REPLACE = 'filter';
// for each rules, each decl
css.eachRule(function (rule) {
rule.eachDecl(function (decl) {
if (decl.prop !== PROP) { return; }
// ... | true |
d348348402d5e29d5b225b182997747922b43982 | JavaScript | mammothgazillionaire/javascriptPractice | /Day 17/Day 17/practice.js | UTF-8 | 4,486 | 4.4375 | 4 | [] | no_license | // 1. Make a function in the Array.prototype called suffle that suffles the given array
// eg: [1,3,6,7,9] => [3,7,6,1,9]
var arr = new Array(1,3,6,7,9);
Array.prototype.shuffleArray = function(arr){
for(var i = arr.length -1 ; i >= 0 ; i--){
var j = Math.floor(Math.random()) * (i + 1);
}
}
//2. Create... | true |
5083a36eab74f029be4398be934ccc7147d29ce3 | JavaScript | compute-io/array-function | /test/fixtures/add1.js | UTF-8 | 211 | 2.84375 | 3 | [
"MIT"
] | permissive | 'use strict';
/**
* FUNCTION: add1( x )
* Adds one to an input value.
*
* @param {Number} x - input value
* @returns {Number} sum
*/
function add1( x ) {
return x + 1;
}
// EXPORTS //
module.exports = add1;
| true |
5845049b4b438c689e765df0cab14e793f0f8cd1 | JavaScript | jhenvi/Enviromental_Indicators_App | /Emissions/static/js/app.js | UTF-8 | 9,742 | 2.78125 | 3 | [] | no_license |
// creating world emissions line chart
function worldemissions(emission){
trace1 ={
x:emission[0].year,
y:emission[0].value,
// text:emission[0].value,
mode:"scatter",
}
ldata1=[trace1];
layout1 = {
title: `${emission[0].country[0]} ${emission[0].indicator[0]} v/s Time`,
showle... | true |
392688bee2da9cb219fecb5eb8987f29c4813d77 | JavaScript | RaduPopescu95/my-portfolio-v3 | /src/Components/Testimonials.js | UTF-8 | 2,082 | 2.6875 | 3 | [] | no_license | // we will create the basic structure of each React component and export it from that file with export default And finally make sure to import it back in App.js:
import React from "react";
import { TerminalIcon, UsersIcon } from "@heroicons/react/solid";
import { testimonials } from "../data";
// These are going to c... | true |
61adf6fd46151ff3876f21002e0627162d8a3cad | JavaScript | ginovva320/ui-extensions-sdk | /lib/stack/assets.js | UTF-8 | 2,236 | 2.84375 | 3 | [
"MIT"
] | permissive | import * as Utils from "./utils.js";
/**
* @summary Creates an instance of `Assets`.
* @description An initializer is responsible for creating Asset object.
* @param {String} uid - uid of the asset
* @example
* let Assets = stack.Assets('bltsomething123');
* @returns {Assets}
* @ignore
*/
export default class A... | true |
b1df798cce9fac60dfc7d25fff3f416632943d0c | JavaScript | gnthackray1978/JSImageAnnotater | /client/app/types/Selection.js | UTF-8 | 2,036 | 2.828125 | 3 | [] | no_license | (function(exports){
var Selection = function (nodestore, options) {
this.nodestore = nodestore;
this.options = options;
this.mouse = {x: 0, y: 0};
this.start_mouse = {x: 0, y: 0};
this.selectionnode;
};
Selection.prototype.OpenSelection = function(){
if(this.selectionnode){
//console.... | true |
d71e5228f3d4ad5bb13593a2ee9c347c8edf253b | JavaScript | lmiguelm/flappy-bird | /js/floor.js | UTF-8 | 791 | 2.859375 | 3 | [
"MIT"
] | permissive | export default class Floor {
constructor(source, context, canvas) {
// canvas
this.canvas = canvas;
// context
this.context = context;
this.source = source;
this.sourceX = 0;
this.sourceY = 610;
this.sourceWidth = 224;
this.sourceHeight = 112;
this.x = 0;
this.y = this.c... | true |
034c0b95c2ea33de0d7b6e061a57ff1487142659 | JavaScript | eguezel/js-training-tdd | /exercises/cut.js | UTF-8 | 959 | 4.125 | 4 | [
"MIT"
] | permissive | 'use strict';
/*
* Create the `cutFirst` function that takes a string and remove the 2 first characters
* Create the `cutLast` function that takes a string and remove the 2 last characters
* Create the `cutFirstLast` function that takes a string as parameter
* and remove the 2 first characters and 2 last character... | true |
9e9c0bbe19fee12d89cd7285472e5baea2e8538e | JavaScript | kamal-choudhary/breaking-bad-api | /src/components/series/SingleEpisode.js | UTF-8 | 1,917 | 2.734375 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
import axios from "axios";
import Spinner from "../ui/Spinner";
const SingleEpisode = (props) => {
const episodeID = props.match.params.epi;
const [episodeData, setEpisodeData] = useState({});
const [charactersData, setCharactersData] = useState([]);
const [i... | true |
f05c6fd710d1dfba61ed5a6f8bd79184e80288f1 | JavaScript | angeluidev/scratch-card | /scratch-it/js/ScratchIt.js | UTF-8 | 15,217 | 2.890625 | 3 | [
"Unlicense"
] | permissive | /**
* A javascript library that simulates a scratch off lottery ticket. It's responsive and is mobile friendly.
*
* @author Aaron Graham
*/
function ScratchIt(){
var parentEl,
overlayCanvas,
overlayCtx,
brushCanvas,
brushCtx,
overlayLoaded = false,
brushLoaded = false,
... | true |
883f7703956def6e034b2786b97f0d461523575c | JavaScript | dy/dotprop | /index.js | UTF-8 | 667 | 3.21875 | 3 | [
"MIT"
] | permissive | /**
* @module dotprop
*
* Get property defined by dot notation in string.
*
* @param {Object} holder Target object where to look property up
* @param {string} propName Dot notation, like 'this.a.b.c'
* @return {*} A property value
*/
module.exports = function(holder, propName){
if (propName == nul... | true |
1376d6208606366d7ef6447a5f742ef3fc5c7e51 | JavaScript | qaz734913414/face-api.js | /tools/train/faceLandmarks/js/synchronizeDb.js | UTF-8 | 1,016 | 3.078125 | 3 | [
"MIT"
] | permissive | async function fillPtsDb(ids) {
const numFetchPerIteration = 4000
for (let i = 0; i < Math.floor(ids.length / numFetchPerIteration) + 1; i++) {
const ptsById = await Promise.all(
ids.slice(i * numFetchPerIteration, (i + 1) * numFetchPerIteration)
.map(async id => ({
id,
pts: a... | true |
588fdedd8de79e553a729b8a3e98055032c59c67 | JavaScript | YashdalfTheGray/hue-remote | /util/promises.spec.js | UTF-8 | 5,699 | 2.65625 | 3 | [
"MIT"
] | permissive | /* eslint-disable max-classes-per-file */
// There seems to be some contention around this issue
// https://github.com/import-js/eslint-plugin-import/issues/2331
// eslint-disable-next-line import/no-unresolved
import test from 'ava';
import { runSerially, delayAsync, promisifyMethods } from './promises.js';
const t... | true |
3f45481a474fca42d9843d4e4cb73ced7447fccb | JavaScript | Magikarppi/FullStackOpen-2019-osa7 | /bloglist-back/utils/list_helper.js | UTF-8 | 2,032 | 3.28125 | 3 | [] | no_license | const dummy = (blogs) => {
return 1
}
const totalLikes = (blogs) => {
const totalLikes = blogs.reduce((sum, item) => {
return sum + item.likes
}, 0)
return blogs.length === 0
? 0
: totalLikes
}
const favoriteBlog = (blogs) => {
const reducer = (sum, item) =>... | true |
3182578e617e88c8ad70835b1cd725f5f711edac | JavaScript | kstulgys/gallery-next | /main/javascript/View.js | UTF-8 | 6,389 | 2.546875 | 3 | [] | no_license | ;(function(window) {
var View = class View {
constructor(setEventListeners) {
this.cache = {}
this.setEventListeners = setEventListeners
}
cacheDOM() {
this.cache.results = document.querySelector('.gallery-results')
this.cache.form = document.querySelector('.search')
this.ca... | true |
c6363bfb72bb9d09c0027beac6e58762780a6393 | JavaScript | dkocsis-emarsys/smartcomponent | /src/js/libs/tests/attributes.spec.js | UTF-8 | 589 | 2.90625 | 3 | [] | no_license | context('Attributes', () => {
let component;
beforeEach(() => {
component = document.createElement('test-attributes');
document.body.appendChild(component);
});
afterEach(() => {
component.parentNode.removeChild(component);
});
it('sets attribute on component and get corrent value from proper... | true |
913eec61f30dc50877b56ff695fb1931f0df1f62 | JavaScript | soybeanxiaobi/Algorithm | /保留最大的数.js | UTF-8 | 1,442 | 3.578125 | 4 | [] | no_license | /**
*
* 给定一个十进制的正整数number,选择从里面去掉一部分数字,希望保留下来的数字组成的正整数最大。
输入描述:
输入为两行内容,第一行是正整数number,1 ≤ length(number) ≤ 50000。第二行是希望去掉的数字数量cnt 1 ≤ cnt < length(number)。
输出描述:
输出保留下来的结果。
示例1
输入
325
1
输出
35
*/
let readline = require('readline');
let... | true |
6de2788874c4cdbc656ca8e850f55c99da6151a5 | JavaScript | dakaras/checkUniqueStr | /app.js | UTF-8 | 468 | 3.453125 | 3 | [] | no_license | function checkUnique(str) {
for (let i = 0; i < str.length; i++) {
for (let j = i + 1; j < str.length; j++) {
if (str[i] === str[j]) {
return false // if match, return false
}
}
}
return true // if no duplicates, return true
}
console.log(checkUnique... | true |
ea96fe6cf1e0b22e0efa95e0feac8bb02c2b79d1 | JavaScript | MeselIsaac/TinyApp | /express_server.js | UTF-8 | 5,234 | 2.671875 | 3 | [] | no_license | var express = require('express');
var cookieSession = require('cookie-session');
const bcrypt = require('bcrypt');
var app = express();
var PORT = 8080;
const bodyParser = require('body-parser');
app.use(bodyParser.urlencoded({extended: true}));
app.set('view engine', 'ejs');
app.use(cookieSession({
name: 'session',... | true |
a712dd8c3b92b70d42846568ba4070c733a809c7 | JavaScript | riezahughes/ffxiv-memory-testing | /app.js | UTF-8 | 1,333 | 2.734375 | 3 | [] | no_license | var edge = require('edge-js');
var helloWorld = edge.func(`
async (input) => {
return ".NET Welcomes " + input.ToString();
}
`);
helloWorld('JavaScript', function (error, result) {
if (error) throw error;
console.log(result);
});
//memory.js attempts
// const memoryjs = require('memoryjs... | true |
5d0382e37d002ddbf6f9c6915dd705e5879c1f3a | JavaScript | etRegg/node8-doker | /server/public/regg.js | UTF-8 | 1,170 | 2.859375 | 3 | [] | no_license | 'use strict';
import React from "react";
const e = React.createElement;
class Comment extends React.Component {
render() {
return e(
'<div class="card" style="width: 18rem;"><div class="card-body"><h5 class="card-title">Comment</h5><p class="card-text">'+
this.props.name
+'</p> </div></di... | true |
194bd2c936f97a84384969421dafe14886178ecd | JavaScript | arkajyotiMukherjee/dictionary_mayadata | /src/pages/AddWordPage/index.js | UTF-8 | 1,973 | 2.546875 | 3 | [] | no_license | import React, {useState} from 'react';
import TextField from '@material-ui/core/TextField';
import Button from '@material-ui/core/Button';
import {useSelector} from 'react-redux';
import {firestore} from '../../services/firebase';
import withStyles from '@material-ui/core/styles/withStyles';
import {styles} from './sty... | true |
15d61c90808b114f3862dbcb15e23ec403a40661 | JavaScript | mekarpeles/We-See-You | /static/js/hackpad_zemanta.js | UTF-8 | 1,047 | 2.75 | 3 | [] | no_license |
function zemanta(text) {
var key = "r8kdrptqrwbpgbtjr7pqappt";
var url = 'http://api.zemanta.com/services/rest/0.0?method=json&api_key=' +
key + "&text=" + text + ;
$.get(url, function(data) {
$("#results").append("<li>" + jQuery.parseJSON(data) + "</li>");
});
}
function prepareZemantaData(apike... | true |