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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ed8f3cec088fe7e26a71f2923dae1e720b1a015b | JavaScript | Mick6432/DevU-Javascript | /operators.js | UTF-8 | 850 | 3.921875 | 4 | [] | no_license | // Categories of operators
// 1. Assignment Operator '='
// 2. Arithmetic Operators
// i. Addition '+'
// ii. Subtraction '-'
// iii. Multiplication '*'
// iv. Division '/'
// v. Modulus '%'
let m = 10 % 3;
console.log('Modulus = ' + m);
// vi. Increment '++'
// vii. Decrement '--'
var a = 1; //a =... | true |
e94ac07c2b72a01ec69e3ec0506fc40e88bd844f | JavaScript | xdweichao/Eclipse | /14.WebApplication/data/postsRepository.js | UTF-8 | 868 | 2.71875 | 3 | [
"MIT"
] | permissive | /**
*
*/
// https://www.sitepoint.com/understanding-module-exports-exports-node-js/
// greetings.js
var exports = module.exports = {};
// fake posts to simulate a database
const posts = [ {
id : 1,
author : 'John',
title : 'Templating with EJS',
body : 'Blog post number 1',
year : '1981'
}, {
id : 2,
author... | true |
e7d0b5b697f5a96302bd472ccd771e2ba9f4b0af | JavaScript | Emmanuel289/Tikky-Takka | /src/components/board.jsx | UTF-8 | 2,372 | 3.65625 | 4 | [] | no_license | import React, { Component } from "react";
import Square from "./square";
class Board extends Component {
constructor(props) {
super(props);
this.state = {
squares: Array(9).fill(null), // declare a squares array comprising 9 null elements, one for each square
xIsNext: true, //boolean to detect mo... | true |
695bc0002d54ffb07b121409802d2d4db6263ce4 | JavaScript | ulajeziorna20/11-liczba-do-potegi-dodatkowe | /js/script.js | UTF-8 | 630 | 4.40625 | 4 | [] | no_license | // 1.version
const power = (base, exponent) => {
let result = 1;
for (let count = 0; count < exponent; count++) {
result *= base;
}
return result;
}
console.log(power(2, 3));
console.log(power(3, 2));
console.log(power(4, 2));
// 2.version
function numberToPower(number, power){
le... | true |
33b418b2e9eca868e63c1fb36cc6640d27f35011 | JavaScript | BDavidoff/Move-Tool | /mainSite/scripts/Utility.js | UTF-8 | 795 | 3.03125 | 3 | [] | no_license | function ajaxRequest(url, params, method, sync) {
/*
* @param {url} STRING the intended site
* @param {params} STRING parameter names and values serialized
* @param {method} STRING GET or POST
* @param {sync} BOOL true for asyncronous
*/
var xmlHttp = null;
url += "?"
var package = ... | true |
b775424a49038f60e876eeebd920b908455425b7 | JavaScript | gauravbehere/client-hints | /server.js | UTF-8 | 1,923 | 2.53125 | 3 | [] | no_license | const express = require('express');
const https = require('https');
const fs = require('fs');
const bodyParser = require('body-parser')
const app = express();
const PORT = 4002;
app.use(express.static(__dirname));
app.use(bodyParser.urlencoded({ extended: false }))
app.use(bodyParser.json())
/**
* The app that serve... | true |
ca4444553b0c701ba4ddbc95bc0d77278c7d5027 | JavaScript | migleankstutyte/tictactoe | /src/reducers/boardReducer.js | UTF-8 | 531 | 2.96875 | 3 | [] | no_license | import { DRAW_X, DRAW_O, STOP } from '../utils/actionTypes';
const initialState = [null, null, null, null, null, null, null, null, null];
const boardReducer = (state = initialState, action) => {
switch (action.type) {
case DRAW_X:
const newXState = [...state];
newXState[action.index] = 'X';
return newXSta... | true |
0e49782862fec04a7d7f8e968315ad71c9e7b7c0 | JavaScript | mj-git/okrs-list | /src/App.js | UTF-8 | 1,695 | 2.59375 | 3 | [] | no_license | import { useState, useEffect, useMemo } from 'react';
import OKRAccordion from './OKRAccordion';
import { fetchOKRs } from './utils';
import { processOKRData, getCategories } from './logic';
function App() {
const [filteredOkrs, setFilteredOkrs] = useState([]);
const [allOkrs, setAllOkrs] = useState([]);
co... | true |
c907202bbe466f374c48c985b9369c76121bc664 | JavaScript | square1grp/Map-Generator | /assets/js/core.js | UTF-8 | 16,676 | 2.640625 | 3 | [] | no_license | /**
* Convert CSV text to array.
*/
var csvToArray = function (a, b) {
if (a) {
for (var b = b || ",", d = RegExp("(\\" + b + '|\\r?\\n|\\r|^)(?:"([^"]*(?:""[^"]*)*)"|([^"\\' + b + "\\r\\n]*)([^\\" + b + "\\r\\n]*))", "gi"), e = [[]], f = null, f = a.split("\n"), g = 0; g < f.length; g++) {
if (g === 0)
... | true |
08c4ad7f0fd10d7b4c030228f2120afdebeb29ab | JavaScript | Monstarrrr/perlin-noise | /perlin_noise_1D/perlin_noise_4/sketch.js | UTF-8 | 537 | 3.28125 | 3 | [] | no_license | var inc = 0.01;
var start = 0;
function setup() {
createCanvas(400, 400);
}
function draw() {
background(51);
stroke(255);
//noFill();
// BEGIN SHAPE TO CONNECT DOTS //
beginShape();
var xoff = start;
// X AXE //
for (var x = 0; x < width; x++) {
stroke(255);
// Y ... | true |
1a2f86c15c7dd106a898d7893cca4d335e7f014e | JavaScript | MrRobot-Less/generateArt | /Snowflake/snowflake.js | UTF-8 | 1,246 | 3.1875 | 3 | [] | no_license | array = [[0,0]]
class Snowflake{
constructor(){ //em python: def __init__()
this.positionx = (width-width/10)/2
this.x = this.positionx
this.y = 0
this.r = 3
}
finish(){
for(let i=0;i<array.length;i++){
let d = dist(array[i][0], array[i][1], this.x,this.y)
if(d < this.r){
... | true |
d6facee89f4a4504cbeac526171d43fa71705185 | JavaScript | MurphyUan/DataRep_Lab4 | /src/components/movies.js | UTF-8 | 399 | 2.640625 | 3 | [] | no_license | //Import local Dependencies
import React, {Component} from 'react';
import MovieItem from './movieItem';
//Read Class
class Movies extends Component{
//Render method from Component
render(){
//Return HTML
return this.props.films.map((e) => {
return <MovieItem item = {e} key={e.imdbI... | true |
ad1ac1540d2edb29d4af6aac9368bdc08d3a8243 | JavaScript | constantinius/ncjs | /src/iobuffer64.js | UTF-8 | 800 | 2.75 | 3 | [
"MIT"
] | permissive | import IOBuffer from 'iobuffer';
export default class IOBuffer64 extends IOBuffer {
readUint64() {
const left = this.readUint32();
const right = this.readUint32();
if (this.isLittleEndian()) {
return (left << 32) | right;
}
return (right << 32) | left;
}
readInt64() {
if (this.isLi... | true |
63df9c93e08926f3b7b98e593c324f6a06cd92b3 | JavaScript | arkpery/exercices_pmn | /classes/js/exo1/utils/range.js | UTF-8 | 164 | 2.6875 | 3 | [] | no_license | function range(start, limit){
let tab = [];
for (let i = start; i <= limit; i++){
tab.push(i);
}
return (tab);
}
module.exports = range;
| true |
6f793f472c00ffe95312df10b76be217c348d0ec | JavaScript | imood00/progate_javascript03 | /es6_study_3/page5/script.js | UTF-8 | 299 | 3.953125 | 4 | [] | no_license | // 関数の引数にnumber1とnumber2を追加してください
const add = (number1,number2) => {
// number1とnumber2を足した値をコンソールに出力してください
console.log(number1+number2);
};
// 引数に5と7を渡して関数を呼び出してください
add(5,7);
| true |
e5df534ff2d50d77abe659cd3d42dad3e7ce487a | JavaScript | JordanOsterberg/BlitFullStackHW | /server/database.js | UTF-8 | 1,638 | 2.640625 | 3 | [] | no_license | const Pool = require("pg").Pool;
const _ = require("underscore");
function Database(user, password, host, port, database, table) {
const pool = new Pool({
user: user,
password: password,
host: host,
port: port,
database: database
});
table = _.defaults({table: table... | true |
3b4d5bef5af969d610897e4d3142580920c76e62 | JavaScript | a1clark1a/DSA-Searching | /ui-search/src/Code/Drills.js | UTF-8 | 1,036 | 3.703125 | 4 | [] | no_license | const binarySearch = require('./BinarySearch')
function main() {
const sorted = [3,5,6,8,11,12,14,15,17,18];
//With a size 10, BS cuts it in half so starts at index 5 = 12
//since value is lower than 12, searches at the left of the array.
//with a size of 5 cuts in half at index 2 = 6
//... | true |
db895949d6360bd145d6f8001d3612a25bebd49a | JavaScript | csxiaoyaojianxian/JavaScriptStudy | /09-PWA/study2/03-service-worker/public/base64util.js | UTF-8 | 636 | 3.078125 | 3 | [
"MIT",
"ICU"
] | permissive | /**
* 将base64的公钥字符串转为Unit8Array
* base64的相关操作,具体可以参考
* https://github.com/web-push-libs/web-push#using-vapid-key-for-applicationserverkey
*/
window.urlBase64ToUint8Array = function (base64String) {
const padding = '='.repeat((4 - base64String.length % 4) % 4);
const base64 = (base64String + padding)
.... | true |
b76d4247a82ace230eb9f1d93ce8a2ba0dbe9748 | JavaScript | kemalreza12/cafeShopApp-backend-expressJS | /src/controllers/histories.js | UTF-8 | 1,903 | 2.5625 | 3 | [] | no_license | const historiesModels = require('../models/histories')
const histories = {
getHistoryById: (req, res) => {
const id = req.params.id;
historiesModels.getHistoryById(id)
.then((result) => {
resultHistories = result;
res.json(resultHistories);
})
.catch... | true |
fffc35dd6dcb97d3c5b8faead366cc5785935c86 | JavaScript | alimurtadho/React-Fundamentals | /app/containers/Es2015/ObjectShorthand.js | UTF-8 | 1,075 | 2.65625 | 3 | [] | no_license | import React from 'react';
import { ScrollView } from 'react-native';
import SyntaxHighlighter from '../../components/SyntaxHighlighter';
import ExampleTitle from '../../components/ExampleTitle';
let examples = {};
class ObjectShorthand extends React.Component {
static navigationOptions = () => ({
title: 'Obje... | true |
5e2fd654af79b80fc08fc79cdfd422d4b7db7c18 | JavaScript | SimonWX/Front-End-Weekly-Collection | /collection/algorithm-study/sort/selectionSort.js | UTF-8 | 440 | 3.734375 | 4 | [
"MIT"
] | permissive | // 选择排序的实现
Array.prototype.selectionSort = function () {
for (let i = 0; i < this.length - 1; i += 1) {
let indexMin = i;
for (let j = i; j < this.length; j += 1) {
if (this[j] < this[indexMin]) {
indexMin = j;
}
}
if (indexMin !== i) {
const temp = this[i];
this[i] = t... | true |
0c3392c38cd29caba1bb81910c13588a274d248e | JavaScript | ahrrhy/gh_7th_js | /hw6/parts/animal.js | UTF-8 | 1,722 | 3.359375 | 3 | [] | no_license | export default class Animal {
constructor(name, health, stamina) {
this.name = name;
this.health = health;
this.stamina = stamina;
this._reloadStamina = stamina;
this._reloadHealth = health;
this._DAY = 1000;
this._age = 0;
this._maxAge = 50;
t... | true |
176266e5233f606a53de9dfdcf00c5a94f540d7c | JavaScript | rramires/javascript | /07_ESNext/14_promise_tratamento_erro.js | UTF-8 | 941 | 4.125 | 4 | [] | no_license | /**
* Vamos simular um erro, aumentando ou diminuindo a sua probabilidade
* apenas para observar o tratamento de exceções com promise
*/
const entrarNoParaiso = (nome, pecados) => {
return new Promise((resolve, reject) =>{
// se a "divindade" está mais ou menos tolerante
let toleranciaDivindade ... | true |
9861e15972c184bcb1cafa7c937a62f1458e898a | JavaScript | kle08/n-queens | /src/solvers.js | UTF-8 | 2,973 | 3.453125 | 3 | [] | no_license | /* _
___ ___ | |_ _____ _ __ ___
/ __|/ _ \| \ \ / / _ \ '__/ __|
\__ \ (_) | |\ V / __/ | \__ \
|___/\___/|_| \_/ \___|_| |___/
*/
// hint: you'll need to do a full-search of all possible arrangements of pieces!
// (There are also optimizations that will allow you to skip a lot of the dead ... | true |
d57843170c1f90c29b55fac12bfa3273dd2fba36 | JavaScript | SiddiquiBoy/CypressPractice | /cypress/integration/3-Practice/TC001.spec.js | UTF-8 | 1,449 | 2.640625 | 3 | [] | no_license | ///<reference types='cypress'/>
describe('basic practice', () => {
it("basics", () => {
// navigate URL
cy.visit("http://demo.automationtesting.in/Register.html");
//check an checkbox
cy.get('#checkbox1').should('not.be.checked');
//get value of the checkbox
cy.get(... | true |
b32311ff506b8150def9cc0aa2c8a880bc184b1c | JavaScript | Ai-Rocky/mess-management-system | /lib/exepnse.lib.js | UTF-8 | 1,995 | 2.703125 | 3 | [
"MIT"
] | permissive | const ExpenseModel = require('../models/expenseModel');
const CategoryModel = require('../models/categoryModel');
class ExpenseLib {
constructor(){};
async addExpense(expenseObject){
try {
return await ExpenseModel.create(expenseObject);
} catch (e) {
return e;
}
}
async totalMessExpense(mess){
try... | true |
86d621983107baf6a036637ec56acaa0b69914d8 | JavaScript | NHQ/uxer | /appendCSS.js | UTF-8 | 471 | 2.84375 | 3 | [] | no_license | module.exports = function(css, id){
var es = document.getElementById(id);
if(es){
return false
// es.parentNode.insertBefore(makeStyle(css), es.nextSibling)
}
else{
var styleSheet = makeStyle(css, id)
document.head.insertBefore(styleSheet, document.head.childNodes[0]);
return styleSheet
}
}
... | true |
cf4344779eae8d5ba0cc0626ec5e6786b76880d1 | JavaScript | ElCapChaser/ironhack-flashCard | /nodemailer.js | UTF-8 | 2,540 | 2.59375 | 3 | [] | no_license | const dotenv = require('dotenv');
dotenv.config();
const nodemailer = require('nodemailer');
const welcomeEmail = (userEmail) => {
const transport = nodemailer.createTransport({
service: 'Gmail',
auth: {
user: process.env.GMAIL_ADDRESS,
pass: process.env.GMAIL_PASSWORD
}
});
transport
... | true |
8e2e523fe12ae627fd052edaab4d4e5bae9537aa | JavaScript | konstantin-kh/hillel | /10/hw10-1.js | UTF-8 | 664 | 3.71875 | 4 | [] | no_license | // https: //developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Classes
class Ingridients {
constructor () {
this.list = [];
}
add (ingridients) {
this.list.push(ingridients);
}
getAll () {
return this.list;
}
getByName (name) {
return t... | true |
d048d67568c2374dee9631f1669c7f269a3b6418 | JavaScript | ArtemSirotkin49/ReactTestApp | /src/index.js | UTF-8 | 5,438 | 3.03125 | 3 | [] | no_license | import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
// =========================================================================
// Компонент КВАДРАТ *******************************************************
function Square(props) {
return (
<button
className="squ... | true |
995b0341c672c7b992574c2d60fe902b38eea13d | JavaScript | NikLever/GLSLfromScratch | /glsl-shaders-57/complete/js/index.js | UTF-8 | 3,406 | 2.78125 | 3 | [
"MIT"
] | permissive | var camera, scene, renderer, composer;
var object, light;
var glslPass;
init();
animate();
function init() {
renderer = new THREE.WebGLRenderer();
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement );
... | true |
0bd802c2287fd6e734dc246e7526aecdd329ac88 | JavaScript | reprograma/On10-TodasEmTech-JavascriptII | /Exercicios/10. array.map()/script.js | UTF-8 | 638 | 3.5625 | 4 | [] | no_license | const usuarios = [
{user:234, name: 'Marcia', idade:40 },
{user:235, name: 'Lorena', idade:20 },
{user:236, name: 'Patricia', idade:24 },
{user:237, name: 'Mariana', idade:15 },
{user:238, name: 'Isis', idade:34 },
{user:239, name: 'Pietra', idade:23 }
]
const textoResultado = usuarios.map((par... | true |
3966174847848ccd70899516b7167508b9bc9888 | JavaScript | ganinaleksei/ClassifierRSSFeeds | /bayesClassifier.js | UTF-8 | 3,110 | 3.25 | 3 | [] | no_license | var bayes = require('bayes')
var classifier = bayes();
// teach it positive phrases
function shuffle(o){
for(var j, x, i = o.length; i; j = Math.floor(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
return o;
}
var MongoClient = require('mongodb').MongoClient;
MongoClient.connect('mongodb://localhos... | true |
5ed32d2c198c530b8400e26dd6adc312e14107bb | JavaScript | JadSayegh/dotjs | /src/static/LeadListing/LeadList.js | UTF-8 | 1,457 | 2.640625 | 3 | [] | no_license | import React from 'react';
import {render} from 'react-dom';
import LeadBox from './LeadBox';
class LeadList extends React.Component {
fetchLeadList(activity){
$.ajax({
dataType: "json",
url: "/api/lead-list/" + activity,
data: "",
success: (data) =>{
this.props.fetchLeadsSuccess(... | true |
db02bd0918caddc5b9d65e928e3d10b83f8c4bd1 | JavaScript | amaurysg/marvelclonepage | /js/sliders.js | UTF-8 | 2,599 | 2.984375 | 3 | [] | no_license | //SLIDES MOBILE AUTOMATICO
var slideIndex = 0;
window.addEventListener("load", showSlides);
function showSlides() {
var i;
var slidesList = document.querySelectorAll(".slidersCollections");
for (i = 0; i < slidesList.length; i++) {
slidesList[i].style.opacity = "0";
}
slideIndex++;
if (slideIndex > sli... | true |
6fd1924f0e73c0046ea0c16a67748bd96acdb0e1 | JavaScript | devLily/idea_backend | /routers/comment.js | UTF-8 | 2,040 | 2.546875 | 3 | [] | no_license | const express = require("express");
const router = express.Router();
const Comment = require("../models/comment");
require("date-utils");
// postId 검증은 내일하자...!
router.get("/:postId", async (req, res) => {
const { postId } = req.params;
try {
const comment = await Comment.find({ upperPost: postId }).sort("-_i... | true |
5771b4fc686d15a99a60fd3749712849a65c84aa | JavaScript | yani-valeva/it-talents | /CyclesWithRecursion/task14.js | UTF-8 | 205 | 3.59375 | 4 | [
"MIT"
] | permissive | let number = 77;
function printNum(num) {
if (num < 10) {
return;
}
if (num % 7 === 0) {
process.stdout.write(num + ' ');
}
printNum(num - 1);
}
printNum(number - 1); | true |
237ba629acc23865d3a749eff4f85627fcd62f1a | JavaScript | minhajspace/counter-redux | /src/components/Counter.js | UTF-8 | 2,022 | 2.953125 | 3 | [] | no_license | import React from 'react'
let userInput = prompt;
let jumpby;
let value = 1;
class Counter extends React.Component {
state = {
counter: 0,
}
onIncrementClick = () => {
this.setState({ counter: this.state.counter + value })
}
onDecrementClick = () => {
this.setState({ coun... | true |
dc5785a77e3ce249eda86b06b54bb1a487fe1609 | JavaScript | kshiro622/react-news-app | /app/components/children/search.js | UTF-8 | 2,751 | 2.890625 | 3 | [] | no_license | var React = require("react");
var Search = React.createClass({
// Here we set a generic state associated with the text being searched for
getInitialState: function () {
return {
term: "",
startYear: "",
endYear: ""
};
},
// This function will respond... | true |
047367a34c11a30c4d9b032c0299e78e96059dcc | JavaScript | zhanght86/HSBC20171018 | /LIS/sinosoft-parents/lis-webapp/src/main/webapp/static/lib/sinosoft.nameicongenerator.js | UTF-8 | 8,061 | 2.859375 | 3 | [] | no_license | window.nameIconGenerator = {};
window.nameIconGenerator.generateIcon = undefined;
window.nameIconGenerator.canvasElement = null;
function vec3(x, y, z) {
this.x = x;
this.y = y;
this.z = z;
}
function NigColor(r, g, b, a) {
this.r = r;
this.g = g;
this.b = b;
this.a = a;
this.toStrin... | true |
180dd58161ee3067746c4fa8501bf1cef9dffc59 | JavaScript | galco0608/files-import | /dbHandler.js | UTF-8 | 1,494 | 2.59375 | 3 | [] | no_license | const Patient = require('./Models/patient');
const Treatment = require('./Models/treatment');
exports.createPatient = (patient) => {
Patient.create({
patient_id: patient.patient_id,
mrn: patient.mrn,
patient_dob: patient.patient_dob,
is_deceased: patient.is_deceased,
dos_ts:... | true |
9eaa1da4dc07c09b19a33b00332af0cf01a5040e | JavaScript | Pygocentrus/BNF | /api/utils/index.js | UTF-8 | 2,425 | 2.609375 | 3 | [] | no_license | 'use strict';
// NPM
let fs = require('fs'),
_ = require('lodash'),
logger = require('tracer').console({
format : "{{timestamp}} - (in {{file}}:{{line}}) -> {{message}}",
dateformat : "d/m/yyyy HH:MM:ss"
});
// Modules
let Conf = require('../conf');
let Utils... | true |
087867de5b82c2d8825fe840afe793a7ca0b24ba | JavaScript | dainvinc/social-network-with-a-timer | /seeds.js | UTF-8 | 2,119 | 2.671875 | 3 | [] | no_license | var mongoose = require('mongoose');
var Friend = require('./models/friends');
var Comment = require('./models/comments');
var data = [
{
name: "First Post",
image: "https://images.pexels.com/photos/336413/pexels-photo-336413.jpeg?h=350&auto=compress&cs=tinysrgb",
text: "Create professional ... | true |
421d3b48afd41422421975bad61822a56785c504 | JavaScript | toshio-shiratori/jk | /js/arakin_part_rect.js | UTF-8 | 1,267 | 2.640625 | 3 | [
"MIT"
] | permissive | // インクルード
import ArakinPart from './arakin_part.js';
export default class ArakinPartRect extends ArakinPart {
constructor(params) {
super(params);
this.fillStyle = this.profile.getProfileData('fillStyle', 'rgb(0,0,0)');
}
static getPropertyList() {
var params = super.getPropertyLis... | true |
d35de9ee83ba59315879441347924c6d7b8e9ac1 | JavaScript | littlehorseboy/rxjs-practice | /src/rx-20/window.1.js | UTF-8 | 211 | 2.625 | 3 | [] | no_license | /* global Rx */
const click = Rx.Observable.fromEvent(document.body, 'click');
const source = Rx.Observable.interval(1000);
const newest = source.window(click);
newest
.switch()
.subscribe(console.log);
| true |
7626fc359047be39465ddb7bcad4fe6d54bc70e5 | JavaScript | tim-heck/lisa-heck-website | /scripts.js | UTF-8 | 761 | 2.546875 | 3 | [] | no_license | window.onscroll = function () { changeArrowFunction() };
function changeArrowFunction() {
let scrollbarPos = window.pageYOffset;
const arrow = document.getElementById('arrow');
if (scrollbarPos < 7640) {
arrow.style.display = 'none';
} else {
arrow.style.display = 'block';
}
//... | true |
a698d76b0e063be9009753f5b5d2eb4fa3aae39d | JavaScript | lxbcc/cnode-react | /src/container/Home/Job.js | UTF-8 | 1,790 | 2.515625 | 3 | [] | no_license | import React, { Component } from 'react'
import {Link} from 'react-router-dom';
export default class Job extends Component {
constructor(){
super();
this.state = {
data: [],
page:1
}
}
componentDidMount(){
fetch('https://cnodejs.org/api/v1/topics?tab=j... | true |
ceafcecb53a86a479eb73da3b9ac2e696e38499e | JavaScript | douxpang/use-js-for-algorithm | /手写题/js手写/promise/promiseMerge.js | UTF-8 | 1,299 | 4.375 | 4 | [
"MIT"
] | permissive | // 实现mergePromise函数,把传进去的数组按顺序先后执行,并且把返回的数据先后放到数组data中。
// 这道题有点类似于Promise.all(),不过.all()不需要管执行顺序,只需要并发执行就行了。但是这里需要等上一个执行完毕之后才能执行下一个。
const time = (timer) => {
return new Promise(resolve => {
setTimeout(() => {
resolve()
}, timer)
})
}
const ajax1 = () => time(2000).then(() => {
conso... | true |
47dce26ca5c2a97904a9345df13de4b2cc285ef1 | JavaScript | vbarbarosh/codescreens | /src/20190529_195952_node_promise_promisify/node_promise_promisify.js | UTF-8 | 886 | 2.953125 | 3 | [
"MIT"
] | permissive | const Promise = require('bluebird');
const fs = require('fs');
const util = require('util');
// Ways to promisify a function
// $ node node_promise_promisify.js
// https://nodejs.org/api/util.html#util_util_promisify_original
const fs_open = util.promisify(fs.open);
// http://bluebirdjs.com/docs/api/promise.promisif... | true |
7ad9f802aef82523dcf965731e6d9c54d09d78f8 | JavaScript | TomThomasPaul/Natours-Project | /utils/email.js | UTF-8 | 1,970 | 2.5625 | 3 | [] | no_license | const nodemailer = require("nodemailer");
const nodemailerSendgrid = require('nodemailer-sendgrid')
const pug = require("pug");
const htmlToText =require('html-to-text');
module.exports = class Email{
constructor(user, url){
this.to = user.email,
this.firstName = user.name.split(' ')[0];
this.ur... | true |
234712ceab2ea94510eb0d31577542a2583ee077 | JavaScript | decompiler-explorer/decompiler-explorer | /static/js/queue.js | UTF-8 | 2,589 | 3.09375 | 3 | [
"MIT"
] | permissive |
let refreshSchedule = -1;
function updateQueue() {
if (refreshSchedule !== -1) {
clearTimeout(refreshSchedule);
}
fetch("/api/queue")
.then(resp => {
if (resp.ok) {
return resp.json();
} else {
throw Error("Error loading queue");
... | true |
bbb36f1f58e4cfe5a286e0b2e92158a5349ddaec | JavaScript | coco98-rt/nodejs | /uploadfile_npm_lib.js | UTF-8 | 1,291 | 2.53125 | 3 | [] | no_license | var http = require('http');
var formidable = require('formidable');
var fs = require('fs');
http.createServer(function(req,res){
//to parse the uploaded file
if(req.url=='/fileupload'){
var form =new formidable.IncomingForm();
form.parse(req, function(err,fields,files){//fields is important... | true |
26536ddcb78f1e27c932467c902f93a3790d9867 | JavaScript | eavelasquez/learning-js | /03-fundaments-js/js/04-scope.js | UTF-8 | 404 | 4.03125 | 4 | [] | no_license | 'use strict';
/** Scope of variables */
function greeting(text) {
let string = 'Hello, World! Local variable';
console.log(string); // Show local variable
console.log(number.toString()); // Show global variable
console.log(text);
}
let number = 77;
let text = 'Hello, World! Goblal v... | true |
2a2c21fb9a2bf9ccdf582fe3fca57af6abff7758 | JavaScript | Deathsteps/FTravel | /util/dateEncoder.js | UTF-8 | 446 | 2.71875 | 3 | [
"MIT"
] | permissive | var moment = require('moment');
exports.encode = function (dateStr) {
return moment(dateStr).format('YYYYMMDD');
};
exports.decode = function (codedDate, type) {
var year = codedDate.substring(0, 4);
var month = codedDate.substring(4, 6);
var day = codedDate.substring(6);
var date = Date.parse(year + '-' + mont... | true |
07374cef68a0e63a94961fad7911c02684a95f4f | JavaScript | eattakata/ProjetoTeste | /yowft/tstpedido/static/VerBranco.js | UTF-8 | 802 | 2.84375 | 3 | [] | no_license | function fVerBranco() {
var vnome = document.getElementById('nome_usuario').innerHTML
var vsobrenome = document.getElementById('sobrenome_usuario').innerHTML
var vendereco = document.getElementById('endereco').innerHTML
console.log(vsobrenome)
var tam_nome = (vnome.tri... | true |
30b2d5efd67acb72dd5a4917f8cccf3eb96cf2d9 | JavaScript | Dagothig/ld48_29-jam | /app/looper.js | UTF-8 | 302 | 2.625 | 3 | [] | no_license | 'use strict';
module.exports = function(callback, tickLength) {
var last = Date.now();
function checkTick() {
var delta = Date.now() - last;
while (delta > tickLength) {
last += tickLength;
delta -= tickLength;
callback();
}
setImmediate(checkTick);
}
setImmediate(checkTick);
};
| true |
a96ec9a378ff023872e556aa24b8874519391838 | JavaScript | memj401/Backend-Cda | /src/middlewares/verificarToken.js | UTF-8 | 1,461 | 2.765625 | 3 | [] | no_license | const chave = require('../config/autenticacao/chaveSecreta').chaveSecreta
const njwt = require('njwt')
/**
* Middleware de autenticação de requisições via JWT para o Front End
* @namespace repositorioAutenticacao
*/
/**
* Autentica o usuario via validação e decriptação, com uma chave secreta, do JWT(Java Web Toke... | true |
033acb6fd73a73c432542dccd2ee55926cd8e84e | JavaScript | taOsemc/AxonCore | /src/Utility/External/SortedList.js | UTF-8 | 2,351 | 4.09375 | 4 | [
"MIT"
] | permissive | /**
* SortedList Object. Sorted Array of element (ascending or descending order)
*
* @author KhaaZ
*
* @template T
*
* @class SortedList
* @prop {Boolean} acending
* @prop {(toInsert: T, baseElement: T) => Boolean)} comparator - Whether toInsert is bigger than baseElement
* @prop {Array<T>} list
*/
class Sor... | true |
8d392e13ce02be5379229e9807a46bcfb2472b3d | JavaScript | Dzejson1/AngularStudentskaSluzba | /Server/routes/comments.js | UTF-8 | 1,769 | 2.578125 | 3 | [] | no_license | const express = require("express");
const router = express.Router();
const mysqlConnection = require("../connection")
//find all comments
router.get("/", (req, res) => {
console.log("uso")
mysqlConnection.query("SELECT * from Comment", (err, rows, fields) => {
console.log(err);
if (!err) {
... | true |
58b13f058b17642e13b8b4b8b9fab253554b07b2 | JavaScript | streamich/schemasafe | /test/regressions/unique.js | UTF-8 | 670 | 2.703125 | 3 | [
"MIT"
] | permissive | 'use strict'
const tape = require('tape')
const { validator } = require('../../')
tape('unique is not confused by type mismatch', (t) => {
const validate = validator({ type: 'array', uniqueItems: true })
t.ok(validate([1, 2]), 'unique items in array')
t.ok(validate([1, '2']), 'unique items in array, different ... | true |
1853524b03bf03d0a3a843ba6fcbca228645f36c | JavaScript | hariscs/dev-interior-consultant | /app.js | UTF-8 | 203 | 2.625 | 3 | [] | no_license | const btn = document.querySelector('.mobile-menu');
const list = document.querySelector('.navbar-list');
function toggle() {
list.classList.toggle('active');
}
btn.addEventListener('click', toggle);
| true |
e218fe8ac88d1882eb926bfdf6e294a24ab6f084 | JavaScript | DamnedScholar/gatsby-cusco | /src/components/RestaurantMenu/scripts/interactive-menu.js | UTF-8 | 7,587 | 3.0625 | 3 | [
"MIT"
] | permissive | // `window.matchMedia()` has the same syntax as CSS media queries.
// Source: https://www.sitepoint.com/javascript-media-queries/
// if (matchMedia) {
// const mq = window.matchMedia("(min-width: 500px)");
// mq.addListener(WidthChange);
// WidthChange(mq);
// }
//
// // media query change
// function WidthChange... | true |
05561be36e8fdfc62472a9d49797d04cd2989f15 | JavaScript | GabiOC/coderbyte-challenges | /symbol-check.js | UTF-8 | 1,046 | 4.8125 | 5 | [] | no_license | /* PROBLEM
Have the function SimpleSymbols(str) take the str parameter being passed and determine if it is an acceptable sequence
by either returning the string true or false. The str parameter will be composed of + and = symbols with several letters
between them (ie. ++d+===+c++==a) and for the string to be true each ... | true |
b563298a165cab77b5a77d156c6c1008e49098a5 | JavaScript | kousiclattala/AngularBootCamp | /PracticePrograms/variables.js | UTF-8 | 58 | 2.75 | 3 | [] | no_license | var a = 10;
var b = "Ten";
console.log(b + " is a " + a);
| true |
71ff9564f5754778c589c167756742abdda91ede | JavaScript | mayankconsultant/JAVASCRIPT_BOOKLIST | /app.js | UTF-8 | 1,142 | 3.703125 | 4 | [] | no_license | //Book Class:represents book
class Book {
constructor(title, author, isbn) {
this.title = title;
this.author = author;
this.isbn = isbn;
}
}
//UI Class: user Interface
class UI{
static displayBooks(){
const storedBooks=[
{
title="Lucky Seven",
author="Unknown",
isbn="... | true |
ff26ffc2974117e80c88d419c5bbd56e1ea2bbee | JavaScript | thomaslombart/workshop-vue-basics | /08-lifecycle-hooks/main.js | UTF-8 | 1,996 | 2.8125 | 3 | [] | no_license | Vue.component("counter", {
template: `
<div>
<h2 class="title">First counter</h2>
<button class="btn btn-small" @click="count++">+1</button>
<p>{{ count }}</p>
</div>`,
data() {
return {
count: 0
};
},
beforeCreate() {
console.log(
"beforeCreate:",
"data i... | true |
1e648d589431f7be85a1ebc9d2b0e55679bd849b | JavaScript | HeikiKotsar/byt-partner | /modal.js | UTF-8 | 1,609 | 2.953125 | 3 | [] | no_license | // New
const newBronn = document.querySelector('#new-bronn');
const newBtn = document.querySelector('#new-btn');
const closeBronn = document.querySelector('.close-bronn');
newBtn.addEventListener('click', openNewBronn);
closeBronn.addEventListener('click', closeNewBronn);
// Open
function openNewBronn() {
... | true |
094ed51db3d916e616412f548c39197a16a3e778 | JavaScript | antoniosanchez9865/informatica-2-L | /clase 23/dibujo peones.js | UTF-8 | 1,124 | 3.46875 | 3 | [] | no_license | let canvas = document.querySelector ("#miCanvas")
let ctx = canvas.getContext("2d")
//voy a dibujar un peon
function dibujarPeon(x,y,color){
ctx.beginPath()
//primero voy a dibujar la cabeza
ctx.strokeStyle = "black"
ctx.fillStyle = color
ctx.arc (x, y, 8, 0, 2*Math.PI)
ctx.stroke()
ctx.f... | true |
f3b6e040e6943769400cd3162d3c2a414de17d7e | JavaScript | faithletzkus/My-Portfolio-Site | /JS/scroll-features.js | UTF-8 | 1,873 | 2.890625 | 3 | [] | no_license | //animating the page to scroll down to the about section after the initial load
function scrollPage() {
//begin
var canvasHeight = $('canvas').outerHeight();
$('html, body').animate({
scrollTop: canvasHeight
}, 500);
//end
document.getElementById("body").style.overflow = "auto";
}
//creating the anima... | true |
ec9ac993f672f5e5cf3392d770f8ce2a7155b59b | JavaScript | jackjenglish/sortingvisualised | /src/algorithms/BubbleSort.js | UTF-8 | 2,380 | 2.875 | 3 | [] | no_license | import React,{Component} from 'react';
import BubbleSortAnimation from '../animations/BubbleSortAnimation.js';
import SortingSection from '../SortingSection.js';
var classNames=require('classnames');
class BubbleSort extends Component{
constructor(props){
super(props);
}
getHeader(){
return (
<div className="... | true |
c30e015e9a7ec0de6abbd6949196a0f124f3e31b | JavaScript | wangyongjie2017/js-demo | /scroll state/index.js | UTF-8 | 571 | 3 | 3 | [] | no_license | var timer = null;
var start = true;
var oldTop, newTop;
var debug = true;
oldTop = newTop = $(window).scrollTop();
var track = function() {
if (start) {
// start
debug && console.log('start');
start = false;
}
if (timer) {
clearTimeout(timer);
}
newTop = $(window).scrollTop();
// scrollin... | true |
91379379952acee02866b5bd8d973b02b6ec7a63 | JavaScript | amardeep0070/singh-amardeep-webdev | /assignment/services/website.service.server.js | UTF-8 | 4,009 | 2.65625 | 3 | [] | no_license | /**
* Created by Amardeep on 03/11/16.
*/
module.exports = function(app,model){
var websites = [
{ "_id": "123", "name": "Facebook", "developerId": "456" , "description" : "facebook bro"},
{ "_id": "234", "name": "Tweeter", "developerId": "456" ,"description" : "twitter bro"},
{ "_i... | true |
f07c3ea43ca52772c2ed22724b3d833e209e35dc | JavaScript | careyke/leetcode | /array/54.螺旋矩阵.js | UTF-8 | 1,464 | 3.359375 | 3 | [] | no_license | /*
* @lc app=leetcode.cn id=54 lang=javascript
*
* [54] 螺旋矩阵
* 不变量原则,左闭右开
*/
// @lc code=start
/**
* @param {number[][]} matrix
* @return {number[]}
*/
var spiralOrder = function (matrix) {
const row = matrix.length;
const col = matrix[0].length;
let rStart = 0;
let cStart = 0;
let rOffset = 1;
let... | true |
e9a073d2d741bfa63bd4e32122e8fd8729aadc9e | JavaScript | TScorpz/lesson8 | /js/scripts.js | UTF-8 | 5,268 | 2.65625 | 3 | [] | no_license | $(document).ready(function() {
var products = [];
var cart = JSON.parse(localStorage.getItem("cart"));
if(cart === null) {
cart = [];
}
updateShoppingCart();
//Get all data from JSON file and put it in "products" array and display it in 'details' view
$.getJSON("products.json",
function(data) {
... | true |
c4500c970680a2b2de411592f2886cf1ce00d5b8 | JavaScript | javierefe/clinica-myhealth | /assets/js/index.js | UTF-8 | 945 | 3.34375 | 3 | [] | no_license |
// const btnRegister = document.querySelector("#btnRegister");
// btnRegister.addEventListener("click", (event) => {
// event.preventDefault();
// })
const nombre = document.getElementById("name")
const email = document.getElementById("email")
const cel = document.getElementById("cel")
const form = docume... | true |
34d3d901227aa9098c34ecbcdbed2e5712c95326 | JavaScript | M-Patryk/Code_Wars | /Unfinished/skip_if_too_many_occurances.js | UTF-8 | 756 | 3.9375 | 4 | [] | no_license | // Given a list list and a number N, create a new list that contains each number of lst at most N times without reordering.
// For example if N = 2, and the input is [1,2,3,1,2,1,2,3], you take [1,2,3,1,2],
// drop the next [1,2] since this would lead to 1 and 2 being in the result 3 times, and then take 3,
// which le... | true |
543b618508b0499443cb0ae29752dd65a044c32f | JavaScript | gd4Ark/vue-fa-form | /lib/utils/readFile.js | UTF-8 | 857 | 2.75 | 3 | [
"MIT"
] | permissive | /**
*
*
* @export
* @param {*} modulesFiles
* @returns {Object}
*/
export function fileListToObject(modulesFiles) {
return modulesFiles.keys().reduce((modules, modulePath) => {
// set './app.js' => 'app'
const moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, '$1')
const value = modulesFiles(module... | true |
34ebb97fafaffcddfabb33b70f0b1dad37de8f84 | JavaScript | OhmPopy/jswpf | /summer/WebContent/js/my/Rectangle.js | UTF-8 | 9,925 | 2.546875 | 3 | [] | no_license | /**
* Rectangle
*/
define(["dojo/_base/declare", "system/Type", "shapes/Shape"],
function(declare, Type, Shape){
var Rectangle = declare("Rectangle", Shape,{
constructor:function(){
}
});
Object.defineProperties(Rectangle.prototype,{
});
Object.defineProperties(Rectangle,{
... | true |
a9dd3131cd936633dde81c98aa4a7d6be73590be | JavaScript | seyhan0126/request-tracker | /backend/app/controllers/userLeave.controller.js | UTF-8 | 5,542 | 2.625 | 3 | [] | no_license | const UserLeave = require('../domain/entities/userLeave.entity');
const DeleteViewModel = require('../models/viewmodels/delete.view.model');
const UserLeaveService = require('../services/userLeave.service');
const UserLeaveRepository = require('../repository/userLeave.repository');
//Initialization
const userLeaveRepo... | true |
bd8768f3b77b388c6a8fc515019886aa7f8fae7e | JavaScript | preethis89/programming_fundamentals_005 | /lib/sugar.js | UTF-8 | 4,344 | 4.625 | 5 | [
"MIT"
] | permissive | // =============== PART 1 - Advanced Objects ================
/*
This function receives an object and returns the number
of key-value pairs (properties) in the object.
*/
function size(object) {
return Object.keys(object).length;
}
/*
This function receives an object, whose values will all be numbers, and re... | true |
171ec66344698535c0bd806647b7d3d20a10e61b | JavaScript | andreaardenti/SmartFreezer-API | /routes/freezers-su-github.js | UTF-8 | 3,350 | 2.6875 | 3 | [] | no_license | //FILE VECCHIO DI CARLO
var express = require('express');
var router = express.Router();
var freezers = [{
id: 1,
lock: true,
events: [],
purchases: []
}, {
id: 2,
lock: true,
events: [],
purchases: []
}];
var addEvent = function(freezer, req, type) {
var length = freezer.events.l... | true |
bf92e8c1f98ae9d751d7d5c4542f5aa3d3b6b0c1 | JavaScript | dominikacookies/mysql-employee-tracker | /src/utils/update/updateOptions.js | UTF-8 | 1,164 | 3.0625 | 3 | [] | no_license | const inquirer = require("inquirer");
const updateDepartment = require('./updateDepartment')
const updateRole = require('./updateRole');
const updateEmployeeRole = require('./updateEmployee')
const updateInformation = async (db) => {
const updateOptions = {
type: "list",
message: "What information would you... | true |
e79b800d2c66aef3c3f0314a015892f22516d5cc | JavaScript | lpiper01/speechsearch | /main.js | UTF-8 | 774 | 2.9375 | 3 | [] | no_license | window.SpeechRecognition = window.SpeechRecognition ||
window.webkitSpeechRecognition ||
null;
// Initialize the recognizer object
var recognizer = new SpeechRecognition();
recognizer.continuous = true;
recognizer.addEventListener('result', function(event) {
getResponse(event.results[i][0]);
});
// Starts ... | true |
18a7d1f7423e8e3b23e8a577095d4c0c80585531 | JavaScript | HugoArrondelle/CicrTensorflow | /dockerForFrontend/app/src/components/SaveButton/SaveButton.js | UTF-8 | 608 | 2.59375 | 3 | [] | no_license | import React from 'react'
import { saveAs } from 'file-saver';
export const SaveButton = () => {
const downloadTargetImg = () => {
const targetImg = document.querySelector(".targetImg");
const targetImgPath = targetImg.getAttribute('src');
const targetImgName = getTargetImgName(targetImgPa... | true |
718b2214c2404bdda537399c43307d75a7058ad9 | JavaScript | halim-boussada/OTDAV | /client/src/component/Contact.jsx | UTF-8 | 3,226 | 2.671875 | 3 | [] | no_license | import React from "react";
import axios from "axios";
class Contact extends React.Component {
constructor(props) {
super(props);
this.handleChange = this.handleChange.bind(this);
this.submit = this.submit.bind(this);
this.state = {
user: "",
number: 0,
adress: "",
message: ""... | true |
5c112fa0e65951d73b43798dd9933f11298068de | JavaScript | c19t043/study-demo | /js-demo/src/main/webapp/resource/common/js/StringUtils.js | UTF-8 | 1,055 | 3.390625 | 3 | [] | no_license | /**
* 字符串工具类
*/
var StringUtils = function () {
};
StringUtils.undefinedStr = 'undefined';
StringUtils.nullStr = 'null';
/**
* 转换undefined,null为有效字符空串''
* @param {String}str
*/
StringUtils.transformUndefinedAndNull2EmptyString = function (str) {
if (str === this.undefinedStr ||
str === undefined ||
... | true |
13abffb7c6483646e68bf5446786f1f43f7cb484 | JavaScript | open-policy-agent/npm-opa-wasm | /test/opa-stringified-support.test.js | UTF-8 | 3,699 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | const { readFileSync } = require("fs");
const { execFileSync } = require("child_process");
const { loadPolicy } = require("../src/opa.js");
const util = require("util");
describe("stringified data/input support", () => {
const fixturesFolder = "test/fixtures/stringified-support";
const dataRaw = readFileSync(
... | true |
2873364cd1d2a7de0b20f1ac259509cbc718aede | JavaScript | EricGlover/assignment_js_sprint | /checker.js | UTF-8 | 19,934 | 3.375 | 3 | [] | no_license | //Checkers
//Objects: Game, Checker, and Board
//Game: deals with inputs, keeps track of stats, and deals with outputs
//Checker: deals with moving itself, checking legality of moves
//Board: keeps track of the locations of the pieces, handles printing out the board state
//input : [move or jump] [coordinate... | true |
899c9f3c4ab401846f6deec097b1eadfa0b83dc3 | JavaScript | madeinchina129/vueMobile | /Phone/src/axios/axios.js | UTF-8 | 1,917 | 2.546875 | 3 | [] | no_license |
// let data = require("./goods.json");
//
// console.log(data);
//
// module.exports={
// data:data
// }
//------------------------------
// let datas = "http://localhost:3000/GoodsNameApi";
// var fn = function (cb) {
// fetch(datas).then(response=>{
// response.json().then(data1=>{
// cb(data1);
//... | true |
11d2e58a25e8eb3ff8e1a6094845644d41f8b32d | JavaScript | saeidp/FullStack | /React-test/react-use-state-x/src/useStateArrayExample.js | UTF-8 | 566 | 2.75 | 3 | [] | no_license | import React from "react";
import { useStateArray } from "react-use-state-x";
const useStateArrayExample = () => {
// there are other actions available in addition to push and remove
const [array, { push, remove }] = useStateArray([1, 2]);
return (
<div>
{array.map((elem, index) => (
<span>
... | true |
02363a647acc4b89b6e34d6445d9c9ddcaea5e18 | JavaScript | 795085/APCSPrinciples795085 | /halloween lab snake game/button.js | UTF-8 | 503 | 3.5625 | 4 | [] | no_license | //button class declared
class Button{
constructor(x,y, w, h, str,clr){
this.loc = createVector(x,y);
this.w = w;
this.h = h;
this.msg = str;
this.clr = clr;
}
//render function defined for the button
run(){
this.render();
}
render(){
fill(134, 0, 210);
rect(this.loc.x, ... | true |
e16f950810fc225c329087056e1e6dc5714ee82b | JavaScript | stoker88/assettv-prototype | /vendor/components/supersearch.js | UTF-8 | 7,633 | 2.515625 | 3 | [] | no_license | var substringMatcher = function (strs) {
return function findMatches(q, cb) {
var matches, substringRegex;
// an array that will be populated with substring matches
matches = [];
// regex used to determine if a string contains the substring `q`
substrRegex = new RegExp(q, '... | true |
226b55569e4f1d7121860f608d13d41980eb2bcf | JavaScript | ashutosh4336/node-convert-array-to-csv | /test/modules/convert-array-of-arrays-to-csv.spec.js | UTF-8 | 4,300 | 2.65625 | 3 | [
"MIT"
] | permissive | import { convertArrayOfArraysToCSV } from '../../src/modules/convert-array-of-arrays-to-csv';
import {
dataArrayWithHeader,
dataArrayWithoutHeader,
dataArrayWithHeaderAndNullAndUndefined,
dataArrayWithHeaderWithBooleans,
dataArrayWithHeaderAndZero,
dataArrayWithDoubleQuotesInsideElement,
dataArrayWithHea... | true |
2be41d30c69ef8823d60cabd9166a66cc9ce7118 | JavaScript | xiayutian3/vue-jest-demo | /src/util.js | UTF-8 | 353 | 3.453125 | 3 | [] | no_license | export function add (x, y) {
// 数字是字符串,能不能转换成纯数字
// x = toNumber(x)
// y = toNumber(y)
if (x == parseInt(x)) {
x = Number(x)
}
if (y == parseInt(y)) {
y = Number(y)
}
return x + y
}
// function toNumber (x) {
// if (Number(x) === parseInt(x)) {
// x = Number(x)
// return x
// }
// }... | true |
223a392716a203b06a1176e19ea17551b5bded6a | JavaScript | DemonCloud/cubec | /src/utils/struct/props/get.js | UTF-8 | 513 | 2.84375 | 3 | [
"MIT"
] | permissive | import isPrim from '../type/isPrim';
import toString from '../tools/toString';
export default function get(obj,prop){
let tmp,i,check;
const keygen = toString(prop||'').split('.');
const l = keygen.length - 1;
if(keygen.length === 1){
if(obj.hasOwnProperty(prop))
tmp = obj[prop];
}else{
// [a.... | true |
9de0b380cf49466609335593b820dc42b6e10ef3 | JavaScript | RLacer/04-Web-API-CODE-QUIZ | /assets/script.js | UTF-8 | 2,822 | 3 | 3 | [] | no_license | var startBtnEl = document.getElementById("start");
var startScreenEl = document.getElementById("startscreen");
var questionsEl = document.getElementById("questions");
var timerId;
var time = questions.length * 15;
var timerEl = document.getElementById("time");
var quesIndex = 0;
var choicesEl = document.getElementById(... | true |
87c44e63997af988efa8831fd8bbeab45b8bb8d0 | JavaScript | bavulapati/npm-exports | /src/index.js | UTF-8 | 530 | 2.78125 | 3 | [
"MIT"
] | permissive | import module1 from "sample/module1";
import _ from "lodash";
import module2 from "sample/module2";
console.log("requiring both module1 and module 2", { module1, module2 });
function component() {
const element = document.createElement('div');
// Lodash, currently included via a script, is required for this ... | true |
1d5f76993bfc745eaeec2d6d3b4d0a2f94f77c25 | JavaScript | V4LLA/Listas-enlazadas | /inventario.js | UTF-8 | 1,345 | 2.765625 | 3 | [] | no_license | class Inventario{
constructor(){
this.inicio= null;
}
agregar(nuevo){
if(this.inicio=== null)
this.inicio= nuevo;
else
this.agregate(nuevo,this.inicio)
}
agregate(nuevo,ultimo){
if(ultimo.siguiente== null)
ulti... | true |
6b7080980d3c45c83d4c82da1aaaf9d9deb5e3dc | JavaScript | Quarazy/planar | /lib/game.js | UTF-8 | 3,659 | 2.765625 | 3 | [] | no_license | var App = App || {};
var points = 0;
// Character variables
var sphereSize = 1.0;
var radius = Math.cbrt(sphereSize * 3/4 / Math.PI);
var speed = 0.1;
var characterGeometry = new THREE.SphereGeometry(1, 32, 32);
var characterMaterial = new THREE.MeshBasicMaterial({color: 0x825900});
var clock = new THREE.Clock();
/... | true |
e4f2eff61128f889fd7d514b7fac22001808c4ba | JavaScript | royalbhati/DatingApp | /validator/register.js | UTF-8 | 1,251 | 2.859375 | 3 | [] | no_license | const validator = require("validator");
const isEmpty = require("./isEmpty");
const isAgeLess = age => {
if (age <= 18) {
return true;
} else {
return false;
}
};
module.exports = function validateRegisterInput(data) {
console.log("bodyyyy", data);
let errors = {};
data.email = !isEmpty(data.email) ... | true |