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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
a8a9de3749c4a6cd8da9a1a0e4243d07f9f8684b | JavaScript | kelthzuard/frontEnd-summary | /实现/promise/async.js | UTF-8 | 1,521 | 3.828125 | 4 | [] | no_license | function getPro(n) {
console.log(n)
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve(n+1)
}, 1000);
})
}
function func(n) {
console.log(n)
return n + 1
}
function *asy(n) {
n = yield getPro(n)
n = yield getPro(n)
n = yield func(n)
n = ... | true |
d10fe826640516c66be9ed9c648eb0a3a754b304 | JavaScript | sergeysenkovenko/react-store | /src/reducers/cart-list.js | UTF-8 | 1,955 | 2.953125 | 3 | [] | no_license | const updateCartItems = (cart, item, index) => {
if(item.count === 0){
return [
...cart.slice(0, index),
...cart.slice(index + 1)
]
}
if(index === -1){
return [
...cart,
item
]
}
return [
...cart.slice(0, index... | true |
9b5d9597ec8de6cd6f7e7249b6121b044e8fc44a | JavaScript | AAI-USZ/FixJS | /input/100+/after/4ae12e74ebc0309b8f9fb33e2d0fda6cf3603938_0_2.js | UTF-8 | 1,522 | 2.796875 | 3 | [
"MIT"
] | permissive | function detectCollision(){
if(pongBall.x+pongBall.width >= canvas.width || pongBall.x <= 0){
pongBall.vx *= -1;
}
if(pongBall.y <= rows*bricks[0].height){
for(var i = 0; i < bricks.length; i++){
if(pongBall.y <= bricks[i].y+bricks[i].height){
if(pongBall.x >= bricks[i].x && pongBall.x <= bricks[i]... | true |
5e2c220444488d0e8b5767803aa9f6ad267b3c49 | JavaScript | JohnTran9717/eventManager | /Event Manager/eventmanager.js | UTF-8 | 461 | 3.46875 | 3 | [] | no_license | let addButton = document.querySelector('#add');
let removeButton= document.querySelector('#remove');
let output= document.querySelector('h1');
function handleEvent(e){
output.innerText = `X: ${e.pageX} Y:${e.pageY} `;
};
addButton.addEventListener('click', function(){
document.addEventListener('mousemov... | true |
7653d1b5a138ccfccbd13fa4f8a47df84dd23bf9 | JavaScript | SHUNDAN/music-drops | /routes/feeling.js | UTF-8 | 1,590 | 2.6875 | 3 | [] | no_license | "use strict";
/*
* Feeling.
*/
var appUtil = require('../util/utility');
var feelingModel = require('../models/feeling');
/**
* Select
*/
exports.select = function(req, res){
console.log('select feelings: ', req.query);
// 今のところ件数が少ないので全件返す
feelingModel.selectObjects({}, function (err, rows) {
... | true |
b7865be9f23f7087b8a2c5df69dac8b65be9ad0e | JavaScript | bopopescu/TAstuff | /algorithms/bst.js | UTF-8 | 1,279 | 3.453125 | 3 | [] | no_license | // for binary search tree algorithms
// find/contains, add, height
// define basic bst structure
// node based
function bstNode(val){
this.value = val;
this.left = null;
this.right = null;
}
function bst(){
this.root = null;
this.add = add;
this.height = height;
this.contains = contains;
}
// contains
fun... | true |
45a74b5bdc729ef33f2215d9c30d4b401564c6cd | JavaScript | INoobSaibot/Ios-UI-clone_2-WebPacked | /iOS-main-menu-clone/src/components/message-center/cursor.js | UTF-8 | 1,078 | 2.59375 | 3 | [] | no_license | import './cursor.css';
class TextCursor extends HTMLElement {
static get observedAttributes() {
return['move']
}
constructor() {
super();
this.start_offset = 150;
this.ref = $(this)
}
connectedCallback() {
this.render()
this.afterRender()
}
... | true |
e83dfda167a56e9003a475d8584975c254479e58 | JavaScript | peterpereira1/https-github.com-samuelgrigolato-material-pos-desenvolvimento-web-nodejs | /exemplos/02_logs/app.js | UTF-8 | 429 | 2.53125 | 3 | [] | no_license | import express from 'express';
const app = express();
app.use((req, res, next) => {
res.on("finish", () => {
const date = new Date();
date.toISOString();
console.log(`${date.toISOString()} [${req.method}] ${req.path} ${res.statusCode}`);
});
next();
});
app.get('/usuario', (_req, res) => {
setTim... | true |
780f3b63111473edf90fcb5a3829daaee092d892 | JavaScript | dpjanes/iotdb-query | /test/parse.js | UTF-8 | 3,251 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | /**
* test/parse.js
*
* David Janes
* IOTDB
* 2018-09-10
*
* Copyright (2013-2020) David P. Janes
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apach... | true |
8a33ca368e5f93c79d67d4d73b54d1c6cdad8d76 | JavaScript | felipe-araujo/edx-paradigms-of-computer-programming | /power.js | UTF-8 | 674 | 3.625 | 4 | [] | no_license | test = require('tape')
/*
This is a tail recursive implementation of x^n.
The invariant used is:
x^n = y^i * a
*/
let power = (x, n) => {
function powerLoop(y, i, a){
if(i == 0) return a
else if(i%2 == 0) return powerLoop(y*y, i/2, a)
else return powerLoop(y, i-1, y*a)
}
return powerLoop(x, n, 1)... | true |
8fe946d8a0bf9bd738d7a75f92910686e9e0bebe | JavaScript | bipbopme/search | /components/stats.js | UTF-8 | 363 | 2.671875 | 3 | [
"MIT"
] | permissive | function format(number) {
return number.toLocaleString(undefined, {
maximumFractionDigits: 3
});
}
export default function Stats({ stats, query }) {
return (
<div className="stats" title={`${format(stats.totalTime / 1000)} seconds`}>
About {stats.totalEstimatedMatches.toLocaleString()} results for ... | true |
e66938225d13a1d8d2a08ea0b334b733d91fcb75 | JavaScript | junioralcant/desafio-deixa-no-azul | /src/pages/SignUp/index.js | UTF-8 | 3,523 | 2.59375 | 3 | [] | no_license | import React, { useState } from "react";
import {
Text,
ActivityIndicator,
ScrollView,
TouchableOpacity,
} from "react-native";
import { Feather } from "@expo/vector-icons";
import api from "../../services/api";
import {
Container,
BoxInput,
Input,
Title,
BoxTitle,
BoxButton,
Button,
TextButto... | true |
67ee6b371c6b204d8421ebdd236bfa71ce9a65e3 | JavaScript | Mihail-tech/first-js | /index.js | UTF-8 | 2,013 | 3.953125 | 4 | [] | no_license | const arr = [`1 задача`]
console.log(arr)
const str = "привет"
console.log(typeof str)
const num = 123
console.log(typeof num )
const flag = true
console.log(typeof flag)
const txt = "true"
console.log(typeof txt)
const arr1 = [`2 задача`]
console.log(arr1)
let a1 = 5 + 3
let a2 = 5 - 3
let a3 = 5 * 3
let a4 = 5 / 3... | true |
42dcecead95b032ceeaaa7b32465e1dbd85aebe9 | JavaScript | noumanch/TGIF | /script/main.js | UTF-8 | 2,487 | 2.859375 | 3 | [] | no_license | var statistics = {
"Democrats": [],
"Republicans": [],
"Independents": [],
"name": "",
"novotemissed": "",
"pervotemissed": ""
}
function callingAllFunction() {
createTable();
// membersInEachParty()
}
callingAllFunction()
function createTable() {
let membersData = data.results[0].members;
for (i... | true |
6cafbbaa49a76a68b0315708c12c11cec1ac65ae | JavaScript | logan-oss/ProgWebClient | /td2/Exercice2/script.js | UTF-8 | 5,525 | 3.578125 | 4 | [] | no_license | let tableRes;
let n = 0;
let j1=prompt("Bienvenue au jeux du Morpion.\nEntrer le nom du premier joueur :");
let j2=prompt("Entrer le nom du deuxième joueur :");
let errorMsg1 = "Impossible, c'est case est déjà jouée !";
let errorMsg2 = "La taille n'a pas été choisie !";
let size ="";
let mode = "";
let winner = "";
l... | true |
7e337d7c8c258fe26208de5efba25b1c39296105 | JavaScript | jjlljj/movie-tracker | /src/helper.js | UTF-8 | 3,435 | 2.5625 | 3 | [] | no_license | import key from './api/key.js';
export const initialFetch = async() => {
try {
const url = `https://api.themoviedb.org/3/movie/now_playing?api_key=${key}`;
const initialFetch = await fetch(url);
if (initialFetch.status > 200) {
throw new Error('could not fetch movies');
} else {
return aw... | true |
156ebd3c48aaec5eea75d821d4cadf045768eee2 | JavaScript | oumiga1314/react-demo-props | /src/index.js | UTF-8 | 1,601 | 2.75 | 3 | [] | no_license | import React, { Component } from 'react';
import ReactDOM from 'react-dom';
export default class Test extends Component{
constructor(props){
super(props)
console.log("this.props====",this.props)
this.state = {
department: '',
input: ''
}
}
componentDidMount(){
const {dept} = ... | true |
3c1b4f89fe61dec48773c28e2a908cab9d93adfe | JavaScript | mdziadkowiec95/buy-a-flat | /src/js/models/Search.js | UTF-8 | 2,371 | 3.0625 | 3 | [] | no_license | import '@babel/polyfill';
export default class Search {
constructor(filters) {
this.filters = filters;
}
async getFlats(investment) {
const name = investment.replace(' ', '').toLowerCase();
try {
const res = await fetch(`/${name}.json`);
const data = await res.json();
this.flats ... | true |
57de29cd0a089acd1044fc1066b42f2e35639f45 | JavaScript | Erfolg-13/JS-HomeWorks | /js/script32.js | UTF-8 | 3,048 | 2.96875 | 3 | [] | no_license | console.log('Lesson32');
const form = document.querySelector('.form');
const result = document.querySelector('#result');
const consoleContainer = document.querySelector('.console');
const showFavourite = document.createElement('button');
showFavourite.className = "showFavBTN";
showFavourite.textContent = "Show the fa... | true |
daa4f3a9bc4c56a22e9e71c411404b9188891dd6 | JavaScript | shubhamm07/htmlcss | /module4-solution/SpeakHello.js | UTF-8 | 126 | 2.953125 | 3 | [] | no_license |
var helloSpeaker = {
speakWord: "hello",
speak: function(name){
console.log(helloSpeaker.speakWord + " " + name);
}
};
| true |
dc0f14605773e1879c48155050f31f0c099243b0 | JavaScript | mitraws/Developer-Resources-Explorer | /src/store/developers/selectors.js | UTF-8 | 769 | 2.796875 | 3 | [] | no_license | // src/store/developers/selectors.js
// function average(numbers) {
// return numbers.reduce((a, b) => a + b, 0) / numbers.length;
// )}
export const selectDevelopers = state => {
return state.developers;
};
export const selectDevelopersWithThisFavorite = favoriteResource => state => {
return... | true |
90a2d34601fe250d8998a39b7425b02e95a48301 | JavaScript | tienpham94/tfidf-nodejs | /app.js | UTF-8 | 1,361 | 2.828125 | 3 | [] | no_license | var express = require("express")
var app = express()
var bodyParser = require("body-parser")
var mongoose = require("mongoose")
var WordSchema = require("./Word.model")
var natural = require('natural');
var TfIdf = natural.TfIdf;
var tfidf = new TfIdf();
var string1 = 'this document is about node.'
tfidf.addDocument... | true |
566daa374477bd170a04907ec80d5a3bf26cdb2e | JavaScript | derren-korean/react-RESTful-spring-lotto | /src/main/js/lotto/Lotto.js | UTF-8 | 1,507 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | import React, {Component} from "react";
import LottoNumber from "./LottoNumber";
const LOTTO_NUMBER_COUNT = 6;
class Lotto extends Component {
invalid(list) {
if (!list || list == 0) return true;
if (list.length != LOTTO_NUMBER_COUNT) return true;
if (this.hasSameNumber(list)) return true... | true |
e5ee24de71d3a1ba1d3bcf7873d0e292242711cb | JavaScript | aspdev91/Blog_Project_With_Docker | /test/blog.route.test.js | UTF-8 | 6,439 | 2.65625 | 3 | [] | no_license | const chai = require('chai')
const expect = chai.expect
const supertest = require('supertest-as-promised')
const { Blog, User, Comment } = require('../models')
const Promise = require('bluebird')
const app = require('../app')
const agent = supertest.agent(app)
describe('http requests on routes', function () {
// ... | true |
5b5f1128405c54440c21821767aa475834f9f223 | JavaScript | benmcrae5/team-roster-generator | /__tests__/Engineer.test.js | UTF-8 | 1,608 | 3.1875 | 3 | [
"WTFPL"
] | permissive | const empType = require("../lib/WorkerTypes");
engineerDude = new empType.Engineer("Jim", 1234, "Jimo@Jim.com", "EngieGitHub");
describe('Engineer Object', () => {
test("Engineer Object contains all necessary members", () => {
expect(engineerDude).toHaveProperty('name', "Jim");
expect(engineerDude... | true |
f6191933fe4a919fb49cb4bcae6b74d4a182508d | JavaScript | drLemis/Read | /js/interface.js | UTF-8 | 3,015 | 2.875 | 3 | [] | no_license | window.onload = checkboxesCheckSet(), tabSizeSet(), getPartList(), getLastNews(), marginsPercentSet(), fontPercentSet(), fontSelectSet();
function checkboxesCheckSet() {
var array = document.getElementsByName("checkbox");
array.forEach(element => {
if (getCookie(element.value) == "true")
e... | true |
a37ff108b696a1e70ddcd5d14e52caa8568d4065 | JavaScript | ArminSheng/Algorithm-Playground | /js/number-of-boomerangs.js | UTF-8 | 692 | 3.453125 | 3 | [] | no_license | /**
* @param {number[][]} points
* @return {number}
*/
var numberOfBoomerangs = function(points) {
const len = points.length;
let res = 0;
for (let i = 0; i < len; i++) {
const map = {};
const x1 = points[i][0];
const y1 = points[i][1];
for (let j = 0; j < len; j++) {
... | true |
916e9ca70cb660b976e2b4f81fd0cfe88b581606 | JavaScript | haritzmedina/MarkAndGo | /app/scripts/contentScript/Toolset.js | UTF-8 | 1,074 | 2.6875 | 3 | [] | no_license | const axios = require('axios')
const _ = require('lodash')
class Toolset {
constructor () {
this.page = chrome.extension.getURL('pages/sidebar/toolset.html')
}
init (callback) {
axios.get(this.page).then((response) => {
// Insert toolset container
this.sidebarContainer = document.querySelect... | true |
ab75ca8b127b2a7a56ac9925871bf6a736651405 | JavaScript | KenneyAisho/RockPaperScissors | /game.js | UTF-8 | 1,194 | 4.09375 | 4 | [] | no_license | const rock = 'rock';
const paper = 'paper';
const scissors = 'scissors';
let user = prompt("Choose rock, paper, or scissors");
let rng = Math.random();
//console.log(rng);
if (rng > 0 && rng < 0.34) {
rng = rock;
} else if (rng <= 0.67) {
rng = paper;
} else {
rng = scissors;
}
function rockPaperScissors(... | true |
5e709cf2952a14464fcee34870ad443ed673ec99 | JavaScript | ameyadeokule/basic-photographic-portfolio | /app/js/stories.js | UTF-8 | 603 | 2.828125 | 3 | [] | no_license | var storiesElts = Array.from(document.getElementsByClassName('story'));
var storiesErrorModal = document.getElementById("stories-error-modal");
var storiesErrorModalBtn = document.getElementById('stories-error-modal-btn');
storiesElts.map(story => {
story.addEventListener('click', e => {
storiesErrorModal.... | true |
3a7fe3ac9bcec3953549d999da7eaf9734b231ad | JavaScript | hkyudong/Collection | /js/cameraAndupload.js | UTF-8 | 8,466 | 2.8125 | 3 | [] | no_license | var pictureSource; // picture source
var destinationType; // sets the format of returned value
var args = {};
// Wait for Cordova to connect with the device
document.addEventListener("deviceready",onDeviceReady,false);
// Cordova is ready to be used!
function onDeviceReady() {
alert("deviceready");
pictureS... | true |
7bb34211ca73a4cc44c447af8d6cf606322cd20f | JavaScript | luctaru/repartin | /source/repartin-api/src/controller/ExpenseController.js | UTF-8 | 3,467 | 2.53125 | 3 | [
"MIT"
] | permissive | var model = require('../schemas/Expense.js');
module.exports = {
create: function (req, res) {
var expense = new model({
name: req.body.name,
value: req.body.value,
useId: req.body.useId,
assignedUserID: req.body.assignedUserID,
payments: req.body... | true |
32fd81995564373ebf0260ff503940c264c7a873 | JavaScript | avantcontra/coding-druid | /01-Math-Trig-Function/sine-js-react/src/Sine.js | UTF-8 | 3,059 | 3.1875 | 3 | [
"MIT"
] | permissive | import React, { useState, useEffect } from 'react';
export default function Sine() {
// Declare a new state variable
const [degree, setDegree] = useState(0);
useEffect(() => {
const id = setInterval(() => {
//If the new state is computed using the previous state, you can pass a functio... | true |
ccfa2e7a9894ad1656a56c8bb3f80e3136b7068c | JavaScript | Kyle-Roman/goItJsCourses | /src/module_1.js | UTF-8 | 2,440 | 3.734375 | 4 | [
"Unlicense"
] | permissive | // MODULE_1
// switch method (task 29)
function getShippingCost(country) {
let message;
// Change code below this line
switch (country) {
case 'China':
message = 'Shipping to China will cost 100 credits';
break;
case 'Chile':
message = 'Shipping to Chile will cost 250 credits';
... | true |
56df2f557466da65eb94f1bea3d94d52476abca4 | JavaScript | ranchoX/schema | /src/index.js | UTF-8 | 2,579 | 2.96875 | 3 | [] | no_license | import BaseType from './types/base'
import StringType from './types/string'
import NumberType from './types/number'
import ArrayType from './types/array'
import ObjectType from './types/object'
import BooleanType from './types/boolean'
const ToString=Object.prototype.toString;
const CLASSTYPEREG=/^function\s(.*)\(\)/;
... | true |
3edd29647eb3dbee620d8f75739dc19f36efba2d | JavaScript | zenlocator/geo | /lib/formatBounds.js | UTF-8 | 1,229 | 3.046875 | 3 | [
"MIT"
] | permissive |
export default function(bounds) {
const ret = {
sw: 0,
nw: 0,
ne: 0,
se: 0
};
const offsetCenter = {
lat: -90,
lng: 1
};
let sorted = [];
/* `bounds` has to be either an array, or an object */
if (this.isArray(bounds) && bounds.length >= 2) {
sorted = this.orderByDistance(offsetCenter, bounds... | true |
72b466c16b2ecd6a62ab18d97e749c177f8a50e6 | JavaScript | folk-tale/hackday | /app/avatars/start.js | UTF-8 | 1,215 | 2.578125 | 3 | [] | no_license | function getURLParameter(name) {
return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search)||[,""])[1].replace(/\+/g, '%20'))||null
}
var id = getURLParameter('id');
window.onload = function(e){
var name = document.getElementById('name');
donebutton = document.getElem... | true |
a1f43e2d41825cd05d7cc158899827ab5dc35961 | JavaScript | JonnyMarx98/React-Bootcamp | /dad-jokes-app/src/JokeBox.js | UTF-8 | 3,600 | 2.796875 | 3 | [] | no_license | import React, { Component } from 'react';
import Joke from './Joke';
import axios from 'axios';
import './JokeBox.css';
import uuid from 'uuid/v4';
class JokeBox extends Component {
static defaultProps = {
numJokesToGet: 10
}
constructor(props) {
super(props)
this.state = {
... | true |
344e745d748a0553efbd92f9e29b4deded85fe01 | JavaScript | ksemenza/social-media-experiment | /user/auth-middleware.js | UTF-8 | 729 | 2.640625 | 3 | [] | no_license | const jwt = require('jsonwebtoken');
const secret = process.env.JWT_SECRET || 'penguins live in the desert to eat cactus';
require('dotenv').config();
module.exports = (req, res, next) => {
const token = req.headers.authorization
if(token) {
jwt.verify(token, secret, (err, decodedToken) => {
... | true |
f5f90461707a9ea14ccfb25083b5388bc6962b00 | JavaScript | YH-Shen/mern-stack-app | /models/User.js | UTF-8 | 1,717 | 2.859375 | 3 | [
"MIT"
] | permissive | const mongoose = require("mongoose");
// bcrypt can be used to encrypt the passwords by hashing them.
// If the database is ever compromised, hacker are not going to
// have acess to the passwords because of encryption.
const bcrypt = require("bcrypt");
// Schema => a blue print that every document in this collect... | true |
9a3114fb5fe4891073ce1e0c438f0dd327e39bcb | JavaScript | PS-Developer/counter | /script.js | UTF-8 | 813 | 2.921875 | 3 | [] | no_license | const counter = document.getElementById('counter')
const incBtn = document.getElementById('inc')
const resBtn = document.getElementById('res')
const decBtn = document.getElementById('dec')
let cValue = 0;
incBtn.addEventListener('click', function (event) {
cValue += 1;
var audio = new... | true |
697d25818088bf45b02068dc0ebe0946756249ca | JavaScript | AlexMidjich/testing_some_js | /js/guess.js | UTF-8 | 972 | 3.6875 | 4 | [] | no_license | /*Gissa talet spel där användaren själv får väja intervall
att gissa mellan. Programmet loppar tills det att
användaren har gissat rätt. När användaren gissat rätt
skrivs det ut tillsammans med statistik för hur många
gissningar det tog.*/
var input = prompt("Skriv in ett nummer");
input = parseInt(input);
var inpu... | true |
e57e6e13fb0b7564523edcd922b2a0d88d740319 | JavaScript | oshinwanjari/comment-widget | /index.js | UTF-8 | 6,416 | 2.9375 | 3 | [] | no_license | (function () {
function Comment(userName, text, votes, commentList) {
this.userName = userName;
this.text = text;
this.votes = votes;
this.commentList = commentList;
}
Comment.prototype.like = function () {
var commentList =
JSON.parse(window.localStorage.getItem("commentList")) || [];
... | true |
64db6167e499ba510b74bfcd70f875d9d8891997 | JavaScript | RamyaSubash/romenext | /els-romenext-rev3-web-admin-portal/src/main/webapp/assets/js/els/fns/display/logical/base/old/fns-displayview.js | UTF-8 | 34,231 | 2.59375 | 3 | [] | no_license | /**
* Display View functions
* Author: Baya Benrachi
* Date: 18 April 2016
* Update: 01 June 2016
*/
var $gallery1;
var $gallery2;
//================== Initiate the Type Bar ==========================================
function initTypeBar(bar){
console.log("Initializing the type bar for display using i... | true |
0c4eca3032acf89c5051cb32d8b0e57089af8412 | JavaScript | HannaCylwik/EXAM-JS | /układy.js | UTF-8 | 5,183 | 3.703125 | 4 | [] | no_license | // --------- Aby sprawdzić, czy działa, należy zrobić następujące:
// NALEŻY TAKŻE USUNĄĆ W "ZADANIE2.JS" WSZYSTKIE "value" Z "difference.value", bo w difference są przechowywane tylko value
// 0. ZAKOMENTOWAĆ WSZYSTKO POWYŻEJ "isStrit"
// 1. Zmienić yourSet na dany układ
// 2. Zadeklarować let a na dany układ
// 3. ... | true |
230d0e06e254eb7ff9322a39b2ecb028c5dadd2a | JavaScript | ilia-fischer/dataex-api | /auth/VerifyToken.js | UTF-8 | 921 | 2.53125 | 3 | [] | no_license | var jwt = require('jsonwebtoken');
var config = require('../config');
function verifyToken(role) {
return function (req, res, next) {
var token = req.headers['x-access-token'];
if (!token)
return res.status(403).send({ auth: false, message: 'No token provided.' });
jwt.verify(to... | true |
f74204500fb082b59014c18c23cf44bd34140416 | JavaScript | inqoyasha/projectSHOP | /src/main/webapp/WEB-INF/js/checkoutinfo.js | UTF-8 | 1,115 | 2.625 | 3 | [] | no_license | function doOnClick() {
const button = document.getElementById("buttonId");
if(button.value.toLowerCase() == 'edit'){
button.value = 'save';
document.getElementById("fn").removeAttribute("readonly");
document.getElementById("ln").removeAttribute("readonly");
document.getElementByI... | true |
72e6cd1f8e73cc3a59bcafd3113239e911e703b8 | JavaScript | mirza-adnan/testing-demo | /tests/capitalize.test.js | UTF-8 | 550 | 3.25 | 3 | [] | no_license | const capitalize = require("../functions/capitalize");
test("capitalizes first letter of string", () => {
expect(capitalize("time to buy socks")).toBe("Time to buy socks");
});
test("does nothing when first char is a digit", () => {
expect(capitalize("1234 fuck you asshole")).toBe("1234 fuck you asshole");
})... | true |
dce88c9c68fa5ad1b1267c6b9efcd27fecc8892e | JavaScript | LilitYepremyan/bcHomewWorks | /HomeWork4-Loops/evenOrOdd.js | UTF-8 | 303 | 3.859375 | 4 | [] | no_license | const number = 35;
if (number % 2 === 0) {
console.log("Even");
} else {
console.log("Odd");
}
const number1 = 125;
if (number1 % 2 === 0) {
console.log("Even");
} else {
console.log("Odd");
}
const number2 = 20;
if (number2 % 2 === 0) {
console.log("Even");
} else {
console.log("Odd");
}
| true |
0317f5cfc2dad6a07b8ad0720a830eafb3212290 | JavaScript | narukaze132/zedit | /src/javascripts/Services/randomService.js | UTF-8 | 520 | 2.90625 | 3 | [
"MIT"
] | permissive | ngapp.service('randomService', function() {
let service = this,
alphanumeric = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
this.generateRandomString = function(length, chars) {
let id = '', numChars = chars.length;
for (let i = 0; i < length; i++) {
id ... | true |
b8ba325c990bafd27f285a6a121eccab2fba397f | JavaScript | josepaz20/josandro12082021 | /public/js/scriptsAsistencia.js | UTF-8 | 1,010 | 2.5625 | 3 | [
"MIT"
] | permissive | function buscarXfecha(fechaBusq) {
if (confirm("Verifique que los Cambios Realizados YA FUERON GUARDADOS. \n\nAl cambiar de fecha perdera toda la informacion que no haya sido guardada \n\n¿ Desea Continuar ?")) {
location.href = 'administracion?fechaBusq=' + fechaBusq;
}
}
function setCambio(idEmpleado... | true |
91e1b292eaa5cca9d5bdcd1a13f33cc4008d53d5 | JavaScript | keshavs759/front-end | /canvas/index.js | UTF-8 | 4,787 | 3.71875 | 4 | [] | no_license | // var canvas = document.getElementById("canvas");
// var ctx = canvas.getContext("2d");
// // for(var i=0;i<=10;i++){
// ctx.fillRect(i*10,i*10,10,100);
// ctx.fillStyle = "red"
// // }
// ctx.strokeStyle='DeepPink'
// ctx.lineWidth =4
// ctx.strokeRect(10,10,100,20)
// //Draw Line
// ctx.strokeStyle = "Turq... | true |
61ad51a8cacf279372e0ba1c2a08571f16924caa | JavaScript | cherylyli/settlersOfAsia | /server/api/imager.js | UTF-8 | 4,931 | 3.125 | 3 | [
"MIT"
] | permissive | // provides function to
// 1. download image
// 2. compress and resize image
var fs = require("fs");
var util = require('util');
var _ = require("underscore");
var lwip = require('lwip');
var request = require('request');
var crypto = require('crypto');
// contains functions we want to export
var imager = module.exp... | true |
5d5e1366cd9fe69ea97caa88fe3ccde603b3c799 | JavaScript | ceejbot/padded-semver | /index.js | UTF-8 | 1,537 | 2.796875 | 3 | [
"MIT"
] | permissive |
var semver = require('semver')
var zeros = '0000'
function pad (val) {
var num = Number(val)
if(!isNaN(num) && num >= 0)
return zeros.substring(num.toString().length) + num.toString().substring(0, 5)
return val
}
function unpad (val) {
while(val[0] === '0' && val.length > 1)
val = val.substring(1)
... | true |
43860a8c9e13785d4139f9b22a1a6b18648303e8 | JavaScript | AdrianHigginsDev/BrainPi-npm | /lib/Conduct/components/Controller.js | UTF-8 | 1,530 | 2.5625 | 3 | [
"MIT"
] | permissive | /*===========================================
Creates A Controller Scaffold File
============================================*/
module.exports = function create(className) {
const fs = require('fs'),
init = require("../../Config/Init"),
configurationFile = init.rea... | true |
f865a7760402487eb8f55a8253344e06589fd412 | JavaScript | gmimaki/book_recommend | /public/javascripts/user_follow_follower_number.js | UTF-8 | 636 | 2.6875 | 3 | [
"MIT"
] | permissive | function asyncFollowing_num(element, user_id){
var req = getXHR();
req.onreadystatechange = function(){
if(req.readyState == 4){
if(req.status == 200){
element.innerHTML = req.responseText;
}
}
}
req.open('GET', '/following_num/' + user_id, true);
req.send(null);
}
... | true |
7312883ea6fd6bc81a6759ba6406621f69efc37a | JavaScript | zacharyhokanson/PersonalPortfolio | /js/projects.js | UTF-8 | 1,759 | 3.015625 | 3 | [] | no_license | /////////////////////////////////////////////IMPORTS/////////////////////////////////////////////
import {projects} from '../assets/projecstApi.js'
////////////////////////////////////////////VARIABLES////////////////////////////////////////////
let javaProjects = document.querySelector('.javaProjects')
// let ... | true |
515cf0c0bfd2aae7a83d6544133560d51da89d39 | JavaScript | LilyChenlin/leetcode | /53.最大子序和/53.最大子序和.js | UTF-8 | 474 | 3.015625 | 3 | [] | no_license | /*
* @lc app=leetcode.cn id=53 lang=javascript
*
* [53] 最大子序和
*/
// @lc code=start
/**
* @param {number[]} nums
* @return {number}
*/
var maxSubArray = function(nums) {
let ans = nums[0];
let total = 0; // 前缀和
for (let i = 0; i < nums.length; i++) {
if (total > 0) {
total += nums... | true |
0eff7052345bc73c203b6e621952d8138a4b5193 | JavaScript | dev-allenk/todo-app-with-nextjs | /src/api/index.js | UTF-8 | 751 | 2.84375 | 3 | [] | no_license | const API_ENDPOINT = "https://jsonplaceholder.typicode.com";
const GET = "GET";
const POST = "POST";
const PUT = "PUT";
const DELETE = "DELETE";
const BODY = (value) => ({
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(value),
});
const request = async (method, URI, options) => {
... | true |
8df97905966cd5bf0f7d0d91b8deafdc4bcbc1d5 | JavaScript | Arsalan-Sadri/06_GiphyAPI | /assets/javascript/app.js | UTF-8 | 4,177 | 3 | 3 | [] | no_license | //
var topicsArr = [
"Washington DC",
"Chicago",
"Los Angeles",
"Vancouver",
"Toronto",
"London",
"Berlin",
"Budapest",
"Vienna",
"Tehran",
"Hong Kong",
"Grand Canyon",
"Paris",
"Istanbul",
"Dubai",
"Barcelona",
"The Sahara",
"Amazon Rainforest",
... | true |
70b8c08df77105acb37ea368b04901e0dc0320e4 | JavaScript | Rejaul-arim-shohag/asynchronous-javascript-core-concept | /async-await.js | UTF-8 | 204 | 2.984375 | 3 | [] | no_license | async function friendlyFunction(){
return `hello`;
}
console.log(friendlyFunction());
// function friendlyFunction(){
// return Promise.resolve `hello`;
// }
// console.log(friendlyFunction());
| true |
35bae45c922b215f117d23fe15a4c2732c90d0da | JavaScript | indralukmana/react-kalkulator | /src/App.js | UTF-8 | 2,839 | 2.75 | 3 | [] | no_license | import React from "react";
import "./App.css";
import Input from "./components/Input";
import Button from "./components/Button";
class App extends React.Component {
state = {
result: "",
value: "",
operation: ""
};
calculate = () => {
try {
this.setState({ value: eval(this.state.value) })... | true |
131310c77992cda038aad3f5fe4abdeecf1e164e | JavaScript | iuryfsilva/JavaScript | /Rocketseat/Desafios/Fluxo de Caixa familiar/scripts.js | UTF-8 | 1,283 | 4.25 | 4 | [
"MIT"
] | permissive | /* ## Sistema de gastos familiar
Crie um objeto que possuirá 2 propriedades, ambas do tipo array:
-receitas:[]
-despesas:[]
Agora, crie uma função que irá calcular o total de receitas e despesas e irá mostrar uma mensagemse a familía está com saldo positivo ou negativo, seguido do valor do saldo.
*/
le... | true |
db2a6ff0d918b95671a45aac6abe45a672632fef | JavaScript | af9593/CrazyFraud | /index.js | UTF-8 | 702 | 3 | 3 | [] | no_license | document.getElementById('profil_pic').addEventListener("mouseover" , () => alert ('HAHAHHAHA') );
document.getElementById("myBtn").addEventListener("click", function(){
var newAddress = prompt("Change Address")
var newNumber = prompt("Change Number")
var newEmail = prompt("Change Email")
if(newAdd... | true |
f2761abff14fb93126963b6cda3a5f6f26fcf56b | JavaScript | Meet57/Competitive-Practice | /Easy/1716. Calculate Money in Leetcode Bank.js | UTF-8 | 912 | 3.9375 | 4 | [] | no_license | /**
* @param {number} n
* @return {number}
*/
var totalMoney = function (n) {
if (n > 7) {
oldWeek = Math.floor(n / 7)
total = [28]
for (let i = 1; i < oldWeek; i++) {
total.push(total[i-1]+7)
}
if(n%7){
total.push(++oldWeek)
for (let i... | true |
b1332e0a53d80baafc11bdbf4d06654a6de1b188 | JavaScript | yangfeiweb/shadouxingshop | /js/kaidian.js | UTF-8 | 2,173 | 2.53125 | 3 | [
"MIT"
] | permissive | $(function(){
var abs=true;
var abs2=false;
// alert($(".sec").text());
// 条款判断
$(".rule").on("touchend",function(){
if (abs) {
$(this).find("img").attr("src","images/rule2.png");
abs=false;
}else{
$(this).find("img").attr("src","images/rule1.png");
abs=true;
}
})
// 线上线下判断
$(".tp2").on("touch... | true |
c555502d4b8d462b6bb8735adaeb821d381a1559 | JavaScript | Kamilasilv/Logica-reprograma | /exercicio5.js | UTF-8 | 189 | 3.703125 | 4 | [] | no_license | //5 - Receba do usuários 3 números e calcule a média entre eles.
let numero1 = 320
let numero2 = 330
let numero3 = 340
let media = (numero1 + numero2 + numero3) /3
console.log(media)
| true |
1484eeda7c7170ae3696326411c5ca6807d19f10 | JavaScript | davibelo/web-development-bootcamp-2021 | /06-javascript/00-curso_web_moderno/01-estruturas_de_controle/04-switch.js | UTF-8 | 855 | 4.09375 | 4 | [] | no_license | // seleção de código com switch
// (Math.floor arredonda o número para baixo)
// necessário usar break para sair do caso
// por isso, para casos com a mesma resposta
// basta colocar o case subsequenete após o primeiro
const imprimirResultado = function (nota) {
switch (Math.floor(nota)) {
case 10: case 9:... | true |
e6ed467380a97376a0d46dd91a285b0d5e27108e | JavaScript | kiwon132445/MemoryGame | /public/Courses/COMP4537/Memory_Game/Frontend/js/summary.js | UTF-8 | 3,033 | 2.875 | 3 | [] | no_license | class Summary {
constructor(score) {
document.getElementById(gameTitle).innerHTML = summaryTitle;
this.score = score;
this.gameScreen = document.getElementById(game_screen);
this.placeScore();
this.submission();
this.placeRestart();
}
placeSc... | true |
900b2ceacf07e7a15fb347711109e3667d5ffd29 | JavaScript | adrianocola/proxy | /sample_server.js | UTF-8 | 446 | 2.75 | 3 | [] | no_license | var http = require('http');
if(process.argv.length <=2 || process.argv[2] === "help" || process.argv[2] === "-h"){
return console.log("Usage: node sample_server.js <server_port>");
}
var port = parseInt(process.argv[2]);
var server = http.createServer(function(req, res) {
res.writeHead(200, {'Content-Type': ... | true |
1e77ba6c4ebe990b6590b1d716ac2a200ee899c7 | JavaScript | kylegold/quantum-light | /setup.js | UTF-8 | 6,326 | 2.625 | 3 | [] | no_license | // const v3 = require('node-hue-api').v3
// // const LightState = v3.lightStates.LightState;
// , discovery = v3.discovery
// , hueApi = v3.api
// ;
// const appName = 'node-hue-api';
// const deviceName = 'Goldish';
// async function discoverBridge() {
// const discoveryResults = await discovery.nupnpSearch(... | true |
8450070bc1e8fe6fdc055e4fa6d4667cde555aca | JavaScript | team-granite/HNGi7-First-Task | /scripts/LOYE.js | UTF-8 | 243 | 3.046875 | 3 | [] | no_license | const name = 'Abisoye Akinloye';
const id = 'HNG-02078';
const lang = 'Javascript';
const email = 'abisoyeakinloye@gmail.com'
let result = `Hello World, this is ${name} with HNGi7 ID ${id} using ${lang} for stage 2 task and my email is ${email}`;
console.log(result) | true |
50d91f7368fd65d20f74f37e6c220fa30e212dc4 | JavaScript | RohitSingh1009/WebDesignAssignment | /Assignments/assignment-9-RohitSingh1009/todoapp/src/components/App.js | UTF-8 | 1,316 | 2.671875 | 3 | [] | no_license | import React from 'react';
import './App.scss';
import Forminput from './Form-element/Forminput';
import TodoList from './Todo-list/Todo-list';
import Detailedview from './Detailed-view/Detailedview'
//This is the parent component
class App extends React.Component {
constructor(props){
super(props);
this... | true |
d225952d18f7d9fcccf9e2ebf8b9826c2466acf0 | JavaScript | bringmetheaxx/asynchronous-programming | /node/file-system/2-fs-callbacks/exercises-tests/exercise-6.js | UTF-8 | 1,082 | 3.171875 | 3 | [
"MIT"
] | permissive | 'use strict';
debugger;
/* helpful examples
refactor-sync-to-async.js
sync-vs-async.js
read-text.js
copy.js
*/
// require built-in dependencies
const assert = require('assert');
const fs = require('fs');
const path = require('path');
// require local dependencies
const labeledLogger = require('../../labeled-l... | true |
166a001fcff1f7eb99715a5be84aa76d6908a1bc | JavaScript | liguohua-bigdata/ECMAScript2015-learn | /src/test003-字符串的扩展/字符的Unicode表示法001.js | UTF-8 | 1,572 | 3.71875 | 4 | [] | no_license | /**
* Created by liguohua on 16/10/10.
*/
/**
*JavaScript允许采用\uxxxx形式表示一个字符,其中“xxxx”表示字符的码点。
*/
console.log("**************001");
{
console.info("\u0061");// "a"
}
/**
*这种表示法只限于\u0000——\uFFFF之间的字符。超出这个范围的字符,必须用两个双字节的形式表达。
*/
console.log("**************002");
{
console.info("\uD842\uDFB7");// "𠮷"
//如果... | true |
55013948d232e6bb6042d5e92477fe4d5445c2d6 | JavaScript | benartw86/bloc-jams-angular | /app/scripts/controllers/AlbumCtrl.js | UTF-8 | 783 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | (function () {
function AlbumCtrl(Fixtures, SongPlayer) {
this.albumData = Fixtures.getAlbum();
this.songPlayer = SongPlayer;
}
angular
.module('blocJams')
.controller('AlbumCtrl', ['Fixtures', 'SongPlayer', AlbumCtrl]);
})();
/*(function() {
function AlbumCtrl() ... | true |
d41c1d939b855c0dc47af827104b5d94d8f4c335 | JavaScript | vikginger/todo-react | /src/components/TodoForm/TodoForm.js | UTF-8 | 1,230 | 2.75 | 3 | [] | no_license | import React, { useState } from "react";
import styles from "./TodoForm.module.scss";
function TodoForm(props) {
const [input, setInput] = useState('');
const [isChecked, setChecked] = useState(false);
const addItem = () => {
if (input) {
props.addTask(input);
setInput('');
};
};
cons... | true |
e92cea6bc5bc28aa455faf86f9d175bfd7ff0f0f | JavaScript | caloudinou/testIntegration | /app/components/paralax/paralax.js | UTF-8 | 1,579 | 2.703125 | 3 | [] | no_license | /**
* Created by grizzly on 07/12/2016.
*/
//ES5
var Parralax = (function(){
var parralax={
elements:[],
pollyfilRequestAnimationFrame : function(){
window.requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || ... | true |
f1cf31fc4f818dd2fb1574d0df91561638c8ba94 | JavaScript | Alicepeach/Curso-Web | /Segunda Semana/Martes/Ejercicios/JavaScript/js/app.js | UTF-8 | 1,101 | 3.21875 | 3 | [] | no_license | var miElementoDOM = document.getElementById("miParrafo");
document.getElementById("insertando").innerHTML = "Vamos a agregar contenido de p aqui" + miElementoDOM.innerHTM;
var arregloP = document.getElementsByTagName("p");
alert("Mensaje de alerta" + arregloP.length + "<p> elelementos de este documento");
document.get... | true |
fb5c1001f89c85ae95a6889099d9c7772879cd35 | JavaScript | symsulei520/Management-Demo | /src/api/request.js | UTF-8 | 1,703 | 2.796875 | 3 | [] | no_license | // import Axios from 'axios';
// 暴露开发环境
// export const baseURL = "http://192.168.0.101:8088";
// 暴露生产环境
// export const baseURL = 'http://it.warmtel.com';
// 自动判断是开发环境还是生产环境
// 执行npm run build使用生产环境地址http://it.warmtel.com;执行npm run serve使用开发环境地址http://192.168.0.101:8088
export const baseURL = process.env.NODE_ENV ==... | true |
9137df320b49ebc21041db4120d0053851b6489a | JavaScript | winn92/backend-examen | /public/app.js | UTF-8 | 3,796 | 2.8125 | 3 | [] | no_license | function generateItemCard(obj) {
return "<div class=\"card horizontal\">\n <div class=\"card-image\">\n <img src=\"img/home.jpg\">\n </div>\n <div class=\"card-stacked\">\n <div class=\"card-content\">\n <div>\n <b>Direccion: </b> " + obj.Direccion + "<p></p>\n </div>\n <div>\n ... | true |
b2c7651dc7db73395cdef762d74ea721b636e5af | JavaScript | NealRame/sync-srt | /srtsync.js | UTF-8 | 4,646 | 2.59375 | 3 | [] | no_license | #! /usr/bin/env node
var EventEmitter = require('events').EventEmitter;
var fs = require('fs');
var sprintf = require('sprintf').sprintf;
var util = require('util');
function time_to_str (ms) {
var sign = '';
if (ms < 0) {
sign = '-';
ms *= -1;
}
var hour = Math.floor(ms/3600000); ms -= hour*3600000;
var m... | true |
6dfae3095b66096d16e0cb6c46ee893191315dc3 | JavaScript | kbastic/TR | /Tumor_Raider/Assets/Scripts/countCell.js | UTF-8 | 813 | 2.984375 | 3 | [] | no_license | #pragma strict
//this script counts the number of cancer cells remaining in the game
//it's attached to the main camera
import UnityEngine.UI;
var cellCount: int;
var cellGroup:GameObject;
var countTxt: UnityEngine.UI.Text;
function Start () {
//count how many cancer cells are present at the beginning of the game
c... | true |
b7b8b44d1607ec830b89a12c382fbf16de6cfa0d | JavaScript | ahrobinson/expressless | /router.js | UTF-8 | 1,119 | 2.640625 | 3 | [] | no_license | const url = require('url');
const fs = require('fs');
const path = require('path');
const getMime = (ext) => {
let contentType = 'text/html';
switch (ext) {
case '.js':
contentType = 'text/javascript';
break;
case '.css':
contentType = 'text/css';
break;
ca... | true |
99048886da75723ab02853b6f5cb61c460943f36 | JavaScript | jinyounghwa/oneday | /day/jscookbook/cp3/3-4.js | UTF-8 | 675 | 3.78125 | 4 | [] | no_license | function factorial(n){
console.log(n);
return n == 1 ? 1: n * factorial(n-1);
}
function noBlock(n, callback) {
setTimeout(function(){
var val = factorial(n);
if (callback && typeof callback == 'function'){
callback(val);
}
},0);
}
console.log("Top of the morning to y... | true |
aa46ca4704f1e33f36616c764d6e76ad0d6a4ea2 | JavaScript | xfdipzone/JS-GAME | /小游戏/07.极速快跑/js/main.js | UTF-8 | 6,045 | 2.640625 | 3 | [] | no_license | /** 极速快跑
* Author: fdipzone
* Date: 2012-07-15
* Ver: 1.0
*/
var gameimg = ['images/start.png', 'images/start_over.png', 'images/go.png', 'images/go_over.png', 'images/running.gif', 'images/run_start1.gif', 'images/run_start2.gif', 'images/run_start3.gif'];
var speed_obj = new SpeedClass();
window.onload = f... | true |
6cff1e79b5c02db93726232970223cd3f1d2181e | JavaScript | Glavin001/homebridge-people-plus | /index.js | UTF-8 | 2,175 | 2.546875 | 3 | [
"MIT"
] | permissive | const { Accessory } = require('homebridge-plugin-helpers');
const { NetworkObserver } = require('./network');
module.exports = function (homebridge) {
PeoplePlusAccessory.register(homebridge);
};
class PeoplePlusAccessory extends Accessory {
static get pluginName() {
return "homebridge-people-plus";
}
static... | true |
3a8ad15bcf33282798ce7452cafcd1f0325575dc | JavaScript | canillas-soporte/Canillas-Front | /src/components/default-image/default-image.js | UTF-8 | 647 | 2.796875 | 3 | [] | no_license | import { LitElement, html } from 'lit-element';
class DefaultImage extends LitElement {
get properties() {
return {
text: { type: String }
}
}
constructor() {
super();
this.text = "Validar"
}
// Implement `render` to define a template for your element.
render(){
/**
... | true |
7dae9c5e46feba7766eafbb614ea3a41fc68a5fc | JavaScript | russellstrauss/Fall-2019-Labs | /lab8a/activity/main.js | UTF-8 | 2,547 | 2.609375 | 3 | [] | no_license | var svg = d3.select('svg');
var width = window.innerWidth;
var height = window.innerHeight;
var colorScale = d3.scaleSequential(d3.interpolateViridis);
var linkScale = d3.scaleSqrt().range([1,5]);
d3.json('les_miserables.json').then(function(dataset) {
network = dataset;
linkScale.domain(d3.extent(network.links, fu... | true |
db505e34264074be5b6747a140f84118f24652aa | JavaScript | BimaCarlo/NodeExpressServer | /public/JS/login.js | UTF-8 | 220 | 2.53125 | 3 | [] | no_license | window.onload = function () {
window.localStorage.setItem("jwtoken","token!");
let tokenLocalStorage = window.localStorage.getItem('jwtoken');
window.localStorage.clear()
alert(tokenLocalStorage);
} | true |
0de45452cf45d3dd10931905af5204c84ba8c738 | JavaScript | caffeinated-tech/react-chess | /client/scripts/pages/game/play/data/square.js | UTF-8 | 479 | 3.328125 | 3 | [] | no_license |
class Square {
constructor(row, column, piece = null) {
this.row = row;
this.column = column;
this.piece = piece;
this.color = ((row + column) % 2 == 0) ? 'white' : 'black';
this.validMove = false;
this.selected = false;
this.lastMove = false;
}
setPiece(piece){
piece.setPosition(... | true |
7f433e40190c04cf9f32ba8fe8497d02f6aaf818 | JavaScript | Renessance/social-network | /src/redux/users-reducer.js | UTF-8 | 3,429 | 2.515625 | 3 | [] | no_license | import {usersApi} from "../api/api";
import {upDateObjectInArray} from "../components/utils/object-helper";
const FOLLOW = true;
const UNFOLLOW = false;
const SET_USERS = 'users/SET_USERS';
const SET_CURRENT_PAGE = 'users/SET_CURRENT_PAGE';
const USERS_COUNT = 'users/USERS_COUNT';
const TOGGLE_IN_PROGRESS = 'users/TOG... | true |
b1606a7abd2b4922eb711df6b6c8901ac6e0cc1b | JavaScript | Haryoken/pokedex | /Pokedex/web/javascript/search.js | UTF-8 | 3,072 | 2.59375 | 3 | [] | no_license | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
var xmlDOM = new DOMParser();
var count = 0;
var cells = [];
var xmlHttp;
function addRow(tableId, cells) {
var table = documen... | true |
14cb94655ee3ee117e480cae5d4b704faea086d9 | JavaScript | banjocreek/node-entity-promises | /index.js | UTF-8 | 1,637 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | /*jslint node: true */
"use strict";
var u = require("underscore"),
uuid = require("uuid");
/**
* Random uuid from id module is as secure as we get right now.
*
* @returns
*/
function secureId() {
return uuid.v4().toLowerCase();
}
/**
* Introduction prepares a new enti... | true |
1738e980d79d79e19cd834c993d292b6a41ae75d | JavaScript | jamie-shearman/Project03Training | /session-demos/02-dom/04-location.js | UTF-8 | 294 | 2.765625 | 3 | [] | no_license | // info about the currently loaded page's address (URL)
console.log( location );
location.href = 'https://en.wikipedia.org';
location.reload(); // reloads current page
// these all loads the new page / current page in diferent ways
// location.assign(), location.replace(), location.reload() | true |
73ea7412fff9b35011995b3d36f0c5eb71cbe532 | JavaScript | MFahadUmer/Recipes | /src/redux/food/foodActions.js | UTF-8 | 757 | 2.546875 | 3 | [
"MIT"
] | permissive | import axios from 'axios';
import { FETCH_FOOD_FAILURE, FETCH_FOOD_REQUEST, FETCH_FOOD_SUCCESS } from './foodActionTypes';
export const fetchFoodRequest = () => ({
type: FETCH_FOOD_REQUEST,
});
export const fetchFoodSuccess = foods => ({
type: FETCH_FOOD_SUCCESS,
payload: foods,
});
export const fetchFoodFailu... | true |
3cfbac2074ce99de6027422e6c73c38c96fd7df5 | JavaScript | FabianoFaria/eficazSystemTesteQualidade | /js/configuracoes.js | UTF-8 | 4,131 | 2.578125 | 3 | [
"MIT"
] | permissive | $().ready(function() {
//Ajustes iniciais para recuperação de URL
var pathArray = window.location.href.split( '/' );
var protocol = pathArray[0];
var host = pathArray[2];
var urlP = protocol + '//' + host;
//BOTÃO DE ADIÇÃO DE USUÁRIO
$('#addUser').click(function(){
// console.log('Ok ... | true |
3b89061e79d5f1d73245384f64fdc16eacef9e25 | JavaScript | 92hackers/marked | /lib/grammars/code.js | UTF-8 | 1,672 | 2.734375 | 3 | [
"MIT",
"BSD-3-Clause",
"LicenseRef-scancode-generic-cla"
] | permissive | /**
* Markdown code grammar:
* // TODO: grammar example.
*/
import {
rtrim,
escape,
} from '../utils'
import { block, inline } from '../grammar-rules'
class Code {
constructor(marked) {
this.options = marked.options
this.tokenTypes = ['code']
this.rules = {
block: block.code,
inlin... | true |
56e84f6e64c4771337c092814d12fd3dae365d92 | JavaScript | grtfercho/node-course-2-todo-api | /playground/mongoose-queries.js | UTF-8 | 1,582 | 2.703125 | 3 | [] | no_license | const {ObjectId} = require('mongodb');
const {mongoose} = require('./../server/db/mongoose.js');
const {Todo} = require('./../server/models/todo.js');
const {User} = require('./../server/models/user.js');
var id = '5ba3079d36338c2cbabd00ac0';
if(!ObjectId.isValid(id)){
console.log('The DB ID provided is invali... | true |
d92795af984cccf5ca4deacfe40e551a6b4b4f99 | JavaScript | JodyBrzo/team-profile-generator | /__tests__/engineer.test.js | UTF-8 | 754 | 2.859375 | 3 | [
"MIT"
] | permissive | const Engineer = require('../lib/Engineer.js');
describe('Engineer', () =>{
describe ('should create a new instance of engineer', () => {
const engineer = new Engineer('Jody Brzovski', '7777', 'jodyb@email.com', 'MyGitHub');
expect(engineer.name).toBe('Jody Brzovski');
expect(engineer.id... | true |