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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
3882de5ffa496347f9dfee2e5eb16e66c7ece4cf | JavaScript | Werton-Wad/dev-inc-weatherApp-js | /src/controller.js | UTF-8 | 1,478 | 2.59375 | 3 | [] | no_license | import getWeatherAPI from './config';
import { weatherModel } from './model';
import lang from './lang';
const $errorMessage = document.querySelector('.error-message');
async function getWeather(language, city) {
$errorMessage.textContent = '';
try {
const response = await fetch(getWeatherAPI(language,... | true |
d7a86f998d2615608878cd52f8fb56c554d9cde0 | JavaScript | vizorvr/patches | /browser/scripts/ui/uiProxyCheckbox.js | UTF-8 | 888 | 2.84375 | 3 | [
"MIT"
] | permissive | var UICheckbox = function UICheckbox(obj, propertyName, domElement, onChange) {
UIAbstractProxy.apply(this, arguments)
}
UICheckbox.prototype = Object.create(UIAbstractProxy.prototype)
UICheckbox.prototype.constructor = UICheckbox
UICheckbox.prototype.getAdapter = function(obj, propertyName){
var that = this
return... | true |
d32be5ee22bae134afeec958bc308cca75997498 | JavaScript | nngocjade/cd_W5_Mon_React_Day1_Lab | /react_day1/src/App.js | UTF-8 | 3,109 | 3.109375 | 3 | [] | no_license | import "bootstrap/dist/css/bootstrap.min.css";
import "./App.css";
import "bootstrap/dist/css/bootstrap.min.css";
import { Container } from "react-bootstrap";
import { Card } from "react-bootstrap";
import { CardGroup } from "react-bootstrap";
const Message = ({ name, yearOfBirth }) => {
let age = 2021 - yearOfBirth... | true |
13f1ac939f21fc95f2e48ee16f61b4d0b365a2cf | JavaScript | MuhammadJoyHussain/BD-Kabab-Bangla | /src/Reducers/reviewReducer.js | UTF-8 | 901 | 2.578125 | 3 | [] | no_license | import { GET, ADD, DELETE, LOADING } from "../Actions/types";
const initialState = {
reviews: [],
loading: false
};
export default function(state = initialState, action) {
switch(action.type) {
case GET:
return {
...state,
reviews: action.payload,
... | true |
3c6b4665b66ed8b2846c299445b87700c30b97cc | JavaScript | arriverwei/project | /jumei/js/details.js | UTF-8 | 1,834 | 2.828125 | 3 | [
"MIT"
] | permissive | new glass()
function glass(){
this.movebox=document.getElementsByClassName('movebox')[0];
this.showimg=document.getElementsByClassName('showimg')[0];
this.imgbox=document.getElementsByClassName('imgbox')[0];
this.main=document.getElementsByClassName('main')[0];
this.clearfix=document.getElementsByClassName('clearf... | true |
1d0ea1f1a5e934c97b19701af7752e486baa579d | JavaScript | StuartChartersE22/planet_lab | /src/views/planet_detail_view.js | UTF-8 | 1,494 | 3.265625 | 3 | [] | no_license | const PubSub = require('../helpers/pub_sub.js');
const PlanetDetailView = function (container) {
this.container = container;
};
PlanetDetailView.prototype.bindEvents = function(){
PubSub.subscribe(`SolarSystem:selected-planet`, (evt) => {
const planet = evt.detail;
this.render(planet);
});
PlanetDeta... | true |
5941009b3b89e524763f5cebec9d1dd2a9408014 | JavaScript | djimenezc/loading-jquery | /loading.js | UTF-8 | 784 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | /**
* Show a Loading Layer in a specific node identify by the element
* with id {id}
*
* @param displayFlag if true display the loading mask, hide it if it is false
* @param id identify the dom element which the mask will be overlapped
*/
const loading = function (displayFlag, id) {
let _where = 'body';
if (i... | true |
d945a831d38bdbb3b5dd13964dc4059bacbf762d | JavaScript | qweasd147/StudyNote | /javascript/prototype/inheritance2.js | UTF-8 | 790 | 3.796875 | 4 | [] | no_license | var inherit = (function(parent, child){
var F = function(){};
return function(parent, child){
F.prototype = parent.prototype;
child.prototype = new F();
child.prototype.constructor = child;
child.super = parent.prototype;
}
})();
function Foo(name){
this.name = name;
}
... | true |
245cabd954dfc7e343c20821f5bd0040903dfeb2 | JavaScript | lucastravagin/web-moderna | /fundamentos/object.js | UTF-8 | 726 | 4.1875 | 4 | [] | no_license | //O objeto em Javascript é uma coleção de chave e valor.
//Declaração de um objeto em Javascript.
const prod1 = {} //Um par de chaves é uma forma litereal de escrever um objeto.
prod1.nome = 'Celular'; // Nome criado dinamicamente dentro de um objeto.
prod1.preco = '2222.90';
prod1['desconto legal'] = 0.40; //Evitar ... | true |
3f15862c93c4f91db96de007004179d69a485507 | JavaScript | Anthonyme0328/FriendFinderAME | /app/routing/apiRoutes.js | UTF-8 | 1,945 | 3.296875 | 3 | [] | no_license |
// imports the friend file to use the array
var listOFriends = require("../data/friends.js");
// Function to export GET and POST to the server file
module.exports = function (app) {
// GET the info from /api/friends path and returns it in JSON format
app.get("/api/friends", function (req, res) {
r... | true |
201ed59e141ace6953a45ae6e7f55d29bcc95efb | JavaScript | SumiSastri/websockets-chat-app | /nodeJS-app/server-side/data-models/messageModel.js | UTF-8 | 550 | 2.546875 | 3 | [] | no_license | const mongoose = require("mongoose");
const Schema = mongoose.Schema;
// const apiMessages = [
// { name: "Zee", message: "Hi gang" },
// { name: "Paraic", message: "Hey whatsup" },
// ];
// Model takes out hard coded array from server and puts it into a schema
const MessageModel = new Schema({
name: {
ty... | true |
8022b674ca4719537a2b101004da67ad19657456 | JavaScript | saneeshkumar/node-bot-line | /index.js | UTF-8 | 3,863 | 2.796875 | 3 | [] | no_license | const express = require("express");
const line = require("@line/bot-sdk");
const line_config = {
channelAccessToken: process.env.LINE_ACCESS_TOKEN,
channelSecret: process.env.LINE_CHANNEL_SECRET
};
const PORT = process.env.PORT || 3000;
const app = express();
app.listen(PORT, function () {
console.log(`l... | true |
62b1d1f9f351d7a6fed0b6208b233964e766dc50 | JavaScript | shwethanayak-lang/phase2level3 | /calll.js | UTF-8 | 418 | 3.203125 | 3 | [] | no_license | //function for clear button
$("#clear").on("click", function () {
$("#screen").val(" ");
});
// function for equal
$("#equal").on("click", function () {
$("#screen").val(eval($("#screen").val()));
});
// function for delete button
var del = () => {
value = $("#screen").val();
$("#screen").val(value.substring(0... | true |
d2d411e8911623d85b3ffd1077a05c938dbca908 | JavaScript | yung-Twist/MVVM | /Watcher.js | UTF-8 | 778 | 2.71875 | 3 | [] | no_license | import { Dep } from './Dep.js'
// 监听函数
// 通过Watcher这个类创建的实例,都拥有update方法
function Watcher (vm, exp, fn) {
this.fn = fn // 将fn放到实例上
this.vm = vm
this.exp = exp
// 添加一个事件
// 这里我们先定义一个属性
Dep.target = this
let arr = exp.split('.')
let val = vm
arr.forEach(key => { // 取值
val =... | true |
aaa4c1192bbd74f5a36220e1711718fbd7b527e8 | JavaScript | SwethaLakshme/gml | /index.js | UTF-8 | 3,266 | 2.65625 | 3 | [] | no_license | var csv_export = require('csv-export');
var fs = require('fs');
const Command = require('command');
let members = {};
const fieldNamesArray = ['name', 'playerID', 'rank', 'level', 'contributionCurrent', 'contributionTotal', 'note'];
module.exports = function GuildMembers(dispatch) {
const command = Command(dispatch... | true |
5aed668817d9c0187fc17d3f7c97203261596129 | JavaScript | Novanet-Studio/misc | /criptograma/word.js | UTF-8 | 1,977 | 3.4375 | 3 | [] | no_license | const phrase = 'dinos con cual dios de la mitologia relacionas a Novanet y por que'
const regExpr = /[a-z]/gi
/* -------------------- Main Class -------------------- */
class Word {
constructor() {
this.phrase = phrase
this.total = this.phrase.match(regExpr)
}
input(el) {
const itemId = el.dataset... | true |
6bba80f91fb00ad38476d58cc182c905ef3dd245 | JavaScript | woodgear/switch-window | /preload.js | UTF-8 | 2,142 | 2.65625 | 3 | [] | no_license | const exec = require('child_process').exec;
async function cmd(cmd) {
return new Promise((resolve, reject) => {
exec(cmd, (error, stdout, stderr) => {
if (error) {
reject(error)
}
resolve(stdout ? stdout : stderr);
});
});
}
function takeCapt... | true |
bced68286fa1e823bf5a8a0d74c3f0de1ffefd04 | JavaScript | balu-/aSync | /classFiles/settings.js | UTF-8 | 1,852 | 3.28125 | 3 | [] | no_license | /*settings.js*/
class collectionClass{
constructor(){
this.name ="";
this.enabledSync = false;
this.lastUpdate = 0;
}
}
class settingsClass{
constructor() {
this.host = "";
this.user = "";
this.pw = "";
this.collections = {};
}
loadSettings(){
var sT = this; //variable to ... | true |
ffe4be9602d2ce6206ca5f1392f1e95105912a89 | JavaScript | kawasyu/eco-friendly-platform | /controllers/loginAdmin.js | UTF-8 | 1,420 | 2.53125 | 3 | [] | no_license | // dependências:
const express = require('express');
const adminSchema = require('../schemas/schAdmin');
const passwordHash = require('password-hash');
const jwt = require('jsonwebtoken');
let router = express.Router()
const segredo = process.env.appEco_secret;
//console.log('>> o segredo é: ' + segredo);
router.post... | true |
bcf7511e403b273df9c57a205168598bdcf8a3b1 | JavaScript | cpan001/react-forms-lab-web-082817 | /src/components/PoemWriter.js | UTF-8 | 1,185 | 2.984375 | 3 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import React from "react";
class PoemWriter extends React.Component {
constructor() {
super();
this.state = {
value: "",
isValid: false
};
}
checkPoemValid = value => {
const lines = value.split("\n");
if (lines.length === 3) {
let line1 = lines[0].trim().split(/\s+/).leng... | true |
6894a1c6b5a0fac9e5fbc77e1c89fac12e899fcc | JavaScript | wesgk/MembershipMap | /app/js/map.js | UTF-8 | 582 | 2.515625 | 3 | [
"ISC"
] | permissive | var googleMaps = {
ready : false,
resolver: {
map: ['$q', function($q) {
if (!googleMaps.deferred) {
googleMaps.deferred = $q.defer();
}
if (googleMaps.ready) {
googleMaps.deferred.resolve();
}
return goog... | true |
dbd9d0e0073eeb900a7500f138f22be039a20526 | JavaScript | robbyronk/zonelist | /priv/static/auth_callback.js | UTF-8 | 1,372 | 2.671875 | 3 | [] | no_license | function setSession(authResult) {
// Set the time that the access token will expire at
var expiresAt = JSON.stringify(
authResult.expiresIn * 1000 + new Date().getTime()
);
localStorage.setItem('access_token', authResult.accessToken);
localStorage.setItem('id_token', authResult.idToken);
localStorage.se... | true |
390f10c9ca80805c37bd4d2fe6966174a22cee45 | JavaScript | smart-town/MyNotes | /01FrontEnd/03javascript/00test/prototypeTest.js | UTF-8 | 307 | 3.25 | 3 | [] | no_license | console.log('原型测试')
function Temp(name="hhg",sex="male"){
this.name = name;
this.sex = sex;
}
Temp.prototype.height = '175cm';
let t1 = new Temp() ;
let t2 = new Temp("cherry","female");
console.log(t1);
console.log(t2);
console.log(Object.keys(t1))
for(let x in t1) {
console.log(x);
} | true |
6851fe93cba87188f27cc448a5242a9d8deb9c04 | JavaScript | mikeladon/Affinage | /js/script.js | UTF-8 | 2,170 | 3.265625 | 3 | [] | no_license | let slideOne = document.querySelector('.slider__first-slide');
let slideTwo = document.querySelector('.slider__second-slide');
let leftArrow = document.querySelector('.yellow-rectangle__nav-forward');
let rightArrow = document.querySelector('.yellow-rectangle__nav-back');
let changeSlides = () => {
slideOne.classLis... | true |
44ba151e51630490fc8d333e8919d663c9c4e727 | JavaScript | Oskasb/workworld | /client/js/lib/data_pipeline/src/GameDataPipeline.js | UTF-8 | 1,277 | 2.59375 | 3 | [] | no_license | "use strict";
define([
'data_pipeline/pipes/JsonPipe',
'data_pipeline/pipes/ImagePipe'
],
function(
JsonPipe,
ImagePipe
) {
var GameDataPipeline = function() {
};
GameDataPipeline.loadConfigFromUrl = function(url, dataUpdated, fail) {
JsonPipe.loadJsonFromUrl(url, dataUpdated, fail)
};
Game... | true |
87a04138fc4b0a9852bf64d787404bfc96ffd263 | JavaScript | IsmailCuruk/HomeworkWeek2Ismail | /src/transform.js | UTF-8 | 1,152 | 2.96875 | 3 | [] | no_license | module.exports.groupAdultsByAgeRange = function groupAdultsByAgeRange(adults) {
const TwentyAndYounger = adults.filter((adult)=> {
return (adult.age >= 18) && (adult.age <= 20);
});
const TwentyOneUntill30 = adults.filter((adult)=> {
return (adult.age >= 21) && (adult.age <= 30);
});
co... | true |
6c5c43f382b7bfc3c891d4713e65260be12830e4 | JavaScript | kenjiSpecial/tubugl-core | /src/utils/webglShader.js | UTF-8 | 788 | 2.765625 | 3 | [
"MIT"
] | permissive | /**
* compile shader based on three.js
*/
function addLineNumbers(string) {
let lines = string.split('\n');
for (let i = 0; i < lines.length; i++) {
lines[i] = i + 1 + ': ' + lines[i];
}
return lines.join('\n');
}
export function webGLShader(gl, type, shaderSource) {
let shader = gl.createShader(type);
g... | true |
4cfa26dbf1768c5a2f7076cf5fc0eed68c18dcd9 | JavaScript | hechem1899/checkpiont-todo | /list/src/App.js | UTF-8 | 981 | 2.84375 | 3 | [] | no_license | import React,{useState} from 'react';
import logo from './logo.svg';
import './App.css';
function App() {
const [item,setItem]=useState('')
const [todos,setTodos]=useState([])
const handleInputValue=(e)=> {
e.preventDefault()
setItem(e.target.value)
}
const handeToDo=(e)=> {
setTodos([...todos,{i... | true |
37b354b8a2000a6209683f0950e8940fe23a1dd1 | JavaScript | OlgaLyubicheva/tt-components | /src/App.js | UTF-8 | 1,341 | 2.546875 | 3 | [] | no_license | import React, {useState, useEffect} from 'react';
import SearchCard from './components/searchCard/SearchCard';
const App = () => {
const [data, setData] = useState([]);
useEffect(() => {
fetch('./api/resp1.json')
.then(response => response.json())
.then(source => setData(source));
}, []);
ret... | true |
8f98d2ffe61112477760da10391100428f81e292 | JavaScript | jiangjianqing/atomer-common-lib | /src/json-schema-js/lib/createFieldValidate.js | UTF-8 | 3,041 | 2.765625 | 3 | [] | no_license | /**
* Created by ztxs on 16-11-28.
*/
module.exports = function(){
return {
'readOnly': function (v, p) {
return false;
},
// ****** numeric validation ********
'minimum': function (v, p, schema) {
return !(v < p || schema.exclusiveMinimum && v <= p);
... | true |
611c2bb5460f7ebe0becd54aa2dd8347d12f9c2c | JavaScript | sanketdhole/ValuefyTask | /controller.js | UTF-8 | 3,255 | 2.984375 | 3 | [] | no_license | let requestData = require('./request-data');
let fs = require('fs');
exports.controler = (allLinks, mediumLinks) => {
//This function takes the allLinks list to be used to add other links.
// mediumLinks is list of links which contains medium.com as domain
//It returns new promise which is resolved when al... | true |
38988b0858f9f9c15d7aec64bed6f5c30a88b942 | JavaScript | natasha-rupani/NFT_Borrowing | /src/store/reducers/accountReducer.js | UTF-8 | 606 | 2.546875 | 3 | [] | no_license | const initState = {
accountAddress: {"address": ""},
accountAssets: []
}
const accountReducer = (state = initState, action) => {
if (action.type === 'ADD_ACCOUNT_ADDRESS') {
let newUserAddress = action.userAddress;
return {
accountAddress: {"address": newUserAddress},
accountAssets: state.acc... | true |
0512d1bf4bfc7f597f923b37b780850535aa8ec5 | JavaScript | 3203317/old | /硕正报表设计器2.5/main/commons/js/util.js | UTF-8 | 130 | 2.71875 | 3 | [] | no_license |
String.prototype.replaceAll = function($oldText,$replaceText){
return this.replace(new RegExp($oldText,"gm"),$replaceText);
};
| true |
12a6368f9c2b2827af9b1fb91f338ff1fccd3851 | JavaScript | limkeunhyeok/study-group | /javascript/YOU DON'T KNOW JS - 1권/2주차 자료/logicalOperator.js | UTF-8 | 156 | 3.4375 | 3 | [] | no_license | var a = 42;
var b = "abc";
var c = null;
console.log(a || b); // 42
console.log(a && b); // abc
console.log(c || b); // abc
console.log(c && b); // null
| true |
d0cd4d9f3c5a01d547f9b5c37b42b9f445437007 | JavaScript | IvanIYankov/SoftUni-Homework-Sync | /Softuni-JS_Apps-ExamPrep/Exam prep 2 with Victor/With everything running just fine/carTube-main (1)/carTube-main/details.js | UTF-8 | 1,376 | 2.546875 | 3 | [] | no_license | import { render, html } from "./node_modules/lit-html/lit-html.js";
import { getListingById } from "./data.js"
import { deleteCar } from "./data.js"
function listingDetailTemplate(car, isOwner, delCar) {
return html`<section id="listing-details">
<h1>Details</h1>
<div class="details-info">
<img src... | true |
9e470a02607843c6d4a74e76e9910d3482a45ab4 | JavaScript | marinadelkovamoro/burger | /public/assets/js/burgers.js | UTF-8 | 600 | 2.875 | 3 | [] | no_license | // jQuery based on on."Click"
// ajax call --> "PUT"
$(function () {
$(".change-devoured").on("click", function (event) {
var id = $(this).data("id");
var newStatus = $(this).data;
var newDevouredStatus = {
devoured: 1
};
// Send the PUT request.
$.aja... | true |
d021ed9738c296444b972f987e5a51bb52c00eea | JavaScript | boylesoftware/thymes2js | /lib/endpoint-mapper.js | UTF-8 | 2,234 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive | "use strict";
/**
* Endpoint lookup result.
*
* @private
* @typedef {Object} EndpointLookupResult
* @property {EndpointHandler} handler Endpoint handler.
* @property {string} resourceUri Resource URI, which is the path section of the
* request URL (sans the endpoint prefix, if any) plus the query string (if any... | true |
5f39b9b88106c3931e991e745987fc866ca4fe56 | JavaScript | kevin-kabore/react-boilerplate | /app/redux-example.jsx | UTF-8 | 2,776 | 2.8125 | 3 | [] | no_license | var redux = require('redux')
// import axios from 'axios';
console.log('Starting redux example');
var actions = require('./actions/index')
var store = require('./store/configureStore').configure()
// Subscribe to changes
var unsubscribe = store.subscribe(() => {
var state = store.getState()
console.log('New St... | true |
d531c50080e44fab9278b428808169838cc8dc29 | JavaScript | linziyanleo/linziyanleo.github.io | /work/p5/p5.js-1.0.0/test/manual-test-examples/saveData/saveJSONObject/sketch.js | UTF-8 | 300 | 3 | 3 | [
"Apache-2.0",
"LGPL-2.1-only"
] | permissive | var json;
function setup() {
json = {}; // new JSON Object
json.id = 0;
json.species = 'Panthera leo';
json.name = 'Lion';
save(json, 'lion.json');
}
// Sketch saves the following to a file called "lion.json":
// {
// "id": 0,
// "species": "Panthera leo",
// "name": "Lion"
// }
| true |
0e4afb1dd1b91419aa90efe972e6938a2d33cd3b | JavaScript | nimbusdin/PD2-Horde | /kolbot/libs/common/Storage.js | UTF-8 | 20,951 | 3.09375 | 3 | [] | no_license | /**
* @filename Storage.js
* @author McGod, kolton (small kolbot related edits)
* @desc manage inventory, belt, stash, cube
*/
var Container = function (name, width, height, location) {
var h, w;
this.name = name;
this.width = width;
this.height = height;
this.location = location;
this.buffer = [];
this.item... | true |
41541083955cb8fdad6d414be983722aa681bb4a | JavaScript | aa1aac/email | /client/src/components/protectedroutePractice.js | UTF-8 | 1,458 | 2.515625 | 3 | [] | no_license | import React, { Component } from "react";
import {
BrowserRouter as Router,
Route,
Link,
Redirect,
withRouter
} from "react-router-dom";
import axios from "axios";
function AuthExample() {
isAuth();
return (
<Router>
<div>
<ul>
<li>
<Link to="/public">Public Page<... | true |
70e9647eae76c903c592f83d8215375019a5e2af | JavaScript | nguyenit67/auto-https | /script/exten_youtube.js | UTF-8 | 2,607 | 2.6875 | 3 | [] | no_license | // @ts-nocheck
// document.addEventListener("load", function() {
const SWITCH_NAME = "lemmeathtem-fu89ufh8ufvj--display-none";
const style = document.createElement("style");
style.innerHTML = `
.${SWITCH_NAME} {
display: none;
}
`;
document.head.appendChild(style);
// Event for toggl... | true |
f7fa739e18ec6b1e5bde1b5605286da5f0075c7c | JavaScript | RadostinKostadinov/JS_Advanced_softuni | /05. DOM Manipulations and Events/Lab/03. Delete-From-Table/app.js | UTF-8 | 540 | 3.078125 | 3 | [] | no_license | function deleteByEmail() {
const email = document.querySelector('label input[type="text"]').value;
const tableEls = document.querySelector('#customers tbody');
const result = document.getElementById('result');
let isDeleted = false;
for(const row of Array.from(tableEls.children)){
if(row.chi... | true |
f25eefef728e842793a8118b589f17e102d03f6c | JavaScript | Whitedev01/cit_215_test_one | /script.js | UTF-8 | 140 | 3.140625 | 3 | [] | no_license | var coolStuffEle = document.body.querySelector(".coolStuff");
var propter = prompt("Hello who are you ?");
coolStuffEle.innerHTML=propter; | true |
6a63ada0db409a0b5cc31ec6670d028c4af26749 | JavaScript | krrk2102/CS_575_SoftareArchitecture_Project | /flightinfo/app/assets/js/index.js | UTF-8 | 4,444 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | function httpGet(theUrl)
{
var xmlHttp = null;
xmlHttp = new XMLHttpRequest();
xmlHttp.open( "GET", theUrl, false );
xmlHttp.send( null );
return xmlHttp.responseText;
}
function listFlight() {
var num = $("input[name='flight_num']").val();
if (isNaN(num) || num < 0 || num > 9999) {
... | true |
acafc59f453685b76eece8979ec3bacb02ab2cbd | JavaScript | fasilak/gameoflife | /tests-unit/testGrid.js | UTF-8 | 2,786 | 3.046875 | 3 | [] | no_license | let Grid = require('../build/test-tmp/server/controller/Grid')
let Life = require('../build/test-tmp/server/controller/Life')
describe("Grid initialization testing", () => {
let sample1 = [[],[],[]]
let outputSample1Rows = 3
let outputSample1Columns = 0
let sample2 = [[1,2,3],[2,2,2],[1,1,1],[3,3,3]]
le... | true |
27a44dc1f67fb39e74aaaddfadf3556d28296646 | JavaScript | bhushu1998/lecturedemo | /day8/assign1.ajax.js | UTF-8 | 1,784 | 3.3125 | 3 | [] | no_license | function helloAjax(){
try{
// STEP-1
let http = new XMLHttpRequest();
// STEP-4 EVENT HANDLER :: run() :: callback
http.onreadystatechange = function(){
if(http.readyState == 4){
let resString = http.responseText;
let resJson = JSON.parse(... | true |
93e7a46feebf88d0f142179602da9e2dc18f6a98 | JavaScript | Gorzas/spotify-playlist | /node/get_playlist_tracks.js | UTF-8 | 2,365 | 3.578125 | 4 | [] | no_license | /**
* Get Playlist Tracks names and artists with Spotify
* --------------------------------------------------
*
* Script for Node based in the examples provided for Spotify.
*
* - Spotify original examples:
* https://github.com/spotify/web-api-auth-examples/
*
*
* Usage:
* node get_playlist_tracks.js <play... | true |
ae375f6a86c25cce30df196ff8d7dbf21e2bd2ca | JavaScript | liuyu520/otpsign2 | /src/main/webapp/js/Ajax.js | UTF-8 | 2,935 | 2.578125 | 3 | [
"MIT"
] | permissive | // return parameter
var xhr =null;
var ii=0;
var getXHR=null;
var objectXHR=null;
var responseMethod222222222111221;
var browser=navigator.appName;
var isIE=(browser=="Microsoft Internet Explorer");
var createXHR=function() {
var xhr;
try {
xhr =xhr = new XMLHttpRequest();
return xhr;
} catch (e) {
try {
xh... | true |
c1f882585de41288a54d3deb798ac065cc788f8a | JavaScript | daytona/lds | /lds-styleguide/lib/object-deep-map.js | UTF-8 | 277 | 2.9375 | 3 | [
"MIT"
] | permissive | function objectDeepMap(object, callback) {
Object.keys(object).map((key) => {
object[key] = callback(object[key], key);
if (typeof object[key] === 'object') {
objectDeepMap(object[key], callback);
}
})
return object;
}
module.exports = objectDeepMap;
| true |
21f902d8be6d8743c1daf05efef1aa8c9705933d | JavaScript | iigmir/Five-Programming-Question-all-programmer-should-solve-in-hour | /javascript/main/pgm2.js | UTF-8 | 186 | 2.703125 | 3 | [] | no_license | module.exports = (list1=[], list2=[]) =>
{
let a = [];
list1.map( (item, index) =>
{
a.push( list1[index] );
a.push( list2[index] );
});
return a;
};
| true |
44b26bfe8dad76682c358394b16cb9fb49de901b | JavaScript | anshul2goyal/Mocha | /test/starting.specs.try.js | UTF-8 | 431 | 3.015625 | 3 | [] | no_license | /**
* Test using try catch block around assert.
* This test case will log the error in terminal but test case will pass
* As the assert is failong but it throws exception
*/
var assert = require('assert');
describe('Basic Mocha test with try', function(){
it('Should show error message in console', function(){
... | true |
9dab0f16e17a11690ac60add4e718e7b9485ecb0 | JavaScript | future4code/Silas-Merces | /semana4/lista-de-exercicios/lista-js-boilerplate/lista-js-boilerplate/exercicios.js | UTF-8 | 6,085 | 4.21875 | 4 | [] | no_license | //Exercício 1
function inverteArray(array) {
// implemente sua lógica aqui
}
//Exercício 2 -- FEITO
function retornaNumerosParesElevadosADois (array) {
let arrayExerc = [1, 2, 3, 4, 5, 6];
let arrayResult = [];
for(num of arrayExerc){
if(num%2===0){
arrayResult.push(num**2);
}
}
... | true |
036dcc3edcb534f7d80db7c39fbb75dbd2696cc2 | JavaScript | mukeshcgs/mukeshcgs.github.io | /2022/wbpack/src/js/pixi_sketch.js | UTF-8 | 1,638 | 2.671875 | 3 | [
"MIT"
] | permissive | // // typical import
// import gsap from "gsap";
// // // get other plugins:
// import ScrollTrigger from "gsap/ScrollTrigger";
// import Flip from "gsap/Flip";
// import Draggable from "gsap/Draggable";
// // or all tools are exported from the "all" file (excluding members-only plugins):
import { gsap, ScrollTrigger... | true |
cc64200888d8dcbbc06719731470cf51784da762 | JavaScript | dtc-innovation/garagiste | /authorize.mjs | UTF-8 | 2,683 | 2.6875 | 3 | [
"MIT"
] | permissive | import fs from 'fs';
import readline from 'readline';
import {promisify} from 'util';
import googleAuth from 'google-auth-library';
const {readFile, writeFile} = fs.promises;
// If modifying these scopes, delete your previously saved credentials
// at ~/.credentials/drive-nodejs-quickstart.json
const SCOPES = ['htt... | true |
ff51907ac0eb03288c75cb19eeb002e250640321 | JavaScript | tkbremnes/MultiMegaMan | /js/keylistener.js | UTF-8 | 3,467 | 2.671875 | 3 | [] | no_license | var keyIsDown = false;
var keyDownObj = {
left: false,
right: false,
jump: false,
down: false,
fire: false,
kd: false
};
var dirArray = [];
function initKeyListener()
{
$(document).bind('keydown',function(e){
switch(e.keyCode)
{
case(37):
// Left
if(!keyDownObj.left){
k... | true |
a2a5a371095a9943aa23532f95de126e58bbaddd | JavaScript | efulet/dawe | /Clase_07/NodeEjem/express/simple_get.js | UTF-8 | 687 | 2.671875 | 3 | [] | no_license | const express = require('express');
const app = express();
// Debe existir esta carpeta en el directorio
//app.use(express.static('public'));
app.get('/index_get.html', function (req, res) {
res.sendFile(__dirname + "/" + "index_get.html");
});
app.get('/process_get', function (req, res) {
// Salida en formato... | true |
2206efebede86daa792366b38873c40acf9cf999 | JavaScript | Sarizeybekk/javascript_exercises | /javascript_uygulamalar/palindromeKontrol/palindrome.js | UTF-8 | 392 | 2.84375 | 3 | [] | no_license | function palindrome()
{
var kelime= document.getElementById("giris").value;
var kelimeTersi = "";
for (i = kelime.length-1; i >= 0; i--)
{
kelimeTersi = kelimeTersi + kelime[i]
}
if (kelime == kelimeTersi)
document.getElementById("snc"). value = kelimeTersi+ " Palindrome ";
else
documen... | true |
63613ce61ab80189739c34b8d69b93aead004240 | JavaScript | Simanis20/Simanis | /4.majas darbs/js/main1.js | UTF-8 | 1,889 | 2.828125 | 3 | [] | no_license | function h(data) {
console.log(data)
let out = ''
let city = ''
if (data.geoip && data.weather){
if (data.geoip.region && cities[data.geoip.region]) {
city = cities[data.geoip.region]
} else (
city = data.geoip.region
)
out += `<h4 class="center">${city}</h4>`
out += `... | true |
431d70ef908fc48094557d1f65bd35ef11d88c8a | JavaScript | FredJiangFei/LearnNodeJs | /demos/express-demo/routes/courses.js | UTF-8 | 1,454 | 2.65625 | 3 | [] | no_license | const Joi = require('joi');
const express = require('express');
const router = express.Router();
const courses = [{ id: 1, name: 'course1' }, { id: 2, name: 'course2' }];
router.get('/', (req, res) => {
res.send(courses);
});
router.get('/:id', (req, res) => {
const course = courses.find(c => c.id === Number(req... | true |
9c932439a3db6d7a55e7b89f3a672e84d0e36012 | JavaScript | bgoonz/UsefulResourceRepo2.0 | /MY_REPOS/web-dev-notes-resource-site/2-content/WEB_AUDIO/p5.js-sound-master/test/tests/p5.Amplitude.js | UTF-8 | 1,517 | 2.640625 | 3 | [
"MIT"
] | permissive | var expect = chai.expect;
describe('p5.Amplitude', function () {
this.timeout(1000);
var sf, amp, osc, oAmp;
it('can be created', function () {
amp = new p5.Amplitude();
});
after(function (done) {
expect(amp.getLevel()).to.not.equal(1.0);
osc.dispose();
sf.dispose();
done();
});
... | true |
74213eb69806f9c786b1e677ef0752461425d4b7 | JavaScript | squireaj/quoteBook | /js/cookieService.js | UTF-8 | 1,761 | 3.1875 | 3 | [] | no_license | var app = angular.module('quoteBook');
app.service('cookieService', function() {
var createCookie = function(name, value, days) {
var expires;
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
expires = "; expires=" + date.toGMTString();
... | true |
2831ff732b9ae7d980dc10c975ce1daf23a824f4 | JavaScript | jhirsch/solving-sol | /049/jhirsch/script.js | UTF-8 | 3,132 | 3.515625 | 4 | [
"Unlicense"
] | permissive | /*
## Wall Drawing #49 (1970)
A wall divided equally into fifteen equal parts, each with a different line direction and color, and all combinations.
Red, Yellow, Blue, Black pencil
*/
var sections = [];
var lineSpacing = 8;
var lineWidth = 2;
function fill1(g){
var x = g.bounds.left;
while(x <... | true |
5971b93e4d8ccc91fef4108b786664df0f597195 | JavaScript | jxzho/koa2-learn | /use-koa-bodyparser/index.js | UTF-8 | 662 | 2.578125 | 3 | [] | no_license | const Koa = require('koa')
const bodyParser = require('koa-bodyparser')
const app = new Koa()
app.use(bodyParser())
app.use(async (ctx) => {
console.log(ctx.method, ctx.url);
let html = ``
if (ctx.method === 'GET' && ctx.url === '/') {
html = `
<form method="POST" action="/">
username: <input n... | true |
b3c6ce97898b1e36d1eb161d49a86d1c3c3e5faf | JavaScript | shamilkhan/jest | /src/functions/work-obj/test/index.test.js | UTF-8 | 173 | 2.5625 | 3 | [] | no_license | import expect from 'expect';
test('obj', () => {
const arr = [1, 2, 124];
expect(arr).toContain(124);
const set = new Set(arr);
expect(set).toContain(1);
}) | true |
b0f7c6ab73d8f7007f1d16a8474d88e26fafe695 | JavaScript | garisian/garisian.github.io | /js/displayCubes.js | UTF-8 | 3,766 | 3.09375 | 3 | [] | no_license | $(window).load(function()
{
//makeCube(50, 50, "squareStructure-1", "cube-1");
makeCubes();
moveCubes();
});
function moveCubes()
{
var pos = 0;
var id = setInterval(frameIncrement, 10);
function frameIncrement()
{
var width = window.innerWidth|| document.documentElement.clientWidth|| document.body.clientW... | true |
7f2a2870aac48b00ac02e693aee10c6aee477dfa | JavaScript | Elvidio-JH/Another-Tier-Maker | /app.js | UTF-8 | 1,492 | 3.1875 | 3 | [] | no_license | /* apps.js will be used for interactivity of the site */
'use strict'
const switcher = document.querySelector('.btn'); /* gets the reference to the theme changing button */
var num_rows = 1;
var srcUrls = [];
switcher.addEventListener('click', function() {
document.body.classList.toggle('dark-theme')
va... | true |
3c5b42671badfc2177a1cfd1a1ceac91aa53dec0 | JavaScript | adamgarcia4/Record | /routes/amazon.js | UTF-8 | 5,437 | 3.09375 | 3 | [] | no_license | // Amazon S3 Upload Route
//*******************Import Dependencies***************
require('dotenv').config();
var express = require('express');
var router = express.Router();
var aws = require('aws-sdk');
var AWS_ACCESS_KEY = process.env.AWS_ACCESS_KEY_ID;
var AWS_PRIVATE_KEY = process.env.AWS_SECRET_ACCESS_KEY;
var S... | true |
98ddb9ceeae6cdcdbea95537557bbcf03285879a | JavaScript | fenech/stickers | /public/js/stickers.js | UTF-8 | 2,784 | 2.765625 | 3 | [
"MIT"
] | permissive | function toTextArea(arr, predicate) {
return arr.reduce(function(prev, curr, index) {
return predicate(curr) ? prev.concat(index) : prev
}, [])
}
function splitStickers(text) {
return text.replace(/\([^\)]*\)/, "").split(/[,\s]+/).filter(Number).map(Number);
}
function ViewModel() {
this.total... | true |
dd2253cefec5dc4fc7b0b32831f3981fad82b067 | JavaScript | rohinigit2020/DevJS | /module2/chapter2/assignment5/snippetCallback.js | UTF-8 | 273 | 3.9375 | 4 | [] | no_license | // call back function
function greet(name,callback ){
console.log('hi'+' '+ name)
callback()
}
function callMe(){
console.log("I am callback function")
}
greet('Axone',callMe)// when ever we are passing a function as an argument we should not give paranthesis | true |
812c891de1cf80ec8f46a7b763b98bfd82cc2443 | JavaScript | gvenezia14/js-objects | /js/student-report.js | UTF-8 | 726 | 2.953125 | 3 | [] | no_license | var message='';
var student;
function print(message){
document.write("<section>" + message + "</section>");
}
for(var i=0; i<students.length; i++){
student=students[i];
console.log(student);
message += '<h2>' + student.name + '</h2>';
message += '<p>' + student.track + '<p>';
}
print(message);
//angular... | true |
507d295d4eb26e12f55edcf40db4c0074eebd262 | JavaScript | Clayakn/promise-example | /src/App.js | UTF-8 | 2,204 | 3.21875 | 3 | [] | no_license | import React, { Component } from 'react';
import './App.css';
import axios from 'axios';
// Async Await
async function fetchData() {
const result = await axios.get('http://pokeapi.salestock.net/api/v2/pokemon/10000000')
console.log(result)
}
class App extends Component {
constructor(){
super();
this.... | true |
e4b554c47f896fbfe7c18942c882f0aa713b0b98 | JavaScript | MrSevenEleven/ES6 | /21.class基本语法/1.简介.js | UTF-8 | 10,768 | 4.03125 | 4 | [] | no_license | // 基本上,ES6 的class可以看作只是一个语法糖,它的绝大部分功能,ES5 都可以做到,新的class写法只是让对象原型的写法更加清晰、更像面向对象编程的语法而已。
// class Point {
// constructor(x, y) {
// this.x = x;
// this.y = y;
// }
//
// toString() {
// return '(' + this.x + ', ' + this.y ... | true |
9e01fbdc823e9dcd73ae5f548b33103174be9bca | JavaScript | alex-milanov/cumuflux | /src/js/iblokz/helpers.js | UTF-8 | 860 | 2.796875 | 3 | [] | no_license | "use strict";
if(typeof iblokz === "undefined"){ var iblokz = {}; }
iblokz.helpers = function(){
var displayWithJade = function(container, fileName, data){
// if passed string create a jquery object
if(typeof container === "string"){
container = $(container);
}
if(typeof data === "undefined"){
data ... | true |
ec5c35e09fed9fcc9c129e6769b0ed89e7f497f0 | JavaScript | ng9891/Nodejs-Tutorial | /Nodejs-Modules/Bucky.js | UTF-8 | 196 | 2.59375 | 3 | [] | no_license | var movies = require('./movie');
//movies.favMovie = "The Notebook";
var buckysMovies = movies();
buckysMovies.favMovie = "The Intern";
console.log("Bucky favMovie is " + buckysMovies.favMovie); | true |
b5d3e28f17883a4e7651ae4df0131ad3c89c498f | JavaScript | kraKEUNZ/todo | /js/toggle.js | UTF-8 | 1,914 | 2.875 | 3 | [] | no_license | $(document).ready(function() { // le script se lance une fois que le DOM est pret
// $(':checkbox').change(function(){ //detection du changement d'état
// var done = 0; // départ du boutton toggle
// var id = $(this).attr('name'); // récupére l'id via la BDD sur quel btn le clic est fait
//
// ... | true |
518b92f9e1e085fe8b3b71fac84e70b56c0034fa | JavaScript | Tazri/Learn-Java-Script | /chapter fourteen/InheritanceAgain.js | UTF-8 | 1,069 | 4.0625 | 4 | [] | no_license | //Work Object for Mixing
var canWalk = {
walk : function(){
console.log('Walking...');
}
}
var canEat = {
eat : function(){
console.log('Eating...');
}
}
var canSwim = {
swim : function(){
console.log('Swimign...');
}
}
//End of Work Object
//Create Mixin Function For ... | true |
27c1fb2fac5a9597744434adcc97204a248fdead | JavaScript | Kaaden/react-native | /src/services/utils.js | UTF-8 | 727 | 2.546875 | 3 | [] | no_license | const err = { isok: false, msg: "fail" }
export default async function request(url, body) {
// let res
return new Promise(function (resolve, reject) {
fetch(url, {
method: "POST",
headers: {
"Accept": "application/json",
"Content-Type": "applicatio... | true |
507058064e1419bdb587c30990d668a67b365d33 | JavaScript | mhkmcp/play-with-node | /fsModule/index.js | UTF-8 | 2,741 | 2.71875 | 3 | [] | no_license | var fs = require('fs')
var http = require('http')
var server = http.createServer(function (request, response) {
if (request.url == '/') {
// sync delete
// fs.unlinkSync
// async delete
// fs.unlink
// sync exists
// fs.existsSync
// async exists
... | true |
05cc72d3b1a87b29e320755054487daf62c36a3c | JavaScript | mnkhod/ub_weather_cli | /index.js | UTF-8 | 3,115 | 2.546875 | 3 | [] | no_license | #! /usr/bin/env node
const program = require('commander');
const axios = require('axios');
const boxen = require('boxen');
const chalk = require('chalk');
const ubCityId = "2028461";
const WEATHERAPI = "YOUR_API_KEY";
const url = `https://api.openweathermap.org/data/2.5/weather?id=${ubCityId}&appid=${WEATHERAPI}&unit... | true |
cf6ecee6d227927d7ab8d4be673a7cc6bca10410 | JavaScript | pani-izabela/khn | /src/main/webapp/js/main.js | UTF-8 | 1,968 | 2.625 | 3 | [] | no_license | $(document).ready(function(){
$("#footerOnPage").load("/footer.html");
$("#headerOnEveryPage").load("/header.html");
$("#sidebarOnEveryPage").load("/sidebar.html");
showEmailLoggedUser();
logout();
});
function setRole() {
if ((window.location.href).includes('customer')){
return 'customer'
... | true |
d60a50e53259fc79ceaa9e0dfc0aaeed2b5b9ebb | JavaScript | wucan1994/mylife | /src/components/tab/tab-bar/index.js | UTF-8 | 921 | 2.515625 | 3 | [] | no_license | /* eslint-disable jsx-a11y/no-static-element-interactions */
import React, { useState } from 'react';
import './index.css';
export default function TabBar(props) {
const { tabs = [], onClickTab } = props;
const [activeIndex, setActiveIndex] = useState(0);
const clickTab = (index) => {
setActiveIndex(index);... | true |
a02f513d9de3f4045625ec40e1554802a65d6172 | JavaScript | Tkutose/coffeelog | /public/static/public/js/index.js | UTF-8 | 4,201 | 2.6875 | 3 | [] | no_license | // CSRF設定
axios.defaults.xsrfCookieName = "csrftoken"
axios.defaults.xsrfHeaderName = "X-CSRFToken"
const api = axios.create({
baseURL:"http://127.0.0.1:8000/",
// baseURL:"https://tkuto-coffeelog.herokuapp.com/",
timeout: 5000,
headers: {
"Content-Type": "application/json",
"X-Requeste... | true |
24f8e80e78aefb80fe258535219535ba34b68c00 | JavaScript | lmccart/itp-networked-media | /week5/04_instagram_example/sketch.js | UTF-8 | 365 | 2.5625 | 3 | [] | no_license |
function setup() {
var url = "https://api.instagram.com/v1/media/search?lat=40.7127&lng=74.0059&client_id=41fc508443ae4954adbf453ec6265f1e";
loadJSON(url, handleData);
}
function handleData(jsonData) {
console.log(jsonData.data.length);
var pics = jsonData.data;
for (var i=0; i<pics.length; i++) {
cre... | true |
55e711f425aa603a3b32b2a830fc24fd7ce33a15 | JavaScript | Imater/mindStorage | /app/js-git-db/storage/storages/local-storage.js | UTF-8 | 1,725 | 2.765625 | 3 | [] | no_license | module.exports = LocalStorage = (function(){
function LocalStorage(tableName){
if(typeof localStorage.setItem != 'function'){
console.info("error: localStorage not supported");
}
if(typeof JSON.stringify != 'function'){
console.info("error: JSON not supported");
}
this._key = function(... | true |
1338d8ed97f36578989ab35a6f344da8a7e0c319 | JavaScript | lscspirit/wmvote | /client/helpers/server_client.js | UTF-8 | 2,382 | 2.625 | 3 | [] | no_license | "use strict";
import $ from "jquery";
import Ballot from "~/models/ballot";
let _client = null;
export default class ServerClient {
/**
* Initialize this client
* (e.g. crediential, csrf tokens)\
*
* @param {Object} opts options
*/
static init(opts) {
}
/**
* Get the singleton client ins... | true |
2ec524e26a578bc326585e791ba32710e57e4773 | JavaScript | aruisan/riom | /usuarios/esterilizador/js/validar-citas.js | UTF-8 | 6,577 | 2.796875 | 3 | [] | no_license | $(document).ready(function (){
$("#examen").change(function(){
$("#valor").html("<p class='loading'><img src='../loading.gif'/><br>Cargando..</p>");
var url = "precio.php"; // El script a dónde se realizará la petición.
$.ajax({
type: "POST",
url: url,
data... | true |
69785f48dde21183e54db467c0b67e4905002afe | JavaScript | negestesh/negestesh.github.io | /W2D1/tests.js | UTF-8 | 1,052 | 3.484375 | 3 | [] | no_license | /* eslint-disable linebreak-style */
/* eslint-disable no-plusplus */
/* global describe */
/* global it */
/* global assert */
/* global sum */
/* global multiply */
/* global reverseString */
/* global filterLongWords */
describe('sum', () => {
it('sums the values in the array passed as a parameter', () => {
as... | true |
8781631ad77902e71b67360f41672bbf668e47d5 | JavaScript | JOLee83/coding-challenges | /code-wars/JS/5kyuJS/MaximunSubarraySum.js | UTF-8 | 398 | 3.359375 | 3 | [] | no_license | var maxSequence = function(arr) {
if (!arr.length) {
return 0
}
let max = arr.reduce((a, b) => a + b)
let length = arr.length - 1
while (length > 0) {
for (let i = 0; i + length <= arr.length; i++) {
let newArr = arr.slice(i, i + length)
let test = newArr.reduce((a, b) => a + b)
if (test > max) {
... | true |
528eb23ef9a87ae503034ab41c69751f9174b921 | JavaScript | justonpoints/koa-bookshelf-api-starter | /lib/api/api.js | UTF-8 | 807 | 2.765625 | 3 | [
"MIT"
] | permissive | module.exports = function(books){
var api = {};
//Note: the use of 'this' below refers to the koa object.
api.user = require("./user.js")(books);
api.test = function *() {
//var response = yield books.user.test("something");
var response = yield books.user.test;
//console.log(response);
r... | true |
5e791f9882b2c72e3b9a7d78c33bc59dec75cac4 | JavaScript | sebapkfd/sketch | /app.js | UTF-8 | 1,672 | 3.46875 | 3 | [] | no_license | const blocksParent = document.querySelector('.blocks');
const buttonSize = document.querySelector('#size-button');
const cleaner = document.querySelector('#clear-button');
function createCanvas(userSelection = 6) {
userSelection = parseInt(userSelection, 10);
if (Number.isInteger(userSelection) == false || use... | true |
5a8a5b43b3b80fe39867b788d895d15f260ad6f5 | JavaScript | jussi-kalliokoski/vectorizer.js | /polygons.js | UTF-8 | 3,364 | 3.203125 | 3 | [
"MIT"
] | permissive | function createPalette (imagedata) {
var w = imagedata.width
var h = imagedata.height
var d = new Uint32Array(imagedata.data)
var c = new Uint8Array(imagedata.data)
var p = []
for (var i=0, n=3; i<d.length; i++, n+=4) {
if (!c[n]) continue
if (~p.indexOf(d[i])) continue
p.push(d[i])
}
return new Uint32... | true |
1823ec243cf9165fadfc13660ebd2cea027d30de | JavaScript | Sirbinod/Medical-Store | /src/store/reducers/cartReducer.js | UTF-8 | 3,053 | 2.609375 | 3 | [] | no_license | import {
ADD_TO_CART,
CART_DATA_FETCH,
CART_FAIL,
CART_START,
DECREASE_QUANTITY,
DELETE_FROM_CART,
CART_EMPTY,
} from "../action/actionType";
const initState = {
loading: false,
success: false,
cart: [],
quantity: 0,
totalPrice: 0,
error: null,
number: 0,
};
const cartReducer = (state = in... | true |
2b38c41ee3c8259ea7e0cba4e820863523fdd36f | JavaScript | dmgreaves/notes-app | /src/notebook.js | UTF-8 | 982 | 3.609375 | 4 | [] | no_license |
class Notebook {
constructor() {
this.notes = [];
this.result = "";
}
create(text) {
let noteInstance = new Note(text);
this.notes.push(noteInstance);
return noteInstance;
console.log("within notebook")
console.log(this.notes)
}
abbrev(text) {
return text.slice(0,17) + ".... | true |
354cc96bf03282ddedd716b183a454aa4d4382c9 | JavaScript | jcapuano328/cwb.react | /src/services/time.js | UTF-8 | 437 | 2.8125 | 3 | [] | no_license | import moment from 'moment';
export const isNight = (dt, battle) => {
var now = moment(dt);
var dawn = moment(now.format('YYYY-MM-DD') + 'T' + battle.dawnTime);
var dusk = moment(now.format('YYYY-MM-DD') + 'T' + battle.duskTime);
return ((now.isSame(dusk) || now.isAfter(dusk)) && now.isBefore(dawn));
}
export c... | true |
53daebe22a315b9d6b8a005e8d56cf2fbfc30dab | JavaScript | AlohaHouse/AlohaHouse | /static/AlohaHouse/js/detail.js | UTF-8 | 424 | 2.515625 | 3 | [] | no_license | $('#favolite-form').submit(e => {
// デフォルトのイベントをキャンセルし、ページ遷移しないように!
e.preventDefault();
var $form = $(this);
$.ajax({
'url': $form.attr('action'),
'type': 'POST',
'data': $form.serialize(),
'dataType': 'json'
}).done( response => {
// 成功したら
alert('fj... | true |
5118f283ca385fb1c10ed13d49d5cd449edbfdde | JavaScript | Wain-PC/nodeSerials.dev | /app/parsers/tvrage/index.js | UTF-8 | 8,886 | 2.96875 | 3 | [] | no_license | function TheTvDbParser(key) {
this.key = key;
this.api = require("./api.js");
this.show = {};
this.util = {};
this.util.compare = require('../../util/compare');
this.show.searchForShow = function (series, callback) {
var _this = this;
var key = this.key;
var showTitle,
... | true |
1f925d225411da5d6d86644d107fac403e1cdd3a | JavaScript | davidnunesantos/validador_de_mensagens | /js/classes/data_send.js | UTF-8 | 4,072 | 3.3125 | 3 | [] | no_license | /**
* @file Destinado a criação da classe DataSend
* @author David Nunes dos Santos <david_nunesantos@hotmail.com>
*/
/**
* Classe responsável por estruturar os dados de envio
* @class
*/
class DataSend {
/**
* Pega o ID da mensagem
* @returns {string}
*/
get idMensagem() { return this._i... | true |
175c635601806e4d5934bf3ddc8143ffd608ba76 | JavaScript | DropSnorz/base64 | /src/components/Encoder.js | UTF-8 | 1,740 | 2.609375 | 3 | [] | no_license | import React from 'react';
import Button from 'react-bootstrap/Button';
import Form from 'react-bootstrap/Form';
export default class Encoder extends React.Component {
constructor(props) {
super(props);
this.state = { encodeSwitch: true, output: "", error: "" };
this.handleChange = this.handleChange.bin... | true |
84a74c2f45608c4da714cf995b6731c93c1ae034 | JavaScript | Dani247/auth-microservice | /src/utils/authMiddleware.js | UTF-8 | 668 | 2.53125 | 3 | [] | no_license | const jwt = require('jsonwebtoken')
function authToken(req, res, next) {
// get bearer token
const authHeader = req.headers['authorization']
const token = authHeader && authHeader.split(' ')[1]
if (!token) {
return res.status(403).json({
message: 'Invalid authentication token',
error: '403 unau... | true |