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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
7c159951f36c62f85708e4cf541319b33807d427 | JavaScript | BogdaholaS/Internet-Shop | /controllers/shop.js | UTF-8 | 1,135 | 2.59375 | 3 | [] | no_license | const Product = require('../models/Product');
const User = require('../models/Users');
exports.getIndex = (req, res, next) => {
Product.find().then(products => {
res.render('index', { pageTitle: 'Internet Shop', products });
});
};
exports.getSignUp = (req, res, next) => {
res.render('signup', { pageTit... | true |
db1dc79bc441086d1fef399a16d9b4641e75783f | JavaScript | Sahana22121994/JavaScript-HomeLoans | /features/support/steps.js | UTF-8 | 2,439 | 2.734375 | 3 | [
"MIT"
] | permissive | const { Given, When, Then, After, Before,setDefaultTimeout } = require("cucumber");
const pageObject= require("../support/pageObject");
setDefaultTimeout(async function(){
setDefaultTimeout(60 *1000);
});
Before(async function() {
await this.loginToApplication();
});
After(async function() {
return await this.... | true |
8a2f23431cca557df474b98725c6c18777991bea | JavaScript | ndedic/rwa | /lv03/04-builtin-object-constructor.js | UTF-8 | 1,144 | 4.03125 | 4 | [] | no_license | /**
* The Object constructor
* more @ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object
*/
var obj1 = Object.create({}, {
prop: {
value: 42,
writable: true,
enumerable: true,
configurable: true
}
});
console.log(obj1.prop);
var user = {
sayHello: functio... | true |
a16b3bffeae8072571be13943181aafe9a7ed05a | JavaScript | novoda/peepz | /web/src/components/room/sort/peepFreshnessComparator.js | UTF-8 | 435 | 2.859375 | 3 | [] | no_license | const FITHTEEN_MINUTES = 15 * (60 * 1000);
const peepFreshnessComparator = now => (a, b) => {
const aIsFresh = isFresh(now, a);
const bIsFresh = isFresh(now, b);
if (aIsFresh && bIsFresh || !aIsFresh && !bIsFresh) {
return 0;
}
if (aIsFresh) {
return -1;
} else {
return 1;
}
};
const isFre... | true |
7ff8924053f9daf000e08d95520251c6b8a058c9 | JavaScript | tmkryb/goliat | /router.js | UTF-8 | 3,337 | 2.609375 | 3 | [] | no_license | var fs = require("fs");
var util = require("util");
var path = require("path");
var queryString = require("querystring");
function route(pathname, response, request, query, userSession, configuration){
//obszar consolelogów i takich tam
//przekieruj te dane do kontrolera
var parseToController = function(){
var con... | true |
2a91edadbccbca5067483fae9e64c6dbf6ceff2d | JavaScript | gzunick/yulu | /love.js | UTF-8 | 1,226 | 3.203125 | 3 | [] | no_license | let final = `
我喜欢你是寂静的,仿佛你消失了一样。
你从远处聆听我,我的声音却无法触及你。
好像你的双眼已经飞离远去,
如同一个吻,封缄了你的嘴。
如同所有的事物充满了我的灵魂,
你从所有的事物中浮现,充满了我的灵魂。
你像我灵魂,一只梦的蝴蝶,
你如同忧郁这个字。
我喜欢你是寂静的,好像你已远去。
你听起来像在悲叹,一只如鸽悲鸣的蝴蝶。
你从远处听见我,我的声音无法企及你。
让我在你的沉默中安静无声。
并且让我借你的沉默与你说话,
你的沉默明亮如灯,简单如指环。
你就像黑夜,拥有寂静与群星。
你的沉默就是星星的沉默,遥远而明亮。
我喜欢你是寂静的,仿佛你消失了一样,
遥远且哀伤,仿佛你已... | true |
45fc0a13b4f6405f4e7e658507d267addc6a95f6 | JavaScript | VaughnHass/graceshopper-project | /client/store/allProducts.js | UTF-8 | 1,478 | 2.609375 | 3 | [
"MIT"
] | permissive | import axios from 'axios';
//constants
const SET_PRODUCTS = 'SET_PRODUCTS';
const SET_FILTER = "SET_FILTER";
const SEARCH_PRODUCTS = "SEARCH_PRODUCTS"
//actions
export const setProducts = (products) => {
return {
type: SET_PRODUCTS,
products,
};
};
export const searchProducts = (products) => {
return S... | true |
80e7b39c5d94e565e23775c946ff2bfd9344a601 | JavaScript | thinkbigdo/learn-react | /basics/react-6/src/index.js | UTF-8 | 438 | 2.953125 | 3 | [
"MIT"
] | permissive | var hellos = [
{ value: "ne hao" }, // Mandarin attempt
{ value: "hello" },
{ value: "hola" }
]
var Hello = React.createClass({
render: function () {
var helloDom = [];
helloDom = hellos.map(function (hello) {
return (<li>{hello.value}</li>)
});
return (
... | true |
20956f5084e5800ba8f2af4b99ffe490d6a6355d | JavaScript | chmodawk/babel-plugin-closure-elimination | /test/processed/object-shorthand-func.{'plugins'_['transform-es2015-destructuring']}.js | UTF-8 | 473 | 2.625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = demo;
function _ref() {
return 1;
}
function shorthand() {
var obj = {
func1: _ref,
func2() {
return 2;
},
func3() {
return 3;
}
};
return obj;
}
function demo() {
var _shorthan... | true |
b0ff7008020b7b84324b518baf796fc45a96382e | JavaScript | irenedrf/practica_js_26oct_irene | /js/funciones.js | UTF-8 | 2,287 | 3.515625 | 4 | [] | no_license | //Irene Díaz-Roncero Fraile FULL-STACK 2020
function addTask(pInputTitle, pInputPriority) {
const newTask = {
id: id,
priority: pInputPriority,
title: pInputTitle
}
let exists = taskList.findIndex(task => {
return task.title == pInputTitle && task.priority == pInputPriority... | true |
607322adb78d4014f888271e1389df5b9af84cbd | JavaScript | KazuyaWatanabe0228/chatwork-notification | /src/chatwork-notification.js | UTF-8 | 3,320 | 2.59375 | 3 | [
"MIT"
] | permissive | (function() {
'use strict';
if (!("Notification" in window)) {
return;
}
if (Notification.permission === "granted") {
chatworkNotify();
}else if (Notification.permission !== 'denied') {
Notification.requestPermission(function (permission) {
if (permission === "gr... | true |
01ff9b041b8f62a613a3d487556a5b8fc58f3885 | JavaScript | SpinalSubset69/top_backend | /server/models/user.model.js | UTF-8 | 662 | 2.65625 | 3 | [] | no_license | import { Schema, model } from "mongoose";
const userSchema = new Schema({
name: String,
email: String,
phone: String,
plan: String,
isActived: {
type: Boolean,
default: true,
},
init_membership: String,
end_membership: String,
months: Number,
});
//TimeStamp ex= 10-9-2021
userSchema.methods.... | true |
5b86bd63157bbb906c7975de47374322e30f3b59 | JavaScript | nathanaltice/PartyCoolFX | /src/scenes/MovingEmitter.js | UTF-8 | 2,336 | 3.09375 | 3 | [] | no_license | class MovingEmitter extends Phaser.Scene {
constructor() {
super('movingemitterScene')
// settings
this.SPEED = 300
this.SPEEDMIN = 50
this.SPEEDMAX = 800
this.DUMMYSPEED = 200
}
preload() {
// load assets
this.load.path = './assets/'
... | true |
fa86b5e8a8844f431667f067dcfb9222d5e67793 | JavaScript | Kofoten/communistars | /client/app/scripts/bodys/star.js | UTF-8 | 368 | 2.5625 | 3 | [] | no_license | let Body = require('./body');
let starMaterial = new THREE.MeshBasicMaterial({
color: 0x00ff00
});
let starGeometry = new THREE.SphereGeometry(7.351 * Math.pow(10, -8), 32, 32);
class Star extends Body {
constructor() {
super();
let mesh = new THREE.Mesh(starGeometry, starMaterial);
t... | true |
81ede1e4334cbbca346dcc9dfe2504305cd3f256 | JavaScript | jaimevepe/jaimevepe | /JavaScript-Problems/Title-Case-a-Sentence/test.js | UTF-8 | 1,181 | 4.84375 | 5 | [] | no_license | // Return the provided string with the first letter of each word Capitalized.
// Make sure the rest of the other words are lowercase.
function tittleCase(str) {
let words = str.toLowerCase().split(" "); // space in "" / str to lowercase all the words and turn them into an Arr
for ( let i=0; i<words.length; i++... | true |
9b7dcc16ef1c9ad9d94f397bca3433bf33b39db3 | JavaScript | cesarvargas00/quiz-app | /app/scripts/controllers/main.js | UTF-8 | 1,366 | 2.5625 | 3 | [] | no_license | 'use strict';
/**
* @ngdoc function
* @name quizApp.controller:MainCtrl
* @description
* # MainCtrl
* Controller of the quizApp
*/
angular.module('quizApp')
.controller('MainCtrl', function($scope) {
$scope.quiz = [{
"q": "Who is the best ping pong player at FSA?",
'options':... | true |
41c70890af4c2e18f77a924e0b74d5fe992f8cff | JavaScript | Lee-Ji-Hye/smartBD | /src/main/webapp/resources/js/selectCity.js | UTF-8 | 1,080 | 2.53125 | 3 | [] | no_license | /**
*
*/
function selectCity (objId, area1, area2) {
$.ajax({
url : "/smart/member/bdmn/getGu/"
,data : {"si":area1}
,dataType : "json"
,success:function(e){
//데이터가 없으면
if(e == null || e == "") {
$("select#"+objId+" option").remove();
optHtml += "<option value=''>지역구</option>";
... | true |
e3cdd0faf6f412eaadc9bc9a3add28ba22582db2 | JavaScript | TonchoLozev/Course-JavaScript-Advanced | /JS-Advanced-Exam-19-Dec-2016/02.Add Left-Right-Clear in List/test/02. Add Left -Right-Clear in List-Tests.js | UTF-8 | 2,199 | 3.4375 | 3 | [] | no_license | const expect = require("chai").expect;
const makeList = require("../02. Add Left-Righ-Clear in List");
describe("TODO …", function () {
let myList = {};
beforeEach(function () {
myList = makeList();
});
it("TODO …", function () {
})
});
describe('makeList Test', function () {
let my... | true |
edb57fdca27dc801f3a48a8f256760311ade5337 | JavaScript | Nikulin-Andrey/image-search-Page | /src/components/ImageCard.js | UTF-8 | 1,896 | 2.53125 | 3 | [] | no_license | import Card from '@material-ui/core/Card';
import CardMedia from '@material-ui/core/CardMedia';
import CardContent from '@material-ui/core/CardContent';
import CardActions from '@material-ui/core/CardActions';
import Button from '@material-ui/core/Button';
import Typography from '@material-ui/core/Typography';
import G... | true |
7202c5017a7145432bdea83b830a04440301a9f3 | JavaScript | wentaiouyang/ShoppingListApp | /src/containers/Home/Home.js | UTF-8 | 1,059 | 2.59375 | 3 | [] | no_license | import React, { useEffect, useState, useContext } from "react";
import { AppContext } from "../../Context/AppContext";
import axios from "axios";
import "./Home.css";
import FoodCard from "../../components/foodCard";
export default function Home() {
const [number, setNum] = useState(10);
const [listData, setList] ... | true |
cd328485d6a118142be40ce968bc534a125ac377 | JavaScript | nickblantz/IndecisiveEats | /Resources/js/graph.js | UTF-8 | 2,327 | 2.625 | 3 | [
"MIT"
] | permissive | $(document).ready(function() {
var margin = {top: 10, right: 0, bottom: 30, left: 30},
width = $("#search-svg").width() - margin.left - margin.right,
height = $("#search-svg").height() - margin.top - margin.bottom,
svg = d3.select("#search-svg")
.attr("width", width + margin.left + margin.right)
.att... | true |
58185e77184cc66e16ec4ce477f6e3a0c2129822 | JavaScript | ngtronghoang97/basic-web-php | /javascript/function.js | UTF-8 | 465 | 3.078125 | 3 | [] | no_license | //checkall
document.getElementById("btn_checkall").onclick = function (){
var checkboxes = document.getElementsByName('name[]');
for (var i = 0; i < checkboxes.length; i++){
checkboxes[i].checked = true;
}
};
//uncheckall
document.getElementById("btn_uncheckall").onclick = function (){
var check... | true |
1b147ef68e297ab3edfca9957269824577043b28 | JavaScript | maggieShally/mood | /utils/util.js | UTF-8 | 1,057 | 3.203125 | 3 | [] | no_license | const formatTime = date => {
const year = date.getFullYear()
const month = date.getMonth() + 1
const day = date.getDate()
const hour = date.getHours()
const minute = date.getMinutes()
const second = date.getSeconds()
return [year, month, day].map(formatNumber).join('-') + ' ' + [hour, minute, second].map... | true |
32efbaceff744be6baf7c433ee10c2e1e4f333eb | JavaScript | sojib-bd/user-form-with-firebase | /src/Components/Config/FireOath.js | UTF-8 | 1,461 | 2.640625 | 3 | [] | no_license | import React,{useState} from 'react';
import * as firebase from "firebase/app";
import "firebase/auth";
import firebaseConfig from './Config';
const FireOath = () => {
const [name,setName] = useState('');
const [email,setEmail] = useState('');
const [url,setUrl] = useState('');
const handleSubmit=()=> {... | true |
4d8fbd6ea705c6e3de131494f750802b0320a5a1 | JavaScript | cice-s560/ejercicio-newsreader | /routes/index.js | UTF-8 | 4,222 | 2.921875 | 3 | [] | no_license | const express = require("express");
const router = express.Router();
const axios = require("axios");
const fs = require("fs");
const path = require("path");
const uuid = require("uuid/v3");
const dbPath = path.join(__dirname, "../db.json");
// !AVISO Necesitamos un /db.json ==> { "articles": [] }
const db = JSON.parse(... | true |
cdbd559d6a93463c94650249bd76124b21f1588f | JavaScript | MatheusTRibeiro/mysqlHW | /bamazonCustomer.js | UTF-8 | 3,650 | 3.390625 | 3 | [] | no_license | // Require packages needed
var inquirer = require('inquirer');
var mysql = require('mysql');
// Define the MySQL connection parameters
var connection = mysql.createConnection({
host: 'localhost',
port: 3306,
user: 'root',
password: "root",
database: "bamazon"
});
// use inquirer's prompt which it... | true |
702cd29008e988bc12b34998327d59892ce98858 | JavaScript | linziyanleo/linziyanleo.github.io | /work/p5/p5.js-1.0.0/src/color/color_conversion.js | UTF-8 | 6,137 | 3.21875 | 3 | [
"LGPL-2.1-only",
"Apache-2.0"
] | permissive | /**
* @module Color
* @submodule Color Conversion
* @for p5
* @requires core
*/
/**
* Conversions adapted from <http://www.easyrgb.com/en/math.php>.
*
* In these functions, hue is always in the range [0, 1], just like all other
* components are in the range [0, 1]. 'Brightness' and 'value' are used
* interch... | true |
83b9c8e75a53d6fba48a320b6ed82dc4d90b4a28 | JavaScript | Trizalio/Frontend-JavaScript | /public/js/views/scoreboard.js | UTF-8 | 1,821 | 2.625 | 3 | [] | no_license | define([
'backbone',
'tmpl/scoreboard',
'collections/scores',
'models/score',
], function(
Backbone,
tmpl,
collection,
Score
){
var ScoreboardView = Backbone.View.extend({
template: tmpl,
viewName: 'ScoreboardView',
container: document.createElement("div"),
i... | true |
5a9504597f8e3b2de5370bc0090c08c8ab735c8d | JavaScript | JenDixon/stellar-client | /app/scripts/utilities/util.js | UTF-8 | 885 | 2.765625 | 3 | [
"ISC"
] | permissive | var Util = {};
Util.validateUsername = function (username) {
if (username.length < 3 || username.length > 20) {
return false;
}
return !!username.match(/^[a-zA-Z0-9]+([._-]+[a-zA-Z0-9]+)*$/);
}
/**
* Shows a tooltip above the given element.
* - title: the text to show
* - type (error, info)
* - placement (top, l... | true |
63473bb0c0c505e79889513f4d5ae6738b21ef21 | JavaScript | shreya-banik/Messaging-Validation | /articles.js | UTF-8 | 2,161 | 2.640625 | 3 | [] | no_license | const express= require('express');
const router= express.Router();
//Bring the article models
let Article = require('../models/article');
//Add Route
router.get('/add', function(req, res){
res.render('add_articles',{
title:'Add Articles'
});
});
// Add Submit POST Route
router.post('/add', ... | true |
4c50b0cced03462638e8b788ba800293a12897f9 | JavaScript | NickMaels/JavaScript-Homework | /Lab17/1/script.js | UTF-8 | 1,290 | 3.125 | 3 | [] | no_license | let first=document.getElementById('first');
let fbutton=document.getElementById('firstb');
let items=document.getElementById('items');
let units=document.getElementById('units');
let price=document.getElementById('price');
let price_it=0.00;
function firstEvent()
{
let count_it=+first.value;
items.inne... | true |
f27462098b53ce2c58a4afc5dd7c780dbcd471b6 | JavaScript | talfreds/acit1620midterm | /menu.js | UTF-8 | 425 | 2.546875 | 3 | [] | no_license |
document.getElementById('menu').style.top = '-80px';
document.getElementById("downimg").addEventListener("click", function(){
menuloc = parseInt(document.getElementById('menu').style.top, 10);
if (menuloc == -80)
{
document.getElementById("menu").style.top =
"0px";
... | true |
bf3fcf9010ff0f56a35f4b09348b3caa3d9ba638 | JavaScript | harunurhan/react-latex-next | /example/src/App.js | UTF-8 | 2,378 | 2.734375 | 3 | [
"MIT"
] | permissive | import React, { useState } from "react";
import Latex from "react-latex-next";
import "katex/dist/katex.min.css";
// eslint-disable-next-line no-useless-escape
const INITIAL_TEXT_WITH_LATEX =
"We give illustrations for the three processes $e^+e^-$, gluon-gluon and some macros: $\\f\\relax{x} = 1$";
const INITIAL_ST... | true |
192a18985699fa90dc35e31e6005af3b56c63eec | JavaScript | ecmarsh/algorithms | /__tests__/Stack.test.js | UTF-8 | 1,105 | 3.140625 | 3 | [
"MIT"
] | permissive | const { Stack, accessStack, stackHas } = require( '../structs' );
describe( 'Stack and helpers', () => {
// initalization
it( 'initalizes a stack object', () => {
const s = Object.create( Stack );
const items = `stack`;
s.init( items );
expect( s.array ).toStrictEqual( Array.from( items ) );
ex... | true |
a5a22761a0fda4cba6be389bbf1800e9cd7c51cd | JavaScript | goldi42/CKANbuilder | /lib/configure/plugins.js | UTF-8 | 1,085 | 2.5625 | 3 | [
"MIT"
] | permissive | const shell = require('shelljs');
const logger = require('../logging/logService').getInstance();
class PluginsConfigurationManager {
/**
* Add all active Plugins to the given configuration file
*
* @param {array} plugins
* @param {string} configurationFile
*/
activateCkanPlugins (plugi... | true |
6103e88c1294df2bb7a96a2f550f788654639d96 | JavaScript | PooTeamTJ/Small-Project | /client/src/actions/itemActions.js | UTF-8 | 2,587 | 2.8125 | 3 | [] | no_license | /*
THis is where we make our request to backend
to add contacts delete contacts
THis where we have to make the update request in the future
using .patch
*/
import {GET_ITEMS, ADD_ITEM, DELETE_ITEM, SEARCH_ITEM, ITEMS_LOADING} from './types';
import axios from 'axios';
import { tokenConfig } fro... | true |
d9b1715bb97a2e14971efc5e2c079248754fe283 | JavaScript | Learning-JavaScript-Sandbox/Learning-JavaScript-Sandbox.github.io | /Scripts/Modulus.js | UTF-8 | 625 | 3.453125 | 3 | [] | no_license | console.log('modulus');
function main() {
let number1;
number1 = document.getElementById('num-inp').value
number1 = Number(number1);
if (number1%2 == 0) {
document.getElementById('output').innerHTML = ('Even')
}else if (number1%2 == 1) {
document.getElementById('output').innerHTML = ('Odd')
}else ... | true |
9026e60424dec6aba912c4fcd973410cd24207a7 | JavaScript | GSG-G10/GSGS | /DB/queries/count-follow.js | UTF-8 | 600 | 2.703125 | 3 | [] | no_license | const connection = require('../config/connection.js')
const countFollowing = (username) =>{
return connection.query(`SELECT count(*) FROM ${username}_following;`)
}
const countFollowers = (username) =>{
return connection.query(`SELECT count(*) FROM ${username}_followers;`)
}
const setFollow = async (usernam... | true |
b0ef5f3724c577dce259866e99566194046f6dd0 | JavaScript | ralucas/restaurant | /restaurant.js | UTF-8 | 11,336 | 3.0625 | 3 | [] | no_license | $(function(){
//Part I
var FoodItem = function (name, calories, vegan, glutenFree, citrusFree){
//String
this.name = name;
//Number
this.calories = calories;
//Boolean
this.vegan = vegan;
//Boolean
this.glutenFree = glutenFree;
//Boolean
this.citrusFree = citrusFree;
};
FoodItem.prototype.isVegan = functio... | true |
ebf58cb3debb1499c82c79a1c0f04a11bf2f13b0 | JavaScript | brunosf/react-redux-basico | /sem-react/tests.js | UTF-8 | 535 | 3.484375 | 3 | [] | no_license | const counter = (state = 0, action) => {
switch (action.type) {
case "INCREMENT":
return state + 1;
case "DECREMENT":
return state - 1;
default:
return state;
}
};
console.assert(counter(0, { type: "INCREMENT" }) === 1);
console.assert(counter(1, { type: "INCREMENT" }) === 2);
conso... | true |
bcaeea2abc95668e0a84c9e2e58d8e9d2ed5ec35 | JavaScript | chrisbrook1603/JavaScript-and-Node | /scripts.js | UTF-8 | 693 | 3.671875 | 4 | [] | no_license | // this is a simple console logging statement
console.log("Hello world!");
// different kinds of console logging
let persondetails = {firstname : "Chris",
surname : "Brook",
place : "Huddersfield",
starsign : "Aquarius" };
console.log(persondetails.firstname);
console.log(persondetails.surname);
console.... | true |
7fa6c365252550a3ec6e1e3ba9b0eb7b756b20ef | JavaScript | davidlinner/sondier-mediation | /dist/bucketize.js | UTF-8 | 3,251 | 2.546875 | 3 | [] | no_license | "use strict";
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
}
exports.__esModul... | true |
2700b177d4a31df3e89caca55f5c1a83a9227408 | JavaScript | victorjordan95/possosairja | /app/js/script.js | UTF-8 | 5,098 | 3 | 3 | [] | no_license | 'use strict';
(function () {
document.getElementById('app-sair').innerHTML = `
<p id="saida" class="alert hidden"></p>
<h1>Que horas posso sair?</h1>
<div class="input-box">
<div class="form-group">
<label>Hora Entrada</label>
<input type="time" id="horaEntrada" pl... | true |
44b98876fdd725b387d11d281d050d4fe3703afd | JavaScript | DmitryBarskov/to-do-react | /src/TodoItem.jsx | UTF-8 | 592 | 2.515625 | 3 | [] | no_license | import React from 'react';
function TodoItem({ todoItem, onCompletedChange, onDelete }) {
const className = todoItem.completed ? 'completed' : '';
const handleClick = (event) => {
onCompletedChange(event.target.checked);
};
return (
<div>
<input
type="checkbox"
defaultChecked={t... | true |
8a1ec25c21f65537f429e77ca6611002fef29511 | JavaScript | chornaya-com/amazon-clone | /src/components/reducer.test.js | UTF-8 | 2,240 | 2.96875 | 3 | [] | no_license | import {initialState, reducer, SEARCH_ACTION} from "./reducer";
describe('reducer', () => {
it('should set user and return new state', () => {
const testUser = {};
const state = {};
const newState = reducer(state, {
type: 'SET_USER',
user: testUser,
});
... | true |
0b21c23fde46799c701e3c6694cec8358da3d7cb | JavaScript | imeoer/maper | /platforms/android/assets/www/js/index.js | UTF-8 | 2,134 | 2.84375 | 3 | [] | no_license | var app = {
initialize: function() {
this.bindEvents();
},
bindEvents: function() {
document.addEventListener('deviceready', this.onDeviceReady, false);
},
onDeviceReady: function() {
$(function() {
app.receivedEvent('deviceready');
try {
app.run();
}
catch(error) {
alert(error.message... | true |
2b2d1534b76a290cecd2c9d21f287405687527fd | JavaScript | naliniraju/javascript | /training/functions.js | UTF-8 | 774 | 2.96875 | 3 | [] | no_license | function getDetails(){
var name = function getName(){
return "Santhosh" +" "+ "Kumar";
}
var edu = function getEdu(){
return "M.C.A";
}
var phone = function getContactNo(){
return 98663212212;
}
console.log("My Name " + name()+ " Education : "+edu()+" Contact to... | true |
d7e975c5404d37268e42faa8d5366733b7bf3966 | JavaScript | hyeonggeun2/javascript | /practice/제어문/9.js | UTF-8 | 143 | 2.984375 | 3 | [
"MIT"
] | permissive | var sumNum = 0;
console.log('\n9번 문제');
for (var i = 1; i < 20; i++){
if (!(i % 2) || !(i % 3))
sumNum += i;
}
console.log(sumNum); | true |
878d3f58f021e81d5551efb26a1a7c33af24c998 | JavaScript | crashley1992/trivia-game | /scripts/app.js | UTF-8 | 4,146 | 3.53125 | 4 | [] | no_license | //start of game is false
var start = false;
//timer counter
var time = 0;
// correct answer counter
var correct = 0;
//stop game
function stopGame() {
document.location.reload()
}
//start time button
function startGame() {
start = true;
//timer
if (start = true) {
timeStart = setInterval(timer, 1000);
}... | true |
619ed6f0ef92ee6978881ad993027cabf32be859 | JavaScript | voliva/intratime-slack-bot | /features/actions.js | UTF-8 | 4,338 | 3.15625 | 3 | [] | no_license | const { Action } = require("../intratime");
const { applyTimeString, applyDateString } = require("./utils");
const actionCommands = {
"check in": Action.CheckIn,
"check out": Action.CheckOut,
"break": Action.Break,
"return": Action.Return
};
// Accepts HH:MM:SS or HH:MM
const timeRegex = /^([01]\d|2[0-3]):[0-... | true |
b19fbd2b051786685d4d4760dcba521f21d16a16 | JavaScript | Snugug/lava-floor | /assets/js/ws.js | UTF-8 | 1,721 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | (function () {
'use strict';
let ws;
let convo;
const wsURI = new URL(window.location);
wsURI.protocol = 'ws:';
wsURI.pathname = '/ws/genie';
const bubble = document.createElement('p');
bubble.classList.add('bubble');
function wsConnect(elem) {
console.log(`connect ${wsURI.toString()}`);
w... | true |
5a0cd747f52d1448a2c58e67663ad6d61517c164 | JavaScript | yuyaun/React-Flux-Architecture | /Lesson1/gulpfile.js | UTF-8 | 933 | 2.59375 | 3 | [] | no_license | // Base gulp
var gulp = require('gulp');
// Bundle modules with Browserify
var browserify = require('gulp-browserify');
// Concatenates require files
var concat = require('gulp-concat');
// 定義 main.js 為載入的唯一 JS 會將此 JS require 檔案作處理
gulp.task('browserify', function() {
gulp.src('src/js/main.js')
.pipe(browser... | true |
edb93be44629587d36ef4aa4f869e67669624146 | JavaScript | weskleymb/revisao-php-manha | /ajax_cidade/js/ajax.js | UTF-8 | 712 | 2.96875 | 3 | [] | no_license | function show_cidades(uf) {
let request = new XMLHttpRequest();
request.onreadystatechange = function() {
if (request.readyState == 4 && request.status == 200) {
document.getElementById("cidade").innerHTML = request.responseText;
}
};
request.open("GET", "ajax_cidade.php?uf="... | true |
017ef185bae88a3985ab58d4ff281c0b51d33c02 | JavaScript | arash16/nexpa | /packages/modeler/src/creator.js | UTF-8 | 2,874 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | var LAST_TYPED_VALUE_ID = 0;
function createTypedValue(meta, ctor, val) {
var result = new ctor(val);
result.vid = ++LAST_TYPED_VALUE_ID;
if ("isClient") {
var contexts = [result, meta, meta.type],
typedView = getProp(contexts, 'view', 3, true);
result.view = nx(() => useView(t... | true |
9afc2e3ff6d910f806220529b3de9b83a3397656 | JavaScript | Mos-team/2048 | /animation.js | UTF-8 | 753 | 2.734375 | 3 | [] | no_license | function show_number_with_animation(x,y,number){
var number_cell = $('#number_cell_'+x+'_'+y);
number_cell.css("background-color",get_number_background_color(number));
number_cell.css("color",get_number_color(number));
number_cell.text(number);
number_cell.animate({
width:100,
height:100,
top:get_pos... | true |
67d6d41021164c4d3367e57255dce38cf784309a | JavaScript | jsjaspreet/epi-in-es6 | /EPI/Chap6/18/test.js | UTF-8 | 386 | 2.65625 | 3 | [] | no_license | const test = require('ava')
const spiral = require('./again')
const { isEqual } = require('lodash')
test(`[[1, 2, 3],
[4, 5, 6],
[7, 8, 9]]`, t => {
const x = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
t.true(isEqual([1, 2, 3, 6, 9, 8, 7, 4, 5], spiral(x)))
})
test(`[[1, 2],
[4, 3]]`, t => {
const x... | true |
b36b3e0af4480d248eb10158e755d6fb9176f3da | JavaScript | Lisenren/Lisenren.github.io | /js/index.js | UTF-8 | 325 | 2.703125 | 3 | [
"MIT"
] | permissive | var banner=document.getElementById("banner");
var txt=document.getElementById("txt");
window.onscroll=function(){
var top=document.documentElement.scrollTop || document.body.scrollTop;
if(top>banner.offsetHeight){
txt.style.position="fixed";
txt.style.top=0;
}else{
txt.style.position="";
txt.style.top=-100;... | true |
091adcc03c6498bad283c44a55c69d71478d50ca | JavaScript | vadimlew/vadimlew.github.io | /games/multiplayer/Utils.js | UTF-8 | 636 | 2.796875 | 3 | [] | no_license | class Utils {
static createAnimSprite( sheetImage, framesNum=4, animationSpeed=1/10, width=16, height=16 ) {
let textures = [];
let baseTexture = new PIXI.BaseTexture( sheetImage );
for ( let i=0; i < framesNum; i++ ) {
let frame = new PIXI.Rectangle( i*width, 0, width, he... | true |
c8e060e746d0a47ae8c314344ca5acc74a81b6dd | JavaScript | elkhechafi/Africa-Security-Tracker | /js/index.js | UTF-8 | 6,849 | 3.140625 | 3 | [] | no_license |
//var declerations
var map = document.querySelector('#map');
var path = map.querySelectorAll('.map-img path');
//End Of Var Declerations
//date slider commence ici
var slider = document.getElementById("myRange");
var output = document.getElementById("demo");
output.innerHTML = slider.value; // Display the default ... | true |
6b53b960dfaa6e38d2c9f235d665eada78daf0f3 | JavaScript | steemiz/steemiz | /src/features/Post/actions/getPostsBy.js | UTF-8 | 3,355 | 2.515625 | 3 | [] | no_license | import { put, select, takeEvery } from 'redux-saga/effects';
import update from 'immutability-helper';
import format from '../utils/format';
import getPostKey from '../utils/postKey';
import { getDiscussionsFromAPI } from 'utils/helpers/apiHelpers';
import { selectPosts } from '../selectors';
/*--------- CONSTANTS ---... | true |
e5da0f211c366c38a89bd1ddd8c82820c8b27b37 | JavaScript | kkxujq/Notes | /DEMO-libs/webSocket-broadcast/client/ws.js | UTF-8 | 1,153 | 2.9375 | 3 | [] | no_license | export default class {
constructor(selector, webSocketLink, type) {
if (!selector || !webSocketLink) return;
this.ws = this.init(webSocketLink);
this.type = type || 'client';
this.pingTimeout = 20 * 1000;
this.open();
this.message(selector);
this.close();
... | true |
78e256c70f8ed73345cc9f0f1c3e66909c9b8c21 | JavaScript | al12534326/unadmexico | /vistas/modulos/cargaMaster/localresource/js/index.js | UTF-8 | 6,845 | 2.671875 | 3 | [] | no_license | //run
let cargamaster = null;
let cargaMasterExcel = null;
let validarCarga = null;
let listaVins = null;
let listData = null;
let listError = null;
let contadorVines = 0;
let tamañoVines = 0;
let tamañoErrorVines = 0;
let leyendaErrorVines = '';
let str = null;
let cantidad = 0;
const selectElement = document.getEl... | true |
52c54ea39a519a491b6ee1f9bcee1b92a4cd4c43 | JavaScript | matzekFloyd/GuidedValid | /src/js/views/concrete.js | UTF-8 | 12,091 | 3.078125 | 3 | [] | no_license | let data = require("./data/wahl.json");
//PARTEI NAMEN
const OEVP = "ÖVP";
const SPOE = "SPÖ";
const FPOE = "FPÖ";
const GRUENE = "GRÜNE";
const NEOS = "NEOS";
const SONSTIGE = "Sonstige";
const TEXTS = {
ONE: "A bar chart is a chart for comparing different categories using rectangular bars. Bars can be horizonta... | true |
bd9eab54fb6aa49f462ce41bd98805738d4b937a | JavaScript | Dev-hoon/reactProjrct | /src/App.js | UTF-8 | 1,710 | 2.734375 | 3 | [] | no_license | // import logo from './logo.svg';
import './App.css';
import Hello from './Hello';
import React, {useRef, useState} from 'react';
import Wrapper from './Wrapper';
import Counter from './Counter';
import InputSample from './InputSample';
import UserList from './UserList';
import CreateUser from './CreateUser';
function... | true |
4ce271589adf9c1a9f41fd9ef1ffa6faef9e5d82 | JavaScript | wheercool/renderProps | /src/components/User.js | UTF-8 | 783 | 2.59375 | 3 | [] | no_license | import React from 'react';
import PropTypes from 'prop-types';
export class User extends React.Component {
render() {
console.log('User rendered');
const { name, error, isFetching, login } = this.props;
if (error) {
return <p>Во время запроса произошла ошибка, обновите страницу</p>;
}
... | true |
382f96e252ee5e2865708140e1ef5af4fcf19de2 | JavaScript | HCXAVIERMORAES/aulaJavaScript | /js/main.js | UTF-8 | 4,091 | 4.0625 | 4 | [] | no_license |
/*
var idade = prompt("Qual a sua idade? ");
if(idade >= 18){
alert("Maior de idade");
} else{
alert("menor de idade");
}
*/
//estrutura de repetição com o while
/*
var count = 0;
while(count < 5){
console.log("repetição com while "+count);
count = count + 1;
}
//var count ;
for(count= 0; count <= 5;... | true |
ce9cedc23315435af70050305a11962e6390dda4 | JavaScript | postcss/autoprefixer | /lib/hacks/intrinsic.js | UTF-8 | 1,396 | 2.546875 | 3 | [
"MIT"
] | permissive | let OldValue = require('../old-value')
let Value = require('../value')
function regexp(name) {
return new RegExp(`(^|[\\s,(])(${name}($|[\\s),]))`, 'gi')
}
class Intrinsic extends Value {
add(decl, prefix) {
if (decl.prop.includes('grid') && prefix !== '-webkit-') {
return undefined
}
return sup... | true |
940ae2593dea1729cca71848f360864e75e5b1c0 | JavaScript | bogusz2233/Blog-website-backend | /comments/commentsController.js | UTF-8 | 1,303 | 2.625 | 3 | [] | no_license | const database = require("../database/database");
const {createNewMySqlConnection} = require("../database/database");
var connection = createNewMySqlConnection();
const createOne = async (request, response) =>{
let bodyReq = request.body;
//Gdy nie podano żadnych infomacji
if(Object.entries(bodyReq).leng... | true |
92ccac109c8dac8be02c65413575b00707999d54 | JavaScript | ahmedavid/react-radio-matrix | /src/components/EditableListItem.js | UTF-8 | 1,297 | 2.609375 | 3 | [
"MIT"
] | permissive | import React , {Component,PropTypes} from 'react';
export default class EditableListItem extends Component{
constructor(props){
super(props);
this.state = {
isEditing:false,
alias:this.props.listItem.alias
}
}
handleKeyPress(e){
if(e.key === 'Enter'){... | true |
6fc96366e5727f66e57409e5343d6729d04c8408 | JavaScript | nateconley/webpack-for-wordpress | /3 - Loader/src/index.js | UTF-8 | 98 | 3.21875 | 3 | [] | no_license | const greeting = ( name ) => {
return `Hello, ${ name }!`;
}
console.log( greeting( 'Nate' ) );
| true |
322602544175755a1b8bf53088a1e5cea690f721 | JavaScript | unisse-courses/s15-mp9 | /scripts/planner.js | UTF-8 | 417 | 2.703125 | 3 | [
"MIT"
] | permissive | $(document).ready(function(){
$("#add-to-planner-btn").click(function() {
var id = $(this).data('id');
$.ajax({
type: "POST",
url: "/add-to-planner/"+ id,
}).done(function (data) {
$('#add-to-planner-modal').modal('toggle');
})
... | true |
6b3edb24f21030bf0d0a4aa64a2121fee96d70c8 | JavaScript | natoparkway/RailsIssueList | /js/components/IssueSummary.react.js | UTF-8 | 791 | 2.609375 | 3 | [] | no_license | var React = require('react');
var AppConstants = require('../constants/AppConstants');
var IssueSummary = React.createClass({
_abridgeText: function(text) {
var abridgedText = '';
var charCount = 0;
if(!text) return "Summary Omitted";
if(text.length <= AppConstants.ISSUE_SUMMARY_CH_LIMIT) return text;
te... | true |
38b4b6022150a710173c1dccdab157c4c0790acf | JavaScript | Godzhang/freddie | /algorithm/code/math/addBinary.js | UTF-8 | 4,883 | 3.46875 | 3 | [] | no_license | // export default (a, b) => {
// let result = "";
// let carry = "0";
// let getLast = str => {
// let last = str.substring(str.length - 1);
// let newStr = str.slice(0, str.length - 1);
// return {
// newStr,
// last
// };
// };
// while (a.length && b.length) {
// let aLast... | true |
a64038c8bd8745d0d0bf9902c1743f3f27443eaa | JavaScript | CdHebert/benefactor | /public/javascript/your-list.js | UTF-8 | 2,561 | 2.96875 | 3 | [
"MIT"
] | permissive |
const handleUserListSearch = (lists) => {
const searchResult = text => lists.filter(list => list.toLowerCase().includes(text.toLowerCase()) && text.length > 0);
const renderResultEl = result => `
<div>
<i class="fa fa-search" style="color: #888; margin-right: 10px;">
</i><span... | true |
6d478b5f0767a43e9b42fc780ab24d1022d20bf7 | JavaScript | ELITA04/website | /src/components/Sortingalgos/InsertionSort.js | UTF-8 | 890 | 3.4375 | 3 | [] | no_license | export function insertionSortAnimations(array){
var aux_array = array.slice();
var animations = insertionSort(aux_array);
return animations;
}
function insertionSort(aux_array){
var animations = []
for(let i = 1; i < aux_array.length; i++){
var val = aux_array[i];
let j = i - 1... | true |
f04eed5136b53b0b00e67857b0e6a95b086617b7 | JavaScript | openGDA/gda-diamond | /configurations/i06-config/testing/DiamondFitnesse/files/javascript/fitnesse.js | UTF-8 | 910 | 3.09375 | 3 | [] | no_license |
var collapsableOpenCss = "collapsable";
var collapsableClosedCss = "hidden";
var collapsableOpenImg = "/files/images/collapsableOpen.gif";
var collapsableClosedImg = "/files/images/collapsableClosed.gif";
function toggleCollapsable(id)
{
var div = document.getElementById(id);
var img = document.getElementById("img"... | true |
84da7b74fdbd1f368f60447dc2b2292fdb79ac9b | JavaScript | ixtli/react-tile-game | /src/gl/map/map-chunk-renderer.js | UTF-8 | 9,662 | 2.796875 | 3 | [] | no_license | import Chunk from "./map-chunk";
import * as THREE from "three";
import {
CHUNK_PIXEL_LENGTH,
MAP_CHUNKS_HIGH,
MAP_CHUNKS_WIDE,
PRE_RENDER_CHUNKS
} from "../../config";
export default class ChunkRenderer {
/**
*
* @type {OrthographicCamera}
* @private
*/
_camera = new THREE.OrthographicCamera(
... | true |
b3cae4cffb10e6fb334d0f900607fd6d94f8dc39 | JavaScript | jpcarrascal/buildUTscrapper | /utscrapper.js | UTF-8 | 3,578 | 2.578125 | 3 | [] | no_license | console.log("Extension UTscraper loaded");
var win;
$(document).ready(function(){
$(window).on('hashchange', function() {
scrapeIt();
});
scrapeIt();
});
function scrapeIt()
{
// https://www.usertesting.com/dashboard#!/study/2668545/sessions
if( window.location.href.lastInd... | true |
7050ddec7a76bcb5a31ecee62d5d60fd6406c5db | JavaScript | jenniferfrankel/hypochondriapp | /test/spec/DurationUtilsSpec.js | UTF-8 | 3,073 | 2.828125 | 3 | [] | no_license | define(['jasmine-html', 'durationUtils', 'lib/lodash'], function(jasmine, utils, _) {
describe('Duration Utils', function() {
describe('Value to seconds conversion', function() {
it('No value should be no seconds', function() {
expect(utils.sliderValueToSeconds(0)).toEqual(0);
});
it('Less than 296 shou... | true |
ba1dc6452506c3de34e4656c5c7d321a4e7e0020 | JavaScript | frankmarmier/cohort-0320 | /1_module/1_week/3_day/js_intro/types.js | UTF-8 | 185 | 3.234375 | 3 | [] | no_license | // There are 7 + 1 data types
// string
"a string";
// boolean
true;
false -
// number
1,
1,
2,
3,
4;
// null => null
// undefined
// object
// symbol
// BigInt
| true |
3306a68ac7ab7cbc826819766910cc46a99e4ef1 | JavaScript | Kimmy6/Someofmycodes | /React/How to use useRef.js | UTF-8 | 431 | 2.71875 | 3 | [] | no_license | import React, {useRef} from 'react';
function App() {
const inputRef = useRef(null)
return (<div classname = "App">
<input ref = {inputRef}></input>
<button onClick = {(event) =>alert(`${inputRef.current.value}`)} />
{/* ref 오브젝트는 current라는 property를 가짐,
useRef에 의해 반환된 ref 객체가 변경되어도 컴포넌트는 재렌더링되지 않음 */}... | true |
a2a202117bc7398cbdf325dfa4a958dbfb0a3c18 | JavaScript | Mostek87/porno-imperium | /js/image-swap.js | UTF-8 | 674 | 2.671875 | 3 | [] | no_license |
$(".image-and-duration").mouseenter(function()
{
let id = $(this).attr("data-id");
$("#progressbar-" + id).css("display","block");
let gif = new Image();
gif.onload = function()
{
$("#progressbar-" + id).css("display","none");
};
gif.src = "/images/movie/gif/" + id + ".gi... | true |
6f5d3ffee811e435650e0e75e9add74ef589448a | JavaScript | yomna-hosny/ITI-project-Warsha | /js/local storge.js | UTF-8 | 594 | 2.65625 | 3 | [] | no_license | var nam = document.querySelector(".name");
var phone = document.querySelector(".telephone");
var city1 = document.querySelector(".city1");
var city2 = document.querySelector(".city2");
emergancyButton.onclick = function popUp() {
popup.style.display = "block";
};
submit.onclick = function remove() {
popup.style.d... | true |
e27c4ab9349d2ab150dcc3120128cb4e95a3c74a | JavaScript | Boussadia/osmscraper | /apps/frontend/static/frontend/js/models/product.js | UTF-8 | 2,158 | 2.546875 | 3 | [] | no_license | define([
'underscore',
'models/base',
],function(_, BaseModel){
var ProductModel = BaseModel.extend({
idAttribute: 'reference',
urlRoot: '/api/product/reference/',
defaults: {
'name': 'test',
'content_id': null
},
initialize: function(){
// Getting quantity in cart
this.vent.on('pro... | true |
cf3552faed3099b73b3cb7a06113061a774150dc | JavaScript | Jatin-Goyal5/Dev_PP | /Lec8_JsConcept/jsinnodejs/function.js | UTF-8 | 677 | 3.5625 | 4 | [] | no_license | // function spoon(s)
// {
// s = s.split(" ");
// console.log(s[1].charAt(0));
// let temp = s[0].charAt(0);
// s[0].replace(s[0].charAt(0),s[1].charAt(0))
// s[1].replace(temp,s[1].charAt(0))
// console.log(s);
// }
// spoon("kite flying");
let obj = {"concept":""};
console.log(JS... | true |
e51d8240b64814b1a9efc8a72052f0642af17288 | JavaScript | bespaleuni/labs | /js/2/qwerty2.js | UTF-8 | 412 | 3.875 | 4 | [] | no_license | let arr = [null];
let sum;
let max = 0;
for (let i = 0; i < 3; i++)
arr[i] = prompt('Введите массу: ');
let min = arr[0];
sum = null;
for (let i = 0; i < 3; i++)
sum += Number(arr[i]);
for (let i = 0; i < 3; i++)
if (arr[i] > max) max = arr[i];
for (let i = 0; i < 3; i++)
if (arr[i] < min) min = ar... | true |
7395c228367a8c0c2c9bb38c9e04d6e0c0e8dc09 | JavaScript | mentatcoat/ra-16-vasiliykonovalov | /src/services.js | UTF-8 | 6,404 | 2.828125 | 3 | [] | no_license | //The module provides services fetch functions
let services = {};
// ??? Как правильно поступить с файлом services.js - в нем вынесены функции для связи с сервером. Эти функции подложить в модули (тогда они будут дублироваться), или оставить в services.js?
// https://neto-api.herokuapp.com/bosa-noga
//!! нужно это... | true |
8e9c06a76e9b459645e3d1237d556a53000f5889 | JavaScript | reubengt/JS-30 | /countdowntimer/app.js | UTF-8 | 2,034 | 3.078125 | 3 | [] | no_license | let countdown;
const timerDisplay = document.querySelector('.display__time-left');
const endTime = document.querySelector('.display__end-time');
const buttons = document.querySelectorAll('[data-time]');
const reset = document.querySelector('#reset');
const beep = document.querySelector('audio');
function timer(seconds)... | true |
a9662318600488ec1aeef23dac29168f5e77b6df | JavaScript | snowleopardAlexa/javascript | /CLASSES/classes.js | UTF-8 | 1,283 | 4.59375 | 5 | [] | no_license | // ES6
// class changes get passed down
// classes aren't hoisted
// Two ways to declare classes: CLASS DECLARATION, CLASS EXPRESSION
class Car {
constructor(doors, engine, color) {
this.doors = doors;
this.engine = engine;
this.color = color;
}
carStats() {
return `This ca... | true |
85b8ee63e013016606c67639090b77daad005f38 | JavaScript | RamyaSubash/romenext | /els-romenext-rev3-web-admin-portal/src/main/webapp/assets/js/els/fns/display/formview/v3/libs/node/NodeUtils.js | UTF-8 | 37,644 | 2.734375 | 3 | [] | no_license | function NodeUtils() {
};
NodeUtils.loadNodes = function() {
var jsonData = {};
if (listTypeIds.length != 0 ){jsonData.typeIds = listTypeIds;}
if (listConnIds.length != 0 ){jsonData.connIds = listConnIds;}
console.log(jsonData);
var successFunction = function( data ) {
NodeUtils.buildNodeAndE... | true |
3c9f78bf87772f7f56b1ccdb3aeed339f548b765 | JavaScript | gao-gao-gao/project | /src/js/ajax.js | UTF-8 | 3,247 | 3.28125 | 3 | [] | no_license | /* eslint-disable no-unused-vars */
function ajax(options = {}) {
// 存储默认值
const requestOptions = {
type: "GET",
url: "",
params: {},
data: {},
header: {
"Content-Type": "application/json",
},
success: function () {},
error: function () {},
...options,
};
// 创建ajax对象
... | true |
8242208b09f71ef3539930563f0f7091a0d62225 | JavaScript | fifthbeatle/node3-weather-website | /src/utils/forecast.js | UTF-8 | 1,042 | 2.875 | 3 | [] | no_license | const request = require('request')
const forecast = (latitude, longitude, callback) => {
const url = 'https://api.darksky.net/forecast/8ce18223078c3f6d4aeedc839906aabe/'+latitude+','+longitude+'?units=si'
request({ url, json: true }, (error, { body }) => {
if(error) {
callback('Unable to c... | true |
50bd28ffcadf4fa31d6e253e2c33a5e682c307ab | JavaScript | freewind-demos/my-async-series-demo | /series.js | UTF-8 | 457 | 2.671875 | 3 | [] | no_license | function _series(tasks, callback, err, result) {
if (err) {
return callback(err, result);
}
if (tasks.length === 0) {
return callback(null, result);
}
const firstTask = tasks.shift()
firstTask(function(err, data) {
if (err) return _series([], callback, err, result);
result.push(data);
_s... | true |
285c0c3b7b51f137d0a7029fdec697b1ff0bb9e9 | JavaScript | tkottke90/bin-inventory | /src/ui/server/services/logger.service.js | UTF-8 | 1,838 | 2.53125 | 3 | [] | no_license | const path = require('path');
const { createLogger, format, transports } = require('winston');
const env = require('./environment.service');
// Configurable list of levels
const customList = [ 'fatal', 'error', 'warn', 'customer', 'info', 'http', 'verbose', 'debug', 'silly' ];
// Convert the list to an object for win... | true |
b9b87e09ecf2947dec0abd4f6b2c98c13c428ab6 | JavaScript | wonderley/SmashAid | /lambda/_index.js | UTF-8 | 5,657 | 2.875 | 3 | [
"MIT"
] | permissive | 'use strict';
const AWS = require('aws-sdk');
const s3 = new AWS.S3();
const AlexaCharacterMoveIntentHandler = require('AlexaCharacterMoveIntentHandler');
const buildSpeechletResponse = require('BuildSpeechletResponse');
/**
* This sample demonstrates a simple skill built with the Amazon Alexa Skills Kit.
* The Inte... | true |
685cdc2fcb8c1b96ce5c0b1e337ff1bac3e4eb34 | JavaScript | fanglinks/admin-vue | /src/common/util.js | UTF-8 | 729 | 2.734375 | 3 | [] | no_license | export default{
serialize(formData) {
const res = [];
for (const key of Object.keys(formData)) {
if (formData[key] instanceof Array) {
for (const value of formData[key]) {
res.push(`${key}=${window.encodeURIComponent(value)}`);
}
} else {
res.push(`${key}... | true |
72664022a0bc4164b33fbe539e8c5cef7e9f60a5 | JavaScript | tpatora/satel-integra-integration-protocol | /decoder.test.js | UTF-8 | 2,832 | 2.5625 | 3 | [
"MIT"
] | permissive | const Decoder = require("./decoder");
const assert = require("assert");
function verifyFrame(decoder, encodedFrame, expectedDecodedFrame) {
assert.deepEqual(
encodedFrame.map((value) => {
return decoder.addByte(value);
}),
[
...Array(encodedFrame.length - 1)
.fill(false)
.conc... | true |
800c3f0f16b98605a33a9f3a8f7d13ba7805f99c | JavaScript | johannessonemma/Soaps | /scripts2/scripts02.js | UTF-8 | 2,718 | 3.578125 | 4 | [] | no_license | var cart = [];
const cartJSON = localStorage.getItem("cart");
var totalPrice = 0;
const shipping = 10;
if (cartJSON !== null) {
cart = JSON.parse(cartJSON);
}
const removeProduct = function(id) {
const productIndex = cart.findIndex(function(product) {
return product.id === id;
});
if (productIndex > -1)... | true |
25a5efce9e4ca6c8838443b03048c939a26eb6e3 | JavaScript | ericoutinho/rlc | /js/lazzyload.js | UTF-8 | 973 | 3.125 | 3 | [] | no_license | /**
* Lazzy Load Effects script
* ---------------------------------------------
* Adiciona comportamento de lazzy load nos elementos do DOM com
* a classe '.lazzy' ativando as animações conforme as classes aplicadas.
* ---------------------------------------------
* 1. from-top: delocamento do topo com transição ... | true |
b17192cdf715ed598acf234533de1faeb80cb6b7 | JavaScript | edgarsegundo/object_state | /index.js | UTF-8 | 2,567 | 3.03125 | 3 | [
"MIT"
] | permissive | /*!
* object_state
* Copyright(c) 2021 Edgar R de Paula
* MIT Licensed
*/
'use strict'
module.exports.create = create
function create() {
return ObjectState();
}
function ObjectState() {
var _statePrevious = undefined;
var _stateCurrent = undefined;
var _states = [];
var _transitions = {};
... | true |