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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
312e66851577d6f3f1048fc34af090af8421c14f | JavaScript | keenanamigos/fcc-local-weather | /dist/weather.js | UTF-8 | 3,096 | 2.671875 | 3 | [] | no_license | "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("val... | true |
fdc3e7d146459745bb1158c649d6686c2e94bd54 | JavaScript | hogehoge666/syno_moments_slider | /static/display-date-command.js | UTF-8 | 996 | 2.78125 | 3 | [
"MIT"
] | permissive | class DisplayDateCommand {
constructor(sliderView) {
this.sliderView = sliderView;
}
do(photo) {
return new Promise((resolve) => {
let date = '';
if (typeof photo !== 'undefined' && typeof photo.time !== 'undefined') {
date = this.convertMomentsTimeTo... | true |
b2bee43d069eef5691f0e69d02b3c9bfb36f6b57 | JavaScript | Pratham05/holiday-resorts | /src/components/RoomsContainer/RoomList/RoomList.js | UTF-8 | 872 | 2.609375 | 3 | [
"MIT"
] | permissive | import React, {useEffect}from 'react';
import Room from '../../Room/Room';
import classes from './RoomList.module.css';
/**
* @desc Component for rendering the list of rooms
* @param object $rooms - The rooms object containing the rooms to be displayed in a sorted order
*/
const RoomList = ({rooms}) => {
if (... | true |
db476cda1152d39887532fbb9b42ef3b2dbe01c5 | JavaScript | Dobronravova/course_JavaScriptReact | /Lesson48/src/js/menu_cards.js | UTF-8 | 4,065 | 3.40625 | 3 | [] | no_license | window.addEventListener('DOMContentLoaded', () => {
const container = document.querySelector('.menu__field .container');
container.innerHTML = '';
class MenuCard {
constructor(src, alt, title, description, price){
this.src = src;
this.alt = alt;
this.title = titl... | true |
dada201d6fc9207f77f7d6cb73e41c2e7cb1f01b | JavaScript | melanieps1/learning-js | /app/js/main.js | UTF-8 | 224 | 2.859375 | 3 | [] | no_license | function warning() {
// The console.log statement below logs the message to Chrome > Inspect > Console
// Console.log statements are used mostly for debugging
console.log('warning triggered');
alert("Danger, Danger!");
} | true |
140118aaecef2435ac2a57faf9be14ba503a2863 | JavaScript | nicklangridge/public-plugins | /solr/htdocs/solr/textproc2.js | UTF-8 | 2,380 | 2.625 | 3 | [
"LGPL-2.1-only",
"Apache-2.0",
"GPL-1.0-or-later",
"Artistic-1.0-Perl",
"MIT"
] | permissive | // Generated by CoffeeScript 1.5.0
(function() {
var TextProc2;
TextProc2 = (function() {
function TextProc2() {
this.candidates = {};
this.values = {};
this.running = [];
}
TextProc2.prototype.candidate = function(key, value, priority) {
var _ref, _ref1;
if (priority ==... | true |
f434bc2fcd4791841ac30de24e7a445f3ee9325a | JavaScript | LeinaPulgarinT/trabajoVirtualGeekParteTresVirtual | /objetos/script/retoCuatro.js | UTF-8 | 113 | 2.578125 | 3 | [] | no_license | const button = document.getElementById("button");
button.addEventListener("click", e => {
console.log(e);
}); | true |
4fd5f44c4160784440d18c09af8a8e6ff12bf8ff | JavaScript | WebHooker/webhooker-sdk-nodejs | /test/Message.spec.js | UTF-8 | 4,191 | 2.875 | 3 | [
"Apache-2.0"
] | permissive | const expect = require('chai').expect
const Message = require('../lib/Message')
const Err = require('../lib/Error')
const basicParams = {
type: 'foo',
tenant: 'bar',
payloads: {
json: { foo: 123 },
xml: '<foo>123</foo>'
},
}
describe('Messages', () => {
const XML_PARAM = 'application/xml'
const JSON_PARAM =... | true |
0be9ec377d024720554251e44c72bf94ed3e9265 | JavaScript | SonjaF0606/project-weather-app | /Designs/weather.js | UTF-8 | 5,174 | 3.265625 | 3 | [] | no_license |
const getWeather = () => {
fetch('https://api.openweathermap.org/data/2.5/weather?q=Stockholm,Sweden&units=metric&APPID=44c5cfc6920c2d5142919775ca620271')
.then((response) => {
return response.json()
})
.then((json) => {
console.log(json)
const apiRespo... | true |
76f117de2065aae67b9268d7735aa3a43aad4839 | JavaScript | m2calabr/svg-path-round-corners | /dist/es5/serialize.js | UTF-8 | 2,332 | 2.6875 | 3 | [
"MIT"
] | permissive | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
var formatArguments = function formatArg... | true |
0df4f75a8f44be7b82716c826516d6dce053c4d1 | JavaScript | drigosantos81/foodFy | /src/app/controllers/SearchController.js | UTF-8 | 1,411 | 2.59375 | 3 | [] | no_license | const Recipes = require('../models/Recipes');
module.exports = {
// ==== PÁGINA DOS RESULTADOS DE UMA BUSCA ====
async index(req, res) {
try {
let results,
params = {}
const { filter, chef } = req.query;
// Se a busca não tiver resultado, retorna para a Home
if (!filter) {
return res.redirect(... | true |
cea477530b37441141f2b42524ed5789c6a37a61 | JavaScript | rainbow8590/MM | /script/page.js | UTF-8 | 4,601 | 2.640625 | 3 | [] | no_license | window.onload = window.onscroll = window.onresize= function(){
/*IE和谷歌走onmousewheel 火狐走DOMMouseScroll必须由绑定事件触发*/
/*封装事件绑定函数*/
function AddEvent(obj,type,fn){
if(obj.addEventListener)
{
obj.addEventListener(type,fn,false); //其它标准浏览器
}
else{
obj.attachE... | true |
adaf832da8126b3094f182c700fe137ac186bc41 | JavaScript | jeiyang108/LogiColorRepo | /Scripts/Marathon/shapesEasy.js | UTF-8 | 12,007 | 3.546875 | 4 | [] | no_license | /* Easy Level Shapes Generator JS
******************************************************************
* THIS NEEDS THE FOLLOWING: GlOBAL.JS *
* COLORLOGIC.JS *
* DRAW.JS *
* EQUATION.JS *
***************... | true |
b082943ad8ffa2a5e7412cf6e714ac5bf4e7d46e | JavaScript | maufarinelli/wigw | /node/db.manager.js | UTF-8 | 3,648 | 2.6875 | 3 | [] | no_license | // Mongo DB
// dbPath: /usr/local/var/mongodb
// sudo mongod
var MongoClient = require('mongodb').MongoClient,
assert = require('assert'),
ObjectID = require('mongodb').ObjectID,
url = 'mongodb://localhost:27017/wigw';
/**
* insert Document
* @param {Object} db
* @param {JSON} document to be ins... | true |
ec24eac9c21e97742252ac74904bbb667acc7a3f | JavaScript | pvandamme/course | /node_js_course/weather_app/app.js | UTF-8 | 384 | 2.796875 | 3 | [] | no_license | const geocode = require("./utils/geocode");
const forecast = require("./utils/forecast");
geocode("Asnijbkfuabhjkwhifbhawkjn", (error, data) => {
if (error) {
return console.log(error);
}
forecast(data.latitude, data.longitude, (error, dataa) => {
if (error) {
return console.log(error);
}
console... | true |
112958f2e5a806062490a6c3d514a4764c5d37e1 | JavaScript | GayathrideviGA/React_Learnings | /concepts/src/concepts/functional_component.js | UTF-8 | 181 | 2.59375 | 3 | [] | no_license | import React from 'react';
function displayName() {
return <h1>I am Gayathri Devi</h1>
}
// ES 6 syntax
// const displayName = () => <h1>I am Gayathri Devi</h1>
export default displayName; | true |
13bbaaad65866d65b4ded8b2ae53ada944ea8469 | JavaScript | miyi/mern | /src/buglist.js | UTF-8 | 2,451 | 2.65625 | 3 | [] | no_license | var React = require('react');
var $ = require('jquery');
var BugTable = require('./bugtable.js');
var BugFilter = require('./bugfilter.js');
var BugSubmitForm = require('./bugsubmitform.js');
var BugList = React.createClass({
getInitialState: function() {
return {bugs:[]}
},
loadBugs: function(fi... | true |
7d311dfa675babd33a15168bceafea6d90e48fab | JavaScript | juangalbea/advanced-algorithms | /src/QueueDataStructure.js | UTF-8 | 693 | 3.859375 | 4 | [] | no_license |
function QueueDataStructure () {
this.queueControl = [];
this.MAX_SIZE = 8;
this.isEmpty = function () {
return this.queueControl.length === 0;
};
this.canEnqueue = function () {
return this.queueControl.length < this.MAX_SIZE;
};
this.enqueue = function (queueElement)... | true |
d3b50a61b76c14c7d9067ade6dff32b00adca10d | JavaScript | mkaemmerer/goban | /src/goban/analysis/atari.js | UTF-8 | 984 | 2.515625 | 3 | [] | no_license | import v from 'v';
const positionStyle = (location) => {
const position = {
top: (location.x / 9) * 100,
left: (location.y / 9) * 100
};
return `top: ${position.top}%; left: ${position.left}%`;
};
const markGroup = (group) => {
return v
.each(group.locations.toArray())
.open('div').append(m... | true |
bbd5d20a1208a308d1f55aea23e597b009da49f2 | JavaScript | RSporman/readme-generator | /index.js | UTF-8 | 1,678 | 3.09375 | 3 | [
"MIT"
] | permissive | const inquirer = require('inquirer');
const fs = require('fs');
const generateMarkdown = require("./utils/generateMarkdown.js");
const path = require("path");
// Asks user a series of questions
const questions = [
{
type: 'input',
name: 'repoName',
message: 'What is name of this application? (This will al... | true |
c6d189caddd366f8b5b7d00c40341e7cbabd3f89 | JavaScript | yangxin1994/javaScript-3 | /javascript/number.js | UTF-8 | 6,201 | 3.71875 | 4 | [] | no_license | /*
'类型:',typeof number,string,boolean,object,undefined, function
*/
console.info('typeof null:',typeof null);
console.info('typeof 1:',typeof 1);
console.info('typeof 你好:',typeof '你好');
console.info('typeof false:',typeof false);
console.info('typeof []:',typeof []);
console.info('typeof {}:',typeof {});
console.info('... | true |
593b03dbeef77dba156f33edf00cff539b06ec12 | JavaScript | russomatt/ARPB | /components/NextArrow.js | UTF-8 | 2,323 | 2.53125 | 3 | [] | no_license | import ReactDOM from 'react-dom';
import React from 'react';
import { getMonthObj } from '../utils/utils.js';
export default class BackArrow extends React.Component {
constructor(props) {
super(props);
this.state = {
selectedDay: this.props.selectedDay,
selectedMonth: this.p... | true |
70937c9d4df2c4f7b6836036eca80f5004f8bf61 | JavaScript | 79manuel/lighthouse-js-fundamentals | /preparation/odd.js | UTF-8 | 171 | 3.546875 | 4 | [] | no_license | function isOdd(num){
if (num % 2 === 1){
return `${num} is not even`;
} else {
return `${num} is even`;
}
}
console.log(isOdd(3));
console.log(isOdd(4));
| true |
6421235a35e797fe9db66ec6727ad13e69fd4bed | JavaScript | Swann606/MyIceCream-Symfony | /public/scripts/recipeLike.js | UTF-8 | 807 | 3.03125 | 3 | [] | no_license | function onClickBtnLike(event){
event.preventDefault();
console.log("pass");
const url = this.href;
const spanCount = this.querySelector('span.js-recipeLikes');
const icone = this.querySelector('i');
axios.get(url).then(function(response){
spanCount.textContent = response.data.recipeL... | true |
84362212f0ce5c6439b1b5bc0f1dbf7f8bd107df | JavaScript | sureshmelvinsigera/ga-amex | /Week-2/day-5/testing-1/js/script.js | UTF-8 | 4,269 | 3.875 | 4 | [] | no_license | mocha.setup("bdd"); //import mocha.setup method
const assert = chai.assert; //call assert from chai
const expect = chai.expect; //call expect from chai
/* ============ BEFORE YOU GET STARTED ============ */
/* here is a very short function that pops up an alert window that says 'Hello!' */
function hello() {
alert("H... | true |
f831ab739789234067e335b397dfba8b9afcc1f4 | JavaScript | joeldseidel/mss-dev-tools | /UI/script/home.js | UTF-8 | 1,890 | 2.6875 | 3 | [] | no_license | var uid = sessionStorage.getItem("uid");
var token = sessionStorage.getItem("token");
var projectsContainer = document.getElementById("my-projects-container");
var activityContainer = document.getElementById("recent-activity-container");
$(document).ready(function(){
var getProjectsData = {
uid: uid,
... | true |
147bea0992c1b67ace99d800c9f7eb9173f3ab67 | JavaScript | lishuliang/leetcode-JavaScript | /leetcode/7.反转整数.js | UTF-8 | 556 | 3.734375 | 4 | [] | no_license | /**
* @param {number} x
* @return {number}
*/
let reverse = function(x) {
let resultArr = [];
let str = '' + x;
for(let i = str.length - 1;i >= 0;i--){
resultArr.push(str[i]);
}
if(str[0] === '-'){ //将负号提到开头
let minus = resultArr.pop();
resultArr.unshift(minus);
... | true |
f135916ed8422d2066e13ecbf36797e7b97dfebe | JavaScript | Ameerahalshihry/Project4 | /frontend/src/App.js | UTF-8 | 11,973 | 2.609375 | 3 | [] | no_license | import React, { Component } from "react";
import axios from 'axios';
import './App.css';
import { getToken, setToken, logout} from './components/services/authServ'
import SigninForm from "./components/authForms/signinForm";
import SignupForm from "./components/authForms/signupForm";
import Home from "./c... | true |
d61a048d8e9ce868a381a362a01e44706fe3182c | JavaScript | zxcabs/webpack-css-module-less-error | /src/index.js | UTF-8 | 367 | 2.625 | 3 | [] | no_license | /**
* @author "Evgeny Reznichenko" <kusakyky@gmail.com>
*/
function renderCat(style) {
var
node = document.createElement('DIV');
node.setAttribute('class', style.root);
document.body.appendChild(node);
}
window.onload = function () {
renderCat(require('./cat.css'));
// error Error: Can... | true |
d2582adeb5cecbc0e8f3554a3ee872090aa0addb | JavaScript | CHENXUEER/viscomposer | /js/data/objectdata.js | UTF-8 | 1,438 | 2.609375 | 3 | [] | no_license | /**
* @fileoverview 数据类基类
*/
viscomposer.data.ObjectData=function(data){
viscomposer.data.Data.call(this);
this.cols={};
if(data!==undefined&&data!==null){
this.update(data);
}
};
viscomposer.data.ObjectData.prototype=Object.create(viscomposer.data.Data.prototype);
viscomposer.data.Obj... | true |
2e3da2f0ad5003363e3a8c376c38764b5f428134 | JavaScript | Neovici/computing-lit-element | /test/computing-lit-element.test.js | UTF-8 | 2,120 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | /* global describe, it */
import {
html, fixture, expect, elementUpdated
} from '@open-wc/testing';
import { ComputingLitElement } from '../computing-lit-element.js';
class ComputingLitElementTester extends ComputingLitElement {
static get properties() {
return {
prop1: {
type: Number
},
prop2: {
... | true |
dd5285a58177622f41c4ce2cf2d89cb263ab0542 | JavaScript | cpharshaw/resteasy-redux | /client/src/store/reducers/mapReducer.js | UTF-8 | 3,387 | 2.703125 | 3 | [] | no_license |
const initState = {
googleAPIValue: null,
numGoogleAPIUpdates: 0,
mapValue: null,
myLocationMarkerValue: null,
initialMapTilesLoaded: false,
mapMovedCounterValue: 0,
boundsValue: function () {
if (this.mapValue) {
return this.mapValue.getBounds();
} else {
return null
}
},
cen... | true |
81ba0267f4c45fe3dccde22eaabd6adaf51eec98 | JavaScript | rnagarajanmca/ES6 | /objectsType.js | UTF-8 | 2,011 | 3.953125 | 4 | [] | no_license | //Object initialization
var employee={
name:"Naga", //: colon symbol should be used
dept:"IT",
project:function(){return "Mobile-1233312"},
};
console.log(employee.name)
console.log(employee.project())
var name="Naga"
var nameObject={name}
console.log(nameObject.name)
//Object Constructor
var deptObjec... | true |
c476cf2d010f0dc42dce276f08c209fec06832ab | JavaScript | IvanTsarehorodtsev/reactwarriors-stage-1 | /src/components/MovieList/MovieItem.jsx | UTF-8 | 1,341 | 2.796875 | 3 | [] | no_license | import React, { Component } from 'react';
class MovieItem extends Component {
constructor(props) {
super(props);
const {title, rating, image, id} = this.props;
this.state = {
id: id,
title: title,
rating: rating,
image: image,
... | true |
7680e451883b34029a00027b2b3771dd13e90b72 | JavaScript | FrCo18/nodeLearn | /workWithThreadsJSON/index.js | UTF-8 | 414 | 2.5625 | 3 | [] | no_license | let http = require('http');
let server = http.createServer(function(req, res){
console.log('URL страницы:' + req.url)
res.writeHead(200, {'content-type': 'text/html; charset=utf-8'})
let obj = {
model: 'Audi',
speed: '234.5',
wheels: 4
}
res.end(JSON.stringify(obj))
})
se... | true |
0e3beb12bdfdb3f946b098bc6e8fa342b3c7c192 | JavaScript | jeannieyeliu/UTS_avengers-fullstack | /avengers-backend/controller/topic.js | UTF-8 | 2,090 | 2.609375 | 3 | [] | no_license | const Topic = require("../model/topicModel");
const Post = require("../model/postModel");
class TopicCtl {
async find(req, res, next) {
const { per_page = 10 } = req.query;
const page = Math.round(Math.max(req.query.page * 1, 1)) - 1;
//为了字符串转数字,所以*1
const perPage = Math.round(Math.max(per_page * 1, ... | true |
2399a8ce263c7fde1d5e27cb97987a9052d83267 | JavaScript | delta94/Shoping-Cart-UI-Antdesign | /src/Store/Reducers/reducer.js | UTF-8 | 622 | 2.625 | 3 | [] | no_license | const initialState = {
cart: [],
url: '1',
};
const reducer = (state = initialState, action) => {
switch (action.type) {
case 'ADD_PRODUCT':
return {
...state,
cart: [...state.cart, action.payload],
};
case 'DELETE_CART':
return {
...state,
cart: [],
... | true |
79fb300a45ef7ec6521555876b2a2977de10e72b | JavaScript | KxcCarter/justi-kenny-chat-app | /src/components/ProgressBarWithPhotos.js | UTF-8 | 3,067 | 2.609375 | 3 | [] | no_license | import React, { useState, useEffect } from 'react';
import { makeStyles } from '@material-ui/core/styles';
import { Box, Paper, Grid, Typography } from '@material-ui/core';
import Axios from 'axios';
//
import NewSelfieModal from './NewSelfieModal';
const landingTime = new Date('April 6, 2021 16:35:00').getTime();
//... | true |
ee554c6c0dec78551e0e46e78f44d478e61e02c8 | JavaScript | BarS134/BarsJS | /BaiTap.js | UTF-8 | 277 | 2.78125 | 3 | [] | no_license | /*
in ra các số chia het cho 2 trong khoảng 0-100
in ra chí hết cho 3
in ra các số chia 5 dư 1
in ra số chính phương => math.qrt(x) %1;
*/
function soChiaHetCho2(){
for( i = 0; i< 100;i++)
if(i%2 == 0){
console.log(i);
}
} | true |
3e57b036209bd5f393be87dd3d4c43ccd43a788e | JavaScript | tylergreason/p5game | /display.js | UTF-8 | 435 | 2.984375 | 3 | [] | no_license | function drawInfo(){
drawFPS()
drawPlayerStats()
document.getElementById('playerHealth').innerText = player.health
}
function drawPlayerStats(){
players.forEach(player => player.drawStats())
}
function drawFPS(){
textSize(12)
text(Math.floor(frameRate()),10,100)
}
function drawInstructions()... | true |
b82a196bf3955e19de36e5445af83f1b452911b7 | JavaScript | ricecreamdude/FED_Screen | /js/bookstore.js | UTF-8 | 1,635 | 3.375 | 3 | [] | no_license | //Fetch data from Google Books API
let bookData = [];
//Increased query results size via URL param
function getBooks(callback,query){
$.ajax({
url: "https://www.googleapis.com/books/v1/volumes?maxResults=40&q=" + query,
type: 'GET',
async: false,
success: function(res) {
callback(re... | true |
ccb13cb4baca55c3aea8e87417f9b4353a81ee82 | JavaScript | biagiola/react-page | /src/components/sub/cuatro.js | UTF-8 | 784 | 2.546875 | 3 | [] | no_license | import React from 'react';
const Cuatro = ( { members, deleteMember } ) => {
const membersList = members.map( member => {
return (
<div className="member"key={member.id}>
<span><strong>Person:</strong> { member.name }</span>
<span><strong> Age:</strong> { ... | true |
57fb4e97b082c64ae41c5e5fdbc7d2445239c33c | JavaScript | vasamvishal/UserRegistration | /sum.js | UTF-8 | 195 | 2.796875 | 3 | [] | no_license | function sum(a,b){
if(a==""||b=="")
return 0;
if(typeof(a)=='undefined'||typeof(b)=='undefined')
return 0;
if(isNaN(a)||isNaN(b))
return 0;
let c=a+b;
return c;
}
module.exports=sum;
| true |
1539136e43db2809422d5761a9ba66622deb5bb4 | JavaScript | bhartiomee/revuiux-Client | /src/app/reducers/userSignUpReducer.js | UTF-8 | 671 | 2.59375 | 3 | [] | no_license | import actionTypes from "../../constants/action-types";
const userAuthenticationReducer = (inputState = {}, action) => {
switch (action.type) {
case actionTypes.auth.USER_SIGNUP_REQUEST: {
return {
...inputState,
isAuthenticating: true,
};
}
case actionTypes.auth.USER_SIGNUP_S... | true |
fbe586d9646eda1a59c13e9fb3b697fb1ce6b05c | JavaScript | BelyaevSergey/towel-sort | /src/index.js | UTF-8 | 421 | 2.875 | 3 | [
"MIT"
] | permissive | module.exports = function towelSort (matrix){
let arr;
if (!matrix) {
return [];
}
if(matrix.length>0)
{
matrix.map(function(item,index){
if((index+2)%2==0){
item=item;
}
else {
item.reverse();
}
... | true |
8f802949e548030b399147dd0cde2fcc5d42be87 | JavaScript | saim201980/java-script | /hello.js | UTF-8 | 80 | 2.703125 | 3 | [] | no_license | var num =-10;
var absoluteNumber = Math.abs(num);
console.log(absoluteNumber);
| true |
8ac0bf5271d74b0d619b40e98e585d7479b84c3f | JavaScript | kushkoalex/new-vision | /public/scripts/a9/helpers/cssDoings.js | UTF-8 | 589 | 2.5625 | 3 | [] | no_license | (function(a9){
/**
* get node style property value
* @param {HTMLElement} $node
* @param {String} cssProperty
* @returns {String} string css property value
*/
a9.getStyle = function($node, cssProperty){
if ('currentStyle' in $node){
return $node.currentStyle[cssPrope... | true |
de0483e02ef6fd08fa1bf6c93e16aa09779bc5ff | JavaScript | Docoo/Charming-Bot | /commands/admin/waifugamereminder.js | UTF-8 | 1,063 | 2.59375 | 3 | [] | no_license | module.exports = {
name: 'waifugamereminder',
description: `Detect waifu game drops and remind you 3 hours later`,
usage: `waifugamereminder <message>`,
help: `Bot will send the input message 3 hours after a successful drop. Use this command again to disable it.`,
async execute(bot, message, args){
... | true |
ee4b55737a7c5bdbbf6d14f44668da08aa30d374 | JavaScript | Kotodua/myjs | /production/locomote/model/flights.js | UTF-8 | 1,090 | 2.53125 | 3 | [] | no_license | var request = require('request');
var api_link = "http://node.locomote.com/code-task/";
function Flights(){
}
Flights.prototype = {
getAirlines: function(resolve, reject){
console.log('getting airlines...');
request(api_link+"airlines", function(error, res, body){
if (error) reject(err);
else resolve(bo... | true |
d952dbfdc7c1493e2b9a395b77d2aa4e06328db9 | JavaScript | Lylichen/testproject | /7.js | UTF-8 | 1,262 | 4.0625 | 4 | [] | no_license | //将优点为我所用 —— 组合继承
//声明父类
function SuperClass(name){
//值类型共有属性
this.name = name;
//引用类型共有属性
this.books = ['javascript','html','css'];
}
//父类原型共有方法
SuperClass.prototype.getName = function(){
console.log(this.name);
};
//声明子类
function SubClass(name,time){
//构造函数式继承父类name属性
console.log("precall-... | true |
4d791911d895bd2d541594dd0f24e62df4535bc8 | JavaScript | yxfanxiao/yxfanxiao.github.io | /showanimation2048.js | UTF-8 | 1,033 | 2.890625 | 3 | [] | no_license | // showanimation2048.js 动画效果逻辑
function showNumberWithAnimation(i, j, randNumber) {
var numberCell = $('#number-cell-'+i+'-'+j);
numberCell.css('background-color',getNumberBackgroundColor(randNumber));
numberCell.css('color',getNumberColor(randNumber));
numberCell.text(randNumber);
numberCell.animate({
width: '... | true |
9519d72adbe49319d37bed88f10a93965c172aa2 | JavaScript | krisyupher/InterviewTest | /myScript.js | UTF-8 | 215 | 2.796875 | 3 | [] | no_license | const openMenu = () => {
const myLinks = document.getElementById("myLinks");
if (myLinks.classList.contains("none")) {
myLinks.classList.remove("none");
} else {
myLinks.classList.add("none");
}
};
| true |
a527158ed77c2db848f8bbdb1b42fa641e19a956 | JavaScript | ednosmab/ExerciciosJavascriptES6 | /Aula15/Contador/script.js | UTF-8 | 1,179 | 3.234375 | 3 | [] | no_license | function contador(){
let inicio = Number(document.querySelector('#inicio').value)
let passo = Number(document.querySelector('#passo').value)
let fim = Number(document.querySelector('#fim').value)
let result = document.querySelector('#resposta-dados')
result.innerHTML = 'Contando: '
let img = doc... | true |
7a722d0c5493006ad32e989520eed68cbe5b824f | JavaScript | philgung/CatMash | /js/tournament.js | UTF-8 | 2,549 | 3.03125 | 3 | [] | no_license |
function Tournament(allPlayers) {
function Battle(id, firstPlayerId, secondPlayerId){
this.id = id,
this.firstPlayerId = firstPlayerId,
this.secondPlayerId = secondPlayerId,
this.isFinished = false;
}
var players = [];
var battles = [];
var rankings = {};
this.i... | true |
ae8dbde471cc84102c861090f8f55b18b6df5957 | JavaScript | Mandy-Tang/leet-code | /src/problems/118-pascals-triangle.test.js | UTF-8 | 787 | 3.25 | 3 | [] | no_license | import generate from "./118-pascals-triangle";
describe("Pascals Triangle", () => {
it("should return undefined if the given number is not a number", () => {
expect(generate("222")).toBeUndefined();
expect(generate()).toBeUndefined();
expect(generate(-9)).toBeUndefined();
});
it("should return an emp... | true |
9c2987c5dccd7e7fb791f88c93fd4074819a02e8 | JavaScript | lowgear/mathlogic2016-hw1 | /SolvationChecker.js | UTF-8 | 5,179 | 2.953125 | 3 | [] | no_license | function Variable(name) {
return {
s: name
}
}
function Op(sign, left, right) {
var res = {
sign: sign,
left: left,
right: right
}
switch (sign) {
case '!':
res.s = sign + left.s;
break;
default:
res.s = '(' + left.s + sign + right.s + ')';
}
return res;
}
function Negt(input) {
switch (... | true |
822f87b30a76e5183005e799da7ed4e9b3779f96 | JavaScript | ansarkmemon/learn-js-deeply | /4_Objects/main.js | UTF-8 | 346 | 2.921875 | 3 | [] | no_license | // 'use strict';
var post = {
id: 1,
title: 'New Post'
};
Object.defineProperty(
post,
'location',
{
value: 'AE',
writable: false,
configurable: true,
enumerable: false
}
);
// delete post.location;
console.log(post)
for(var article in post) {
console.log(article);
}
post.location =... | true |
903fe2594fd1326df8cec4589e4f6dad880e0695 | JavaScript | uhgenie7/gallery | /js/custom.js | UTF-8 | 1,386 | 3 | 3 | [] | no_license | $(function(){
// article의 갯수 저장
let numAc = $("article").length;
console.log(numAc);
// article 전체 가로 길이
let widSec = numAc * 200;
console.log(widSec);
// 하나의 article에 넓어지는 값 더함
let widTotal = widSec + 600;
console.log(widTotal);
// section의 넓이 값 대입
$("section").width(widTotal);
//body의 높이... | true |
7224f6772f4d7d220ede834a703015a84dc1facf | JavaScript | sangameshrently/bleplugin | /RNOaksBleLockLibrary/commands/responses/DefaultResponse.js | UTF-8 | 375 | 2.5625 | 3 | [] | no_license | "use strict";
const Response = require('./Response');
class DefaultResponse extends Response {
constructor(buffer) {
super(buffer);
let startPos = super.bytesParsed;
this._battery = buffer[startPos++];
this.bytesParsed = startPos;
}
get battery() {
return thi... | true |
689cdcd0119ced412a5bf8b40fa0f54bcfab2c36 | JavaScript | gilmoreg/referendus_angular | /server/controllers/references.js | UTF-8 | 3,351 | 2.53125 | 3 | [] | no_license | /* eslint-disable no-underscore-dangle */
const { Reference } = require('../models/Reference');
const APAFormatter = require('./formats/apa');
const ChicagoFormatter = require('./formats/chicago');
const MLAFormatter = require('./formats/mla');
exports.getRefs = async (req, res) => {
if (!req.query.format) throw Er... | true |
409710fcec5244419a69266fb6180a9b111e5af2 | JavaScript | rashedabir/bmi_calculator | /src/components/Metric.jsx | UTF-8 | 1,981 | 2.765625 | 3 | [] | no_license | import { Button, makeStyles, TextField, Typography } from "@material-ui/core";
import React, { useState } from "react";
const useStyles = makeStyles((theme) => ({
root: {
"& > *": {
margin: theme.spacing(1),
},
},
input: {
width: "100%",
},
result: {
margin: "20px 0",
},
}));
functio... | true |
312f1056c15af4379146bf20eccc89ae784d37e6 | JavaScript | ps222nq/LNU-Book-Library | /app/resources/AddBookResource.js | UTF-8 | 989 | 2.765625 | 3 | [] | no_license | (function () {
"use strict";
var LibraryDAO = require('../dao/LibraryDAO');
var Book = require("./models/Books");
module.exports = function (data, callback) {
LibraryDAO.readXMLFile(function(error, obj){
if(error){
return console.log(error);
}
... | true |
dd1d1445b0ab1c5e2e842afe42265d7b637eafd8 | JavaScript | vladutcornel/HTML5-Paint | /js-src/tools/resize-canvas.js | UTF-8 | 1,481 | 2.984375 | 3 | [
"MIT"
] | permissive | /**
* Created by vciobota on 4/15/17.
*/
(function () {
const PROP_WIDTH = "width";
const PROP_HEIGHT = "height";
var $canvas;
var context;
var $width, $height;
jQuery(function ($) {
$canvas = $("#WorkCanvas");
context = $canvas.get(0).getContext("2d");
$width = $("#Ca... | true |
aa2939fea267b62e6a8f86e6b670944044429d56 | JavaScript | Anil1111/my-timer-vue | /relogin.js | UTF-8 | 3,236 | 2.78125 | 3 | [
"MIT"
] | permissive | const URL_GOOGLE ="https://script.google.com/macros/s/AKfycbyd5AcbAnWi2Yn0xhFRbyzS4qMq1VucMVgVvhul5XqS9HkAyJY/exec?tz=America/Fortaleza";
const SC = 1000;
const MN = 60 * SC;
const HR = 60 * MN;
const DY = 24 * HR;
const FD = (len, number) => (new Array(len).fill('0').join('') + number).slice(-len);
const F2 = (numbe... | true |
744ed2f54b47ec64bb41843d2746c2aa2d280e01 | JavaScript | muratkeremozcan/cypressExamples | /cypress-tutorial-build-todo-starter/cypress/integration/footer.spec.js | UTF-8 | 1,579 | 2.765625 | 3 | [
"MIT"
] | permissive | describe('Footer', () => {
context('with a single todo', () => {
it('displays a singular todo in count', () => {
cy.seedAndVisit([{
id: 1,
name: 'Buy milk',
isComplete: false
}]); // 1 item in the list
cy.get('.todo-count')
.should('contain', '1 todo left');
... | true |
efb6fa1ba6d95a4a7d81681b0fc7941c5bd2c438 | JavaScript | lsolesen/ifire-dk-jekyll | /assets/js/shared.js | UTF-8 | 16,101 | 2.578125 | 3 | [] | no_license | $(document).ready(function() {
$("#calculator_fire").submit(function(e) {
console.log('Ready to submit');
e.preventDefault();
let monthly_budget = Number($("[name='monthly_budget']").val());
let passive_income_percent = Number($("[name='passive_income_percent']").val());
let... | true |
ad1307715b7c7df7ba22ebaa24becf7687a38e7a | JavaScript | bccho/michael-bay-tower-defense | /js/GameEngine.js | UTF-8 | 4,799 | 3.359375 | 3 | [] | no_license | // This file sets up the framework for game functionality, including a dictionary of lists of active instances,
// and utility methods for creating and destroying in-game objects
var GameEngine = GameEngine || {
// Instance variables - global delta time, active instances
_prev_t: undefined,
_time: undefine... | true |
ba5038f00daf2e2775a1a84476702819d4cf4758 | JavaScript | gisligudjons/Flies | /OldJSfiles/food.js | UTF-8 | 778 | 3.59375 | 4 | [] | no_license | // class Food {
// constructor(x, y) {
// this.pos = createVector(x, y)
// this.size = random(3, 5)
// this.eaten = false
// this.col = color(random(100, 255), 150, random(0, 100))
// }
// update() {
// this.pos.add(0, this.size * 0.15)
// if (this.pos.y == h... | true |
01cb29642357baef0a236908922fda8c9d3a149e | JavaScript | paigen11/better-javascript-lut | /destructuring/src/index.js | UTF-8 | 1,115 | 3.953125 | 4 | [] | no_license | document.getElementById('app').innerHTML = `
<h1>Hello Parcel!</h1>
<div>
Look
<a href="https://parceljs.org" target="_blank" rel="noopener noreferrer">here</a>
for more info about Parcel.
</div>
`;
// this is the spread operator
// by using the ... at the end of the array, everything from c on will be printed o... | true |
a5ea8598136b48330f440aa4f3d5aca80a5467b8 | JavaScript | dpocknee/nc-news_frontend | /src/utils/utils.js | UTF-8 | 978 | 2.546875 | 3 | [] | no_license | import { compareDesc } from 'date-fns';
import { navigate } from '@reach/router';
export const capitalizer = word => word[0].toUpperCase() + word.slice(1);
export const filterer = (articles, searchbox) => (searchbox
? articles.filter(article => {
const regex = new RegExp(searchbox, 'gi');
return regex.test(... | true |
d21c47bd8d156de643f5811c8bb4aa10688bdc5c | JavaScript | melsitov-as/technomart | /source/js/main.js | UTF-8 | 2,004 | 2.84375 | 3 | [] | no_license | const contactsButton = document.querySelector('.contacts__button');
const popup = document.querySelector('.popup');
const popupClose = popup.querySelector('.popup__close-button');
const usernameInput = popup.querySelector('.popup__username-input');
const form = popup.querySelector('.popup__form');
const emailInput = po... | true |
2764768d83a0c573dccdda39eaf10ad395007908 | JavaScript | SiLeBAT/foodprocess-web-app | /src/js/models/ingredients.jsx | UTF-8 | 1,837 | 2.859375 | 3 | [] | no_license | /**
* This file creates and exports an ingredient node. It creates an instance of the basic node, adds some configuration, and attaches a backbone model for the properties to it.
*/
let joint = require('jointjs/dist/joint.js');
let Backbone = require('backbone');
import { nodeTypes, IngredientCollection } from '.... | true |
f0e845c8661ea933fa939c4a16c718e514a0e29f | JavaScript | ZhiMing96/Balance-api-interview-task | /test.js | UTF-8 | 5,078 | 2.609375 | 3 | [] | no_license | import chai from 'chai';
import {
app,
getBitStampCurrencyIdentifier,
getUsdBalanceForACurrency,
getTotalUsdBalanceForUser,
} from './index.js';
import axios from 'axios';
import sinon from 'sinon';
import chaiHttp from 'chai-http';
const { expect } = chai;
chai.use(chaiHttp);
describe('Test For User Balance'... | true |
5e537ea6bb59bc9b22ee669640f20d47e93e1e74 | JavaScript | jaspreet-singh-sahota/assignment_project | /src/utils/data.js | UTF-8 | 2,162 | 2.703125 | 3 | [
"MIT"
] | permissive | import faker from "faker";
const tableTitle = [
"Vendor",
"Vendor Code",
"PO#",
"PO Line",
"Description",
"PO Value INR",
"Qty Ordered",
"Qty Shipped",
"GR Quantity",
"UOM",
"Due Date",
"Commented Date",
"Status",
];
const status = [
"All",
"GRN Posted",
"Accepted",
"Rejected",
"Re... | true |
9e44a92e1067dec61baeac1d5513b0a497d24713 | JavaScript | emiougi/classical-music | /www/soundCtl.js | UTF-8 | 1,881 | 3.171875 | 3 | [] | no_license | // メディアオブジェクトを定義
var media = null;
var current_sound = '';
var playing = 0;
// クイズ用のコントローラ
myApp.controller('soundController',['$scope', '$timeout', function($scope, $timeout) {
$scope.init = function (filename) {
current_sound = filename;
playing = 1;
setTimeout(function(){
play... | true |
f1b5a70bd9b72bcf02081e15ab7d32a8672cb20e | JavaScript | punit-shah/data-table-trainee-assessment | /tabs.js | UTF-8 | 468 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | function initTabs() {
$('.tab').click(function () {
$('.tab').removeClass('selected');
$(this).addClass('selected');
showHideTabContent($(this).attr('data-shows'));
});
showHideTabContent();
$('.tab')
.first()
.click();
}
// hides all tab content before showing ... | true |
7db60e4b515eec428a38d55d1283feb5572b4d8f | JavaScript | houston88/react-training | /src/www/js/components/redux-cars.js | UTF-8 | 3,667 | 2.671875 | 3 | [
"MIT"
] | permissive | import React from 'react';
import ReactDOM from 'react-dom';
import { createStore, combineReducers } from 'redux';
const cars = [
{ id: 1, make: 'Ford', model:'F-150', year:2015, color: 'red' },
{ id: 2, make: 'Ford', model:'F-250', year:2016, color: 'blue' },
{ id: 3, make: 'Tesla', model:'Model S', year:2017, c... | true |
d5ad09c73f0ffc8b3909705135283081e0577399 | JavaScript | RoboCafaz/optc | /js/app.js | UTF-8 | 1,115 | 2.640625 | 3 | [] | no_license | angular.module('app', []);
angular.module('app')
.controller('TimeCtrl', function(){
var self = this;
self.timezone = jstz.determine().name();
var utctime = moment.utc("2015-05-04 13:00");
var my_offset = moment().utcOffset();
self.my_time = utctime.clone().utcOffset(my_offset);
self.military = false;
... | true |
1576c2ccf2081ca2f4717284730383d5c82de7d5 | JavaScript | davcri/gl-jam0 | /src/utils/AtlasGraphic.js | UTF-8 | 2,068 | 3.09375 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | const W = 16 // tile width in pixels
const H = 16
const SEPARATION = 1
const ATLAS_W = 815 // width in pixels
const ATLAS_H = 373
const TILES_PER_ROW = (ATLAS_W + SEPARATION) / (W + SEPARATION)
const TILES_PER_COL = (ATLAS_H + SEPARATION) / (H + SEPARATION)
const LAST_TILE_ID = 1056
class AtlasGraphic {
constructor(... | true |
c26ae12a896e55280b1a75296482a1c3ebb41481 | JavaScript | dominik-pocica/Pocica-Dominik-lal2-2-WebS | /ImageEditor/main.js | UTF-8 | 2,128 | 2.890625 | 3 | [] | no_license | const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
let img = new Image(); //let - that makes you redefine variable unlike const
let fileName = '';
const downloadButton = document.getElementById('download-btn');
const uploadFile = document.getElementById('upload-file');
const revert... | true |
e7d30967417615df2620a2dc8cfbf0504189c180 | JavaScript | halis/halis | /tests.js | UTF-8 | 3,549 | 3.21875 | 3 | [
"MIT"
] | permissive |
QUnit.test("query", function( assert ) {
var x = {
a: {
b: [{name: 'steve'}, {name: 'bill'}, {name: 'joe'}],
}
};
assert.equal('a.b.2.name'.query(x), 'joe');
assert.equal('a.b.2.age'.query(x), undefined);
assert.equal(halis.getProp(x, 'a.b.2.name'), 'joe');
assert.equal(halis.getProp(x, 'a.... | true |
5733f2beac81cbd58185fbb08586347fbc584786 | JavaScript | PitPanda/PitPandaCTJS | /components/plaque.js | UTF-8 | 2,476 | 2.78125 | 3 | [] | no_license | import { sentenceCase } from '../utils';
import { createPlayerList, createPlayerName } from './playerName';
import * as Elementa from 'Elementa/index';
import { createCard } from './cards';
/**
* @param {string} uuid
*/
export const createMainLink = uuid => {
const comp = new Elementa.UIContainer()
.setHeight... | true |
bd9e15dcad98984968d10cfb8fee63d30ae5915e | JavaScript | njgray/kata-solutions | /_tests.template.mjs | UTF-8 | 754 | 2.84375 | 3 | [
"BSD-3-Clause"
] | permissive | // import fn from './*.solution.mjs';
function test(func, args, expected, assertion) {
const msg = `Testing: ${func.name}(${args}) === ${expected}`;
const start = (new Date()).getTime();
const actual = func(...args);
const passed = assertion(actual, expected, console.assert);
const execTime = ( Date.now() - ... | true |
657b0992cd172453005bf508f8e487ca2527ec2d | JavaScript | AndrewTBurks/EnglewoodSocialServices | /src/js/controllers/searchController.js | UTF-8 | 2,036 | 2.75 | 3 | [
"BSD-2-Clause",
"BSD-3-Clause",
"MIT",
"ODbL-1.0",
"CC-BY-3.0"
] | permissive | /* global d3 _ */
'use strict';
var App = App || {};
// eslint-disable-next-line no-unused-vars
let SearchController = function() {
let self = {
input: null,
counter: null,
button: null,
lastSearchedTerm: null
};
function attachDOMElements(inputID, counterID, buttonID) {
self.input = d3.se... | true |
2c7cbdd2a8dec48d438baf6e4b35dec8524e4c70 | JavaScript | TomaNikolov/TelerikAcademy | /JS-OOP/01. Functions and Function Expressions/tasks/task-2.js | UTF-8 | 1,242 | 3.84375 | 4 | [
"MIT"
] | permissive | /* Task description */
/*
Write a function a function that finds all the prime numbers in a range
1) it should return the prime numbers in an array
2) it must throw an Error if any on the range params is not convertible to `string`
3) it must throw an Error if any of the range params is missing
*/
function solve()... | true |
f9ec209edb2e2a0ed9eda241854c77f379ceb0b1 | JavaScript | qinhuining125/CJYQFY | /src/main/resources/static/utils/CommonUtils.AjaxUtil.js | UTF-8 | 10,131 | 2.53125 | 3 | [] | no_license | /**
* CommonUtils.AjaxUtil,通用list操作ajax类
* @author BBF
* */
;
(function (comm, $) {
'use strict';
var defaults = {
"loadingType": 2, //1 - 读取,2 - 提交,默认2
"msgTitle": "\u6E29\u99A8\u63D0\u793A", // 信息标题
"lazyTime": 100, // successCallback 延迟执行的时间,毫秒
"autoCloseModal": true, //自动关闭提示
"loadingTitl... | true |
b1ac19909cdd8c8f530abf134c6643c5e936451f | JavaScript | structure-computation/computation-lab | /public/javascripts/functions_layer.js | UTF-8 | 5,101 | 2.90625 | 3 | [] | no_license | <!--
//------------------------------------------------------------------------------------------------------
// fonctions génériques
//------------------------------------------------------------------------------------------------------
function clone(myArray){
var newArray = new Array();
for (var property ... | true |
b6beea6287b98147e7843b056784723a3622bea0 | JavaScript | oronsh/swapi-ui-test | /js/storage.js | UTF-8 | 854 | 2.625 | 3 | [] | no_license | define(['controllers/error'], function(Error) {
var ERROR_MESSAGE = 'Could not start storage';
function _handleFactory() {
if(!window.localStorage) {
// TODO: load some other storage engine
return;
}
// return default storage engine
return window.localStorage;
}
function Storag... | true |
9d3a96a5e8e3e40d665081d36b7734df8578f95a | JavaScript | NijoNin/GSimpact-Codes | /index.js | UTF-8 | 5,021 | 2.609375 | 3 | [] | no_license | require('dotenv').config();
const axios = require('axios').default;
const cheerio = require('cheerio');
const { CronJob } = require('cron');
const Discord = require('discord.js');
const fs = require('fs');
const cron = require('cron').CronJob;
const url = "https://www.gensh.in/events/promotion-codes";
const dir = "./.... | true |
c64d4b0c5e8317ff9e451200e0ba45103d926a42 | JavaScript | izaroot/plnr-frontend | /src/Components/WeekContainer.js | UTF-8 | 1,064 | 2.609375 | 3 | [] | no_license | import React, { Component } from "react"
import { Segment } from "semantic-ui-react"
import DayContainer from './DayContainer'
export default class WeekContainer extends Component{
render(){
let dayNames = [...new Set(this.props.weeklyTasks.map(task => task.start_time[2]))]
let firstTaskDay = new ... | true |
0fcb450dedc4e9559b244ebaafb2c190d748d8dd | JavaScript | awald220/Constructor-Word-Guess | /word.js | UTF-8 | 671 | 3.765625 | 4 | [] | no_license | var Letter = require("./letter.js");
function Word(answer){
this.objectArray = [];
for (var i = 0; i < answer.length; i++){
var letter = new Letter(answer[i]);
this.objectArray.push(letter)
}
this.log = function(){
answerLog = "";
for(var j = 0; j < th... | true |
18464b97de9f84421c98d1f2bcdbebe88eea5523 | JavaScript | Krish2580-PRO/Dustbin | /sketch.js | UTF-8 | 804 | 2.703125 | 3 | [] | no_license |
const Engine = Matter.Engine;
const World = Matter.World;
const Bodies = Matter.Bodies;
const Body = Matter.Body;
var ground1,side1,side2,side3
var paperBody
function preload()
{
}
function setup() {
createCanvas(1000,600);
engine = Engine.create();
world = engine.world;
//Create the Bodies Here.
ground1= ... | true |
2da6c33fba66d9b9de0e530fc861d8b986a7a7f7 | JavaScript | uanq2/trivia_quiz | /assets/js/highscores.js | UTF-8 | 337 | 3.09375 | 3 | [] | no_license | let highScores = document.getElementById("high-scores");
let highScoresArr = JSON.parse(localStorage.getItem("highScoresArr")) || [];
function displayScores() {
highScores.innerHTML = highScoresArr
.map((score) => {
return `<li>${score.name} ${score.score}</li>`;
})
.join("");
}... | true |
97b71b8e7f34d1a197db34805a769f1a9469c884 | JavaScript | anand-kay/sportsy-be | /controllers/wishlist.js | UTF-8 | 1,461 | 2.703125 | 3 | [] | no_license | const ProductModel = require('../models/product');
// Add to wishlist
exports.addToWishlist = (req, res, next) => {
const user = req.user;
user.wishlistproducts.push({
_prodid: req.body.prodid
});
user.save().then((user) => {
res.send(user.wishlistproducts);
}).catch((err) => {
... | true |
8261a9db0d72b0af7c146e7fdd088ce154b36485 | JavaScript | SinCatGit/all-of-javascript | /读书笔记/JavaScript数据结构与算法/leetcode/addtwoSum.js | UTF-8 | 1,113 | 3.890625 | 4 | [] | no_license | // Input: (2 -> 4 -> 3) + (5 -> 6 -> 4)
// Output: 7 -> 0 -> 8
// Explanation: 342 + 465 = 807.
// 意思是输入两个非空链表,然后输出一个经过计算的链表。对应的计算方式如上
/**
* Definition for singly-linked list.
* 定义这个链表的过程已经实现了,不用写。
* function ListNode(val) {
* this.val = val;
* this.next = null;
* }
*/
/**
* @param {ListNode} l1
* @... | true |
503be49ff35fc66f70f059172eefcfd6cb050472 | JavaScript | julianvanost/react-search-ombd-api | /src/App.js | UTF-8 | 994 | 3 | 3 | [] | no_license | import React, { Component } from 'react'
import axios from 'axios'
class App extends Component {
state = {
pokemon: []
}
componentDidMount () {
axios.get('https://pokeapi.co/api/v2/pokemon')
.then(({ data: { results } }) => {
console.log(results)
this.setState({ pokemon: results ... | true |
888df3165f5ff0cf9bf64394e19fec8d40438524 | JavaScript | aka-Kush/Full-Stack-Web-Dev | /Lec7.6-JS_Function_call_stacks/script.js | UTF-8 | 1,323 | 4.3125 | 4 | [] | no_license | // When we call a function inside other function, that function gets added to the function callstack
// Here callstack goes from shivansh --> maa
// We can check that all the functions are getting added to callstack and are being called by throwing an error in the last function
function shivansh() {
console.log("L... | true |
09a770614d5278bae18b72c0da94b7b0b77f15f4 | JavaScript | w3tsa/Random-quote-machine | /src/App.js | UTF-8 | 1,853 | 2.59375 | 3 | [] | no_license | import React, { Component } from "react";
import Box from "./Box";
import { getData, Choice } from "./Helpers";
import "./styles.css";
class App extends Component {
static defaultProps = {
allColors: [
"purple",
"magenta",
"violet",
"red",
"black",
"blue",
... | true |
3534fe06f1c8bbf53b3bc05de9194e2faf94ea02 | JavaScript | cperezll/APIRest_email | /views/static/js/users.js | UTF-8 | 4,121 | 2.703125 | 3 | [] | no_license | $(document).ready(function(){
//Variables from a new User
var statusName = true
var statusEmail = true
var statusPassword = true
//Deselect inputs from a new user
$("#infoNewUser").hide()
$(".errorProjName").hide()
$(".errorEmail").hide()
$(".errorPassw").hide()
//Add user for... | true |
6e5ab1ce25196f35aa248c47b272654a9a9bddcd | JavaScript | exah/data-structures-and-algorithms-practice | /linked-list/test.js | UTF-8 | 1,319 | 3.53125 | 4 | [] | no_license | import test from 'ava'
import SinglyLinkedList from './singly-linked'
import DoubleLinkedList from './double-linked'
const john = 'John'
const james = 'James'
const bob = 'Bob'
const harry = 'Harry'
const ron = 'Ron'
const basicListTest = (list, t) => {
// Basic operations
t.is(list.length, 0)
list.add(john)
... | true |