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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
d7a61dcc2a3adc01a2db1b852143bdc8b1fd4c59 | JavaScript | xingwenl/node-project | /async-test/index.js | UTF-8 | 1,129 | 3 | 3 | [] | no_license | var async = require('async')
// async.series({
// test1: function(callback){
// callback(null,1);
// },
// test2: function(callback){
// callback(null,2);
// }
// },function(err, results){
// //{ test1: 1, test2: 2 }
// console.log(results)
// })
// async.parallelLimit([
// function(callback){
... | true |
3c2ad38548d7a13d33a68bb95a62289cd26e13db | JavaScript | Graleszczur/IPMOB | /task8/index.js | UTF-8 | 15,601 | 2.640625 | 3 | [] | no_license |
// In the following line, you should include the prefixes of implementations you want to test.
window.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
// DON'T use "var indexedDB = ..." if you're not in a function.
// Moreover, you may need references to some window.... | true |
396f36fe09b8d5d65ce226731690c18a0b8ec93f | JavaScript | hoaxvo16/tic-tac-toe-hook | /src/components/Moves.js | UTF-8 | 1,271 | 2.5625 | 3 | [] | no_license | import { useRef, useEffect } from 'react';
export default function Moves({ onJump, currentStep, history, isAscending }) {
const bottomRef = useRef();
const topRef = useRef();
useEffect(() => {
if (isAscending) {
bottomRef.current.scrollIntoView({ behavior: 'smooth' });
} else {
t... | true |
80fb4f03f6625b529296de83775ca53b909c063c | JavaScript | joyfullyx/testing-location | /public/js/newComment.js | UTF-8 | 1,061 | 2.9375 | 3 | [] | no_license | document.querySelector('#newCommentForm').addEventListener("submit", event => {
event.preventDefault();
const fetchObj = {
content: document.querySelector('#newComment').value,
}
fetch('/api/comments', {
method: "POST",
body: JSON.stringify(fetchObj),
header: {
... | true |
fc43399ed21d51ee1d64e2d66e2285b80d4bb8a5 | JavaScript | Marlon3DS/Curso-refatoracao-para-js-funcional | /aulas/aula01 - Como solucionar um problema/isPrime-refatorado/passo11.js | UTF-8 | 1,065 | 3.734375 | 4 | [
"MIT"
] | permissive | const NOT = ( x ) => !x
const isNot = NOT
const even = ( num ) => ( num % 2 )
const halfOf = ( num ) => Math.ceil( num / 2 )
const disibleBy = ( num ) => ( i ) => isNot( num % i )
const squareRootOf = ( num ) => Math.sqrt( num )
const isInteger = ( num ) => Number.isInteger( num )
const hasDivisor = ( num ) => {
con... | true |
f257a757f5a39f15bcd03a8ef894897fc585fbfb | JavaScript | jdmartinez1062/to-do | /src/localStorageUpdate.js | UTF-8 | 637 | 2.609375 | 3 | [
"MIT"
] | permissive | const updateLocalStorage = (element) => {
const projects = JSON.parse(localStorage.getItem('Projects'));
for (let i = 0; i < projects.length; i += 1) {
if (projects[i].id === element.id) {
projects[i] = element;
}
}
localStorage.setItem('Projects', JSON.stringify(projects));
};
const findProject =... | true |
efe33c1e7e9866a913925347a053d085337baa27 | JavaScript | drypa/ProAngular | /app/scripts/services/watchlist-service.js | UTF-8 | 3,094 | 2.5625 | 3 | [] | no_license | (function () {
'use strict';
angular.module('marketApp')
.service('WatchlistService', function () {
var watchListFieldName = 'Marker.WatchLists';
var nextIdFieldName = 'Marker.NextIds';
var _model = loadModel();
function loadModel() {
var localWl = localStorage[watchListFieldN... | true |
f98b11dd0e620aa64c0ed2eb471e63240f22a934 | JavaScript | natukinemoto/test_rip | /develop/js/BaseBallBattle.js | UTF-8 | 9,779 | 3.15625 | 3 | [] | no_license | /* ストライクorホームラン判定 */
let knock = 0;/* 0:バットを振っていない 1:バットを降った */
let strike = 0;/* ストライクカウンタ */
let hit = 0;/* ヒットカウンタ */
let ball = 0;/* ボールカウンタ */
let avoidanceS = 0;/*ストライク回避スイッチ 0:回避不能 1:回避可能*/
let avoidanceB = 0;/*ボール回避スイッチ 0:回避不能 1:回避可能*/
let ballSwitch = 0;/*ボール判定スイッチ 0:ストライク 1:ボール*/
/* メインロジック */
document.getEl... | true |
19eba96b8856c8a3376a5b8307cadbc7d8bdd5ad | JavaScript | chengHWang/CSC309_Winter2019 | /Week6/Exercise2/starting codes/e2_library.js | UTF-8 | 5,432 | 3.9375 | 4 | [] | no_license | /* E2 Library - JS */
/*-----------------------------------------------------------*/
/* Starter code - DO NOT edit the code below. */
/*-----------------------------------------------------------*/
// global counts
let numberOfBooks = 0; // total number of books
let numberOfPatrons = 0; // total number of patrons
/... | true |
0a17b4286aad0960346b0a28ec66c2279ec6edf9 | JavaScript | LucWeidell/jeopardy | /app/Controllers/PlayersController.js | UTF-8 | 1,975 | 2.953125 | 3 | [] | no_license | import { ProxyState } from "../AppState.js"
import { playersService } from "../Services/PlayersService.js"
function _drawAll(){
const players = ProxyState.players
let template = '<option selected disable>Choose a player</option>'
players.forEach(p=> template += `<option>${p.name}</option>`)
document.getEleme... | true |
18f959f46bd950459391a982fbc0bd18816662d3 | JavaScript | cs50x-tokyo/Basic-Redux-Counting-App | /index.js | UTF-8 | 1,965 | 3.5 | 4 | [] | no_license | import "./styles.css";
import { createStore } from "redux";
//what are we going to learn:
//what is redux and why to use it - redux is a container for main state in our complex app, it helping us to connect every component without repeating the code and creating complicated connection between the components
//function ... | true |
c27adff2a958a2422f28502ccb6e3609c0f624fc | JavaScript | Jinksi/netlify-cms-react-starter | /src/util/collection.js | UTF-8 | 1,365 | 2.671875 | 3 | [
"MIT"
] | permissive | import _uniq from 'lodash/uniq'
import _kebabCase from 'lodash/kebabCase'
import _values from 'lodash/values'
import _includes from 'lodash/includes'
export const getCollectionTerms = (
collection = [],
taxonomyName,
orderBy = 'asc'
) => {
// collection: array of items in a collection
// taxonomyName: taxono... | true |
01210f68b660cb27a47377dd594624109dc8d35a | JavaScript | paulogc/skip-the-dishes | /src/reducers/cousines.js | UTF-8 | 543 | 2.578125 | 3 | [] | no_license | import {
COUSINES,
COUSINES_LOADING,
COUSINES_ERROR,
} from '../constants/cousines';
const INITIAL_STATE = {
loading: false,
error: false,
cousines: [],
}
export default function cousinesReducer(state = INITIAL_STATE, action) {
switch(action.type) {
case COUSINES_LOADING:
return { ...state, lo... | true |
2ae2d6b39088ef05c023b3e90443fd60c5eba2df | JavaScript | VladimirUE4/Prison-RP | /resources/txAdmin/src/webroutes/player/actions.js | UTF-8 | 6,401 | 2.515625 | 3 | [
"CC-BY-3.0",
"MIT"
] | permissive | //Requires
const modulename = 'WebServer:PlayerActions';
const xss = require('../../extras/xss')();
const { dir, log, logOk, logWarn, logError } = require('../../extras/console')(modulename);
//Helper functions
const anyUndefined = (...args) => { return [...args].some(x => (typeof x === 'undefined')) };
const escape ... | true |
6056c80eb5b28e39c46a570ab8c89fa7587b41ee | JavaScript | coderofsiliconvalley/mern-devconnector-120 | /validation/post.js | UTF-8 | 1,101 | 3.015625 | 3 | [] | no_license | /*
POSTS FORM VALIDATION
*/
const Validator = require("validator");
const isEmpty = require("./is-empty");
// NOTE: All validation is string-based
module.exports = validatePostInput = data => {
let errors = {};
// Convert empty object properties to empty string, and
// Gracefully error out in case form is not s... | true |
337a701e966265e18d0e91b4fda685a51135ff8f | JavaScript | Tsarpf/Tsatter | /nodeapp/environment/server/imageProcessWorker.js | UTF-8 | 6,108 | 2.609375 | 3 | [] | no_license | /**
* Created by tsarpf on 4/6/15.
*/
var mkdirp = require('mkdirp');
var imageTooBig = 'image-too-big.png';
//TODO: read from environment variable
var imagesPath = __dirname + '/../dist/images/';
var gm = require('gm');
var fs = require('fs');
var request = require('request');
mkdirp(imagesPath);
var fileTypes... | true |
43b19af57d90d5cfd46efae7acaca2690a8c0f62 | JavaScript | suederade/post-parcel | /server/config/mongoose.js | UTF-8 | 898 | 2.5625 | 3 | [] | no_license | var mongoose = require('mongoose');
module.exports = function(config){
// Set up the connection to mongodb, check for errors, and if open
// log out that the connection to the db was opened.
mongoose.connect(config.db);
var db = mongoose.connection;
db.on('error', console.error.bind(console, 'connection error...'... | true |
494ce8462cc8fc02c693c7d54b3c63781d72b32d | JavaScript | TitarenkoBA/JavaScript_level_2_lesson_4 | /js/js-1,2.js | UTF-8 | 489 | 3.421875 | 3 | [] | no_license | const correction = (string) => {
let value = string.replace(/'/gi,'"');
let str = value.match(/\S+"\S+/gi);
for (let i = 0; i < str.length; i++) {
str[i] = str[i].replace(/"/gi,"'");
value = value.replace(/\S+"\S+/gi,str[i]);
}
return value;
};
document.querySelector('.for... | true |
a959bec2baf62167d18880d81e51711eddf27f81 | JavaScript | robschroeder333/fileConverter | /renderer.js | UTF-8 | 880 | 2.984375 | 3 | [
"LicenseRef-scancode-public-domain",
"CC0-1.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | // This file is required by the index.html file and will
// be executed in the renderer process for that window.
// All of the Node.js APIs are available in this process.
const fs = require('fs');
const form = document.createElement('form');
const upload = document.createElement('input');
upload.type = "file";
uploa... | true |
08855e00f5afdc79d46b36932e0b1c975b131d84 | JavaScript | jfairbank/bundle-with-webpack-talk | /public/examples/getting-started/modules/log.js | UTF-8 | 709 | 2.921875 | 3 | [
"MIT"
] | permissive | module.exports = function createLogger(mount) {
const buffer = [];
const container = document.createElement('pre');
mount.innerHTML = '';
mount.appendChild(container);
function checkBuffer() {
if (buffer.length > 0) {
const line = buffer[0];
const child = document.createTextNode(line[0]);
... | true |
8f6ef89f50f3b18c5191fa07d7f97b6a557398eb | JavaScript | jesperzach/mws-restaurant-stage-1 | /js/main.js | UTF-8 | 6,481 | 2.78125 | 3 | [] | no_license | let restaurants,
neighborhoods,
cuisines
var map
var markers = []
/**
* Fetch neighborhoods and cuisines as soon as the page is loaded.
*/
document.addEventListener('DOMContentLoaded', (event) => {
fetchNeighborhoods();
fetchCuisines();
});
/**
* Fetch all neighborhoods and set their HTML.
... | true |
9b298d60c125d206fd4dc119cab9541e9f87ba51 | JavaScript | DOrgizo/lectormanga-scraping | /main.js | UTF-8 | 1,542 | 2.78125 | 3 | [] | no_license | const got = require('got')
const cheerio = require('cheerio')
const fs = require('fs')
const json = fs.readFileSync('./Info.json')
const gayInfo = JSON.parse(json)
const length = gayInfo.length
let lastIndex = 0
let arrayInfo = []
let i = 0//parseInt(fs.readFileSync('./lastIndex.txt'))
class gayMangaInfo... | true |
99f7712a602ccb3289cbc474ead48d4c7d83d6e2 | JavaScript | zhaoyanglin/solo-project-basketball-app | /public/navBar.js | UTF-8 | 713 | 2.59375 | 3 | [] | no_license | $(document).ready(function () {
let tabs = $('.tabs');
let items = $('.tabs').find('a').length;
let selector = $(".tabs").find(".selector");
let activeItem = tabs.find('.active');
let activeWidth = activeItem.innerWidth();
$(".selector").css({
"left": activeItem.position.left + "px",
... | true |
cea14f72d3a6584e8ed2351eac9b612e013dd425 | JavaScript | hsk9210/portfolio | /learning javascript/stringfyjson.js | UTF-8 | 2,405 | 3.703125 | 4 | [] | no_license | var stringifyJSON = function (obj) {
// 재귀함수로 사용하기 위해 반복되는 데이터 타입 확인
if (typeof obj === 'number' || obj === null || typeof obj === 'boolean') {
return "" + obj;
} else if (typeof obj === 'string') {
return '“' + obj + '“';
}
var bin = [];
if (Array.isArray(obj)) {
if (obj... | true |
b8df28744b1664acd8d8c30d4022e7319e11357e | JavaScript | lmlevine/VA-dashboard | /src/lib/redux/reducers/app.js | UTF-8 | 518 | 2.734375 | 3 | [] | no_license | const initialState = {
UID: "",
userData: {}
}
const appReducer = (state = initialState, action) => {
switch (action.type) {
case "ADD_UID":
localStorage.setItem('uid', action.UID)
return Object.assign({}, state, {
UID: action.UID
})
case... | true |
12fed719d64d57ca2539edf2dcc21aadd70423d5 | JavaScript | JamesAkritidis/movie-api-frontend | /src/hooks/useUsersFetch.js | UTF-8 | 582 | 2.609375 | 3 | [] | no_license | import { useState, useEffect } from "react";
import axios from "axios";
import API_ROOT from "../utils/constants"
function useUsersFetch() {
const [users, setUsers] = useState([]);
useEffect(() => {
axios
.get(`https://movie-picker-backend.herokuapp.com/users`) //this url returns a Json ob... | true |
e3a63ee010e874975a725d191f4c8241fd5822eb | JavaScript | hatsu38/taskleaf | /frontend/src/Containers/TasksContainer.jsx | UTF-8 | 5,988 | 2.609375 | 3 | [] | no_license | import React, { useState, useEffect, createContext } from 'react';
import { useParams } from 'react-router-dom';
import Task from 'Models/Task';
import Tag from 'Models/Tag';
import { TaskPage } from 'Components/Pages/TasksPage/TaskPage/TaskPage';
import { TasksPage } from 'Components/Pages/TasksPage/TasksPage';
expor... | true |
807259276706b2b2682a53c8c39cfd0988fa16b9 | JavaScript | alyssamanse/Hangman-Game | /assets/javascript/game.js | UTF-8 | 5,401 | 3.734375 | 4 | [] | no_license |
// Get Elements
var score = document.getElementById("wins");
var currentWord = document.getElementById("currentWord");
var guessesRemaining = document.getElementById("guessesRemaining");
var lettersGuessed = document.getElementById("lettersGuessed");
var answerText = document.getElementById("answerText");
var ... | true |
27d5aef9fbb19af4b95c1fe965da95af9b3b29fb | JavaScript | dkutelov/treehouse-frontend-degree | /11_performance_optimisation/public/js/scripts.js | UTF-8 | 410 | 2.765625 | 3 | [] | no_license | var $tumbs = $(".image a img");
var $popUpImg = $(".pop-up");
$tumbs.on('click', function(){
// getting clicked tumb url and modifying to large image url by cutting 'tumb'
var $tumbUrl = $(this).attr('src');
var largeImgUrl = $tumbUrl.slice(0,-8) + '.jpg';
// get index of clicked element
var index = $tumbs.index(... | true |
79aaa79b7e15440a37723e9dac4cd3b90a7a28ae | JavaScript | KonstantinPererva/box-bonus | /app/js/containerDetail.js | UTF-8 | 6,475 | 2.609375 | 3 | [
"MIT"
] | permissive | function ContainerDetail(node) {
var self = this;
self.node = node || null;
self.contentDetail = self.node.querySelector('[data-content="detail__content"]') || null;
self.gallery = self.node.querySelector('[data-popup]') || null;
self.substrateGallery = self.node.querySelector('[data-substrate-gall... | true |
04c7963e6e8221240856ed2eea3ef57398855f0d | JavaScript | JesterXL/react-redux-async-types | /src/caloriesReducer.js | UTF-8 | 1,884 | 2.921875 | 3 | [] | no_license | import { find, reject, reduce } from 'lodash/fp'
export const ADD_FOOD = 'ADD_FOOD'
export const REMOVE_FOOD = 'REMOVE_FOOD'
export const addFood = food =>
({ type: ADD_FOOD, food })
export const removeFood = food =>
({ type: REMOVE_FOOD, food })
const findFood = foodID =>
find(
food => food.id ... | true |
0b3c56a25a61e915307d946fb9d297d5215214b2 | JavaScript | kubawolanin/cypress | /packages/driver/test/cypress/integration/dom/visibility_spec.js | UTF-8 | 40,840 | 2.5625 | 3 | [
"MIT"
] | permissive | const $dom = Cypress.dom
const $ = Cypress.$.bind(Cypress)
describe('src/cypress/dom/visibility', () => {
beforeEach(() => {
cy.visit('/fixtures/generic.html')
})
context('isHidden', () => {
it('exposes isHidden', () => {
expect($dom.isHidden).to.be.a('function')
})
it('throws when not pa... | true |
adfeb82b598a7e85e7de902c3008b18dbec13a98 | JavaScript | sushant23/redux-html | /app.js | UTF-8 | 907 | 3.296875 | 3 | [] | no_license | const INCREMENT = 'increment';
const DECREMENT = 'decrement';
const reducer = (state = {count: 0}, action) => {
switch(action.type){
case INCREMENT:
return {...state, count: state.count + 1};
case DECREMENT:
return {...state, count: state.count - 1};
default:
... | true |
dfa5e2dce5d301efd3e8fec36177284b51c4757e | JavaScript | Mahmoud-Nabuwi/landing-webpage | /js/app.js | UTF-8 | 2,562 | 3.390625 | 3 | [] | no_license | /**
*
* Manipulating the DOM exercise.
* Exercise programmatically builds navigation,
* scrolls to anchors from navigation,
* and highlights section in viewport upon scrolling.
*
* Dependencies: None
*
* JS Version: ES2015/ES6
*
* JS Standard: ESlint
*
*/
/**
* Define Global Variables
*
*/
const navBar =... | true |
16a32bd1c60cbb2d4baf043eeb9946546222ffcf | JavaScript | JonasDreessen/dashboard-preventions-react | /src/redux/NavigationBarColor/NavigationBarColor.js | UTF-8 | 715 | 2.625 | 3 | [] | no_license | // -- actions -- //
export const changeNavigationBarGray = () => {
return {
type: 'gray'
}
}
export const changeNavigationBarLightGray = () => {
return {
type: 'lightgray'
}
}
// -- reducer -- //
const ChangeNavigationBarColor = (state = {color: '#2b2b2b', textcolor: '#c8c8c8'}, action) ... | true |
6b29c20966087e36751f21c5fd0d20efd4365917 | JavaScript | amberjohnsonsmile/five-a-day | /old/old.js | UTF-8 | 1,256 | 3.421875 | 3 | [
"MIT",
"LicenseRef-scancode-public-domain"
] | permissive | // Five-a-day fruit and vegetable counter using JavaScript and jQuery
// Initial setup: whiteboard with counter on side
// Get today's date and format it
var today = new Date();
var dd = today.getDate();
// January is 0
var mm = today.getMonth() + 1;
var yyyy = today.getFullYear();
if (dd < 10) {
dd = '0' + dd;
}
... | true |
60ba7827bf47cee96d704657a92b8cd2c06c3ea4 | JavaScript | anademetrio/bluecore | /src/pages/home.js | UTF-8 | 954 | 2.53125 | 3 | [] | no_license | import React, { Component } from 'react';
import Page1 from '../components/page1_component';
import Page2 from '../components/page2_component';
export default class Home extends Component {
constructor(props) {
super(props);
this.state = {
display_page_1: true
}
}
prevPa... | true |
32d45f08dd07baf9f8f927ef54e4adf3f80eb4bd | JavaScript | Huhspaniel/store-app | /public/js/app.js | UTF-8 | 624 | 2.703125 | 3 | [] | no_license | function toggleHidden(selector) {
document.querySelector(selector).classList.toggle('hidden');
}
switch (window.location.pathname) {
case '/': {
renderHomePage();
break;
}
case '/product': {
const urlParams = new URLSearchParams(window.location.search);
const query = {
... | true |
cfc55218a639814711e6068045026c1a7e2bf9f4 | JavaScript | maryambabalola/DMS-FULLSTACK | /server/controllers/role.controllers.js | UTF-8 | 3,780 | 2.890625 | 3 | [
"MIT"
] | permissive | (function() {
'Use strict';
var Role = require('./../models/role.models');
/**
* [function to create a role]
* @param {[http request object]} req [used to get the request query]
* @param {[http response object]} res [used to respond back to client ]
* @return {[json]} [success message that rol... | true |
0973ad3c189172b12ad424fd4cc3f995b60d73ea | JavaScript | NoeliaChicharro/javaScriptModule | /javaScript/week4/day1/DOM/code.js | UTF-8 | 938 | 3.578125 | 4 | [] | no_license | /** ID SELECTION **/
const idSelection = document.getElementById('title');
// this will count as an attribute (so keep the hyrarchy in mind)
idSelection.style.color = 'pink';
/** CLASS SELECTOR **/
const classSelection = document.getElementsByClassName('listItem');
console.log(classSelection);
for (let i = 0; i < cl... | true |
fdb99b96bef92f402ba3d014704668ff192675c6 | JavaScript | wanglihuaya/web | /systematic/Miss_Zhang_Vue/WangJiawei_day016/dist/index_base.js | UTF-8 | 361 | 3.25 | 3 | [] | no_license | "use strict";
let num = 100;
num = 500;
console.log('数量:', num);
let msg = 'OKKKKKK';
msg = 'FINEEEEEEEE';
let flag = false;
flag = true;
console.log(msg, flag);
let obj = {
name: 'Name',
age: '1000',
};
console.log(obj);
let arr = [];
let arr1 = ['1', '2', '3', '4'];
console.log(arr, arr1);
let num1;
console.l... | true |
74a5f83c96da8c75b130e7b72529950c712a8b20 | JavaScript | jordan-ashbacher/edabit | /the-frugal-gentleman/app.js | UTF-8 | 632 | 3.984375 | 4 | [] | no_license | // The Frugal Gentleman
let wines = ([
{ name: "Wine A", price: 8.99 },
{ name: "Wine 32", price: 13.99 },
{ name: "Wine 9", price: 10.99 }
])
const sortWine = (wine) => {
return wine.sort((a, b) => {
if (a.price > b.price) {
return -1;
} else if (a.price < b.price) {
... | true |
725bb378126d87b55690a25ce2bf374f85e6d8f3 | JavaScript | PashaShevchuk/Node | /lesson_3_router_contrl_mdlw/middlewares/car.middleware.js | UTF-8 | 564 | 2.59375 | 3 | [] | no_license | module.exports = {
checkCarValidity: (req, res, next) => {
try {
const car = req.body;
if (!car.producer || !car.model || !car.year) {
throw new Error('Please enter all required details');
}
if (+car.year < 1885 || +car.year > new Date().getFul... | true |
6c3e89e58bfa525969f60a44759f5f0d13474a5c | JavaScript | 4jonathanfoster/readMe-Generator | /index.js | UTF-8 | 1,821 | 3.171875 | 3 | [
"MIT"
] | permissive | // TODO: Include packages needed for this application
const inquirer = require('inquirer');
const fs = require('fs');
const generateMarkdown = require("./utils/generateMarkdown");
// TODO: Create an array of questions for user input
const questionsAsked = [{
type: 'input',
message: "Whats your project'... | true |
29d77093f2983615f01bed9f52d2d5eba2778020 | JavaScript | andysarbini/new_hris | /web/cms/plugin/cuti_old/js/admin.js | UTF-8 | 1,507 | 2.515625 | 3 | [
"MIT"
] | permissive | $(document).ready(function(){
load_list_cuti();
$("#status").change(function(){ load_list_cuti(); });
$("#year").change(function(){ load_list_cuti(); });
});
function load_list_cuti(){
var status = $("#status").val();
var year = $("#year").val();
$.post(base_url()+"cuti/admin/listcuti", {"status":status, "y... | true |
982feaac872fc604c4b4732f2a0945bf9b485671 | JavaScript | alikhundmiri/everything | /nasa_apis/free_images/index.js | UTF-8 | 561 | 3.25 | 3 | [] | no_license | const api_request = "https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY";
/* API REQUESTS*/
fetch(api_request)
.then(resp => resp.json())
.then(function(data){
/* FETCH THE JSON DATA*/
let image_title = data.title;
let image_url = data.url;
let image_explain = data.explanation;
/* CHANGE THE TITLE, BACKGROUND ... | true |
66d95100371e744b66fada3cb87683b608c762d0 | JavaScript | deepraining/see-fetch | /src/util.js | UTF-8 | 1,037 | 2.953125 | 3 | [
"MIT"
] | permissive | /**
* {a: 1, b: 2} => a=1&b=2
*
* @param params
* @returns {string}
*/
export const makeSearch = params => {
if (!params) return '';
const search = [];
Object.keys(params).forEach(key => {
search.push(
`${key}=${typeof params[key] === 'undefined' ? '' : params[key]}`
);
});
return search... | true |
7f6f13da5e81dc24ad6c0b569a9baea4450ac742 | JavaScript | lincond/cs-2018 | /topico-5/day.js | UTF-8 | 1,516 | 3.71875 | 4 | [] | no_license | /**
* Calcula o dia da semana de determinada data
* @class Utilitário para cálculo do dia da semana de terminada data
*/
export class Day {
/**
* Retorna o dia da semana para a data informada via parâmetro, sendo
* 0 para Segunda-Feira, 1 para Terça-Feira e assim sucessivamente
* @param {number} d... | true |
13435575a4b18694e89bbd98b6bb9d4a897d2c4f | JavaScript | miniyomi1/90secGame | /js/index.js | UTF-8 | 1,647 | 2.78125 | 3 | [] | no_license | const w = 800;
const h = 450;
//config內是phaser遊戲內的基礎設定
const gameStart = {
key: 'gameStart',
preload: function(){
//場景初始化,需要載入的資源都在這邊載入
this.load.image('bg1','../images/bg/bg1.png');
this.load.image('bg2','../images/bg/bg2.png');
this.load.image('bg3','../images/bg/bg3.png');
... | true |
76fb33d5d4f0be1b577626520fc3700b2fa0dd8a | JavaScript | michfit/lex | /src/views/Team.js | UTF-8 | 3,783 | 2.8125 | 3 | [] | no_license | import React, { Component } from 'react';
import { Col, Container, Row } from 'reactstrap';
import TeamMember from './TeamMember'
import maria from '../img/kiejnich.png'
import sean from '../img/langley.png'
import julian from '../img/rice.jpg'
import michelle from '../img/su.jpg'
import rishab from '../img/sukumar.png... | true |
c4f69bc81519165d0487f71c08a7470ee4a6cfb6 | JavaScript | dhlevi/Quetify | /cli/lib/emptyQueue.js | UTF-8 | 2,874 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | const MongoClient = require('mongodb').MongoClient;
const chalk = require('chalk');
const log = console.log;
/**
* These utilty functions will flush data from your queues.
* By defualt, Quetify doesn't delete documents, it just
* sets the status. If you want to clear out old messages
* you can use th... | true |
d3a9b0d3daa01ad8cc8ec849a7853d2880a85edb | JavaScript | tudormaerean/tic-tac-toe | /src/web/classes/Game.js | UTF-8 | 1,692 | 2.9375 | 3 | [] | no_license | var Cell = require('./Cell');
var template = require('../utils/template');
var constants = require('../utils/constants');
function Game(game, socketController, player) {
this.whosTurnIsIt = game.currentTurn.name;
this.player = player;
this.game = game;
this.socketController = socketController;
this.gameDiv =... | true |
f2ffb1316dbc09eb1e616fec138ece3f788f464d | JavaScript | isaacmillercodes/Intro-to-JS | /js-loops.js | UTF-8 | 1,208 | 3.71875 | 4 | [] | no_license | //Problem 1
for (var i = 0; i <= 1000; i += 100) {
console.log(i);
}
//Problem 2
for (var i = 1; i <= 128; i *= 2) {
console.log(i);
}
//Problem 3
for (var i = 0; i <= 10; i += 2) {
console.log(i);
}
//Problem 4
for (var i = 3; i <= 15; i += 3) {
console.log(i);
}
//Problem 5
for (var i = 9; i >= 0; i--) {
co... | true |
01bbaa2bab4a9199165e0f56db909e49d8db9067 | JavaScript | jyannielli/ps-campus | /public/debug-log.js | UTF-8 | 1,549 | 3.140625 | 3 | [] | no_license | var msgCount = 0;
function SendMsgToServer(msg) {
$.ajax({
type: "POST",
url: "/log",
data: msg,
contentType: "text/plain"
});
}
function OverwriteConsoleFunctions() {
var sessionID = Math.floor(Math.random() * 1000);
// Save old functions
var oldLog = console.log;... | true |
544ee867e39a32e487afeec363fe91f9dfd5503b | JavaScript | DiegoGabo/TUM_Mobility_Services | /src/src/app/components/VehiclePanel.js | UTF-8 | 1,423 | 2.5625 | 3 | [] | no_license | /*Component in which there are the information about acceleration and pre-emptive driving*/
import React from 'react';
import '../css/contentPanel.css';
import '../css/vehiclePanel.css';
export class VehiclePanel extends React.Component {
constructor(props)
{
super(props)
this.handleClick = this.handleCl... | true |
d89f06c167437467d35a97613016f3c5bf18bc0f | JavaScript | alexandershubin/drag-n-drop | /source/js/script.js | UTF-8 | 3,221 | 3.125 | 3 | [] | no_license | 'use strict';
const initSlider = () => {
const button = document.querySelector('.main__button');
const mainViewport = document.querySelector('.main');
const overlay = document.querySelector('.overlay');
const onMouseDown = (evt) => {
// координаты курсора мыши на момент начала события
const startCoords... | true |
1ce806a2fb5e33eb5a79afb7599b0cb82510558b | JavaScript | aroblesgalit/artist-web-app | /client/src/utils/ItemContext.js | UTF-8 | 8,817 | 2.890625 | 3 | [] | no_license | import React, { Component } from "react";
import API from "./API";
const ItemContext = React.createContext();
// Provider
class ItemProvider extends Component {
state = {
items: [],
cart: [],
cartSubtotal: 0,
cartShipping: 4,
cartTotal: 0,
cartCount: 0,
ale... | true |
6d65f9f9e8eaac92535d27a1833f0378b6fb63e0 | JavaScript | TonyProjects/moto-auction | /available/js/select.js | UTF-8 | 1,420 | 2.640625 | 3 | [] | no_license | jQuery(document).ready( function($) {
var
logics_select_item = function(el) {
var item = (el instanceof jQuery) ? el : jQuery(el.currentTarget),
select = item.parent().parent(),
value = select.children("input[type=hidden]");
value.val(item.attr("data-value"));
select.attr("data-current", item.attr... | true |
b415fc7159b201ce1efb8215659d4cf2a8f2ea96 | JavaScript | Alex-Windle/React-Contact-List | /src/js/single_view.js | UTF-8 | 1,259 | 2.515625 | 3 | [] | no_license | import React, { Component, PropTypes } from 'react';
import ReactDOM from 'react-dom';
import data from './data';
//build a list view component
export default class SingleView extends Component {
static propTypes = {
user: PropTypes.shape ({
name: PropTypes.string.isRequired,
email: PropTypes.string.isRequired... | true |
b3b4db45f615462b9f6ed3e44d4f8c9521f40bb9 | JavaScript | beming-dev/Interactive-develop | /c_collision/collisionM.js | UTF-8 | 1,686 | 3.03125 | 3 | [] | no_license | import { Rectangle } from "./rectangle.js";
import { Circle } from "./circle.js";
class Collision {
constructor() {
this.canvas = document.createElement("canvas");
document.body.appendChild(this.canvas);
this.ctx = this.canvas.getContext("2d");
this.pixelRatio = window.devicePixelRatio > 1 ? 2 : 1;
... | true |
85d4ba94b6fa4edaf5080cf77685ec4f26f7c5be | JavaScript | shevdrakon/gss-challenge | /src/client/utils/generate-day-range.js | UTF-8 | 422 | 2.890625 | 3 | [] | no_license | import moment from "moment";
const generateDayRange = (data) => {
if (!data) throw new Error(`Passed data arg has to be specified.`);
const startDate = moment(data);
if (!startDate.isValid()) throw new Error(`Passed data arg not a date.`);
return new Array(7)
.fill(null)
.map((v, index) => moment(sta... | true |
d87889d8074f594bd9f779d10c2fabd0d874ca4a | JavaScript | DragonDC/TSW_Damian_Centek | /public/js/skrypt.js | UTF-8 | 22,398 | 2.53125 | 3 | [] | no_license | /* jshint browser: true, globalstrict: true, devel: true */
/* global io: false */
"use strict";
$( window ).load( function (event) {
var status = $("#status");
var open = $("#open");
var close = $("#close");
var send = $("#send");
var text = $("#text");
var message = $("#message");
var soc... | true |
1dacd996165198f6893d1283506cf6e8bedc4f16 | JavaScript | riinaalisah/ExerciseDiary | /exercisediary/src/reducers/workoutReducer.js | UTF-8 | 978 | 2.5625 | 3 | [] | no_license | import workoutService from '../services/workouts'
const workoutReducer = (state = [], action) => {
switch(action.type) {
case 'INIT_WORKOUTS':
state = action.data
return state
case 'NEW_WORKOUT':
return state.concat(action.data)
case 'DELETE_WORKOUT':
return state
default:
... | true |
7c2a398f2c11d911f6fb43f2564edf04da3ed52a | JavaScript | ioana01/Paid-parking | /paid_parking/src/components/Spots/Spots.js | UTF-8 | 2,403 | 2.703125 | 3 | [] | no_license | import React, { Component } from 'react';
import './Spots.css'
class Spots extends Component {
constructor(props) {
super(props);
this.state = {
checked: false,
lastChecked: ""
}
this.selectSpot = this.selectSpot.bind(this);
}
selectSpot(e) {
... | true |
ee3fd4c997f77b28ffe53f6217d9251da351550c | JavaScript | mako-2021/EasyPet | /server/routes/events.test.js | UTF-8 | 1,798 | 2.625 | 3 | [] | no_license | const request = require('supertest')
const server = require('../server')
const { getAllEvents, addNewEvent } = require('../db/db')
jest.mock('../db/db')
describe('GET api/v1/events', () => {
test('event route', () => {
const fakeEvent = [1, 'Vet', 'Appointment']
getAllEvents.mockImplementation(() => {
... | true |
9ef7dfb3d90c1ea530fc34df144ef8c292574ac8 | JavaScript | xldrkp/gitbook | /lib/output/website/themeLoader.js | UTF-8 | 2,751 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | var _ = require('lodash');
var fs = require('fs');
var path = require('path');
var nunjucks = require('nunjucks');
/*
Nunjucks loader similar to FileSystemLoader, but avoid infinite looping
*/
/*
Return true if a filename is relative.
*/
function isRelative(filename) {
return (filename.indexOf('./') === 0... | true |
aea28023e252127072368b6f1d95ae9cc3a07f8c | JavaScript | BeMoreHuman/learnjs | /section_4/call-apply.js | UTF-8 | 1,500 | 4.25 | 4 | [] | no_license | // Task #1: Перепишите суммирование аргументов
// Есть функция sum, которая суммирует все элементы массива:
// function sum(arr) {
// return arr.reduce(function(a, b) {
// return a + b;
// });
// }
// alert( sum([1, 2, 3]) ); // 6 (=1+2+3)
// Создайте аналогичную функцию sumArgs(), которая будет суммировать вс... | true |
a572192b69517aa101eee778662724a4305d3244 | JavaScript | ziel/whoishiring | /test/test_whoshiring.js | UTF-8 | 3,920 | 2.671875 | 3 | [
"MIT"
] | permissive | 'use strict'
/* eslint-env node, mocha */
const expect = require('chai').expect
const Sinon = require('sinon')
const WhosHiring = require('../lib/whoshiring')
const HNSearch = require('hacker-news-api')
describe('WhosHiring', function () {
// -------------------------------------------------------------
// Fixtur... | true |
02fd5b07509180e7060e33ef44864aa36dbd8882 | JavaScript | KevenLYF/Shopify_Challenge | /online-marketplace-api/customer/customer.js | UTF-8 | 4,456 | 3.15625 | 3 | [] | no_license | const SUCCESS = 'success';
const fs = require('fs');
var shop = (action, name, quantity) => {
if (action === 'select') {
if (name === undefined) {
return 'Please specify item name!\n';
}
let cart = fetchCart();
let productsInfo = fetchProducts();
let product = productsInfo.find((p) => p.t... | true |
7865fcee642f63a88b4d36a937b040d4e0f2de42 | JavaScript | shvedbook/mearvevim | /jScripts/JavaScript.js | UTF-8 | 5,958 | 2.6875 | 3 | [
"MIT"
] | permissive |
//counter for big json object
var jsoncounter = 0
//big json object
var data = 0;
$(document).ready(function () {
var x = window.matchMedia("(max-width: 768px)")
JSbysize(x) // Call listener function at run time
x.addListener(JSbysize) // Attach listener function on state changes
... | true |
d6b9fd8887ccb5eeb495a560ba72cd67c14275c6 | JavaScript | chuyouchia/filmoculus | /test-frontend/index.js | UTF-8 | 242 | 2.8125 | 3 | [] | no_license | const canvas = document.querySelector('canvas')
const c = canvas.getContext('2d')
canvas.width = window.innerWidth
canvas.height = window.innerHeight
console.log(canvas)
window.addEventListener('click', () => {
console.log('clicked')
}) | true |
c6f8927bf9cdd4fd1c2c9b2ce5aac47b54bd61b2 | JavaScript | VaD1ke-edu/learn-js | /dom/deposit-calculator.js | UTF-8 | 3,530 | 3.390625 | 3 | [] | no_license | // http://learn.javascript.ru/task/calculate-capitalization
class DepositCalculator {
constructor(form, info, selectors, yearPercent = 12) {
this.MONTH_INCREASE_STEP = parseFloat(yearPercent) / 12 / 100;
this.form = form;
this.info = info;
this.moneyInput = this.form.querySelecto... | true |
34660610d0e98132c4eb1e0be518093f41d0e5ee | JavaScript | scrapcupcake/hexs6 | /src/hexs6.js | UTF-8 | 5,631 | 3.40625 | 3 | [
"MIT"
] | permissive | /**
* Hexs6
* Updated and Curated by Hunnie Tana
* Based on excellent documentation and Generated Code -- http://www.redblobgames.com/grids/hexagons/
*/
/**
* Named generator for the expected hex javascript object, which holds a hex's co-ors in cubed format
* These serve as both coordinate and vector in the hex ... | true |
33d768ee53d2fbf1283efe73a47d4c23da484647 | JavaScript | mylesz123/react-form-validation | /src/Components/BasicInfo.js | UTF-8 | 2,668 | 2.546875 | 3 | [] | no_license | import React from 'react';
export default function BasicInfo({
state, nextStep, setStateValidation,
handleChange
}) {
const { name, email, jobRole, validationErrors } = state;
function isValidEmail(email) {
const valid = /^[^@]+@[^@.]+\.[a-z]+$/i.test(email) && email !== '';
retu... | true |
d14ab11365c707f3ad5beb37bff4ebb6ddb58f5a | JavaScript | maxnetish/jellyblog | /src/utils-data/apply-check-permissions.js | UTF-8 | 1,187 | 2.8125 | 3 | [] | no_license | /**
* check permission for resource methods
* @param rpcCall - permit only call throw rpc interface
* @param directCall - permit only direct call (not from webapi, also roles will be ignore)
* @param roles - permit user with one of specified roles
* @param resourceFn - decorated resource function
*/
function appl... | true |
59a48fc920974e816c5b83ee129d7a4cd4ca56d2 | JavaScript | ConstanzaGarcia/array-ejercicios-guiados | /martes05.js | UTF-8 | 2,204 | 3.6875 | 4 | [] | no_license | const tasks = [
{
name: 'Pasear al perro',
duration: 40
},
{
name: 'Estudiar JS',
duration: 120
},
{
name: 'Ver un capítulo de Aggretsuko',
duration: 15
},
{
name: 'Ir a clases',
duration: 300
},
{
name: 'Cepillar al gato',
... | true |
de39cc851d0a138b2d2818f880e9caa76874e56c | JavaScript | Exia01/commerce-course | /main-project/ml-clothing/src/firebase/firebase.utils.js | UTF-8 | 3,284 | 2.515625 | 3 | [] | no_license | import firebase from 'firebase/app'; //pulling the utility lib that we need
// base import enables this referencing firebase
import 'firebase/firestore';
import 'firebase/auth';
const config = {
apiKey: `${process.env.REACT_APP_FIREBASE_KEY}`,
authDomain: 'crwn-db-16bcf.firebaseapp.com',
databaseURL: 'https://cr... | true |
364c32107bd3420f1a21b19519a52d74dbbc481d | JavaScript | zhufengnodejs/201615node | /6.webpack/src/components/MessageForm.js | UTF-8 | 1,951 | 3.0625 | 3 | [
"MIT"
] | permissive | import React from 'react';
/**
* 1.为按钮绑定点击事件 给表单绑定提交事件
* 2.把收集到的姓名和内容封装成一个对象,传递给MessageBox,从而修改状态。
* 3.状态改变后会自动刷新 MessageList
*/
// ES5 ES6 重大区别 es5所有事件处理函数 this=当前组件的实例
// ES6 事件处理函数指向 undefined
export default class MessageForm extends React.Component{
constructor(){
super();
}
handleSubmit(event){
... | true |
ce2287d4703f80d72d9172ff7c63d716caf76f3a | JavaScript | mehmettunc55/github-job-finder | /src/components/form/Form.js | UTF-8 | 2,038 | 2.65625 | 3 | [] | no_license | import axios from "axios";
import {useState, useEffect} from "react";
import './Form.css'
import JobCard from '../jobCard/JobCard'
import loadingLogo from '../../assets/loading.gif'
import error from '../../assets/404.png'
function Form() {
const [job, setJob] = useState([]);
const [description, setDescriptio... | true |
d24e2eeaf6a1fd8a2da499752b46858019f082e8 | JavaScript | 4rlm/phase-0-tracks | /js/explore.js | UTF-8 | 1,080 | 4.8125 | 5 | [] | no_license | // console.log("Hello world!");
// command line:
// node test.js
// Q2) pseudocode a function that takes a string as a parameter and reverses the string. reverse("hello")
// Steps:
// 1) Declare a function which takes one string argument.
// 2) Split the string into individual letters in an array using .split("")
// ... | true |
05bf0a66ecdcbe096f457a87633a23940666a54d | JavaScript | Novice-chap/DiscordBot | /commandHandler.js | UTF-8 | 911 | 2.703125 | 3 | [] | no_license | const fetch = require('node-fetch');
module.exports = async (message) => {
const replies = ['Helloooooo there!', 'Howdy!', 'Hola amigo!', 'Hey buddy'];
// console.log(message.content);
const userMsg = message.content.split(' ');
let keywords = 'We welcome you';
if (keywords.length > 1) {
keywords = userM... | true |
e8d41226d559544812fc6d8e4a75495cc97f335e | JavaScript | rollerskating1/jswork | /js_pinti2/7-5.js | UTF-8 | 815 | 2.953125 | 3 | [] | no_license | const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
// output: process.stdout,
});
let buf =[]
rl.on('line', (line) => {
if (line.trim()=="") rl.close()
//buf数组是命令行输入的信息
buf.push(line)
})
rl.on('close', () => {
... | true |
cf745533654ba9f7c46aeac78726a7f365232494 | JavaScript | alexanderzabiela/skiddle-sarch | /src/pages/eventDetails/EventDetails.js | UTF-8 | 1,623 | 2.546875 | 3 | [
"MIT"
] | permissive | import { useState, useEffect } from "react";
import { useParams } from "react-router-dom";
import { Link } from "react-router-dom";
import "./EventDetails.scss";
const EventDetails = () => {
const [eventDetails, setEventsDetails] = useState([]);
const { id } = useParams();
useEffect(() => {
(async () => {
... | true |
4a2328ba4188647e77066e8ec271bca3e4978686 | JavaScript | ninajhun/practice-problems | /lfz-challenges/string-manipulation-1/src/get-words.js | UTF-8 | 122 | 2.578125 | 3 | [] | no_license | /* eslint-disable no-unused-vars */
function getWords(str){
if(str === ''){
return []
}
return str.split(' ')
}
| true |
adf817a9c828a2794086e76231030ac1903e7ed0 | JavaScript | MrHassanMurtaza/ES6-Guide | /output/template-string.js | UTF-8 | 208 | 3.421875 | 3 | [] | no_license | "use strict";
// Template strings make pushing HTML content to DOM easy.
// Sample HTML content.
var template = "\n\t<div>\n\t\t<p> Hello World! </p>\n\t</div>\n";
// Print tempalte.
console.log(template); | true |
c249816395cd894bdfc975cad4b2010aa7dc1745 | JavaScript | Allott/Allott.github.io | /pathfinder/PUGRI.js | UTF-8 | 4,400 | 3.03125 | 3 | [] | no_license | let raceBox = document.getElementById("race-box")
let class1Box = document.getElementById("class1-box")
let class2Box = document.getElementById("class2-box")
let counter = document.getElementById("counter")
var count = 0
function loadFile(filePath) {//extra
var result = null
var xmlhttp = new XMLHttpRequest()
xm... | true |
d5ffb7150d54093cd90515eb80802c8ff1106ac5 | JavaScript | whysoserious/js-for-absolute-beginners | /meeting-1.js | UTF-8 | 1,168 | 3.265625 | 3 | [] | no_license | 13
45
3.456 + 5.4567
2000 // 2*10^3
2e3
2e3 - 2e2
// + - * / %
100 * (2 + 5) //205 700
(100 / 3) * 3
100.0001 / 3e9
1e-2
1e-3 //1*10^-3
1e-4
1e2
1e3 //1*10^3
314 / 100
330 % 100
330 / 100
273 % 10
"twoja stara"
'też twoja stara'
`adfsg`
"twoja stara\nw nowej linii"
"twoja stara ma na imie \"Ania\... | true |
d7f6dd9163a8a67fa73db7bb54696656172e94bd | JavaScript | GabrielFJunkes/walletjs | /resources/js/main.js | UTF-8 | 10,960 | 2.671875 | 3 | [
"MIT"
] | permissive | let closeModal = () => {
let modal = document.getElementById("modal");
modal.classList.remove('is-active');
}
let bulmaModalLogic = () => {
document.addEventListener('DOMContentLoaded', function () {
// Modals
var rootEl = document.documentElement;
var $modals = getAll('.modal');
var $moda... | true |
080177ad75a9482848ec9fcf3f5f4cb42801a7df | JavaScript | cheziZrubavel/Countries-API | /main.js | UTF-8 | 1,879 | 2.921875 | 3 | [] | no_license |
$(document).on("click", ".navbar-brand", ()=>{
$.ajax({
url: "https://restcountries.eu/rest/v2/all",
method:'GET',
success: (data)=>{
console.log(data);
showAllDetalis(data);
}
});
});
function showAllDetalis(object) {
$("#div").empt... | true |
a89c13c1ca32a41ff67b002abf2a5aef0789440c | JavaScript | RPGroup-PBoC/growth_limits | /code/figures/exploratory/class_selection.js | UTF-8 | 1,539 | 3.03125 | 3 | [
"MIT",
"CC-BY-4.0"
] | permissive | // Identify the provided selected class
var class_select = class_select_input.value;
// Given class selection, restrict selectable complexes to those in annotated class
var cplx_indices = getAllIndexes(cplx_desc_source.data['cog'], class_select);
var prot_indices = getAllIndexes(prot_desc_source.data['cog'], class_sel... | true |
7667f5389e23be5ad3d44ebb475f57554485bbbc | JavaScript | KulakDmitry/triangle-app | /main.js | UTF-8 | 819 | 2.921875 | 3 | [] | no_license | import { isTriangle } from "./render-triangle.js";
import { renderForm } from "./render-form.js";
const sides = {};
function getTriangleValue(value) {
return parseInt(document.querySelector(value).value);
}
function event() {
sides.a = getTriangleValue("#first-side");
sides.b = getTriangleValue("#second-side")... | true |
cebe20243503fb9db0f3519b481cbdec89e158c6 | JavaScript | xinleiye/LeetCode | /双周赛 2021/第 62 场双周赛/5872. 连接后等于目标字符串的字符串对/javascript/ac_v1.js | UTF-8 | 390 | 3.34375 | 3 | [
"Apache-2.0"
] | permissive | /**
* @param {string[]} nums
* @param {string} target
* @return {number}
*/
var numOfPairs = function(nums, target) {
let res = 0;
const length = nums.length;
for (let i = 0; i < length; i++) {
for (let j = 0; j < length; j++) {
if (i !== j && nums[i] + nums[j] === target) {
... | true |
d1def56896732207f1d5f4c97411941e3cdd0647 | JavaScript | andrewske123/web-react-meuPerfil | /src/App.js | UTF-8 | 1,768 | 2.78125 | 3 | [] | no_license | import React, { Component } from 'react';
import './App.css';
class App extends Component {
constructor(props){
super(props);
this.state = {
nome: 'Jefferson'
};
this.entrar = this.entrar.bind(this);
}
entrar(){
// this.state.nome = 'Jefferson Andrews'
this.setState({
n... | true |
c1d8fdfae9eac6885995136eae9aedbea4b17682 | JavaScript | alonsonina95/exercise.javascript_day-4-exercises | /js/manual-animation.js | UTF-8 | 2,444 | 3.234375 | 3 | [] | no_license | const buttons = document.querySelectorAll("button");
var animate;
document.addEventListener('keypress',
function() {
var direction = event;
animate = setInterval(function () { moveImageFromKeyboard(direction);}, 3000);
});
document.addEventListener('mouseup', function() { clearInterval... | true |
0404bf9c5e2e9ec9bad9d8c5d3a26c3c9058070a | JavaScript | gustavofds/trybe-exercises | /BACK_END/BLOCO_24/DIA_1/bonus-exercises.js | UTF-8 | 1,751 | 2.734375 | 3 | [] | no_license | // Para todas as alterações realizadas, você deve sempre atualizar ou adicionar o campo lastUpdate , que armazena a data da última alteração com o tipo timestamp
// 14
db.xmen.updateMany(
{ class: "unknown" },
{
$unset: { class: "" },
$currentDate: {
lastUpdate: { $type: "timestamp" }
},
}
);... | true |
c9cba6d94f36297e7bbfce4b3a6b8f3e15bf38cc | JavaScript | mariateresachaves/laig | /TP3/pivit/reader/primitives/Sphere.js | UTF-8 | 3,044 | 3.03125 | 3 | [] | no_license | /**
* Sphere
* @param radius sphere radius.
* @param slices number of slices.
* @param stacks number of stacks.
* @constructor
*/
function Sphere(scene, radius, slices, stacks) {
CGFobject.call(this,scene);
this.radius = radius;
this.slices = slices;
this.stacks = stacks;
this.initBuffers();
};
Sph... | true |
5cfb4518283af6740ce5dcd9224b6c3c57c284ce | JavaScript | FromBlueMarble/Yuta | /projects/week-3/Operators/1.js | UTF-8 | 403 | 3.53125 | 4 | [] | no_license | // Assignment
var x = 10;
// Adding
var x = 5;
var y = 2;
var z = x + y;
// Multiplying
var x = 5;
var y = 2;
var z = x * y;
// Aritmetic Operators
+ Addition
- Subtraction
* Multiplication
** Exponetiation
/ Division
% Modulus 'return the remainder'
++ Increment
-- Decrement
// AssignmentOperators
// Operator Ex... | true |
cf5c2516d8392341e29b554b60429bcb13e06705 | JavaScript | ThomasAbbink/pataphysical | /src/sketches/generative/wavy-anemone.js | UTF-8 | 7,942 | 2.578125 | 3 | [] | no_license | import { getCanvasSize } from '../../utility/canvas'
import { distanceSquared } from '../../utility/vectors'
import {
generateLoopNumber,
generateOscillatingNumber,
} from '../../utility/numbers'
import { lerpAngle } from '../../utility/vectors'
import { destroyableMap } from '../../utility/destroyableSet'
import {... | true |
6411162cc3141562b7936772e9d3b70c21765e44 | JavaScript | modlr-the-corporate-performance-cloud/MODLR-Process-Examples | /Utilities/Utility.Export Graphviz.js | UTF-8 | 3,065 | 3.03125 | 3 | [] | no_license | /*
This process is a work in progress for outputting a graphviz diagram of a data model built on MODLR.
*/
function pre() {
//this function is called once before the processes is executed.
//Use this to setup prompts.
script.log('process pre-execution parameters parsed.');
}
function begin() {
//this function is c... | true |
f7783e38825fdbdd3a01b98701b76616eeac8cf1 | JavaScript | iamsamitdev/redux_nextjs | /pages/index.js | UTF-8 | 1,641 | 2.578125 | 3 | [] | no_license | import {useState} from 'react'
import {connect} from 'react-redux'
import MainLayout from '../src/layouts/MainLayout'
import {decrementCounter, incrementCounter} from '../src/redux/actions/counterActions'
const Home = (props) => {
console.log(props)
// let counter = 0
// const { value, dispatch } = props
//... | true |