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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
7ab1a06c8335b3eadd642a80d688b3e8068f6364 | JavaScript | fagleyali/dasboard | /controllers/appointments.js | UTF-8 | 2,542 | 2.71875 | 3 | [] | no_license | const Doctor = require('../models/doctor');
const DateFormat = require('dateformat');
module.exports = {
createAppointment,
getSlots
}
const aSlots = ['8:00 am','8:30 am','9:00 am','9:30 am','10:00 am','10:30 am','11:00 am','11:30 am','12:00 am','12:30 am','1:00 am','1:30 am','2:00 am','2:30 am']
function c... | true |
584df9c57caecf19a9006fd9b8f7a32c9edc0808 | JavaScript | Rinsho/BrainfuckInterpreter | /build/tokens.js | UTF-8 | 2,656 | 2.796875 | 3 | [
"MIT"
] | permissive | export class Scope {
constructor() {
this._tokens = [];
this._hasActiveScope = true;
}
get HasActiveScope() {
return this._hasActiveScope;
}
set HasActiveScope(active) {
if (!active) {
let mostRecentToken = this._tokens[this._tokens.length - 1];
... | true |
4114eef6d12b1a8987661bc70777cb77f90cc3ba | JavaScript | lrrr-omicron/jsvn | /load/index.js | UTF-8 | 2,786 | 2.765625 | 3 | [
"BSD-3-Clause"
] | permissive | 'use strict';
//load.js
// This View for the load button
import { $, $$ } from 'cash-js';
import model from "../model";
import stage from "../stage";
import shared from "../shared";
const loadModalComponentId = "load-modal-component";
const openLoadModal = () => {
console.log("--> load.openLoadModal()" );
try ... | true |
676e3fe2318c0d8d271b905f0028f85620e7a11a | JavaScript | MatthewHird/2019Spring | /csci311/greysiteProject/src/greyServer/js/createPaletteWidget.js | UTF-8 | 6,750 | 2.984375 | 3 | [] | no_license | // author: Matthew Hird
// csciId: hirdm
// date: Apr 1, 2019
// links:
function setFocus(event) {
let element = event.currentTarget;
document.getElementById(colourList[ccellFocus].id).style.boxShadow = "none";
document.getElementById(colourList[ccellFocus].id).style.border = document.getElementById(colou... | true |
35614f98cdc518145b2ab298b8bd5e573a5d5e4f | JavaScript | Faz-um-bem/backend | /app/Controllers/Http/HttpResponses.js | UTF-8 | 1,217 | 2.671875 | 3 | [] | no_license | const GenericException = use('App/Exceptions/GenericException');
function ok(data) {
return {
statusCode: 200,
message: null,
data,
};
}
function created(data) {
return {
statusCode: 201,
message: null,
data,
};
}
function noContent() {
return {
statusCode: 204,
message: nul... | true |
b871fbd65075061e4235d8d07dbac139c8d8443e | JavaScript | masaeedu/infix | /test.js | UTF-8 | 727 | 2.96875 | 3 | [] | no_license | const { test } = require("ava");
const { infix, uncurry } = require(".");
test("can apply static functions infix", t => {
const Int = {
"+": x => y => y + x,
"-": x => y => y - x,
"*": x => y => y * x,
"/": x => y => y / x
};
const result = infix(Int)(1)
["+"](2)
["+"](5)
["*"](5)
... | true |
c394b3384b9abb9afc1a95e5e3eef46fe680ddb0 | JavaScript | Hilmawanh/Ujian-Fundamental | /soal1.js | UTF-8 | 426 | 3.28125 | 3 | [] | no_license | const auction = a => {
var hargaAwal = 10000;
var minute = 0;
do {
minute++;
if (minute % 4 == 0) {
hargaAwal += Math.ceil(hargaAwal * 0.1);
} else {
hargaAwal += Math.ceil(hargaAwal * 0.2);
}
if (hargaAwal >= 30000000) {
return `the items were sold`;
}
} while (minute ... | true |
27df9704fd990e7e58cb11d02943b414f87245dd | JavaScript | solihinf/basics-blackjack | /script.js | UTF-8 | 10,064 | 4.03125 | 4 | [] | no_license | // var main = function (input) {
// var myOutputValue = 'hello world';
// return myOutputValue;
// };
var makeDeck = function () {
// Initialise an empty deck array
var cardDeck = [];
// Initialise an array of the 4 suits in our deck. We will loop over this array.
var suits = ['hearts', 'diamonds', 'clubs',... | true |
34bbf9ec4b87755be2b2c0acf3d07640e5a8332d | JavaScript | sradms0/library-manager | /test/lib/Route.js | UTF-8 | 4,905 | 2.703125 | 3 | [] | no_license | 'use strict';
/**
* @module test/lib/Route
*/
/**
* Util Class for route navigation
*/
module.exports = class {
/**
* Navigates to desired route when server is running
* @param {Browser} browser - zombie instance
* @param {String} route - route to visit
* @return {Promise} zombie.Browser.visit
*/
... | true |
5d804ac19df7f207793d85e411a4ca0709fe3506 | JavaScript | SwagatikaBehera/learning_React | /src/components/user.jsx | UTF-8 | 635 | 2.828125 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
const User = (props) => {
const [planet, setPlanet] = useState("Earth");
// componentDidMount
useEffect(() => {
console.log("byeeee");
console.log("hho");
//componentWillUnmount
return console.log("bye");
}, []);
// componentDidUpdate
//... | true |
7c82c3ca8bdf2a7f0804af0df354c51d27ddb13a | JavaScript | AriGonzo/TIY-Assignments | /YeomanProject/src/app/main/main.controller.js | UTF-8 | 2,270 | 2.515625 | 3 | [] | no_license | 'use strict';
angular.module('yeomanProject', ["firebase"])
.controller('MainCtrl', function ($firebase, $firebaseAuth, $scope) {
var ref = new Firebase('https://github-comments.firebaseio.com/');
var sync = $firebase(ref);
var auth = $firebaseAuth(ref);
var syncObject = sync.$asObject();
var sel... | true |
ceb11ce92df58236c70d7070d39f1435d096438f | JavaScript | coderben2017/blog-set | /js/nav.js | UTF-8 | 13,568 | 2.609375 | 3 | [] | no_license | function goToCover() {
$('#title').text("随想集");
$('#content').text("Poetry is a deal of joy and pain and wonder, with a dash of the dictionary..");
$('#tip').hide();
}
function showContent(id, type) {
const {title, contents, tips} = type === 'poetry' ? poetries[id]: articles[id];
let content = '';
content... | true |
e657af395ac55d3db132959345e3af0af49c33fb | JavaScript | davipferr/javascript-course | /encontre-o-string.js | UTF-8 | 297 | 2.96875 | 3 | [
"MIT"
] | permissive | const filme = {
titulo: 'Vingadores',
ano: 2077,
personagem: 'Thor',
diretor: 'Robin'
}
exibirPropriedades(filme);
function exibirPropriedades(obj){
for(prop in obj){
if(typeof obj[prop] === 'string')
console.log(prop, obj[prop]);
}
} | true |
057ebc24f77045b927df0e76cb6cced635460d3a | JavaScript | nstevanoski/JavaScript-Exercises | /Задача 3/Задача 3.4/javascript.js | UTF-8 | 249 | 2.953125 | 3 | [] | no_license | var objDate = new Date();
var hours = objDate.getHours();
if(hours>=06&&hours<=10){
console.log('Добро утро.');
}
else if(hours>=10&&hours<=18){
console.log('Добар ден.');
}
else{
console.log('Добро вечер.');
} | true |
3967075afcf0b5d3ec8164f8dac89ea03326df5e | JavaScript | prasadaman2000/hitchhike | /frontend/src/pages/MyRides.js | UTF-8 | 3,485 | 2.71875 | 3 | [] | no_license | /*
Page to view rides posted and requested by users
*/
import * as React from 'react';
import {
Text,
View,
StyleSheet,
Image,
Alert,
FlatList,
ScrollView,
AsyncStorage
} from 'react-native';
// or any pure javascript modules available in npm
import { Card } from 'react-native-paper';
import Divider fr... | true |
c8f2e700b52351409253bc8b76465eb027875edc | JavaScript | Abhayhk29/Angular | /promise.js | UTF-8 | 1,518 | 3.359375 | 3 | [] | no_license | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
var imageTestPromise = document.getElementById('imageTestPromise');
var images = ['images/1.jpeg', 'images/2.jpeg', 'images/3.jpg', '... | true |
5aae001a8d2ca3f0c5f49d0e1d0e4cf54c517f49 | JavaScript | 18824127298/DianDanChe | /FrameWork4.5/Sigbit.InfoBusService/$MicrosoftTranslatorDemo/MicrosoftTranslatorDemo.web/module/gcmap/js/Tools.js | UTF-8 | 2,967 | 2.828125 | 3 | [] | no_license | //================= ToolsControl 这是一个地图工具栏控件 =======================
//**** 可以显示,添加一些按钮,和使用当前控件的一些全局函数 *******************
//=============================================================================
//============ 1.0 创建这个控件 ================
function ToolsControl() {}
ToolsControl.prototype = new GControl();
/... | true |
916ad87c99aa6ea787aba8d799aa96e7195f6cd9 | JavaScript | ksenia-fe/js-course | /leson15/demo.js | UTF-8 | 364 | 2.828125 | 3 | [] | no_license | import { createCalculator } from './index.js';
const calculator = createCalculator();
const calculatorNext = createCalculator();
calculator.getMemo(); // 0
calculator.add(3);
calculator.getMemo(); // 3
calculator.decrease(5);
calculatorNext.add(5);
calculatorNext.getMemo(); // 5
calculator.getMemo(); // -2
cal... | true |
65c6fb9a61639b8ac46b04271da0141e3167f024 | JavaScript | chin242424/E-commerce-website-using-HCL-Design-Principles | /script_delivery.js | UTF-8 | 1,551 | 2.8125 | 3 | [] | no_license | /* If you're feeling fancy you can add interactivity
to your site with Javascript */
function fn1()
{
var Standard_delivery = document.getElementById("Standard_delivery");
var Express_delivery = document.getElementById("Express_delivery");
var Scheduled_delivery = document.getElementById("Scheduled_delivery... | true |
aa2f6532e28f00be4aa1651ba809ef970c105edb | JavaScript | MOHAMMADArsalan/100DaysOfCode | /day-4/deleteNode.js | UTF-8 | 738 | 4.3125 | 4 | [] | no_license | /**
* Delete Middle Node: Implement an algorithm to delete a node in the middle (i.e., any node but
the first and last node, not necessarily the exact middle) of a singly linked list, given only access to
that node.
EXAMPLE
Input: the node c from the linked list a- >b- >c - >d - >e- >f
Result: nothing is returned, but... | true |
3d9679f95f8ff01118fad47f3a25e56d7c0606c3 | JavaScript | cadellsingh/JS-practice | /reverseInteger.js | UTF-8 | 256 | 3.59375 | 4 | [] | no_license | const reverseInteger = (num) => {
const multiplier = num < 0 ? -1 : 1;
num = Math.abs(num);
const newNumber = Number(num.toString().split("").reverse().join(""));
return newNumber * multiplier;
};
let num = -123;
console.log(reverseInteger(num));
| true |
17285b3c4209e4518267b07cc55fa769748fa8fb | JavaScript | lhgjose/rock-paper-scissors | /scripts/main.js | UTF-8 | 1,787 | 4.4375 | 4 | [] | no_license | /*
ask the user to choose between rock, paper or scissors
create a variable with the user's choice (case-insensitive)
create function to randomly return rock, paper or scissors
create a function to play a round of the game
crate a function that keeps track of results and declare a winner
*/
const btnChoice = document.... | true |
8a5d38b3d86f1b7f713a3f71931279c1ba730499 | JavaScript | callumtaylorZA/joblisting-api | /api/controllers/job_listing.js | UTF-8 | 3,823 | 2.6875 | 3 | [] | no_license | 'use strict';
var db = require('../../config/db');
module.exports = {getAll, save, getById, update, remove, getApplicantsByJobListingId, addApplicant, getApplicantById, updateApplicantStatus, removeApplicant};
/* ===================
* Path: /job-listings
*/
//GET
function getAll(req, res, next) {
db.g... | true |
bff0bc5a263bf8ee6d8230435e1c22ee812ed344 | JavaScript | cwparsons/project-euler | /problems/04x/040.js | UTF-8 | 618 | 3.546875 | 4 | [] | no_license | /**
* problems/04x/040.js
* Champernowne's constant
*/
module.exports = function (keep) {
var integers = 0,
limit = Math.max.apply(null, keep),
d = [];
// Loop through integers until we hit the max keep
for (var i = 1; integers <= limit; i++) {
var n = i.toString().split('');
// Split the... | true |
fb9694f3c69ff664f2c22fb7bfb1dcea5cdba02c | JavaScript | magnomil/caf-com-java | /null undefined.js | UTF-8 | 358 | 3.390625 | 3 | [] | no_license | // null traz a referência para um espaço de memória
//undefuned significa que o valor da variável não está definida. ela não foi inaciamilziada.
/*let valor;
console.log(valor);*/
//null singifica que não é apontada nem um lugar na memória e não tem nenhum valor.
valor = null
//zerar uma variável de referê... | true |
5d3a0036a964d977e0ce4d4cbc91c8ebf7c22d84 | JavaScript | wangdk1/websocket | /src/main/resources/static/js/stats/stats.js | UTF-8 | 9,708 | 2.703125 | 3 | [
"MIT"
] | permissive | /**
* 本js和所关联的html中,echarts图是使用不同类型进行命名的,每个类型分别从1开始计算
* 而表格,是将所有表格从1开始统计到最后
*/
//点击tab键的时候,将参数传递过来
var tableIdAndName = new Map();
//点击tab键的时候,将参数传递过来,因为图片不唯一,设为数组
var imgIdAndName = new Map();
/*********************导出为excel相关的方法****************/
tabParams('tab', 1, 1);
//处理表格参数传递给导出excel方法
function dealParams(table... | true |
27eee24d05f664e4db0017189607e2f1902edda4 | JavaScript | MyothuaungGitHub/just-a-chatin | /database/seeds/sample-seed.js | UTF-8 | 566 | 2.6875 | 3 | [] | no_license | 'use strict'
const sqlite3 = require("sqlite3");
function sampleSeed() {
let db = new sqlite3.Database('./database/botapp.db');
db.serialize(function () {
db.run(`CREATE TABLE IF NOT EXISTS people (
id INTEGER PRIMARY KEY,
name TEXT,
score INTEGER
... | true |
0bfb14868ff7be7c224e26b338b86391600d31e8 | JavaScript | jasalguero/ela_crain_webite | /src/components/ContactForm.js | UTF-8 | 2,162 | 2.59375 | 3 | [] | no_license | import React, { Component } from 'react';
import serializeForm from 'form-serialize';
import '../styles/ContactForm.css';
import '../styles/coaching/ContactForm.css';
import { validateEmail } from '../utils/helpers';
var request = require('request');
// const URL = "http://elacrain.com/cf/test.php?s=test123123123&m=he... | true |
4a4ee867541e1b35c418e293ffb66afc30ee530f | JavaScript | MdKhizaruddin/EcmaScript.js | /Problems/OddNumber.js | UTF-8 | 86 | 3.03125 | 3 | [] | no_license | const OddNumberFinder = (num) => (num % 2=== 1);
console.log(OddNumberFinder(999999)); | true |
6621a6da64cd64a8107ec5a0f313d87ee9bee9c3 | JavaScript | volodymyr4509/MazeGame | /src/main/webapp/resources/files/javascripts/MoveThroughTheMaze.js | UTF-8 | 11,024 | 3.109375 | 3 | [] | no_license | $( document ).ready(function() {
var canvas = document.getElementById("mazecanvas");
var context = canvas.getContext("2d");
var mazeWidth = 556;
var mazeHeight = 556;
var lastKeyDown;
var players = [];
function Dummy(x,y,name,speed,colour){
this.x = x;
this.y = y;
t... | true |
726986000663a97bad768d5099b628ad9990fada | JavaScript | CodeBeast10/Project-Racing | /main.js | UTF-8 | 1,808 | 2.859375 | 3 | [] | no_license | canvas= document.getElementById("myCanvas");
ctx= canvas.getContext("2d");
var c;
background_Image = "racetrack.jpg";
car1_width= 120;
car1_height= 70;
car1_image= "car1.png";
car1_y = 10;
car1_x = 10;
car2_width= 120;
car2_height= 70;
car2_image= "car2.png";
car2_y = 10;
car2_x = 10;
backgr... | true |
17932f3e679deadb23840c392495a1ff6e25a878 | JavaScript | maratovagull/bootcamp | /chapter_1/lesson_2/js/main.js | UTF-8 | 757 | 3.578125 | 4 | [] | no_license | // var age = +prompt('Сколько вам лет?');
// if (age < 14){
// alert('Шрек');
// } else if (age < 16) {
// alert('Мстители');
// } else if ( age < 18){
// alert('Острые козырьки');
// } else if ( age >= 18) {
// alert('Эйфория');
// }
// var drinks = prompt('Введите напиток');
// switch(drinks) {
... | true |
cebab21bba7a9dfeb706bef0b2ff583cad7d30bb | JavaScript | ConeDeathAPS/F1-databucket-v2 | /src/components/NavbarLink.js | UTF-8 | 315 | 2.515625 | 3 | [] | no_license | class NavbarLink extends React.Component {
constructor(props) {
super(props);
}
render() {
const page = this.props.page;
const className = this.props.isActive ? 'active' : '';
return (
<a
href="#"
className={className}
onClick={() => this.props.click(page)}>
{page}
</a>
);
}
} | true |
ba4d85eca59669f7611044ab8e3a811083059cf0 | JavaScript | Zaffirar/weppo | /lista8/zadanie_3.js | UTF-8 | 998 | 2.65625 | 3 | [] | no_license | //using second database form zadanie_1.sql
var mssql = require('mssql');
async function main() {
var conn = new mssql.ConnectionPool(
'server=localhost,1433;database=Weppo_lista8;user id=foo;password=foo');
try {
await conn.connect();
var request = new mssql.Request(conn);
var r... | true |
02c5b02989bdf5541f5308d78ef8068119cb9932 | JavaScript | SSSofyen/Koji | /src/components/ArticleList.js | UTF-8 | 698 | 2.75 | 3 | [] | no_license | import React, { useEffect, useState } from 'react'
import axios from 'axios'
const ArticleList = () => {
const [data, setData] = useState([])
// preparing data from jsonplaceholder
async function _getArticles() {
try {
const { data } = await axios('https://jsonplaceholder.typicode.com/posts')
setData(data)... | true |
155e7dab27fa7032f3f03471d22e9d1458e0f5b6 | JavaScript | IT-xzy/Task | /Web/gupeiru/JS/js1/js1.js | UTF-8 | 2,074 | 3.46875 | 3 | [] | no_license | var div = document.getElementsByClassName('box'); //获取方块节点
var on = document.getElementById("on"); //获取开始按钮节点
var off = document.getElementById("off"); //获取结束按钮节点
var time; //声明定时器变量
function mycolor() {
//随机生成十六进制颜色
return '#' + ('00000' + (Math.random() * 0x1000000 << 0).toString(16)).substr(-6);
}
on.onc... | true |
596b939490d0f92b8e6ac963bbc628801fb772d1 | JavaScript | iceycc/daydayup | /攻读红宝书(第四版)/示例代码/Chapter15DOMExtensions/ElementTraversal/ElementTraversalExample01.js | UTF-8 | 475 | 3.5 | 4 | [
"MIT"
] | permissive | let parentElement = document.getElementById('parent');
let currentChildNode = parentElement.firstChild;
// For zero children, firstChild returns null and the loop is skipped
while (currentChildNode) {
if (currentChildNode.nodeType === 1) {
// If this is an ELEMENT_NODE, do whatever work is needed in here
pro... | true |
25b95571fc842daf1b855935399f50296ffca7b6 | JavaScript | mhaligowski/fishkees-ui | /test/spec/flashcard/services/flashcardlistDetailsServiceTest.js | UTF-8 | 3,911 | 2.59375 | 3 | [
"BSD-3-Clause"
] | permissive | 'use strict'
describe('FlashcardListDetailsService', function() {
var testList = {
"id": "someNiceId1",
"title": "Spanish for beginners",
"create_date": 1379617022000
};
var testFlashcards = [
{
id: "someId1",
flashcard_list_id: "someNiceId1",
... | true |
94cb036b8275724f22ebf54eddffc67c0f90abaf | JavaScript | dat310-spring20/course-info | /examples/js/vue3/global-state-vuex-fruits/src/data.js | UTF-8 | 845 | 2.96875 | 3 | [] | no_license | const vuexStore = new Vuex.Store({
state: {
// like data in the vue instance
fruits: [
{ name: "Apple", favorite: true },
{ name: "Banana", favorite: true },
{ name: "Pear", favorite: true },
{ name: "Grapes", favorite: false },
{ na... | true |
cc04f257d4d9600aba3541e03e8fb477fd8d85c3 | JavaScript | Kizal/React-Season-App | /src/Logic.js | UTF-8 | 971 | 2.5625 | 3 | [] | no_license | import React from "react";
import SeasonDisplay from "./SeasonDisplay";
import Spinner from "./Spinner";
class Logic extends React.Component {
state = {
lat: null,
long: null,
errmsg: ""
};
componentDidMount() {
window.navigator.geolocation.getCurrentPosition(
position => {
this.set... | true |
4b2756b4e090ea09428d4c4208710a9a0e105f2f | JavaScript | sambitsatpathy/d3-react-heatmap | /src/request.js | UTF-8 | 612 | 2.6875 | 3 | [] | no_license | export default(url,token) => new Promise((resolve, reject) => {
let req = new XMLHttpRequest();
req.open('GET', url);
req.onload = () => {
if (req.status === 200) {
var response=JSON.parse(req.response);
resolve(response);
} else {
reject(Error(req.statusT... | true |
8b8d0355e90dd24aac36d7c8a29513d6aaa71fa1 | JavaScript | RazzYoshi/dog-food-recipes | /client/src/App.js | UTF-8 | 911 | 2.546875 | 3 | [] | no_license | import React, { Component } from "react";
import { Recipe } from "./components/Recipe";
import "./App.css";
class App extends Component {
state = {
recipes: []
};
componentDidMount = () => {
this.getRecipes()
.then(resp => {
this.setState({ recipes: resp.recipes });
})
.catch(e... | true |
126cf4b36dc615d4872ea503ad7a912d4f67d09f | JavaScript | ToMrArcher/osloBike | /osloBike.js | UTF-8 | 2,632 | 3.296875 | 3 | [
"MIT"
] | permissive |
var requestURL = "https://gbfs.urbansharing.com/oslobysykkel.no/station_status.json";
var nameURL = "https://gbfs.urbansharing.com/oslobysykkel.no/station_information.json";
var request = new XMLHttpRequest();
var nameRequest = new XMLHttpRequest();
//Info = Json object that will contain all the needed data.
var inf... | true |
883a8cad46939bc23be8d7d6bc1fd802ea27943d | JavaScript | anderson3661/random-fa-cup | /client/src/components/settings/settings-helpers.jsx | UTF-8 | 13,631 | 2.59375 | 3 | [] | no_license | import { SEASON, COMPETITION_START_DATE, FIXTURE_UPDATE_INTERVAL, BASE_FOR_RANDOM_MULTIPLIER, AWAY_TEAM_FACTOR, IS_NOT_A_TOP_TEAM_FACTOR, GOALS_PER_MINUTE_FACTOR, IS_IT_A_GOAL_FACTOR, IS_IT_A_GOAL_PENALTY_FACTOR, DIVISION_FACTOR } from '../../utilities/constants';
import * as helpers from '../../utilities/helper-functi... | true |
065ad8d45bd81c2a53f556865a75fbb0a655d655 | JavaScript | akamai/boomerang | /plugins/ipv6.js | UTF-8 | 6,455 | 2.671875 | 3 | [
"BSD-3-Clause"
] | permissive | /**
* Plugin to measure various [IPv6](https://en.wikipedia.org/wiki/IPv6) related metrics.
*
* This plugin tries to do a few things:
* - Check if the client can connect to an IPv6 address
* - Check if the client can resolve DNS that points to an IPv6 address
* - Check latency of connecting to an IPv6 address
* ... | true |
3753c92f139ccc6dce61d69abc29533e67416acb | JavaScript | Jowelahmed-devloper/InterviewQuestion-Js | /map-filter.js | UTF-8 | 333 | 4.3125 | 4 | [] | no_license | const numbers = [5, 6, 8, 9, 10]
// const output =[];
// for(let i =0; i<numbers.length;i++){
// const element = numbers[i]
// const result = element*element;
// output.push(result);
// }
// console.log(output);
// Using Map
const result = numbers.map(function(element){
return element * 4;
})
console... | true |
39cec90e2a725d6169fb8e6703a2584093f2f237 | JavaScript | yurii-korolchuk/excel-js | /src/core/utils/utils.test.js | UTF-8 | 2,356 | 3.1875 | 3 | [] | no_license | import {
capitalize,
areEqual,
camelToKebab,
parse, debounce
} from './utils';
describe('capitalize:', () => {
test('should return capitalized string', () => {
const tmp = 'yurii'
expect(capitalize(tmp)).toBe('Yurii')
})
test('should return blank string', () => {
ex... | true |
b01826dfb88d9b63e8f6c6468fe54261f3150f41 | JavaScript | Anya555/NoteTaker | /Develop/routes/apiroutes.js | UTF-8 | 1,362 | 2.96875 | 3 | [] | no_license | const fs = require("fs");
const Store = require("../db/Store");
const path = require("path");
const db = require("../db/db.json");
module.exports = function(app) {
// reads the db.json file and returns all saved notes as JSON
app.get("/api/notes", function(req, res) {
res.json(db);
});
app.delete("/api/no... | true |
55e09568b5da6d816ddfa32ee5117d403aeb0ac4 | JavaScript | wenjun-li/BookSharing---MEAN-Stack | /public/assignment/user/controllers/profile.controller.client.js | UTF-8 | 3,130 | 2.546875 | 3 | [] | no_license | (function(){
angular
.module("WebAppMaker")
.controller("ProfileController", profileController);
function profileController($routeParams, $location, UserService) {
var userId = $routeParams['uid'];
var vm = this; // vm stands for ViewModel
// event handlers
vm.... | true |
2c7f2e9e400c9ef782cf882bb150934310d3ffc5 | JavaScript | belencludius/ejerciciosJS | /__test__/bucles/02-repetir.test.js | UTF-8 | 387 | 3.171875 | 3 | [] | no_license | const {repetir}= require('../../src/bucles/02-repetir')
// 2) repetir(valor, cantidad)
// Crear una función repetir que tome como argumento un valor valor y un número entero cantidad,
// y devuelva una array con valor repetido cantidad de veces.
describe('repetirValor',()=>{
it('deberia repetir tres veces lovelace... | true |
be2ee9c99324b5693f1ac0ddf8d6f11bf8a560a0 | JavaScript | Nordask/front | /workspace_js/angular/namespaces/namespaces.js | UTF-8 | 437 | 2.921875 | 3 | [] | no_license | var College;
(function (College) {
var Student = (function () {
function Student(num, str) {
this.studentId = num;
this.studentName = str;
}
return Student;
}());
College.Student = Student;
College.courseList = [".NET", "Java", "Blockchain", "Angular", "AW... | true |
cc7a98d2a1d3b24f13b6afe5ac19d503bba6b5d1 | JavaScript | zerbfra/Big-Gym-Hypermedia-Project | /WEBSITE/js/nav.js | UTF-8 | 1,400 | 2.796875 | 3 | [] | no_license | /*
* Big Gym: HYP Project 2014-15
* nav.js
* Manager for the responsive menu
* Author: Zerbinati Francesco
*/
var ww = document.body.clientWidth;
$(".nav").css("display", "none");
// add classes for dropdown menu
$(".nav li a").each(function() {
if ($(this).next().length > 0) {
$(this).addClass("par... | true |
7e6957a944f203f6b7a5d28212d8ad08bb8e9e8f | JavaScript | zdhsoft/pomelo-node-client | /lib/utils/log.js | UTF-8 | 1,714 | 2.765625 | 3 | [] | no_license | let {dateUtils} = require('./dateutils');
let {tools} = require("./tools");
/**
* 控制台日志类
*/
class LogConsole {
constructor(paramName = '') {
this.m_name = paramName;
}
get name() {
return this.m_name;
}
set name(paramName) {
this.m_name = paramName;
}
/**
*
* ... | true |
ce8d4082cc2f3650496a4081e15ad261fe743284 | JavaScript | cristianoso19/ECMAScriptPlatzi | /ec6/index.js | UTF-8 | 3,237 | 4.4375 | 4 | [] | no_license | /*
*DEFAULT PARAMS
*/
// ES5
function newFunction(name, age, country) {
var name = name || "cris";
var age = age || 32;
var country = country || "MX";
console.log(name, age, country);
}
// ES6
function newFunction2(name = "cris", age = 32, country = "EC") {
console.log(name, age, country);
}
newFunction();... | true |
399943dbf1ce115ce8fbd4cb58cc815f50eb2ea2 | JavaScript | juansensio/3js | /18_collisions_sound/src/sounds.js | UTF-8 | 421 | 2.59375 | 3 | [] | no_license | const sound = new Audio("/sounds/hit.mp3");
// play different random similar sounds
// adjust volume to collision strength, body mass or size, ...
// add delay to play to avoid playing in consecutive frames
const playSound = (collision) => {
if (collision.contact.getImpactVelocityAlongNormal() > 1.5) {
sound.cu... | true |
78f964187a64e8d421c881b34cd5b236f32271a7 | JavaScript | sourabhmadur/Amplify | /src/TextPanel.js | UTF-8 | 1,228 | 2.578125 | 3 | [] | no_license | import React, {Component} from 'react'
import Plot from 'react-plotly.js';
import Chart from 'chart.js';
import equal from 'fast-deep-equal'
class TextPanel extends Component{
constructor(props){
super(props);
this.state = {date : null};
}
componentDidMount(props){
const defaultData... | true |
1bad4a65d03246abb181a8e7b624fa06d9000d2d | JavaScript | jimdoescode/alert.codemana.com | /client/components/App.js | UTF-8 | 2,213 | 2.625 | 3 | [] | no_license | //These three are exposed as global so they can be
//accessed on the main page.
React = require("react");
ReactDOM = require("react-dom");
var AppHeader = require("./AppHeader.js");
var AppFooter = require("./AppFooter.js");
var Watcher = require("./Watcher.js");
var LoginButtons = require("./LoginButtons.js");
App ... | true |
82361bebfa6d74e1d2d3d280da883489e1622dd4 | JavaScript | PacktPublishing/Mastering-Zendesk | /Chapter 06/app.js | UTF-8 | 414 | 2.609375 | 3 | [
"MIT"
] | permissive | (function() {
return {
events: {
'app.activated':'doSomething',
},
doSomething: function() {
//Use Data API to obtain email address of requester
var email = this.ticket().requester().email();
//Generate the link
var link ='https://backend.examplecomp.com/admin/users/' + email;
//M... | true |
8c45877773ba6ea72a362b839c29c5cde08e6aeb | JavaScript | vmusil/lessons | /lesson-1/react/v1/src/App.js | UTF-8 | 1,965 | 3.84375 | 4 | [
"MIT"
] | permissive | import React, { Component } from 'react'; // import due to the JSX (React.createElement() instead of <div ...>)
import './App.css';
class App extends Component {
// various life-cycle methods to bring dynamic behaviour (state or properties, ...)
// note: child component can just read the props, but cannot modify t... | true |
b3d199a8abd3c3fec09dd8956bd62fa7b7053741 | JavaScript | dante055/web | /react/classes-tutorial/src/components/ParentComp.js | UTF-8 | 976 | 2.515625 | 3 | [] | no_license | import React, { Component, PureComponent } from 'react';
import RegularCom from './RegularCom';
import PureComp from './PureComp';
import MemoComp from './MemoComp';
class ParentComp extends Component {
// class ParentComp extends PureComponent {
constructor(props) {
super(props);
this.state = {
cou... | true |
b8fc5392bd189e0a726f8bb41039b220aa00a5f0 | JavaScript | acetao/tju-books | /WebRoot/scripts/global.js | UTF-8 | 2,550 | 3.0625 | 3 | [] | no_license | //所有公用的js
function submitForm(myCurrentPage){
var currentPage = document.getElementById("currentPage");
currentPage.value = myCurrentPage;
var form = document.getElementById("searchForm");
form.submit();
}
function G(elementId){
if(document.getElementById){
return eval('document.getElementById("'... | true |
efd68b83400f63b08cc7c5864ab104858e93c21c | JavaScript | renjinhui/2018_13 | /week3/day1/js/3.js | UTF-8 | 491 | 2.890625 | 3 | [] | no_license | // 匹配 有效数
// 012.23 0.12 q0.12ew
// — + 有可能
// 整数部分 若是 单位 则可以是 0; 多位开头不能是0 ; \d [1-9]\d+; 0|[1-9]
// 小数部分可有 可无
var reg = /^[-+]?(\d|[1-9]\d+)(\.\d+)?$/ // '12' '10'
// 匹配手机号
// 1开头 11位
// 第二位 8或9
// 其他不限
var reg = /^1[89]\d{9}$/
var reg = /^1(8|9)\d{9}$/
//QQ邮箱匹配
// 最少6位;
// 最多11位
// 不能0开头
// @qq.com
... | true |
c90c30863d6c40bdcb8ab7e7b6d684be52f25c7f | JavaScript | leandroluizpereira/site-imc | /static/funcao.js | UTF-8 | 964 | 3.59375 | 4 | [
"MIT"
] | permissive |
function botao(){
var n = document.getElementById("text").value;
var altura = document.getElementById("altura").value;
var imc = n / (altura * altura);
if (imc >=19 && imc <=25){
document.getElementById("p").innerHTML="Peso normal "+imc.toFixed(2);
}
else if(imc <=18.5... | true |
a5691f7c599e2e14c292e966c23055afdc4fd8a3 | JavaScript | TalentFlow/Brandee-Front | /src/reducers/product.js | UTF-8 | 2,523 | 2.5625 | 3 | [] | no_license | /* eslint-disable import/no-anonymous-default-export */
import {
GET_PRODUCT,
GET_PRODUCT_DETAIL,
PRODUCT_LOADING,
ADD_OR_REMOVE_FROM_WISHLIST,
ADD_OR_REMOVE_FROM_CART,
SEARCH_PRODUCT,
CLEAR_SEARCH_PRODUCT,
SEARCH_PRODUCT_ERROR,
} from "../components/action/productTypes";
import update from "react-addon... | true |
c2a20615fcd00afb56501ecab8ca06f7f0643488 | JavaScript | alex-evans/calculator | /src/components/calcButton.jsx | UTF-8 | 1,423 | 2.71875 | 3 | [
"MIT"
] | permissive | import React from "react";
import { connect } from "react-redux";
import { opperatorPressed, numberPressed, acPressed, decPressed, equalPressed } from "../redux/actions";
const opperatorButton = /^[+\-x/]/i;
const numberButton = /\d/;
class CalcButton extends React.Component {
constructor(props) {
super(p... | true |
2865a6cb38527aca18d929cd7819e5457569dfd0 | JavaScript | denilsonbarahona/d-p-memorama | /js/components/board/index.js | UTF-8 | 521 | 2.703125 | 3 | [] | no_license | import {Board} from "./board.js";
import {PlayCard} from "./playcard/playcard.js";
export function setBoard(characteres, setCardOpen) {
const $board = Board();
characteres.forEach(character => {
const {image, species, name, gender, status, apOrigin} = character;
const $card = PlayCard... | true |
60244855d08ab4973b3d224904b6f3a5cbcfaf7f | JavaScript | Nickadiemus/HackerRank | /problem-solving/Algorithms/JavaScript/MiniMaxSolution.js | UTF-8 | 355 | 3.96875 | 4 | [] | no_license | // Complete the miniMaxSum function below.
// Wants the sum if the 4 lowest and 4 high
// Always will be an input of
function miniMaxSum(arr) {
var min = 0, max = 0;
//sort the array so
arr = arr.sort((a,b) => {return (a - b)})
for(var i = 0; i < arr.length - 1; i++){
min += arr[i];
max += arr[i+1];
}... | true |
747ca915edccfa80af3e54b78a3a40e941900d0a | JavaScript | cguedes/github-batch | /studentsloader.js | UTF-8 | 878 | 3.125 | 3 | [
"MIT"
] | permissive | //////////////////////////////
// File format (sample)
//
// G00 cguedes
// G01 cguedes bart
// G02 lisa
// # G04 foo bar this line will be ignored
//
//////////////////////////////
module.exports = function(filename, cb) {
var fs = require("fs");
var students = [];
fs.readFile(filename... | true |
ddffde008378fc0111b08d4a61133343a18f5422 | JavaScript | iseedeadpeople1005000/onepagesite | /mainpage/static/ajaxall.js | UTF-8 | 1,618 | 2.59375 | 3 | [] | no_license | $(function() {
$('.create_post').on('submit', function(event){
event.preventDefault();
console.log("form submited!")
create_post();
});
function create_post() {
console.log("create post is working!")
var Comment_Author = $('#Comment_Author').val()
var Comment... | true |
ac3cf56fc6f7caecee6b5d3532979597fcbd973e | JavaScript | Tommi-GH/fullstackopen2019 | /osa4/blogilista/tests/user_api.test.js | UTF-8 | 2,392 | 2.53125 | 3 | [] | no_license | const supertest = require('supertest')
const app = require('../app')
const api = supertest(app)
const mongoose = require('mongoose')
const helper = require('./test_helper')
const User = require('../models/User')
const helperUsers = require('../misc/users_for_testing')
beforeEach(async () => {
await User.deleteMany... | true |
f9cb94d53bf338eff5c3159e35959a6cf3f26936 | JavaScript | jooyeal/ais-deploy | /src/text/Badge.js | UTF-8 | 1,114 | 2.546875 | 3 | [] | no_license | export const text = `
const [count, setCount] = React.useState(0);
<div style={{ display: "flex", gap: "15px" }}>
<Badge content={count} color="tomato">
<Icon size="sm">
<path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.... | true |
31f92945a0d7d9f8045e39dcded7a5dd23ed2d23 | JavaScript | stephLaba/sohogallery | /js/script.js | UTF-8 | 1,673 | 2.796875 | 3 | [] | no_license |
$(function() {
//array of images
var images = [
".image1",
".image2",
".image3",
];
function getRandomNumber(n){
var n = Math.floor(Math.random()*n);
return n;
}
//randomly choose an animation in array
function getRandomImage(){
var num = getRandomNumbe... | true |
44b2c4bf830b9aa606179f178f912d7de20cfcd0 | JavaScript | verknight/workspace | /nodeschool/learnnode/httpcollect.js | UTF-8 | 678 | 2.78125 | 3 | [] | no_license | const http = require('http');
const url_1 = process.argv[2];
const url_2 = process.argv[3];
const url_3 = process.argv[4];
http.get(url,function httpResponseHandler(response) {
//response is instance of http.IncomingMessage
let statuscode = response.statusCode;
let error;
if(statuscode !== 200){
error = ne... | true |
d68cd28ac26b888266395db81d62ad0765e6a5ff | JavaScript | s1lv3rsph3r3/cron-parser-printer | /tests/unit/parser.test.js | UTF-8 | 1,176 | 2.546875 | 3 | [] | no_license | const parser = require('../../src/parser');
describe('Test parser => parseCronInterval', () => {
beforeAll(() => {});
test('should return an integer when interval is defined', async () => {
const expected = 1;
const input = 'str/1';
expect(parser.parseCronInterval(input)).toEqual(expected);
});
tes... | true |
17c659826dacbdf9502c3ebe89d7313c0efd1ad9 | JavaScript | ashwinncj/automated-at | /js/at-v2-markup.js | UTF-8 | 2,273 | 2.796875 | 3 | [] | no_license | function getAtMarkup( markup = '' ) {
switch( markup ) {
case 'seeAtMarkup':
return seeAtMarkup();break;
case 'clickAtMarkup':
return clickAtMarkup();break;
case 'onPageAtMarkup':
return onPageAtMarkup();break;
case 'seeElementAtMarkup':
... | true |
925feb25e79886cde0ec2523b3046c1220c3c48f | JavaScript | ChrisMayes22/puzzles-and-aglorithms | /codewars/javascript/level-five/sudoku.js | UTF-8 | 2,058 | 3.953125 | 4 | [] | no_license | // Build a function that will indicate whether a given 10 x 10 Sudoku board is solved.
// The board will be implemented on an array of 10 arrays w/ 10 numbers each.
// Return "Finished!" for solved, "Try again!" for unsolved.
/* Planning
Columns and rows -- can just create helper functions to check if s... | true |
510b1b8dab2e968014a374024d526c459f762cdd | JavaScript | needimf/cryptocurrency-github-project | /src/api/config/formatGithubApi.js | UTF-8 | 984 | 2.765625 | 3 | [] | no_license | const FORMATGITAPI = {
/*
Takes in all data returned from Github
API (as an array of objects), and cleans
up the resulting data objects for each
of the Top Six projects
*/
formatTopSixResults: function(arrayOfTopData) {
return arrayOfTopData.map(project => {
let reformattedData = {};
... | true |
2b4e24346e320f90445dfbfda6e456f71e70b455 | JavaScript | Nickpodski/MVC_Blog_NP | /public/assets/js/post.js | UTF-8 | 929 | 2.921875 | 3 | [] | no_license | const addPost = () => {
const newPost = {
title: $('#title').val(),
post: $('#newPost').val()
}
axios.post(`/api/posts/`, newPost)
.then(res => {
window.location.href = "/dashboard";
})
.catch(err => {
console.log(err);
})
}
const editPost = () => {
const updatedPost = {
... | true |
84870e7623b1137708faac9215b60bc7cc757d7f | JavaScript | ps0305/Javascript-Algorithms-And-Data-Structures | /leetcode/game-of-life/index.js | UTF-8 | 1,238 | 3.484375 | 3 | [] | no_license | /**
* @param {number[][]} board
* @return {void} Do not return anything, modify board in-place instead.
*/
var gameOfLife = function(board) {
if (!board.length || !board[0].length) {
return;
}
const m = board.length;
const n = board[0].length;
const lives = [];
for (let i = 0; i < m; i++) {
for (... | true |
0b2f3e7fedea6f0b8fba120f6dc209a4797245fc | JavaScript | josson001/redux | /src/App.js | UTF-8 | 1,907 | 2.515625 | 3 | [] | no_license | import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import { Provider,connect } from 'react-redux'
import { createStore } from 'redux'
import Child from './component/child/Child';
import Father from './component/father/Father';
// function counter(state = 0, action) {
// ... | true |
e3c5d4f621f3e72224a16ad9333a3a6747d11dd6 | JavaScript | alfradchew/JS101_Programming_Foundation_with_JS | /small_problems/interpretive_problem_solving/1_1000lights.js | UTF-8 | 1,687 | 4.5 | 4 | [] | no_license | /*
You have a bank of switches before you, numbered from 1 to count. Every switch is connected to exactly one light that is initially off. You walk down the
row of switches and toggle every one of them, that is, you flip every switch. All the lights are now on. You walk back to the beginning of the row and start
anothe... | true |
f57846d6960be7a2a3c584d799731cae52ef18a0 | JavaScript | sumonsbgc/JavaScript | /modal/modal.js | UTF-8 | 682 | 2.859375 | 3 | [] | no_license |
let modal = document.querySelector(".modal");
let openBtn = document.querySelector("#modalBtn");
let closeBtn = document.querySelector(".closeBtn");
openBtn.addEventListener("click", openModal);
closeBtn.addEventListener("click", closeModal);
modal.addEventListener("click", closeModalOutsite);
function openModal(e... | true |
6c88f18dc3e1a291be3270985bbb6a88aaa564ad | JavaScript | Reflex-Gravity/birthday-cal | /js/main.js | UTF-8 | 7,845 | 3.359375 | 3 | [] | no_license | function CalendarApp() {
const mappedDayOfWeek = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"]
const WEEK_DATA = { mon: [], tue: [], wed: [], thu: [], fri: [], sat: [], sun: [] }
const parentSquareSide = 160
const dateFormats = ['DD/MM/YYYY', 'MM/DD/YYYY', 'YYYY/DD/MM', 'YYYY/MM/DD']
this.prevR... | true |
4a75099462ff16afaecf0068c5ca6dc623403c63 | JavaScript | marianouribe/ES6 | /ES6-6.js | UTF-8 | 1,410 | 3.96875 | 4 | [] | no_license | //Symbol
var sim1 = Symbol();
var sim2 = Symbol("foo");
var sim3 = Symbol("foo");
console.log(Symbol("foo") === Symbol("foo"));
var sym = Symbol("foo");
console.log(typeof sym);
var symObj = Object(sym);
console.log(typeof symObj);
const foo = Symbol()
const bar = Symbol()
console.log(typeof foo);
console.log(typeof... | true |
dc7241d4f7a1c5807c62f92bb2bbc35793549518 | JavaScript | JohanSundman/VisualAudio | /visualizers/BezierCircle.js | UTF-8 | 1,730 | 3.453125 | 3 | [] | no_license | function Point(centerX, centerY, radius, length, angle){
this.x1 = centerX + radius * Math.sin(angle);
this.y1 = centerY + radius * Math.cos(angle);
this.x2 = centerX + (radius + length) * Math.sin(angle);
this.y2 = centerY + (radius + length) * Math.cos(angle);
}
// Connect the start and finish
var secondPoint =... | true |
4107923186220997e1b8f3359fc4a07269c49fb3 | JavaScript | hiwamn/Lobster | /AuthenticationService/wwwroot/js/SendInvalidImages.js | UTF-8 | 819 | 2.6875 | 3 | [] | no_license |
window.onload = function () {
}
function validateForms(NationalCard,Person,Booklet) {
var nationalCard = document.getElementById(NationalCard);
var person = document.getElementById(Person);
var booklet = document.getElementById(Booklet);
var i1 = checkHasValue(person, "لطفا تصویر صفحه اول دفترچه را ... | true |
fb87675de0f3a7f9d346d2ce8d25ef25f37d14ae | JavaScript | h5p/h5p-flashcards | /upgrades.js | UTF-8 | 1,876 | 2.609375 | 3 | [
"MIT"
] | permissive | /** @namespace H5PUpgrades */
var H5PUpgrades = H5PUpgrades || {};
H5PUpgrades['H5P.Flashcards'] = (function () {
return {
1: {
/**
* Asynchronous content upgrade hook.
* Upgrades parameters to support alternative answers separated by |.
*
* @params {object} parameters Parameter... | true |
649917561b8f1d2ec1448656ed682ea587754ac5 | JavaScript | hannuus/GambleAPI | /gamble/src/main/webapp/static/js/common.js | UTF-8 | 9,536 | 2.625 | 3 | [] | no_license | /*************************************************************************************************************/
/****************************************基本通用方法***********************************************************/
/**************************************************************************************************... | true |
96b63d82b522874f3a65aef7f642de2a11b73948 | JavaScript | almahdi-chihaoui/cdp-recruitment-javascript | /app.js | UTF-8 | 1,344 | 3 | 3 | [] | no_license | 'use strict'
const { data } = require('./data');
const ops = require('./src/ops');
const main = () => {
// get and identify arguments
const arg = process.argv[2]
if (!arg) {
console.error(`No argument was provided, please refer to the docs.
*/ "--filter=[value]": to filter data.
... | true |
cdde053249c8a9eb09d26b412abbb67e8c2b74fe | JavaScript | choy524/technical_assessment_1 | /src/meal.js | UTF-8 | 1,408 | 3.375 | 3 | [] | no_license | /* 1
----Write a function called nameMenuItem that takes in any ONE item
----and returns a string with the word "Delicious" in front of the item name
*/
// Please write your code here
/* 2
----Write a function called createMeuItem that creates and return an object with the new item name, price and a type
----You... | true |
de913cbb06146d2a373e9831fc464f967c31c81f | JavaScript | stampyzfanz/flowfield | /particle.js | UTF-8 | 3,617 | 2.984375 | 3 | [] | no_license | class Particle {
constructor() {
this.pos = createVector(random(width), random(height));
this.vel = createVector(0, 0);
this.acc = createVector(0, 0);
this.maxspeed = 3;
this.maxForce = 0.2;
}
update() {
this.vel.add(this.acc);
this.vel.limit(this.maxspeed);
this.pos.add(this.vel);
this.acc.mult(... | true |
8193093a268f2719908512065772d96d75479ee7 | JavaScript | KhadijaNoor777/Promises_asyncAwait_callbacks | /promise.js | UTF-8 | 1,454 | 4.28125 | 4 | [] | no_license | ///PROMISE
///Example 1
var promise = new Promise(function(resolve, reject){
resolve(2);
})
promise.then(first).then(second).then(third).then(function(response){
console.log(response);
})
function first(value){
console.log(value+2);
return value+2;
}
function second(value){
cons... | true |
ad84300afa692d3744f18f8a3b87106cb5a9d703 | JavaScript | CharlesLiu02/Fake-Artist | /public/src/menu.js | UTF-8 | 237 | 3.1875 | 3 | [] | no_license | const createRoom = () => {
// Generate room code
const code = Math.random().toString(36).substr(2, 5)
document.getElementById("room").value = code
}
document.getElementById('create-btn').addEventListener('click', createRoom) | true |
7d6b6553fdce19007b31b32ad791efc38ebb24b0 | JavaScript | DashaMarinkevich/typical-arrays-problems | /src/index.js | UTF-8 | 1,006 | 3.515625 | 4 | [
"MIT"
] | permissive | exports.min = function min(array) {
let min = 0;
if (typeof array == 'undefined' || array.length == 0) {
return 0;
} else {
for (let i = 0; i < array.length; i++) {
if (array[i] < min) {
min = array[i];
}
}
return min;
}
}
exports.... | true |
265fc7547a7b9cfabea1ad90e49722a4d15ba687 | JavaScript | StarkovAleksandr/my_project | /HomeTasks2/Task4.js | UTF-8 | 123 | 3.015625 | 3 | [] | no_license | let arr = [1, 2, "sad", "a", "456", 456];
let newArr = arr.filter((item) => typeof item == "number");
console.log(newArr);
| true |
3b4e7885c12314d2dcbd89cc4fa018368595a642 | JavaScript | stephen-donga/Refactory-Catalyst002-Final-Assessment | /timmwandha/mwandhawebserver.js | UTF-8 | 3,360 | 3.203125 | 3 | [] | no_license | /** This written by Timothy Wampa Mwandha creates a node.js web server,
* that passes values from the student detail Form and inserts them into a database. */
/** Upon install via npm, node's web framework called Express calls extra native and3rd party
* packages (files & libraries) which are required to move dat... | true |
cc4ab9a44aae9501c1ca2fb7835ed936dd2c7f67 | JavaScript | JoachimBorup/algorithm-visualizer | /src/algorithms/sorting/merge.js | UTF-8 | 1,149 | 3.171875 | 3 | [
"MIT"
] | permissive | class MergeSort extends Sort {
async sort() {
this.aux = [];
await this.sortHalves(0, num_of_values - 1);
}
async sortHalves(lo, hi) {
if (hi <= lo) {
return;
}
const mid = Math.floor(lo + (hi - lo) / 2);
await this.sortHalves(lo, mid);
... | true |
92d22da5b38e26ca317757470e12eb546b90c79f | JavaScript | melanienolan/data-viz-notebook | /src/components/Tooltip.js | UTF-8 | 1,974 | 2.515625 | 3 | [] | no_license | import React from "react";
const Tooltip = ({
x,
y,
width = 200,
height = 50,
isShown = false,
content,
dimensions,
}) => {
let boxX1, boxX2, boxY1, boxY2, pointRight, pointMiddle, pointLeft, points;
let isUpsideDown = false;
if (x < width / 2) {
boxX1 = x / 2;
boxX2 = boxX1 + width;
} el... | true |
a98137f348f2026796ce665cce23b964b2f2bb1a | JavaScript | jxd88/javascript-jquery | /javascript.js | UTF-8 | 2,561 | 2.8125 | 3 | [] | no_license | $(document).ready(function(){
$('input[type=radio][name=drawtype]').on('change', function() {
$(".unit").off(); //// reset event handlers when choosing new type of animation
if (this.value == 'radio1') {
draw();
}
else if (this.value == 'radio2') {
... | true |
40bfa06cc73be4f31e9201c09cc5f32afac2c1a5 | JavaScript | wqx133695/ojo | /project/ojo/js/public.js | UTF-8 | 2,586 | 3.296875 | 3 | [] | no_license | // 补零功能
function createZero(n){
if(n.length<2 || n < 10){
return "0"+n;
}else{
return n;
}
}
// 范围随机数功能
function random(max,min){
return Math.round(Math.random()*(max-min)+min)
}
// 日期的格式化
function createDate(){
var d = new Date();
var y = d.getFullYear()
var m = d.getMonth()
va... | true |