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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
9f4502fcb79abb2fde102a84eee6ebe1222087a8 | JavaScript | ehynds/jquery-misc | /carousel/carousel.js | UTF-8 | 4,002 | 2.640625 | 3 | [] | no_license | (function($) {
function Carousel(container, opts) {
container = this.container = $(container);
this.opts = opts;
this.ul = container.find("ul");
this.items = this.ul.children();
this.nextLink = container.find(opts.next);
this.prevLink = container.find(opts.prev);
this.itemIndex = 0;
t... | true |
3cb71e34a88af7e49111b95d8b98e6e56cc0307c | JavaScript | peterken674/akan-names | /script.js | UTF-8 | 1,871 | 3.921875 | 4 | [
"MIT"
] | permissive | let maleNames = ["Kwasi", "Kwadwo", "Kwabena", "Kwaku", "Yaw", "Kofi", "Kwame"];
let femaleNames = ["Akosua", "Adwoa", "Abenaa", "Akua", "Yaa", "Afua", "Ama"];
function getBirthday() {
let dateInput = document.getElementById("date").value;
let date = new Date(dateInput);
if (!!date.valueOf()) {
le... | true |
4da7635493f56d6d6228739f503260b5f3ffa44a | JavaScript | vincetal/JS_basic | /exo1/script_1.js | UTF-8 | 505 | 3.71875 | 4 | [] | no_license | /* 2.1.1. Bonjour
Créé un script script_1.js qui affichera "Bonjour, monde !" dans la console.
Voici les lignes que tu dois voir dans ta console : */
"Bonjour monde"
console.log("\"Bonjour monde\"");
/* 2.1.2. Salut
Customise le script script_1.js qui te demandera ton prénom avec un prompt.
Tu stockeras cette ent... | true |
6c9057e65836cd66e7e3f425c87e726a814332ce | JavaScript | kitpao/Responsive-Design | /script.js | UTF-8 | 1,252 | 2.65625 | 3 | [] | no_license | window.onscroll = function () {
logosticky();
};
window.onresize = function () {
resizable();
};
var nav = document.getElementById('navid');
var sticky = nav.offsetTop;
var image = document.getElementById('logo-token');
var logo = document.getElementById('logo-token-2');
var mainnav = document.getElementById('mainn... | true |
cee8924029312857cf49ef533337760d555af05b | JavaScript | soverby/js_scratch | /reduce.js | UTF-8 | 285 | 3.6875 | 4 | [] | no_license |
const r1 = [1, 2, 3].reduce( (acc, n) => acc + n, 0);
console.log(r1);
const f = (...vals) => {
console.log(`val: ${vals}`)
return vals.reduce( (acc, v) => {
console.log(`acc: ${acc}, v: ${v}`)
return acc + v
}, 0)
}
console.log(`${f(1, 2, 3, 4)}`)
| true |
983c53da607eeb569dc1387f7bcaf9d9562bc3b0 | JavaScript | xyyit9/leetcode | /normal/tree/105.js | UTF-8 | 1,014 | 3.671875 | 4 | [] | no_license | /**
* Definition for a binary tree node.
* function TreeNode(val, left, right) {
* this.val = (val===undefined ? 0 : val)
* this.left = (left===undefined ? null : left)
* this.right = (right===undefined ? null : right)
* }
*/
/**
* @param {number[]} preorder
* @param {number[]} inorder
* @return {... | true |
9a968c87fcbe8992d687ba3039bfefac71fe375e | JavaScript | ilkka183/hotline | /server/connection.js | UTF-8 | 1,190 | 2.6875 | 3 | [] | no_license | const mysql = require('mysql');
class Connection {
constructor(user, password, database) {
this.connection = mysql.createConnection({
host: 'localhost',
user,
password,
database
});
}
connect(callback) {
this.connection.connect(callback);
}
query(sql) {
const promise... | true |
4a970622d3f8999ca70b3c0e0928a2084f18c06d | JavaScript | step-batch-7/todo-Neha-sanserwal | /libs/viewTodoTemplate.js | UTF-8 | 1,497 | 2.984375 | 3 | [] | no_license | const replaceText = function(key, value, template) {
const pattern = new RegExp(`__${key}__`, 'g');
const newTemplate = template.replace(pattern, value);
return newTemplate;
};
const readTask = function(task, reader) {
let taskTemplate = reader('templates/taskTemplate.html', 'utf8');
for (const key in task) {... | true |
5ebe3aa1fa0df5e9fc7609b8f513c5dc03960cb2 | JavaScript | shivateja-madipalli/SelectOInput | /dialog_impl.js | UTF-8 | 5,268 | 2.5625 | 3 | [] | no_license | // declaring Angular App
var app = angular.module('MyApp',['ngMaterial', 'ngResource', 'ngMessages', 'material.svgAssetsCache']);
// Main Controller
app.controller('AppCtrl', function($scope, $mdDialog) {
$scope.status = ' ';
$scope.customFullscreen = false;
$scope.teamDetails = {
"teamName": "",
"teamM... | true |
7f49fa6c11e7a9d58d2297204609b6500ece11aa | JavaScript | TomaszLaski/Event-app | /client/src/context/event/eventReducer.js | UTF-8 | 1,480 | 2.5625 | 3 | [] | no_license | import {
GET_EVENTS,
ADD_EVENT,
DELETE_EVENT,
SET_CURRENT,
CLEAR_CURRENT,
UPDATE_EVENT,
FILTER_EVENTS,
CLEAR_FILTER,
EVENT_ERROR,
CLEAR_EVENTS,
} from '../types';
export default (state, action) => {
switch (action.type) {
case GET_EVENTS:
return {
...state,
events: action.payload,
loading: ... | true |
d8556c26e9a7a9b9f5e4bb3806cf82a0cc8f1933 | JavaScript | lukegalea/drawback | /lib/drawback/index.js | UTF-8 | 1,368 | 2.640625 | 3 | [
"MIT"
] | permissive | /*!
* drawback
* MIT Licensed
*/
/**
* Module dependencies.
*/
/**
* Library version.
*/
exports.version = '0.0.6';
/*** Methods ***/
/**
* draw method
*
* @param {String} module
* @param {Object} data
* @return {Function} callback
*/
exports.draw = function(module, data, fn){
// plugins definitions
va... | true |
e22c3c7c5f2b00cd2ab42508d38a243c3205565d | JavaScript | Wiytiszen/beer-stock | /src/helpFunctions/helpFunctions.js | UTF-8 | 68 | 2.640625 | 3 | [] | no_license | export const isNumber = (value)=>{
console.log("funciona"+ value)
} | true |
6fdea3ce9766b6c0ef02e135073346dec390b6f2 | JavaScript | SenorEdbot/project3 | /client/src/components/Stats/UserStats/Graph.js | UTF-8 | 2,494 | 2.53125 | 3 | [] | no_license | import ReactChartkick, { LineChart } from 'react-chartkick'
import Chart from 'chart.js'
import React, { Component } from 'react'
import { withStyles } from '@material-ui/core/styles'
import Tabs from '@material-ui/core/Tabs'
import Tab from '@material-ui/core/Tab'
ReactChartkick.addAdapter(Chart)
const styles = th... | true |
b397e18ca200955d044bd87a8d0e878ed2a6242e | JavaScript | seanpranoto/todo-list | /src/components/Form.js | UTF-8 | 896 | 2.703125 | 3 | [] | no_license | import React, { useState } from "react";
const Form = (props) => {
const { tasks, setTasks } = props;
const [list, setList] = useState({
name: "",
isComplete: false,
nameStyle:{}
});
const onSubmit = (e) => {
// Prevent default behaviour
e.preventDefault();
... | true |
2552966f55ce3b38b86025cfd13cef1c04cad044 | JavaScript | koko-m/TtT | /js/textarea.js | UTF-8 | 501 | 3.03125 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | function clearLog () {
var logArea = document.getElementById("logArea");
logArea.value = "";
}
function addLog (txt) {
var logArea = document.getElementById("logArea");
logArea.value = txt + "\n" + logArea.value;
}
function clearConsole () {
var consoleArea = document.getElementById("consoleArea")... | true |
889b73fc3f70fc60e469b6c8c5ac6a3e9157d8d2 | JavaScript | Bartosz90/mdolatowska | /src/components/Home.js | UTF-8 | 7,924 | 2.90625 | 3 | [] | no_license | import React from "react";
import "../styles/Home.sass";
import logo from "../img/home/home1.jpg";
const Home = () => {
const description = "Drawing & Print - level I";
let delay = 0.1;
const letters = [...description].map((letter) => {
delay += 0.1;
return (
<span
className="letter"
... | true |
aab8563a858a4870e92efb65a7035b12d79e5952 | JavaScript | phantomxxi/Remember_App.github.io | /app.js | UTF-8 | 19,544 | 3.265625 | 3 | [] | no_license | //Hide lists, hide remember form, if name in LS - show list form and grab stuff from LS
document.addEventListener("DOMContentLoaded", function(event) {
UICtrl.hideListForm();
UICtrl.hideItemList();
UICtrl.hideCompletedItemList();
UICtrl.hideStartOverBtn();
const name = localStorage.getItem('name');
if(name !== nu... | true |
576a83f6d89c10c31560a7746ed15cf6692b624c | JavaScript | jijothic/gestalt | /scripts/stats.js | UTF-8 | 1,787 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | /*
# Setup
jscodeshift --transform ~/src/gestalt/scripts/stats.js --parser flow --dry ~/src/my-repo | grep "^\- " | cut -c 4- > ~/Desktop/gestalt-stats.csv
# What % of components calls are Gestalt components?
cat ~/Desktop/gestalt-stats.csv | grep -v "tests" | grep ",true," | wc -l
cat ~/Desktop/gestal... | true |
532096f5ab6fc9c10abad6b9974eced9ee8ba116 | JavaScript | zjkessler/vschool-assignments | /warmups/add_three/script.js | UTF-8 | 520 | 3.578125 | 4 | [] | no_license | function loneSum(a, b, c) {
// var sum = 0;
// if (a !== b && a !== c && b === c) {
// sum += a + b;
// } else {
// sum += b;
// }
// if (a !== c && b !== c) {
// sum += c;
// }
// if (a === b && c === a && b === c) {
// sum = 0;
// }
// console.log(sum);
// sum = 0;
var numArr = [];
//push to arra... | true |
84d1b321bed1342cfec2109d8d3ca302953442e3 | JavaScript | dtuite/ab_test_calculator | /javascripts/app/calculator.js | UTF-8 | 3,616 | 3.359375 | 3 | [] | no_license | // moment will be required from javascripts/lib because of the RequireJS
// configuration we have set up.
define(['moment', 'qnorm'], function(moment, qnorm) {
// Time Related Stuff
// ------------------
// Moment.js
// http://momentjs.com/
var MILLISECONDS_IN_ONE_DAY = 86400000;
// INFO: http://stacko... | true |
7cda177f3d80702e0d1ede0b0b9ea2251e020610 | JavaScript | haiifeng/dailyQA | /2021/2021-06-16 题目/wangyi.js | UTF-8 | 5,063 | 3.578125 | 4 | [] | no_license | /**
* 在开发中,我们可能会遇到一些对异步请求数做并发量限制的场景,
比如说微信小程序的request并发最多为5个,又或者我们需要做一些批量处理的工作,可是我们又不想同时对服务器发出太多请求(可能会对服务器造成比较大的压力)。这个时候我们就可以对请求并发数进行限制,并且使用排队机制让请求有序的发送出去。
实现一个对请求并发数做限制的通用 Request 类,对应真实场景是控制并发请求数,并且需要返回请求的结果,模拟浏览器的并发请求控制
**/
class RequestDecorator {
constructor({
maxLimit = 5,
requestApi,
})... | true |
146b74354932f4b2081fa90389b5a502665caa02 | JavaScript | Invincible9/JsCore | /JsFundamentals/ExpressionsConditionalStatementsAndLoops/01.HelloJavaScript!.js | UTF-8 | 166 | 2.984375 | 3 | [] | no_license | /**
* Created by Mihail on 9/21/2016.
*/
function solve(args) {
let name = args;
console.log("Hello, " + name + ", I am JavaScript!")
}
solve(['Ivan']);
| true |
6e39b5c43b598060046192b19e0ea3fb9d79e41f | JavaScript | vladime88/ExoNode-2 | /counter.js | UTF-8 | 172 | 2.9375 | 3 | [] | no_license | const min = Number(process.argv[2])
const max = Number(process.argv[3])
const step = Number(process.argv[4])
for (let i = min; i <= max; i += step) {
console.log(i)
}
| true |
ca4d3a9fe9a7fe2ddd3c73fc72fb73b508875a71 | JavaScript | bnoordhuis/v8-cmake | /v8/test/mjsunit/temporal/duration-from.js | UTF-8 | 9,874 | 2.515625 | 3 | [
"BSD-3-Clause",
"SunPro",
"Apache-2.0"
] | permissive | // Copyright 2021 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-temporal
d8.file.execute('test/mjsunit/temporal/temporal-helpers.js');
let d1 = new Temporal.Duration(1, 2, 3, 4, 5, 6, 7, 8, 9, 10... | true |
6bcc30eecddac8b7f86812eacacc7e3c9e7b3f90 | JavaScript | piiiiva/cursoudemy | /fundamentos/erro.js | UTF-8 | 1,029 | 4.375 | 4 | [] | no_license | /*
function imprimirNomeGritado(obj) {
console.log(obj.name.toUpperCase() + '!!!')
}
const obj = { nome: 'Roberto' }
// imprimirNomeGritado(obj) vai dar erro pq usei obj.name.toUpperCase na funçao
*/
// mas defini como nome no objeto depois
/* Em códigos que possuem mais chance de apresentar algum tipo de erro é ... | true |
97c9b188f1257e301a1e0a4ffd40eeb0285c317e | JavaScript | kennydude/FallbackSwigLoader | /fallbackswigloader.js | UTF-8 | 1,000 | 2.609375 | 3 | [] | no_license | var fs = require("fs"),
async = require("async"),
path = require("path");
module.exports = function(locations, encoding){
encoding = encoding || 'utf8';
return {
resolve : function(to, from){
return to;
},
loadSync : function(identifier){
for (var i = 0; i < locations.length; i++) {
var filename =... | true |
16c2844885cbc35d574410c5522cc4c0d5506ed7 | JavaScript | queicherius/ng-passwordstrength | /scripts/services/passwordStrengthZxcvbn.js | UTF-8 | 1,142 | 2.765625 | 3 | [
"MIT"
] | permissive | // This algorithm depends on https://github.com/lowe/zxcvbn (MIT) and loads 700kb of dictionaries but is more accurate
application.factory('passwordStrength', function () {
(function () {
var a;
a = function () {
var a, b;
b = document.createElement("script");
b.... | true |
c536ed3d8f1bc3ffcea2472075906cf83fc81f4d | JavaScript | AsherBearce/AsherBearce.github.io | /js/project.js | UTF-8 | 2,329 | 2.796875 | 3 | [
"MIT"
] | permissive | $(document).ready(function() {
let name = getProjectName();
loadProject(name);
loadTopBar(name);
getScrollInfo();
});
$(window).on('scroll', () => {
this.getScrollInfo();
});
function getProjectName() {
let url = document.location.href;
let params = url.split('?')[1];
return params;
}
... | true |
a22e07a5a325dbb9bea90ea0e6c421156bc290f5 | JavaScript | youqingkui/stydy | /AngularJS/ex_code/ch02_05_service_factory/scripts/myApp.js | UTF-8 | 623 | 2.78125 | 3 | [
"MIT"
] | permissive | "use strict";
angular.module('myApp', []);
angular.module('myApp').controller('MyCtrl', function(log) {
log.debug('MyCtrl has been invoked!');
});
angular.module('myApp').factory('log', function () {
// Service Implementation
var log = function (level, message) {
console.log('[' + level + '] ' + ... | true |
bf18f121a1cd526c06600fc1e2543031378a78bc | JavaScript | cyrstron/JS-Lessons | /for-sorting/Lesson 1/unit-24/jsx.jsx | UTF-8 | 499 | 2.578125 | 3 | [] | no_license | import React from 'react';
import ReactDOM from 'react-dom';
const name = 'Vasya';
const element = (
<h1 className='greeting'>
Hello, {name}
</h1>
);
ReactDOM.render(
element,
document.getElementById('root'),
);
import React from 'react';
import ReactDOM from 'react-dom';
const name = 'Vas... | true |
7ca79b5514d876fbcee5233e9bc9184a43f4fe82 | JavaScript | MrKireko/samaritan | /js.js | UTF-8 | 500 | 3.0625 | 3 | [
"MIT"
] | permissive | $(document).ready(function(){
var inp = "What are your commands".split(" ");
inp.push(inp[inp.length - 1])
console.log(inp);
function post() {
var i = 0;
var interval = setInterval(function(){
$("#txt").css("color", "black");
$("#txt").html(inp[i]);
i = i+1;
if (i == inp.length) {
$("#txt").css(... | true |
8633299d8230835f4477551191c70100ed1e4e9f | JavaScript | JimmyGit/codeChallenge | /weightedMean.js | UTF-8 | 864 | 3.6875 | 4 | [] | no_license | /********************
input:
20
10 40 30 50 20 10 40 30 50 20 1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10 10 40 30 50 20 10 40 30 50 20
(10x1) + (40x2) + ... (2*40) + (3*30)... sum
_____________________________________ = ______
1 + 2 + ... 40 + 30 .. sum
Answer set to 1... | true |
885cb457f52152da7974a28b988e665f33740e24 | JavaScript | Mrduanjq/mrduanjq | /shootingBall/ball.js | UTF-8 | 2,321 | 2.984375 | 3 | [] | no_license | ;(function(){
function QQ(){ //创建气球构造器
//气球位置坐标
this.x = Math.random()*( document.body.clientWidth - 96 );
this.y = 800;
//气球编号
this.number = Math.ceil( Math.random()*8 );
//气球分数
this.score = this.number;
// 气球速度(编号越大,速度越快)
this.step = this.number*1.5;
//气球宽高
this.width = 96;
this... | true |
1073c7b071768b36d78255105f54bff2b8833da5 | JavaScript | husseinzahran/kagoal-app | /src/pages/components/ManageGoals/GoalsApp.js | UTF-8 | 1,954 | 2.515625 | 3 | [] | no_license | import React, { Component } from 'react';
import GoalItem from './GoalItem'
import AddGoal from './AddGoal'
import firebase from 'firebase'
const goalsCollection = [];
class GoalsApp extends React.Component {
constructor(props){
super(props)
this.state = {
goals: [],
name:["aaaaaaa", "ssssss"]
}
... | true |
d6c65bf5eb45770c303160349f6aa5e13dd0d27a | JavaScript | LuisGVicente/Bootcamp.2-JavaScript_BasicosII | /Rosendo_ej/listado_series_funciones.js | UTF-8 | 1,725 | 2.71875 | 3 | [] | no_license | //Función mostrar producto
/*
name: 'Modern Love Season 1',
link: 'https://www.amazon.es/gp/video/ssoredirect/?ru=https%3A%2F%2Fapp.primevideo.com%2Fdetail%3Fgti%3Damzn1.dv.gti.60b639e1-e479-1dbb-fba0-6e5c390c0764%26ref_%3Ddvm_src_ret_es_xx_s&page-type-id=B07WN2CGCF&ref=sr_1_1&keywords=series&__mk_es_ES... | true |
6e0c5dc723d4f20fd7b350924e6284e933c46e4e | JavaScript | kaidez/kaidez.com | /v1.0.0/requireBuildOut/loadHomePageAds.js | UTF-8 | 4,174 | 2.578125 | 3 | [
"MIT"
] | permissive | /*
* Require JS Module: loadHomePageAds
*
* Create 250px x 250px lynda.com & Media Temple ads and load them
* onto the home page
*/
define( ["enquire"], function( enquire ) {
/*
* if window.matchMedia is not supported, add matchMedia polyfills.
* Each file will load twice, check to see ... | true |
2081678b139b0b444ecdc47f499273996ee4b1dc | JavaScript | mmcfarlin107/McFarlin_Lab5 | /script.js | UTF-8 | 425 | 4.53125 | 5 | [] | no_license | var temp = parseInt(prompt("What is the temperature in Farenheit?"));
// console.log((temp - 32) * (5/9) + "Degrees Celcius");
console.log(temp + " degrees Fahrenheit equals " + ((temp - 32) * (5 / 9)) + " degrees Celsius");
var temp2 = parseInt(prompt("What is the temperature in Celsius?"));
console.log(temp2 + " de... | true |
866ba4a8d1ee7f569b2cdb92d3ea816d3640a373 | JavaScript | gersilva96/DigitalHouse | /05-Heroes/app.js | UTF-8 | 1,547 | 2.671875 | 3 | [] | no_license | const express = require("express");
const fs = require("fs");
const app = express();
app.listen(3030, () => console.log('Server running in 3030 port'));
const heroes = JSON.parse(fs.readFileSync(__dirname + '/data/heroes.json', 'utf-8'));
app.get('/', (req, res) => {
res.send("Ni Superman, IronMan o La Mujer Mar... | true |
7c630adfaf8b5b4b9d0dc17a35ce10dec89defd5 | JavaScript | Samuel1s/cefet-web-learnyounode | /src/time-server.js | UTF-8 | 379 | 2.9375 | 3 | [] | no_license | const http = require('http')
const port = process.argv[2]
now = () => {
const date = new Date();
const hour = date.getHours();
const minutes = date.getMinutes();
return `${date.toLocaleDateString('en-CA')} ${hour}:${minutes}`
}
const server = http.createServer()
server.on("connection", (socket) => {... | true |
180d9f4ce119760b8568840e1b44709fb7522b0e | JavaScript | zbchen29/personal-app | /src/components/ArtCarousel.js | UTF-8 | 3,719 | 2.515625 | 3 | [] | no_license | import React, { Component } from 'react';
import "bootstrap/dist/css/bootstrap.min.css";
import "./ArtCarousel.css";
class ArtCarousel extends Component {
constructor (props) {
super(props);
this.state = {
activeIndex : 0
};
this.goToIndex = this.goToIndex.bind(this);
... | true |
4c7ce00fb48b9663fd096f892e235b9f6693fa3c | JavaScript | mikkelhartmann/mikmik19.github.io | /js/tools-of-chaos-theory/lorenz-system.js | UTF-8 | 3,633 | 2.78125 | 3 | [] | no_license | (async function () {
var width = 500;
var height = 400;
var origin = [250, 250];
var scale = 4;
var pointData = [];
var trajectory = [];
var beta = 0;
var alpha = 0;
const loopIndex = 0;
var startAngle = Math.PI / 4;
var svg = d3
.select("#lorenz-system")
.append("svg")
.attr("preserv... | true |
282b0ea8a2cd091c26af07e1cabb42eb58ab59bf | JavaScript | Shadowv/js-assignment | /ass2Q2.js | UTF-8 | 1,227 | 3.5 | 4 | [] | no_license | console.log("ass2q.2");
//initialization of array
var arr=["hii,how,are,you"];
console.log(arr);
//push an array
arr.push("i,am,fine");
console.log(arr);
arr.unshift("ajay")
console.log(arr)
// remove from an array
console.log(arr.pop())
console.log(arr);
console.log(arr.shift());
//To merge to ar... | true |
f2620401faf2cfa7828317d9ccd3216a77ffe1b1 | JavaScript | SumnerDolleman/CS188 | /repositories/items-repository.js | UTF-8 | 608 | 2.53125 | 3 | [] | no_license | const uuid = require('uuid');
let items = [
{
'itemId': uuid.v4(),
'name': 'Bean Bag Chair',
'description': 'I bean bag chair with a Drake logo'
'price': 15.69
},
{
'itemId': uuid.v4(),
'name': 'Drake Sticker',
'description': 'Make anything a Drake th... | true |
da5571aef08eff9ae1fcf6b71662e4bf26dfdfc9 | JavaScript | zhy0412/zhy0412.github.io | /JD/js/详情页.js | UTF-8 | 542 | 2.59375 | 3 | [] | no_license | //商品数量加减
function fun(obj,flag){
if(flag){
var res=parseInt($(obj).next('input').val());
res++;
$(obj).next('input').val(res);
}else{
var res=parseInt($(obj).prev('input').val());
res--;
if(res==0){
return;
}
$(obj).prev('input').val(res)... | true |
e9d0aa23865bc2e5868d81d723f9e2a2dffb53d6 | JavaScript | anattzlil/weather-react | /client/src/App.js | UTF-8 | 2,842 | 2.6875 | 3 | [] | no_license | import React, {
Component
} from 'react';
// import './App.css';
import SearchForm from './SearchForm';
import WeatherListBox from './WeatherListBox';
import axios from 'axios';
class App extends Component {
constructor(props) {
super(props);
this.state = {
weather: []
};
this.onSubmitForm = ... | true |
2d47a186da11965a208f5e1343abefe6f1d012da | JavaScript | Steve-B-Taylor/challenges | /Week6/podcast-express-master/src/models/Podcast.js | UTF-8 | 925 | 2.75 | 3 | [] | no_license | import fs from "fs"
const podcastsPath = "podcasts.json"
const getPodcasts = () => {
const fileContents = fs.readFileSync(podcastsPath)
return JSON.parse(fileContents.toString()).podcasts
}
class Podcast {
constructor(title, description, network, slug) {
this.title = title
this.description = descriptio... | true |
af2100cd99c4489bf7350b6ec24f4763cf693605 | JavaScript | JesseDWhite/merch-site | /src/components/ItemList.js | UTF-8 | 931 | 2.546875 | 3 | [] | no_license | import React from "react";
import Item from "./Item";
const masterItemList = [
{
name: "cloudbuster",
description: "I know that something good is going to happen",
quantity: 1
},
{
name: "batwings",
description: "Move with me",
quantity: 100
},
{
name: "dagger",
description: "... | true |
3aef3e75c5896fda1de7e99cd146415c6fb7acfa | JavaScript | EasonMar/studyHub | /ES6/ES5_review/js/inherit_3.js | UTF-8 | 1,618 | 4.5 | 4 | [] | no_license | // javascript的继承 : https://blog.csdn.net/qq_35732147/article/details/82801533
// 3. 组合继承
// 组合继承指的是将原型链和经典继承的技术组合到一起,从而发挥二者之长的一种继承模式
// 即使用原型链实现对原型属性和方法的继承,而通过经典继承来实现对实例属性的继承
function SuperType(name){
this.name = name;
this.colors = ["red", "blue", "green"];
}
SuperType.prototype.sayName = function(){ ... | true |
84ed40c5f1b33b720582b735cd672d86bfc25727 | JavaScript | AdrianFedeles/Practica-Front-end-wantsome | /practicacCasa/saptamana11/partea1/indexSaptamana11P1.js | UTF-8 | 2,228 | 3.578125 | 4 | [] | no_license | console.log(Math.random());
console.log(Math.min(1, 2));
console.log(Math.min(3, 12));
// const add2 (x){
// return x + 2
// }
// const y = 2
// y = 12;
// const adder =(x) => {
// return x + y
// }
// console.log(adder(4))
let y = 2;
y = 12;
const adder = (x) => {
return x + y
}
console.log(add... | true |
6251d2c309c7aeec1dd0d88ce569c021fba73b5f | JavaScript | thenativeweb/formats | /dist/validators/regex.js | UTF-8 | 635 | 2.59375 | 3 | [
"MIT"
] | permissive | 'use strict';
var getReturnValue = require('../getReturnValue'),
throwOnUnknownProperties = require('../throwOnUnknownProperties');
var validator = function validator(options) {
if (!options) {
throw new Error('Options are missing.');
}
if (!options.expression) {
throw new Error('Regular expression ... | true |
3be2edb2294d2f65d03b2d6edc9cc3d945a3b3af | JavaScript | jstaizhousun/ES6 | /13promisetest.js | UTF-8 | 493 | 3.5625 | 4 | [
"MulanPSL-2.0",
"LicenseRef-scancode-mulanpsl-2.0-en",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | //使用promise读取文件内容(nodeJS环境)
//1、
const fs = require('fs')
fs.readFile('./README.md',(err,data)=>{
//如果失败
if(err) throw err;
console.log(data.toString())
})
//使用promise封装
const p = new Promise(function(resolve,reject){
fs.readFile('./README.md',(err,data)=>{
//如果失败
if(err) reject(err)... | true |
5774c123cbc9eb6da64d693e1dd4a2072d7844bf | JavaScript | verma4435/js_performace | /for.performance.js | UTF-8 | 513 | 3.421875 | 3 | [] | no_license | let arrSize = 100663296;
let arr = Array(arrSize);
console.time('init time: ');
for(let i = 0 ; i < arr.length; i++) {
arr[i] = i;
}
console.timeEnd('init time: ');
console.time("Sum time");
let sum = 0;
for(let i = 0; i < arr.length; i++) {
sum += arr[i];
}
console.log('Sum: %d', sum);
console.timeEnd("Sum t... | true |
1908b06a94d211a76c8e8ac9a6727e32e7ca0054 | JavaScript | alisyihab/flip_test | /cypress/integration/task_2.js | UTF-8 | 2,926 | 2.71875 | 3 | [] | no_license | context('task-2 - get element by xpath & attribute', () => {
beforeEach(() => {
cy.visit('https://flip.id/')
})
//assert text by xpath
describe('Assertion teks', () => {
it('Assertion text button Bantuan, Karir, Biaya, Masuk ', function () {
cy.xpath('//*[@id="section1"]/div[1]/div[1]/ul/li[1]/a'... | true |
aebe283e13d3794da4cc502ea653efd903ae0028 | JavaScript | lucaspsacchi/LuLuSo-co | /Views/js/scriptQuestoes_bck.js | UTF-8 | 2,038 | 3.28125 | 3 | [] | no_license | window.addEventListener('load', (event) => {
data = catchDadosUrl()
atual = 0;
})
// Pega as chaves e valores da url
function catchDadosUrl() {
var query = location.search.slice(1)
var partes = query.split('&')
var data = {}
partes.forEach(function (parte) {
var chaveValor = parte.split('=')
var ch... | true |
060bcaaf4c6e28381a61b70369dda31d6eb4199e | JavaScript | pwolan/library | /models/book.js | UTF-8 | 1,173 | 2.625 | 3 | [] | no_license | const { pool } = require("../database/config");
exports.add = async (userID,{ title, author, cover }) => {
let date = new Date().getDate();
let query = `
INSERT INTO books (title, author, cover, date, userID)
VALUES ($1,$2,$3,$4,$5)
`;
await pool.query(query, [title, author, cover, date, userID]);
};
e... | true |
357e535434474ad5bf978a05d8544f816372f317 | JavaScript | BCProgramming/BASeBlock | /appdata/Scripts/test.js | UTF-8 | 1,468 | 2.8125 | 3 | [] | no_license | //test javascript for BASeBlock
//and basic "sample"...
//this sample flashes the block as it is hit.
var ourblock=self;
var usepen = System.Drawing.SystemPens.Highlight;
//the GetName() function is called to determine the name of the block as it appears in
//the Editor Drop-downs.
var GetName = function(){
return ... | true |
5315656cac03f0d1d7398ba16dbd7d49ba19943a | JavaScript | Rafquadros22/wiremosaic | /script.js | UTF-8 | 5,498 | 3.203125 | 3 | [] | no_license | $("#five-day").hide();
$(document).ready(function() {
//submit city button
$("#submit").click(function(event) {
//give user city a value
var userCity = $("#search-city").val().trim();
var queryURL = `https://api.openweathermap.org/data/2.5/weather?q=${userCity}&appid=045f01a53bdb9c81d396467bc99a5685`;
//empt... | true |
07ccc43eb2354a336e0048d81335d17a834d962e | JavaScript | xingmengmeng/nodeBase | /15.socket.io/1.server.js | UTF-8 | 4,652 | 2.921875 | 3 | [
"MIT"
] | permissive | var express = require('express');
var path = require('path');
var app = express();
/*app.get('/bootstrap.min.css',function(req,res){
res.send('xx');
});*/
//使用这个中间件之后,此中间件原理是去public目录下找找有没有这个文件,如果有则读出来返回给客户端,如果没有则 next
app.use(express.static(path.resolve('public')));
//当客户端访问/的时候,返回一个index.html文件
app.get('/',function(r... | true |
004536358b6eb764efe8359f3e0fccefd7392dc0 | JavaScript | Amarius1/WavecomV | /Dist/components/tabs.js | UTF-8 | 976 | 2.796875 | 3 | [] | no_license | jQuery(document).ready(function() {
// Standard
jQuery('header a').on('click', function(e) {
var currentAttrValue = jQuery(this).attr('href');
// Show/Hide Tabs
jQuery('* ' + currentAttrValue).show().siblings().hide();
// Change/remove current tab to active
jQuery(this).addClass('active'... | true |
75adf21568de8278e90126a01b7fc11c12bcab29 | JavaScript | AaronChacon/Javascript-moderno-2020-Udemy | /09-Funciones/js/11-app.js | UTF-8 | 529 | 4.125 | 4 | [] | no_license |
const aprendiendo1 = function(tecnologia, tecnologia2){
console.log(`Aprendiendo ${tecnologia} y ${tecnologia2}`);
}
aprendiendo1('Javascript', 'NodeJs')
/* En los arrow function si se le pasa solo 1 parametros podemos
no utilizar los parentesis */
const aprendiendo2 = tecnologia => `Aprendiendo ${tecnologia}... | true |
de44bfbd27ae12ad517eaa122db36f8f25ccc8b4 | JavaScript | neilsextra/document-reader | /static/cloud.js | UTF-8 | 3,237 | 2.78125 | 3 | [
"MIT"
] | permissive | function Cloud(account, token, container, directory) {
this.__account = account;
this.__token = token;
this.__container = container;
this.__directory = directory;
}
Cloud.prototype.query = function() {
return new Promise((accept, reject) => {
var xhttp = new XMLHttpRequest();
xh... | true |
56c46d20e1e486ef5736027100f00018d883f6ad | JavaScript | dodrio/game-example-bunny-funny-runner | /src/game/game/components/generators/enemy.js | UTF-8 | 1,441 | 2.625 | 3 | [] | no_license | import Phaser from 'phaser';
import Generator from './generator';
import Service from '../../../service';
import SpringMan from '../../actors/spring-man';
import FlyMan from '../../actors/fly-man';
import SpikeBall from '../../actors/spike-ball';
import Cloud from '../../actors/cloud';
export default class EnemyGenera... | true |
16d90d0b8a9307a057daab3c421f4144b457a3d2 | JavaScript | spierre95/LettersAssignment | /countLetters2.js | UTF-8 | 368 | 3.421875 | 3 | [] | no_license | function countLetters(str){
var numberOfLetters = {
}
var string = str.split(" ").join("");
console.log(string);
for (i = 0; i < string.length; i++ ){
if(!numberOfLetters[string[i]]) {
numberOfLetters[string[i]] = [i];
} else {
numberOfLetters[string[i]].push(i);
}
}
return numberOfLetters
}
consol... | true |
443fc5fb8c8d1c7f5af206178f56330cb87c39c7 | JavaScript | Abhishek-2080/Project-27 | /rope.js | UTF-8 | 1,042 | 2.6875 | 3 | [] | no_license | class Rope{
constructor(bodyA,bodyB,OffsetX,OffsetY){
this.OffsetX = OffsetX;
this.OffsetY = OffsetY;
//this.x=rope.x;
//this.y=rope.y;
var options={
bodyA:bodyA,
bodyB:bodyB,
pointB:{x:this.OffsetX,y:this.OffsetY},
... | true |
d3877c5d9be0eaee0f01ace78054c878e281f68c | JavaScript | StevenYoung21/LeetCode_practice | /dynamicProgramming/70-climbStairs/1.js | UTF-8 | 320 | 3.296875 | 3 | [] | no_license | /**
* @author steven
* @date 2020-4-17
* @func 爬楼梯算法
* @param {*type number } n
*/
var climbStairs = function(n) {
if(n >= 40) throw new Error('内存会溢出');
if(n == 1 ) return 1;
if(n == 2 ) return 2;
return climbStairs(n-1) + climbStairs(n-2);
};
console.log(climbStairs(45)); | true |
ef593264e79a06eecfdc33db581ab3ce504dd7d2 | JavaScript | S-A-Pran/js-basic-array | /nested-ifelse.js | UTF-8 | 210 | 2.65625 | 3 | [] | no_license | let isPacked = false;
let danishPrice = 60;
let myMoney = 61;
if(danishPrice<myMoney){
if(isPacked == false){
console.log('Mama Danish dio na');
}
}
else{
console.log('Ajk haoai khabbo');
} | true |
707609088364e18f46c3a55b4d34e1739faf1a10 | JavaScript | dfpires/lp | /Lista de Vetor de Objetos/VetorObjetosExe15.js | UTF-8 | 2,993 | 3.25 | 3 | [] | no_license | var vetorCozinheiros = [];
var vetorIngredientes = [];
var vetorReceitas = [];
var vetorIngredientesReceitas = [];
function cadastraCozinheiro(){
// cria um objeto
var objeto = new Object();
// atribui valores às propriedades
objeto.codigo = parseInt(prompt("Informe código do cozinheiro"));
objeto.nome = prompt("I... | true |
0c6b8b239ea63b60b2c6360e8c81eec5cf008c06 | JavaScript | slide33/JS-19-20 | /js/slider.js | UTF-8 | 818 | 3.34375 | 3 | [] | no_license | var secDuration = 5;
var image = 1;
var maxImages = 3;
var slider = document.getElementById('slider');
var timeout
function changeImage(requiredImage) {
if (!requiredImage && requiredImage != 0) {
if (image < maxImages) {
image++;
} else {
image = 1;
}
... | true |
b05d76fc343e9f9c4de46f81dc6c4765112e9fd2 | JavaScript | response4sourav/React-Apps | /2-React/4-shop-ui-v2/src/App.js | UTF-8 | 1,938 | 2.53125 | 3 | [] | no_license | import React, { Component } from 'react';
import Navbar from './components/Navbar';
import Product from './components/Product';
import ViewCart from './components/ViewCart';
class App extends Component {
constructor(props) {
super(props)
this.state = {
isCartOpen: false,
cart: [],
products:... | true |
d8420028f1fa692afa4abebe0991564bcf383db9 | JavaScript | ntdanh1711/recipes | /src/containers/RecipeScreen/reducer.js | UTF-8 | 889 | 2.546875 | 3 | [] | no_license | import {
FETCH_RECIPES,
FETCH_RECIPES_FAIL,
FETCH_RECIPES_SUCCESS,
DELETE_RECIPE_FAIL,
RESET_STATE,
} from './actionTypes';
const initialState = {
recipes: [],
error: null,
isLoading: false,
totalPages: 1,
};
export const recipeReducer = (state = initialState, action) => {
switch (action.type) {
... | true |
40e8b06576d84ee875d304a2eae5bb626bb1aabb | JavaScript | maximus92/projet-java | /WebContent/MyFirstScript.js | UTF-8 | 1,239 | 3.1875 | 3 | [] | no_license | function validateMyForm(){
var fName = document.forms["indexForm"]["fName"].value;
var lName = document.forms["indexForm"]["lName"].value;
var bDay = document.forms["indexForm"]["bDay"].value;
var sex = document.forms["indexForm"]["sex"].value;
if (fName == null || fName == "") {
alert("First Name mus... | true |
7d79a0f27e9e7528f538f83e081d622763c587c5 | JavaScript | tvc-school-org/react-challenge-app | /app/src/components/Home/html-css-js/L10JSOperators/index.jsx | UTF-8 | 8,533 | 2.859375 | 3 | [] | no_license | // L10JSOperatorsWithMath
import React from 'react'
import './style.css'
import { Table } from 'react-bootstrap'
import Pre from './../../elements/Pre'
import Code from './../../elements/Code'
import Lesson from '../../elements/Lesson'
import LessonSection from '../../elements/LessonSection'
import styles from './style... | true |
348ad14b512a576da522b22af655f94242a27cdf | JavaScript | chunpin629/find-recipe | /src/js/index.js | UTF-8 | 3,056 | 2.5625 | 3 | [] | no_license | import PageLoad from './models/PageLoad';
import Search from './models/Search';
import Recipe from './models/Recipe';
import Like from './models/Like';
import * as searchView from './views/searchView';
import * as recipeView from './views/recipeView';
import * as likeView from './views/likeView';
import { renderLoader,... | true |
d9158bbe74c9d8da105ae347004ad79ea06d55dc | JavaScript | nikolaharris/One-Rep-Max-Calculator | /main.js | UTF-8 | 253 | 3.0625 | 3 | [] | no_license | function calcMax() {
let w = Number(document.getElementById('w').value)
let r = Number(document.getElementById('r').value)
const x = .0333
let max = Math.floor(((w * r) * x) + w)
document.getElementById('max').innerHTML = max
} | true |
f0500484362d35b2481d4ff25392c0886eef5f27 | JavaScript | AlanTamez/server-router-model | /model.js | UTF-8 | 1,572 | 2.859375 | 3 | [] | no_license | const uuid = require('uuid');
let postDB = [
{
id: uuid.v4(),
title: "First Post",
content: "This is the content of my first post",
author: "AlanTamez",
publishDate: new Date(2018, 11, 24)
},
{
id: uuid.v4(),
title: "Second Post",
content: "This... | true |
17a5e5ae545651470a7531690dac1a05666a900b | JavaScript | sbrnation/fixit8KevinMurphy.appstudio | /forms/namesExtra/namesExtra.js | UTF-8 | 241 | 3.34375 | 3 | [] | no_license | //question2: Option B
let name = ["Bob", "Janet", "Tom", "Bob", "Randy", "Elizabeth", "Kim", "Nancy"]
function rName(name){
name.reverse()
return name
}
let rname =rName(name)
for (i=0; i<rname.length; i++)
console.log(rname[1]) | true |
5167baa9e87acf907bc817d4c6921b91bf907aef | JavaScript | LeoLe101/CF-2020 | /cloudflare-2020-general-engineering-assignment-main/sde-2021/index.js | UTF-8 | 4,354 | 2.625 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | // #region CONSTANTS
const HEADERS_JSON = {
'content-type': 'application/json;charset=UTF-8'
}
const HEADERS_HTML = {
'content-type': 'text/html;charset=UTF-8'
}
const LINKS = {
API_LINKS: [
{
"name": "Neighborhood Knockout (Global Game Jam 2020)",
"url": "https://globalga... | true |
15a5fbc08e05dc862b335fa3405f31f6636226a0 | JavaScript | Janice-M/React-Weather-App | /client/src/store/reducers/index.js | UTF-8 | 1,176 | 2.65625 | 3 | [] | no_license | import { SET_LOCATION_TEXT_INPUT, SET_LOCATION_RADIO_INPUT, SET_DEFAULT_INPUT,
LOADING_WEATHER_DATA, LOADED_WEATHER_DATA, ERROR_WEATHER_DATA } from '../actions/index';
const defaultState = {
locationData: '',
locationType: 'zipcode',
loading: true,
loaded: false,
error: false,
};
const rootReducer = funct... | true |
af3613391e8c6841bb790180809df9e8747f3303 | JavaScript | xinyzhang9/snh48_canvasgame | /js/game.js | UTF-8 | 3,665 | 3.1875 | 3 | [] | no_license | // Create the canvas
var w = window;
var canvas = document.createElement("canvas");
var ctx = canvas.getContext("2d");
canvas.width = w.innerWidth
canvas.height = w.innerHeight
document.body.appendChild(canvas);
// Background image
var bgReady = false;
var bgImage = new Image();
bgImage.onload = function () {
bgReady... | true |
bec588aa589bece6db105885c6b8cb85dd2db76f | JavaScript | rosogon/topology-editor | /js/editor/log.js | UTF-8 | 2,815 | 3.28125 | 3 | [
"Apache-2.0"
] | permissive | /**
* log4j-like logger.
*
* Usage:
* var log = Log.getLogger("my-package").setLevel(Log.DEBUG);
* log.debug("debug message");
* log.info("info message");
* log.warn("warn message");
*
*
* Comments:
* log.getLogger calls are cached. This allows to define a default level
* for the logger in th... | true |
32df7f0393d2e6201f2fdb40b0f8cdaf934e8ea2 | JavaScript | rnugraha/mobx-demo-examples | /src/4-reaction/reaction-1.js | UTF-8 | 1,198 | 3.6875 | 4 | [] | no_license | import { observable, reaction, autorun } from "mobx";
const todos = observable([
{
title: "Make coffee",
done: true
},
{
title: "Find biscuit",
done: false
}
]);
// wrong use of reaction: reacts to length changes, but not to title changes!
const reaction1 = reaction(
() => todos.length,
le... | true |
1799ba5611a688b7f0005a9df087ab12ba00ca3c | JavaScript | matthieuBA/JS | /script1.js | UTF-8 | 347 | 3.65625 | 4 | [] | no_license | var div = document.querySelector('.result');
div.innerHTML = "<h4>coucou depuis le JS : </h4><br/>";
div.innerHTML += "What is your name?<br/>";
console.log("coucou depuis la console");
let name = prompt("What is your name?");
div.innerHTML += "Hello ";
div.innerHTML += name+"<br/>";
alert("Hello, " + name);
console... | true |
d1c8447075ca951347bc29195769540c515819dd | JavaScript | DaniSmith03/Book-Keeping | /components/bookDetails.js | UTF-8 | 2,167 | 2.578125 | 3 | [] | no_license | import React, { useState, useEffect } from 'react';
import {styles} from '../styles';
import {Image, View, Text, TouchableOpacity, ScrollView} from 'react-native';
import {db} from '../firebase'
import {navigateActionFav, navigateActionHome, navigateActionStack} from './nav';
function bookDetails ({ route, navigation ... | true |
e06a013d29c997f63101f3105a5f84d5183b66f5 | JavaScript | skd1993/learning-nodejs | /app1.js | UTF-8 | 908 | 3.546875 | 4 | [] | no_license | // file system access
var fs = require('fs');
//synchronous method (blocking)
//complete this code block's exceution before moving on
var res = fs.readFileSync('readme.txt', 'utf8');
console.log(res);
fs.writeFileSync('write.txt', res);
//async versions; doesn't block the extra code after this
fs.readFile('readme.tx... | true |
44020035adb90bc740e9eef5b92b7296e9f7dbf3 | JavaScript | jysdu2006/GoodJob | /testFile/get/abc.js | UTF-8 | 524 | 2.78125 | 3 | [] | no_license | $(document).ready(function(){
$("form").submit(function(event) {event.preventDefault()})//取消submit的默认行为
$("form input[type='submit']").click(function(){
var url = $('form').attr('action'); // 取Form中要提交的链接
var param = {}; // 组装发送参数
param['name'] = $('form input[name=name]').val();
... | true |
c3ad1fd1854beae068f05e7d2fce252dfadc620a | JavaScript | SoleilQ/filemanager-plugin | /src/command/zip.js | UTF-8 | 1,148 | 2.5625 | 3 | [
"MIT"
] | permissive | const compressing = require('compressing');
const fsExtra = require('fs-extra');
import fs from 'fs';
import { handlerError, handlerInfo } from '../utils';
import path from 'path';
/**
* @desc Zip file/folder. Support zip, tar, gzip.
* @param source {string}
* @param destination {string}
* @param type {string}
* ... | true |
f9d1eb19f47b6e4ce84a31ea772d1dce9e7a000b | JavaScript | manthanshahdc/WEBD6201-Lab2 | /Scripts/registration.js | UTF-8 | 3,327 | 2.953125 | 3 | [] | no_license |
//Global Variables
var noErrors;
function validateField(id,value) {
if((id == 'fname') && value.length <= 1){
}else if((id == "lname") && value.length <= 1){
}else if(id="femail"){
}else if(id="pass"){
}else if(id="repassword"){
}
... | true |
bc638070827ca1773bde5cbeef8029f157e1c7ca | JavaScript | clagarejo/ListTodo | /js/index.js | UTF-8 | 385 | 2.5625 | 3 | [] | no_license | import Model from './model.js';
import View from './view.js';
// Agrego este evento para que el codigo JS se cargue despues de que todo el HTML se renderice
document.addEventListener('DOMContentLoaded', () => {
const model = new Model
const view = new View
// Asignamos lo que acabamos de instanciar
mod... | true |
4dc6d9a69c15d9a72725b6d5c8439d9f15138fac | JavaScript | alliestehney/redditFeed | /scripts.js | UTF-8 | 1,100 | 3.34375 | 3 | [] | no_license | $.get('https://www.reddit.com/r/aww/.json', function(data) {
// get top 10 posts (skip 1)
var listOfPosts = data.data.children; // returns an array
//go through each post
for (var i = 1; i < 11; i++) {
//gather data
var currentArticle = listOfPosts[i];
var title = currentArticle.data.title;
var th... | true |
2b8cacb616d11f90be9e41b4abd73d5e87fcb1d5 | JavaScript | LuisAngelBonCorpse/Generation | /js/12-ternario.js | UTF-8 | 154 | 3.28125 | 3 | [] | no_license | // el operador ternario e una abreviacion del if
const edad = 25;
const mensaje = edad > 18 ? "Eres mayor de edad" : "Eres menor"
console.log(mensaje); | true |
6a8744e2b9cf6e39a128e58c004662cbdf1ce0ec | JavaScript | joekarl/okcjs-2015-07-slides | /examples/color_animate/index.js | UTF-8 | 2,703 | 2.828125 | 3 | [] | no_license | const canvas = document.getElementById("webglCanvas"),
gl = canvas.getContext("webgl");
// shaders
const vertexShader = compileShader(gl, gl.VERTEX_SHADER,
`
attribute vec2 aVertexCoordinate;
attribute vec4 aVertexColor;
uniform mat4 uModelMatrix;
varying mediump vec4 vColor;
void main() {
gl_... | true |
8036e8103009bb4dfb2367012707a9f105049a80 | JavaScript | AlexanderKruk/you-dont-know-js | /types & grammar/2/19.js | UTF-8 | 184 | 3 | 3 | [] | no_license | function isNegZero(n) {
n = Number( n );
return (n === 0) && (1 / n === -Infinity);
}
console.log(isNegZero( -0 ));
console.log(isNegZero( 0 / -3 ));
console.log(isNegZero( 0 )); | true |
24058a824fc7ae8a6a00d942e0025b4ae199ec5b | JavaScript | olimorri/react-topics | /client/react-topics/src/App.js | UTF-8 | 1,599 | 2.78125 | 3 | [] | no_license | import { useEffect, useState } from 'react';
import './App.css';
import TopicList from'./TopicList/TopicList';
import ApiService from './ApiService';
import TopicInput from'./TopicInput/TopicInput';
function App() {
const [topics, setTopics] = useState([]);
const deleteTopic = (id) => {
ApiService.deleteTopi... | true |
83f28d7e5de2fd08a5987e681267c7b905565564 | JavaScript | nelrosn/skylessgtp | /web/javascript/library/Application.js | UTF-8 | 2,096 | 2.84375 | 3 | [] | no_license | /**
* @author Gean Junior
*/
Application = function Application() {}
Application.CONTENT = "#content"
Application.DEFAULT_PAGE = "view/default.php";
Application.MAIN_CONTROL = "controller/main.control.php";
Application.messages = new ApplicationMessages();
Application.prototype.login = function login(user, passwor... | true |
46318622ccb756849d3f70aa5d7b9390c12a00c6 | JavaScript | avishikhandelwal2008/P85 | /main.js | UTF-8 | 1,830 | 3.171875 | 3 | [] | no_license | var canvas=document.getElementById("myCanvas");
ctx=canvas.getContext("2d");
var car_width = 95;
var car_height = 95;
var car_x = 5;
var car_y = 225;
background_image = "parkingLot.jpg";
car_image = "car2.png";
function add() {
background_imageTag = new Image();
background_imageTag.onload = uploadBack... | true |
560345063c31c7feecccc850ff37bf0201d8f93c | JavaScript | williamcameron1998/constructor_hangman | /letter.js | UTF-8 | 310 | 2.875 | 3 | [] | no_license | var letter = function(getLetter) {
this.letter=getLetter;
this.appear = false;
this.letterRender = function() {
if(this.letter == ' ') {
this.appear = true;
return '';
}if(this.appear === false){
return '_';
}else{
return this.letter;
}
};
};
module.exports = letter; | true |
dda2b316883ba7fab3b94594f5af77dd3f44b1ba | JavaScript | OlenaKashuba/JS-Core-1-Exercises | /homework/ali/ex2.js | UTF-8 | 924 | 4.46875 | 4 | [] | no_license | // Write a function to log the grade of a student in an examination.
// The student will get A+ grade if the mark is in the range 90 - 100 (inclusive),
// A if the mark is in the range 80 - 89, B if the mark is in the range 70 - 79,
// C if the mark is in the range 60 - 69, D if the mark is in the range 50 - 59
//... | true |
95058e1edb9a7067a7bac1488c4eb0c98baa428a | JavaScript | krxxl/822905-what-to-watch-5 | /src/store/selectors.js | UTF-8 | 677 | 2.59375 | 3 | [] | no_license | import {createSelector} from 'reselect';
const getGenreActive = (state) => state.SHOW.genreActive;
const getFilms = (state) => state.DATA.films;
export const getGenres = createSelector(
[getFilms], (films) => {
let genres = [...new Set(films.map((film) => film.genre))];
genres.unshift(`All genres`);
... | true |
fd9a1f4db56a443cd3145744ec623f80b14aa9ed | JavaScript | KTTNDev/WebWorkRawai | /public/javascripts/ArabicToThaiNumber.js | UTF-8 | 4,103 | 3.453125 | 3 | [] | no_license | (function() {
const numbers = {
0: "zero", 1: "one", 2: "two", 3: "three", 4: "four", 5: "five", 6: "six", 7: "seven", 8: "eight", 9: "nine", 10: "ten", 11: "eleven", 12: "twelve", 13: "thirteen", 14: "fourteen", 15: "fifteen", 16: "sixteen", 17: "seventeen", 18: "eighteen", 19: "nineteen", 20: "twenty", 30: "... | true |
8193bb7bb046e03bf94d6a05db696b4e4beb3ebe | JavaScript | Ludmila-Brus/mesto | /src/components/UserInfo.js | UTF-8 | 1,568 | 2.75 | 3 | [] | no_license | class UserInfo {
constructor(profileInfoTitleSelector, profileInfoSubtitleSelector) {
this._profileInfo = document.querySelector('.profile-info');
this._profileInfoTitle = this._profileInfo.querySelector(profileInfoTitleSelector);
this._profileInfoSubtitle = this._profileInfo.querySelector(p... | true |