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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
d6ebefc201164cd4abe219e46e323e6d38a9d59d | JavaScript | denisrey/snake | /src/Grid/Grid.js | UTF-8 | 965 | 2.546875 | 3 | [] | no_license | import React, {useState, useEffect} from 'react';
import Cell from '../Cell/Cell';
import './Grid.css';
const Grid = props => {
const createInitialCells = () => {
const localCells = []
for (let i = 0; i < props.numberOfCells; i++) {
localCells.push(
<Cell cellSize={props.cellSize} className={"... | true |
ba3a83299d02d1a8a94f45b0ea78ea9e87353d0d | JavaScript | hoseinhoseini/Section-2-Source-Code | /J5/Project 1/app.js | UTF-8 | 1,700 | 4.09375 | 4 | [] | no_license | // variables
const number = document.querySelector('#value')
const bealaveBtn = document.querySelector('.increase')
const resetBtn = document.querySelector('.reset')
const menhaBtn = document.querySelector('.decrease')
const title = document.querySelector('h1')
// eventlisteners
// add event listener for bealave But... | true |
d32c6d3b7f4da7640224def9019e97718cffe9c9 | JavaScript | Ryan-Shz/Exps | /javascript-sample/es6/const.js | UTF-8 | 172 | 3.625 | 4 | [] | no_license | // const 不存在变量提升
const str = 'Hello';
console.log(str);
// 模板字符串
let name = 'Ryan';
let age = 11;
console.log(`my name is ${name}, age is ${age}`); | true |
4c2c2a63b1a8c1d32b16a863ae6e72f02d12f97b | JavaScript | sophie-kim/VC2Animation | /javascript.js | UTF-8 | 1,220 | 2.71875 | 3 | [] | no_license | function showText(id,delay){
var elem=document.getElementById(id);
setTimeout(function(){elem.style.opacity=1;},delay*1000)
}
window.onload = function () {
showText('1', 1);
showText('2', 2);
showText('3', 3);
showText('4', 4);
showText('5', 5);
showText('6', 6);
showText('7', 7);
... | true |
cf3739eb78c66891a6dfad241c8161c144e563ff | JavaScript | dartmouth-cs52-18S/starterpack-alexdanilowicz | /src/containers/controls.js | UTF-8 | 1,389 | 2.546875 | 3 | [] | no_license | import React from 'react';
import { connect } from 'react-redux';
import { withRouter } from 'react-router-dom';
// importing the 2 ActionCreators we created earlier.
import { increment, decrement } from '../actions';
/* eslint react/jsx-filename-extension: 0 */
/* eslint react/prop-types: 0 */
const Controls = (pr... | true |
fd09a89df5e52216b202e12e43de785d0ab39114 | JavaScript | abdumamdouh/Evaluate-Articles-with-NLP | /src/client/js/handleFormSubmit.js | UTF-8 | 1,829 | 2.796875 | 3 | [
"MIT"
] | permissive | import checkURL from "./checkURL";
async function handleFormSubmit(e) {
e.preventDefault();
// get the url input node
let submitBtnNode = document.getElementById("submitBtn");
let loggerNode = document.getElementById("loggerSection");
const urlInputElment = document.getElementById("url-text");
const URL ... | true |
b1f1ac529621de507fc9eb94a3fd40d418acc415 | JavaScript | revialim/nmap.js | /nmap/src/boundingbox.js | UTF-8 | 1,872 | 3.171875 | 3 | [
"MIT"
] | permissive | /**
* a simple boundingbox with some get/set functions
* @constructor
* @param {object} args
* @param {integer|float} args.width=0 - width of the boundingbox
* @param {integer|float} args.height=0 - height of the boundingbox
* @param {integer|float} args.x=0 - x-position of the boundingbox
* @param {integer|float} args... | true |
3b72b3156d4ac8fbe86f3065e6e7103cf27acae4 | JavaScript | sammorrow/TestFirst-Part-1 | /05-Functions-&-Closure/functions.js | UTF-8 | 1,356 | 3.515625 | 4 | [] | no_license | function concatString(){
var args = [].slice.call(arguments)
return args.join("")
};
function yourFunctionRunner(func){
var output = "";
for (var i = 0; i < arguments.length; i++){
output += arguments[i]();
}
return output;
};
function makeAdder(num){
return function(num2){return n... | true |
c43a5f7d224804b55bc9f158d34483b2a53a1063 | JavaScript | masaru39/Recruitment | /src/selectors/timesheet.js | UTF-8 | 977 | 2.859375 | 3 | [] | no_license | import moment from 'moment';
export const fillTimesheetsToFullMonth = (state) => {
if (!state.timesheet.lists) return [];
const year = moment(state.timesheet.lists[0].date).format('YYYY');
const month = moment(state.timesheet.lists[0].date).format('MM');
const firstDay = moment(`${year}-${month}-01`);
const ... | true |
fc4604d0843702b0891ca7f2794df43b1dcc547f | JavaScript | GeraldWodni/forth-ev.de | /js/articles.js | UTF-8 | 1,322 | 2.515625 | 3 | [] | no_license | /* Edit an Article using CRUD */
/* (c)copyright 2017 by Gerald Wodni<gerald.wodni@gmail.com> */
$(document).ready(function(){
var $introTextarea = $('textarea[name="intro"]');
var $bodyTextarea = $('textarea[name="body"]' );
var modes = {
html: "html",
markdown: "markdown",
plaint... | true |
1b2894fedc5591bdb75b9d4547ce2c8263ab7f26 | JavaScript | nahudalla/TPFinalAyDAII | /src/web/js/ui/statusBar.js | UTF-8 | 1,844 | 2.8125 | 3 | [
"MIT"
] | permissive | import {logger, FLAGS} from '../logger.js'
const STATUS_BAR_SELECTOR = ".statusBar";
const STATUS_SELECTOR = ".statusBar > span";
const LOG_SELECTOR = ".statusBar > div.log";
const MAX_LOG_ELEMS = 150;
const container = document.querySelector(STATUS_BAR_SELECTOR);
const status_container = document.querySelector(STAT... | true |
7cc71f08d8bd0409461b0ef29fd3cb20440d6eb9 | JavaScript | sKhan16/Blyp | /.hambone-fake-namington/createFakeBlyp.js | UTF-8 | 2,307 | 2.703125 | 3 | [
"MIT"
] | permissive | var admin = require("firebase-admin");
var faker = require("faker");
var serviceAccount = require(process.env.GOOGLE_APPLICATION_CREDENTIALS);
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: "https://blyp-ae6e4.firebaseio.com",
});
let firestore = admin.firestore();
console... | true |
dfe5eb7a30a951bd39e44fc98c6822f568fad3b3 | JavaScript | steven-jp/space-shooter | /Astroid.js | UTF-8 | 697 | 3.359375 | 3 | [] | no_license | const ASTROID = new Image();
ASTROID.src = "./images/astroid.png";
class Astroid {
constructor(x, y, radius, velocity) {
this.color = "white";
this.radius = radius;
this.x = x;
this.y = y;
this.velocity = velocity;
this.counter = 0;
}
draw() {
ctx.beginPath();
ctx.drawImage(
... | true |
76c67b67f861eb55179f05df94cf18fab561467c | JavaScript | heyjulieh/express-personal-api | /server.js | UTF-8 | 6,049 | 2.546875 | 3 | [] | no_license | // require express and other modules
var express = require('express'),
app = express();
// parse incoming urlencoded form data
// and populate the req.body object
var bodyParser = require('body-parser');
app.use(bodyParser.urlencoded({ extended: true }));
function logRequestInfo(req, res, next){
console.log(`\n... | true |
0f12e83a7fb2ad8604995c0168dd615dd7bf9568 | JavaScript | martleim/codeGenApp | /app/templates/mean/server/server.js | UTF-8 | 1,864 | 2.59375 | 3 | [] | no_license | #!/bin/env node
// OpenShift sample Node application
//var meanApp = require('meanApp');
/**
* Define the sample application.
*/
var ServerApp = function() {
// Scope.
var self = this;
self.setupVariables = function() {
// Set the environment variables we need.
self.ipaddress = pro... | true |
5b5d65be54d796eda6fe12d40d9fe5c6e4a19598 | JavaScript | WickedFridge/codingame-code-vs-zombies | /src/elements/characters.js | UTF-8 | 1,169 | 3.15625 | 3 | [] | no_license | class Zombie extends Circle {
constructor(x, y, dirx, diry, id) {
super(x, y, 200, 'rgb(75, 0, 0)');
this.dir = { x: dirx, y: diry};
this.id = id;
}
graphicUpdate() {
this.update(4);
}
update(speed = 400) {
this.move(this.dir.x, this.dir.y, speed);
}
}
cl... | true |
40660c8e908d3cd76be33c80fc84475b4b3f7a29 | JavaScript | Quadruple/OnlineStoreProject-Frontend | /src/Components/Sign-up.js | UTF-8 | 6,174 | 2.546875 | 3 | [] | no_license | import React, { Component } from 'react'
import '../StyleSheets/main.css'
import '../StyleSheets/util.css'
import AuthService from '../services/auth.service';
class Sign_up extends Component {
constructor() {
super()
this.state = {
username: '',
email: '',
passwo... | true |
b4c23b7d6fbc6776d0802d3c9f4da38a46428a5d | JavaScript | jeanRandria/apiFrenchOperator | /index.js | UTF-8 | 2,898 | 2.765625 | 3 | [] | no_license |
const express = require('express');
const app = express();
const fs = require('fs');
const csv = require('csv-parser')
const request = require("request");
const results = [];
process.env.PORT = 3001;
async function readingFile() {
return fs.createReadStream('./files/2018_01_Sites_mobiles_2G_3G_4G_France_metropoli... | true |
595233bc346b96181c2cb37082f2903edc4492ea | JavaScript | kqazi02/Bamazon | /index.js | UTF-8 | 1,340 | 3.5625 | 4 | [] | no_license | //PseudoCode
//Contstructor homework
//USE STRICT
'use strict';
// var Square = require("./square.js");
// var Pentagon = require("./pentagon.js");
// var Triangle = require("./triangle.js");
//Establish a basic constructor function to apply to other shapes for later
//CAPITALIZE
function Shape (shapename) {
if (!(t... | true |
0d8d43ed5fa9ff46c3c8a2f04fd5f947acb52097 | JavaScript | avanwest/CreativeCoding | /abstractArt/boutiqueHotelArtGenerator/sketch.js | UTF-8 | 852 | 3.109375 | 3 | [] | no_license | let count = 30;
function setup() {
createCanvas(400, 400);
colorMode(HSB, 360, 100, 100, 100);
background(255);
background(random(360), random(100), random(100),random(100));
for (let i = 0; i < 10; i++) {
beginShape();
fill(random(360), random(100), random(100),random(100));
rect(ra... | true |
667e6ae00812ff56fa27ddb749f2bf8dcc063930 | JavaScript | yelingfeng/ylf-charts | /src/util/mockUtil.js | UTF-8 | 2,372 | 2.703125 | 3 | [
"MIT"
] | permissive | import Mock from 'mockjs'
const names = ['苹果', '香蕉', '梨', '橙子', '樱桃', '西柚', '泥猴桃', '草莓']
const info = '@ctitle(10)'
const categorys = ['A', 'B', 'C']
export {
names, categorys
}
const format = date => {
let dateString = new Date(date)
let month =
dateString.getMonth() + 1 < 10 ?
'0' + ... | true |
28281269ff0a563643b13d487f12cab191926c40 | JavaScript | arleswall/assignments | /exercises/warmups/query-url/query-url.js | UTF-8 | 814 | 3.46875 | 3 | [] | no_license | // Example:
//
const endpoint = "http://localhost:8080/monkeys"
let query = {
color: "black",
species: "howler"
}
// stringifyUrl(endpoint, query);
//returns "http://localhost:8080/monkeys?color=black&species=howler"
// function stringifyUrl(){
// let url="http://localhost:8080/monkeys?"
// for(let key i... | true |
224a823a5bb41a84b13e52407f60739fee800e00 | JavaScript | lcordenod/42_www_matcha | /back/services/inputService.js | UTF-8 | 3,305 | 2.546875 | 3 | [] | no_license | var userModel = require("../models/userModel");
module.exports = {
lastname: data => {
const regex = /^[a-zA-ZáàâäãåçéèêëíìîïñóòôöõúùûüýÿæœÁÀÂÄÃÅÇÉÈÊËÍÌÎÏÑÓÒÔÖÕÚÙÛÜÝŸÆŒ]*-?[a-zA-ZáàâäãåçéèêëíìîïñóòôöõúùûüýÿæœÁÀÂÄÃÅÇÉÈÊËÍÌÎÏÑÓÒÔÖÕÚÙÛÜÝŸÆŒ]*$/;
if (data == null || data == "") return { error: "missing paramete... | true |
e8f17ed70660e5d29de904b225a276dd6615d8a9 | JavaScript | GustavoSilvaMistro/calcFestInfantil | /www/components/script.js | UTF-8 | 735 | 3.765625 | 4 | [
"MIT"
] | permissive | // This is a JavaScript file
window.onload = function (){
const display = document.querySelector("#display");
let refrigerante = 600;
let agua = 200;
let bolo = 100;
let doce = 3;
let salgado = 10;
document.querySelector("#igual").addEventListener('click', function(){
let valor = display.value;
l... | true |
74b5eb3e183e01ed8b5416240624fc19bf5bba11 | JavaScript | Smit36/agro-mart-client | /src/redux/reducers/auth.js | UTF-8 | 629 | 2.625 | 3 | [] | no_license | const authReducerDefaultState = {
loggedIn: false,
loggedOut: true,
signUpMessage: null
}
export default (state = authReducerDefaultState, action) => {
switch (action.type) {
case 'LOGGED_IN':
return {...state, loggedIn: true, loggedOut: false };
case 'LOGGED_OUT':
... | true |
22c78eb1a0f5cf47c539e08a3c44ded941a4d6a6 | JavaScript | fponticelli/minicanvas.js | /sample/sample.js | UTF-8 | 1,185 | 2.8125 | 3 | [
"MIT"
] | permissive | var MiniCanvas = ("undefined" !== typeof require && require("../lib/minicanvas").MiniCanvas) || MiniCanvas;
MiniCanvas.create(200, 200)
.checkboard(20)
.checkboard(10, "rgba(100,200,200,0.5)", "rgba(255,255,255,0.5)")
.border(1)
.display("checkboard");
MiniCanvas.create(200, 200)
.box(function(x, y) {
r... | true |
862e87385cdcba0f8ccfeca4f48426131dca6c76 | JavaScript | Hebotech/shaft-static | /store/companies.js | UTF-8 | 655 | 2.546875 | 3 | [] | no_license | import axios from 'axios';
const urlBase = 'http://localhost:9000/shaft';
export const state = () => ({
allCompanies: [],
});
export const getters = {
favCompanies: (state) => {
return state.allCompanies.filter((company) =>
company.properties.fav.value === true ? company : console.log(company)
);
... | true |
d2369d1ef61b4d65efc83ab1f44c805f9de57743 | JavaScript | dlefevre/garage-door-remote | /app/userstore.js | UTF-8 | 1,856 | 2.734375 | 3 | [
"Unlicense"
] | permissive | /*
* app/userstore.js
*/
const fs = require('fs');
const hash = require('create-hash');
const config = require('../config');
const logger = require('./logger.js');
const NodeCache = require('node-cache');
const path = require('path');
var userCache = new NodeCache({stdTTL: config.application.userstore.cache_ttl});... | true |
9dd57de666670530bea4f1a4936c3cf2eb87c9bf | JavaScript | aerogear-attic/data-sync-server | /server/security/services/keycloak/AuthContextProvider.test.js | UTF-8 | 2,811 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | const { test } = require('ava')
const AuthContextProvider = require('./AuthContextProvider')
test('provider.getToken() returns request.kauth.grant.access_token', (t) => {
const token = {
someField: 'foo'
}
const request = {
kauth: {
grant: {
access_token: token
}
}
}
const pr... | true |
3919d1586aaae0195bcca83e60e69178a549115f | JavaScript | rismael/TwitterImgurMatcher | /nodejs-https-server/public/javascripts/imgur.js | UTF-8 | 2,470 | 3.34375 | 3 | [] | no_license | //imgur.js is handles the API calls to Imgur. It get media from Imgur and returns the link associated to it.
//Later the link is used in the front-end to put on the website.
console.log('imgur.js - Running');
var config = require('../../keys/imgur_credentials.js');
const axios = require('axios');
//get_images ... | true |
de54f1ce30957991023f21c2eb21cc40afb910f2 | JavaScript | skylying/doubleSpin | /src/dd.js | UTF-8 | 7,482 | 2.5625 | 3 | [] | no_license | /**
* Author : Tim Lin
* mail : linsuitm@gmail.com
* Date : 2015/4/6
*/
(function()
{
var sizeConst = 100;
var prefixList = ['webkit', 'Moz', 'O', 'ms'];
var defaultConfig = {
size: 1,
topColor: '#FF0000',
bottomColor: '#008000',
speed: 'fast'
};
var speedMap = {
"slow": '4s',
"medium": '3s',
... | true |
68973954289146bedeea88f8cea374b35fb0830d | JavaScript | Code-Ken/DataStruct | /Liner/SingleList/JS/singleList.js | UTF-8 | 3,885 | 4.1875 | 4 | [] | no_license | /**
* 节点函数
* @param {int} data
*/
function Node(data) {
this.data = data;
this.next = null;
}
/**
* 线性表的链式存储结构
* @copyright MIT.
* @author Ken(gaosong0301@foxmail.com)
*/
class SingleList {
/**
* 构造函数
*/
constructor() {
this.head = null;
this.tail = null;
... | true |
7cc7ff743be34b0e60e48f3f53977c73b635d000 | JavaScript | paudeldileep/foodapp-react_native | /src/screens/SearchScreen.js | UTF-8 | 1,522 | 2.515625 | 3 | [] | no_license | import React, { useState } from "react"
import { View, Text, ScrollView, StyleSheet } from "react-native"
import ResultsList from "../components/ResultsList"
import SearchBar from "../components/SearchBar"
import useResults from "../hooks/useResults"
const SearchScreen = () => {
const [term, setterm] = useState("")... | true |
9d9d0de5eaaf5946bb15596f52e37a7942597c29 | JavaScript | AlexLarina/422049-kekstagram-20 | /js/filter.js | UTF-8 | 1,613 | 2.75 | 3 | [] | no_license | 'use strict';
(function () {
var RANDOM_COUNT = 10;
var showFilters = function () {
var filtersContainer = document.querySelector('.img-filters');
filtersContainer.classList.remove('img-filters--inactive');
};
var filtratePictures = function (filter, pictures) {
var filteredPictures = [];
swi... | true |
51425ae5cd18c370cc96f4d9de49a95fbe441e6d | JavaScript | yefengHope/greater | /admin/adminWeb/src/main/resources/static/js/myjs/base/function/function.js | UTF-8 | 934 | 4.25 | 4 | [] | no_license | /**
* 函数基础
* Created by rain on 2016/7/23.
*/
/**
* 函数的声明和调用
* 函数也是对象
*/
//函数声明
function sum(a, b) {
return Number(a) + Number(b);
}
//函数调用
sum(4, 5);
/**
* 匿名函数
* 实质为匿名函数表达式,而非语句
* function后面可省略函数名
* 可以有返回值,返回值是一个Function对象的引用
* 注:js解析时,必须表达式在前,调用才后,和函数不一样
*/
//将Function对象的一... | true |
ec4f952873b54b0548634e0a85495976b55b4964 | JavaScript | apavlushina/query | /events-manager/src/actions/events.js | UTF-8 | 1,557 | 2.515625 | 3 | [] | no_license | import request from "superagent";
export const EVENTS_FETCHED = "EVENTS_FETCHED";
const baseUrl = "http://localhost:4000";
const eventsFetched = events => ({
type: EVENTS_FETCHED,
events
});
export const loadEvents = () => (dispatch, getState) => {
// when the state already contains events, we don't fetch the... | true |
e3740e69f3c2a031ad0548ab2392ed2e992a4b9c | JavaScript | shubhamxy/strictly | /authUsingEmail.js | UTF-8 | 1,820 | 2.671875 | 3 | [] | no_license | import firebase from "./api";
export const verifyEmail = async () => {
const user = firebase.auth().currentUser;
console.info(`User for verifyEmail : ${JSON.stringify(user, null, 4)}`);
if (user.emailVerified === false) {
user.sendEmailVerification().then(() => {
console.info("Verification email sent")... | true |
aed06857cd77e9246c7a8addcad1d63f16415b7b | JavaScript | hcuffy/Marks | /src/components/calendar/actions.js | UTF-8 | 4,066 | 2.515625 | 3 | [
"MIT"
] | permissive | import moment from 'moment';
import _ from 'lodash';
import {actions} from './constants';
import {addCalendarEvent, deleteEvents, getAllEvents, updateCalendarEvent} from '../../collections';
import {getAttribute, getCustomAttribute, getFormValues} from '../helpers';
export function getEvents() {
return async disp... | true |
a50d5cc80a394828ae6d555379b0d53cb607c628 | JavaScript | WillianMotta/JavaScript | /Cursoemvideo/ex008.js | UTF-8 | 253 | 2.984375 | 3 | [
"MIT"
] | permissive | var vel = 20
console.log(`A velocidade do seu carro é ${vel} km/h`)
if(vel > 60){ //condição simples, if significa 'se'.
console.log("Você ultrapassou a velocidade permitida.Multado!")
}
console.log("Dirija sempre usando o sinto de segurança!") | true |
259e23c03ad19ce4a4b76eda5c2835de46ab84fd | JavaScript | currenthandle/frontend-challenge-1 | /main.js | UTF-8 | 4,569 | 4.15625 | 4 | [] | no_license | var api = {};
/*
PART 1: Implement fanOut.
fanOut - return a new collection of results after applying the
input function to each item in the input collection.
args: input - input collection
fn - function to apply to each item in the collection
EX: - fanOut([1, 2, 3], double) --> [1, 4, ... | true |
47afc5d92b73beabf1f9ee81822aa32ef584182d | JavaScript | Spartano/timestampFCC | /server.js | UTF-8 | 817 | 2.671875 | 3 | [] | no_license | var express = require('express');
var app = express();
var moment = require("moment");
var path = require('path');
var port = process.env.PORT || 3500;
app.get('/', function(req, res){
var fileName = path.join(__dirname, 'index.html');
res.sendFile(fileName, function(err){
if(err){
... | true |
11eecfb0c7647b51fc3e8bdff8d784574fedd190 | JavaScript | SeanGallen/SalesBackendAPI | /salesFormBackEnd/service/companyService.js | UTF-8 | 1,951 | 2.875 | 3 | [] | no_license | const CompanyModel = require('../model/CompanyModel');
let Validator =require('fastest-validator');
let companies = {};
let count = 0;
let companyValidator = new Validator();
let namePattern = /([A-Za-z\-\’])*/;
const companySchemaValidator = {
guid: {type: 'string', min: 3},
company_name: { type: 'string',... | true |
ddddee28cf5d26f24ddc46beb92c916e65a5139c | JavaScript | Calculingua/cali-app | /src/calcu/base/ttest.js | UTF-8 | 3,476 | 2.671875 | 3 | [
"BSD-2-Clause"
] | permissive | define(['../mType/HashTable',
'./transpose',
'./minus',
'./size',
"jStat"], function(HashTable, transpose, minus, size, jStat){
function ttest() {
var args = Array.prototype.slice.call(arguments, 0);
var callback = args.pop();
var alpha = 0.05;
var df, i = 0;
while(i < args.length){
var key;... | true |
a17a466bb7b40448b3b056f22f2e560a205759b4 | JavaScript | Berkeley-gov/LightFeather-coding-challenge | /src/components/NotificationForm.js | UTF-8 | 7,010 | 2.703125 | 3 | [] | no_license | import { Component } from 'react';
import React from 'react';
import axios from 'axios';
import DropdownMenu from './DropdownMenu';
// UserSignUp class component allows a user to sign up for an account.
export default class NotificationForm extends Component {
constructor(props) {
super(props)
// ... | true |
47164f2af97f9b68870c5a2b8d8a9bcabd111efb | JavaScript | codyss/brewery | /server/db/models/category.js | UTF-8 | 489 | 2.640625 | 3 | [] | no_license | 'use strict';
var mongoose = require('mongoose');
var schema = new mongoose.Schema({
name: {
type: String
},
description: {
type: String
},
tags: [{
type: String
}]
});
schema.statics.getAllUniqueCats = function() {
return this.find({})
.then(function(cats){
var out=... | true |
dc42272905d3eb2ee0ca59450461efba04c38017 | JavaScript | mayurgupta1991/NodeApp | /src/server.js | UTF-8 | 666 | 2.578125 | 3 | [] | no_license | const express = require('express');
const server = require('./serverPort');
var app = express();
app.use(express.static(`${__dirname}/public`));
app.get('/', (req, res) => {
// res.send('<h1>Hello Express!</h1>');
res.send({
name: 'Andrew',
likes: [
'Biking',
'Cities'
... | true |
34e999055484ad3eae001b1e4690513ff2ff6dca | JavaScript | ninjasphere/sphere-api-service | /lib/web/rest/laststate.js | UTF-8 | 1,218 | 2.625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | 'use strict';
var when = require('when');
var debug = require('debug')('api:laststate');
// this function retrieves cached data from redis
exports.getCachedLastStateForThings = function (redis, user, results) {
return when.map(results, function (thing) {
return getCachedLastStateForThing.call(this, redis, user,... | true |
aadaa4748314edee36fd1327fdbebe1c13afa3a5 | JavaScript | hernanreiq/battle-reiq | /js/primera-pantalla.js | UTF-8 | 10,369 | 2.984375 | 3 | [] | no_license | var primera_pantalla = document.getElementById('pantalla-1');
var pantalla_2 = document.getElementById('pantalla-2');
var pantalla_3 = document.getElementById('pantalla-3');
var mensaje_final = document.getElementById('mensaje-final');
var controles = document.getElementById('controles');
var anuncios = document.getEle... | true |
4e84a1df74d653e783828c16e3e5bf05f44fd65d | JavaScript | jaebradley/fruit | /src/mergeContent.js | UTF-8 | 464 | 2.609375 | 3 | [
"MIT"
] | permissive | import isJSON from 'is-json';
import deepMerge from 'deepmerge';
const mergeContent = ({ originalContent, additionalContent }) => {
if (isJSON(additionalContent) && isJSON(originalContent)) {
const mergedContent = deepMerge(
JSON.parse(originalContent),
JSON.parse(additionalContent),
);
retur... | true |
03abf274c04ec8e296e154549d9c89b2383ea353 | JavaScript | elfacu0/js-intermedio | /clase-12/pokedex/components/load_data.js | UTF-8 | 924 | 2.8125 | 3 | [] | no_license | import { getPokemon, getPokemonList } from '../repository/pokemon.js';
export async function getPokemonData(id = 1) {
const storedPokemon =
JSON.parse(localStorage.getItem('pokemonStored')) || {};
if (id in storedPokemon) {
return storedPokemon[id];
} else {
const pokemon = await ge... | true |
59438cdc24ed5a88eaab93d0354b7986bf7a1bac | JavaScript | stau0444/js-study-repo | /study/extends.js | UTF-8 | 669 | 3.65625 | 4 | [] | no_license | class Vehicle{
constructor(name,wheel){
this.name = name
this.wheel = wheel
}
}
const myVehicle = new Vehicle('오토바이',2);
console.log(myVehicle);
class Bicycle extends Vehicle{
constructor(name,wheel){
super(name,wheel)
}
}
const myBicycle = new Bicycle('자전거',2)
const myBicycle2... | true |
058ede0c6d4e6e2d3f57e2a07a1b254235586aea | JavaScript | rockquai/KeepCoding | /HACOSA-FED/DAY03/quiz.js | UTF-8 | 6,040 | 4.28125 | 4 | [] | no_license | 'use strict';
// 내장함수를 사용하지 않는다.
/**
* -----------------------------------------------------
* 1. 숫자를 넣으면 그 숫자의 제곱을 반환하는 함수를 만들어라.
* 예: 5를 넣으면 25가 나온다. 100을 넣으면 10000이 나온다.
* -----------------------------------------------------
*/
function squareFn(num) {
return num * num;
}
/**
* --------------------------... | true |
29b0e9e548b8acf870f2864da3f07b70cba042cf | JavaScript | mikesprague/gitbook | /packages/gitbook/src/models/__tests__/templateBlock.js | UTF-8 | 8,664 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | const nunjucks = require('nunjucks');
const Immutable = require('immutable');
const Promise = require('../../utils/promise');
describe('TemplateBlock', () => {
const TemplateBlock = require('../templateBlock');
describe('.create', () => {
it('must initialize a simple TemplateBlock from a function', ()... | true |
7c97d1543466b43f586c5b9f18fb8b732a9e75b2 | JavaScript | sedillon93/08-09-vanilla-rest-server | /lib/requestParser.js | UTF-8 | 1,316 | 2.984375 | 3 | [] | no_license | 'use strict';
const requestParser = module.exports = {};
const logger = require(`./logger`);
const urlModule = require(`url`);
requestParser.parse = (request) => {
return new Promise((resolve, reject) => {
request.url = urlModule.parse(request.url, true); // hey!: using url's built in parse function, get me ... | true |
c1eac35ecf304c6a106934938bdbc48f1e239c9c | JavaScript | Alisa1711/pixelHunter | /js/utils.js | UTF-8 | 614 | 2.984375 | 3 | [] | no_license | const showScreen = (...elements) => {
const mainElement = document.querySelector(`#main`);
mainElement.innerHTML = ``;
elements.forEach((it) => {
mainElement.appendChild(it);
});
};
const resize = (frame, image) => {
const frameRatio = frame.width / frame.height;
const imageRatio = image.width / image.... | true |
04aff09639b1dd1beb4f08c08f3063ed2b8f224c | JavaScript | chief-tech/landing-server | /phone.js | UTF-8 | 1,554 | 3.078125 | 3 | [] | no_license | // Require `PhoneNumberFormat`.
var PNF = require('google-libphonenumber').PhoneNumberFormat;
var phoneUtil = require('google-libphonenumber').PhoneNumberUtil.getInstance();
// returns null if the phone number is invalid
var format = function(phoneNumber)
{
// parse the phone number as a US number
try {
var pa... | true |
f8af74c5fe834daa4b8041046b2e8fe49da928bb | JavaScript | okvarsh/Hackerrank-Codes | /10 Days of JavaScript/DAY_8-Button.js | UTF-8 | 1,931 | 4.0625 | 4 | [
"MIT"
] | permissive | /*DAY-8*/
/*Objective
In this challenge, we practice creating buttons in JavaScript. Check out the attached tutorial for learning materials.
Task
Complete the code in the editor so that it creates a clickable button satisfying the following properties:
The button's id is btn.
The button's initial text label is . Af... | true |
9cbac3a14c39247d79f84128a6b1c74a5d31b429 | JavaScript | fabienDaou/FlowViz | /src/services/flowEstimatesService.js | UTF-8 | 848 | 2.625 | 3 | [] | no_license | const FLOWVIZ_KEY = "FlowViz";
export const saveNewFlowEstimates = (estimates) => {
let currentEstimates = localStorage.getItem(FLOWVIZ_KEY);
currentEstimates = !currentEstimates ? [] : JSON.parse(currentEstimates);
const date = new Date();
let newEstimates = [{ date: date.getTime(), estimates }, ...cu... | true |
0a4e1b2450ca3e37b6bba4472055435ff03040f0 | JavaScript | WesleyFreitasdeLima/react-projeto-calculadora | /src/main/Calculator.jsx | UTF-8 | 2,576 | 2.953125 | 3 | [] | no_license | import React, { Component } from 'react';
import '../assets/css/calculator.css';
import Button from '../components/Button';
import Display from '../components/Display';
class Calculator extends Component {
constructor(props) {
super(props);
this.state = {
displayValue: 0,
m... | true |
19056c1faeb90f85c7411928f6be44f795a20c74 | JavaScript | guohamy/musicplayer | /source/component/Toast.js | UTF-8 | 1,151 | 2.671875 | 3 | [] | no_license | import './Toast.scss';
let TipsShow = (o,text,time,callback)=>{
localStorage.toast = text;
o.innerHTML = text;
var tipsTime = 0;
let t = setInterval(()=>{
tipsTime += 33;
if(tipsTime>time){
clearInterval(t);
o.classList.remove('show');
setTimeout(()=>... | true |
d9ec61cbee1044852f2c2f1146b5ec0869dcfd44 | JavaScript | trantrungan1306/React-Hook | /src/App.js | UTF-8 | 2,983 | 2.5625 | 3 | [] | no_license | import React, { useState } from 'react';
import { useEffect } from 'react';
import querystring from 'query-string';
import './App.scss';
import Pagination from './components/Pagination';
import PostList from './components/PostList';
import TodoFrom from './components/TodoFrom';
import TodoList from './components/TodoLi... | true |
bd8c0aae994a9d536da91e8041520d5a06f5ee98 | JavaScript | Eyasu15/vidly | /src/components/utils/paginate.js | UTF-8 | 305 | 3.125 | 3 | [] | no_license | export function paginate(items, pageSize, activePage) {
let startIndex = pageSize * (activePage - 1);
let movies = [];
let movieIndex = 0;
for (let i = startIndex; i < startIndex + pageSize; i++) {
if (items[i] === undefined) break;
movies[movieIndex++] = items[i];
}
return movies;
}
| true |
cf3af83207d3baf9d1cf76efe8af2be20baa7666 | JavaScript | allenlili/would-you-rather | /src/redux/question.redux.js | UTF-8 | 2,607 | 2.65625 | 3 | [
"MIT"
] | permissive | import { _getQuestions, _saveUserByNewQuestion, _saveQuestionAnswer } from "../_DATA";
// define actions
const GET_QUESTIONS = 'get_questions';
const SAVE_QUESTION_ANSWER = 'save_question_answer';
const SAVE_QUESTION = 'save_question';
// create actions
function getQuestionsAction(data) {
return {
type: GET_QUESTI... | true |
5a19a467ab064d79d8bfd3e5c082f03799d98348 | JavaScript | CGastrell/ArgenMap | /js/argenmap/LatLng.js | UTF-8 | 1,199 | 2.765625 | 3 | [] | no_license | goog.provide('argenmap.LatLng');
goog.require('goog.asserts');
/**
* @class Representa una coordenada (un punto geográfico)
* @param {Float} lat latitud
* @param {Float} lng longitud
* @export
* @constructor
*/
argenmap.LatLng = function(lat, lng)
{
lat = goog.asserts.assertNumber( lat );
lng = go... | true |
93d611e6b6bcb50d3827a6a47e2363ac8b8480ed | JavaScript | h3vanth/hlwb | /public/js/landOwnerInfo.js | UTF-8 | 2,562 | 2.609375 | 3 | [] | no_license | const sqFt = document.getElementById('sqFt');
const mobileNo = document.getElementById('mobileNo');
const pin = document.getElementById('pin');
let allClear = true;
mobileNo.addEventListener('keyup', () => {
if(isNaN(mobileNo.value) || mobileNo.value.length !== 10){
document.querySelector('span.mobileNo')... | true |
5d367161f8a76ecae9ca93449e806b84fb60f0c9 | JavaScript | GustavoFreitas22/JavaScript | /Array/forEach2.js | UTF-8 | 457 | 3.921875 | 4 | [] | no_license | const formas = ['circulo', 'quadrado', 'losangulo', 'triangulo']
/*function paraCada(formas){
for(let i = 0; i<formas.length; i++){
console.log(`${i +1}) ${formas[i]}`)
}
}
paraCada(formas)
*/
// Forma mostrada no curso:
Array.prototype.forEach2 = function(callbak){
for(let i = 0; i<this.lengt... | true |
b5afe21d703e800584240fb2e3e854373eaaed23 | JavaScript | mjblee20/bamazon | /bamazonCustomer.js | UTF-8 | 4,555 | 3.15625 | 3 | [] | no_license | // npm packages
const inquirer = require("inquirer");
const mysql = require("mysql");
// global variables
// creating location to connect with mysql database
var connection = mysql.createConnection({
host: "localhost",
// Your port; if not 3306
port: 3306,
// Your username
user: "root",
... | true |
b3a158c14f1f1b8bce20c1c3568bd40809616fa0 | JavaScript | lauucorrea/ExamenDivF | /tres.js | UTF-8 | 3,442 | 3 | 3 | [] | no_license | function mostrar()
{
let origenIngresado,
cantidadVacunasIngresadas,
costoVueloIngresado,
respuesta,
flagCantidadVacunas = 1,
origenMenosVacunas,
cantidadMenosVacunas,
cantidadVuelosOccidente = 0,
totalVacunasOccidente = 0,
promedioVuelosOccidente,
totalSinDescuento = 0,
totalConDescuento,
p... | true |
8e026f36f4a32d26ebebf8ef7830a8feea9e4e74 | JavaScript | climboy/Scrapper | /ajaxGet.js | UTF-8 | 3,347 | 2.640625 | 3 | [
"MIT"
] | permissive | // Utilisation de la librairie spin.js pour générer le spinner
var opts = {
lines: 13 // The number of lines to draw
, length: 28 // The length of each line
, width: 14 // The line thickness
, radius: 42 // The radius of the inner circle
, scale: 1 // Scales overall size of the spinner
, corners... | true |
caf8cf79bfac582e48c70fb5b17c849a37e5d762 | JavaScript | delbury/temp_learning | /tests/e2e/custom-assertions/testAssert.js | UTF-8 | 835 | 2.6875 | 3 | [] | no_license | // this.command => this.value => this.evaluate
exports.assertion = function testAssert(selector, expected) {
// this.options = {
// elementSelector: true
// };
// 1.
this.formatMessage = () => {
console.log('formatMessage')
return {
message: 'the the the messsssssage.',
args: []
}
}
// 7.
th... | true |
54b632a1c603ed234ba39abb3394e5867f6c8845 | JavaScript | duchoang06/NodeJS_IOT | /index.js | UTF-8 | 3,296 | 2.53125 | 3 | [] | no_license | var firebase = require("firebase");
// Initialize Firebase
// TODO: Replace with your project's customized code snippet
var config = {
apiKey: "AIzaSyAK_VVrlpW99bJKU7YrCUflwRji78ArYDc",
authDomain: "weathertracking-1803.firebaseapp.com",
databaseURL: "https://weathertracking-1803.firebaseio.com",
stora... | true |
b2514bef19c6dc133c91b971797e86834641d2dc | JavaScript | mumuyang1/pos_v2 | /pos_v2/src/model/scanner.js | UTF-8 | 614 | 3 | 3 | [] | no_license | function barcodesArray(inputs) {
this.inputs = inputs;
}
barcodesArray.prototype.getBarcodes=function(){
var barcodes = [];
for (var i = 0; i < this.inputs.length; i++){
var barcodeNum = this.inputs[i].split("-");
var barcode = barcodeNum[0];
var num = barcodeNum[1] || 1;
for (var j = 0; j... | true |
a430f7f4f1381d1c6f38c73357af4ea872121334 | JavaScript | lodgingzeus/discord-bot-berry | /commands/moderation/setNsfwOrSfw.js | UTF-8 | 809 | 2.625 | 3 | [] | no_license | module.exports ={
commands: 'set',
expectedArgs: 'Nsfw or Sfw',
callback: (message, args, text) =>{
if(args[0] === 'nsfw'){
if(message.channel.nsfw){
message.reply('Channel is already NSFW')
}else{
let channel = message.channel
... | true |
4fb9d6f4773cf73300bff0b4eddb0b45efd801ac | JavaScript | molinaja/clontagramPersonalized | /cliente/src/Views/Login.js | UTF-8 | 1,785 | 2.53125 | 3 | [] | no_license | import React, { useState } from 'react';
import Main from '../Componets/Main';
import {Link} from 'react-router-dom';
export default function Login({login, mostrarError}) {
const [usuario, setUsuario] = useState({
email: '',
password: ''
});
function handleInputChange(e) {
setUsua... | true |
b5f084ccdb4babdf2b7e69f232c7fc18782c0937 | JavaScript | kinivi/IoT-algorithms | /3_lab/3_lab.js | UTF-8 | 2,996 | 3.484375 | 3 | [] | no_license | const INF = Infinity;
const readline = require('readline');
/////////Initialize console in\output////////////////
const textStream = readline.createInterface({
input: process.stdin,
output: process.stdout
});
//////////////NodeJs console query//////////////////
textStream.question(`Input N and M: `, (... | true |
11bfe2ca69cb4c9bed01d504afd85f44d75683e1 | JavaScript | michelleamason/tipCalculator | /main.js | UTF-8 | 1,194 | 3.5 | 4 | [] | no_license | // calculate Tip
function calculateTip() {
var bill = document.getElementById("bill").value;
var percentage = document.getElementById("percentage").value;
var numOfPeople = document.getElementById("splitAmount").value;
// validate input
if (bill === "" || percentage == 0) {
alert("Enter values");... | true |
dd783fcf3f0c040561c9fc8809bd005fb6429c22 | JavaScript | AnatoliAgeichik/song_translator_frontend | /src/components/RegistrationForm.jsx | UTF-8 | 2,064 | 2.6875 | 3 | [] | no_license | import React, {Component} from 'react'
import {Button, Form} from "react-bootstrap";
export class RegistrationForm extends Component{
constructor(props){
super(props)
this.state ={
username:'',
email:'',
password:''
}
}
changeHandler = (e) =>... | true |
a99e600dcc1f198f501439260114c6c756b17c5b | JavaScript | chidieberejoel/res-task | /server/api/middleware/getOpenRes.js | UTF-8 | 2,183 | 2.890625 | 3 | [
"MIT"
] | permissive | const moment = require("moment");
const weekDays = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
// Function to show only open restaurants and open hours
const parseData = (initAppointments, restaurantNames) => {
const appointments = initAppointments.map((ia) => {
if (ia) {
const daysClock = ia.map((... | true |
577ffb263648fccc33367d2ce5cee97892e7a072 | JavaScript | glKarin/together | /qml/js/util.js | UTF-8 | 6,719 | 2.765625 | 3 | [] | no_license | .pragma library
function RandColor(alpha)
{
var a = typeof(alpha) === "number" ? alpha : 1.0;
return Qt.rgba(Math.random(), Math.random(), Math.random(), a);
}
function ModelClear(model)
{
if(Array.isArray(model))
model = [];
else
model.clear();
}
function ModelSize(model)
{
var length = Array.isArray... | true |
782f4ed23fab9f67253a39dc14089ae80cdb6d44 | JavaScript | spt30/autotests-task-02 | /lib/formatDate.js | UTF-8 | 989 | 3.265625 | 3 | [] | no_license | const getTime = require('./getTime');
const MONTH = [
'января',
'февраля',
'марта',
'апреля',
'мая',
'июня',
'июля',
'августа',
'сентября',
'октября',
'ноября',
'декабря'
];
const formatDate = (date, nowDate... | true |
5f665d28184a82fe701cceaefe752e21d0c0198e | JavaScript | SABERGLOW/Programming_Foundations_with_JavaScript_HTML_CSS | /Week 3/6. Convert an Image to Grayscale/ConvertoGrayscale.js | UTF-8 | 589 | 3.21875 | 3 | [
"MIT"
] | permissive | var image;
function upload() {
var imgcanvas = document.getElementById("can1");
var fileInput = document.getElementById("finput");
var fileName = fileInput.value;
alert("You Chose: " + fileName);
image = new SimpleImage(fileInput);
image.drawTo(imgcanvas);
}
function makeGrey() {
var image2 = image... | true |
e6ed199adca47ac88ea06aae0a054cc204af6d07 | JavaScript | Andasweet/practice | /pra/zz01_点名/js/index.js | UTF-8 | 1,781 | 3.265625 | 3 | [] | no_license | // var date = new Date();
// var hour = date.getHours();
// var minute = date.getMinutes();
// var second = date.getSeconds();
// var dm = document.getElementById('dm');
// dm.innerHTML = hour+':'+minute+':'+second;
/*setInterval(function(){
var date = new Date();
var hour = date.getHours();
var minute = ... | true |
79a1b2a1df6af166784dd02a8ce3846bd5b6ac77 | JavaScript | csprance/node-misrcon-example | /index.js | UTF-8 | 542 | 2.515625 | 3 | [] | no_license | const misrcon = require('node-misrcon');
const CronJob = require('cron').CronJob;
const server = new misrcon.NodeMisrcon({ ip: '', port: '', password: '' });
console.log('Script Starting!');
// Runs every 5 minutes
const job = new CronJob(
'* * * * 5 *',
() => {
console.log('Running Cron Job');
const sta... | true |
45372df00894cad7ca56944f19d6380a1163dc35 | JavaScript | julianotorquato/ModeloDigitec | /WebContent/resources/js/dom.js | UTF-8 | 1,742 | 3.09375 | 3 | [] | no_license | /*
* Método utilizado para selecionar todos os checkboxes de um formulário com
* base na mudança de status de um deles.
*
* @param checkbox ->
* componente que irá determinar que os outros checkboxes serão
* marcados
* @param form ->
* formulário que contém os checkboxes que ir... | true |
dcea88271ecd2c52f16cc852d2d2e71590e5d80c | JavaScript | laerciom1/ai-come | /aicome-web/src/redux/cart/reducer.js | UTF-8 | 3,716 | 2.8125 | 3 | [] | no_license | import * as actionTypes from './actionTypes'
const initialState = {
cart: {
actualItemId: 0
}
}
const updateCartTotalValues = (newCart) => {
var subTotal = 0;
for (let it of newCart.itens) {
subTotal += (it.totalValue * it.qt)
}
newCart.subTotal = subTotal
newCart.total = subTotal + newCart.del... | true |
6d7e9bf46c1d3500e43514ef0608b86f7d98720f | JavaScript | Baiqiang/mahjong-scoring | /lib/scoring/1/two-chows.mjs | UTF-8 | 2,562 | 3.0625 | 3 | [
"MIT"
] | permissive | import Fan from '../fan'
export default class TwoChows extends Fan {
get names() {
return ['一般高', '喜相逢', '连六', '老少副']
}
_process() {
let singles = this.melds.filter(
meld => meld.isChow() && this.combinations.every(combination => !combination.includes(meld))
)
let sets = []
for (let co... | true |
2b7d3183fd448eec8ed83ef40b8337802bdb667b | JavaScript | venetrius/project_leonhard | /functions/heap.js | UTF-8 | 2,149 | 3.640625 | 4 | [] | no_license | class Heap {
constructor() {
this.nodes = []
this.lastIndex = -1
}
_swap = (a, b) => {
const nodes = this.nodes
const temp = nodes[a]
nodes[a] = nodes[b]
nodes[b] = temp
}
_getParentIndex = index => Math.ceil(index /2) - 1
_propagateUp() {
let index = this.lastIndex
let nod... | true |
123453baf6c60710e3e78ed4f22ba72e91f7672d | JavaScript | JohaP22/practice_node | /backend/calculadora.js | UTF-8 | 286 | 3.328125 | 3 | [] | no_license | 'use strict'
var params = process.argv.slice(2);
var plantilla = `
La suma es: ${Number(params[0])+Number(params[1])}
La resta es: ${params[0]-params[1]}
La multiplicacion es: ${params[0]*params[1]}
La división es: ${params[0]/params[1]}
`;
console.log(plantilla);
| true |
84544622ab4e5871270dac8ee653d6280d7d5a73 | JavaScript | simpixelated/flickr-faves-from-gallery | /index.js | UTF-8 | 1,529 | 2.84375 | 3 | [] | no_license | const fs = require('fs');
const Flickr = require('flickr-sdk');
const flickr = new Flickr(process.env.FLICKR_API_KEY);
// get public favorites by user id
const getPublicFavoritesForUser = async (params) => {
try {
const response = await flickr.favorites.getPublicList(params)
return response.body.photos.photo... | true |
b4e3e8643c979ab332983dbf5375fed73fc262be | JavaScript | vladimirtrifkovic/WebShop | /WebShop-02/src/main/resources/static/js/music.js | UTF-8 | 936 | 2.546875 | 3 | [] | no_license | $('document').ready(function(){
$('table #editButton').on('click', function(event){
event.preventDefault();
// /country/findById/?id=1
var href = $(this).attr('href');
//ispis podataka u formu koja se edituje
$.get(href, function(music, status ){
$('#idEdit').val(music.id);
$('#titl... | true |
f29781ef39d2ac060803a5356e14f29d80ceff88 | JavaScript | coredigix/brighterjs | /assets/dom/attributes.js | UTF-8 | 1,993 | 3.453125 | 3 | [] | no_license | $$.plugin({
/**
* modify elemnts attributes
* .attr() returns an array of strings containing all attributes names of the first element
* .all.attr() return list of list, equivalent to .map(ele => ele.getAttributeNames())
* .attr('attrName') return the value of this attribute of the first element
* .all... | true |
07af20b8df5ce35ffb67acd5e396d07f420c8b56 | JavaScript | sachinpar/BFDC | /server/routes/counter.js | UTF-8 | 3,076 | 2.546875 | 3 | [] | no_license | const express = require('express');
const router = express.Router();
const MongoClient = require('mongodb').MongoClient;
// Connect
const connection = (closure) => {
return MongoClient.connect('mongodb://localhost:27017', (err, client) => {
if (err) return console.log(err);
var db = client.db('BFD... | true |
2242648fc4c69d6a678a48821e1639eff4ad055c | JavaScript | fhoman/project1-option-trading-game | /js/view.js | UTF-8 | 8,580 | 3.296875 | 3 | [] | no_license | // Create class with rendering different styling for type of screens
class Screens {
constructor (player) {
this.divElement = document.getElementById('game')
this.divElementTradeBox = document.getElementById('trade-box')
this.name = player.name
}
renderIntroductionScreen () {
this.divElement.inn... | true |
c469961cebda517f3de55e0c940c88166d9672d6 | JavaScript | umlsynco/uml-snippets | /public/js/app/modules/umlsync/cs/aggregation.js | UTF-8 | 2,298 | 2.59375 | 3 | [] | no_license | /*
Class: aggregation
Aggregation connector creates a connection beween two elements of diagram
Author:
Evgeny Alexeyev (evgeny.alexeyev@googlemail.com)
Copyright:
Copyright (c) 2011 Evgeny Alexeyev (evgeny.alexeyev@googlemail.com). All rights reserved.
URL:
umlsync.org/about
Version:
2.0.0 (2012-07-12)
*... | true |
1f0a94c13a1423fb9dfa9d7ddbf5749a30e4d131 | JavaScript | shubhampakhale14/javascriptbasic | /comparingobject.js | UTF-8 | 685 | 4.15625 | 4 | [] | no_license | // In JavaScript, objects are a reference type. Two distinct objects are never equal,
// even if they have the same properties. Only comparing the same o
// reference with itself yields true.
// two variable, two distinct objects with same properties
var fruit={name:'apple'};
var fruitbar={name:'apple'};
fruit=... | true |
91f5f8af08ec3f3e6192175e865a31e05e0145de | JavaScript | Ognjen-Radisic/CaseStudy-VanillaJS-Part1 | /src/index.js | UTF-8 | 4,514 | 3.046875 | 3 | [] | no_license | import "./style/main.scss";
import { elements } from "./js/base";
import {
carouselSliderData,
uspsData,
offersData,
tabsData,
additionalInfo,
currency,
} from "./data";
import {
oneCarouselSlider,
oneUsp,
oneOffer,
oneTab,
oneTabMobile,
} from "./js/htmlTemplates";
import * as helperFunctio... | true |
9cbdf7de17d6b62b553f90952a0bbef6d39ef5bd | JavaScript | carlosssanchez/Javascript | /KATA Check and Mate.js | UTF-8 | 1,790 | 4.125 | 4 | [] | no_license | /*
In this kata, you have to implement two functions: isCheck and isMate.
Both of the functions are given two parameters: player signifies who just moved and pieces is an array of objects describing a piece and its location in the following fashion: Tell whether the player put the other in check.
{
piece: string, /... | true |
7b066db94cc57cc72d60bf24f32fac9555b4e1d7 | JavaScript | lambertkuang/btf | /components/TwistedTreeline.js | UTF-8 | 3,486 | 2.515625 | 3 | [] | no_license | import React from 'react';
import axios from 'axios';
import Portrait from './Portrait';
import Champions from './Champions';
import {banRank} from '../helpers/banRank';
export default class TwistedTreeline extends React.Component {
constructor() {
super();
this.state = {
data: [],
nameData: {},
... | true |
42c7c340545da704141647f55be51ffe5a30304f | JavaScript | youneskacel/JS_Checkpoint | /script.js | UTF-8 | 2,569 | 4.0625 | 4 | [] | no_license | /* const isSameNum = (a,b) => {
if (a===b) {
return true
}else{
return false
}
}
console.log(isSameNum(5,"5"))
const minMax = (liste) => {
var min
var max
min = liste[0]
max = liste[0]
for (let index = 0; index < liste.length; index++) {
if (liste[index] > max)... | true |
25e1ab07faa15a94b6f2bc2cfb12d8c48774614d | JavaScript | yynet21/yynet21.github.io | /js/mathtool.js | UTF-8 | 340 | 3.1875 | 3 | [] | no_license | var PI=Math.PI;
var PI_2=2*Math.PI;
function random(v1,v2){
if (arguments.length===1){
return v1*Math.random();
}
else {
return v1+(v2-v1)*Math.random();
}
}
function sin(t){
return Math.sin(t*Math.PI*2);
}
function cos(t){
return Math.cos(t*Math.PI*2);
}
function abs(t){
retu... | true |