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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
d41e76c87df9b375682e62fc0d697edcdbe5e55b | JavaScript | jatinsumai1104/laravel-blog | /public/js/file-input.js | UTF-8 | 818 | 2.625 | 3 | [
"MIT"
] | permissive | // Code By Webdevtrick ( https://webdevtrick.com )
console.log("Helooo");
$(document).ready(function(){
$("#inputGroupFile01").change(function(){
// alert("A file has been selected.");
});
});
$("#inputGroupFile01").change(function(event) {
console.log("Helooo");
readURL(this);
});
function read... | true |
727588e8705932dfd5fac5a737693cf0b385d1e4 | JavaScript | anpavlo/ukrresources | /resources/WebContent/resource/js/deleteRS.js | UTF-8 | 837 | 2.625 | 3 | [] | no_license | $(document).ready(function() {
var deleteLink = $("a:contains('Delete')");
$(deleteLink).click(function(event) {
alert("Якщо в базі містяться ресурси даного типу, він видалений не буде")
var conBox = confirm("Ви впевнені, що хочете видалити цей тип?");
if(conBox){
$.ajax({
... | true |
f3e6b76360340e6ccc816b582326f7016bfef401 | JavaScript | huapeng-zhang/lc | /spec/test/medium/koko_eating_bananas.spec.js | UTF-8 | 536 | 2.671875 | 3 | [] | no_license | const s1 = require('@medium/koko_eating_bananas_1');
describe('koko eating bananas', () => {
let cases = null;
beforeEach(() => {
cases = [{
input: [[3,6,7,11], 8],
output: 4
}, {
input: [[30,11,23,4,20], 5],
output: 30
}, {
i... | true |
981996c2f165d78585ffc17936cbf9f8bd68a8bf | JavaScript | Ninni-cfm/day19_Lev1_1_js-einfuehrung_console-log | /assets/js/main.js | UTF-8 | 1,499 | 4.46875 | 4 | [] | no_license | /* Schreibe den untenstehenden Code im VSC und sieh dir das Ergebnis mit Hilfe des
console.log() Befehls an, nutze den Live Server um das Projekt zu starten und dann
in der Konsole des Chrome - Browsers das Ergebnis zu sehen.
*/
let a = 12;
let b = a * 3;
console.log(b);
// Probier mal b mit Hilfe von docume... | true |
e2be47af6126fe61e016537cd0537f53cd2f8400 | JavaScript | vbushuev/xray | /js/espirit_bot.js | UTF-8 | 5,489 | 2.65625 | 3 | [
"MIT"
] | permissive | //в реализации должно получиться что-то вроде захода в цикле на каждую страницу товара, принта в страницу скрипта и вызова нужной функции с параметрами товара
//Добавление товара в корзину
//цвет не указан, т.к. если вы спарсили товар, то ссылка содержит уже и цвет (для каждого цвета одинакого товара разные ссылки)... | true |
eceda169d8d04110fbee6fcb1dac81276ba519cc | JavaScript | mosqueira/CursoIngresoJS-2017 | /2-InstruccionIf/jsInstruccionIF (4).js | UTF-8 | 382 | 3.03125 | 3 | [] | no_license | function Mostrar()
//con dos if funciona igual pero tiene mas probabilidad de error
//y tambien cuando tenemos if y else.
{
var edad;
edad =document.getElementById('edad').value;
if(edad>12 && edad<18)
{
alert("es adolescente");
}
// if(edad>12&&edad<18)
//{
//alert("es un ad... | true |
0c3d48d16e64d512eef25799d012e2a28b309918 | JavaScript | rabbitCode/file-generator | /lib/inheritance.js | UTF-8 | 1,441 | 2.671875 | 3 | [
"MIT"
] | permissive | var Step = require('step'),
fsPath = require('path');
function Inheritance(paths){
if(typeof(paths) === 'undefined'){
paths = [];
}
this.paths = paths;
}
Inheritance.prototype.add = function(path){
this.paths.push(path);
};
/**
* Attempts to find given path under .paths
*
*
* @param {String} pa... | true |
36975a174c4fcf97903e9c307665e00ef37a5f07 | JavaScript | BransonGitomeh/genesis-core | /Engines/Parser.js | UTF-8 | 4,216 | 3.015625 | 3 | [] | no_license | // Todo
// extend the query lang for ranges to include sorting order
module.exports = {
parse:function(QueryString){
return root(tokenize(QueryString))
}
}
var queryMeta = {}
function root(tokens) {
// querytype checks
// check if its a single value or a range being asked by the query
if(to... | true |
c4991f49cfae6b9f822836e540ecdaae6eb14abd | JavaScript | ahartz1/project-euler | /js/tests/test_e019counting_sundays.js | UTF-8 | 671 | 3.1875 | 3 | [] | no_license | /**
* Tests for Project Euler #19: Counting Sundays
*/
// Set up our test environment
var test = require('mocha').it;
var expect = require('chai').expect;
var assert = require('chai').assert;
var main = require('../e019counting_sundays.js');
test('countingSundays', function() {
// Set up our test dates. (In Ja... | true |
672e93bfc335692490a81e75d0c3099cb3d446e1 | JavaScript | RickyDa/ZTM-smartbrains-server | /controllers/signin.js | UTF-8 | 931 | 2.609375 | 3 | [] | no_license | const bcrypt = require('bcrypt');
const passwords = require('../db/api/passwords')
const users = require('../db/api/users')
const signin = async (req, res) => {
const { email, password } = req.body;
try {
const data = await passwords.getPasswordByEmail(email)
if (data) {
const isVa... | true |
630ae118fdda36bc760dae3ceac83c11dd1a1e9b | JavaScript | elizabethiman/hackspace | /chat/main.js | UTF-8 | 3,835 | 2.625 | 3 | [] | no_license | var config = {
apiKey: "AIzaSyBCY35YbSVN4y4Eb_WJ6FSIL1c0sbpJPaE",
authDomain: "proyecto-demo-cc493.firebaseapp.com",
databaseURL: "https://proyecto-demo-cc493.firebaseio.com",
storageBucket: "proyecto-demo-cc493.appspot.com",
};
firebase.initializeApp(config);
var storage = firebase.storage();
var... | true |
dfbfa8160cad51cc82d7bf98fc1e3b71e919fdc3 | JavaScript | schroffl/object-differ | /test/benchmark.js | UTF-8 | 621 | 2.671875 | 3 | [
"MIT"
] | permissive | var codeStart = process.hrtime();
var differ = require('../index.js');
var obj = {
'This': 'is',
'a': {
'test': 'object',
'demonstrating': 'the'
},
'functionality': ['of', 'object-differ']
};
var update = {
'a': {
'test': 'that isn\t'
}
};
var updateStart = process.hrt... | true |
1e710394ca08cf2c408d44b90bfd7f759bda5690 | JavaScript | githork/MonitoRSS-Web | /src/services/auth.js | UTF-8 | 5,824 | 2.515625 | 3 | [
"MIT"
] | permissive | const fetch = require('node-fetch')
const { URLSearchParams } = require('url')
const WebCache = require('../models/WebCache')
const discordAPIConstants = require('../constants/discordAPI.js')
const getResponseError = require('../util/getResponseError.js')
const createLogger = require('../util/logger/create.js')
/**
*... | true |
a9704a7ff434a95a5c5a27aef1ffcde80d715ddd | JavaScript | bmstu-iu9/utp2020-11-spreadsheet | /src/lib/parser/Parser.js | UTF-8 | 6,981 | 2.96875 | 3 | [
"MIT"
] | permissive | import EW from './ExpressionWrapper.js';
import FormatError from '../errors/FormatError.js';
const toInt = (a) => a.charCodeAt();
export default class Parser {
constructor(inputString) {
this.inputString = inputString;
this.pos = 0;
}
static makeParserError(str) {
throw new FormatError(`Parser: err... | true |
f8aa1a008869b3ea22c5d4597d86de2251fa443b | JavaScript | jimmybengtsson/Github-Dashboard | /client/src/components/Github/GithubChart.js | UTF-8 | 9,000 | 2.890625 | 3 | [] | no_license | import React, { Component } from 'react';
import {Line} from 'react-chartjs-2';
import FlatButton from 'material-ui/FlatButton';
import './Github.css';
let momentIterator = require('moment-iterator');
class GithubChart extends Component {
constructor(props){
super(props);
this.state = {
... | true |
0e2797b9dc1adfc4ca611c0c7577d292d0c73298 | JavaScript | jc-sanchez16/Parcial1 | /public/javascripts/main.js | UTF-8 | 7,208 | 2.578125 | 3 | [
"MIT"
] | permissive | window.onload = () => {
mensaje.hidden = true;
document.getElementById("cardRegistro").hidden = true;
};
nv = navio(d3.select("#navio"), 600);
const element = document.getElementById("databases");
const mensaje = document.getElementById("msg");
const collections = document.getElementById("collections");
const creat... | true |
62820bc8b801b82cc65f9fd971f39d56c72bd130 | JavaScript | soft91/React-Study | /react-context-api-example/src/App.js | UTF-8 | 1,350 | 3.0625 | 3 | [] | no_license | import React from 'react';
// context를 사용하면 모든 컴포넌트를 일일이 통하지 않고도
// 원하는 값을 컴포넌트 트리 깊숙한 곳까지 보낼 수 있습니다.
// light를 기본값으로 하는 테마 context를 만들어 봅시다.
const ThemeContext = React.createContext('light');
class App extends React.Component {
render() {
// Provider를 이용해 하위 트리에 테마 값을 보내줍니다.
// 아무리 깊숙히 있어도, 모든 컴포넌트가 이 값을 읽... | true |
e8358a67b12ad5621784e32a2713416c655cc1f2 | JavaScript | duvan094/ClientSideProgrammingProject | /highscore.js | UTF-8 | 588 | 2.84375 | 3 | [] | no_license | var highscoreArr = [];
var highscoreList = document.getElementById("highscoreList");
/*Get the get highscores from localStorage if there are any saved*/
if (window.localStorage.highscores !== undefined) {
highscoreArr = JSON.parse(window.localStorage.highscores);
highscoreList.innerHTML = "";
for(var i = 0; i<high... | true |
a8d80015322d5264262c8cc62a34b2a93aa8854c | JavaScript | John-Nagle/adlimiter | /options.js | UTF-8 | 2,678 | 3.09375 | 3 | [] | no_license | //
// options.js -- preferences panel support for Ad Limiter
//
// Chrome now prohibits JavaScript in option pages, so this has to be separate.
//
const KPREFSKEY = "P"; // local storage name for prefs
//
// onload -- get existing prefs at page load
//
// If no prefs are stored, use prefs from page HT... | true |
286dd57903a9f425d47cf28b7927dddb93758fac | JavaScript | Ramosc/wpf1303 | /Day 9/main9.js | UTF-8 | 2,714 | 3.5625 | 4 | [] | no_license | console.log("hello");
var compareTwo = function(a, b) {
if (a > b) {return 1;}
if (a < b) {return -1;}
return 0;
};
console.log("compare: ", compareTwo(4, 6));
console.log("compare: ", compareTwo(6, 4));
console.log("compare: ", compareTwo(4, 4));
var prices = [2,99, 2.49, 3.09, 9.99, 0.99];
console.log("... | true |
e8680af83a442dc8d42acbe320433b14ba87c2d1 | JavaScript | rkgallaway/ta-work | /401n12/Erik/dsa/code_challenges/ll_insertions/__test__/node_test.test.js | UTF-8 | 1,470 | 3.4375 | 3 | [
"MIT"
] | permissive | 'use strict';
// REQUIRE AND SETUP
const Node = require ('../lib/node');
const LinkedList = require ('../lib/linklist');
const linkedList = new LinkedList();
//LINKEDLIST VALUES
linkedList.insertAtHead(1);
linkedList.insertAtHead(2);
linkedList.insertAtHead(3);
describe ('linked list test.', () => {
it('Can it add... | true |
cead4e5e6e15bf2cedb0c1e7288ffbe9906e8e39 | JavaScript | realdeeraj/ExpenseChartUsingReactJS | /src/components/Expenses/ExpenseBlock.js | UTF-8 | 899 | 2.640625 | 3 | [] | no_license | import React, { useState } from "react";
import ExpenseItem from "./ExpenseItem";
import Card from "../UI/Card";
import ExpenseChart from "./ExpenseChart";
import ExpensesFilter from "./ExpensesFilter";
import ExpenseList from "./ExpenseList";
import "./ExpenseBlock.css";
function ExpenseBlock(props) {
const [newYea... | true |
c00c153dba01165f889ed216e6c70b2fef652216 | JavaScript | BoykoPetevBoev/SoftUni-Programming-Basics-January-2019 | /ExamTrial/4zad.js | UTF-8 | 761 | 3.265625 | 3 | [] | no_license | function bachelorParty(input)
{
let sumGostArtist = Number(input.shift());
let group = input.shift();
let couvert = 0;
let guests = 0;
while(group != 'The restaurant is full'){
group = Number(group);
guests += group;
if(group < 5){
couvert += (group * ... | true |
22d8c4d729fb11132ec838a7161edb69df8fbd81 | JavaScript | SilviuIordache/TaskManager | /script.js | UTF-8 | 8,549 | 3.40625 | 3 | [] | no_license | // -------MODEL--------------------
class Task {
constructor(id, title, desc, completed = false) {
this.id = id;
this.title = title;
this.desc = desc;
this.completed = completed;
}
}
function getIndexOfId(id, arr) {
return arr.findIndex(el => el.id === id);
}
function addTaskToArr(task, arr) {
... | true |
4c7e54d4194b3f3f2d996c04939b82a5ed66c1a8 | JavaScript | vageeshb/Leo8 | /public/js/challanIndex.js | UTF-8 | 771 | 2.671875 | 3 | [] | no_license | $(document).ready( function () {
$('tbody tr').on('click', 'td a', function () {
var ele = $(this),
status = ele.attr('data-status'),
id = ele.attr('data-id').replace(/"/g, "");
$.ajax({
url: '/challan/' + id + '/status/' + status,
method: 'GET'
}).done( function (message) {
... | true |
31de094b118829421dea1a14ca7487454e6bb4bd | JavaScript | Beomi/snue202 | /index.android.js | UTF-8 | 2,944 | 2.796875 | 3 | [] | no_license | /**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
TextInput,
Modal,
Picker,
} from 'react-native'
class Project extends Component {
constructor(props) {
super(props);
t... | true |
422ce4181523997c6fd12f4b81cc96dd18ad31a1 | JavaScript | tomatofall/IFC.js | /src/ifc-project-builder/items-finder.js | UTF-8 | 1,368 | 2.53125 | 3 | [
"MIT"
] | permissive | import { namedProps as n } from '../utils/global-constants.js';
import { getName } from '../utils/ifc-types.js';
class IfcEntityFinder {
constructor(ifcData) {
const map = new Map();
// generate map so we can return all types without looping tree again
Object.keys(ifcData).forEach((e) => {
const t... | true |
39db725a5173cd356eece56895e05099f5e228e8 | JavaScript | HiltzEM12/weather-journal-app | /server.js | UTF-8 | 1,293 | 3.140625 | 3 | [] | no_license | // Setup empty JS object to act as endpoint for all routes
projectData = {};
// Require Express to run server and routes
const express = require('express');
// Start up an instance of app
const app = express();
/* Middleware*/
// Here we are configuring express to use body-parser as middle-ware.
const bodyParser = r... | true |
0364280e73b00a295d6e4f202e2113f04a219cb4 | JavaScript | jasonnolanreed/watch-ui | /components/message/message-templates.js | UTF-8 | 1,737 | 2.515625 | 3 | [] | no_license | const makeCss = (component) => (
`
<style>
@import "styles/global-styles.css";
:host {
max-width: 750px;
margin: 0.5em auto;
padding: 1em;
color: #fff;
background-color: var(--light-blue);
border-radius: 2px;
box-shadow: 0 2px 6px 0px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(0, 0, 0, 0.1), inset 0 0 4em rgba(0,... | true |
0c9b91454ec1284516620b102b5adb5937feb3cd | JavaScript | lynpotskie/JAVASCRIPT-WORKSHEETS | /ex_conditions/script.js | UTF-8 | 172 | 3.46875 | 3 | [] | no_license | var a = 10;
var b = 20;
if (a < b) {
var result = a + b ;
document.write ('the result of a and b :',result);
} else {
document.write('the data is not true');
} | true |
f5b568911921979ba0f0a66db62dd4e2a2a41eb7 | JavaScript | Zpp-github/mystudy | /mini-program/firstOne/components/myHeader/myHeader.js | UTF-8 | 2,015 | 3.046875 | 3 | [] | no_license | // components/myHeader/myHeader.js
Component({
/**
* 存放从父组件中接收的数据
*/
properties: {
// 要接收的数据的名称
aa: {
// type要接收的数据的类型
type: String,
// value 默认值
vaue: ""
}
},
/**
* 组件的初始数据
*/
data: {
myHeader: [
{
id: 0,
name: "首页",
isActive:... | true |
44e54983ae442dd9377c63644ea7822b2d576063 | JavaScript | sourav-ghosh1234/mongo_assignment1 | /routes/student.js | UTF-8 | 619 | 2.609375 | 3 | [] | no_license | const express=require('express')
const router=express();
const Student=require('../models/Student')
router.post('/add',async(req,res)=>{
const student=new Student(req.body)
const result=await student.save();
if(result){
return res.send({"result":"Success"})
}else{
return res.status(422... | true |
d596543c76a378ffc4d39aa12b1aeda3c4d9f2ee | JavaScript | atbtavares/phaser-plataform-test | /js/menu.js | UTF-8 | 1,471 | 2.8125 | 3 | [] | no_license | "use strict";
var MenuState = function(game) {};
MenuState.prototype.preload = function()
{
game.load.image('bg', 'assets/tela_inicial_2.jpg');
game.load.spritesheet('btn', 'assets/btn_inicio.png',200,35);
game.load.image('creditos', 'assets/creditos.jpg');
}
MenuState.prototype.create = function()
{
... | true |
24d2fab5df19521a6e3cfd9aeb01d08d879a30aa | JavaScript | thomasnakagawa/script-jam | /src/AudioPlayer.js | UTF-8 | 2,029 | 2.734375 | 3 | [] | no_license | import KickSound from './sounds/KICK1.wav';
import HatSound from './sounds/HIHAT1.wav';
import SnareSound from './sounds/SNARE4.wav';
import SynthNote from './sounds/synth_note.ogg';
import SynthNote2 from './sounds/synth2.ogg';
import Pizzicato from 'pizzicato';
import { indexOf } from 'lodash';
const pitchForSemiton... | true |
c572e8a4123944c158f5cff1c4dbf606e1e73110 | JavaScript | locolucco209/MongoScraper | /python/anaconda/pkgs/bokeh-0.12.5-py27_1/lib/python2.7/site-packages/bokeh/server/static/js/tree/models/tickers/util.js | UTF-8 | 818 | 2.546875 | 3 | [] | no_license | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ONE_MILLI = 1.0;
exports.ONE_SECOND = 1000.0;
exports.ONE_MINUTE = 60.0 * exports.ONE_SECOND;
exports.ONE_HOUR = 60 * exports.ONE_MINUTE;
exports.ONE_DAY = 24 * exports.ONE_HOUR;
exports.ONE_MONTH = 30 * exports.ONE_DAY;
exports.ONE_YE... | true |
577fc93f5cdcd58577858c93c4dd9e00ef5bb9eb | JavaScript | dingdingrz/letao | /public/front/js/search.js | UTF-8 | 1,822 | 2.640625 | 3 | [] | no_license | /**
* Created by Administrator on 2018-04-10.
*/
$(function(){
function getHistory(){
var history = localStorage.getItem("searchList")||"[]";
var arr = JSON.parse(history);
return arr
}
function render(){
var arr = getHistory();
$(".content ul").html(template("hist... | true |
129c3e1c3c04d4a86eb3488ffbe472b54ff01196 | JavaScript | energychain/StromDAO-BusinessObject | /MPToken.js | UTF-8 | 1,865 | 2.515625 | 3 | [
"MIT"
] | permissive | /**
* StromDAO Business Object: MPToken
* =========================================
* Meter Point Token handling for StromDAO Energy Blockchain.
*
* In General a MPToken consists of two ERC-20 Tokens: Time and Power
*
* @author Thorsten Zoerner thorsten.zoerner@stromdao.de
* */
this.mptoken = function(obj... | true |
3157c621809415197edff9c1a87e304a9215351a | JavaScript | 0MatheusT/learningCurve-0MatheusT | /pages/bootstrap/bootstrapPages/projeto-galeria/src/js/core/includes.js | UTF-8 | 953 | 2.65625 | 3 | [] | no_license | import $ from 'jquery'
const loadHtmlSuccessCallbacks = [] //array de função callback que é chamado quando uma requisição for bem sucedida
export function onLoadHtmlSuccess(callback) { //função parent ler todos os att wm-include
if(!loadHtmlSuccessCallbacks.includes(callback)) {
loadHtmlSuccessCallbacks.... | true |
df8e8942806c44ca47bbb7ca120a3cdddfbe74c8 | JavaScript | eddycheong/midterm-schoodle | /public/scripts/create-attendee.js | UTF-8 | 6,369 | 2.984375 | 3 | [] | no_license | $(() => {
let editFlag = false;
let currentUserID;
let currentUserOnPage;
function buildAttendeeResponses(array) {
return {
attendeeName: array[0],
attendeeEmail: array[1],
responses: array.slice(2, array.length)
};
};
function unhideInput() {
// Unhides Input
$("#form... | true |
419b4f5846295201b45ba21197d04758cb57c810 | JavaScript | lotaviods/AnimesList | /public/js/change.js | UTF-8 | 1,004 | 3.078125 | 3 | [] | no_license | function toggleInput(animeId) {
const nomeanimeEl = document.getElementById(`nome-anime-${animeId}`);
const inputanimeEl = document.getElementById(`input-nome-anime-${animeId}`);
if (nomeanimeEl.hasAttribute('hidden')) {
nomeanimeEl.removeAttribute('hidden');
inputanimeEl.hidden = true;
... | true |
b18f93ab48394d18ded4323feb34d8b7740124ae | JavaScript | lucyislucyfer/submit-googleforms-to-trello | /GoogleForm-Trello-Integration.js | UTF-8 | 2,965 | 2.9375 | 3 | [] | no_license | function onFormSubmit(e) {
//Call function to create the card
createTrelloCard(e.range);
function createTrelloCard(range) {
//CONFIG VARIABLES TO EDIT
//Trello app key
//Go to https://trello.com/1/appKey/generate to generate key
var TrelloKey = "<KEY>"; //Key to Trello app - SPECIFIC TO YOUR ACCOUNT
//Tr... | true |
f8c02dd4caac182e2c9147b47244e1f3cfad94d2 | JavaScript | Aurifier/jstest | /js/src/ScientificCalculator.js | UTF-8 | 409 | 2.828125 | 3 | [] | no_license | var ScientificCalculator = function() {};
ScientificCalculator.prototype = new Calculator();
ScientificCalculator.prototype.sin = function(a) {
return Math.sin(a);
};
ScientificCalculator.prototype.cos = function(a) {
return Math.cos(a);
};
ScientificCalculator.prototype.tan = function(a) {
return Math.... | true |
74892c9e305079e1f4ba160e2b7ff8bed9f93115 | JavaScript | rushikeshdixit/amne-coding-challenge | /amne.js | UTF-8 | 2,667 | 3.828125 | 4 | [] | no_license | /* N days of average home sale price data
K file window size
Constraints
1 <= N <= 200,000 days
1 <= K <= N days
Input.txt
5 3
188930 194123 201345 154243 154243
Window = N-K+1
*/
// var inputData
//Read the file and saving it to the scope
var express = require('express');
var fs = require('fs');
/... | true |
4e6fa105fba55d079f90a430e0c64fadd9d6e1a7 | JavaScript | DingChiLin/ECommerceWebsite | /server/controllers/item_controller.js | UTF-8 | 2,551 | 2.75 | 3 | [] | no_license | const Item = require('../models/item_model');
const authenticate = async (req, res, next) => {
let itemId = parseInt(req.params.id);
let statusCode = 200;
let message = '';
if (!itemId) {
statusCode = 400;
message = 'item_id is wrong';
} else {
const userId = await Item.get... | true |
c62c8389c0e400e7c1b4d61df1c76f0ae8049b97 | JavaScript | kevin-hasoffers/codeChallenge-vanillaTodo | /assets/app.js | UTF-8 | 142 | 2.640625 | 3 | [] | no_license | (function(){
var todoLists = DOM('#todo-lists');
var clone = '<li class="todo_item">mytodo</li>';
todoLists.first().append(clone);
})(); | true |
916f1c13e867d027496aa2b0c624329bddb58eb6 | JavaScript | RogerDavidCruz/code-wars | /#_The_Post_RC_Saga_Training/Javascript_practice/7kyu_ codewars/7kyu_coding_3min_parallel_circuit.js | UTF-8 | 989 | 3.703125 | 4 | [] | no_license | // 7 kyu - Coding 3min : Parallel circuit
// https://www.codewars.com/kata/571654c3347e6533fa00186b/train/javascript
function resistance(arr){
let sumPreRes = arr.map(x => x.reduce((ac, cv) => ac+cv));
return parseFloat((1/(sumPreRes.map(x => 1/x).reduce((ac, cv) => ac+cv))).toFixed(2));
}
//prep
//parameter ---... | true |
269ce86e7194a18a58255c0454ad84a90f04fa55 | JavaScript | AsterGarden/AsterGarden.github.io | /project/christmas-fjx/index/surprise/main.js | UTF-8 | 3,904 | 2.90625 | 3 | [] | no_license | $(function () {
//数字、letter部分隐藏
$('.area').one('mouseover', function () {
alert("别走,再看我一眼QAQ");
});
//雪花特效
//页面index雪花特效
$("#snow").fallingSnow({
flakeSizeAdjust: 2, //片状大小
flakeSpeedAdjust: 1, //片状速度
drift: 400, //漂移
stopOnClick: false, //点击停止,tu... | true |
17b5bc7fe3ae1a8ffcbb84fd340baf0f5c2ad0f1 | JavaScript | babybluue/Js_practice | /callback/promise.js | UTF-8 | 713 | 3.515625 | 4 | [] | no_license | const promise1 = new Promise((resolve, reject) => {
setTimeout(() => {
resolve("hello promise");
// reject(new Error("something happened"));
}, 3000);
});
const promise2 = new Promise((resolve, reject) => {
setTimeout(() => {
resolve("hello world");
}, 4000);
});
console.log("start");
//*一个错误就会无法运... | true |
374e4b0b98fc6959fc3665be649049e9082ebcf4 | JavaScript | prabhupatil123/patil | /wordcounter.js | UTF-8 | 428 | 3.546875 | 4 | [] | no_license | let textbox = document.getElementById("textbox");
textbox.addEventListener('input', function(){
var text = this.value;
let char = text.length;
document.getElementById("char").innerHTML = char;
text = text.trim();
let words = text.split(" ");
let cleanlist = words.filter(function(ele){... | true |
797001aee06dd4c41fb7860ea85faad572f7f923 | JavaScript | jamesbting/COMP-400-Research-Project | /riot-games-api-scraper/src/index.js | UTF-8 | 583 | 2.6875 | 3 | [] | no_license | // get CLI args and parse
//start the scraping object
const Scraper = require('./scraper')
const config = require('config') //read the config file
const lineReader = require('line-reader');
const cliArgs = process.argv.slice(2)
const apiKey = cliArgs[0]
lineReader.eachLine(config.get('writeToFile.path'), (line, last... | true |
b69df9e2dfdc3d214b2fec44566f9ada8ddca9bb | JavaScript | JamesonC/GifTastic | /assets/app.js | UTF-8 | 1,544 | 3.359375 | 3 | [] | no_license | // functions to create --> makeButton, renderButton
var topics = ["Silicon Valley", "Chuck Norris", "Archor", "South Park", "Game of Thrones"];
function makeButton(name) {
return `<button class='btn btn-outline-primary'>${name}</button>`;
}
// Function for displaying gif data
function renderButtons() {
$(`#... | true |
00c07a8fd7f7037005290b1531348f986031caea | JavaScript | ninasun/JavaScript_MOCAP_Animation | /GLEAT/Geometry/PolyMesh.js | UTF-8 | 34,551 | 3.03125 | 3 | [
"Apache-2.0"
] | permissive | //TODO: Figure out how to jointly require gl-matrix-min.js
function MeshVertex(P, ID) {
this.pos = vec3.clone(P); //Type vec3
this.texCoords = [0.0, 0.0];
this.ID = ID;
this.edges = [];
this.component = -1;//Which connected component it's in
this.color = null;
this.getVertexNeighbors =... | true |
09e20372a7dc16a236d17113af63a1f8fc21f5c3 | JavaScript | anibalp1/bicycles_network | /spec/api/bicycle_api_test.spec.js | UTF-8 | 3,390 | 2.65625 | 3 | [] | no_license | var Bicycle = require('../../models/bicycle');
var request = require('request');
var server = require('../../bin/www');
beforeEach(()=>{
Bicycle.deleteMany({}, function(err, success){
if(err) console.log(err);
});
});
describe('Bicycle Api', ()=> {
describe('Get Bicycles /', ()=> {
it('St... | true |
d11354900af3cdd76c799bb580a2d07d6b3f745f | JavaScript | minhazhalim/Quiz-Application | /application.js | UTF-8 | 7,070 | 2.84375 | 3 | [] | no_license | const startButton = document.querySelector(".start_button button");
const info_box = document.querySelector(".info_box");
const exitButton = info_box.querySelector(".buttons .quit");
const continueButton = info_box.querySelector(".buttons .restart");
const quiz_box = document.querySelector(".quiz_box");
const resu... | true |
50c9efe7b57dceb577470ad8223ca14507cdc5a4 | JavaScript | ThingsMinder/web | /JavaScript/HTML5/script/test_jQuery.js | UTF-8 | 2,120 | 2.703125 | 3 | [
"MIT"
] | permissive | 'use strict'
/*
$(document).ready(function(){
$('button').click(function(){
$('#div1').fadeToggle();
$('#div2').fadeToggle('slow');
$('#div3').fadeToggle(3000);
});
});
$(document).ready(function(){
$('button').click(function(){
$('#div1').fadeTo(1000,0.1);
$('#di... | true |
eba264af869ac00603e861d40b3e11e93b2200e0 | JavaScript | o-rumiantsev/Dirsync | /lib/server.js | UTF-8 | 6,086 | 2.53125 | 3 | [
"MIT"
] | permissive | 'use strict';
const fs = require('fs');
const net = require('net');
const EventEmitter = require('events');
const Connection = require('./connection');
const Watcher = require('./watcher');
const { inspectDirectory } = require('./watcher/utils');
const { readFileSubsystem } = require('./fs-interface');
const kNextCon... | true |
7786a58ffbbc2077bf322711561fa07a3f18ac4c | JavaScript | carljohnson1992/TimothyGay-DiscordBot | /bot.js | UTF-8 | 3,996 | 2.859375 | 3 | [] | no_license | // Import the discord.js module
const Discord = require('discord.js');
// Create an instance of a Discord client
const client = new Discord.Client();
// The token of your bot - https://discordapp.com/developers/applications/me
const token = 'token';
var fortune = [
"It is certain",
"It is decidedly so",
"Without a... | true |
bfc985cb1eaaa9c28354fd5eeed0caaaa96e64bf | JavaScript | AndreaDex/js-jsnacks-blocco-1 | /snack6/main.js | UTF-8 | 238 | 3.84375 | 4 | [] | no_license | /* Stampa il cubo dei primi N numeri,
dove N è un numero indicato dall’utente */
var userNum = Number(prompt("Inserisci un numero da elevare")) +1;
for (var i = 1; i < userNum; i++){
var n3 = Math.pow(i, 3)
console.log(n3);
}
| true |
f3df9e29a3a7523f3bd83e678a488f97e267f84e | JavaScript | smbecerra/freeCodeCamp-Exercises-and-more | /nesting-arrays.js | UTF-8 | 193 | 3 | 3 | [] | no_license | function canNest(arr1, arr2) {
if (Math.min(...arr1) > (Math.min(...arr2))){
return true
} else if (Math.max(...arr1) > (Math.max(...arr2))){
return false
} else {
return false
}
}
| true |
f0b11dd4c5396fd0332ff241962caafe17ba05c3 | JavaScript | nicoruiz/UNQfy | /domain/album.js | UTF-8 | 2,055 | 2.828125 | 3 | [] | no_license | const Track = require("./track");
const idManager = require("../utils/idManager");
const MatchingObject = require("../utils/matchingObject");
//Errores
const NonexistentResourceError = require("../error/nonexistentResourceError");
const ResourceNameTakenError = require("../error/resourceNameTakenError");
class Albu... | true |
4b78da367717aa37d444d9656693c665ead886e7 | JavaScript | BjornMulder/Deltion_exam | /public/js/location.js | UTF-8 | 1,613 | 2.5625 | 3 | [] | no_license | (function($) {
function loadMap() {
var mapEl = document.getElementById('map');
var fromPoint = {lat: $(mapEl).data('d-lat'), lng: $(mapEl).data('d-lng') };
var currentPoint = {lat: $(mapEl).data('c-lat'), lng: $(mapEl).data('c-lng') };
var directionsService = new google.maps.Direct... | true |
65aa2b792b63333ede8626108f87a304fc6d0bc1 | JavaScript | maliknur/code_snippets | /javascript_starter.js | UTF-8 | 981 | 4.03125 | 4 | [] | no_license | /**
A javascript starter based on node.js for
Coursera course on Data Structures and Algorithms
by University of California, San Diego & Higher School of Economics
Input:
4 4
1 2
4 1
2 3
3 1
Ouput:
[ [ 4, 4 ], [ 1, 2 ], [ 4, 1 ], [ 2, 3 ] ]
How to use:
node javascript_starter.js
in console line prov... | true |
d8b8a45eb2954bd7b66319638af89101e48deefd | JavaScript | hecmonn/laso | /pis/public/javascripts/validations.js | UTF-8 | 358 | 2.5625 | 3 | [] | no_license | $('document').ready(function(){
$('#add_name').submit(function(){
var abort = false;
$('div.error').remove();
$(':input[required]').each(function(){
if($(this).val() === ''){
$(this).after('<div class="error">This is a required field</div>');
abort=true;
}
});//on each
if(abort){return false;} ... | true |
c2cd3e80c13b3c1a2510165090d6061221c15a76 | JavaScript | SatyamJagtap/Turtle-Game | /sketch.js | UTF-8 | 5,098 | 2.78125 | 3 | [] | no_license | var candy,candyImg
var sandy,sandyImg
var turtleG
var ground
var realGround;
var bg,backDrop
var gameState = "select"
var ob,ob1,ob2,ob3,obGroup
var obrand
var obplace
var score = 0
var lifeCount = 3
var life,lifeImg,lifeG
var gameover,gameOver
var sStop,cStop
//var fail,hit,life1,life2,jumppp
var liferand
function pre... | true |
fe229ee873196a2a46dcd112b1e03031128dafaf | JavaScript | edwardoboh/zc_plugin_company_files | /backend/controllers/search.controller.js | UTF-8 | 5,480 | 2.609375 | 3 | [] | no_license | const DatabaseOps = require('../utils/database.helper');
const File = new DatabaseOps('File');
const Folder = new DatabaseOps('Folder');
const appResponse = require('../utils/appResponse');
const { BadRequestError } = require('../utils/appError');
const formatSearchData = data => {
return data.map(_ => {
return... | true |
5d0d4f3268cca55fecf04a2931834e2e79fd1418 | JavaScript | sallyquosto/longest-name-exercise | /script.js | UTF-8 | 634 | 3.8125 | 4 | [] | no_license | let name1 = 'sally';
let name2 = 'miranda';
let name3 = 'sophia';
let f = name1.length;
let t = name2.length;
let th = name3.length;
if (f > t && f > th) {
console.log(`${name1} is the longest`);
} else if (f === t && f > th) {
console.log(`${name1} and ${name2} have the longest names`)
} else if (f === t && ... | true |
ed7885e255576e2787ae115be35b1c2700bdc30b | JavaScript | belunusbaum/formulario-registro-de-usuarios | /public/index.js | UTF-8 | 2,179 | 2.53125 | 3 | [] | no_license | $.ajax('http://localhost:3000/api/users')
.done(function (data) {
console.log(data);
for (let i = 0; i < data.length; i++) {
$('#tabla').append(`
<tr data-id=${data[i].id}>
<td>${data[i].nombre}</td>
<td>${data[i].apellido}</td>
... | true |
eb9cc4962bbb885c55f86f1a741c9aa5372a7b70 | JavaScript | francescagiorno/js-snack-es6 | /jsnack-{2}/main.js | UTF-8 | 765 | 3.578125 | 4 | [] | no_license | /*
Creare un array di oggetti: ogni oggetto descriverà una bici
da corsa con le seguenti proprietà: nome e peso.
Stampare a schermo la bici con peso minore.
*/
var bicycles = [
{
"nome" : "mountain-bike",
"peso" : 50,
},
{
"nome" : "city-bike" ,
"peso" : 25,
},
{
"no... | true |
30ac712bd701f1e51dce7b5b954841d0db60671a | JavaScript | pawellecki/MyTravel | /mytravel/src/helpers/date.js | UTF-8 | 1,238 | 2.59375 | 3 | [] | no_license | import moment from 'moment'
import idx from 'idx'
import { getExtreme } from './int'
export const renderTravelTimeRange = stages => {
let timeRanges = []
stages &&
stages.map(stage => {
let startDate = idx(stage, _ => _.date[0].seconds)
let endDate = idx(stage, _ => _.date[1].seconds)
... | true |
f3b30c3f02f1c5350557d4b89dac4f772693c513 | JavaScript | mjlee-andk/AN4102_RaspberryPi | /logic/init.js | UTF-8 | 1,958 | 2.578125 | 3 | [] | no_license | const { ipcRenderer, remote } = require('electron');
const log = require('electron-log'); // 로그 기록
// 초기화
const initFunctionFButton = document.getElementById("initFunctionFButton");
const initConfigButton = document.getElementById("initConfigButton");
initFunctionFButton.addEventListener('click', function(){
remo... | true |
7c803db7a66450db63b214ebb85712025f402a39 | JavaScript | BorgesTh/desafios-javascript-cursoemvideo | /des02-verificapessoa/script.js | UTF-8 | 2,457 | 3.40625 | 3 | [] | no_license | function verify() {
let date = new Date(); // Pega a data atual completa;
let year = date.getFullYear(); // Pega apenas o ano da data atual completa;
let yearF = document.querySelector('input#year').value;
let sexF = document.getElementsByName('radsex');
let gender = "";
let res = document.query... | true |
e3a87a69902d4e2487db673431956158425f21ce | JavaScript | Suprabho-Roy/Data-Structures | /Stacks and Queues/QueueWithStacks.js | UTF-8 | 667 | 3.984375 | 4 | [] | no_license | class Queue{
constructor() {
this.s1 = [];
this.s2 = [];
}
enqueue(value){
while(this.s1.length != 0){
this.s2.push(this.s1.pop());
}
this.s1.push(value);
while(this.s2.length != 0){
this.s1.push(this.s2.pop());
}
}
... | true |
17406006362e0a5e189ea2d35d87459be8dad7b0 | JavaScript | Giorgio-24/vue-score-table | /script.js | UTF-8 | 3,622 | 2.65625 | 3 | [] | no_license | Vue.config.devtools = true;
var root = new Vue(
{
el: '#root',
data: {
players: [
{ name: 'Player 1', score: 0, modifyScore: false, addToScore: 0, },
{ name: 'Player 2', score: 0, modifyScore: false, addToScore: 0, },
{ name: 'Player 3', s... | true |
82103403024492740d81dd4cb8f4b2e4da80d802 | JavaScript | avisilber88/avisilber88.github.io | /MelodyApp.js | UTF-8 | 53,148 | 2.984375 | 3 | [] | no_license | // Variable which tell us what step of the game we're on.
// We'll use this later when we parse noteOn/Off messages
var currentStep = 0;
var score = 1;
// Timer length
var timerLength = 10 / 60; // in minutes
var timerTripped = false;
// Lock 1 variables
var correctNoteSequence = [1, 2, 3, 4, 5, 6, 7, 8, 9]; ... | true |
689d799fdb11d78a02bedb3350a3587f0cc6daa4 | JavaScript | Satish2202/JavaScriptLearning | /JavaScript/Operators/arithmaticOperators.js | UTF-8 | 791 | 3.765625 | 4 | [] | no_license |
/*************Addition*******/
let x=8;
let y=9;
let add = x+y;
console.log(add);
/*************Subtraction*******/
let a=6;
let b=7;
let subtract = b-a;
console.log(subtract);
/*************Multiplication*******/
let c=5;
let d=8;
let multiply=c*d;
console.log(multiply);
/*************Division*******/
let e=6;
let... | true |
cc261ce09af7644707de0ea27df301cfeee868e4 | JavaScript | nicoleneo/nodeschool_exercises | /learnyounode/q10.js | UTF-8 | 778 | 3.203125 | 3 | [] | no_license | var net = require('net')
var portNum = process.argv[2];
var server = net.createServer(function (socket) {
var currTimeObj = new Date();
var dateStr = currTimeObj.getFullYear()+
"-"+(currTimeObj.getMonth()+1).toString().padLeft('0', 2)+
"-"+currTimeObj.getDate().toString().padLeft('0', 2)+
... | true |
4487407748ae336f965060e76367b9209f685512 | JavaScript | codingfreak/cfjs | /codingfreaks.utils.basic.js | UTF-8 | 2,578 | 3.359375 | 3 | [] | no_license | var cf = window.cf || {};
/**
* Contains utility functions useful in many cases.
*/
cf.BasicUtil = function() {};
/**
* Is thrown when an operation-parameter is invalid.
*/
cf.InvalidArgumentException = function(message) {
this.Message = message;
this.Name = "InvalidArgumentException";
};
/**
* Is thrown whe... | true |
2932e8b69b140cadd7e261e9771f7d8417354029 | JavaScript | siddhu2588/Oren-Assignment | /src/userProfile.js | UTF-8 | 1,249 | 2.609375 | 3 | [] | no_license | import React, { Component } from 'react';
import axios from 'axios'
import Card from './card';
class userProfile extends Component {
constructor(props) {
super(props);
this.state = {
list: []
}
}
componentDidMount(){
axios.get("https://jsonplaceholder.typi... | true |
841392a5b71837f1bd295b235aafea0553ddc829 | JavaScript | noamlerner/Spreadsheet | /Grid.js | UTF-8 | 2,836 | 2.53125 | 3 | [] | no_license | APP.sheetGrid = (function () {
var focus = {
xi: 0,
xf: 50,
yi: 0,
yf: 50
};
var grid = {};
var keepFocus = {};
return {
updateCell: function (elem) {
var c, location = elem.getAttribute("cell-id");
if (typeof grid[location] === 'undefi... | true |
59e60ed88141839097fe774702d6e33b5add95c3 | JavaScript | AR589/js-intro | /javascript/theme-switcher.js | UTF-8 | 1,356 | 3.65625 | 4 | [] | no_license | // ============================================================
// Theme Switcher
// ============================================================
// Turns the background from black to white or vise-versa.
"use strict";
// Listen for clicks on the dark theme button
var darkThemeBtn = document.getElementById("dark-them... | true |
28d6ed648cceba68b7a0ca983e0feca9a4538c92 | JavaScript | HoneyHyunny/Resume | /backend/controllers/board.js | UTF-8 | 3,146 | 2.8125 | 3 | [] | no_license | const Board = require("../models/board");
exports.createBoard = (req, res, next)=>{
const board = new Board({
mainTitle : req.body.mainTitle,
extraTitle : req.body.extraTitle,
date : req.body.date,
contents : req.body.contents,
boardCategory : req.body.boardCategory,
... | true |
643ef26ce73002a9f50b1d7e5eefd6d3db9366e6 | JavaScript | scottmcpherson/meteor-starter-kit | /server/startup.js | UTF-8 | 339 | 2.546875 | 3 | [] | no_license | import { Tasks } from '/imports/api/collections';
import casual from 'casual';
if (Tasks.find().count() === 0) {
// Create an array with 3 titles
const taskTitles = [...Array(13).keys()].map(() => casual.title);
taskTitles.forEach(title => {
const id = Tasks.insert({ title });
console.log(`Inserted tas... | true |
4501a539bb53d79043a6d96e3f36fd482b4c6471 | JavaScript | CelestialCrafter/cytrus | /commands/punch.js | UTF-8 | 1,328 | 2.6875 | 3 | [
"MIT"
] | permissive | const Discord = require('discord.js');
exports.run = async (client, message, args, level) => { // eslint-disable-line no-unused-vars
try {
let member = message.mentions.members.first();
let embed;
if (member) {
if (Math.random() < 0.5) {
embed = new Discord.RichEmbed()
.set... | true |
a07daad3968b86c0b2e1dea33c16ee2c7d80f231 | JavaScript | oll-sam/Dojo-Pizzeria | /script.js | UTF-8 | 1,464 | 3.53125 | 4 | [] | no_license | function pizzaOven( crustType, sauceType, cheeses, toppings) {
var pizza = {};
pizza.crustType = crustType;
pizza.sauceType = sauceType;
pizza.cheeses = cheeses;
pizza.toppings = toppings;
return pizza;
}
var pizza1 = pizzaOven("deep dish", "traditional", ["mozzarella"], ["pepperoni", "sausage"]... | true |
9ddb2e6d549def2fa184896776939f3ee011bc0b | JavaScript | rafelluiz/javascript_basico_avancado | /Arrays e Objetos/07_reverse.js | UTF-8 | 78 | 2.765625 | 3 | [] | no_license | let nums = [5,6,2,4,9,6,2];
console.log(nums);
console.log(nums.reverse());
| true |
204bbc59d9ae0330b04d66fed4cc7b38a9fad0c1 | JavaScript | Haugen/js-playground | /current-play.js | UTF-8 | 413 | 3.78125 | 4 | [] | no_license | "use strict";
let user = {
name: "Tobias",
age: 32,
doubleAge: () => user.age * 2,
[2 + 2]: "expressions in keys",
};
console.log(user.name);
console.log(user.age);
console.log(user.doubleAge());
// Assigned variables can be used with brackets to locate keys.
let key = "age";
console.log(user[key]);
// Sett... | true |
ebb0b4c5fac07a36a5d1d9d089d83efe433641ed | JavaScript | nhatvu1998/software-engineer-test | /src/problem2.js | UTF-8 | 1,435 | 2.984375 | 3 | [] | no_license | const hasTextAndNumber = (input) => {
const words = input.split(" ");
const filteredWords = words.filter(
(w) => w.search(/\d/) !== -1 && w.search(/[a-zA-Z]/) !== -1
);
const answer = filteredWords
.reduce((answer, w) => [...answer, ...partition(w)], [])
.map((partition) => partition.join("-"));
... | true |
ef2301d47b8fb7911f3bb23c91f5536a92067221 | JavaScript | lars-erik/logic-app-to-plantuml | /src/core/logicapp-to-plantuml.js | UTF-8 | 4,524 | 2.59375 | 3 | [
"MIT"
] | permissive | const colors = {
turqouise: '#d9eced',
blue: '#c4e2ff',
lightPurple: '#edeafe',
purple: '#eadef8',
grey: '#d9dadb',
red: '#fedcdb'
};
const typeColors = {
'Http': colors.turqouise,
'InitializeVariable': colors.purple,
'SetVariable': colors.purple,
'Switch': colors.grey,
'If'... | true |
8835f09d9227fe560cb96d1d9c28985136e2f0ae | JavaScript | tapansiwach/spinner | /spinner.js | UTF-8 | 268 | 3.1875 | 3 | [] | no_license | const chars = ["|", "/", "-", "\\"];
const loopArray = chars + chars + chars;
let delay = 0;
for (const char of loopArray) {
delay += 200;
setTimeout(() => {
process.stdout.write(`\r${char} `);
}, delay);
}
setTimeout(() => {
console.log();
}, delay); | true |
606727cbadc57bfd2bc4b505189381027b44f7f9 | JavaScript | robotomatic/smf | /backup/2016/01-jan/backup.2016.1.14-4-ok_places_everyone/js/engine/world/actor/animation_manager.js | UTF-8 | 4,397 | 2.828125 | 3 | [] | no_license | function AnimationManager(name, animation, character) {
this.name = name;
this.animation = animation;
this.animationRepeat = animation.repeat ? animation.repeat : false;
this.currentFrame = 0;
this.lastRender = timestamp();
this.animationOver = false;
}
AnimationManager.prototype.start = functi... | true |
b9d281a4a341aa3450bc9f3f676b7d0f8efc4a1e | JavaScript | chungchi300/headfirst-js-for-leetcode | /128.longest-consecutive-sequence.js | UTF-8 | 1,364 | 3.859375 | 4 | [
"MIT"
] | permissive | /*
* @lc app=leetcode id=128 lang=javascript
*
* [128] Longest Consecutive Sequence
*/
/**
* @param {number[]} nums
* @return {number}
*/
/*
# Easiest divide and conquer
1. sort( O(n log n) or O(n^2))
2. find the longest O(n)
## Disadv
very slow,don't fit the O(n) requirement
# Boundary method
Input: [100, 4,... | true |
e92b8bfce7dcdbbe9d7657a5a358c772322910c8 | JavaScript | Tushar-Tilwani/stuff | /company-specific/apple/combinationSum.js | UTF-8 | 864 | 3.125 | 3 | [] | no_license | /**
* @param {number[]} candidates
* @param {number} target
* @return {number[][]}
*/
var combinationSum = function (candidates, target) {
const result = [];
allSets(candidates, 0, target, [], result);
return result;
};
function allSets(candidates, index, target, partial, result, wasPrevSame) {
if (target ... | true |
1780f8283a741e8c0a1d9aa859c475914ec6f300 | JavaScript | diaotai/leetcode | /119.js | UTF-8 | 731 | 3.6875 | 4 | [] | no_license | /**
* 119. Pascal's Triangle II
* Given a non-negative index k where k ≤ 33, return the kth index row of the Pascal's triangle.
* Note that the row index starts from 0.
* Example:
* Input: 3
* Output: [1,3,3,1]
*/
/**
* 思路:就是单纯的不存之前的即可,与上一题的区别在于起始值从 1 变为了 0
* @param {number} rowIndex
* @return {number[]}
*/
... | true |
ee9b2f139010f3b8cb9c257c1df7d04fd3cf6946 | JavaScript | ojetgreece/weatherComponent | /weather-component/viewModel.js | UTF-8 | 2,845 | 2.71875 | 3 | [] | no_license | define(
['ojs/ojcore', 'knockout', 'jquery'], function (oj, ko, $, ace, monokai) {
'use strict';
function WeatherViewModel(context) {
var self = this;
var capeId;
self.iconUrl = ko.observable()
self.tempMeasure = ko.observable(55);
self.description = ko.observable(""... | true |
f6fb9ed8823ef9416ad1dc146973695c05079261 | JavaScript | turbomaze/type-inference-playground | /type-inferer.js | UTF-8 | 10,119 | 2.84375 | 3 | [] | no_license | var util = require('util');
module.exports = {};
// classes to help with types
class AbstractType {
constructor(type) {
this.type = type;
}
}
// work methods
function infer(functionSignatures, expressions) {
// annotate the nodes of the expression tree to disambiguate repeated functions
var labeledExpr... | true |
41955e0193722763dd14046bad989089bbb0e39f | JavaScript | ozziest/business-logics | /src/index.js | UTF-8 | 1,719 | 2.71875 | 3 | [
"MIT"
] | permissive | class BusinessLogics {
constructor (map) {
if (!map) {
throw Error('Initialization data should be passed.')
}
if (map.parameters === undefined || map.parameters === null || typeof map.parameters !== 'object') {
throw Error('Map parameters couldn`t found.')
}
if (map.results === undef... | true |
2cd9ea7320c5eb9d5f5500020850dc84f6362ad0 | JavaScript | lijiliang/record | /vue/vue-mongodb-mall/server/routes/goods.js | UTF-8 | 4,340 | 2.53125 | 3 | [
"MIT"
] | permissive | var express = require('express');
var router = express.Router();
var mongoose = require('mongoose');
var Goods = require('../models/goods')
// 连接mongodb数据库
mongoose.connect('mongodb://127.0.0.1:27017/dumall')
// 连接成功
mongoose.connection.on('connected', function(){
console.log('Mongodb connected success')
})
// 连接失... | true |
bdbe54f61214fe96452171da592d0c9af7973d3c | JavaScript | elonmask/Ruby | /src/modules/classification/classificationLogic.js | UTF-8 | 1,639 | 2.5625 | 3 | [] | no_license | import { findNode, getRequest } from '../../helpers/utils'
import { writeToStorage } from "../../storage/storageMethod";
import { links } from "../../links/links";
import { SportCategory } from "./sportCategory/sportCategory";
import { config } from "../../config/config";
export class ClassificationLogic {
construct... | true |
884a51e0479374265d1c7a7d9a5df3d9266de53f | JavaScript | sergioeruiz/sign-up-exercise | /src/js/userLogHandler.es6 | UTF-8 | 605 | 2.90625 | 3 | [] | no_license | /**
* @class UserLogHandler
* Handles the user list stored in the localStorage
*/
export default class Log {
/**
* Variable name for localStorage
* @constant
* @type {String}
*/
static get LOCALSTORAGE_VARIABLE() {
return 'userList';
}
/**
* Get/set required
*/
... | true |
948c1da23007cdd48b7e910f4aa4059b53f0b273 | JavaScript | guidooudin/To-Do-list | /scripts/tasks.js | UTF-8 | 987 | 3.21875 | 3 | [] | no_license | window.addEventListener('load', () => {
const apiUrl = 'https://ctd-todo-api.herokuapp.com/v1/users/getMe';
const userId = localStorage.getItem('userId');
const formulario = document.querySelector('.nueva-tarea');
const nodoNombreUsuario = this.document.querySelector('.user-info p')
let tarea = docu... | true |