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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
b528d1497218971ceaa6dcedcffaad07a07501cb | JavaScript | chenya1123236324/PWA | /sw.js | UTF-8 | 1,766 | 2.890625 | 3 | [] | no_license | // 缓存的字符串名称,可更改
var cacheStorageKey = 'daniujia'
// 缓存文件列表
var cacheList = [
'/',
"index.html",
"main.css",
"logo.png",
"become.png"
]
// 注册完成安装 Service Worker 时, 抓取资源写入缓存
self.addEventListener('install', function (e) {
console.log('缓存事件触发!')
e.waitUntil(
caches.open(cacheStorageKey).then(function (... | true |
9488bc3f3502c3f126d42c66f76f2bda2af580ef | JavaScript | timohh97/React-like-button | /src/App.js | UTF-8 | 546 | 2.5625 | 3 | [] | no_license | import React, {useState} from 'react'
import './App.css'
function App()
{
const [count, setCount] = useState(0)
const [red, green] = useState(false)
const [left,right] = useState(false)
const incrementLike= ()=>
{
setCount(count+1)
green(!red)
right(!left)
}
return(
<div classN... | true |
52bf46de6dfb05eceb568a02d662ec75064f963d | JavaScript | jfuller957/sandbox | /lessons_traversy_media/modern_js_from_beginning/section_five/constructors/app.js | UTF-8 | 466 | 3.984375 | 4 | [] | no_license | // Person Constuctor
function Person(name, dob) {
this.name = name;
// this.age = age;
this.birthday = new Date(dob);
this.calculateAge = function() {
const diff = Date.now() - this.birthday.getTime();
const ageDate = new Date(diff);
return Math.abs(ageDate.getUTCFullYear() - 1970);
};
}
// const... | true |
132f7fd5a0ecd2fab3a84510e325c31e34040e64 | JavaScript | Zaynas-gif/simple | /script.js | UTF-8 | 1,065 | 2.859375 | 3 | [] | no_license |
var person = {
firstName: "Jonas",
lastName : "Mikutavicius",
language : "Svenska/Engelska/Litausika",
age: 25,
hobbies: "Kampsport/Böcker/Datorspel",
gatan: "Tranemansgatan 21B",
stad: "Helsingborg",
get namn() {
return this.firstName;
},
get efternamn () {
... | true |
f92a8761543ee5c3efe45b29eaa9724e186d7d5f | JavaScript | silaslangley98/super-cool-app | /public/js/controllers/main-controller.js | UTF-8 | 1,108 | 2.640625 | 3 | [] | no_license | (function(angular) {
"use strict";
var app = angular.module('superApp');
app.controller('MainController', function($scope, FeaturesService) {
FeaturesService.getFeatures().then (
function(response) {
features = response.data;
angular.forEach(features, function(feature) {
if (feature.mostRe... | true |
caa4eb9da3551677bd3bab213a439c73b13fdd02 | JavaScript | Kesymaru/js3-19-pomodoro | /src/js/pomodoro.js | UTF-8 | 12,125 | 3.03125 | 3 | [] | no_license | /**
* Module for the Pomodoro class
* This class manages the pomodoros
*/
const Pomodoro = (function () {
// private vars
const DATA = new PomodoroData();
// Pomodoro class
return class Pomodoro {
_formOpen = false;
/**
* Init the Pomodoro
* @param {String|HTMLEle... | true |
a5386a6072b1c7fa16fd9767870f6ea5f1f3b4a7 | JavaScript | BabaSar/notes-node | /notes.js | UTF-8 | 2,118 | 3.46875 | 3 | [] | no_license | const fs = require('fs');
var fetchNotes = () => {
try{
//fetch the existing notes
var notesString = fs.readFileSync('notes-data.json');
return JSON.parse(notesString); //bring it back into an object
}catch(e){
return []; //returns an empty array as opposed to JSON array of obj... | true |
4a3812e997304b2839a01cc5a7cb97e0ce30deff | JavaScript | Kizletsky/board | /app/javascript/favorites.js | UTF-8 | 1,581 | 2.75 | 3 | [] | no_license | /* global $ */
const favoriteTemplate = require('./templates/favorites/favorite.hbs')
const addLink = require('./templates/favorites/add_link.hbs')
const removeLink = require('./templates/favorites/remove_link.hbs')
export function initFavorites () {
fillFavoritesDropdownOnClick()
appendFavorite()
removeFromFavo... | true |
3c1c4bbaa564d7495119a33fa1667a3fa048275f | JavaScript | santant/vue-resumable | /src/utils/queue.js | UTF-8 | 1,600 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | export default class Queue {
constructor(options) {
this.thread = options.thread
this.uploaderList = options.uploaderList
this.enableChunk = options.enableChunk
let recursive = null
let list = null
return new Promise(resolve => {
if (this.enableChunk) {
recursive = () => {
... | true |
ffcc7cd98f77fb84a84515e157b08743613572f6 | JavaScript | rahulbaghel2552/react_crud_demo | /src/component/users/User.js | UTF-8 | 1,396 | 2.5625 | 3 | [] | no_license | import { useState, useEffect } from "react";
import axios from "axios";
import { useHistory, useParams } from "react-router-dom";
const User = () => {
const { id } = useParams();
const [user, setUser] = useState({
name: "",
username: "",
email: "",
phone: "",
website: "",
});
useEffect(() ... | true |
4e4ac2b2dbc3924fd2317eaccc6e7ffb78c99623 | JavaScript | shanaslavin/SummerTraceCamp | /week3/review/contextApi/context-counter/src/components/App.js | UTF-8 | 510 | 2.734375 | 3 | [] | no_license | import React, { useState, useContext } from "react";
import CounterContext from "../context/CounterContext";
function App() {
const counterContext = useContext(CounterContext);
return(
<div>
<h1>Hello App</h1>
<button onClick = { () => counterContext.setCounter((counter) => counter + 1) }> Inc... | true |
604372b44552aeb521328a36faba3ee2c35ffdf2 | JavaScript | YusraSenimAydin/JS-Algorithm-Studies | /2.veritipleri.js | UTF-8 | 1,503 | 3.59375 | 4 | [] | no_license | /*Ödev 1
Bir değişken oluşturun ve bu değişkende saniye değerini tutun.
Sonra bu saniye değerinin kaç dakika ve saniyeye denk geldiğini yazdırın
Örnek 1200 değeri için 20 dakika 0 saniye yazmalıdır.*/
let saniyeString = prompt("Saniye değerini giriniz", "100");
let saniye = parseInt(saniyeString);
let dakika = par... | true |
e5808e342bec03fe110b38a9f5e8c3dd0a065224 | JavaScript | siramkalyan/react-case-study | /src/Newapp.js | UTF-8 | 2,847 | 2.75 | 3 | [] | no_license | import React ,{ Component } from 'react';
import App from './App';
import {Link} from 'react-router-dom';
import Display from './Display';
class Component1 extends React.Component {
constructor(props) {
super(props);
this.state = {name: "User" , age : "0",gender:"male",country:"indian"};
this.sub... | true |
bb83d6a250c9887d17e3df2dc1147e9d2a0e8ef6 | JavaScript | KentaroSmith/Train-Schedule | /assets/javascript/app.js | UTF-8 | 3,096 | 2.90625 | 3 | [] | no_license | var firebaseConfig = {
apiKey: "AIzaSyCdaAzNguVciD9dYhwG09qpYkZq0pv5wzI",
authDomain: "train-56005.firebaseapp.com",
databaseURL: "https://train-56005.firebaseio.com",
projectId: "train-56005",
storageBucket: "",
messagingSenderId: "573420792033",
appId: "1:573420792033:web:27e10f7e9ae21f2c"... | true |
f9c60f97c8b14a74fe1bdbd1ee3958647daf6613 | JavaScript | charlesreid1/a-shrubbery | /pelican/maps/barrygoldwater.js | UTF-8 | 2,730 | 2.578125 | 3 | [] | no_license | // prefix defined in common.js
// create the map, assign to the mao div, and set it's lat, long, and zoom level (12)
//var map = L.map('map').setView([-100.0,35.0], 12);
var map = L.map('map').setView([32.8, -113.5], 10);
//var map = L.map('map').setView([-113.5, 32.5], 10);
var attribution = '<a href="http://www.doi... | true |
3ec4a58d4d7edfcc11e40fcea333f8745dab118e | JavaScript | Vuizlx/Astronaut | /comandos/botstats.js | UTF-8 | 1,914 | 2.5625 | 3 | [] | no_license | const Discord = require("discord.js");
const { RichEmbed } = require('discord.js');
exports.run = async (client ,message, args) => {
let bot = client
let bicon = bot.user.displayAvatarURL;
const msg = await message.channel.send(new RichEmbed()
.setTitle(`Informações | ${bot.user.username}`)
.setColor... | true |
8af154dad61448c5ab3b0dba7e59884b72f49c2f | JavaScript | rowlandjl/js-looping-and-iteration-filter-lab-cb-000 | /index.js | UTF-8 | 425 | 2.90625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | function findMatching(drivers, str) {
return drivers.filter(function(driver) {
return driver.toLowerCase() == str.toLowerCase();
});
}
function fuzzyMatch(drivers, str) {
return drivers.filter(function(driver) {
return driver.slice(0,str.length) == str;
});
}
function matchName(drivers, str) {
ret... | true |
f923db3d2daf9b8086a166a51658d04096cbe923 | JavaScript | dpyatin/Relevant | /Chrome extension/content.js | UTF-8 | 644 | 2.578125 | 3 | [] | no_license | chrome.runtime.onMessage.addListener(
function(request, sender, sendResponse) {
if (request == "getHtml") {
sendResponse({result: document.documentElement.outerHTML});
} else if (request == "getUsername") {
var htmlBody = document.documentElement.outerHTML;
var username = "";
if ($(htmlBo... | true |
77d378db9b1c76950389b69fc336dc8a50b13c5e | JavaScript | AlanJhonatan/image-crop-vanillajs | /src/scripts.js | UTF-8 | 2,956 | 2.71875 | 3 | [] | no_license | import CroppingTool from './cropping-tool.js';
const photoFile = document.getElementById('photo-file');
const selectImage = document.getElementById('select-image');
const photoPreview = document.getElementById('photo-preview');
const selectionTool = document.getElementById('selection-tool');
const cropButton = documen... | true |
20b5b518755b5e95f30049be7a4f3460542ac56d | JavaScript | anonymouspanda-23/WebDev | /public/scripts/calculator.js | UTF-8 | 694 | 4.15625 | 4 | [] | no_license | const myHeading = document.querySelector('h1');
myHeading.textContent = 'Number Multiplier';
let multiplyNumbers = document.getElementById("multiply");
let result = document.getElementById("result");
function multiply() {
let number1 = document.getElementById("number-1").value;
let number2 = document.getEleme... | true |
5ba913c695bf140e7b742f46ef1e854582b74af7 | JavaScript | awilsongithub/eloquent_javascript | /06_objects/06_exercises.js | UTF-8 | 5,722 | 4 | 4 | [] | no_license |
/* ===========================
GET TO THE ROOT
AND BE EFFICIENT
WITH THE POWER OF
PROTOTYPICAL INHERITANCE!
============================== */
console.log( Object.getPrototypeOf([]) == Array.prototype ); // T
// define a functin and give it an object literal
function speak(noise){
var sound = this.type + ' says ' +... | true |
6bd14f15d79103c8a1cab267ba6a945a0e126c3c | JavaScript | zuzannakowal/aplikacje | /nodejs01/server10.js | UTF-8 | 714 | 2.703125 | 3 | [] | no_license | var fs = require("fs");
var http = require("http");
var server = http.createServer(function(req,res){
fs.readFile("static/index.html", function (error, data) {
if (error) {
res.writeHead(404, { 'Content-Type': 'text/html' });
res.write("<h1>błąd 404 - nie ma pliku!... | true |
d0888a76bf0e9aee5cb1c04cab01fb71aab99d73 | JavaScript | ZachBarbre/week7 | /learnyounode/mymodule.js | UTF-8 | 365 | 2.671875 | 3 | [] | no_license | 'use strict'
module.exports = function(filePath, fileExt, callback){
const fs = require('fs');
fs.readdir(filePath, function (err, fileList){
if (err){
callback(err);
}
callback (null, fileList.map(file => {
if (file.split('.')[1] === fileExt){
re... | true |
c4ce08c60d433b6d7c1770ca5dea78ccf4f74f2e | JavaScript | cainrus/snake | /js/snake.js | UTF-8 | 3,261 | 3.453125 | 3 | [] | no_license | 'use strict';
function Snake(options) {
var self = this;
this.length = 0;
this.options = options || {};
var listenerHandler = function (e) {
var direction = self.getDirection();
switch (e.keyCode) {
case 37:
if (direction !== 'right') {
... | true |
93a1d73dde119943087a59c5d6e4171dd71ad834 | JavaScript | CobaltBlueDW/BlueBolts | /Server/www/bluebolts/libs/jquery/plugins/textmatting/jquery.textmatting.js | UTF-8 | 1,117 | 2.78125 | 3 | [] | no_license | /** jQuery Textmatting: A jQuery plugin used to format text.
*
* ToDo:
* - add valuable standard formats to the formats list.
*
* @author David Wipperfurth
* @group WellBe.me
* @dated 4/8/10
*/
(function(){ //scope for variable protection (likely not used, but still a good idea to use by default)
//variables
jQu... | true |
910738b04a8a5007ffc8a2e04ddc82f383e01af6 | JavaScript | phatnguyenuit/FrontEnd-Masters | /deep-js-foundations-v3/types-exercises/equality/ex.js | UTF-8 | 3,125 | 3.515625 | 4 | [
"MIT"
] | permissive | function findAll(value, array) {
return array.filter((item) => {
if (Object.is(value, item)) return Object.is(item, item);
else if (value == null && item == null) return Object.is(item, item);
else if (
typeof value == "number" &&
!Object.is(value, -0) &&
!Object.is(value, NaN) &&
... | true |
2b6305a715a9b18da6812e5738df4968c1727390 | JavaScript | emineozgenel/find-jobs-reactjs | /src/components/List/Index.js | UTF-8 | 2,185 | 2.546875 | 3 | [] | no_license | import { useContext, useState } from 'react';
import { Container, Row, Col} from 'react-bootstrap';
import {JobContext} from "../../context/JobContext";
import Search from "../Search/Index";
import Card from "../Card/Index";
import Filter from "../Filter/Index";
import './style.css';
const Jobs = () => {
const {jobs... | true |
e53e9a0a1bdef0a1f1d95b89ffffc335009540bb | JavaScript | talyaron/fullstack-int-aug20 | /Javascript/functions/cherut/js.js | UTF-8 | 348 | 3.609375 | 4 | [
"Artistic-2.0"
] | permissive | function CalculateAge(BirthYear, CurrentYear) {
return CurrentYear - BirthYear;
}
// let MyAge = CalculateAge(1998,2020);
// console.log(MyAge);
function namesToObj(firstName, surname) {
let obj = { firstName, surname }
return obj;
}
namesToObj('cherut', 'gur');
let x = namesToObj('cheru... | true |
e8be5a71e71213bcd3d196a9ee7f2acc167f8176 | JavaScript | fansOnly/JUSTCODING | /30secondsofcode.org/algorithm/distance/distance.js | UTF-8 | 260 | 3.984375 | 4 | [] | no_license | /**
* distance
* Calculate the distance between two points.
* 1. Use the Math.hypot() to calculate the Euclidean distance between two points.
*/
const distance = (x0, y0, x1, y1) => Math.hypot(x1 - x0, y1 - y0)
console.log(distance(1, 1, 2, 3)) // ~2.236
| true |
16b312f1d77722e8f2b6d19d3c6adb7a73e4ae4f | JavaScript | RCosson/exoJsCafe | /app.js | UTF-8 | 2,943 | 3.59375 | 4 | [] | no_license | //message d'accueil
console.log("Bienvenue!");
//initialisation de la fonction permettant la commande et la production d'un café
function cafe() {
//déclaration des différents cafés
var court = 1;
var long = 1.2;
var lait = 1.5;
var cafes = ["court", "long", "lait"];
//boucle de sélection d'un café s'il exi... | true |
8322acc5a66c4a491b6ea74ff2002f08de91fea5 | JavaScript | kaleem7832/ResponsiveSurveyRendering | /app/views/questions/dropdown-grid-question-view.js | UTF-8 | 2,983 | 2.640625 | 3 | [
"MIT"
] | permissive | import QuestionWithAnswersView from './base/question-with-answers-view.js';
import ValidationTypes from "../../api/models/validation/validation-types";
export default class DropdownGridQuestionView extends QuestionWithAnswersView {
constructor(question) {
super(question);
this._attachHandlersToDOM... | true |
3db4aaa952acb11b0dbeeaeef3a5b5c4dc007fb0 | JavaScript | 15692458767/thinker | /controllers/index.js | UTF-8 | 1,842 | 2.625 | 3 | [] | no_license | // 引入话题模型
const topic = require('../models/topic');
// 引入话题分类模块
const topicCategory = require('../models/topic_category');
exports.index = (req, res, next)=>{
// 接收分类的id
const {categoryId} = req.query;
let conditions = {}
if(categoryId){
conditions={
categoryId
}
}
... | true |
c5f068ccb1090dee72f5abef5038fe9a4f8cd124 | JavaScript | Bruno97442/gaming | /batonnes/class/IfBatons3d.js | UTF-8 | 7,612 | 2.5625 | 3 | [] | no_license | class IfBatons3d {
static instance = null
_nombre
get nombre() {
return this._nombre
}
set nombre(value) {
this._nombre = value
}
_pioche = []
get pioche() {
return this._pioche
}
set pioche(value) {
this._pioche = value
}
... | true |
56f7388d4167748f7dec4edf53ab9a1366290241 | JavaScript | JollyRougerLovers/SimpleMessage | /www/cdn/js/users.js | UTF-8 | 3,008 | 2.78125 | 3 | [] | no_license | const usersListClass = function () {
this.add = function (properties) {
if (typeof properties === "undefined")
return false;
lists[properties.id] = new userListClass(properties.id);
lists[properties.id].adds(properties);
return true;
}
this.set = function (id, p... | true |
1362c3b322d8b664e19b054dc77698e0c60577f3 | JavaScript | Lucas-Uniqodo/MV-bootcamp | /sqlStuff/insert.js | UTF-8 | 2,580 | 2.921875 | 3 | [] | no_license | const sqlite3 = require('sqlite3').verbose();
/**
* This code inserts some rows in the tables for the Restaurants assignment
*/
function insert() {
// connect to a database named restaurants.sqlite
const db = new sqlite3.Database('./restaurants.sqlite');
try {
db.serialize(function () { // seriali... | true |
df996f7aeac93d882e6299b7a6ef579fecca9a29 | JavaScript | taiki-fw/AtCoder | /ABC143/A.js | UTF-8 | 375 | 3.203125 | 3 | [] | no_license | "use strict";
main(require("fs").readFileSync("/dev/stdin", "UTF-8"));
function main(input) {
input = input.split("\n");
const window_width = parseInt(input[0].split(" ")[0]);
const curtain_width = parseInt(input[0].split(" ")[1]);
let not_enougth = window_width - curtain_width * 2;
if (not_enougth < 0) {
... | true |
d07686065406f75b7112de6cc90b30e66f7f1ee0 | JavaScript | withinsight/jquery-promises-demo | /js/app.js | UTF-8 | 1,388 | 2.546875 | 3 | [
"MIT"
] | permissive | // jQuery Promises and Caching Demo
promiseDemo = {
init: function() {
var feedUrl = function( cat ) {
return 'http://blog.ted.com/category/' + cat + '/?feed=json&jsonp=cb';
}
var technologyPromise = promiseDemo.ajax( feedUrl( 'technology' ), 'technology-feed' );
var entertainmentPromise = t... | true |
78ad70c9e317501e56ceb37b32c968176669bc5a | JavaScript | kemperrr/rjs | /classes/pickup.js | UTF-8 | 1,018 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | const Entity = require("./entity")
module.exports = class Pickup extends Entity {
/**
* https://wiki.gtanet.work/index.php?title=Pickups
* @param {native|Int} native native or Int
* @param pos
* @param rot
* @param vehicle
* @param respawnTime
* @param dimension
* @returns {*}
... | true |
546fe7d587a3e1f00eb252b787aa62c4c489cb27 | JavaScript | ziqingW/iching_api | /test/app.spec.js | UTF-8 | 1,839 | 2.78125 | 3 | [
"MIT"
] | permissive | const app = require('../app.js')
const chai = require('chai')
const chaiHttp = require('chai-http')
chai.use(chaiHttp)
const expect = chai.expect
const nock = require('nock')
const axios = require('axios')
const api = nock("http://example.com")
.get('/api/')
.reply(200, {status: 'NOT FOUND'})
// unit test
// sy... | true |
434dea5bc9cc728ed2ff62698fcc65be2ef41a7e | JavaScript | sokol1412/PSSO | /Projekt/Projekt 4 zad 2/queue.js | UTF-8 | 496 | 2.703125 | 3 | [] | no_license | maze_app.factory('Queue', function() {
function Queue() {
this.container = [];
}
Queue.prototype.pop = function() {
if (this.container.length > 0) {
var e = this.container[0];
this.container.shift();
return e;
} else
alert("Maze impossible to be solved");
};
Queue.prototype.pushBack = function(... | true |
5e646ae2484b91d95a8ef97683a48c0ec39b09aa | JavaScript | paigen11/codingChallenges | /firstFactorial.js | UTF-8 | 637 | 4.59375 | 5 | [] | no_license | /* Have the function FirstFactorial(num) take the num parameter being passed and
return the factorial of it (e.g. if num = 4, return (4 * 3 * 2 * 1)).
For the test cases, the range will be between 1 and 18 and the input will always be an integer.
*/
function FirstFactorial(num) {
var factorial = 1;
for(let ... | true |
3372a1eb737612ff380aeb6d71fd3103561c29bd | JavaScript | kevin36524/nodeAlgos | /trees/identicalTrees.js | UTF-8 | 2,104 | 3.625 | 4 | [] | no_license | var Tree = function (obj) {
if (!obj || !obj.v) {
return;
}
this.val = obj.v;
if (obj.l) {
this.left = new Tree(obj.l);
}
if (obj.r) {
this.right = new Tree(obj.r);
}
}
var checkForIdenticalTrees = function(tree1, tree2) {
if ((!tree1 && !tree2) || (!tree1.... | true |
201cbaae64d2abe03b1eab86a94e5554ad011557 | JavaScript | CamielJalink/Advent-of-Code-2020 | /day19/part1/dist/helpers.js | UTF-8 | 2,461 | 2.84375 | 3 | [] | no_license | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.connectRules = exports.Rule = void 0;
var Rule = /** @class */ (function () {
function Rule(stringRule) {
var _this = this;
this.children = [];
this.childRulesSets = [];
this.validAnswers = [];
... | true |
8b5e2c2e0e134dae5d6ce7ecc6d3a284eeb629c5 | JavaScript | rasuloff789/todo-react | /src/App.jsx | UTF-8 | 1,285 | 3.015625 | 3 | [] | no_license | import { useState } from 'react'
import "./App.css"
function App () {
const [todos, setTodos] = useState([])
let [todoID, setTodoID] = useState(0);
const createTodo = e => {
if (e.keyCode === 13) {
setTodoID(todoID => todoID + 1);
let newTodo = {
id: todoID,
title: e.target.value.tri... | true |
bdd0444c7e771dd382a3dfe70ffcd5517776f73a | JavaScript | VeraKuzub/JS-geekHub-homeWorks | /homework_11_myGitHubProfilePage/client/script.js | UTF-8 | 4,360 | 2.859375 | 3 | [] | no_license | // 1. Зробити сторінку “My GitHub Profile” (додаткове завдання - розмістити її на github pages),
// з короткими даними про вас (дані з гіта отримуємо з допомогою методу fetch - у GitHub непоганий API,
// наприклад https://developer.github.com/v3/repos/branches/… - приклад отримання списку бранчів).
// 2. Обов’язково... | true |
8a914f2a8b2eaaed11ea7374529a2c3b8a8328e1 | JavaScript | tellnes/track.js | /track.js | UTF-8 | 4,422 | 2.53125 | 3 | [
"MIT"
] | permissive | ;(function(undefined) {
var nextTick = (typeof process !== 'undefined') && process.nextTick || function(fn) {
setTimeout(fn, 0)
}
var isArray = Array.isArray || function(obj) {
return Object.prototype.toString.call(obj) === '[object Array]'
}
var EventEmitter
try {
EventEmitter = require('eve... | true |
cf7506dbd6eb0be9902203001d33f8f0c80b36f1 | JavaScript | Genicleito/MATA56_Paradigmas | /forEach2.js | UTF-8 | 146 | 3.171875 | 3 | [] | no_license | function escreveNomes3() {
var nomes = ["Joao", "Maria", "Genicleito"], counter;
nomes.forEach(nome => console.log(nome));
}
escreveNomes3();
| true |
3f0bf82a574b109548e5712c7aee2bd8529f445a | JavaScript | MyGreenSlime/Appman-test | /bingo.js | UTF-8 | 3,123 | 3.5 | 4 | [] | no_license |
var stdin = process.openStdin();
function getRandomInt(max) {
return Math.floor(Math.random() * Math.floor(max));
}
function generateBoard(boardsize){
var numbers = [...Array(boardsize[0]*boardsize[1]).keys()].map(value => {
return value+1
})
var board = []
for(var i = 0; i < boardsize[... | true |
53e3522a2b3bc5de3d4b9e1309191b9a200a54aa | JavaScript | palmtoy/Exercise | /Nodejs/StringifyTest/Backup/app-1.js | UTF-8 | 374 | 3 | 3 | [] | no_license | function CFuncs() {
this.onenter = function() {
console.log('Hello World');
};
var f = function() { return 'f' };
this.f = f;
this.foo = 'bar';
}
CFuncs.prototype.myFunc = function() { return 'myFunc' };
CFuncs.prototype.myStr = 'myStr';
var o = new CFuncs();
o.tmpFunc = function() { return 'tmpFunc' ... | true |
a644d0484f68d9a1adf067252b1f832f6e56e083 | JavaScript | EricLuceroGonzalez/devf-dojo | /js/07-API/07-js-API.js | UTF-8 | 1,652 | 3.296875 | 3 | [] | no_license | // 07-js-API
// From documentation: Express `Hello World` at https://expressjs.com/en/starter/hello-world.html
const express = require("express");
const app = express();
const port = 3000;
// To parse a boydy to json
var bodyParser = require("body-parser");
// parse application/x-www-form-urlencoded
app.use(bodyPar... | true |
fda2fd5563c262a4f4739ce1e8af3b2458ff9355 | JavaScript | mohit-n-rajput/songbook-website | /songbook/assets/js/register.js | UTF-8 | 681 | 2.828125 | 3 | [] | no_license | // jquery syntax
$(document).ready(function(){
console.log('document is ready.');
//by writing $(".hideLogin") jquery create element object
// code for hide login
$("#hideLogin").click(function(){
console.log('login hide button was pressed.');
$("#loginForm").hide(); //when click on sp... | true |
ddad1b9b22bf1a957b3cd0feebc392aef00486f0 | JavaScript | m0inur/problem-solving-hackerrank | /Problem-Solving/Extra-Long_Factorial/index.js | UTF-8 | 161 | 3.75 | 4 | [] | no_license | var n = 50;
function fact(n) {
var sum = 0;
if (n == 1) {
return 1;
}
sum = n * fact(n - 1);
return sum;
}
console.log(fact(n)); | true |
99effe5f2883efbbc373e464a3f75c695021751b | JavaScript | MikuBlog/xz-func-programming | /jsonp.js | UTF-8 | 533 | 2.78125 | 3 | [] | no_license | /**
* 手写jsonp跨域
*/
function jsonp({
url,
params,
callbackName
}) {
const generateUrl = () => {
let dataSrc = []
for (let key in params) {
dataSrc.push(`${encodeURIComponent(key)}=${params[key]}`)
}
return `${url}?${dataSrc.join("&")}&callback=${callbackName}`
}
return new Promise((resolve, reject) =>... | true |
4b9209ed94a0f06157b8b48aeea60b5f614c35f9 | JavaScript | sowndarya1299/guvi | /javascript.js/noofdays-month.js | UTF-8 | 417 | 2.9375 | 3 | [] | no_license |
const readline = require('readline');
const inp = readline.createInterface({
input: process.stdin
});
inp.on("line", (month) => {
if(month == 1 or month == 3 or month == 5 or month == 7 or month == 8 or month == 10 or month == 12)
console.log("31");
if(month == 2)
console.log("28");
if(month == 4 or month == 6 o... | true |
b1892d37e1944c5836f4648b24402fc0635f66f8 | JavaScript | jgraham0325/traccar | /web_src/app/GeofenceConverter.js | UTF-8 | 3,699 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | /*
* Copyright 2016 Anton Tananaev (anton.tananaev@gmail.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required b... | true |
c0f909f78cefd69c780ccd3c23d4b5d4d697646c | JavaScript | gen-a/step-project-forkio | /src/components/MenuSwitch/MenuSwitch.js | UTF-8 | 1,325 | 2.9375 | 3 | [] | no_license | const switchClassName = "MenuSwitch";
const switchOpenClassName = "MenuSwitch_isOpen";
const navClassName = "Header-Navigation";
const navActiveClassName = "Header-Navigation_isActive";
let addClass = function (elements, className) {
elements.forEach(element => element.classList.add(className));
};
let removeClas... | true |
5536ac12adc0783f89eb15783e72b8ff6d81e725 | JavaScript | Baz86/React-Username-Changer | /src/App.js | UTF-8 | 1,231 | 2.734375 | 3 | [] | no_license | import React, { Component } from 'react';
import './App.css';
import Output from './UserOutput/UserOutput';
import Input from './UserInput/UserInput'
class App extends Component {
state = {
users: [
{ username: 'Tom' },
{ username: 'Sophie' },
{ username: 'Emma' },
{ username: 'James' },... | true |
b53f6932250914132bc00932f5cc011f19e51f56 | JavaScript | MarinaMeza/Ejercicios_JavaScript | /EjercicioN11/scripts/script.js | UTF-8 | 312 | 2.921875 | 3 | [] | no_license | function color(id,color){
//var newColor="blue";
var R=Math.floor(Math.random() * 256);
var G=Math.floor(Math.random() * 256);
var B=Math.floor(Math.random() * 256);
/*
var R=84;
var G=133;
var B=184;*/
document.getElementById(id).style.backgroundColor="rgb("+R+","+G+","+B+")";
} | true |
a8e5cfe1fcd9d9ef4283343613c3cce833d62073 | JavaScript | saramartinss/reprograma-javascript-iii | /03-promises/main.js | UTF-8 | 1,102 | 2.96875 | 3 | [] | no_license | const cep_input = document.getElementById("cep");
const logradouro = document.getElementById("logradouro");
const complemento = document.getElementById("complemento");
const bairro = document.getElementById("bairro");
const localidade = document.getElementById("localidade");
const uf = document.getElementById("uf");
co... | true |
24655c27691239139cea81689f49f63dbd63d18a | JavaScript | akudrin/JavaScript-Code-Samples | /Node Cookbook/CH2/file-watching/watch.js | UTF-8 | 243 | 2.609375 | 3 | [] | no_license | const fs = require('fs');
const moment = require('moment');
const file = './file.txt';
fs.watchFile(file, (current, previous) => {
const time = moment().format('MMMM Do YYYY,h:mm:ss a');
return console.log(`${file} updated ${time}`);
});
| true |
2bd033f7568f5024da15c0218c0299c11fc9daa7 | JavaScript | CityGenerator/CityGenerator | /js/CityMap.js | UTF-8 | 23,045 | 3.03125 | 3 | [] | no_license |
/* ========================================================================= */
/* CityMap is the base object for generating the city map.
/* TODO This should be abstracted out with WorldMap
/* ========================================================================= */
CityMap.prototype = Object.create(VoronoiMap.pr... | true |
8383aa32c02f0cd4dfde4efd19b7dae30148d27d | JavaScript | jddj007-hydra/Blazor.ECharts | /Blazor.ECharts/wwwroot/core.js | UTF-8 | 2,338 | 2.671875 | 3 | [
"MIT"
] | permissive | // This is a JavaScript module that is loaded on demand. It can export any number of
// functions, and may import other JavaScript modules if required.
export function showPrompt(message) {
return prompt(message, 'Type anything here');
}
export class echartsFunctions {
static liChart = new Array();
stati... | true |
0e43c0b63b11924e57793bcb1522f994f8cb450f | JavaScript | Daniel--cai/randomdatabase | /src/jsmidgen.js | UTF-8 | 1,223 | 2.609375 | 3 | [] | no_license | const fs = require('fs');
const Midi = require('jsmidgen');
const file = new Midi.File();
const track = new Midi.Track()
track.c = function(note,length){
if (typeof(note) === 'string'){
this.note(0,note,length)
} else {
this.addChord(0, note, length)
}
return this
}
track.n = function(note,length){
... | true |
eeae79b96d68e5a686a99ea33a55719779e9342b | JavaScript | joseisaacz/blockchian-js | /src/blockchain/block.js | UTF-8 | 1,469 | 2.734375 | 3 | [] | no_license | import genHash from '../modules/hash';
import adjustDiff from './modules/adjustDiff';
const DIFFICULTY = 3;
class Block{
constructor(timestamp, previousHash, hash, data, nonce, difficulty){
this.timestamp= timestamp;
this.previousHash= previousHash;
this.hash= hash;
this.data= data;
this.nonce= nonce;
this.dif... | true |
8bad40ec2c97fed76354992963506677be9ae02e | JavaScript | 98o718/mlp-front | /src/teacher.worker.js | UTF-8 | 3,242 | 2.796875 | 3 | [] | no_license | const tf = require('@tensorflow/tfjs')
export function teach(
randomPointsArray,
nu,
weights01Array,
weights02Array,
weights2Array,
teachOutputArray,
count
) {
tf.setBackend('cpu')
let randomPoints = tf.tensor(randomPointsArray)
let weights01 = tf.tensor(weights01Array)
let weights02 = tf.tensor... | true |
9fc729c7c8489fed69ce7788b10653afceebeadc | JavaScript | jersonsw/jswdb | /web-ui/src/store/persisted.store.js | UTF-8 | 1,436 | 2.71875 | 3 | [] | no_license | import {updateClasses} from './middlewares/settings.middleware.js';
import {updateTheme} from './middlewares/themes.middleware.js';
const STORAGE_KEY = 'angle-store-key';
/**
* Use this function if you need to call a middleware
* when setting the initial state.
*/
const callMiddlewares = state => {
// Since a... | true |
efd0653a3dc6d663aa18252564040dec1689f528 | JavaScript | tuanthanhngo/line2csv | /wrap/filesys.js | UTF-8 | 1,368 | 2.828125 | 3 | [] | no_license | // import global
// tested is OK 2016/02/22 12:30
var fs = require("fs");
module.exports = {
/////////////////////////////////
// sync read text file by fs.readFile
// tested: OK, 2016/02/22 12:30
readFile2StringSync: function(filepath) {
//var fs = require("fs");
// fs.readFileSync(path, 'utf-8');
... | true |
a476a52820eb553b70e90bc4ff4111062fbb5c91 | JavaScript | RyanChenPublic/OpenDataWebApi | /OpenDataWebApi/wwwroot/js/index.js | UTF-8 | 1,585 | 2.875 | 3 | [] | no_license | $(document).ready(() => {
//綁定取得資料按鈕
$("#getOpenData").on("click", () => {
getOpenData();
})
$("#InsertDb").on("click", () => {
InsertDb();
})
})
//fetch 後台API取得資料
function getOpenData() {
fetch("api/Population", { method: 'get', redirect: 'follow' }).then(response => {
... | true |
b2c4657f3eaa3db1a57535d0b3c3f3f381eb1938 | JavaScript | crperezchica/meme-generator | /examplesrc/ecomponents/eApp.js | UTF-8 | 2,413 | 2.921875 | 3 | [] | no_license | import React, { PureComponent } from 'react';
import figlet from 'figlet';
import domToImage from 'dom-to-image';
import fileSaver from 'file-saver';
class App extends PureComponent {
state = {
count: 0,
// hi: {
// text: 'you'
// },
text: 'hi there',
// anotherText: '',
formattedText... | true |
25ba63264149085af6f118b07198fdc9b4cb01a7 | JavaScript | Adven97/AwesomeCalculator-js | /calc.js | UTF-8 | 3,690 | 3.25 | 3 | [] | no_license | const disp = document.querySelector('.inp');
let listOfSigns = [];
let listOfNums = [];
let listOfNumButtons = []
let isDot = false;
let isMin = false;
function addNumAndSign(sign) {
listOfNums.push(parseFloat(disp.value));
listOfSigns.push(sign);
isDot = false;
}
function performCalc() {
let licz =... | true |
94c6a268d267dad78e072cbc77d0f4e72df14de2 | JavaScript | codeforjapan/socialhackday | /lib/vendor/jquery.maskedinput/spec/Setup.Spec.js | UTF-8 | 367 | 3.03125 | 3 | [
"MIT"
] | permissive | feature("Masking an Input", function() {
scenario('Applying a mask to an already masked input',function(){
given("an input with two masks", function(){
input
.mask("9")
.mask("99");
});
when("typing a number",function(){
input.mashKeys("1");
});
then("value should be correct",function(){
ex... | true |
965de8d04dc9797b0601f9ae2ef5e962575f39e5 | JavaScript | csgreen3/Wildhacks | /server/public/javascript/carDashboard.js | UTF-8 | 2,785 | 2.84375 | 3 | [] | no_license | app.controller('CarDashboardController', [ '$scope', '$http', function($scope, $http) {
var currSpeed = 0;
var currAngle = 90; // 0 is right, 180 is left
$scope.test= "123";
$scope.forward = function() {
console.log("hit");
currSpeed = currSpeed == 250 ? currSpeed : currSpeed + 50;
... | true |
d3728766ec1ac29e7c357271a405d2145fcaf3cd | JavaScript | DaaanielM/agregar-grafica | /src/models/empleado.model.js | UTF-8 | 1,418 | 2.9375 | 3 | [] | no_license | const conexion = require('../database/db');
const model = {};
model.listar = async (req, res) => {
try {
const sql = `SELECT * FROM empleado`;
const resultados = await conexion.query(sql);
return resultados;
} catch (error) {
console.log(error);
}
};
model.crear = async (datos) => {
try {
const sql = `... | true |
46a366840492ade58f88cf5833d597d523cf1f3e | JavaScript | grlira/adventofcode | /day8/day8.js | UTF-8 | 1,306 | 3.3125 | 3 | [] | no_license | const fs = require("fs");
function countDigits(layer, digit) {
return layer.reduce((count, d) => (d === digit ? count + 1 : count), 0);
}
if (!process.argv[2] || !process.argv[3] || !process.argv[4]) {
console.error("missing input file name, width or height");
process.exit(1);
}
const image = fs
.readFileSyn... | true |
15bd0ff76e93067f285f21c7fd4908f040e64c98 | JavaScript | jfmengels/wuxiaworld-manganese | /list-chapters-from-html.js | UTF-8 | 654 | 2.5625 | 3 | [
"MIT"
] | permissive | const cheerio = require('cheerio');
const ranger = require('number-ranger');
const chapterNumberRegex = /hapter (\d+)/;
function listChaptersFromHtml(html, job) {
const $ = cheerio.load(html);
const chapters = $('div.entry-content p > a[href^="http://"]')
.map((i, e) => {
const chapter = chapterNumberRegex.... | true |
ee492cd64b1fba1c7647333ef1f44207590079d5 | JavaScript | rhysw97/circle-inheritance | /scripts/sprites/enemy.js | UTF-8 | 1,120 | 3.40625 | 3 | [] | no_license |
class Enemy extends Circle {
constructor(xMid, yMid, radius, health) {
super(xMid, yMid, radius, 'red', health);
this._xVel = 3;
this._yVel = 3;
}
get xVel(){
return this._xVel;
}
get yVel(){
return this._yVel;
}
set xVel(value){
... | true |
fe302c3821244ba19eba72cf933bdf437a6c497c | JavaScript | bareardon/plotly-challenge | /static/js/app.js | UTF-8 | 5,390 | 3.28125 | 3 | [] | no_license |
function buildCharts(id) {
// Use the D3 library to read in samples.json
d3.json("./data/samples.json").then(data=> {
console.log(data)
// Create a horizontal bar chart
var sampleData = data.samples.filter(d => d.id === id)[0];
// console.log(`ID Selected: ${id}`)
co... | true |
6bd20bbbfb6deb86bafaa3d3cf9a3ba860ffc77d | JavaScript | bimedia-fr/valdr | /src/core/validators/minValidator.spec.js | UTF-8 | 1,794 | 2.578125 | 3 | [
"MIT"
] | permissive | describe('valdrMinValidator', function () {
var minValidator, constraint;
beforeEach(module('valdr'));
beforeEach(inject(function (valdrMinValidator) {
minValidator = valdrMinValidator;
constraint = { value: '10' };
}));
it('should provide the correct name', function () {
expect(minValidator.n... | true |
da8da982ec51ab3113fd173b72135ae91625e538 | JavaScript | SebastianUdden/simply-chess | /src/components/Board.js | UTF-8 | 4,080 | 2.59375 | 3 | [
"MIT"
] | permissive | import React, { useState, useEffect } from "react"
import styled from "styled-components"
import { CHESS_BOARD, CHESS_COLUMNS } from "../constants/chessBoard"
import { MOVEMENT_PATTERN } from "../constants/movementPattern"
import { checkIsValid, showPossibleMoves } from "../utils/validateMovement"
import Cell from "./C... | true |
8f2d61521f78758939c7aa5231d83a9104dffe8d | JavaScript | EinarsBistrovs/p5game | /examples/sketch.js | UTF-8 | 605 | 2.703125 | 3 | [] | no_license | function setup() {
Engine.start(30);
createCanvas(windowWidth, windowHeight);
}
function draw() {
background(255);
Engine.step();
}
function mousePressed() {
Engine.onClick();
}
function keyPressed() {
Engine.onKeyPress();
if (key == "o") {
console.log(Engine.getObjects());
}
if (key == "a") {... | true |
e83320340c988e46e21f3b103de018b22a6b8bdf | JavaScript | sergiolysenko/495903-big-trip-11 | /src/utils/common.js | UTF-8 | 3,356 | 2.796875 | 3 | [] | no_license | import {MONTH_NAMES} from "../components/constants.js";
import moment from "moment";
const formatTime = (date) => {
return moment(date).format(`HH:mm`);
};
const formatDate = (date) => {
return moment(date).format(`dd/mm/yy`);
};
const formatMonth = (month) => `${MONTH_NAMES[month]}`;
const routePointDuration =... | true |
51334cee39e198cf0521d515e3479a0e47e2dcee | JavaScript | arzud/wdio-workshop-examples | /helpers/number.js | UTF-8 | 297 | 3.3125 | 3 | [] | no_license | /**
* Returns a random number of a range that starts in min and ends in max.
* @param {Integer} min the lower limit of the range
* @param {Integer} max the upper limit of the range
*/
export function getRandomInclusive(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
| true |
93aa2ad8386badecb43123c74607391df3a2e78d | JavaScript | johnstallo/maria-martucci | /pages/1.js | UTF-8 | 1,789 | 2.546875 | 3 | [] | no_license | import ChapterLayout from '../components/ChapterLayout'
import Photo from '../components/Photo'
export default () => (
<ChapterLayout
pageTitle="Maria Martucci - Introduction"
chapterTitle="1. Introduction"
next="/2"
nextTitle="My mother's conversion">
<p>Maria Martucci was born in Mottola, a to... | true |
07300435d765a57f71bdb38ec5c3d58ba449ff9a | JavaScript | guillemontecinos/programacion_creativa_p5js | /clases/clase_4/clase_4_ejemplos/clase_4_ejemplo_5.js | UTF-8 | 269 | 2.625 | 3 | [] | no_license | // Programación Creativa usando p5.js
// Clase 4
// Ejemplo 5
// Video
// por Guillermo Montecinos y Coded Escuela
var video;
function setup(){
createCanvas(640,480);
video = createCapture(VIDEO);
// video.hide();
}
function draw(){
image(video,0,0);
filter(INVERT);
}
| true |
bfdbd736c3780f1649f4835c3a70be6f42baeaf6 | JavaScript | S-Voss/RV-QA-Project | /test/specs/imageTest.js | UTF-8 | 1,130 | 2.890625 | 3 | [] | no_license | var assert = require('assert');
//TESTS THE IMAGES ON THE PAGE
describe('webdriver.io page', function() {
it('all imgs should render and display', function() {
browser.url('https://internet.frontier.com/');
var isVisible = browser.isVisible("img");
var images = browser.elements("img");
... | true |
c7ba6d91a0970e52dc050a74f63fe28ea0d06577 | JavaScript | mferguson54100/JavaScript-NamePriceChecl | /scripts.js | UTF-8 | 1,611 | 4.125 | 4 | [
"MIT"
] | permissive | // Grab the form element
const form = document.querySelector("form");
/**
* Calculate value.
* @param {Number} raw
* @returns {Number} gives back the final value.
*/
const monetize = raw => {
// for every 5 chars in an input this increases the value by $7 for every field less than 5 each char is worth $1
// va... | true |
4f2908b10fb1d98337a7758516e5dd20460b861f | JavaScript | infandrew/wfs | /js/sap.js | UTF-8 | 2,394 | 2.8125 | 3 | [] | no_license | !function() {
// Create the event
var SAAgentProvider, connectEvent = new CustomEvent("socketConnected"),
dataReceivedEvent = new CustomEvent("dataReceived"), agentCallbackTimer;
function tryCatchProxy(callback) {
try {
callback();
} catch (err) {
var errMsg = "exception [" + err.name + "] msg[" + err.... | true |
bb766638ad49d7d2f1334b5829d4f2bab2525049 | JavaScript | celesterobinson/assignments | /for-fun/rock-paper-scissors/rps.js | UTF-8 | 1,067 | 3.71875 | 4 | [] | no_license | var input = prompt("Rock, paper, or scissors. What is your choice?").toLowerCase();
function rockPaperScissors() {
var arr = ["rock", "paper", "scissors"];
var play = arr[Math.floor(Math.random()*arr.length)];
if (input === 'paper' && play === 'rock') {
alert('Your opponent picked ' + play + '. YOU ... | true |
dce1e3c56d5841d75e1103666d7f4ae3c966c748 | JavaScript | zhangbinzhbb/zhbb-cli | /src/config.js | UTF-8 | 725 | 2.671875 | 3 | [] | no_license | // 专门管理.zbclirc文件(当前的用户目录下)
// zb-cli config set key value
import { get, set, getAll, remove } from "./utils/rc";
/**
* 下载到本地仓库
* 本地仓库的配置文件
*/
const apply = async (action, k, v) => {
let r;
switch (action) {
case "set":
await set(k, v);
break;
case "remove":
await remove(k);
break... | true |
6593c13ac3e593c05b686dfd1d6a2333bb80c7f8 | JavaScript | arielware1975/sg-tools | /app.js | UTF-8 | 954 | 3.53125 | 4 | [] | no_license | // Calcular cambio de tasas
// Autor: Ariel Garcia
// Fecha: 25/09/2019
const unitTime = 360;
let getEffectiveRateFromNominalRate = (nominalRate, daysRateExpressed, capitalizationPeriod) => {
let potencia = daysRateExpressed / capitalizationPeriod;
let base = 1 + (nominalRate * capitalizationPeriod / unitTim... | true |
81023fb2a54624f2450e2e29c1f788da18b4920d | JavaScript | labbsr0x/mydoop | /test/parse-utils.test.js | UTF-8 | 2,221 | 2.546875 | 3 | [
"MIT"
] | permissive | const assert = require('assert');
const parseUtils = require('../src/parse-utils')
describe('parseUtils', () => {
describe('#extractProjectionTerms()', () => {
let query = `SELECT
table_mock_alias.column_1 as "1",
table_mock_alias.column_2 as "2",
... | true |
3549f2715016e51fa56956f13980cde7c859facc | JavaScript | jjmalfoy/jm_portfolio | /assets/js/index.js | UTF-8 | 1,115 | 2.703125 | 3 | [] | no_license |
function jumpToElement(element) {
if (element != null && typeof element === 'string') {
$([document.documentElement, document.body]).animate({
scrollTop: $(element).offset().top
}, 500);
} else {
console.log('Error jumping to element.')
}
}
$("#projects-button").on("cl... | true |
edff36ff59b87335f8970519e2cf66867d8934fa | JavaScript | X-API/PayRunIO.Demo.UI | /helpers/fixedDecimal.js | UTF-8 | 151 | 2.609375 | 3 | [
"Unlicense"
] | permissive | module.exports = (input, noOfDecimalPoints) => {
if (input) {
return parseFloat(input).toFixed(noOfDecimalPoints);
}
return "";
}; | true |
dd0ed9f70b1f6dc1cc213897964f2639a15fc9e5 | JavaScript | gaooooo/moon | /src/directives/default.js | UTF-8 | 5,478 | 2.6875 | 3 | [
"MIT"
] | permissive | const hashRE = /\.|\[/;
const addEventToNode = function(eventType, eventHandler, node) {
const data = node.data;
let events = data.events;
if(events === undefined) {
events = data.events = {};
events[eventType] = [eventHandler];
} else {
let eventHandlers = events[eventType];
if(eventHandlers ... | true |
c68bc09b5a203cfca82adc820bf6151de5cc680c | JavaScript | saichaitanyareddy/Berkadia_Assignments | /Nodejs/Week_1/mul.js | UTF-8 | 325 | 2.734375 | 3 | [] | no_license | var readline=require('readline-sync');
var num1=readline.question("enter number one");
var num2=readline.question("enter number two");
var d=Number(num1)*Number(num2);
console.log(d );
-------------------------------------------------------
F:\js>node mul.js
enter number one3
enter number two3
... | true |
3b4050e42f424672ba6a772cf27df1e5edaa395b | JavaScript | AhmadJaber/intro-node-js | /exercises/first-node/argument.js | UTF-8 | 146 | 2.796875 | 3 | [] | no_license | // Receiving User Input via Command Line Arguments
console.log(process.argv);
// collect input from the user
console.log(process.argv.slice(2));
| true |
bc022c72fb63b4d5ce75bd6e75abb47ba90e1d14 | JavaScript | ashokaditya/knex | /scripts/wait-for-mssql-server.js | UTF-8 | 1,196 | 2.6875 | 3 | [
"MIT"
] | permissive | var Connection = require('tedious').Connection;
var config = {
userName: "sa",
password: "S0meVeryHardPassword",
server: "localhost",
options: {
database: "knex_test",
}
};
let didConnect = false;
let tryCount = 0;
function tryToConnect() {
tryCount++;
if (tryCount > 50) {
console.log("Giving u... | true |
457d34c3dc7a06ed65e4682220971eb26f31cfe2 | JavaScript | owlRogue/dynamic-reporting-platform | /public/js/sortTable.js | UTF-8 | 2,041 | 3.203125 | 3 | [] | no_license | // Call sortTable function to sort column on header click:
const cells = $('thead').find('td');
cells.each(function (i) {
cells[i].onclick = (function (n) {
return function () {
sortTable(n);
};
})(i);
});
// Logic to sort the table with column header click:
function sortTable(n) {... | true |
e2f7dc0670264c1d790a30b1a54538c7dc5ad18f | JavaScript | Tanman1276/Tanman1276.github.io | /Alarm/myJavaScript.js | UTF-8 | 740 | 3.609375 | 4 | [] | no_license | function DisplayAlarmMessage() {
// Variables to hold our time information
var now = new Date();
var month = now.getMonth();
var dayOfMonth = now.getDate();
var dayOfWeek = now.getDay();
document.getElementById("time").innerHTML = now;
// Here we throw in all the conditions where we are al... | true |
1eb03631283fc32d693382ae418ace7fc0a8d2b1 | JavaScript | daryna22/my-app | /src/components/Time.js | UTF-8 | 685 | 2.71875 | 3 | [] | no_license | import React, { Component } from 'react';
export class Time extends Component {
constructor(props) {
super(props);
this.state = {
time: new Date(props.newData).getTime(),
}
}
componentDidMount() {
this.timeTick = setInterval(() => {
const { time } = ... | true |