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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
f327ffd05e064fce64b05c9eb579afad998d5aa5 | JavaScript | danillouz/explain-this-js | /test/new.js | UTF-8 | 553 | 3 | 3 | [
"MIT"
] | permissive | var chai = require('chai');
var expect = chai.expect;
describe('new binding', function () {
it('use `this` to make the constructor instance property `bar` equal the value `10`', function () {
function Foo(n) {
// TODO: use the `this` binding to make the test pass
}
var foo = /* TODO */
expect(foo.bar).to... | true |
28ad24e6128385c759256a4d815b1c54d25e341d | JavaScript | dblanchard13/Giphyness | /assets/javascript/app.js | UTF-8 | 3,716 | 3.640625 | 4 | [] | no_license | // You should get in the habit of wrapping your js code in either a
// $(document).ready(function(){
// // code goes here
// })
// or an IIFE (immediately invoked function expression)
// ;(function(){
// // code goes here
// })()
// One of the most important reasons for that is security - because right now your g... | true |
10e55adeca10a7c328a5ec31d70a4769dae6895f | JavaScript | tjunussov/toolpar | /metronic/_js/xnavigateformz.js | UTF-8 | 2,616 | 2.703125 | 3 | [] | no_license | $(function () {
// ---- autofocus FOCUS-----
var K_ESC = 27;
var autofocus = $('*[autofocus]');
$(document).delegate('body','keydown',function(e){
if(e.keyCode == K_ESC) autofocus.focus();
});
// ---- FIELDSET FOCUS-----
//
$(document).delegate('fieldset','focusin',function(e){
... | true |
b17cac1ba18db7ada9ddf33e0e78f9377b8c570f | JavaScript | ShoryuDZ/RPHExtension | /root/js/popup.js | UTF-8 | 852 | 2.96875 | 3 | [] | no_license | document.addEventListener("DOMContentLoaded", function () {
document.querySelector('button').addEventListener("click", randomButton);
timeSet();
});
function randomButton(e) {
chrome.extension.getBackgroundPage().openRandomSite();
}
function timeSet() {
var ct = new Date();
var currentTime = ct.ge... | true |
b3e89de556de2cfa42647ad85815cfae0c125050 | JavaScript | kbuffington/Georgia | /js/helpers.js | UTF-8 | 27,978 | 2.8125 | 3 | [] | no_license | function IsFile(filename) {
return utils.IsFile(filename);
}
function IsFolder(folder) {
return utils.IsDirectory(folder);
}
/**
*
* @param {string} titleFormatString Title format string to evaluate
* @param {FbMetadbHandle=} metadb Handle to evaluate string with
* @param {boolean=} force Force eval... | true |
5665bdac335468a48c5dd1e011452c2587f3dc35 | JavaScript | kumi1688/JavaScript-Practice | /tip5/arrays.js | UTF-8 | 984 | 3.9375 | 4 | [] | no_license | // 배열은 순서를 갖기 때문에 이를 기준으로 값을 추가하거나 제거할 수 있고 모든 위치에 값이 있는지 확인할 수 있다
// 또한 배열을 정렬하여 순서를 새로 지정할 수도 있다
const team = ["Joe", "Dyan", "Bea", "Theo"];
function alphabetizeTeam(team) {
return [...team].sort();
}
console.log(alphabetizeTeam(team));
const game1 = {
player: "Jim Jonas",
hits: 2,
runs: 1,
errors: 0
};
c... | true |
b145470046e07942fb6b239939ad7c0d5afc49ad | JavaScript | Imranh21/covid19-tracker-web | /src/comonents/country/Country.js | UTF-8 | 1,785 | 2.609375 | 3 | [] | no_license | import React, { useState, useReducer, useEffect } from "react";
import axios from "axios";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faSearch } from "@fortawesome/free-solid-svg-icons";
import Comp from "./Comp";
import style from "./Comp.module.css";
import Loader from "../../loa... | true |
77261d10bb811f0fdb9f9a1233e80d451d515644 | JavaScript | githubedward/mini-weather-app | /src/services.js | UTF-8 | 300 | 2.859375 | 3 | [] | no_license | export async function getWeather(city) {
try {
const res = await fetch(
`https://api.openweathermap.org/data/2.5/weather?q=${city}&units=metric&APPID=885c24dac664de0bc9186f32747cf51a`
);
const data = await res.json();
return data
} catch (err) {
console.log(err);
}
}
| true |
43f7d6cad6609d5161e6a7c3baa357c88524f34a | JavaScript | jinghua000/shadow-fns | /test/deepCompact.js | UTF-8 | 1,332 | 2.875 | 3 | [
"MIT"
] | permissive | const eq = require('./util/eq')
const equals = require('./util/equals')
const f = require('../src')
describe('test deepCompact', function () {
it('should select values not empty and will not change the origin array', function () {
let arr = [0, 1, null, undefined, false, [], {}, '']
equals(
f.deep... | true |
fb67db84cfae00394e7a06bee83ddc28f59df3ec | JavaScript | huynhhoangvy/react-redux-lab | /src/redux/reducer.js | UTF-8 | 815 | 2.859375 | 3 | [] | no_license | // export const counterReducer = (state = { count: 0 }, action) => {
// switch(action.type) {
// case 'INCREMENT_COUNTER':
// return { count: state.count + 1 }
// default:
// return state;
// }
// }
// export const counterReducer = (state = { count: 0, currentUser: {} }, action) =... | true |
176fce907eb8c7aff5c403428f08b35e9510b70d | JavaScript | sil2422/cosentinovet | /js/valida.js | UTF-8 | 1,000 | 3.359375 | 3 | [] | no_license | document.addEventListener("DOMContentLoaded", function() {
document.getElementById("formulario").addEventListener('submit', validarFormulario);
});
function validarFormulario(){
var txtNombre = document.getElementById('name').value;
var txtMensaje = document.getElementById('msg').value;
... | true |
dc2f1e3d7a52c20b5a8028ad31120a637a386f3a | JavaScript | adamhochberger/seatcheck-web | /src/MapBuild/createmap.js | UTF-8 | 12,378 | 2.5625 | 3 | [] | no_license | import React from 'react';
import Button from '@material-ui/core/Button';
import { Grid } from '@material-ui/core';
import firebase from '../firebase.js';
import Input from '@material-ui/core/Input';
import { Select } from '@material-ui/core';
import { InputLabel } from '@material-ui/core';
import { MenuItem } from '@m... | true |
940a07abde1b312b36cdc05dd5d9fc9e51777e5c | JavaScript | MTASZTAKI/ApertusVR | /plugins/languageAPI/jsAPI/3rdParty/nodejs/10.1.0/source/test/parallel/test-icu-stringwidth.js | UTF-8 | 3,139 | 2.734375 | 3 | [
"LicenseRef-scancode-free-unknown",
"MIT",
"ISC",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"Artistic-2.0",
"NAIST-2003",
"BSD-3-Clause",
"Zlib",
"NTP",
"LicenseRef-scancode-openssl",
"ICU",
"LicenseRef-scancode-unicode",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | // Flags: --expose_internals
'use strict';
const common = require('../common');
if (!common.hasIntl)
common.skip('missing Intl');
const assert = require('assert');
const readline = require('internal/readline');
// Test column width
// Ll (Lowercase Letter): LATIN SMALL LETTER A
assert.strictEqual(readline.getStri... | true |
6ad65940bfb5acf8773ca59fb61360ba602f9bf5 | JavaScript | wayne-kim/Desktop-application-development-using-Javascript-and-Node.js | /GIGO.js | UTF-8 | 278 | 3.265625 | 3 | [] | no_license | const readlineSync = require('readline-sync');
let num = readlineSync.question("input num : ");
function addTow(parameter) {
let ckeckNum = Number(parameter);
return Number.isNaN(ckeckNum) ? "숫자 형태로 입력해주세요." : ckeckNum + 2;
}
console.log(addTow(num)); | true |
ad07134dc207a36c63454da41e279ab351f81a66 | JavaScript | willmonahan/interactive-final | /prototypes/colorPicker/sketch.js | UTF-8 | 2,283 | 2.609375 | 3 | [] | no_license | var materialColors = [["#B71C1C","#C62828","#D32F2F","#E53935","#F44336","#EF5350","#E57373","#EF9A9A"],
["#4A148C","#6A1B9A","#7B1FA2","#8E24AA","#9C27B0","#AB47BC","#BA68C8","#CE93D8"],
["#1A237E","#283593","#303F9F","#3949AB","#3F51B5","#5C6BC0","#7986CB","#9FA8DA"],
["#01579B","#0277BD","#0288D1","#039BE5","#03A9F4... | true |
739a02dfa23ef833f3f9c00212c0af401290346e | JavaScript | kyurikotpq-me/av-deep-dive | /audio_deepdive/js/app.js | UTF-8 | 5,061 | 2.765625 | 3 | [
"MIT"
] | permissive | // let api = 'http://ws01.worldskills.org/LifeBook%20Audios/';
let api = 'http://ws01.worldskills.org/LifeBook%20Audios/';
let audioPlayer = Vue.component('audio-player', {
props: ['songs'],
template: "#audio-player",
data() {
return {
currentSongIndex: 0,
currentSong: {
... | true |
bc457723b8b86ad74b4f6fd6fdca3d749d16e663 | JavaScript | EdmilsonEMAndrade/angular-node-dragonapi | /backend/src/controllers/Dragon/index.js | UTF-8 | 1,857 | 2.59375 | 3 | [] | no_license | const DragonService = require('../../service/Dragon');
const Dragon = require('../../models/Dragon');
const HttpConstants = require('../../constants/http');
const Cache = require('../../utils/Cache');
const DragonConstants = require('../../constants/DragonConstants');
class DragonController {
async index(req, res)... | true |
4816f1c9f958c62f1c64da4d5e4b8789a4f7aeea | JavaScript | vailv/INFO6250_WebDev | /work/js-dom/public/main.js | UTF-8 | 3,044 | 3.453125 | 3 | [] | no_license | "use strict";
(function iife() {
const items = [
{
text: 'books',
quantity: 5,
},
{
text: 'table',
quantity: 2,
},
{
text: 'cushions',
quantity: 8,
},
];
const listEl = document.querySelector('#inventory .stock');
const inputEl = document.querySelect... | true |
3f7b47b0e3af44c0d1267c94e1ab2391612a4c07 | JavaScript | WajihaUmar/Complete_JavaScript_Practice | /app5.js | UTF-8 | 2,571 | 2.953125 | 3 | [] | no_license | //Q1
// function display() {
// var name = document.getElementById("name")
// var email = document.getElementById("mail")
// var showing = document.getElementById("show")
// var p1 = document.createElement("p")
// var textNode1 = document.createTextNode(name.value)
// p1.appendChild(textNode1)
// var p2... | true |
95f4c66e89cc67c2c383d0b5f228a8ed4659c0f6 | JavaScript | momo1113/zayo | /src/checkArea.js | UTF-8 | 1,638 | 3.328125 | 3 | [] | no_license | import convertString from './convertString';
const checkArea = (...args) =>{
let shape = args[0];
let area = 0;
let unit = "";
let output = "";
if(shape === 'square'){
let result = convertString(args[1])
let length = result.number;
unit = result.unit;
are... | true |
0e32204f3f607a22025a4416c9bea63e986dffca | JavaScript | JeffHauckJr/8-ball-discord-bot | /index.js | UTF-8 | 649 | 2.8125 | 3 | [] | no_license | require("dotenv").config();
const { Client, Intents } = require("discord.js");
const client = new Client({
intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES],
});
const TOKEN = process.env.TOKEN;
const responses = [
"Probably not",
"Unlikely",
"Who knows",
"It's looking good",
"How sho... | true |
347b8a48d6452946b474e0b8c2b5b0802da8f37c | JavaScript | bgrins/console-output-experiment | /js/utils/VariablesViewUtils.js | UTF-8 | 4,263 | 2.984375 | 3 | [] | no_license | /**
* Returns true if the descriptor represents an undefined, null or
* primitive value.
*
* @param object aDescriptor
* The variable's descriptor.
*/
export function isPrimitive(aDescriptor) {
// For accessor property descriptors, the getter and setter need to be
// contained in 'get' and 'set' proper... | true |
d805595a16f1c7ab7cd20f9c690ac56ba05089b9 | JavaScript | ChoralCloud/ChoralWeb | /sample_chorals/defaults/toCAD.js | UTF-8 | 1,122 | 3.3125 | 3 | [] | no_license | //(
function (children, done){
/*
* This function converts the first child member that is a number
* to the same value in canadian (use with caution)
*/
function isNumber(n) {
return !isNaN(parseFloat(n)) && isFinite(n);
}
if(!children) return done({ price: 0 })
var request = require('request... | true |
8dab01cb99dd97c1a839713a960388db1589e30d | JavaScript | param1111/SocGen | /controller.js | UTF-8 | 7,729 | 2.53125 | 3 | [] | no_license | const Archive = require('./models.js')
//Find all the distinct symbols in the archives
exports.findMatch = (req, res) => {
var data = [];
var obj = {};
let keyArr = ['77H','30T','30V','36'];
Archive.find({})
.then(result => {
result.forEach((val,inx)=>{
const valA... | true |
cb4ffdb22a7c72f61186e96bedc00761a29aa511 | JavaScript | bennettslin/yearlings_bobtail_app | /admin/data/album/helpers/song.js | UTF-8 | 1,713 | 2.546875 | 3 | [] | no_license | import slugify from 'slugify'
import albumLyrics from '../lyrics'
import { getFloatToHundredth } from '../../../../src/helpers/general'
const _addIsLogue = (songIndex, song) => {
const { isLogue } = albumLyrics[songIndex]
if (isLogue) {
song.isLogue = isLogue
}
return isLogue
}
const _addOve... | true |
3ca8b5a6e8303714444602b448232acea018a2f8 | JavaScript | yonatanmk/backup | /js-marathon/Spaceship.js | UTF-8 | 803 | 3.5625 | 4 | [] | no_license | class Spaceship {
constructor (name) {
this.name = name;
this.crew = [];
this.captain = null;
this.propulsion = null;
}
loadCrew (newCrew) {
for (let person of newCrew) {
this.crew.push(person);
console.log(`${person.name} has boarded ${this.name}`);
}
}
makeCaptain () {
... | true |
88d87f6685a1e15b86579dbd036f523fa5c2b8c5 | JavaScript | mirdesai81/ES6_Features | /js/blockScope_ES6.js | UTF-8 | 1,727 | 3.9375 | 4 | [] | no_license | /**
* Created by Mihir.Desai on 3/16/2016.
*/
var a = 2;
{
let a = 3;
console.log("Inside block let a="+a);
}
console.log("Outside block var a="+a);
if(a > 1) {
let b = a * 3;
console.log("b="+b);
for(let i = a; i <= b; i++) {
let j = i * 10;
console.log("for loop using let de... | true |
9c9c310d23669c0336ad5ebd0726ffebf0d61722 | JavaScript | lamcgregor/eventsDatabase | /js/googleMap.js | UTF-8 | 2,550 | 2.828125 | 3 | [
"MIT"
] | permissive | $(document).ready( function(){
$('#locationFinder, #addressOptions, .addressInput').hide();
$('#locationCheck').click(function() {
$('#locationFinder').toggle();
});
$('#locationCheck[type="button"]').click(function() {
$('.editLocation').hide();
});
});
var geocoder;
var map;
var markersArray = [];
function ... | true |
33fcd6898061d397f8419cf87e569bc106139480 | JavaScript | bhaweshgupta/angularJS | /Angular/Scripts/event.js | UTF-8 | 530 | 2.625 | 3 | [] | no_license | var myApp=angular.module("myModule",[]).controller("myController",function($scope)
{
var technologies=
[
{name:"C#",like:0,dislike:0},
{name:"C++",like:0,dislike:0},
{name:"java",like:0,dislike:0},
{name:"python",like:0,dislike:0},
];
$scope.technologies=technolo... | true |
2ff7a9a306da5022475eb2042de9f1639c5e1c96 | JavaScript | taydunworth/codewars | /201804/string-reversing-changing-case-etc.js | UTF-8 | 903 | 4.3125 | 4 | [] | no_license | // Title: String Reversing, Changing Case, etc.
// Level: 7 kyu
// Date Completed: 4/23/18
// URL: https://www.codewars.com/kata/string-reversing-changing-case-etc/train/javascript
// Description: Given 2 string parameters, show a concatenation of: the reverse of the 2nd string with inverted case; e.g Fish -> HSIf; a s... | true |
7004b8fb66819791132ee6cb8a6fe53a27a3f33f | JavaScript | kmui2/JavaScript-LOCV-NN | /train.js | UTF-8 | 1,851 | 2.625 | 3 | [] | no_license |
function customCV(x_datas, y_data, network, LOCV_percent, training_options) {
// arayy of objects containing x=[1,2,..,10] and y=sin(x)
const data = _.map(_.range(x_datas.length),
(n) => {
return {
x: x_datas[n],
y: y_data[n]
}
}
);
let training_data = _.sample(data, Math... | true |
3619f686e6ebef24db1f5a25a0e8134f8bba4306 | JavaScript | LanaCoyote/baller | /src/utils/input.js | UTF-8 | 1,920 | 3.078125 | 3 | [] | no_license |
/******************************************************************************
InputManager
******************************************************************************/
function InputManager( w ) {
// set the initial state of the input manager hashes
this.keyspressed = {};
this.b... | true |
564aa4469dada2ce47f4f6e6abd6211068236342 | JavaScript | KarolKlos/React-v1.0 | /src/components/Cockpit/Cockpit.js | UTF-8 | 1,666 | 2.71875 | 3 | [] | no_license | import React, { useEffect, useRef } from 'react';
import AuthContext from '../../context/auth-context';
import classes from './Cockpit.css';
const cockpit = props => {
//const toggleBtnRef = React.createRef(); - without "import React, { useRef } from 'react';"
const toggleBtnRef = useRef(null); // with "import..."
... | true |
dd3eff9873321762d407fc47aae8028138ef603b | JavaScript | ihnesto/shop-react | /shop-react-redux/src/redux/MainReducer.js | UTF-8 | 1,972 | 2.734375 | 3 | [] | no_license | const initialState = {
// Хранилище приложения
isCart: false,
brands: [],
products: [],
cart: [],
numCartItems: 0
};
function MainReducer(state = initialState, action) {
if ( action.type === 'SET_BRANDS') {
return {
...state,
... | true |
ffa62ffe601cbd4cff3afdbe6f608ed97deb4158 | JavaScript | AugustanaCSC490Spring2020/AugustanaMarket | /src/redux/actions/itemActions.js | UTF-8 | 1,368 | 2.90625 | 3 | [] | no_license | /**
* This action loads the information of a single item
* from the listReducer state so that if redux already
* has this info, we do not have to do another read to
* firestore
* @param item the item being loaded
*/
export const loadItemDetails = (item) => {
return {
type: 'ITEM_LOADED',
payl... | true |
fd5286d0ccb7b7d9767075e78d37a13eb8b2f468 | JavaScript | anisiqbal/strugbits-test | /Q1.js | UTF-8 | 1,120 | 3.890625 | 4 | [] | no_license | var arr = [
[1, 2, 3],
[4, 5, 6],
[7, 8, 9],
];
function SumDiagonal(arr) {
var sumPrimary = 0;
var sumSecondary = 0;
for (let i = 0; i < arr.length; i++) {
for (let j = 0; j < arr.length; j++) {
if (i == j) {
sumPrimary = sumPrimary + arr[i][j];
... | true |
f2fe1f545398b16f96c4931e2be0cab292fc3243 | JavaScript | jonnyts235/capstone-project | /src/pages/reviews.js | UTF-8 | 7,073 | 2.53125 | 3 | [] | no_license | import React, { Component } from "react";
import axios from "axios";
import { Link } from "react-router-dom";
import logo from "../images/logo.png";
export default class Reviews extends Component {
constructor(props) {
super(props);
this.state = {
name: "",
movie: "",
comment: "",
ra... | true |
d9e31b6a267268b338df9b876d500d4b25506942 | JavaScript | RyanGled/ethNode | /test/EthConvert.test.js | UTF-8 | 3,030 | 2.765625 | 3 | [] | no_license | const chai = require('chai')
const EthConverter = require('./../dist/assets/js/EthConvert')
const ethValInWei = 19254563000000000;
describe('Testing Wei unit and upward conversions', function() {
it('Wei -> Kwei', function(done) {
let result = EthConverter.convert(ethValInWei, 'Wei', 'Kwei')
chai.a... | true |
020adf66906da3a1d2a7100360364bc73ec82337 | JavaScript | Jiedegul/itpark | /javaScript/2-ai/08-algoruthms/02-join.js | UTF-8 | 436 | 2.921875 | 3 | [] | no_license | // names=["asan","massan","hasan","lassan","tarzan"]
// let result='"'
// names.forEach((name,index)=> {
// if(index===names.length-1){
// result+=name
// }else{
// result+=name+","
// }
// })
// console.log(result+'"')
// names=["asan","massan","hasan","lassan","tarzan"]
// console.log... | true |
6a11f9c6729f1f89b0a5809abdcdb15dc050d43c | JavaScript | cristobal2323/programacion | /codigo4.js | UTF-8 | 1,040 | 3.078125 | 3 | [] | no_license | var dibujo, lienzo, t, b;
function inicio(){
dibujo = document.getElementById("dibujo");
lienzo = dibujo.getContext("2d");
t = document.getElementById("usuario");
b = document.getElementById("dibujalo");
lienzo.beginPath();
lienzo.strokeStyle = "#00F";
lienzo.arc(150,150,100, (Math.PI * 2), false);
lienzo.clos... | true |
c48c6259041c547136436cf7f8da4aa747544531 | JavaScript | luotaoyeah/learning-javascript | /projects/2020/src/book/javascript-the-definitive-guide.6e/13/13-01/13-01-02-A.js | UTF-8 | 578 | 3.09375 | 3 | [] | no_license | /*
* 13.1.2 JavaScript in Web Applications
*/
(function() {
/*
* 我们把浏览器比作一个操作系统, 它提供了很多底层的 API 服务;
* 例如:网络, 图形, 存储等;
* 例如 XMLHttpRequest 用来在不刷新页面的情况下访问网络, 获取数据;
* 例如 HTML5 规范定义的很多音视频相关的 API 等;
*
* 基于这些 API 的应用称之为 web application;
* 当禁用 JS 时, web application 将无法正常工作;
*/
console.log("\n-----... | true |
c58aca72cf0d3f88bbc01553b939a03154bcd819 | JavaScript | cyber-nathan/NSBEHacksBeacon | /Hacks/script.js | UTF-8 | 3,048 | 2.84375 | 3 | [
"MIT"
] | permissive | var date = document.getElementById("date");
var youtubeLink = ["https://www.youtube.com/watch?v=_eKTOMhpy2w", "https://www.youtube.com/watch?v=kqtD5dpn9C8", "https://www.youtube.com/watch?v=9VJJSCVH_Wk", "https://www.youtube.com/watch?v=U9YKY7fdwyg", "https://www.youtube.com/watch?v=umWJCOh_oE4&t=18s", "https://www.yo... | true |
09d1d4be1ee800df1b4f03ef7512ce0412b4a3d7 | JavaScript | saipraneethreddy969/ecommerce | /static/js/rgbguess.js | UTF-8 | 337 | 3.03125 | 3 | [] | no_license | function myfun()
{
var squ=document.querySelectorAll(".square");
// alert(squ.length);
for(var i=0;i<squ.length;i++)
{
var lm=kiss();
squ[i].style.backgroundColor="rgb("+lm[0]+","+lm[1]+","+lm[2]+")";
function kiss()
{
var l=[];
for(var j=0;j<3;j++)
{
l.push(Math.round((Math.random()*1000)%255));
}
... | true |
75c208edd07b1c516390c080a24f2fbf4891b775 | JavaScript | pepijnkok/generative-art | /sketch.js | UTF-8 | 1,406 | 3.359375 | 3 | [
"MIT"
] | permissive | let img;
let cnv;
let slider;
let size = 5;
function preload(){
//Load images
let gogh0 = loadImage('images/gogh1.jpeg');
let gogh1 = loadImage('images/gogh1.jpeg');
let gogh2 = loadImage('images/gogh2.jpeg');
let gogh3 = loadImage('images/gogh3.jpeg');
let gogh4 = loadImage('images/gogh4.jpeg');
let ... | true |
89502affdf5873080cf4d0e07bcdc54edc34cc8b | JavaScript | rev-tomi/survive-javascript | /functional-inheritance.js | UTF-8 | 1,323 | 3.46875 | 3 | [] | no_license | demo.createMammal = function(name) { // name hidden, cannot set it
var result = {};
result.getName = function() {
return name;
}
result.saymyname = function() {
return "I'm " + this.getName();
}
result.sayhello = function() {
return "Hello...";
}
return result;
}
demo.createCat = function(na... | true |
1ac9aa40da396eb65240bc1e99a7e2988c3ac85f | JavaScript | Erislash/Erislash-DailyUI-2 | /src/app.js | UTF-8 | 1,213 | 3.21875 | 3 | [] | no_license | window.addEventListener('load', StartApp);
function StartApp() {
const fieldsInput = {
name: document.querySelector('#holder'),
number: document.querySelector('#number'),
month: document.querySelector('#expiresMonth'),
year: document.querySelector('#expiresYear'),
CVV: docu... | true |
6e263781bd1414f8a0238352f47744b803dffd31 | JavaScript | TheCodingFreakj/ecommerce | /client/src/components/Shop-Page/CartHelper/cart_helpers.js | UTF-8 | 1,185 | 3.109375 | 3 | [] | no_license | //https://github.com/kaloraat/ecommerce
//https://github.com/kaloraat/ecommerce-front
// // it contains
// // ["sumit","amit","anil","anish"]
// var set1 = new Set(["sumit","sumit","amit","anil","anish"]);
// // it contains 'f', 'o', 'd'
// var set2 = new Set("fooooooood");
// // it contains [10, 20, 30, 40]
// var ... | true |
e0d97e55df74f134249b6b7633d8e16afccc7c68 | JavaScript | javiosyc/nodeJs-bootcamp | /serverExample/renderEngine.js | UTF-8 | 544 | 2.765625 | 3 | [] | no_license | var fs = require('fs');
function templateRender(values, view) {
for(var key in values) {
view = view.replace('{{'+key+'}}', values[key]);
}
return view;
}
function render (template, data ,res) {
var view = fs.readFileSync('./' + template + '.html' , {encoding :'UTF-8'});
var header = fs.readFileSync('./heade... | true |
033871273be43bdcd84e33e2badfdf6d1ff7fa33 | JavaScript | rajeshmine/npm | /NPM/Emi-Calc/index.js | UTF-8 | 1,097 | 2.59375 | 3 | [] | no_license | //a- loanAmount,m-numberOfMonths,r=rateOfInterest,mir-monthlyInterestRatio,h-high,l-low,t-total,i-interest,bb-beginbalance,
emiCalc = (a, m, r) => {
let mir, h, l, sp, emi, t, bb, initial = 0, begin = 0, end = 0, i = 1, res = [];
a = (+a); m = (+m); r = (+r);
mir = r / 100 / 12;
h = Math.pow(1 + mir, m);
... | true |
058097b8d8dd8ca851ced2a090ca80a594efce9d | JavaScript | caleeli/documentos | /resources/assets/js/mixins/fechasTarea.js | UTF-8 | 2,717 | 2.578125 | 3 | [
"MIT"
] | permissive | export default {
methods: {
tiempoReloj(tarea) {
let start = moment(tarea.attributes.tar_fecha_derivacion);
let end = null;
tarea.relationships.usuarios.forEach(usuario => {
if (usuario.attributes.pivot.dias_plazo > 0) {
let s = moment(
usuario.attributes.pivot.fech... | true |
ee2b8035747d35fa18af43a14e48bf2f7bcb8836 | JavaScript | Akesure/refactor | /src/5.函数操作/1.多函数/2.chain.js | UTF-8 | 1,155 | 3.046875 | 3 | [] | no_license | import "babel-polyfill";
// 函数串联执行,上一个函数的返回值传递给下一个函数
function compose(...funcs) {
if (funcs.length === 0) {
return arg => arg
}
if (funcs.length === 1) {
return funcs[0]
}
const last = funcs[funcs.length - 1]
const rest = funcs.slice(0, -1)
return (...args) => rest.reduceRight((composed, f) => f... | true |
30268ea5b95aa2f441c309ac7e6f17b81dce7210 | JavaScript | nitish7890/employee-payroll | /employee-payroll.js | UTF-8 | 1,554 | 2.765625 | 3 | [] | no_license | class EmployeePayrollData {
get id() { return this.id; }
set id(id) {
this._id=id;
}
get name() { return this.name; }
set name(name) {
let nameRegex=RegExp("^[A-Z]{1}[a-zA-z\\s]{2,}$")
if(nameRegex.test(name))
this._name=name;
else throw 'Name is Incorrect'... | true |
c2376e801d87cc836c7ea5e704c1197eabbf3abe | JavaScript | mariem86/covert-es5-to-es6 | /INDEX.js | UTF-8 | 785 | 3.8125 | 4 | [] | no_license | const pets = [
{ name: "Max", type: "dog", bornOn: 2018 },
{ name: "Angel", type: "cat", bornOn: 2015 },
{ name: "Jasper", type: "dog", bornOn: 2016 }
];
getAge = function (pet)
{
return new Date().getFullYear() - pet.bornOn;
return new Date().getFullYear() - pet.bornOn;
}
co... | true |
4d200d2d29bad763ec97d6aed89e7431ba7cc5ce | JavaScript | briped/briped.github.io | /CphBProgrammering/03.2 Fibonacci/fibonacci.js | UTF-8 | 203 | 3.46875 | 3 | [] | no_license | let fibNext;
let fibPrev = 0;
let fib = 1;
for (let i = 1; i <= 10; i++) {
document.write(`Fibonacci #${i}: ${fibPrev}<br />`);
fibNext = fibPrev + fib;
fibPrev = fib;
fib = fibNext;
}
| true |
49e535f3aebffad993e7d57834673e0824ce46cb | JavaScript | user-sachin/Week4JavaScript | /ExpressCRUD-FEImplementation/database/service/model/dog.js | UTF-8 | 930 | 2.96875 | 3 | [] | no_license | //Dependencies
const mongoose = require("mongoose");
const Schema = mongoose.Schema;
//Create a Schema for our Dog Object.
const dogSchema = new Schema({
name: { type: String },
age: { type: Number },
species: { type: String }
});
//Associate CRUD requests with schema, these functions "findOne" etc are Mo... | true |
1f28d23cf85cc5c22b95ba9ecd19c69ad2ae05b9 | JavaScript | victoriadrake/xmas | /docs/script.js | UTF-8 | 1,293 | 3.578125 | 4 | [
"MIT"
] | permissive | function getTimeRemaining () {
const today = new Date()
const xmas = new Date('Dec 25, 2021')
const millis = Math.abs(xmas - today)
var days, hours, minutes, seconds, totalHours, totalMinutes, totalSeconds
totalSeconds = parseInt(Math.floor(millis / 1000))
totalMinutes = parseInt(Math.floor(totalSeconds / ... | true |
91e1f2727f18e6a1567ba00b143252da4adb91db | JavaScript | Sriven-Reddy/ITWS-II-Friday | /tasks/lab-3/form-validation.js | UTF-8 | 1,909 | 3.546875 | 4 | [] | no_license | // Return true if input is valid
function validateUsername(name) {
if (name.length < 4 && name.length > 8)
{
return true;
}
else
return false;
// Length of username should be between 4 to 8
// It should not contain any whitespace
}
function validatePassword(passowrd) {
var countupper = 0, countlower = 0, ... | true |
00ef9e61247cc2bb0e2210eec6284f2bca73924a | JavaScript | valevassallo/ToDo-List-JS | /resources/js/index.js | UTF-8 | 4,826 | 3.078125 | 3 | [] | no_license | var list_task = [];
function assignEvent() {
let btnAddTask = document.getElementById("btnAddTask");
btnAddTask.addEventListener("click", addTask);
let btnSearch = document.getElementById("btnSearch");
btnSearch.addEventListener("click", filterTask);
let columns = document.getElementsByClassName("colHeader... | true |
5b2d7898d81849c349e26b3da5c9760b198c2bdf | JavaScript | js-tasks-ru/js-20210427_artur-mingazhov | /05-dom-document-loading/2-sortable-table-v1/index.js | UTF-8 | 3,218 | 2.90625 | 3 | [] | no_license | export default class SortableTable {
subElements = {};
constructor(headerConfig = [], { data = [] } = {}) {
this.header = headerConfig;
this.localData = data.map(item => {
return this.header.reduce((acum, { id }) => {
acum['id'] = item['id'];
acum[id] = item[id];
return acum... | true |
c078ac0aa7eb4408bb7da1778db56ed6b3b66337 | JavaScript | iluxa-com/fcoffice | /2012-02/alice/resource/js/global.js | UTF-8 | 1,372 | 2.703125 | 3 | [] | no_license | var FH = FH || {};
(function($$) {
/**
* 记录调试信息
* @param string str 字符串
*/
$$.log = function(str) {
if (typeof(console) != 'undefined' && typeof(console.log) == 'function') {
console.log(str);
}
};
/**
* 页面重新加载
*/
$$.pageReload = function () {
self.location.reload(true);
};
/**
* 弹出警告提示
* ... | true |
fc1f6717b80bbc67bbea92b3bbf13da597c5bce4 | JavaScript | surpmillet/dingtalk-promise | /src/token.js | UTF-8 | 943 | 2.625 | 3 | [
"MIT"
] | permissive | /**
* Created by michao on 16/7/28.
*/
import request from 'superagent';
class Token {
createdAt;
content;
constructor(corpId, corpSecret, expireIn = 7200, req = request) {
this.corpId = corpId;
this.corpSecret = corpSecret;
this.expireIn = expireIn;
this.request = req;
}
isExpired(timesta... | true |
26bc5db79c0bfd3619d5e348c666e93c2c1cf206 | JavaScript | emilyanas2323/Daynote | /daynote-app/src/components/ModalComponents/AddEventModalComponent.js | UTF-8 | 7,836 | 2.59375 | 3 | [] | no_license | import React, {Component} from 'react';
import axios from 'axios';
import '../../App.css';
import Datetime from 'react-datetime';
import "react-datetime/css/react-datetime.css";
export default class AddEventModalComponent extends Component {
constructor(props) {
super(props);
this.onSubmit = this... | true |
6a774960e30fc84b359327da306ef1dfb47d57fb | JavaScript | sanjeev0901/PowerRanger | /js/Game.js | UTF-8 | 2,222 | 3.0625 | 3 | [] | no_license | class Game {
constructor(){
}
getState(){
var gameStateRef = database.ref('gameState');
gameStateRef.on("value",function(data){
gameState = data.val();
})
}
update(state){
database.ref('/').update({
gameState: state
});
}
async start(){
if(gameState === 0){
... | true |
c5b59c82ec5d4942be1d3a3a7e394c3f130cbee3 | JavaScript | ashwinkanchana/Swish | /config/dynamoDB.js | UTF-8 | 3,162 | 2.546875 | 3 | [] | no_license | const AWS = require('aws-sdk')
AWS.config.update({
region: process.env.AWS_REGION,
accessKeyId: process.env.AWS_ACCESS_ID,
secretAccessKey: process.env.AWS_SECRET_KEY,
})
const dynamoTableName = process.env.DYNAMO_TABLE_NAME
const dynamoClient = new AWS.DynamoDB.DocumentClient()
const insertStoreCache = ... | true |
a275a47b42ccc914f54684adb61a9816cf446f57 | JavaScript | rogersjeffreyl/Real-Time-Hand-Gesture-Recogniton | /BioMetric_Project/js/handtracking.js | UTF-8 | 19,331 | 2.734375 | 3 | [] | no_license | var HT = HT || {};
HandTracker = function(params){
this.params = params || {};
this.mask = new CV.Image();
this.eroded = new CV.Image();
this.contours = [];
this.skinner = new HandSkinner();
};
HandTracker.prototype.detect = function(image){
this.skinner.mask(image, this.mask);
if (this.... | true |
5bf85dfbfc9086d08b198f3c9309c1cec28b36bf | JavaScript | bwbcode/CanBudget | /server/business/fetchData.js | UTF-8 | 2,185 | 2.734375 | 3 | [] | no_license | const usersMap = require('./usersMapManipulations');
const companyInformation = require('./getCompanyInformation');
const fetchStock = require('./fetchStock2');
async function getDataForUser(id) {
const user = await usersMap.addUser(id);
const compInfo = await companyInformation.getAllCompaniesInformation(user... | true |
2a8f908fc18babb51c4f1ccf98c144bebadffdb3 | JavaScript | Effiongoto/Devcamp-Technical-Task | /Task_5.js | UTF-8 | 198 | 3.296875 | 3 | [] | no_license | //creating a function
function url(str){
//for loop to replace " " with "%20"
for(var i = 0; i < str.length; i++) {
str = str.replace(" ", "%20");
}
return str;
}
| true |
7965f54ee0db526b0ad292ad4779b5fc031f7588 | JavaScript | vwhope/nexTrain | /assets/javascript/app.js | UTF-8 | 15,105 | 3.546875 | 4 | [] | no_license | // nexTrain app - using Firebase and MomentJS
//
// The purpose of this code is to:
// - use Firebase to store data
// - work with date/time objects using MomentJS
// - implement user-input validation
//
// Lessons learned with this assignment
//
// 1. understanding that the time object includes both date and tim... | true |
22860a96e5a15c611a02931492670d4461fe4705 | JavaScript | omnajjar/Dee | /client/src/components/landing_page/BackgroundWrapper.jsx | UTF-8 | 2,068 | 2.5625 | 3 | [] | no_license | import React from "react";
import bg01 from "./images/bg01.jpg";
import bg02 from "./images/bg02.jpg";
import bg03 from "./images/bg03.jpg";
import bg04 from "./images/bg04.jpg";
import bg05 from "./images/bg05.jpg";
import bg06 from "./images/bg06.jpg";
const BackgroundWrapper = () => {
const bgRefs = [];
const i... | true |
7ae93cb807126c391f15cd5b9fcb6bb5ee3385be | JavaScript | ngocson092/socket-game-J2 | /src/spec/EvalSpec.js | UTF-8 | 4,203 | 2.78125 | 3 | [] | no_license | describe("Chess count", function() {
var b;
beforeEach(function() {
b = new vnc.Board();
b.newGame();
});
it("should be 32 initially", function() {
expect(vnc.count(b)).toEqual(32);
expect(vnc.count(b, 0)).toEqual(16);
expect(vnc.count(b, 1)).toEqual(16);
});
it("in TP should increase ... | true |
f2ea991e6d1b0d165178d37ecf9179929b3f055f | JavaScript | celsou/ScadaBR-EF | /WebContent/resources/fuscabr/templates/serverside/slider.js | UTF-8 | 1,409 | 2.921875 | 3 | [
"MIT"
] | permissive | /* @license MIT */
// Slider width (in pixels)
var width = 150;
// Slider scale
var maximum = 10;
var minimum = 0;
var step = 1;
// Show a text with the data point value
var show_value = false;
//
// DON'T CHANGE THE CODE BELOW
//
// Check if data point type is compatible
if (getDataPointType(point.id) != "M... | true |
65aab1602d9acff0ddfea73652bd04ee62c14b0a | JavaScript | corbecker/weather-app | /utils.js | UTF-8 | 364 | 3.46875 | 3 | [] | no_license | class Utils {
static capitalize(message){
const messageArray = message.split(' ');
const capitalisedArray = messageArray.map(word => {
return word.charAt(0).toUpperCase() + word.slice(1, word.length);
});
const messageString = capitalisedArray.reduce((prev, curr) => {
return `${prev} ${cur... | true |
fbfb7b63e393083d0cd299a07921021af7df0d48 | JavaScript | qtplatypus/junk-heap-planet | /scripts/thunkCounter.js | UTF-8 | 1,135 | 2.90625 | 3 | [] | no_license | "use strict";
// This has so much in common with power. See if you can refactor them together
define("thunkCounter", ["./displayNumber"], function (displayNumber) {
return function () {
var thunkCounter = 0;
var source = {};
var sink = {};
var thunk = {
"thunks" : function () {
return t... | true |
beeb8e8838752c24e674e224732d7d6333b200bc | JavaScript | StephhyL/lotide | /eqObjectsRecursion.js | UTF-8 | 1,475 | 3.53125 | 4 | [] | no_license | const assertEqual = function(actual, expected) {
actual === expected ?
console.log(`✅✅✅Assertion Passed: ${actual} === ${expected}.`)
: console.log(`🛑🛑🛑Assertion Failed: ${actual} !== ${expected}.`);
};
const eqArrays = (arr1, arr2) => {
if (arr1.length !== arr2.length) {
return false;
}
for ... | true |
e08fd1430921289adc69acdecd4a284e41e27623 | JavaScript | alexandr2110pro/waves-angular-test | /src/shared/core/exception/abstract-exception.js | UTF-8 | 747 | 2.6875 | 3 | [] | no_license | import ExtendableError from 'es6-error';
/**
* @abstract
*/
export class AbstractException extends ExtendableError {
/**
* @abstract
* @type {string}
*/
name = 'AbstractException';
constructor(...args) {
super();
const { message, code } = this._processExceptionData(...args);
this.messa... | true |
dad880b9e4b78dc810db799c927fd4457fb0f177 | JavaScript | ramiroerg/js | /js/src/calculatorSpec.js | UTF-8 | 392 | 2.78125 | 3 | [] | no_license | var calculator = require('./calculator');
describe('calculator', function(){
it('should add two numbers', function(){
var actualRes = calculator.sum(1,2);
var expectRes = 3;
expect(actualRes).toBe(expectRes);
});
it('should calc the fact of a number', function(){
var actualRes = calculator.factorial(5)... | true |
018da5a60c31eb65e67bd7acec8644fa93e1ca06 | JavaScript | orikurt/DoctorDemo | /router.js | UTF-8 | 1,452 | 2.875 | 3 | [] | no_license | //Add required modules
var fs = require("fs");
var startPath = "container.html";
var xmlp = require('xml2js');
var requestHandler = require("./requestHandler.js");
//route to requested page and handle data if necessary
function route(pathname, response, data, handle){
pathname = pathFix(pathname);
console.l... | true |
3461c39cf8aa3b953ca47df75be77e4f6eae6aee | JavaScript | kstarzyk/curves-editor | /src/components/selected.js | UTF-8 | 1,085 | 2.6875 | 3 | [] | no_license | class SelectedComponent extends Component {
constructor() {
super('#selected-info')
this.id = -1
this.selected = null
this.elem.addEventListener('click', this, false)
}
status() {
}
onClick(e) {
switch (e.target.id.slice(7)) {
case 'animate':
this.handleAnimate()
... | true |
8ecbcd50fcc40822412d4226c3850d846476bca0 | JavaScript | stbth01/d3-training | /src/materials/Week 7/Assignments/viz2/js/chart.js | UTF-8 | 7,366 | 2.71875 | 3 | [
"MIT"
] | permissive | function buildChart(containerId) {
// size globals
var width = 2000;
var height = 500;
var legendSize = 15;
var scaleProj = 400;
var margin = {
top: 50,
right: 50,
bottom: 50,
left: 50
};
// calculate dimensions without margins
var innerWidth = width... | true |
866d68d74696205da8406a88d6cb2471bbaaa08a | JavaScript | ryancookdev/canvas-chess | /src/engine.js | UTF-8 | 18,245 | 2.9375 | 3 | [
"MIT"
] | permissive | var CHESS = CHESS || {};
/**
* Utility library
*/
CHESS.Engine = function ($) {
$.Engine = {};
$.Engine.gameIsOver = function (position) {
return this.getLegalMoves(position).length === 0;
};
$.Engine.isStalemate = function (position) {
return !this.isCheck(position) && this.getLegalMoves(position).length... | true |
07dae474e81990a2b35f566da5895aefbcf55f66 | JavaScript | done520/vue-imgupload | /vue2/ImgUpload/utils.js | UTF-8 | 1,532 | 2.71875 | 3 | [] | no_license | /**
* @Description: 一些工具示例
* @Author: Neo
* @Date: 2019-12-11
* @LastEditTime: 2021-11-17
* @LastEditors: Neo
*/
/**
* 数字存储大小格式化
* @param {number} num 存储大小 单位:Byte
* @param {number} digits 保留几位小数
* @return {string} 2MB
*/
function toStorage (num, digits) {
digits = digits || 2
if (num < 1024) {
retu... | true |
287484201ed3f481fbc7cbf3aabe0b62496c5712 | JavaScript | leomicheloni/clean-code-javascript-examples | /functions/function avoid flag arguments.js | UTF-8 | 307 | 2.625 | 3 | [] | no_license | //// Functions, don't use flag arguments
// Mal
function createFile(name, temp) {
if (temp) {
fs.create(`./temp/${name}`);
} else {
fs.create(name);
}
}
// Bien
function createFile(name) {
fs.create(name);
}
function createTempFile(name) {
createFile(`./temp/${name}`);
} | true |
a1fef2b3fff26acba7e5c81312e11757ab01ca8e | JavaScript | rafaelsoteldosilva/track-map | /src/context/AuthContext.js | UTF-8 | 3,534 | 2.515625 | 3 | [] | no_license | import AsyncStorage from '@react-native-async-storage/async-storage';
import createDataContext from './createDataContext';
import trackerApi from '../api/tracker';
const ADD_ERROR = 'ADD_ERROR';
const SIGNIN = 'SIGNIN';
const SIGNOUT = 'SIGNOUT';
const CLEAR_ERROR_MESSAGE = 'CLEAR_ERROR_MESSAGE';
const initialState ... | true |
ef7ed27cd82354e0cef8bb6417250ca9ce14fac4 | JavaScript | denmadmaI/denmadmaI.github.io | /javascript/optical_calculator.js | UTF-8 | 12,294 | 2.53125 | 3 | [] | no_license | class FormClass {
constructor(formName) {
let fieldSet = document.createElement("fieldset");
let myForm = document.getElementById(formName);
this.form = formName;
this.mode = "Tx";
this.TxExp = "In Tx mode, OMA is the calculated quantity.";
... | true |
e1320da778d28be83354e1ddc41bed1e78573e13 | JavaScript | CheeseDanish1/pearl | /final-discord-bot/src/commands/Misc Commands/members.js | UTF-8 | 1,722 | 2.828125 | 3 | [] | no_license | const Discord = require('discord.js');
module.exports.run = (client, message, args) => {
let start = 0;
let end = 10;
let mes = message.guild.members.cache
.filter(m => !m.user.bot)
.map(m => m.user.username)
.sort();
let embed = new Discord.MessageEmbed()
.setTitle(`${message.guild.name} Membe... | true |
fc1fb94a784b63250a73ac3e8211ca1f9f59fd24 | JavaScript | lanniu/leetcode | /Median of Two Sorted Arrays.js | UTF-8 | 1,002 | 3.796875 | 4 | [] | no_license | const findMedianSortedArrays = function (nums1, nums2) {
const merge = (num1, num2) => {
let num1Index = 0
let num2Index = 0
const arr = []
const num1Length = num1.length
const num2Length = num2.length
while (num1Index < num1Length && num2Index < num2Length) {
const value1 = num1[num1In... | true |
4066407cc5a9eea44540fab6a2d19c0c305e2366 | JavaScript | manojbhargavan/javascript | /projects/nodejs/files/index.js | UTF-8 | 2,393 | 3.125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env node
//Get File System Node Module
const fileSystem = require("fs");
const chalk = require("chalk");
const path = require("path");
const targetDir = process.argv[process.argv.length - 1] || process.cwd();
console.log(targetDir);
//printDirectoryEntires(targetDir);
//printDirectoryEntiresAsync(targetDi... | true |
5d9d70426e91b8edf8f6474cb7b8904cf339e84f | JavaScript | testpassenumerique/HarryPotron-master | /sketch.js | UTF-8 | 847 | 3.203125 | 3 | [] | no_license | var video;
var gSlider;
// Partie exécutée une seule fois (initialisation)
function setup() {
createCanvas(640, 480);
video = createCapture(VIDEO);
video.size(120, 80);
video.hide();
gSlider = createSlider(50, 1000, 50);
gSlider.position(20, 20);
}
// Partie qui tourne en boucle
function d... | true |
dc1039efcdca1a61b7df9a54ed9a379e2ddee310 | JavaScript | Beotrix3/mesto | /src/components/Card.js | UTF-8 | 2,756 | 2.890625 | 3 | [] | no_license | export default class Card {
constructor({data, handleCardClick, handleVerifyDelete, handleLikeClick}, templateSelector, api, guestId) {
this._name = data.name;
this._link = data.link;
this._likes = data.likes;
this._templateSelector = templateSelector;
this._handleCardClick = handleCardClick;
... | true |
8b2af3b53fd5273c785c984139fd0b8026a5899e | JavaScript | 10xtarun/sttp_node_2021 | /quotes_app/async-await.js | UTF-8 | 169 | 2.6875 | 3 | [] | no_license | const fs = require('fs/promises');
async function readFile(){
let data = await fs.readFile(__dirname+"/quotes.txt");
console.log(data.toString());
}
readFile() | true |
7bb44cbe5eb7047930b5c492f3b22f1d3281c0ee | JavaScript | sansrivas/The-Real-Repo | /challenge.js | UTF-8 | 1,641 | 2.78125 | 3 | [] | no_license | var source = $("#template").html();
var template = Handlebars.compile(source);
var data = {
countries: [ {
country: {
countryCode: "BY",
countryName: "Belarus"
population: "9,685,000",
english?: "",
},
country: {
countryCode: "BZ",
... | true |
58d143b25297bcee1feec79361043c12b018df58 | JavaScript | evan361425/homework-cryptography | /src/hash-video.js | UTF-8 | 3,055 | 2.765625 | 3 | [
"MIT"
] | permissive | const fs = require('fs');
const crypto = require('crypto');
const { joinPath, readFile, writeFile } = require('./helper');
/** @var {string} used folder */
const FOLDER = 'hash-video';
/** @var {string} get videos name and expect tag */
const DATA_PATH = `${FOLDER}/data.json`;
/** @var {string} file to output */
const... | true |
931cc0a7db9a6622d688742b4f65fe0da0fb4243 | JavaScript | manjufy/javascript | /design-patterns/constructor-pattern.js | UTF-8 | 437 | 4.46875 | 4 | [] | no_license | /**
* One way to address some of the weakness of the factory pattern is to use the Constructor Pattern.
*/
function Robot(name, job) {
this.name = name
this.job = job
this.introduce = () => {
console.log(`Hi I'm ${this.name} and My job is ${this.job}`)
}
}
const bender = new Robot("Bender", "... | true |
e1b7e9f41e0e864855e0439171958aad835b4822 | JavaScript | sonbkt/DDD | /index.js | UTF-8 | 2,945 | 3.671875 | 4 | [] | no_license | "use strict";
class Database {
constructor(initialData) {
this.data = initialData;
}
getAuthors() {
return this.data.authors;
}
getPosts() {
return this.data.posts;
}
getAuthor(authorId) {
return this.data.authors[authorId];
}
getPost(postId) {
... | true |
4cf2e4e6a861eb987cae6af2b281cd5b2d5ded11 | JavaScript | Andrew-R-Law/interactive-form | /js/script.js | UTF-8 | 8,154 | 3.046875 | 3 | [] | no_license | const jobTitle = document.getElementById('title');
const colorSelector = document.getElementById('color');
const designSelector = document.getElementById('design');
const activities = document.getElementById('activities');
let totalCost = 0;
const activityBoxes = document.querySelectorAll('[type = "checkbox"]');
const ... | true |
66cfa5644ea3339a3a0e9993f3a946b991314358 | JavaScript | duarbdhks/study_algorithm_javascript | /merge_sort.js | UTF-8 | 1,346 | 4.25 | 4 | [] | no_license | /*
병합정렬
- 시간복잡도: O(N * logN)
- 비고:
퀵정렬도 빠르지만, 만약에 정렬되있는경우 느림(편향적인 정렬)
이러한 평향적인 부분이 없어 N * logN을 보장함.
=> 병합정렬 > 퀵정렬
- 문제: 오름차순 정렬
- 내용: 일단 반으로 자르고, 나중에 병합함.
*/
let list = [7, 6, 5, 8, 3, 5, 9, 1]
const merge = (left = [], right = []) => {
let results = [], leftIdx = 0, rightIdx = 0;
//작은 순으로 배열에 삽입
while... | true |
99915e904bddf1f5b3c78f6e5e4123723cca0576 | JavaScript | nimishag2000/hellophonegap | /assets/www/Jquery/Common.js | UTF-8 | 10,938 | 2.546875 | 3 | [] | no_license |
function Watermark(id, watermarkText) {
//alert(id+'<--------->'+watermarkText);
$(id).focus(function () {
$(this).filter(function () {
//alert($(this).val()+'<--------->'+ $(this).attr('watermark'));
// We only want this to apply if there's not
// something actual... | true |
1126d2e175575389cdc3418ee67ab7f9c474a77a | JavaScript | ishumski/world | /JS/DOM/6.hi_lvl_work_with_DOM(lesson_24)/30.task/js/script.js | UTF-8 | 431 | 3.3125 | 3 | [] | no_license | /*30. Дан ol, а внутри него li. Сделайте так,
чтобы по нажатию на любую li эта li удалялась. */
const ol = document.querySelector("ol");
const li = document.querySelectorAll("li");
li.forEach((elem) => {
elem.addEventListener("click", (event) => {
const { currentTarget } = event;
currentTarget.re... | true |
dbbb130822f17e39107367f498ef1c23aa288116 | JavaScript | Vishnyasuper/488747-keksobooking | /js/map.js | UTF-8 | 7,406 | 2.640625 | 3 | [] | no_license | // Файл map.js
'use strict';
var ESC_KEYCODE = 27;
var ENTER_KEYCODE = 13;
var ADVERT_AVATAR = ['img/avatars/user01.png', 'img/avatars/user02.png', 'img/avatars/user03.png', 'img/avatars/user04.png', 'img/avatars/user05.png', 'img/avatars/user06.png', 'img/avatars/user07.png', 'img/avatars/user08.png'];
var ADVERT_TI... | true |
d623fcd6c24450e39ef8c1b03e34e44c3ef97685 | JavaScript | mrsperry/visuals | /projects/falling-lights/js/light.js | UTF-8 | 3,661 | 3.203125 | 3 | [] | no_license | class light {
static globals() {
// Chance to create a tipped light (0-1)
light.tippedChance = 0.1;
// Minimum speed the light must be going to be tipped
light.minimumTipSpeed = 0.7;
// Minimum tip length in pixels
light.minTipLength = 50;
// Maximum tip lengt... | true |