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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
36fdf3f15002a8f733bcf232ba18f3e7dfaf52c5 | JavaScript | NAWilson9/GarbageCollection | /client/js/core/basic.js | UTF-8 | 2,517 | 2.765625 | 3 | [] | no_license | /**
* Created by Chris on 4/19/2015.
*/
var canvases = {};
var ctxs = {};
function initCanvas(parent, name, w, h){
var canvas = document.createElement('canvas');
canvas.width = w;
canvas.height = h;
canvas.style.position = 'absolute';
canvas.style.top = '10px';
canvas.style.left = '10px';
parent.appendChild(... | true |
a6006901837322dfbf9e7eb5612a8e203f921d72 | JavaScript | LenaMaltseva/NodeJS | /hw-2/stat.js | UTF-8 | 1,599 | 3.328125 | 3 | [] | no_license | const fs = require('fs')
class Statistic {
constructor (data) {
this.gamesCount = data.winLog.length
this.winsCount = data.userWins
this.losesCount = data.userLoses
this.winsRatio = Math.round((this.winsCount / this.gamesCount) * 100)
this.losesRatio = Math.round((this.loses... | true |
1358c8d5c1ffcfcedc0c96dff225c5cdf331087a | JavaScript | TT-WEBFT-43-Food-Truck-TrackR/Front-End | /src/components/AddTruckForm/AddTruckForm.js | UTF-8 | 2,724 | 2.5625 | 3 | [] | no_license | import React, { useState } from 'react'
import { v4 as uuid } from "uuid"
import styled from 'styled-components'
const initialFormValues = {
truckName: '',
location: '',
category: '',
menu: []
}
const initialMenuValues = {
itemName: '',
desc: '',
price: ''
}
const StyledForm = styled.form`
display:flex... | true |
e2b7aca94f5d3f423f4a0e2bc259d220cd55019a | JavaScript | codefornl/consul-assets | /server.js | UTF-8 | 3,702 | 2.546875 | 3 | [] | no_license | (function () {
'use strict';
var http = require("http");
var path = require('path');
var fs = require('fs');
var Archiver = require('archiver');
/**
* Parse the params of the request.
*/
function params(req) {
var q = req.url.split('?');
var result = {};
if (q.length >= 2) {
q[1].... | true |
35c35c46425cd45775758f3c58fdfc6c8bb6983d | JavaScript | coucoulesr/exercise-tracker-vue | /src/store/index.js | UTF-8 | 4,066 | 2.65625 | 3 | [] | no_license | import Vue from "vue";
import Vuex from "vuex";
import axios from "axios";
import { BACKEND_URI } from "../config";
Vue.use(Vuex);
export default new Vuex.Store({
state: {
token: null,
user: null,
loggedIn: false,
exercises: []
},
mutations: {
setUser(state, username) {
state.user = us... | true |
04fa6e22ca1f39dfb2a6ae6e9d339213425173bf | JavaScript | icpcbot1209/React_DriverDelivery | /src/AdminUserManage/UserList.js | UTF-8 | 2,054 | 2.5625 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
export const UserList = (props) => {
const [newUser, setNewUser] = useState({ name: "" });
const [arrUser, setArrUser] = useState([]);
useEffect(() => {
console.log("didmount");
}, []);
const handleSubmit = (event) => {
event.preventDefault();
... | true |
890140a52b8376e4f02caf4df714307bb68c8621 | JavaScript | BlazorHub/DatingApp | /DatingApp.Blazor/wwwroot/js/index.js | UTF-8 | 698 | 2.703125 | 3 | [] | no_license | function createAlert(message) {
alert(message);
}
function log(message) {
console.log(message);
}
function saveToken(token) {
localStorage.setItem("token", token);
}
function removeToken() {
localStorage.removeItem("token");
}
function getToken() {
return localStorage.getItem("token");
}
funct... | true |
ac1c4e780ed3beb07688026de7fbb7c48aa6e275 | JavaScript | MintLucky/movieSearch | /src/components/admin/EditMovieForm.js | UTF-8 | 3,126 | 2.5625 | 3 | [] | no_license | import React, { Component } from 'react';
import { connect } from 'react-redux';
import { movieActions } from "../../actions";
const mapDispatchToProps = dispatch => ({
loadMovieById: (id) =>
dispatch(movieActions.getById(id)),
updateMovie: (data) =>
dispatch(movieActions.update(data))
});
cla... | true |
5b90fb3dad725fc2e116422cb170df8aee63788d | JavaScript | furashcka/feedback.js | /test/unit/helper.form.js | UTF-8 | 2,066 | 2.5625 | 3 | [
"MIT"
] | permissive | var forEach = require( 'helper.forEach' );
var form = module.exports = {
el: null,
events: {
afterInit: function() {}
},
init: function() {
form.el = document.createElement( 'form' );
form.el.setAttribute( 'method', 'post' );
form.el.setAttribute( 'action', 'ht... | true |
fef16218dc7f27d9ada8e560ea8076c7b2bb16b1 | JavaScript | AyrFX/Telerik-Academy-2016-JavaScript-Fundamentals-Homeworks | /06. Loops/04. Lexicographically smallest/script.js | UTF-8 | 993 | 3.15625 | 3 | [] | no_license | function solve() {
var smallest = '~',
largest = '';
for (var prop in document) {
if (smallest > prop) {
smallest = prop;
}
if (largest < prop) {
largest = prop;
}
}
console.log('Smallest in Document: ' + smallest);
console.log('Largest... | true |
36675f430f4044062554d4de49620a6480650e63 | JavaScript | 6504/Dashboard-2020 | /src/components/themes.js | UTF-8 | 817 | 2.578125 | 3 | [
"MIT"
] | permissive | // Create an alias for theme-related DOM objects
ui.theme = {
select: document.getElementById('theme-select'),
link: document.getElementById('theme-link')
};
//Changes theme to match alliance (for funsies)
NetworkTables.addKeyListener('/FMSInfo/IsRedAlliance', (key, value) => {
if(value == true) {
Network... | true |
15b5c85930c1769dee3b6c863819a50ead3baa99 | JavaScript | alramdein/restful-api-nodejs-mongodb | /src/helper/helper.js | UTF-8 | 4,211 | 2.734375 | 3 | [] | no_license | import Product from '../models/product.model';
import User from '../models/user.model';
// these function was created to support easy maintainability
export const insertProductQuery = (req) => {
return {
name: req.body.name,
price: req.body.price,
weight: req.body.weight,
descripti... | true |
804a745eba9139d52ea89360b788e369d4b913ea | JavaScript | lilpacy/auto_align_app | /app/assets/javascripts/objs.js | UTF-8 | 9,222 | 2.8125 | 3 | [
"MIT"
] | permissive | $(document).on('turbolinks:load', function(){
function loadEvents(){
$('span[id="title"]').each(function(){
$(this).click(function(){ //titleをidに持つspanがクリックされたら発火
_this = this; // グローバル変数_thisにクリックされたspanを格納
if(!$(this).hasClass('on')){ // classにonを持ってなければ
$(this).addClass('on'); /... | true |
21aa3cb5672d5949aa49afacb155eedf13ff508f | JavaScript | Curvaderioou/estudo-senac-js | /conversor-temperatura-celsius.js | UTF-8 | 205 | 3.515625 | 4 | [] | no_license | var temperature = parseFloat(prompt("Digite a Temperatura em Celsius: "));
var conversion = parseFloat(((temperature * 9) / 5) + 32).toFixed(2);
console.log(`A temperatura em Fahrenheit é ${conversion}`) | true |
1afb04a8ab4e2b6e7eb0d114c7e450fe5f62e6d8 | JavaScript | bhavyathashetty/Unit_testing_mocha_chai | /unit_testing_basics/game_logic/ship_methods.js | UTF-8 | 741 | 3.078125 | 3 | [] | no_license | function checkForShip(player,cordinates){
var shipPresent,ship;
for(var i=0;i<player.ships.length;i++){
ship = player.ships[i];
shipPresent = ship.locations.filter(function(actualCordinate){
return(actualCordinate[0]===cordinates[0]&&(actualCordinate[1]===cordinates[1]))
})[... | true |
51f7367fdd66765df64b877f29b4c0e5b6e3daf1 | JavaScript | Dot-Rhs/REST-API | /index.js | UTF-8 | 938 | 2.5625 | 3 | [] | no_license | //import express
let express = require("express");
//import Body parser
let bodyParser = require("body-parser");
//Import mongoose
let mongoose = require("mongoose");
//setup the server port
let port = process.env.PORT || 8080;
//import routes
let apiRoutes = require("./routes/routes");
//initialise the app
let app = e... | true |
d85e4df05dd42bb9f19fde3e55e2ea0c2538d3d6 | JavaScript | idenhan/js-algorithms-practice | /Pre Off toy/threeFiveMultiples.js | UTF-8 | 218 | 3.375 | 3 | [] | no_license | function threeFiveMultiples(num) {
let arr = [];
for (let i = 0; i < num; i++) {
if (i % 3 === 0 || i % 5 === 0) {
arr.push(i);
}
}
return arr.reduce((acc, cur) => {
return acc + cur;
});
} | true |
7a27487c5fefa6ba6bcf65da9fbbd412d09f74a1 | JavaScript | AniKatya/Secure-App | /src/stores/UserStore.js | UTF-8 | 770 | 2.59375 | 3 | [] | no_license | import { observable, action } from "mobx";
class UserStore {
@observable currentUser = ""
@observable latitude = ""
@observable longitude = ""
@observable currentUserID = ""
@action updateUserKeys = e => this.setState({ [e.target.name]: e.target.value });
@action getLocation = async () => {
... | true |
baf3f2c1a25bc8c35d828d0c13d991757e31fbfe | JavaScript | cseiasp/fewpjs-removing-altering-and-inserting-html-lab-london-web-100719 | /index.js | UTF-8 | 175 | 2.609375 | 3 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | const main = document.getElementById("main")
main.remove()
const newHeader = document.createElement("h1")
newHeader.id = "victory"
newHeader.innerHTML= "XXX is the champion"
| true |
97e247f76c2080a85a57fa8d4e0b6158e3da3fb7 | JavaScript | dustinirving/vogi | /services/projectService.js | UTF-8 | 1,642 | 2.71875 | 3 | [] | no_license | // Require project dao
const { ProjectDao } = require('../dao')
/*
Project service extends ProjectDao to access it's methods
*/
class ProjectService extends ProjectDao {
constructor (options = {}) {
super()
this.options = options
}
// Retrieves all projects created using the method from ProjectDao
... | true |
9e1b01ef1e7cd99459d5559b189f774407561ff9 | JavaScript | trupiakapota/web-class.gr | /react/pages/Lesson.js | UTF-8 | 3,785 | 2.8125 | 3 | [
"MIT",
"CC-BY-4.0"
] | permissive | /* The bellow component render each lesson to
* container or returns NotFound page.
*/
import React from 'react';
import LessonStore from '../LessonStore';
import lessonValues from '../lessonValues';
import NotFound from '../NotFound';
export default class Lesson extends React.Component {
constructor() {
sup... | true |
a40e227a251cdd0b24c8da70546fb8f37e56299c | JavaScript | nikaz123/html123- | /fd2-DZ-6/fd2-dz6.js | UTF-8 | 7,885 | 3.375 | 3 | [] | no_license | (function () {
`use strict`;
// Создайте класс Grid, который будет автоматически строить html таблицу и автоматически отобразит её на странице.
// Конструктор должен принимать объект, в котором должны быть следующие свойства:
//
// • wrapper – элемент или селектор элемента, в который будет вста... | true |
0cfb9f65154b30f455243d89f101fc1df43338c9 | JavaScript | sziszi86/uzenofal | /public/js/main.js | UTF-8 | 1,291 | 2.84375 | 3 | [] | no_license | $(function() {
function yyyymmdd() {
var x = new Date();
var y = x.getFullYear().toString();
var m = (x.getMonth() + 1).toString();
var d = x.getDate().toString();
var h = x.getHours().toString();
var h = ("0" + h).slice(-2);
var p = x.getMinutes().toString();
var p = ("0" + p).slice(-... | true |
7d6a7ee7a1c1e5b91a939023fd1d29d92e584604 | JavaScript | cfsghost/frex.js | /examples/session/engine/session.js | UTF-8 | 947 | 2.578125 | 3 | [
"MIT"
] | permissive | "use strict";
var Session = function() {
var self = this;
};
Session.prototype.auth = function(username, password, callback) {
var self = this;
var conn = Session.frex.getConnection(arguments);
if (username == 'fred' && password == 'stacy') {
if (!conn.req.session)
conn.req.session = {};
conn.req.sessio... | true |
a4f4edab3525e8dea3e6df1d477fcfe6715e0747 | JavaScript | dproshutin/homework_58_task1 | /src/containers/WatchList/WatchList.js | UTF-8 | 2,892 | 2.71875 | 3 | [] | no_license | import React, {Component} from 'react';
import './WatchList.css';
import uuid from 'uuid/v1';
import Button from "../../components/UI/Button/Button";
import InputField from "../../components/UI/InputField/InputField";
import Movie from "../../components/Movie/Movie";
class WatchList extends Component {
state = {
... | true |
0b2740a28c44167549d012d7eb3f951994dfd61b | JavaScript | jianglianlian/webProgram-qq- | /js2/qqmusic.js | UTF-8 | 1,533 | 2.828125 | 3 | [] | no_license | window.onload=function(){
var div1=document.getElementById('div1');
var oImg=div1.getElementsByTagName('img')[0];
var oImg1=div1.getElementsByTagName('img')[1];
var spanL=document.getElementById('L');
var spanR=document.getElementById('R');
var oUl=document.getElementById('ul');
var oLi=oUl.... | true |
5af16469a11c226f921080dae16cc6a01b9e0351 | JavaScript | egerdnc/sp-blackmarket | /client/nui/assets/js/app.js | UTF-8 | 2,391 | 2.5625 | 3 | [] | no_license | $(function () {
var insert_name; var insert_ammo; var insert_price; var insert_buy; var currency; var dealer;
function display(bool, name) {
if(bool) {
$('.app').css({ "display": "flex" });
$('#shopName').append(name);
$.post("https://sp-blackmarket/rowItems", JSON.s... | true |
bb0932916c67ba011f1994f68249e1051fbdbfb0 | JavaScript | alveraboquet/Class_Runtime_Terrors | /Students/Eric/JS/Lab4/api2.js | UTF-8 | 2,042 | 3.265625 | 3 | [] | no_license |
// var dataSaver = null;
function http_get(url, success) {
let xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState === 1) {
xhttp.setRequestHeader('Authorization', 'Token token="83ff6c5e1850ac35856e1869206dd66e"')
} else if (this.readyState === 4 && thi... | true |
a3de5fff7876b1ddf0e3e3858bdbd1ec6f7640af | JavaScript | HSSSH/TestCode | /despattern/singleton.js | UTF-8 | 421 | 3.1875 | 3 | [] | no_license | // 单体模式
var Singleton = function(name){
this.name = name;
this.instance = null;
};
Singleton.prototype.getName = function(){
return this.name;
}
// 获取实例对象
function getInstance(name) {
if(!this.instance) {
this.instance = new Singleton(name);
}
return this.instance;
}
// 测试... | true |
2b147fa96d355f239e98e3bd8d450ba2efb970a6 | JavaScript | CodeupClassroom/quincy-web-exercises | /cooking.js | UTF-8 | 1,658 | 3.765625 | 4 | [] | no_license | var pasta = {
noodle: prompt("What kind of noodles would you like?"),
noodlesBoiled: false,
sauce: prompt("What kind of sauce would you like?"),
}
var meat = {
meat: confirm("Meat?"),
meatTemp: 30;
}
// heat up water, boil noodles (10 minutes)
// cook noodles (10 minutes)
function cookNoodles() {
var waterTemp;... | true |
e15ba880a82ca5a3e6d00881f7780150f9d8c8de | JavaScript | KimConcepcion/Node.js | /app2.js | UTF-8 | 1,355 | 3.9375 | 4 | [] | no_license |
/*
GLobal objects:
*/
// The console is a global object. It is part of the global scope, we can access it anywhere, in any file:
//console.log();
// Use this to call a function after a specific time/delay. Can be used in a browser and node:
//setTimeout();
// Stop the setTimeout function:
//clearTimeout();
// Ca... | true |
cb7063315709628091ba771908fc0aa4b83f7a55 | JavaScript | wismer/character-builder | /src/login.js | UTF-8 | 1,094 | 2.578125 | 3 | [] | no_license | import React from 'react';
import { login } from './adapters';
export default class Login extends React.Component {
constructor(props) {
super();
this.state = {
didError: false,
username: '',
password: ''
};
this.handleInput = (evt) => {
const { target } = evt;
const s... | true |
64b2db93a82fd80af420448fe061709fae0be88a | JavaScript | AnnaStoyano/MyFramework | /src/data/helper.js | UTF-8 | 1,191 | 3.375 | 3 | [] | no_license | export function filterCharactersByWork(characters, currentWork) {
if (currentWork == 'staff') {
return characters.filter(character => character.hogwartsStaff == true);
} else if (currentWork == 'students') {
return characters.filter(character => character.hogwartsStaff == false);
} else {
return chara... | true |
6dd4b1c5c11c4c75b5d5bb187472fd5dc69d76c2 | JavaScript | yokotak0527/js-type-is | /src/index.js | UTF-8 | 1,318 | 2.765625 | 3 | [
"MIT"
] | permissive | const jsTypes = [
'String',
'Number',
'Undefined',
'Function',
'Object',
'Symbol',
'Boolean',
'Null',
'RegExp',
'Error',
'EvalError',
'RangeError',
'ReferenceError',
'SyntaxError',
'TypeError',
'URIError',
'Math',
'Date',
'Array',
'Int8Array',
'Uint8Array',
'Uint8ClampedArray... | true |
2f46274fc2c619bb04fa4233c2ffd8b64f6737b6 | JavaScript | DexRohan/shared-node-server | /controllers/carbon.js | UTF-8 | 2,488 | 2.640625 | 3 | [
"MIT"
] | permissive | /**
* @Author: Jack Woods
* @Date: 2018-12-14T13:18:19-08:00
* @Filename: carbon.js
* @Last modified by: Jack Woods
* @Last modified time: 2019-01-15T12:50:45-08:00
* @Copyright: 2018 Oregon State University
*/
var express = require('express')
var router = express.Router()
var db = require('../ddb.js')
db.i... | true |
84c47bd95636f75d762c4ea557f0ef868cda71b4 | JavaScript | Adrian7630/Rock-Paper-Scissors-Game | /App.js | UTF-8 | 3,973 | 3.96875 | 4 | [] | no_license | let userScore = 0;
let computerScore = 0;
const userScore_span = document.getElementById("user-score");
const computerScore_span = document.getElementById("computer-score");
const scoreBoard_div = document.querySelector(".score-board");
const result_p = document.querySelector(".result > p"); // get the p from t... | true |
67d3ddedf90637bcbe471a00a3af2d1d49bd8fd1 | JavaScript | setheid/mean-calculator | /test/angular/unit-test.js | UTF-8 | 1,750 | 2.671875 | 3 | [] | no_license | const angular = require('angular');
require('./../../build/app.js');
require('angular-mocks');
// Run test with 'karma start'
describe('AppController', () => {
let $httpBackend, createController;
let apiRoute = 'https://mean-calculator.herokuapp.com/calculator';
beforeEach(angular.mock.module('App'));
before... | true |
ec4932efcce0a32fe55a9b47a0eaebc112db0167 | JavaScript | PokhodniaA/Learning-JS-Hillel | /Лекция 9-10/Homework10/EX.1/main.js | UTF-8 | 891 | 3.671875 | 4 | [] | no_license | function copy(buffer) {
this[buffer] = this.result;
return this
}
function clear() {
(this.hasOwnProperty('property')) ? this[this.property] = null :
this.result = null;
return this
}
function doFunction(func, x, y) {
(this.hasOwnProperty('property')) ? this[this.property] = func(x, y) :
... | true |
494517a8fba8ff6ae9dba38969da9712e4dadf42 | JavaScript | mahitsy/JavaScript-Fundamentals | /01. JavaScript Syntax/Lab/05. String of Numbers 1..N.js | UTF-8 | 155 | 3.671875 | 4 | [
"MIT"
] | permissive | function string(input){
let concat = ''
for (let i = 1; i <= Number(input); i++) {
concat+=i
}
console.log(concat)
}
string('11') | true |
a688b4dd8e8e6cf540aa6c02de9c66886f6adade | JavaScript | vatana7/dojo-blog | /src/useFetch.js | UTF-8 | 1,107 | 2.734375 | 3 | [] | no_license | import { useEffect, useState } from 'react';
function useFetch(url) {
const [data, setData] = useState(null);
const [isPending, setisPending] = useState(true);
const [isError, setisError] = useState(null)
useEffect(() => {
const AbortCont = new AbortController()
setTimeout(() =... | true |
8393d12f8845f0a4a631a5cdabadf7ccd6e7334d | JavaScript | ParagBadala/Furious-Fan | /BackEnd/server.js | UTF-8 | 1,801 | 2.890625 | 3 | [] | no_license | //importing libraries
var express = require('express');
var data = require('../src/assets/Data/data.json')
var parser = require('body-parser');
var fs = require('fs');
var cors = require('cors');
var exp = express();
exp.use(cors());
//Declaring Vaiables
var appendData = data;
var _getUrl = '/rest/api/get-movies';
var ... | true |
97640318f048b6a8860f75e37b55f20008c84c35 | JavaScript | Juliyo/Api-REST-Practica1 | /ApiREST/routes/estaciones.js | UTF-8 | 3,183 | 2.625 | 3 | [] | no_license | //File: routes/tvshows.js
module.exports = function (app) {
var Estaciones = require('../models/estaciones.js');
//GET - Return all tvshows in the DB
findAllEstaciones = function (req, res) {
Estaciones.find(function (err, estaciones) {
if (!err) {
console.log(... | true |
83099297fac2c11a60d09f6044436c5f5944faae | JavaScript | zohaib10/REST-Player-APP | /src/Components/Show.js | UTF-8 | 1,584 | 2.71875 | 3 | [] | no_license | import React, { Component } from 'react';
import axios from 'axios';
class Show extends Component {
state = {
players: []
};
componentDidMount() {
axios.get(`http://localhost:4000/api/players`).then(res => {
const players = res.data;
this.setState({ players });
});
}
handleDeleteEmpl... | true |
02463c82daf38706757dfa31958a52bea2c6d24c | JavaScript | VishwasMalhotra/JS-exercises-using-jQuery | /Exercise (Matching numerical values and event propogation)/script.js | UTF-8 | 279 | 2.609375 | 3 | [] | no_license | $(document).ready(function() {
$("#check").bind("click", checkInp)
function checkInp(event) {
var numberInput = $("#number").val();
var displayResult = $('#result');
displayResult.val($.isNumeric(numberInput))
event.preventDefault();
}
});
| true |
733da9926b13b55528721d828070cdaaede941bb | JavaScript | hsynlms/muteferrika | /src/index.js | UTF-8 | 10,119 | 3.125 | 3 | [
"MIT"
] | permissive | 'use strict'
const {
getShortCodeTagRegexp,
getShortCodeAttrRegexp,
escapeRegExp,
typeCast
} = require('./helpers')
/**
* Muteferrika class
*/
function Muteferrika () {
this._shortcodes = []
this._onTagRender =
function (fullMatch, finalOutput, shortcodeOutput) {
return finalOutput.replace(
... | true |
443580c242b1e131a5513b6999a84ab7ef9ec869 | JavaScript | thechenhan/frontend-nanodegree-feedreader | /jasmine/spec/feedreader.js | UTF-8 | 5,510 | 3.515625 | 4 | [] | no_license | /* feedreader.js
*
* This is the spec file that Jasmine will read and contains
* all of the tests that will be run against your application.
*/
/* We're placing all of our tests within the $() function,
* since some of these tests may require DOM elements. We want
* to ensure they don't run until the DOM is read... | true |
f03f8a9a2dc9cc83682a93efddb3f2886c16b972 | JavaScript | CrazyProgrammer12138/my-test | /04node/node-day1/node-code-block/node-day1-code/node-base/07.1.core.js | UTF-8 | 1,107 | 3.34375 | 3 | [] | no_license | //util 工具模块 核心模块/内置模块, 不需要安装直接使用
//util.inherits: 实现继承
//util.isArray, isFunction
//util.promisify 把方法转化成promise
let util = require('util')
//判断类型
//1、typeof 判断不了对象数据类型
//2、instanceof 不能判断继承后
//3、constructor
//4、Object。prototype.toString.call([]) === '[object Array]'
// console.log(util.isDate(/o/));
// 继承方式
function ... | true |
659f87f0abdee54c0432d3db216b341c00461874 | JavaScript | Adijav/codingAcademy | /server/config/mongoose.js | UTF-8 | 1,594 | 2.53125 | 3 | [] | no_license | var mongoose = require('mongoose'),
encrypt = require('../utilities/encryption'),
crypto = require('crypto');
module.exports = function(config){
mongoose.connect(config.db);
var db = mongoose.connection;
db.on('error', console.error.bind(console,'error connecting to database'));
db.once('open', function callback... | true |
0bc78eeb72bb3f9ac09f4b68f6761679edcb5a4b | JavaScript | rseniv083/advanced | /advanced_homework_№5_Seniv/task1_closure/main.js | UTF-8 | 182 | 3.40625 | 3 | [] | no_license | function sum(numb){
let number = numb;
function inner(numb){
number += numb;
console.log(number);
}
return inner
}
let fn = sum(0);
fn(2)
fn(5)
fn(7) | true |
859079871eecbb91c4d75286678ce79fd6b4fb05 | JavaScript | hyetigran/webapi-challenge | /index.js | UTF-8 | 1,282 | 2.78125 | 3 | [] | no_license | /*
play this: https://www.youtube.com/watch?v=d-diB65scQU
Sing along:
here's a little code I wrote, you might want to read it really slow, don't worry be happy
in every line there may be trouble, but if you worry you make it double, don't worry, be happy
ain't got no sense of what is REST? just concentrate on learnin... | true |
0cc5d1470df20385fac949fb70f0d8f5d08af2df | JavaScript | rahulyhg/GEMS | /js/admin/gujarati_samaj/dateutil.js | UTF-8 | 718 | 3.109375 | 3 | [
"MIT"
] | permissive | var dateTimeRenderer = function (data, type, full, meta) {
var regex = /(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/;
var arrDate = regex.exec(data);
var objDate = new Date((+arrDate[1]), (+arrDate[2]), (+arrDate[3]), (+arrDate[4]), (+arrDate[5]), (+arrDate[6]));
/* Convert the date object to string... | true |
a818130230eec5367b0a2bbf71d8716dfb2f3b47 | JavaScript | BereketYemane/MWA_AngularJs | /Assignment1/app.js | UTF-8 | 155 | 2.84375 | 3 | [] | no_license | const fibonacci = require("./fibonacci");
const fib = require("./fib")
fibonacci(30);
fibonacci(-15);
// console.log(fib(30));
// console.log(fib(-15));
| true |
91c3af2edf468eecbb6bb7a071da6109ea2f685c | JavaScript | hrasadi/auto-asaad-radio | /collaborativelistening/PublicFeedListeningLogger.js | UTF-8 | 2,597 | 2.59375 | 3 | [
"MIT"
] | permissive | const DBProvider = require('./DBProvider');
const DBObject = require('./DBObject');
const CACHE_FLUSHING_FREQUENCY = 10000; // 10 seconds
class PublicFeedListeningLogger extends DBProvider {
constructor(dbFileName) {
super(dbFileName);
this._logEntryCache = [];
}
init() {
this.in... | true |
3612b43004e41b6b961e1ba0238e9d485e28274f | JavaScript | zhuangshanshang/jswork | /work5/work5.js | UTF-8 | 858 | 3.28125 | 3 | [] | no_license | let str = '<table border="1">'
for(let a=1;a<10;++a){
str +='<tr>'
for(var b=1;b<=10;++b){
//拼接单元格
str += '<td> </td>'
}
str +='</tr>'
}
str +='<table>'
//设置div的html文档内容
document.getElementById('table').innerHTML=str
//倒九九乘法空表
str = '<table border="1">'
... | true |
84886b599b641a616c997c3e08f3af171d887588 | JavaScript | mcjazzyfunky/archived-js-surface | /src/experimental/Injector.js | UTF-8 | 659 | 2.515625 | 3 | [] | no_license | export default class Injector {
constructor() {
this.__registry = new Map();
}
bind(type, qualification = null) {
return {
to: instance => {
let subReg = this.__registry.get(type);
if (!subReg) {
subReg = new Map();
this.__registry.set(type, subReg);
}
subReg.set(qualification, in... | true |
34a03b2c3d902a4a42854b7eb5f2641e4da91b2e | JavaScript | Ilham-Nugroho/website-donutsaga-store | /public/javascripts/gmaps.js | UTF-8 | 402 | 2.796875 | 3 | [] | no_license |
function initMap() {
// Google map Your Location
const location = {
lat: -5.181757,
lng: 119.426664
};
// The map, centered at Your Location
const map = new google.maps.Map(document.getElementById("map"), {
zoom: 18,
center: location,
});
// The marker, positioned at Your Location
cons... | true |
14680a217a6f878bb749781f2cc1bedad9f1a310 | JavaScript | caffeinated-tech/react-chess | /client/scripts/pages/game/play/data/piece.js | UTF-8 | 413 | 3.03125 | 3 | [] | no_license |
class Piece {
constructor() {
this.hasMoved = false;
this.type = null;
this.color = null;
this.row = null;
this.column = null;
}
canMoveToPositions(myPosition, board){
return [];
}
setPosition(row, column){
this.row = row;
this.column = column;
}
_isOffBoard(row, column)... | true |
771172cfea9245ee3a89278a5d475a8a1f15516c | JavaScript | SevDaisy/AStar_huarongdao | /源码源工程/AutoJS脚本/web.js | UTF-8 | 4,617 | 3.1875 | 3 | [] | no_license | function getPath(num_list) {
/* 准备 api url 字符串 */
let url = "47.93.197.229:12345/cal?array=[";
/* 加一个数,加一个逗号 */
for (let i = 0; i < 8; i++) {
url += num_list[i] + ",";
}
/* 最后一个数后面不加逗号,直接补中括号 */
url += num_list[8] + "]";
/* 使用建立好的url发送get请求,将返回值保存为res */
let res = http.get(url);
/* 控制台打印 本次请求的数组... | true |
ab5ac9c16fe5e62734f88d1ecb65776bcdd33f3e | JavaScript | tonykieling/eloquenteJSBookClub | /Eloquent-JS/20-book.js | UTF-8 | 367 | 3.21875 | 3 | [] | no_license | /////////// NODE
const allTypedLine = process.argv;
console.log("you typed:")
allTypedLine.forEach((e, i) => {
if (i === 0){
console.log(`${i + 1}- this is the program to be ran (${e})`);
return;
} else if (i === 1){
console.log(`${i}- this is the file to be read/executed (${e})`);
return
}
cons... | true |
fc477aa1bd56cd318b7aa4b3676d05b42546b865 | JavaScript | nargiza-web/htx-november | /12redux/wednesday/inclass/src-3/store/reducer.js | UTF-8 | 609 | 2.78125 | 3 | [] | no_license |
import * as actionTypes from './actions/actionTypes'
const initialState = {
counter: 9999,
tasks: []
}
const reducer = (state = initialState,action) => {
switch(action.type) {
case actionTypes.INCREMENT_COUNTER: // case 'INCREMENT_COUNTER':
return {
...state,
counter: state.counter... | true |
774fad4baa10dc43255eb1d0260e29b3134291b3 | JavaScript | giusepped/vary-pixel | /public/js/angular/providers/pixelFactory.js | UTF-8 | 638 | 2.96875 | 3 | [] | no_license | homepage.factory('PixelFactory', function() {
var createPixel = function(ctx, action, x, y, size, pixelColor) {
x = Math.floor(x / size) * size;
y = Math.floor(y / size) * size;
if (action === 'erase') {
ctx.clearRect(x, y, size, size);
} else if (action === 'draw') {
ctx.fillStyle = pix... | true |
0c1f11643fa7fab90a29785c659109a13f58886d | JavaScript | wafiz/js-loop-trgel4 | /js/script.js | UTF-8 | 314 | 2.796875 | 3 | [] | no_license | var person1 = {
name : "Safa",
height : "2.20"
};
var person2 = {
name : "Diana",
height : "1.70"
};
var person3 = {
name : "dotan",
height : "1.80"
};
var persons = [];
persons.push(person1);
persons.push(person2);
persons.push(person3);
for (var i = 0; i < persons.length; i++) {
persons[i].height=175;
}; | true |
be10b90912f425fb9a52df772a4239b0fe09c835 | JavaScript | eblics/whl8 | /php_web/mobile/static/js/extract.js | UTF-8 | 1,035 | 2.5625 | 3 | [] | no_license | var extract={
init:function(){
//页面打开发生一个查询事件
$.post("/user/account",{},function(data){
alert(data);
var res =JSON.parse(data.replace(/<.*>/g, ''));
console.log(res.amount);
$(".ext-total").text(res.amount);
});
$("#ext-click").click(function(){
var value = $("#ext_value").val();
if(value... | true |
c5b01ae7f788f29780941fbf09d28152e4bdc1b8 | JavaScript | STAR-RG/entente | /seeds/test262/shell.js | UTF-8 | 108,971 | 3.1875 | 3 | [
"MIT",
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | // Copyright (C) 2017 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: |
Verify that a subArray is contained within an array.
---*/
/**
* @param {Array} array
* @param {Array} subArray
*/
function arrayContains(array, subArray) ... | true |
1cf338ef51f0f032a977fe0a5b807b7cabe0f6ce | JavaScript | GALubenov/SoftUni-Software-Engineering | /JS-fundamentals-2020/14.EXERCISE FUNCTIONS/07. NxN Matrix-Exercise.js | UTF-8 | 264 | 3.390625 | 3 | [] | no_license | function solve(input) {
let digit = Number(input)
for (let i = 0; i < digit; i++) {
let result = '';
for (let j = 0; j < digit; j++) {
result += digit + ' ';
}
console.log(result)
}
}
solve( 3) | true |
96cb3f318885b76c97f8e05c0ee03929d343216e | JavaScript | wellington1993/ember-cli-content-security-policy | /lib/utils.js | UTF-8 | 830 | 2.625 | 3 | [
"MIT"
] | permissive | /* global module */
'use strict';
var unique = function(array) {
return array.filter(function(value, index, self) {
return self.indexOf(value) === index;
});
};
var buildPolicyString = function(policyObject) {
return Object.keys(policyObject).reduce(function(memo, name) {
var value = policyObject[name];... | true |
2b8ea8aa12538fe9e8f582e858ca12aa18e090d5 | JavaScript | nuradiltursun/modal-with-html-cssand-javascript | /main.js | UTF-8 | 1,153 | 2.6875 | 3 | [] | no_license | document.querySelector('body').addEventListener('click',function(e){
if(e.target.nodeName == "BUTTON" && e.target.getAttribute('data-toggle')=='modal'){
var target_modal=document.querySelector(e.target.getAttribute('data-target'));
var target_modal_dialog=document.querySelector(e.target.getAttribute... | true |
7ff3c113fcde484510398618bfcd51d8875d16b6 | JavaScript | sigitariprasetyo/h8-p0-w4 | /exercises16.js | UTF-8 | 2,407 | 3.5625 | 4 | [] | no_license | // Graduates
function graduates (students) {
// Code disini
var obj0 = {}
if( students.length === 0){
return obj0
}
var arrFoxes = []
var arrWolves = []
var arrTigers = []
var obj = {}
for(var i = 0; i < students.length; i++){
if(students[i].class === 'foxes' && stu... | true |
3f342b9203c5fb9c9b33baaa65f95119fe191591 | JavaScript | ipadthree/Learning-Cheat-Sheet | /FEInterview21/FBE/3_flatArray.js | UTF-8 | 1,555 | 3.953125 | 4 | [] | no_license | /**
* @param { Array } arr
* @param { number } depth
* @returns { Array }
*/
function flatWithDepth(arr, depth = 1) {
const result = arr.reduce((accumulator, item) => {
if (Array.isArray(item) && depth > 0) {
accumulator.push(...flatWithDepth(item, depth - 1));
} else {
a... | true |
3b986d24f1c7e7780900fe557dba13052cbd7ce4 | JavaScript | ronashdkl/atmApp.js | /src/injector.js | UTF-8 | 1,116 | 2.546875 | 3 | [
"MIT"
] | permissive | /* eslint-disable new-cap */
/* eslint-disable no-useless-escape */
export default {
dependencies: {},
add: function (qualifier, obj) {
this.dependencies[qualifier] = obj
},
addAll: function (array) {
array.forEach(element => {
this.add(element.name, element)
})
},
get: function (func) {
... | true |
67bd12652b36e84ff0855d79d09a8737ea82ae0b | JavaScript | S-Dey/cat-clicker-knockout | /js/app.js | UTF-8 | 2,088 | 3.171875 | 3 | [] | no_license | var initialCats = [
{
clickCount: 0,
name : 'Slim',
imgSrc : 'img/cat1.jpg',
imgAttribution: 'Udacity',
nicknames: ['Skinny']
},
{
clickCount: 0,
name : 'Shady',
imgSrc : 'img/cat2.jpg',
imgAttribution: 'Udacity',
nicknames: ['S... | true |
c9a2ab1c814f55ad9b259a58fb9c3686e64052a3 | JavaScript | tomjmcnamee/js-looping-and-iteration-filter-and-map-lab-nyc-web-080519 | /index.js | UTF-8 | 730 | 3.515625 | 4 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | // Code your solution here:
function driversWithRevenueOver(obj_arr, rev_num) {
let output = obj_arr.filter( driver => driver['revenue'] > rev_num );
return output;
}
function driverNamesWithRevenueOver(obj_arr, rev_num) {
let output = obj_arr.filter( driver => driver['revenue'] > rev_num )
.map(driver => dri... | true |
5f1be639b306eba2dbc6b6643a0ca5fa4b70944d | JavaScript | boiledorange73/TokyoMapOld2020 | /app/src/main/assets/js/mapconsole.js | UTF-8 | 9,051 | 2.5625 | 3 | [] | no_license | if( window.BO == null ) {
window.BO = {};
}
/**
* (INTERNAL) Append SVG. Called by only constructor.
* Added: 2021-04-01
*/
function appendSvg(e_parent, iconname) {
var e_div= document.createElement("div");
e_div.className = "mapconsole-button-icon-wrap";
e_parent.appendChild(e_div);
var svg = BO.createIn... | true |
4aa586a08d5aa0c1af5fb9a5de0bbe5a2c15d7c5 | JavaScript | TristanAG/ecconote | /src/components/HashWordList.js | UTF-8 | 588 | 2.625 | 3 | [] | no_license | import React from 'react'
const HashWordList = ({ hashedWords }) => (
//i need to create a copy array and only transfer 5 results... the amount the user wants
// componentDidMount(){
// console.log('hello')
// }
//ok, so the hashword should render with the date added, and it should also not have the box... | true |
a51d00935aa9cafc6008c3f59d26955eec0313e5 | JavaScript | Fisherman33/kevin_videau | /src/Animeback.js | UTF-8 | 7,033 | 2.921875 | 3 | [
"MIT"
] | permissive | import React from 'react';
import './Animeback.css';
class Animeback extends React.Component {
render() {
var canvas, ctx, cw, ch;
var particles = [];
const MIN_VEL = -1,
MAX_VEL = 1,
NUM_PARTICLES = 150,
RADIUS = 1,
MIN_PARTICLE_DISTANCE = 0.06,
ISGRAYSCALE = false,
LINEWIDTH = 0.9,
F... | true |
6491cd61cbf06ea3d1e2cf8fb73f2d2f793e4c17 | JavaScript | fw6/apple-homepage | /js/animation.js | UTF-8 | 6,741 | 3.28125 | 3 | [] | no_license | /*
* Tween.js
* t: current time(当前时间)
* b: beginning value(初始值)
* c: change in value(变化量)
* d: duration(持续时间)
*/
var Tween = {
//直线运动
Linear: function (t, b, c, d) {
return c * t / d + b;
},
//二次曲线
Quad: {
easeIn: function (t, b, c, d) {
return c * (t /= d) * t + b;
},
easeOut: f... | true |
92c0520e7e39c1df977b1c15b28a55c30ce00ce8 | JavaScript | iivanov03/Softuni-JS | /js-advanced/nameLIst.js | UTF-8 | 158 | 3.015625 | 3 | [
"MIT"
] | permissive | function solve(arr){
arr.sort((a, b) => a.localeCompare(b)).forEach((n, i) => console.log(`${i + 1}.${n}`));
}
solve(["John", "Bob", "Christina", "Ema"]); | true |
e24ba131a29a9f97fd857a71ba20e9209cf83777 | JavaScript | Tomino2112/test-stock-prices | /src/hooks/useChartConfig.js | UTF-8 | 658 | 2.5625 | 3 | [] | no_license | import {useEffect, useState} from "react";
export default function useChartConfig({
chartData,
subset
}) {
const [data, setData] = useState({
data: []
});
useEffect(() => {
setData(generateData(chartData, subset));
}, [chartData, subset]);
return data;
}
function generate... | true |
afdf1d008f56dd21eab2741eecd795d6640c55f0 | JavaScript | clayton-perszyk/objects-in-space | /spec/javascripts/angular/NEO/catagory.fitler_spec.js | UTF-8 | 3,125 | 2.75 | 3 | [] | no_license | // require application.js
describe('catagoryFilter filter', function() {
var catagoryFilter, $filter, catagories, sampleData;
beforeEach(function() {
module('ObjectsInSpace');
inject(function($injector) {
$filter = $injector.get('$filter');
catagoryFilter = $filter('catagoryFilter');
});
... | true |
e38c7b400bbd0f155f9736971e80cc010ab3a44e | JavaScript | design-with-js/algorithms | /src/sort/mergeSort.js | UTF-8 | 934 | 3.515625 | 4 | [] | no_license | function sortedMerge(arrX, arrY) {
// console.log({ arrX, arrY });
let m = arrX.length;
let n = arrY.length;
let arr = Array(m + n).fill(0);
let i, j, k;
for (i = 0, j = 0, k = 0; i < m, j < n; ) {
if (arrX[i] < arrY[j]) {
arr[k] = arrX[i];
i++;
} else {
arr[k] = arrY[j];
j++... | true |
7d812d8679dbce7558c6fdc10344d599cc47064f | JavaScript | jassdv/sorting | /bubblesort.spec.js | UTF-8 | 1,186 | 3.46875 | 3 | [] | no_license | describe('Bubble Sort', function(){
beforeEach(function () {
//spyOn(window, 'swap').and.callThrough();
spyOn(window, 'compare').and.callThrough();
});
it('has methods named `bubbleSort`, `compare`, `swap`', function() {
expect(typeof bubbleSort).toBe('function');
expect(typeof compare).toBe('fu... | true |
8cfbaf9da10a819f80e35c117598332e027a1eef | JavaScript | future4code/Alice-Souza | /semana10/projeto-labex/src/components/ApplicationFormPage/ApplicationFormPage.jsx | UTF-8 | 5,032 | 2.65625 | 3 | [] | no_license | import React, {useState, useEffect} from 'react'
import axios from 'axios'
import useInput from '../../hooks/useInput';
import {useHistory} from 'react-router-dom';
import ListCountries from '../ListCountries/ListCountries';
import {Button} from './styles';
function ApplicationFormPage() {
const [viagens, setViag... | true |
6154316f2af2188019e2f845fa45c269674bb8ae | JavaScript | tylrs/turing-cafe-ui | /src/components/App/App.js | UTF-8 | 2,146 | 2.609375 | 3 | [] | no_license | import React, { Component } from 'react';
import './App.css';
import Reservations from '../Reservations/Reservations'
import ReservationForm from '../ReservationForm/ReservationForm'
class App extends Component {
constructor() {
super()
this.state = {
reservations: [],
error: ''
}
}
comp... | true |
8a35987bc2db7e28da12441c083dd3f03ea57323 | JavaScript | HemalathaMurugan/react-using-callbacks-to-pass-information-lab-houston-web-career-021819 | /src/Cell.js | UTF-8 | 749 | 2.703125 | 3 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import React, { Component } from 'react';
import { timingSafeEqual } from 'crypto';
export default class Cell extends Component {
constructor(props) {
super(props)
this.state = {
color: this.props.color
}
}
setCellColor = (inputColor) => {
//console.log('got here')
this.setState({... | true |
47e1840d5ee9ad6e978ca237554c13d5c0476b2b | JavaScript | Tseian/javascript | /nowcoder/2.二维数组查找.js | UTF-8 | 1,437 | 3.703125 | 4 | [] | no_license | /*
题目描述
在一个二维数组中(每个一维数组的长度相同),每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序。请完成一个函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数。
*/
// 暴力
// function Find(target, array) {
// let row = array[0].length;
// let col = array.length;
// for (let i = 0; i < row; i++) {
// for (let j = 0; j < col; j++) {
// if (array[... | true |
97daa72dc2cdb2178ecf3db8b6132dec8d936c79 | JavaScript | ifundefined/chrome_extension_image_information | /js/cookies.js | UTF-8 | 1,249 | 2.765625 | 3 | [] | no_license | var LGExtension = LGExtension || {};
LGExtension.Cookies = LGExtension.Cookies || {};
// Adds a cookie
LGExtension.Cookies.addCookie = function(cookie)
{
var host = cookie.host.trim();
var name = cookie.name.trim();
var protocol = "http://";
var secure = cookie.secure;
var url = null;
var v... | true |
dd8797ef703021e7ab830f494ec53054e105eb5d | JavaScript | akiokada/homebridge-oldfan | /index.js | UTF-8 | 3,240 | 2.640625 | 3 | [
"MIT"
] | permissive | var Service, Characteristic;
const gpio = require('rpi-gpio');
gpio.setMode(gpio.MODE_BCM);
module.exports = function(homebridge) {
Service = homebridge.hap.Service;
Characteristic = homebridge.hap.Characteristic;
homebridge.registerAccessory("homebridge-oldfan", "OldFan", FanAccessory);
}
function Fa... | true |
25383684a67b29536bc446c07203232750f1d512 | JavaScript | Rafael-Dyszy/JSFullCourse | /arrays/every-Some.js | UTF-8 | 390 | 4.21875 | 4 | [] | no_license | const arr = [1, , 5, 10, 'string', true];
// In every all elements need to be true!!
let onlyNumbers = arr.every((el) => {
console.log(el);
return typeof el === 'number';
});
console.log('method every ' + onlyNumbers);
// in some one of the elements need to be true
let someNumbers = arr.some((el) => {
return t... | true |
af810885843b61eec7f076fa2c25099de1de59c1 | JavaScript | DariaKatyaevaa/Frontend-Homework | /js/8/index.js | UTF-8 | 2,485 | 3.203125 | 3 | [] | no_license | const DELAY = 300;
let REQUEST_NUMBER = 0;
async function find_suggest_first() {
const text = document.getElementById('search').value;
find_suggest(text, 0);
}
async function find_suggest_second() {
const text = document.getElementById('search2').value;
find_suggest(text, 1);
}
async function fi... | true |
acead04dc4fb7bb4e4943ee3ff20ceb43d7fd385 | JavaScript | ShrSamuel/pruebahtmlcss | /js/main.js | UTF-8 | 3,673 | 2.765625 | 3 | [] | no_license | var myGamePiece;
var allowedKey = {
};
var myGameArea =
{
canvas :
document.createElement("canvas"),
start : function()
{
this.... | true |
f9e84a39e8a413721632e4ae7bb89d25ed1c9b20 | JavaScript | smitthakkar1/Channel_API | /routes/api/users.js | UTF-8 | 3,265 | 2.515625 | 3 | [] | no_license | var mongoose = require('mongoose');
var passport = require('passport');
var router = require('express').Router();
var User = mongoose.model('User');
var auth = require('../auth');
//router.use('/', require('./users'));
router.post('/users', function (req,res,next) {
var user = new User();
user.username = req.bo... | true |
aa418e4a34444609c339f1ee547e29712590ef55 | JavaScript | OliverDashiell/Bert | /src/bert/www/static/spec/util_spec.js | UTF-8 | 1,254 | 3.015625 | 3 | [] | no_license |
describe("Util", function() {
it("it diff", function() {
var a = ["dash","pete"];
var b = ["pete"]
expect(a.diff(b)).toEqual(["dash"]);
expect(b.diff(a)).toEqual([]);
});
it("it should subscribe", function(){
var array = ko.observableArray();
var a = "foo";
... | true |
309fd21cfc05648754323b2068f648f8d8e37161 | JavaScript | Guillermo-Bearzot/frontendIII-entregable | /src/components/Layout.jsx | UTF-8 | 2,572 | 2.84375 | 3 | [] | no_license | import React, {Component} from "react";
import data from "./data.json";
import Opciones from "./Opciones";
import Recordatorio from "./Recordatorio";
class Layout extends React.Component {
constructor(props){
super(props)
this.state= {
contador: 0,
seleccionAnterior: "",
... | true |
969f3c622a55c9f9d97530f55644599fbf6e4aa1 | JavaScript | supreetph/React | /src/SimpleForm.jsx | UTF-8 | 570 | 3.015625 | 3 | [] | no_license | import React, { useState } from 'react';
const SimpleForm = () => {
const [name, setName] = useState("");
const [fname, Display] = useState();
const DisplayName = () => {
Display(name);
}
const InputEvent = (event) => {
setName(event.target.value);
}
return(
<>
... | true |
727a8109d4f73897ff215d1dbd650440166a00d4 | JavaScript | LoadCode/nodejs-learning | /ajax_app_1/app.js | UTF-8 | 687 | 2.859375 | 3 | [] | no_license |
var peticion_http = null;
/*Asignación del evento click después de la carga del documento*/
window.onload = function(){
var divBoton = document.getElementById('boton');
divBoton.addEventListener('click', send_payload);
}
// Procesar respuesta
var get_response = function(){
var divTexto = document.getElementById('... | true |
0651d56098a28c16efc0fbac42bec0d343eaa27b | JavaScript | Perezented/PSF | /src/components/sub/NotFound.js | UTF-8 | 255 | 2.578125 | 3 | [
"MIT"
] | permissive | export function NotFound() {
// page for when a link is not on the domain. User gets redirected to hompepage and this message appears
return (
<h4 className="notFound">
That page was not found, here is our homepage instead.
</h4>
);
}
| true |
8e2be0524a7f66f83bfc172d967ab68f43e48f1a | JavaScript | reyespinosa3/Buzzfizz | /loop2.js | UTF-8 | 90 | 2.828125 | 3 | [] | no_license | console.log("Ready to go!");
for (i=0; i<10; i++) {
console.log("The number is " + i);
} | true |
091ea38020e233a3676dcaf83b35390268801b79 | JavaScript | J-Puls/thorium-ui-docs | /src/pages/general/customThemes.jsx | UTF-8 | 3,014 | 2.640625 | 3 | [
"MIT"
] | permissive | /* React */
import React from "react";
/* Thorium-UI */
import { Code, useCustomStyles, useTheme } from "thorium-ui";
/* Custom Components */
import { HCodeBlock, PageSection } from "components";
export const CustomThemesDetails = () => {
const theme = useTheme();
const cs = useCustomStyles();
const h2 = { ...c... | true |
e41a54a0bc782d0465c3beef48ee35e8ac828bef | JavaScript | Dev33Renan/Projeto_04 | /src/components/function.js | UTF-8 | 816 | 2.59375 | 3 | [] | no_license | import React, { useState, useEffect } from 'react';
export default function formulario() {
const [formulario, setFormulario] = useState();
const [nomeFormulario, setNomeFormulario] = userState("");
return (
<div>
<form>
<label>
Nome:
<input placeholder... | true |
491d5a93399d9ff3d602a6183faea8af2e1fdd3d | JavaScript | sofistoyanova/team-collaboration-tool | /client/src/components/CommentForm.js | UTF-8 | 1,160 | 2.578125 | 3 | [] | no_license | import React, { useState, useEffect } from 'react'
const { postMethod } = require('../helpers/request')
const CommentForm = (props) => {
const [errorMsg, setErrorMsg] = useState('')
const handleFormSubmit = async (event) => {
event.preventDefault()
const form = event.target
let formDat... | true |