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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
aa639b875b9aedb866ae67f1865d7a307c0be198 | JavaScript | MarioGogogo/OneHundred-DayPlan-01 | /LeetCode_JS/数组/数组中的第K个最大元素.js | UTF-8 | 1,821 | 4.28125 | 4 | [] | no_license | /**
* 215-在未排序的数组中找到第 k 个最大的元素。
* 请注意,你需要找的是数组排序后的第 k 个最大的元素,而不是第 k 个不同的元素。
*/
// 输入: [3,2,1,5,6,4] 和 k = 2 (不一定是有序数列)
// 输出: 5
let nums = [3, 2, 1, 5, 6, 4];
var findKthLargest = function (nums, k) {
let res = nums.sort((a, b) => {
return a - b;
});
return res[k - 1];
};
console.log(
'%c 🍖 findKthLarg... | true |
fe6009da3260eb553b5674176e48de4f83444007 | JavaScript | ZiyongHe/bitGora | /client/src/utils/RateContext/index.js | UTF-8 | 1,272 | 2.578125 | 3 | [
"MIT"
] | permissive | import React, { useState, useEffect, useRef } from 'react'
const RateContext = React.createContext()
export function RateProvider(props) {
const [rate, setRate] = useState()
const id = useRef(0)
useEffect(() => {
// fetch Btc rate upon rendering
const query = 'https://api.coindesk.com/v1/bpi/currentpri... | true |
a0e32658d8552b555ed03aa9b3d887755e48912c | JavaScript | ACCode-art/Portfolio | /blog.js | UTF-8 | 6,179 | 3.15625 | 3 | [] | no_license | const menu = document.querySelector('.menu');
const menuIcon = document.querySelector('.menu-icon');
const blog = document.querySelector('.blog');
const blogTitle = document.querySelector('.blog__title');
const blogDate = document.querySelector('.blog__date');
const blogText = document.querySelector('.blog__text');
co... | true |
cd2cb07288992adf379f6ad73c919f9fc192d9d1 | JavaScript | lailazouaki/todo-app | /app/components/AddTodo.js | UTF-8 | 1,373 | 2.515625 | 3 | [] | no_license | var React = require('react');
var Modal = require('react-modal');
var AddTodo = React.createClass({
getInitialState: function (){
return {
modalIsOpen: false
}
},
openModal: function () {
this.setState({modalIsOpen: true})
},
closeModal: function () {
... | true |
b50127c94ae2a1508ac026f26d42f653d1e8defc | JavaScript | vaibhavdesai137/javascript-udemy | /Lecture-63-Object.create-And-Polyfill/app1.js | UTF-8 | 351 | 3.859375 | 4 | [] | no_license |
console.log("--------- app1.js ---------");
var person = {
fname: "Default",
lname: "Default",
greet: function () {
return "Hi " + this.fname;
}
};
var john = Object.create(person);
console.log(john);
john.fname = "John";
john.lname = "Doe";
console.log(john);
// o/p:
// Object {}
// Object... | true |
1c2d4aa9449894a39c9013ba1808b4a0bdfbed97 | JavaScript | GreenRabite/nodejs-mead | /notes-node/playground/debugg.js | UTF-8 | 291 | 3.171875 | 3 | [] | no_license | const person = {
name: "Andy"
};
person.age = 32;
debugger;
person.name = "Mike";
console.log(person);
// Debug Commands
// list(num) - List the num of lines
// n - next statement
// c - continute entire program to end
// repl - REPL mode
// debugger - 'c' will stop to this break point
| true |
b9b468963556f2a8d7df68491f8c35dd4bea036e | JavaScript | manish2bharti/data-structure-javascript | /Binary Search Tree/BST-reverseLevelOrderTraversal.js | UTF-8 | 2,140 | 4.71875 | 5 | [] | no_license | class Node {
constructor(value) {
this.val = value;
this.leftChild = null;
this.rightChild = null;
}
}
/**
* Given a binary tree print its level order traversal in reverse
* e.g 6
* 5 10
* -3 8 16
* 11
* Output ... | true |
82d2a742d85c5614bcd5e0e35ac88d19d10d68fe | JavaScript | Oleksandr2891/stopwatch | /src/App.js | UTF-8 | 2,428 | 2.6875 | 3 | [] | no_license | import React from "react";
import { useEffect, useState } from "react";
import { interval, Observable, Subject } from "rxjs";
import { takeUntil } from "rxjs/operators";
import Section from "./components/section/Section";
import Watch from "./components/watch/Watch";
import Button from "./components/button/Button";
co... | true |
5df4e24e8e4d241f498d23cc8f2eb67399192817 | JavaScript | Oksana1988/cellx | /tests/ObservableList.spec.js | UTF-8 | 7,118 | 2.734375 | 3 | [] | no_license | describe('ObservableList', function() {
if (!window.Symbol) {
window.Symbol = cellx.js.Symbol;
}
it('#sorted', function() {
let list = new cellx.ObservableList([4, 3, 1, 5, 2], {
sorted: true
});
expect(list.toArray())
.to.eql([1, 2, 3, 4, 5]);
});
it('#contains()', function() {
let list = new ... | true |
9fa0a732b0734932315ee7c0de6311a827471fce | JavaScript | foster55f/whats-new-with-hooks | /src/components/SearchForm/SearchForm.js | UTF-8 | 1,254 | 2.765625 | 3 | [] | no_license | import React, { Component } from 'react';
import './SearchForm.css';
class SearchForm extends Component {
constructor(props) {
super(props);
this.state = {
searchField: ''
}
}
// if ideas === []
// return <p>No Ideas Yet</p>
// logic can live anywhere in Componen... | true |
e0781c337458fad36c08878ab39d6a06b65af233 | JavaScript | khazaddoom/Learning-Fullstack | /public/browser.js | UTF-8 | 2,198 | 2.921875 | 3 | [] | no_license | const todoInputElement = document.getElementById('todo-input');
const todoList = document.getElementById('todo-list');
items.map(item => todoList.insertAdjacentHTML('beforeend', todItemTemplate(item)))
.join('');
document.getElementById('todo-form').addEventListener('submit', function (e) {
e.preventDefault(... | true |
42c9e20600b1cafcf1736822680e082e70bc34a9 | JavaScript | harshul1999/JSON-Final | /weather.js | UTF-8 | 777 | 3.15625 | 3 | [] | no_license | let weather;
let temp;
let weatherDiv = document.getElementById("Weather");
let weatherPara = document.getElementById("weatherPara");
let weatherBtn = document.getElementById("weatherBtn");
weatherBtn.onclick = checkWeather;
function checkWeather() {
fetch('https://api.openweathermap.org/data/2.5/weather... | true |
d59d432c465b1f4e626b9416a99757bc0fb93beb | JavaScript | nadsit/Study | /JS-Advanced/01.Syntax_Functions_And_Statements/P02.Syntax-Functions-And-Statements-Exercise/02-freatestCommonDivisor.js | UTF-8 | 302 | 3.34375 | 3 | [] | no_license | function solve(a, b) {
while (b) {
let temp = b;
b = a % b;
a = temp;
}
return a;
}
console.log(solve(15, 5));
console.log(solve(2154, 458));
//84/18 = 4 и остатък 12
//18/12 = 1 и остатък 6
//12/6 = 2 без остатък
//=> НОД(18,84) = 6 | true |
32fddddf9b516b55dd01cfb8ad9742646b74ce7f | JavaScript | airdox/animation-ria | /scripts/modules/booksApparitions.js | UTF-8 | 514 | 3.265625 | 3 | [] | no_license | /* Books appear when they are observable */
let booksItems = document.querySelectorAll('.book')
let observer = new IntersectionObserver(function (observables) {
observables.forEach(function (observable) {
if (observable.intersectionRatio > 0.5) {
observable.target.classList.add('effect')
... | true |
be5d54bc9a30f1391f3c7bf69ac68188ea2aed29 | JavaScript | NightTrek/AgroMation-smartGrow | /MQTT-controller/MQTT-Test.js | UTF-8 | 1,493 | 2.6875 | 3 | [] | no_license | const mqtt = require('./MQTT');
const testGetLiveData = async () => {
let res = await mqtt.connectAndGetLiveData("AgroOffice1");
if(res.main){
return true;
}
}
const testClientAndSub = async (count=0, stopcount=1) => {
try{
let client = await mqtt.createMqttClient();
try{
... | true |
c89900277d8bd07a91379282f6256e894dd01a28 | JavaScript | WatsonCIQ/fsbl-hosted | /dist/finsemble/common/AdapterReceiver.js | UTF-8 | 1,428 | 2.734375 | 3 | [] | no_license | import * as Utils from "./util";
/**
* Simple object to handle the loading and registration of storage adapters.
*
* @export
* @class AdapterReceiver
*/
export default class AdapterReceiver {
constructor() {
this.callbacks = {};
this.adapters = {};
this.storageAdapters = {};
this.loadModel = this.loadMo... | true |
b9d7acaf46a26302cd870353e87a941a7282dfb9 | JavaScript | parthibanloganathan/xpyre | /reverse_img_search.js | UTF-8 | 648 | 2.703125 | 3 | [] | no_license | //Usage: phantomjs reverse_img_search.js img_url
//returns: post.png, which should be ocr-friendly
var WebPage = require('webpage');
page = WebPage.create();
page.settings.userAgent = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.66 Safari/537.36';
img_url = phantom.args[... | true |
9d6657103b75b8911bf08593fbe1802f46ede9f0 | JavaScript | LInE-IME-USP/iVProg | /tests/test38.spec.js | UTF-8 | 841 | 2.796875 | 3 | [] | no_license | import { IVProgParser } from './../js/ast/ivprogParser';
import { IVProgProcessor} from './../js/processor/ivprogProcessor'
import { OutputTest } from './../js/util/outputTest';
import { LanguageService } from '../js/services/languageService';
describe('The write function', function () {
const code = `programa {
... | true |
7524a83d49ddb3cea2cec3a8cd0c982bdfff973f | JavaScript | mcdowell8023/webrtc_study | /demo/test3/filterCanvas.js | UTF-8 | 6,972 | 3.5625 | 4 | [] | no_license | /*
* @Author: mcdowell
* @Date: 2020-05-25 15:05:18
* @LastEditors: mcdowell
* @LastEditTime: 2020-05-25 15:23:20
*/
//灰度效果
function copy1(canvasContext, width, height) {
//获取ImageData的属性:width,height,data(包含 R G B A 四个值);
var imgdata = canvasContext.getImageData(0, 0, width, height)
for (var i = 0; i < imgd... | true |
e3502560ecf122bd4fb5a2de73eb24bdcb6fed27 | JavaScript | slobiiv/Practical-JS | /09.Data-types-and-comparisons/01.Data-types-overview.js | UTF-8 | 270 | 3.25 | 3 | [] | no_license | /*
* Objects (can be complex as you want)
{} - todoList, arrays, functions
* Primitives (building blocks)
- String 'A string'
- Number (1,2,3.5)
- Boolean (true, false)
- Undefined (value that hasn't been set)
- Null (nothing)
*/ | true |
5fdb8109d10c4a7018b5cc418500673613d187eb | JavaScript | MisherLiu/nodejs-training | /src/cases/core-api/parse-text/index.js | UTF-8 | 900 | 3.46875 | 3 | [] | no_license | /*
s是一个字符串
正常情况下 s的格式为 ID-NAME[USERNAME]:{DATE} (字符串不会含有空格换行符等)
例如 1-Alice,[ALICE1]:{20200202}
异常情况下 s的格式任意
请将字符串结构化并返回一个object
其中包含属性
id: number 无需前缀0
name: string
username: string
date: string
例如
return {
id: 1,
name: "Alice",
username: "ALICE1",
date: "20200202"
}
异常情况下,各字段请设置为null,并依然返回objec... | true |
1ae6e1cfcad01f3435953e6f299a3b243e787dc1 | JavaScript | Besker1/besker1.github.io | /studies/variables.js | UTF-8 | 3,028 | 4.4375 | 4 | [] | no_license | /*
* VARIABLES:
*
* 0. To hold things in memory during the life-cycle of a program, we can use variables. Variables
* are named identifiers that can point to values of a particular type, like a Number, String,
* Boolean, Array, Object or another data-type. Variables are called so because once created, we
* can ... | true |
8fdb09902fcb7bfac2bea2fc3044279d2be233cd | JavaScript | Hbentzur/a2z-DA-fin | /txtanalyser.js | UTF-8 | 1,361 | 2.6875 | 3 | [] | no_license | let fs = require('fs');
let origin = JSON.parse(fs.readFileSync('./txt/barthelmeunique.json', 'utf8'));
// Youtube
var youtubedl = require('youtube-dl');
// Sentiment Analysis
var natural = require('natural');
var Analyzer = require('natural').SentimentAnalyzer;
var stemmer = require('natural').PorterStemmer;
var ana... | true |
73e139108008d8a1def7434c0d80b21b3fa31232 | JavaScript | Zhekager/goit-js-hw-07 | /js/task-04.js | UTF-8 | 1,354 | 3.5625 | 4 | [] | no_license | // Счетчик состоит из спана и кнопок, которые должны увеличивать
// и уменьшать значение счетчика на 1.
// Создай переменную counterValue в которой будет хранится
// текущее значение счетчика.
// Создай функции increment и decrement для увеличения
// и уменьшения значения счетчика
// Добавь слушатели кликов на кноп... | true |
1c5631a318178836a4cbe489de02c99884bf5df8 | JavaScript | saisirisha1835/Soqqle---MERN | /src/theme/components/tasks/Achievement.js | UTF-8 | 5,940 | 2.65625 | 3 | [
"MIT"
] | permissive | /*
author: Anshul Kumar
*/
import React, { Component } from 'react';
import Modal from 'react-modal';
import PropTypes from 'prop-types';
import ActionLink from '~/src/components/common/ActionLink';
import '~/src/theme/css/achievement.css';
class Achievement extends React.Component {
constructor(props) {
su... | true |
73eb471880de72234286205e2bb0e77843d68727 | JavaScript | ijon9/SoftDev | /28_js/funky_town.js | UTF-8 | 521 | 3.515625 | 4 | [] | no_license | //Team [] -- Isaac Jon and Mohammed Uddin
//SoftDev1 pd6
//K#28 -- Sequential Progression
//2018-12-19
var fibonacci = function(n) {
if(n == 0)
return 0;
if(n < 2)
return 1;
else
return fibonacci(n-2) + fibonacci(n-1);
}
var gcd = function(a, b) {
if(a == 0)
return b;
return gcd(b%a, a);
}
... | true |
d1573b1ee929556917264c210fa36d497c84ea94 | JavaScript | Nepre/Nepre.github.io | /index.js | UTF-8 | 5,373 | 2.796875 | 3 | [] | no_license | var items = 18;
var examQuestions = [];
var right = 0;
var currentQuestion = 0;
var selected = -1;
var correctAnswer = -1;
function filltable(){
$.getJSON('verbs.json', function(data) {
var count = Object.keys(data).length;
const params = new URLSearchParams(document.location.search);
page... | true |
b7af54f7a0a76682415fd25990d7748bd29e470e | JavaScript | rahulchougule/mern-project | /client/src/service/userservice.js | UTF-8 | 1,117 | 2.515625 | 3 | [] | no_license | class UserService{
createUser(user, token){
let promise = fetch("http://localhost:4040/api/user", {
method:"POST",
headers:{
"Content-type":"application/json",
... | true |
bc7b4458bfbcec8957b8723843572d59a7634934 | JavaScript | yichunhuang/TodoList-AWS-Lambda-ApolloGraphQL | /graphql/todo.test.js | UTF-8 | 2,523 | 3 | 3 | [] | no_license | const TodoAPI = require('./todo.js');
const todoAPI = new TodoAPI();
todoAPI.initialize({ context:{} });
test('get all todos', async () => {
const allTodos = await todoAPI.getAllTodos();
expect(Array.isArray(allTodos)).toBe(true);
allTodos.forEach(todo => {
expect(Object.keys(todo).sort()).toEqual... | true |
b1df87c54edf38c9f2843724e14118dcf30604f2 | JavaScript | stashimi/serverless-z | /lib/utils/index.js | UTF-8 | 11,564 | 2.515625 | 3 | [
"MIT"
] | permissive | 'use strict';
/**
* Serverless: New Utilities
* - Cleaner, stable utilities for plugin developers.
* - Be sure to use fs-extra, instead of writing utilities, whenever possible
*/
require('shelljs/global');
let BbPromise = require('bluebird'),
rawDebug = require('debug'),
path = require('... | true |
29693aa469bf73e09bfd45ac06ba4724fad0b317 | JavaScript | Avika-Coder/-Class-80-Adding-Sound-and-Score-Homework | /ACA-80-Homework/sketch.js | UTF-8 | 2,391 | 2.8125 | 3 | [] | no_license | const Engine = Matter.Engine;
const Composite = Matter.Composite;
const Bodies = Matter.Bodies;
const Constraint = Matter.Constraint;
var engine, world;
var ground, arrow, clown1, clown2, clown3, clown4, clown5;
var apple1, apple2, log1, log2, log3, log4, backgroundImage;
var slingshot, gameState = "onSling";
var sele... | true |
4b2759b4094f1896003e5fe3d34726b73b4d0744 | JavaScript | jervis446/Editor-IDE | /Server/app.js | UTF-8 | 2,532 | 2.515625 | 3 | [] | no_license | const express = require('express');
const bodyParser = require('body-parser');
const cors = require('cors');
const app = express();
app.use(cors());
app.use(bodyParser());
const proxy = require('redbird')({
port: 80,
xfwd: true,
letsencrypt: {
path: __dirname + '/certs',
port: 9999,
},
ssl: {
http... | true |
1982f977b6028d88d93dc97a6dc1658fab9de283 | JavaScript | Inviz/better-dom | /src/Node.events.js | UTF-8 | 11,298 | 2.59375 | 3 | [
"MIT"
] | permissive | define(["Node", "Node.supports"], function($Node, $Element, SelectorMatcher, EventHandler, _forEach, _forOwn, _slice, _makeError) {
"use strict";
// DOM EVENTS
// ----------
(function() {
var eventHooks = {},
legacyCustomEventName = "dataavailable";
/**
* Bind a D... | true |
afc5597e635324eaaffd4f58bf1e6782e20a1804 | JavaScript | walzerm/global-health-obesity | /public/js/app.js | UTF-8 | 8,848 | 2.734375 | 3 | [] | no_license | //world map template from https://vida.io/gists/oaYRaR8EwvpEnXBbM
var dataValues = {};
//default year
var year = 1990;
var country;
//sets the color scale
var color = d3.scale.threshold()
.domain([-23, -22, -21 -20, -19, -18, -17, -16, -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0... | true |
121f3bcf3e98c7f596e0385a0da4baa315c7fe3b | JavaScript | anandgeorge/bitcoinjs-transactions | /primitives.js | UTF-8 | 476 | 3.3125 | 3 | [] | no_license | function ArraySource(rawBytes, index) {
this.rawBytes = rawBytes;
this.index = index || 0;
}
ArraySource.prototype = {
readByte: function() {
if (!this.hasMoreBytes()) {
throw new Error('Cannot read past the end of the array.');
}
return this.rawBytes[this.index++];
... | true |
f5f640d6716e376debce3c5afb901e646bb7625b | JavaScript | marcopeg/stuffer | /docs/services/stuffer/ssr/lib/dates.js | UTF-8 | 433 | 2.96875 | 3 | [] | no_license |
const zeroPad = d => ('0' + d).slice(-2)
export const date2obj = date => ({
YYYY: date.getUTCFullYear(),
MM: zeroPad(date.getMonth() + 1),
DD: zeroPad(date.getDate()),
hh: zeroPad(date.getHours()),
mm: zeroPad(date.getMinutes()),
ss: zeroPad(date.getSeconds()),
})
export const date2pg = date ... | true |
abc9badcdb46f3351b8d60694a4145260e8c1060 | JavaScript | dmiyamoto/mine_sweeper | /js/render.js | UTF-8 | 10,158 | 3.1875 | 3 | [] | no_license | /*
現在の盤面の状態を描画する処理
*/
const canvas = document.getElementsByTagName( 'canvas' )[ 0 ]; // キャンバス
const ctx = canvas.getContext( '2d' ); // コンテクスト
const W = 500, H = 500; // キャンバスのサイズ
const COLS = 10, ROWS = 10; // 横10、縦10マス
const BLOCK_W = W / COLS, BLOCK_H = H / ROWS; // マスの幅を設定
let x = 0; //座標取得用変数のCOLS用
let y = 0... | true |
23553780f2bf9cf9e6035cb82aa15afa35711905 | JavaScript | Tabitha13/Westfall_Tabitha_WPF | /Functions_Worksheet/Circumference/js/script.js | UTF-8 | 362 | 4.03125 | 4 | [] | no_license | //Tabitha Westfall 2/23 Functions Worksheet- Circumference
var radius = 5; //given
var pi = 3.14; // given
var circ = calcCirc(radius, pi); //result variable //arguements
console.log("The circumference of the circle is " + Math.round(circ) + "."); //print circumference to console
function calcCirc(r, p){ //paramete... | true |
b1db616a3eecf0a74999c2bd6c8623ef5c12059e | JavaScript | mattcosta7/webpack-stats-diff | /src/print/markdown.js | UTF-8 | 2,653 | 3 | 3 | [
"MIT"
] | permissive | const TABLE_HEADERS = ['Asset', 'Old size', 'New size', 'Diff', 'Diff %'];
const conditionalPercentage = number =>
[Infinity, -Infinity].includes(number) ? '-' : `${number.toFixed(2)} %`;
const capitalize = text => text[0].toUpperCase() + text.slice(1);
const makeHeader = columns =>
`${columns.join(' | ')}\n${colu... | true |
4ad4f73f14dabdba9a4439e3d342163d34959eba | JavaScript | v3rt1go/nodeschool | /learnyounode/httpClient.js | UTF-8 | 607 | 3.140625 | 3 | [] | no_license | 'use strict';
// This function reads data from a given url and outputs every data event to the
// console
const http = require('http');
http.get(process.argv[2], (res) => {
res.setEncoding('utf8');
res.on('err', console.error);
// We can pass directly a function without calling it and the callback will
// h... | true |
1155000ff69103bab58a793cabf25fd19717d468 | JavaScript | AndreasAskjem/Oppgaver | /Yatzy/yatzy.js | UTF-8 | 10,869 | 3.5 | 4 | [] | no_license | // Saves names as objects before replacing the HTML of the page with the game.
//////////////////////////////////////////////////////////////////////////////
let playerList = [];
document.getElementById('username').focus();
function nameIsSubmitted(){
inputField = document.getElementById('username');
let submit... | true |
08573f51e1efa0fb41be35ea42240ac799bd5c18 | JavaScript | 007c/classes | /add-two-numbers.js | UTF-8 | 1,405 | 3.8125 | 4 | [] | no_license | /**
* You are given two non-empty linked lists representing two non-negative integers.
* The digits are stored in reverse order and each of their nodes contain a single digit.
* Add the two numbers and return it as a linked list.
You may assume the two numbers do not contain any leading zero, except the numbe... | true |
f689866014dd297fe8dc93b98f5dd409e268e8cc | JavaScript | surazgyawali/code-challanges-beginner | /max3num.js | UTF-8 | 501 | 3.65625 | 4 | [
"CC0-1.0"
] | permissive | function UserInput(){
print("Enter 3 numbers:");
var a=readline();
var b=readline();
var c=readline();
return [a,b,c];
}
function max3num(num1, num2, num3) {
var max_so_far = num1;
if (num2 > max_so_far) {
max_so_far = num2;
}
if (num3 > max_so_far) {
max_so_far = num3;
}
... | true |
ce75c0806f2c8916beb5f1d37a01f115267f18bf | JavaScript | Tanmay53/cohort_3 | /submissions/sm_037_srikanth/week_03/day_5/session_1/findAverageMarks.js | UTF-8 | 298 | 3.015625 | 3 | [] | no_license | student = {
name:'Raj',
marks: [50,30,100,80]
}
function averageMarks(student){
sum=0;
for(i=0;i<student.marks.length;i++){
sum = sum + student.marks[i];
}
var averageMarks= sum / student.marks.length;
return averageMarks;
}
console.log(averageMarks(student)); | true |
a6de2c863cb05b5160063a1941aa41e58331e82d | JavaScript | josecarneiro/transportes.live | /worker/metro/helpers/extract-position.js | UTF-8 | 2,847 | 2.5625 | 3 | [] | no_license | 'use strict';
const { log } = require('transportes/utilities');
const lines = require('transportes/metro/data/lines');
const destinations = require('transportes-bundled-data/dist/metro/destinations');
const extractTrains = require('./extract-trains');
const getAdjacentPreviousStation = (line, currentStation, direct... | true |
0ed1d29493222934163c58cabecd397d1aa2c4ff | JavaScript | trenbail/food-register-backend | /src/domain/beans/OrderItem.js | UTF-8 | 183 | 2.546875 | 3 | [] | no_license | class OrderItem {
constructor(itemName, itemQuantity, itemType){
this.itemName = itemName;
this.quantity = itemQuantity;
this.itemType = itemType;
}
}
| true |
3dcb796be2705c796a9645494e31fe1f880b05a8 | JavaScript | i-wangxiaoqing/ask | /thinkphp-3.2/Public/js/func-board.js | UTF-8 | 1,635 | 2.59375 | 3 | [
"MIT"
] | permissive | var QiangdaRunning = false;
$("#but0").click(function() {
alert(111)
$("#Delay").val(Number($("#Delay").val()));
$("#TimeOut").val(Number($("#TimeOut").val()));
$("#but0").html("正在发送请求");
var delay=$("#Delay").val();
var timeout=$("#TimeOut").val();
$.ajax({
type: 'POST',
url: '/tp/public/php/newqd.php',
d... | true |
254e041d9218debc5c81e002e0154030aca11018 | JavaScript | turathalanbiaa/alturath-alqurani | /src/data/action/category_actions.js | UTF-8 | 1,582 | 2.515625 | 3 | [] | no_license | import axios from 'axios';
const booksCategoryUrl = "http://quran.turathalanbiaa.com/api/books-library-categories";
const audioCategoryUrl = "http://quran.turathalanbiaa.com/api/audio-categories";
const videoCategoryUrl = "http://quran.turathalanbiaa.com/api/video-categories";
export function fetchBooksLibraryCategor... | true |
42fd5283ffc59288f046d1ec7c6dd3953b989715 | JavaScript | jroehl/linkedin-portfolio-backend | /src/server/server-utils.js | UTF-8 | 1,354 | 2.53125 | 3 | [
"MIT"
] | permissive | import { columnToLetter } from '../utils';
/**
* Publish the spreadsheet to the web
*
* @export
*/
export const publishToWeb = () => {
const ss = SpreadsheetApp.getActiveSpreadsheet();
const fileId = ss.getId();
const revisions = Drive.Revisions.list(fileId);
const { items } = revisions;
const revisionId... | true |
50c4083d934dda0986605db20f41bf681b11ccab | JavaScript | seankrummel/sezzleInterviewChallengeClient | /src/components/calculator.js | UTF-8 | 4,222 | 2.796875 | 3 | [] | no_license | import React from 'react';
import {connect} from 'react-redux';
import {postEquation, fetchLogs} from '../actions/log';
class Calculator extends React.Component {
constructor(props) {
super(props);
this.state = {
display: ''
}
}
componentDidMount() {
this.props.dispatch(fetchLogs());
t... | true |
fa3fd0bd4ac8d000f588eb46cc4f258f0571bec5 | JavaScript | glamboyosa/campmason | /src/Store/reducer/registerReducer.js | UTF-8 | 1,142 | 2.671875 | 3 | [] | no_license | import * as actionTypes from '../actions/actionTypes';
const initalState = {
loading: false,
error: null,
phone: null
};
const reducer = (state = initalState, action) => {
switch (action.type) {
case actionTypes.REGISTER_START:
return {
...state,
loading: true
};
case actionT... | true |
0ab55163c624d938b12f9b7fd7376d35484af467 | JavaScript | SilmarSilva/studyingJS | /developerMozillaOrg/javascript/variaveis/variaveis.js | UTF-8 | 323 | 3.46875 | 3 | [] | no_license | var button = document.querySelector('button');
button.onclick = function(){
var nome = prompt('Qual é o seu nome?');
alert('Olá ' + nome + ', é um prazer te ver!');
}
if(nome === 'Adão'){
alert('Olá Adão, é um prazer te ver!');
} else if(nome === 'Alen'){
alert('Olá Alan, é um prazer te ver!');
} | true |
38588896f8c6261b16b93a0b3c5c19f53be98646 | JavaScript | lordtryndamere/myclassflix_backend | /controllers/gradeController.js | UTF-8 | 1,823 | 2.6875 | 3 | [] | no_license | var Grade = require('../models/gradeModel');
var moment = require('moment');
var GradeController = {
createGrade(req,res){
var items = req.body;
var grade = new Grade();
var name = items.name;
if(name){
grade.name = name
grade.created_at = moment().uni... | true |
a2650fe0ecea96af2e063f96a71bd5db547fceaa | JavaScript | Niordsid/GraphicCharsPage | /resources/js/create_class/create_class.js | UTF-8 | 4,269 | 2.671875 | 3 | [] | no_license | //------------------------------------------------------
// GLOBAL VARIABLES
//------------------------------------------------------
var students = [];
var teachers = [];
var initialize = function() {
getListStudents(function(_students) {
students = _students;
renderStudents();
});
getListTeachers(... | true |
3b9428f30b2683f0b3b0b3798cddc39c60428472 | JavaScript | mbarzilai/Trip-Planner-Front-End | /src/marker.js | UTF-8 | 821 | 2.9375 | 3 | [] | no_license | const mapboxgl = require('mapbox-gl');
function marker(type, coords) {
type = type.toLowerCase();
const markerDomEl = document.createElement('div'); // Create a new, detached DIV
markerDomEl.style.width = '32px';
markerDomEl.style.height = '39px';
switch (type) {
case 'activity':
markerDomEl.style... | true |
57bbcefeeedbfa0543f87955067db7b5f349ec18 | JavaScript | Sandrita41/javaScritp | /masyvai.js | UTF-8 | 794 | 3.40625 | 3 | [] | no_license | "use strict"
// Masyvas - tai sąrašas elementų
let m = [5, 87, "labas", false, "!", 5];
console.log(m[2]);
m[1] = true;
console.log(m.length);
//
let km = m;
km[0] = "pakeičiau";
console.log(m);
console.log(km);
// Masyvas JS'e yra objektas
/*
1. Masyvas turi spec savybę "lenght"
2.
*/
console.log("=== 1 ===");... | true |
50bbca2a4a5fdfcfc363c4687bf2822e858ce7eb | JavaScript | ForeverSc/code-kata | /src/answer.js | UTF-8 | 854 | 3.09375 | 3 | [] | no_license | /**
* @example
* hand(["A♠", "A♦"], ["J♣", "5♥", "10♥", "2♥", "3♦"])
* // ...should return {type: "pair", ranks: ["A", "J", "10", "5"]}
* hand(["A♠", "K♦"], ["J♥", "5♥", "10♥", "Q♥", "3♥"])
* // ...should return {type: "flush", ranks: ["Q", "J", "10", "5", "3"]}
*/
const nums = ['A', 'K', 'Q', 'J', '10', '9', '8... | true |
fe5f48f1835e21a8f62ab2a3306f2173858f33ff | JavaScript | geocodinglife/JavaScript-autumn-2020 | /exercises/bmi/bmi.js | UTF-8 | 1,228 | 3.65625 | 4 | [] | no_license | const showDateTime = () => {
const now = new Date()
const date = now.getDate()
const month = now.getMonth() + 1
const year = now.getFullYear()
const hours = now.getHours()
const minutes = now.getMinutes()
const seconds = now.getSeconds()
return `${date}/${month}/${year} ${hours}:${minutes}: ${seconds}`... | true |
e32f1acd1b0ae027d72006b4de30f84c99d271cb | JavaScript | jpadilla/denali | /lib/data/serializer.js | UTF-8 | 2,466 | 2.984375 | 3 | [
"MIT"
] | permissive | /**
* Serializers allow you to customize what data is returned in the response and
* apply simple transformations to it. They allow you to decouple what data is
* sent from how that data is structured / rendered.
*
* @class Serializer
* @module denali
* @submodule data
*/
export default class Serializer {
s... | true |
a4835a25be1703cd68d9df463c413d7c63cf0015 | JavaScript | afeidexiaolulu/pro-code-bim2 | /bim-web/src/main/resources/static/webAppJs/ZhiU_Engine/zhiu_Core/zv_visibilitymanager.js | UTF-8 | 13,356 | 2.671875 | 3 | [] | no_license |
(function() {
'use strict';
var zv = ZhiUTech.Viewing,
zvp = zv.Private;
var VisibilityManager = function(viewerImpl, model) {
this.viewerImpl = viewerImpl;
//Currently the visibility manager works on a single model only
//so we make this explicit here.
this.model = model;
// Keep track of isolated... | true |
4cbb956612523409e000bf0e0d1e88b0ab4c191a | JavaScript | xingkongzyx/react-redux | /widget-in-hook/src/Components/Search.js | UTF-8 | 1,966 | 2.875 | 3 | [] | no_license | import React, { useState, useEffect } from 'react';
import axios from 'axios';
const Search = () => {
const [searchTerm, setSearchTerm] = useState('');
const [searchResults, setSearchResults] = useState([]);
// 当input中的value有change的时候更新state(searchTerm)
const onTermChange = (event) => {
setSearchTerm(event.tar... | true |
a1a82899ab646a8ecf0e3d59316cd959d741ed35 | JavaScript | yashvantys/shecabs | /assets/custom/survey/js/acknowledge.js | UTF-8 | 1,209 | 2.53125 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | jQuery(document).ready(function() {
$('body').css('overflow','hidden');
$('body').css('position','fixed');
$('body').css('width','100%');
$('#modal_ack').modal('show');
$('.close').hide();
});
$("body").on("click", "#cancel_form", function(e){
e.preventDefault();
var url = SurveyView.base_url + "user/lo... | true |
e83651f6c6ea6104a6418d7dcbc480c6e166953c | JavaScript | Geimaj/getnicked | /src/server/app.js | UTF-8 | 3,076 | 2.921875 | 3 | [] | no_license | const fetch = require('node-fetch')
const express = require('express')
const os = require('os')
const conf = require('../../conf')
const WORDNIK_API_KEY = (conf[0].WORDNIK_API_KEY)
const WORDNIK_URL = `http://api.wordnik.com/v4/words.json/randomWord?api_key=${WORDNIK_API_KEY}`
const WORDNIK_SEARCH_URL = `https://api.... | true |
8f1117b9004fc5b6c0667b57124e276b00360e73 | JavaScript | ths887/website | /signup.js | UTF-8 | 881 | 3.1875 | 3 | [] | no_license | let first = document.getElementById("first");
let last = document.getElementById("last");
let pass = document.getElementById("pass");
let email = document.getElementById("email");
function validation(){
if(first.value.trim()==""){
alert("firstname cannot be empty");
return false;
... | true |
d635444f9035fc012e8f73fbc0aa0bd93f8b8a62 | JavaScript | ThundroD/bootcamp | /Module 1/Task 18/CapStone/Styling/index.js | UTF-8 | 742 | 2.765625 | 3 | [] | no_license | $( document ).ready(function() {
console.log( "ready!" );
//slide up and down the quote with a chain function
$(".lead").slideUp(2000).slideDown(2000).animate({height: '200px', opacity: '0.3', fontSize: '60px'}, "slow");
//Email
document.querySelector('#contact-form').addEventListener('submit', function (e... | true |
fb655bfedf797d338fa4a852f5e848330603963a | JavaScript | diversen/project-euler | /24.js | UTF-8 | 1,004 | 4.15625 | 4 | [] | no_license | /**
* A permutation is an ordered arrangement of objects. For example, 3124 is one
* possible permutation of the digits 1, 2, 3 and 4. If all of the permutations
* are listed numerically or alphabetically, we call it lexicographic order. The
* lexicographic permutations of 0, 1 and 2 are:
*
* 012 021 102 12... | true |
efec9dd25eba259a85d9bc934a41aea16fea9100 | JavaScript | juanmrad/express-session-example | /server.js | UTF-8 | 1,267 | 2.5625 | 3 | [] | no_license | const express = require('express');
const app = express();
const session = require('express-session');
// app middleware to parse body and requests
app.use(express.json());
app.use(express.urlencoded({extended: true}))
// add middleware to initialize session
app.use(session({
secret: 'tacocat',
resave: true,
sa... | true |
4ff961c923915615b85d25f0057fc4cdb89fdb21 | JavaScript | maguas01/hackerRank | /jScriptStuff/GameOfThronesI.js | UTF-8 | 1,402 | 3.984375 | 4 | [] | no_license | /*
Dothraki are planning an attack to usurp King Robert's throne. King Robert learns of this
conspiracy from Raven and plans to lock the single door through which the enemy can enter his
kingdom.
But, to lock the door he needs a key that is an anagram of a certain palindrome string.
The king has a string composed of l... | true |
c6cc5a2e04bf04a65bc2619cfe3402227383f49e | JavaScript | omerbaki/WordCounter | /word-count-reducer/src/index.js | UTF-8 | 973 | 2.5625 | 3 | [] | no_license | import dotenv from 'dotenv';
import 'regenerator-runtime/runtime';
import queueReader from '../../queues-emulator/queueReader';
import db from '../../document-db-emulator/db';
dotenv.config();
const reduceAndUpdateDb = async () => {
console.log("start word count reducer");
let finalCount = JSON.parse(awai... | true |
c2946c76f9485f8c909163eb26975c486e87e7d4 | JavaScript | NestorV95/groupley-frontend | /src/redux/actions/currentUser/UpdateUser.js | UTF-8 | 710 | 2.609375 | 3 | [] | no_license | import {fetchUserRequest, fetchUserSuccess, fetchUserFailure} from './fetchUser'
const UpdateUser = (log) => async (dispatch) =>{
dispatch(fetchUserRequest())
const req={
method: 'PATCH',
headers: {
'Content-Type':'application/json',
'Accept':'application/json',
... | true |
cc6e1e2b2416559c9a63e4ed1957003910887178 | JavaScript | pangeon/JQueryTrain | /js/effects.js | UTF-8 | 282 | 2.734375 | 3 | [
"MIT"
] | permissive | // https://api.jquery.com/hover/#hover-handlerIn-handlerOut
$("td").hover(
function() {
$(this).css("background-color", "red");
}, function() {
$(this).css("background-color", "white");
}
);
$("td.fade").hover(function() {
$(this).fadeOut(100);
$(this).fadeIn(500);
}); | true |
91a3facf3e3867c4d70136e39e4cff2a32e55a65 | JavaScript | snorristurluson/sprites | /contactlistener.js | UTF-8 | 910 | 2.59375 | 3 | [] | no_license | function getContactListener() {
var listener = new Box2D.JSContactListener();
listener.BeginContact = function(contactPtr) {
var contact = Box2D.wrapPointer( contactPtr, Box2D.b2Contact );
var fixtureA = contact.GetFixtureA();
var fixtureB = contact.GetFixtureB();
var entityA =... | true |
19326bec6647808fc029498c1758c463544a4bd8 | JavaScript | reneleyva/laberet | /js/validationInicarSesion.js | UTF-8 | 1,136 | 2.671875 | 3 | [
"MIT"
] | permissive | function isValidEmailAddress(emailAddress) {
var pattern = /^([a-z\d!#$%&'*+\-\/=?^_`{|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+(\.[a-z\d!#$%&'*+\-\/=?^_`{|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+)*|"((([ \t]*\r\n)?[ \t]+)?([\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-... | true |
b93e9cd3c926709d32e476da6f2bb55eb841335a | JavaScript | ArjunAtlast/js-datastructure | /dist/ds/abstract/abstract-graph.js | UTF-8 | 4,850 | 3.03125 | 3 | [
"MIT"
] | permissive | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const graph_1 = require("../../interfaces/graph");
const abstract_set_1 = require("./abstract-set");
const abstract_map_1 = require("./abstract-map");
/**
* Abstract implementation of graph interface
*/
class AbstractGraph {
constructor() ... | true |
187998cc860036cd31cebac59b9a9f5190617520 | JavaScript | WhiteApfel/moy-nalog | /index.js | UTF-8 | 8,531 | 2.828125 | 3 | [
"MIT"
] | permissive | const fetch = require('cross-fetch')
/**
* Добавление продаж / создание чеков прихода
* в МойНалог https://lknpd.nalog.ru/
* @param {string} login - логин(обычно ИНН) от личного кабинета
* @param {string} password - пароль
* @param {boolean} autologin=true - сразу запускать .auth в конструкторе класса
* @propert... | true |
58f0634eccf71b51f3d8e724dfd85e4f168ffebf | JavaScript | julianoperin/Planet-Games | /src/util.js | UTF-8 | 519 | 2.796875 | 3 | [] | no_license | // Resize the images
export const smallImage = (imagePath, size) => {
// In case there is no search
if (!imagePath) return null;
const image = imagePath.match(/media\/screenshots/)
? imagePath.replace(
"media/screenshots",
`media/resize/${size}/-/screenshots`
)
: imagePath.replace("... | true |
f2b95af122e4d55100a893db91ff83866c61e4e4 | JavaScript | JEHatred/Web_Programming | /0010_14/Objetos/app.js | UTF-8 | 323 | 3.921875 | 4 | [] | no_license | var person = {
fistName: 'Javier',
lastName: 'Mota',
greet: function (){
console.log(`Hello Mr. ${this.fistName} ${this.lastName}`);
}
}
console.log(person.fistName);
console.log(person.lastName);
person.greet();
console.log(person['fistName']);
console.log(person['lastName']);
person['greet']... | true |
0c73c9a9e834583b54100fa16235f2603221945d | JavaScript | UTVova/industrial-ui | /lib/utils/compose-classes.js | UTF-8 | 358 | 3.03125 | 3 | [
"MIT"
] | permissive | /**
* Compose classes to pass to components' wrapper element
*
* @param {string} args – array of strings of one or many classes
* @returns {string|null} – string of nicely concatenated classes passed into the component
*/
export default (...args) => {
let classes = args.join(' ').trim().replace(/ false | +/g, '... | true |
2911f6dc0d3c5a2d63ae9b6ef0ac0a2073698ba3 | JavaScript | djux1990/networkvisualizer | /utility/logUtility.js | UTF-8 | 492 | 2.828125 | 3 | [] | no_license | const shell = require('shelljs');
/**
* To return the fileName corresponding to the current date
*
* @returns File Name in string
*/
var getFileName = () => {
let currentDate = new Date();
return `${currentDate.toDateString().replace(/ /g, '_')}.log`
}
// To check if all the directories in the given path ... | true |
6644460c0cb8c013a444af613d36c30967984731 | JavaScript | BrainBuzzer/myreads | /src/components/Home.js | UTF-8 | 4,696 | 2.703125 | 3 | [] | no_license | import React, { Component } from 'react'
import * as BooksAPI from '../utils/BooksAPI.js'
import FaSearch from 'react-icons/lib/fa/search'
import { Link } from 'react-router-dom'
import { chunk } from '../utils/helper'
import BookRow from './BookRow'
import PropTypes from 'prop-types'
/**
* Home page
*
* @class Hom... | true |
6c7aac7261995f2eb480156658a3b5d4f97f2af2 | JavaScript | a-borisov1/movies-list | /src/components/AutocompleteForm.js | UTF-8 | 1,229 | 2.515625 | 3 | [] | no_license | import React from "react";
import { RatingPalette } from "./RatingPalette";
import { movies } from "../utils/constants";
export const AutocompleteForm = ({
pickMovie,
searchValue,
currentRating,
currentGenre
}) => {
const moviesClone = movies.slice();
const filteredByName = moviesClone.filter(
(item) ... | true |
ec477729daf042751e3d34c2b543c6578a743f55 | JavaScript | ninja-programmer-academy/week2-day2-json-localstorage | /app.js | UTF-8 | 1,899 | 3.546875 | 4 | [] | no_license | const giphyKey = "J1noCVxuNpIkjrmWc9LZUCtzfUezIF8D";
const form = document.getElementById("nameform");
//helper function to retrieve gif
function gif(q) {
//returns a promise
//ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
return new Promise(function(resolve... | true |
4725f97d28e1c7264a8414370df8e9ce2e08f113 | JavaScript | damnko/manage-income-expense | /models/Summary.js | UTF-8 | 4,521 | 2.53125 | 3 | [] | no_license | var getResults = {
getMeans: function(email, year, callback){
// DB object
var db = require('../config/db').getDb();
// DB find expense summary for selected period
db.collection('transactions').aggregate([
{
$match: {
date: {
$gte: new Date(year,0,1),
$lte: n... | true |
e2f9196fe58602a318697ae5e06367231207164e | JavaScript | Ryazapov/hot-coffee | /app/assets/javascripts/current_coordinates.js | UTF-8 | 980 | 2.796875 | 3 | [] | no_license | const KAZAN_LATITUDE = 55.788258;
const KAZAN_LONGITUDE = 49.119290;
class CurrentCoordinates {
constructor(coordinates = []) {
this.latitude = coordinates[0] || KAZAN_LATITUDE;
this.longitude = coordinates[1] || KAZAN_LONGITUDE;
this.getCurrentPosition();
}
getCurrentPosition() {
if (navigator... | true |
7ba78e56c235f7fae6138a678187961b25f514fe | JavaScript | levaleks/js-camp-2-mocha-chai | /test/timeout.test.js | UTF-8 | 1,694 | 2.921875 | 3 | [] | no_license | const { assert } = require('chai');
const { sleep, timeout } = require('../timeout');
/**
* Sleep
*/
describe('sleep', () => {
let startTime;
beforeEach(() => {
startTime = Date.now();
});
it('should sleep at least 0ms', async () => {
await sleep(0);
const endTime = Date.now();
const tim... | true |
03fd58fc5af16e62ce646dcdd7b18a886b915d46 | JavaScript | ricochetGobz/ricochet_test_communication | /server/render/app/main.js | UTF-8 | 1,764 | 2.71875 | 3 | [] | no_license | /**
*
* app/main.js
* The entry point of your javascript application.
*
**/
import WSConnection from './core/WSConnection';
const _WSConnection = new WSConnection();
const DOMInstallStatus = document.getElementById('install-status');
const DOMDebug = document.getElementById('debug');
const DOMEvents = document.getEle... | true |
a37f81626d689bfdd40266d04ff8deb2233ddd00 | JavaScript | Omniwallet/bitcoinjs-lib | /src/bitcoin.js | UTF-8 | 1,892 | 2.6875 | 3 | [
"BSD-3-Clause",
"MIT"
] | permissive | (function() {
/*
* BitGo additions for globally selecting network type
*/
Bitcoin.setNetwork = function(network) {
if (network == 'prod') {
Bitcoin.network = 'prod';
Bitcoin.Address.pubKeyHashVersion = 0x00;
Bitcoin.Address.p2shVersion = 0x5;
Bitcoin.ECKey.privateKeyPrefix = 0x8... | true |
150a9ab4a56fad5c4dd4a472af5c4e65c5767343 | JavaScript | CNAtion96/marina_project | /js/dashboard.js | UTF-8 | 426 | 2.515625 | 3 | [] | no_license | var token = localStorage.getItem('token');
$("form").on('submit',(e)=>{
e.preventDefault();
var title = $("#title").val();
var description = $("#description").val();
$.ajax({url: "https://tiyagencyweek.herokuapp.com/blogs/create",
type: "POST",
data: {title,description},
headers:{X_... | true |
046ab23b9585f06adda56a86af3872b1aa83b4ef | JavaScript | hsalehi100/cash_counter | /cashcounter/cashcounter/js/calculate.js | UTF-8 | 2,534 | 3.015625 | 3 | [
"MIT"
] | permissive | sumar = () => {
const five_cent = document.getElementById("five_cent").value * 0.05;
const ten_cent = document.getElementById("ten_cent").value * 0.10;
const twentyfive_cent = document.getElementById("twentyfive_cent").value * 0.25;
const loonnie = document.getElementById("loonie").value * 1;
c... | true |
abdfbe2009bf1ed69c5d649275aec3005b2aa369 | JavaScript | perettijuan/complete_web_development_course | /07_jQuery/index.js | UTF-8 | 1,513 | 3.578125 | 4 | [] | no_license | // Selects the h1 element and then adds it the css class big-title and the class margin-50
$("h1").addClass("big-title margin-50");
// Selects all the buttons on the screen and changes the text to "New Text"
$("button").text("New Text");
// Select the anchor tag and change the href attribute
$("a").attr("href", "http... | true |
98d05386be8932e9d6a4c1e18d6f10e6b0816676 | JavaScript | JonasAqua/sminternshipproj | /react-frontend/src/components/SendPost.js | UTF-8 | 1,919 | 2.8125 | 3 | [] | no_license | import React from 'react'
class SendPost extends React.Component {
constructor (props) {
super(props)
this.state = {
message: '',
category: ''
}
this.handleInputChange = this.handleInputChange.bind(this)
this.handleSubmit = this.handleSubmit.bind(this)
}
handleInputCha... | true |
e5dc03d18d18ee12a008493397174392d438563a | JavaScript | Memphis1983/100-Devs-Assignments | /code_wars/codewars_04-10-2021.js | UTF-8 | 201 | 3.71875 | 4 | [] | no_license | Challenge: MakeUpperCase
Write a function which converts the input string to uppercase.
Solution:
function makeUpperCase(str) {
// Code here
const newStr = str.toUpperCase();
return newStr;
} | true |
381fff0e24eba2f3587c4d5b97d71e2e107fdd94 | JavaScript | Sandakelum98/SandakelumWeb | /assests/projects/Course Work - ITS 1119 (In memory POS System)/controller/HomePageController.js | UTF-8 | 7,210 | 2.671875 | 3 | [] | no_license | // -----------------------------------------------------------------------------------------------------------------
//-------------------------------------------------Pages Properties-------------------------------------------------
// Home Page Properties
var orderBtn = document.getElementById('getStart');
var homeS... | true |
019a50a5f3bac6cfc622752f6e536c9032a372b7 | JavaScript | tvcong0999/bt07 | /bt07.js | UTF-8 | 1,744 | 2.90625 | 3 | [] | no_license | var curentPage = 1;
async function getData(url) {
let response = await fetch(url);
let users = await response.json();
return users;
}
let url0 = "https://reqres.in/api/users?page=1&per_page=2";
getData(url0).then((users) => {
loadData(users);
});
$(document).ready(function () {
$("ul.pagination").on("click",... | true |
70e2e46e063ae2d6434952e26e8831a4084d3b64 | JavaScript | acantuta/javascript-examples | /basic/1-function.js | UTF-8 | 615 | 4.6875 | 5 | [] | no_license | // Function - input (argument), code, output (return value)
let greetUser = function () {
console.log('Welcome user')
}
greetUser()
greetUser()
greetUser()
let square = function (num) {
let result = num * num
return result
}
let value = square(3)
let otherValue = square(4)
console.log(value)
console.lo... | true |
810459b65fe7bdf71d30251d9262f5faca9314b9 | JavaScript | dohzya/ukiuki2 | /public/javascript/main.js | UTF-8 | 3,548 | 2.9375 | 3 | [
"Apache-2.0"
] | permissive | (function () {
var window = this;
var document = window.document;
function createTag(container, name, fn) {
var tag = document.createElement(name);
fn(tag);
container.appendChild(tag);
return tag;
}
function imagePopup(img, images) {
var alt = img.getAttribute('alt');
var url = img.g... | true |
119abc75e64d8fc23debcc107d8cac830dd41c95 | JavaScript | danilomartinssilva/topicosSI2018 | /main.js | UTF-8 | 2,333 | 2.859375 | 3 | [] | no_license |
function validarCPF(inputCPF){
var soma = 0;
var resto;
//var inputCPF = document.getElementById('cpf').value;
if(inputCPF == '00000000000') return false;
for(i=1; i<=9; i++) soma = soma + parseInt(inputCPF.substring(i-1, i)) * (11 - i);
resto = (soma * 10) % 11;
... | true |
84e50c22c5bf3b239178196afdbf93a3c57f4cc4 | JavaScript | Ipkhchan/ageimals-leaderboard | /middleware/handleGet.js | UTF-8 | 1,777 | 2.640625 | 3 | [] | no_license | const cTable = require('console.table');
const {
getBottomOfLeaderboard,
getTopLoseStreaks,
getTopOfLeaderboard,
getTopWinStreaks,
} = require('./crud-functions/index.js');
const {orderObjects} = require('../utilities/object-formatting.js');
const {orderedColumns, commands} = require('../constants');
async fun... | true |
62ae84f7c5100b09e473275afe3b471b8cbb5074 | JavaScript | kimmanlui/vocbooster | /FLASH/js/usecards.sync-conflict-20190326-091109-THMC7LY.js | UTF-8 | 5,671 | 2.8125 | 3 | [
"MIT"
] | permissive | $(document).ready(function(){
if( $("#flashcard").length != 0 ){
// var flashCards = [
// {front:"1 + 1 = _", back:"2"},
// {front:"a,b,c,d,_ ?", back:"e"},
// {front:"dat front", back:"dat back"},
// {front:"front4", back:"back4"},
// {front:"front5", back:"back5"},
// ... | true |
256d528cb75485e40d40a4c9c1b6a53768ad8a00 | JavaScript | mathew94/problem-solving-js | /inchToFeet.js | UTF-8 | 343 | 4.25 | 4 | [] | no_license | // Converting inch to feet function
function inchToFeet(inch){
var feet = inch / 12;
return feet;
}
var senior = [156, 288, 300]; // also can be done with array
var nanaFeet = inchToFeet(senior[0]);
console.log(nanaFeet);
var naniFeet = inchToFeet(288);
console.log(naniFeet);
var dadiFeet = inchToFeet(300);... | true |