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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
73a54f496f6d7da35140adc7b68a26972c05b8d6 | JavaScript | LWu93/Leslies-Algo-Practice | /AlgoExpert/Recursion/nthFib.js | UTF-8 | 412 | 3.921875 | 4 | [] | no_license |
//Recursive solution
function getNthFib(n) {
if (n === 1) return 0;
if (n === 2) return 1;
return getNthFib(n - 1) + getNthFib(n - 2);
}
//DP solution
function getNthFib(n) {
if (n=== 1 || n === 0) return 0;
let firstTwo = [0, 1];
let counter = 3;
while (counter <= n) {
const fib = firstTwo[0] + firstTwo[... | true |
36ca4a708dde26f4603d9fd98cebeba7b22cff19 | JavaScript | Semiroundpizza8/StackchatTest | /src/NewMessageForm.js | UTF-8 | 808 | 2.515625 | 3 | [] | no_license | import React, { useState } from "react";
import { Form, Button } from "react-bootstrap";
const NewMessageForm = ({ name, socket }) => {
const [formMessage, setFormMessage] = useState("");
const handleFormSubmit = (event, formMessage) => {
event.preventDefault();
console.log("Sending message", socket);
... | true |
917950c6aea1f09d0bca0e5d894c3ba58ad1ac5f | JavaScript | Igor-Mayorov/newrepo | /Task 1/js/main.js | UTF-8 | 164 | 3.015625 | 3 | [] | no_license | let fullname = "Mayorov Igor";
alert(fullname);
console.log(fullname);
document.write(fullname);
let element = document.getElementById("box");
element.append(fullname); | true |
9734af5d7dfd6041be99cca502ac1277e5b71e3d | JavaScript | marioh5700/typeometer | /front-end/src/components/TypingInformation.jsx | UTF-8 | 1,168 | 2.515625 | 3 | [] | no_license | import React, { Component } from 'react';
class TypingInformation extends Component {
constructor(props){
super(props);
this.resetEvent = this.resetEvent.bind(this);
}
resetEvent(){
this.props.resetTimer();
}
render() {
let seconds = this.props.seconds;
... | true |
8b21e8da14e7af76e92f8ad150f1ee5dd8fe2bb7 | JavaScript | Danimal-63/nine-lives | /keyboardControl.js | UTF-8 | 2,994 | 2.828125 | 3 | [] | no_license | /**
* Keydown event listener runs every time ANY key is pressed!
*
*/
var CONTROLS = {
cat : {
up : false,
down : false,
left : false,
right : false,
instaDeath: false,
},
player2: {
up: false,
down: false,
left: false,
right: false,
instaDeath: false,
}
};
//this ma... | true |
1057cfb81b986a395986271f4f0c5225a1607c19 | JavaScript | mtyra321/WDD-330 | /Todo/main.js | UTF-8 | 4,605 | 3.390625 | 3 | [] | no_license | //add
//remove
//complete
//sort
//due date
//write to data store
//save to data store
//remove from data store
//display
import { qs } from './utilities.js';
const myTodo = new Todo("#todoList", "todos");
document.getElementById("Task").addEventListener("keydown", function(e) {
if (e.key === "Enter") { //che... | true |
4f46cacdd24422e1f9b47c94ebbbf35a6c1deeac | JavaScript | SerdilMordeniz/universaliqtest | /client/src/routes/Checkout.js | UTF-8 | 2,636 | 2.671875 | 3 | [] | no_license | import React from 'react'
import { useHistory } from 'react-router-dom'
import CheckoutForm from '../components/checkout/CheckoutForm'
function Checkout() {
let history = useHistory()
const amount = history.location.state.convertedCurrencyAmount;
const currency = history.location.state.currency;
const... | true |
19d2ddbc542fb9c352b98f91662c1501958fa8bc | JavaScript | suraj077/practice-Js | /js/js/js11.js | UTF-8 | 1,507 | 2.875 | 3 | [] | no_license | console.log('Jai Mahakal')
// let element = document.createElement('li');
// // Add a class name to the li element
// element.className = 'baba1';
// element.id = 'newli';
// element.setAttribute('title', 'mahadev');
// // innertext is for simpal text
// element.innerText = 'Hello this is created by Maha... | true |
6285df15d7b1173c317997ccee7a51288765c222 | JavaScript | parameter-pollution/webgl-ingress | /js/myOrbit.js | UTF-8 | 2,858 | 3.125 | 3 | [] | no_license | /*
@coder paremeter-pollution / https://github.com/parameter-pollution/
*/
myOrbit = function ( camera, center, distance, clock ) {
this.camera = camera;
this.center = center;
this.clock = clock;
this.autoRotate = true;
this.autoRotateSpeed = 0.2; //radiants per millisecond
this.spherical = {};
this.spher... | true |
28e7d195d5ec179d609c302ffacbfecf1ea7eef3 | JavaScript | samikatz/is-plainish-object | /is-plainish-object.mjs | UTF-8 | 1,426 | 3.078125 | 3 | [
"MIT"
] | permissive |
const ObjectPrototype = Object.prototype;
const getPrototypeOf = Object.getPrototypeOf;
const toStringCat = Function.prototype.call.bind(ObjectPrototype.toString);
const cache = new WeakMap();
export function isPlainishObject(obj) {
if (!obj || (typeof obj !== 'object')) {
return false;
}
cons... | true |
319f5113ed05cdc2f79b29672f794a92d20b7814 | JavaScript | Pnickolas1/Classwork | /11.1-Javascript_Contruct_p1/E_ConstructorPIII.js | UTF-8 | 827 | 3.8125 | 4 | [] | no_license |
function DigitalPal(hungry, sleepy, bored,age){
this.hungry = false;
this.sleepy = false;
this.bored = true;
this.age = 0;
// FIRST METHOD
this.feed = function(){
if(hungry == true){
console.log('that was yummy')
this.hungry = false;
this.sleepy = true;
} else {
console.log('no thanks, I\'m full'... | true |
961c37c693d36334028c894cc2c07204a41e5717 | JavaScript | alibaba/tofu.js | /examples/lib/boids.js/src/core/boid.js | UTF-8 | 5,420 | 2.765625 | 3 | [
"MIT"
] | permissive | import { Vector3, Euler } from 'three';
// import CubeWall from './walls/cubewall';
export default function Boid(options = {}) {
const {
position = new Vector3(),
rotation = new Euler(),
velocity = new Vector3(),
goal = null,
worldWall = null,
neighborhoodRadius = 50,
maxSpeed = 4,
ma... | true |
44355e01b36bbd87686661b9815ba18e3cfd7979 | JavaScript | StolpnerA/js--base-course | /06/ht/ginkomix/app/js/map.js | UTF-8 | 6,225 | 2.515625 | 3 | [] | no_license | import {Memory} from "./memory";
import Queries from "./queries";
import {eb} from "./eventBus";
export default class Map extends Memory(Queries) {
constructor(key) {
super();
this.yaMap;
this.createMapFlag = false;
var self = this;
this.key = key;
this.enterPress(... | true |
24716eaf295499a8decc494f9fc80ab4f2db0202 | JavaScript | maxdavid/Redux-Todo | /todo/src/reducers/index.js | UTF-8 | 1,324 | 2.9375 | 3 | [] | no_license | import { ADD_TODO, TOGGLE_TODO, DELETE_TODO } from '../actionTypes';
const initialState = {
todos: JSON.parse(localStorage.getItem('todos')) || []
};
const emptyTodo = { todo: '', id: -1, complete: false };
const setTodosLocalStorage = todoArray => {
localStorage.setItem('todos', JSON.stringify(todoArray));
};
... | true |
3cd1c21ad74af4e5b90896a42c83b2de9a1134ac | JavaScript | Codepath-capstone-ecommerce/ecommerce | /backend/models/user.js | UTF-8 | 6,947 | 2.671875 | 3 | [] | no_license | const bcrypt = require("bcrypt")
const { BCRYPT_WORK_FACTOR } = require("../config")
const db = require("../db")
const { BadRequestError, UnauthorizedError } = require("../utils/errors")
class User {
static makePublicUser(user) {
return {
id: user.id,
first_name: user.first_name,
last_name:user... | true |
415711c4c22f279173caeae7fe1a0f1bb88baacc | JavaScript | TheNova22/algorithms | /leetcode/JavaScript/No236.lowest-common-ancestor-of-a-binary-tree.js | UTF-8 | 3,807 | 3.796875 | 4 | [] | no_license | /**
* Difficulty:
* Medium
*
* Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.
* According to the definition of LCA on Wikipedia:
* “The lowest common ancestor is defined between two nodes v and w as the lowest node in T that has both v and w as descendants (where we all... | true |
01e7b0997058f8a86e9192b1f8a5b0acf5cba1ba | JavaScript | DhruvPrakash/EDIS-ASSMT | /app/routes.js | UTF-8 | 2,058 | 2.734375 | 3 | [] | no_license | let auth = (req, res, next) => {
if (req.isAuthenticated()) {
return next();
}
res.json({"message": "You are not currently logged in"});
}
let hasError = (num1, num2, oper) => {
let err = false;
if(Number.isInteger(num1) && Number.isInteger(num2)) {
err = (num2 === 0 && oper === 'divide') ? true : false;
} ... | true |
db4717af672f37b08687a782ce7fc6f68b1d21ac | JavaScript | ChrisJeamme/ChrisJeamme.github.io | /editdistance/branch_bound.js | UTF-8 | 2,518 | 3.53125 | 4 | [] | no_license | var best_ed_so_far
var best_path_so_far
function branch_bound(str1, str2)
{
var timerStart = new Date();
best_ed_so_far = Number.MAX_SAFE_INTEGER; //We initialize the best solution each time we call the algo
best_path_so_far = "";
branch_bound_bis(str1, str2, 0, ""); //On the first call of the recursi... | true |
63ef14ab7186cd3e5cb39b207da118d15eb3882a | JavaScript | std08010/javascript-portfolio | /concepts/functional_programming/purity/impure/example2.js | UTF-8 | 311 | 3.71875 | 4 | [] | no_license | const frederick = {
name: "Frederick Douglass",
canRead: false,
canWrite: false,
};
/**
* changes a variable outside its scope by being mutable.
*/
const selfEducate = (person) => {
person.canRead = true;
person.canWrite = true;
return person;
};
console.log(selfEducate(frederick));
console.log(frederick... | true |
e159f202ed46fca4d9267ad4792d724542165d37 | JavaScript | GordonRudman/previous.gordonrudman.com | /js/svg.js | UTF-8 | 1,290 | 2.59375 | 3 | [
"MIT"
] | permissive | const svgs=document.getElementById("svg-container").children;
const UA=window.navigator.userAgent;
const ua=(UA.indexOf('rv:11')+UA.indexOf('Firefox'))>=0;
const svgcount=document.getElementById('svg-container').childElementCount;
var styleArr=[];
var heightArr=[];
var navBar=document.getElementById('nav');
var ... | true |
10b52ef98ca48e0d9680b744fcca0f98c8b4431f | JavaScript | zacharydub/react-udemy | /redux/redux-3-toolkit/src/store/index-2.js | UTF-8 | 1,301 | 2.640625 | 3 | [] | no_license | //now working with multiple slices so we can deal with auth
import { createSlice, configureStore } from "@reduxjs/toolkit"; //createSlice prepared slice of global state, and we can separate them as we wish
const initialCounterState = { counter: 0, showCounter: true };
const counterSlice = createSlice({
name: "someN... | true |
225a4114c7151de53f01527dac1753fd1db7c744 | JavaScript | uptick/react-object-list | /src/filters/types/Month.js | UTF-8 | 3,502 | 3.0625 | 3 | [
"MIT"
] | permissive | import React from 'react'
import PropTypes from 'prop-types'
import moment from 'moment'
import MonthPicker from 'react-month-picker'
/**
* Filter input used to pass month and year values
*/
class Month extends React.Component {
static propTypes = {
/** Current filter value */
value: PropTypes.instanceOf(... | true |
77bcd414f07b9e92adcb3275d7a4d4db2bb8f1ba | JavaScript | CasingOne/js | /src/exercise-unit-02/code/reverse.js | UTF-8 | 1,202 | 4.5625 | 5 | [] | no_license | /*
challenges - programming_basics_reverse_string
reverse.js
Реализуйте и экспортируйте функцию по умолчанию, которая переворачивает строку задом наперед, используя рекурсию.
Попробуйте решить эту задачу, используя рекурсивный процесс. Для этого вам понадобится метод slice().
Например:
import reverse from './reverse... | true |
d384689b7d32713262dc121e37c4dbd53057bf3b | JavaScript | elmoknit/Seed-vue-webpack-karma-chaiAsPromised | /src/module/auth/AuthService.js | UTF-8 | 1,234 | 2.703125 | 3 | [] | no_license | import { QUERY_LOGIN } from './queries';
import EmptyEmailError from './exception/EmptyEmailError';
import EmptyPasswordError from './exception/EmptyPasswordError';
export default class AuthService {
constructor (client) {
this.client = client;
}
validateForm (email, password) {
if (email === '') {
... | true |
a0cc32981f758792bff37ffc50e479dc6cf4bcdf | JavaScript | LucasVieiraa/StudyFiles | /FUNCOES/Obj-1classe.js | UTF-8 | 1,019 | 4.03125 | 4 | [] | no_license | //------------------------------------------------------------
//Function
function fn(cb){
console.log('executar acao de callback');
console.log(typeof cb);
//if(typeof cb === 'function'){cb();}
typeof cb === 'function' && cb();
}
function callback(){
console.log('funcao passada por parametro');
}
fn(c... | true |
d8843eff953547bc53f264dc5ac9dc5d2ebb9452 | JavaScript | javierrv/nodejs-design-patterns | /ch04/_09/009.js | UTF-8 | 258 | 2.71875 | 3 | [] | no_license | function spiderLinks(currentUrl, body, nesting) {
if (nesting === 0) {
return Promise.resolve();
}
const links = utilities.getPageLinks(currentUrl, body);
const promises = links.map(link => spider(link, nesting - 1));
return Promise.all(promises);
} | true |
19634a063d4c324664e45ebfdf088dc103955159 | JavaScript | AlejandroGarciaHub/EnciclopediaMultimedia | /renderer.js | UTF-8 | 694 | 2.578125 | 3 | [
"LicenseRef-scancode-public-domain",
"CC0-1.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | // This file is required by the index.html file and will
// be executed in the renderer process for that window.
// All of the Node.js APIs are available in this process.
/*
const BrowserWindow = require('electron').remote.BrowserWindow
const path = require('path')
const url = require('url')
const ventanaAnimacion = ... | true |
52d9a1f661de989ff6154a6c9b12145268166394 | JavaScript | shafali03/JavaScript_Guide | /Destructuring/script.js | UTF-8 | 1,677 | 4.4375 | 4 | [] | no_license | const alphabet = ['A', 'B', 'C', 'D', 'E', 'F']
const numbers = ['1', '2', '3', '4', '5', '6']
const [a, b, ...rest] = alphabet
const newArray = alphabet.concat(numbers)
// Destructuring works by taking the element you want to structure on and put it on the right side of the equal like the example above.
console... | true |
314c6e77ff4e195c4795d650fe31671627a31174 | JavaScript | piacz/FoodieApp | /api/src/routes/index.js | UTF-8 | 1,619 | 2.765625 | 3 | [] | no_license | const { Router } = require('express');
// Importar todos los routers;
// Ejemplo: const authRouter = require('./auth.js');
const recipesRouter = require('./recipes.js');
const dietsRouter = require('./diets.js');
const { Recipe, Diet } = require('../db.js');
// const recipeRouter = require('./recipe.js');
const { Seque... | true |
cfdb2b3a29f17617b3467cfce2ae3cc1b7aa312a | JavaScript | Gonzagadavid/CSV-To-JSON | /js/views/erroMessage.js | UTF-8 | 740 | 2.734375 | 3 | [] | no_license | import createHtmlElement from '../functions/createHtmlElement.js';
import displayNone from '../functions/displayNone.js';
export default function erroMessage(message) {
const content = document.getElementById('content');
const container = createHtmlElement('div', { className: 'erro-message' });
const title = cre... | true |
b1e06d5f839b636d62a28f96ca21cfdf305720a2 | JavaScript | melnikaite/app-generator-vue | /templates/test_template_old.js | UTF-8 | 5,579 | 2.640625 | 3 | [
"MIT"
] | permissive | var EntitynameContract = artifacts.require("./EntitynameContract.sol");
contract('EntitynameContract', function(accounts) {
it("should assert true", async function() {
var addressRegistry;
var revertFound;
var entity01 = "entity0.1";
var entity02 = "entity0.2";
var entity11 = "entity1.1";
va... | true |
ec46f2c4808c0bec258f7ebe2d4d92de2deace0f | JavaScript | zfair665/fabricate-diem | /webapp/static/js/fabric.js | UTF-8 | 1,007 | 2.609375 | 3 | [] | no_license | /* global THREE */
goog.provide('diem.Fabric');
/**
* The physical properties of a piece of fabric.
* @param {object} storageFabric
* @constructor
* @private
*/
diem.Fabric = function(storageFabric) {
this.mass_ = .1;
this.gravity_ = new THREE.Vector3(
0, - diem.Fabric.GRAVITY, 0).multiplyScalar(this.mas... | true |
325bd6dfea51512dcd4ee3d63d78367efcc6f75a | JavaScript | AustinBurns/invoice | /src/components/memo-field.jsx | UTF-8 | 940 | 2.625 | 3 | [
"MIT"
] | permissive | import React, { useState, useEffect } from 'react';
import { TextField } from '@material-ui/core';
export const MemoField = ({ memo, dispatch }) => {
// Keep track of all changes to the value locally, and only update the value
// of the memo on the invoice when the user has finished typing and left the input
con... | true |
5848b31bb1f99fa93abc2afc4fbd079a6951f436 | JavaScript | TomasHubelbauer/html-responsive-table | /calculateBreakpoints5.js | UTF-8 | 4,499 | 2.578125 | 3 | [] | no_license | function* getBreakpoints(columns, deadspaces) {
const combos = [];
function addCombo(columns) {
const ratio = columns.reduce((a, c) => a + c.ratio, 0);
const sizes = columns.map(c => (ratio / c.ratio) * c.limit);
const table = Math.max(...sizes);
const deadspace = deadspaces(table);
const viewp... | true |
4272534cac3c713c5c88037d355f54a6c477918f | JavaScript | Lasynsec/codesjavascript | /codes/matchEnd.js | UTF-8 | 903 | 3.9375 | 4 | [] | no_license | /**
Check if a string (first argument) ends with the given target string (second argument).
*/
function end(str, target)
{
var answer = false;
if(str.match(/\s/g)) //Si le string contient des espaces.
{
var stringArray = str.split(' '); //On transforme le string en tableau.
var lastWord = stringArray[s... | true |
3618f3cc127e1f56efb32040d2a1a8931af718db | JavaScript | HebaBesheer/Trufla | /dictionary.js | UTF-8 | 237 | 2.828125 | 3 | [] | no_license | module.exports = class Dictionary
{
constructor(key, value)
{
this.key = key;
this.value = value;
}
toString()
{
return this.key.toString() + ' : ' + this.value.toString();
}
} | true |
64bb78a3c16e99eb563420408e5b6e0b3fc20c70 | JavaScript | TamyUTF/DesafioFL-HTML-CSS | /js/home.js | UTF-8 | 712 | 2.640625 | 3 | [] | no_license | window.addEventListener('click', outsideClick); //para saber qndo clicar fora da modal
function fechaSlideMenu(){
document.getElementById('sidemenu').style.width='0';
document.getElementById('container').style.marginLeft='0';
}
function abreSlideMenu(){
document.getElementById('sidemenu').style.width='270p... | true |
393f74655d00fcd2c79185fc894d9c54351a0226 | JavaScript | rferreyrag/DW2 | /Carlos Jonathan Lopez Palma - Latter/latter/JS/revisar.js | UTF-8 | 12,192 | 2.609375 | 3 | [] | no_license | function soloLetras(e) {
key = e.keyCode || e.which;
tecla = String.fromCharCode(key).toLowerCase();
letras = " áéíóúabcdefghijklmnñopqrstuvwxyz";
especiales = "8-37-39-46";
tecla_especial = false;
for (var i in especiales) {
if (key == especiales[i]) {
tecla_especial = true... | true |
c23b18d6578e631bb19f0df3ba2704ea8724bed8 | JavaScript | siteslave/SmileHealth | /app/js/filter.js | UTF-8 | 809 | 2.640625 | 3 | [] | no_license | // Application filters
(function (window, angular) {
angular.module('app.filter', [])
// Convert system date to thai date
.filter('toThaiDate', function () {
return function (date) {
var year = moment(date).get('year') + 543;
return moment(date).format('DD/MM/') + year;
}
})
... | true |
0698bbc47db7d63d1deb1a6fc5538b4fa779bb47 | JavaScript | marahghanem/CountryStates | /new-frontend/src/Dropdown.js | UTF-8 | 1,390 | 3.078125 | 3 | [] | no_license | import React from 'react';
export class Dropdown extends React.Component{
render() {
let itemList = this.props.items.length > 0
&& this.props.items.map((item) => {
return (
<option key={item.id} value={item.code}>{item.name}</option>
)
}, this);
return(
... | true |
b9acefc71d5c425780f014fd9aac0c2181c41528 | JavaScript | TarCode/RedAndGreen | /tdd_test.js | UTF-8 | 614 | 3.0625 | 3 | [] | no_license |
TestMyCode.run("testing hello world function", function(assert){
var result = helloWorld();
// is the result as we expected?
assert.equals("hello world!", result, "testing hello world function");
});
TestMyCode.run("testing hello Mars function", function(assert){
var result = helloMars();
... | true |
cb7996becda81b69a0f1ac70f349867307892c4a | JavaScript | SlavaPetrushiin/corporate-chat | /client/src/store/reducers/messages.js | UTF-8 | 620 | 2.515625 | 3 | [] | no_license | import {NEW_MESSAGES} from "../actions/actionTypes";
const initialState = [
{
userId: 1,
name: 'Slava',
message: 'Привет!',
},
{
userId: 2,
name: 'Ivan1988',
message: 'Привет Коля!'
}
];
export const messagesReducer = (state = initialState, action) => {
... | true |
d9be43646fd62633e6c7c8a82f8fe9cede45d17c | JavaScript | nicolas-mosch/DiscoPoP_Visualizer | /js/general/generalFunctions.js | UTF-8 | 1,475 | 3.390625 | 3 | [] | no_license | /**
* A module containing some general, independent functions
* @module generalFunctions
*/
module.exports = {
/**
* Makes a more readable data-number
* @param {number} bytes The number to be changed
* @param {boolean} si Defines whether the given number shall be considered as bytes (true) or bits... | true |
30159a80c382251a1271d306ac1797a5dd476165 | JavaScript | djordjeandrejevic/JavaScript-Koans | /koans/dont-peek/functions-2/2-module.js | UTF-8 | 655 | 2.984375 | 3 | [] | no_license | /*Solution 1*/
var colorLookup = (function () {
var lookupMap = {
'red': 0xFF0000,
'green': 0x00FF00,
'blue': 0x0000FF
};
return function (colorString) {
return lookupMap[colorString];
};
}());
/*Solution 2*/
(function () {
var lookupMap = {
'red': 0xFF0000,
'green': 0x00FF00,
'blu... | true |
0b426a3ec0386374eec2ea97f6eaaaca0c3af972 | JavaScript | ovidiubute/metricador | /test/histogram.spec.js | UTF-8 | 4,235 | 2.75 | 3 | [
"MIT"
] | permissive | /*
* The MIT License (MIT)
* Copyright (c) 2015 Ovidiu Bute ovidiu.bute@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
* and associated documentation files (the "Software"), to deal in the Software without
* restriction, including without limitation th... | true |
dc3fe3e5ec25f6f27efca61712c9485df6f5a677 | JavaScript | AldoCasareto/Tours-REACT | /src/App.jsx | UTF-8 | 1,090 | 2.96875 | 3 | [] | no_license | import React, { useState, useEffect } from 'react';
import Loading from './Loading';
import Tours from './Tours';
// ATTENTION!!!!!!!!!!
// I SWITCHED TO PERMANENT DOMAIN
const url = 'https://course-api.com/react-tours-project';
function App() {
const [tours, setTours] = useState([]);
const [loading, setLoading] = ... | true |
308b26f31d0402bfe1c65183511cea32f18e7417 | JavaScript | xsamynox/SCL014-social-network | /src/lib/views/templateLogin.js | UTF-8 | 1,786 | 2.6875 | 3 | [] | no_license |
export const login = () => {
const divLogin = document.createElement('div');
const viewLogin = `<div class="contenedor">
<form id="login-form" class="formulario">
<div>
<img class="logo" src="./img/iconos/LOGO.jpg">
</div>
<h1>EASYCOOK</h1>
<div class="">
<p>Inicia sesi... | true |
121ec6f5579819aec4362df7b3c43815ae44c49f | JavaScript | cocofemi/React_Course_Expensify_App | /src/playground/destructuring.js | UTF-8 | 878 | 3.390625 | 3 | [] | no_license | // const person = {
// name: 'Femi',
// age: 24,
// location:{
// city: 'london',
// temp: 17
// }
// }
// const {name: firstName = 'Anonymous', age} = person;
// console.log(`${firstName} is ${age}`);
// const {city, temp: temperature} = person.location;
// if (city && temperature) {
// console.log(`It's $... | true |
ebe03df32cf9e3b77febfc04426d9767ce306335 | JavaScript | nkleinmann/Algorithms | /Topic-7/01-swap-case/Unsolved/swap-case.js | UTF-8 | 521 | 4.59375 | 5 | [] | no_license | // Write code to create a function takes a string and returns the string with all of the letter cases swapped
var swapCase = function(str) {
// console.log(`original: ${str}`);
let finalString = "";
for (let i=0; i<str.length; i++) {
let letter = str[i];
if (letter === letter.toUpperCas... | true |
bb68b6c33ce96809a818b5c12c5d808a18881163 | JavaScript | devitito/mymindmeteo | /api/policies/replaceSpaceByAND.js | UTF-8 | 448 | 2.875 | 3 | [] | no_license | /**
* Decode filter query parameter
* Replace spaces by ' AND '
* Delete filter query param if == ''
*/
module.exports = function(req, res, ok) {
var queryFilter = req.query.filter;
if (queryFilter !== undefined) {
if (queryFilter == '') {
//Delete filter parameter
req.query.filter = undefined;
return... | true |
dfc9a384d35b3398d9b83dd50395b003c7f9aafe | JavaScript | NickTheFerret/TicTacToe | /app.js | UTF-8 | 3,035 | 3.875 | 4 | [] | no_license | let cells = document.querySelectorAll('.row > div');
let player = 'X'
let turnCount = 0
console.log(cells)
for (let i = 0; i < cells.length; i++) {
cells[i].addEventListener('click', cellClicked);
}
function cellClicked() {
if (event.target.textContent == '') {
event.target.textContent = player;
... | true |
ab8a0473d6bb94270f7c552b01484144a73c483a | JavaScript | nehalicious/syncvr | /src/Components/RequestBox.js | UTF-8 | 1,007 | 2.578125 | 3 | [] | no_license | import React from 'react';
import {Row, Container} from "react-bootstrap";
import SimpleDateTime from "react-simple-timestamp-to-date";
/**
* Container to display a single api requeszt
* @param props : props.value: value of fibonacci number
* props.timestamp: Access tine of the fibonacci number
*/
export default f... | true |
53abef384363cb42b8237e3b4e3d8586b265c1b2 | JavaScript | tansaku/AgileVentures | /features/step_definitions/basic_steps.js | UTF-8 | 4,362 | 2.546875 | 3 | [
"MIT"
] | permissive |
var basicStepDefinitionsWrapper = function () {
this.World = require("../support/world.js").World; // overwrite default World constructor
this.Given(/^I am on the home page$/, function(callback) {
this.visit('http://localhost:8000/app/index.html', callback);
});
this.Then(/^the title should be "([^"]*)"... | true |
6871014d8b95ea8028997f5e52e2682d934fa198 | JavaScript | faroukelabady/fyyur | /static/js/script.js | UTF-8 | 998 | 2.9375 | 3 | [] | no_license | window.parseISOString = function parseISOString(s) {
var b = s.split(/\D+/);
return new Date(Date.UTC(b[0], --b[1], b[2], b[3], b[4], b[5], b[6]));
};
const deleteVenues = document.querySelectorAll('.delete-venue');
for (let deleteBtn of deleteVenues) {
deleteBtn.onclick = function (e) {
const venueId = e.t... | true |
5ff1b308f1ab283c79124ec58ba6ca23641fc45b | JavaScript | jorge-gs/biblioteca | /asesoria/paso-3.js | UTF-8 | 4,919 | 2.78125 | 3 | [] | no_license | let p3Nombre;
let p3Apellido;
let p3Cuenta;
let p3Carrera;
let p3Clases;
let p3Aceptar;
let p3Cancelar;
let p3restablecer = false;
function cargarP3() {
p3Nombre = document.getElementById('p3-nombre');
p3Cuenta = document.getElementById('p3-cuenta');
p3Carrera = document.getElementById('p3-carrera');
p... | true |
d7b06ce389bfdc0dc3429b1072662fce92302a8f | JavaScript | twlite/simple-typing-game | /script.js | UTF-8 | 3,046 | 3.453125 | 3 | [
"MIT"
] | permissive | const timerElm = document.getElementById("timer");
const txtElm = document.getElementById("text");
const inputElm = document.getElementById("input");
const nextBtn = document.getElementById("nextButton");
const API = "https://api.quotable.io/random";
let TIMER;
let textIndex = 0;
function getQuote() {
ret... | true |
d784c76a3c7b1786d4ede5c8949e064898299b94 | JavaScript | tmcintire/swingdev | /src/features/data/reducer.js | UTF-8 | 1,242 | 2.515625 | 3 | [] | no_license | import { combineReducers } from 'redux';
import * as actionTypes from './actions';
const user = (state = [], action) => {
switch (action.type) {
case actionTypes.SET_USER:
return {
...state,
email: action.user.email,
id: action.user.uid,
};
case actionTypes.UNSE... | true |
a651e5c32a1c5e92798edb394dff7a7975a954c1 | JavaScript | rawrat/eos-poc | /web/vote.js | UTF-8 | 2,184 | 2.734375 | 3 | [] | no_license |
var question_id;
function load_data() {
// id of the question
question_id = getUrlParameter('id');
eos.getTableRows({json:true, scope: account, code: contract, table: 'topic', table_key: question_id, limit:100}).then(res => {
// filtering by table_key doesn't seem to work in current master, so we'... | true |
7ba37351fcd4a8e3c47c181f10870b96450b4dc8 | JavaScript | xUser5000/pingo-server | /src/service/post/createPost/create.service.js | UTF-8 | 1,891 | 2.734375 | 3 | [] | no_license | const { createPostSchema } = require("./create.schema");
const { InvalidInputError } = require("../../../error/InvalidInputError");
const { ForbiddenError } = require("../../../error/ForbiddenError");
const { NotFoundError } = require("../../../error/NotFoundError");
const { validate } = require("../../../util/valida... | true |
a580c01aa886bf3478ff632d1dffb59bfe3e0774 | JavaScript | vinaayy/mumbai-metro | /nav.js | UTF-8 | 2,230 | 2.671875 | 3 | [] | no_license | function top_page() {
$("html, body").animate({ scrollTop: 0 }, 500);
}
window.onscroll = function() {myFunction()};
function myFunction() {
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
document.getElementById("navbar").style.backgroundColor = "#fff";
... | true |
20b249ea05e3a85a6f7bdf6b5a05be10e3e7d470 | JavaScript | sabrinachowzbl/gaProject4Web | /public/gameJs/bot.js | UTF-8 | 20,607 | 2.765625 | 3 | [] | no_license | var bots = {};
var botCheckInt;
var previousPlay;
var counter = 0;
var target;
var botsWanted = 30;
// var idInRadius = [];
function botsLeftNumber () {
var botsNum = 0;
var values = Object.values(bots);
console.log('values: ' + values);
for(var i=0; i<values; i++) {
if(values[i] > 0) {
... | true |
0d1752294ff8dae6cb40a963c32c879923529bfb | JavaScript | sloane1965/LFGFinder | /src/utils/api.js | UTF-8 | 344 | 2.546875 | 3 | [] | no_license | import React from 'react';
import axios from 'axios';
var axios = require('axios');
module.exports = {
fetchPopularRepos: function (term) {
varEncodedURI = window.encodeURI(`http://www.reddit.com/r/lfg.json`);
return axios.get(encodeURI)
.then(function (response) {
return response.data.items;
});
}
}
f... | true |
a4eabb8e5a49258dd13957b25ec4f4d6311f0bdf | JavaScript | evantk91/skip-i-delete-j | /index.js | UTF-8 | 984 | 3.15625 | 3 | [] | no_license | const { LinkedList, ListNode, createLinkedList, toArray } = require('./linkedLists');
function skipideletej(list, i, j) {
//Given the head of a linked list and two integers, i and j. You have to retain the first i nodes and then delete the next j nodes.
//Continue doing so until the end of the linked list.
... | true |
4778b95f2f078867f6e8f2ea5855117e0e1d688a | JavaScript | katewindy/refactoru-ajaxcountries | /public/javascripts/main.js | UTF-8 | 406 | 2.5625 | 3 | [] | no_license | // CLIENT SIDE JS
console.log('TEST');
$(document).on('ready', function(){
$(document).on('click', '#loadCountries', function(){
$.get('/countries', {}, function(responseData, err){
// console.log('err:', err);
// console.log('response:',responseData);
for (var i = 0; i < responseData.length; i++){
$... | true |
b601cc910a30342bfa4aea058573edfa3bb1abd3 | JavaScript | vasanthivk/YorkTest | /Source/apps/Customer/FoodAdvisr7Oct/www/js/map.js | UTF-8 | 1,789 | 2.625 | 3 | [
"MIT"
] | permissive |
function myMap(latitude, longitude, searchval) {
//alert("From map");
var mapOptions = {
center: new google.maps.LatLng(latitude, longitude),
zoom: 10,
mapTypeId: google.maps.MapTypeId.TERRAIN
}
var map = new google.maps.Map(document.getElementById("map"), mapOptions);
var marker = new google.maps.Marker(... | true |
dd2bb248ba7e375d167767a1274d2781caaa8eda | JavaScript | erlanggajatikusuma/ark-tugas | /week2/w2t1task3.js | UTF-8 | 522 | 3.375 | 3 | [] | no_license | const seleksiNilai = (num1, num2, arr) => {
if(num1 < num2 && arr.length > 5 ) {
const data = arr.filter(item => {
if(num1 < item && item <= num2) {
return item;
}
});
const dataSort = data.sort((a, b) => a-b);
console.log(dataSort);
} else... | true |
3493aa3745a1cda63e1c039cfe6325103a4e03e8 | JavaScript | SmartContractFactory/smartcontractfactory.github.io | /js/web3/contract_interactors/erc20Interactor.js | UTF-8 | 13,381 | 3.765625 | 4 | [] | no_license | /**
* Allows the user to mint new tokens to a specified address if and only if the user is the
* owner of the ERC20 token contract.
**/
function mintTokens() {
//Check if the erc20Instance is defined.
if(erc20InstanceDefined()) {
//Assign the recipient to a variable and then check if it is the empty string. If
... | true |
d9917bb3952c5ed3aab53f2fec8af28aa1b8e5f7 | JavaScript | ofojichigozie/SchoolInfoManagement | /routes/deletes.js | UTF-8 | 803 | 2.515625 | 3 | [] | no_license | var express = require('express');
var router = express.Router();
var sqlite3 = require("sqlite3").verbose();
/* GET users listing. */
router.get('/', function(req, res, next) {
//Get who is to be deleted
var sn = req.query.sn;
var fn = req.query.fn;
//Connect to database
var database = new sqlite3.Database("Datab... | true |
397f993239c0a3e8337028b90e9ed8b208886efc | JavaScript | sbkwgh/simple-blog | /static/js/router.js | UTF-8 | 4,210 | 2.546875 | 3 | [] | no_license | var Router = function(templateContainer, menuBar) {
var self = this;
this.menuBar = menuBar;
this.routes = {};
this.templateContainer = templateContainer;
this.getTemplateNameHTML = function() {
var routeName = (location.hash.slice(1) ? location.hash.slice(1) : 'index');
if(routeName.slice(-1) === '/') rou... | true |
1e826767d48abaab97ce1cd1596c3f3f46ed32ca | JavaScript | tminot/europeanDataVisualisation | /modules/features/mmw_charts/assets/js/mainCategoriesSingleSelect.js | UTF-8 | 1,058 | 2.625 | 3 | [] | no_license | /**
* @file
*/
function updateChart(){
jQuery(document).ready(function ($) {
var year = $('#year').val();
var countriesValues = [];
$('#country-select input:not(#all-countries):checked').each(function (index) {
countriesValues.push($(this).val());
});
var dataChart = [];
var euDataV... | true |
1f7b8cf244df0e66c337e9ac4f7034a676e0d548 | JavaScript | SafaMahbub/contactlist | /server.js | UTF-8 | 1,971 | 2.703125 | 3 | [] | no_license | var express = require("express");
var app = express();
var mongojs = require("mongojs");
var db = mongojs('contactlist',['contactlist']);
var bodyParser = require("body-parser");
//IN New York!!!
// app.get("/", function(req,res){
// // send yo info
// res.send("Hello World!");
// });
app.use(express.static(__dir... | true |
169cb710cf32dca3208dfd9b774b3b113d2ac10d | JavaScript | salomaogit/MarcacaoWeb | /JS/assets/script/js.js | UTF-8 | 318 | 3.5625 | 4 | [
"MIT"
] | permissive | let hello = "Hello";
let world = "World";
console.log(`${hello} ${world}`);
console.log(typeof hello);
function mostrarNome(){
let campoValue = document.getElementById("nome").value;
let conteudo = document.querySelector("#conteudo");
conteudo.innerHTML = campoValue;
console.log(campoValue);
}
| true |
dfef9b8bd7ecbf5f862d96fc9240d9f639dd0543 | JavaScript | antmellor/alexa-skill-skyplus | /lambda/index.js | UTF-8 | 13,631 | 2.953125 | 3 | [
"MIT"
] | permissive | /*
* alexa-skill-skyplus
* https://github.com/pete-rai/alexa-skill-skyplus
*
* Copyright 2017 Pete Rai
* Released under the MIT license
* https://github.com/pete-rai/alexa-skill-skyplus/blob/master/LICENSE
*
* Released with the karmaware tag
* https://pete-rai.github.io/karmaware
*
* Website : http://www.ra... | true |
906c818754a5f34a6e6d39f9ebb811da5dc567e4 | JavaScript | PrabhuN27/My-First-Website | /final2.js | UTF-8 | 7,745 | 3.0625 | 3 | [] | no_license | document.getElementById("Submit1").onclick = function() { Input() };
document.getElementById("Submit2").onclick = function() { AddTable() };
document.getElementById("Remove").onclick = function() { DelTable() };
document.getElementById("Clear").onclick = function() { ClearLocalTable() };
var cal = 0;
var pro = 0;
var f... | true |
c3ca13be45d86096462c0a569523543a34af7ed6 | JavaScript | mosesr-kim/c0521-code-solutions | /exercises/string-manipulation-3/src/is-anagram.js | UTF-8 | 608 | 3.875 | 4 | [] | no_license | /* exported isAnagram */
function isAnagram(firstString, secondString) {
var first = firstString.split(' ').join('');
var second = secondString.split(' ').join('');
var firstArray = [];
var secondArray = [];
for (var i = 0; i < first.length; i++) {
firstArray.push(first[i]);
}
for (var z = 0; z < seco... | true |
a8f96262a720bcf106ed2d8bbe71512be06b7c4c | JavaScript | jokeyrhyme/package-diff-summary.js | /__tests__/npm.js | UTF-8 | 918 | 2.53125 | 3 | [
"MIT"
] | permissive | /* @flow */
'use strict';
const npm = require('../lib/npm.js');
test('nameToMarkdown("does-not-exist")', () => {
const name = 'does-not-exist-' + Math.random() * 1e6;
return npm.nameToMarkdown(name).then((result) => {
expect(result).toBe(name);
});
});
test('nameToMarkdown("execa")', () => {
const expect... | true |
bd0d6514b133a8c14e7cb5290ac3f966d5b657c1 | JavaScript | alif-ic/employee-app | /src/components/Redux/components/EmployeeFormR.js | UTF-8 | 4,238 | 2.703125 | 3 | [
"MIT"
] | permissive | import React, { Fragment } from "react"
class EmployeeForm extends React.Component {
constructor(props) {
super(props);
this.state = {
index: this.props.currentEmp.index || null,
name: this.props.currentEmp.name || '',
age: this.props.currentEmp.age || '',
... | true |
1b5a29675fd9fb2dea734175d7900ac9a7752dfe | JavaScript | blpatidar/college-management-system | /collegeMangment/model/CollegeModel.js | UTF-8 | 2,436 | 2.546875 | 3 | [] | no_license | var Datasource = require('../model/Datasource');
var CollegeBean = require('../bean/CollegeBean');
Datasource = new Datasource();
CollegeBean = new CollegeBean();
class CollegeModel {
add(CollegeBean) {
return new Promise((resolve, reject) => {
var sql = "INSERT INTO clg_users (name,address,st... | true |
59591b2febee3cc63528f716d668269beb7c89ed | JavaScript | pbochynski/busola | /core/src/luigi-config/utils/feature-toggles.js | UTF-8 | 679 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | export function updateFeatureToggle(key, value) {
if (value) {
Luigi.featureToggles().setFeatureToggle(key);
} else {
Luigi.featureToggles().unsetFeatureToggle(key);
}
}
export function getFeatureToggle(key) {
return (Luigi.featureToggles().getActiveFeatureToggleList() || []).includes(
key,
);
}
... | true |
0a55124565205a0344665d6bc2b68148719f8050 | JavaScript | colingoodale/LocalStorageWalkThrough | /script.js | UTF-8 | 1,691 | 2.734375 | 3 | [] | no_license | console.log("page load")
var needSave = [];
var gotten = localStorage.getItem("message")
gotten = JSON.parse(gotten);
console.log("Saved Package", gotten);
if (!gotten) {
localStorage.setItem("message", JSON.stringify(needSave));
gotten = localStorage.getItem("message")
console.log("built storage container"... | true |
e758939b00b7676770b21be44c696970514fa122 | JavaScript | DarthFlashyPants/sith-wdc | /app.js | UTF-8 | 2,466 | 2.53125 | 3 | [
"MIT"
] | permissive | //modules ==========================================
var express = require('express');
var bodyParser = require('body-parser');
var session = require('express-session');
var cookieParser = require('cookie-parser');
var r = require('rserve-client');
var app = express();
// Modules for handling xml requests and response... | true |
c73f37ce4e6305e5d1c33d16abefd1cea8cd1b2b | JavaScript | jffng/subway-stories-node | /test_app.js | UTF-8 | 1,287 | 2.6875 | 3 | [] | no_license | var serialPort = require('serialport');
var express = require('express');
var http = require('http');
var app = express();
var server = http.createServer(app);
app.use("/", express.static(__dirname + "/public"));
var WebSocketServer = require('ws').Server;
var wss = new WebSocketServer({
'server': server
});
var my... | true |
3676a18d6246c7b2cc416bb3e2361db94c915e62 | JavaScript | young8179/algorithm-javascript | /exercise/exercise_2.js | UTF-8 | 312 | 4.21875 | 4 | [] | no_license | //Write a javascript program which accept a number as input and insert dashes(-) between each number.
let num = 402392191
let dashes = (userInput)=>{
return String(userInput).split("").join("-")
}
console.log(dashes(num))
console.log(typeof dashes(num))
const check = typeof dashes(num)
console.log(check) | true |
2f8583d431d7139e7835e0709c260dff056069f7 | JavaScript | nguyenphitan/Lap_trinh_Website | /buoi_6_contest/bai_3/app.js | UTF-8 | 451 | 3.65625 | 4 | [] | no_license | // bài 3:
let arr = prompt('Enter array:').split(',');
console.log(arr);
function check(arr_, x)
{
for(let i=0 ; i<arr_.length ; i++)
{
if( x === arr_[i] ) return false;
}
return true;
}
let arr_result = [];
let iter = 0;
arr_result[iter++] = arr[0];
for(let i = 1 ; i < arr.lengt... | true |
0f8627477627fcbfdce28f60715388f618ffbc31 | JavaScript | MishaAkulenko/react-vacation-calendar-demo | /src/redusers/redusers.js | UTF-8 | 2,467 | 2.65625 | 3 | [] | no_license | import {combineReducers} from "redux";
const userReducer = function(state = null, action) {
if (action.type === 'SET_USER_INFO') {
return state = action.user
}
return state;
};
const vacationReducerInitialState = {
reservedDays: [],
availDaysToVacation: {max:0, avail:0},
confirmationSt... | true |
ec7a5b0aea15828af2a7efebf81953a208e644c7 | JavaScript | daniele3b/TravelAppMBGP | /helper/auth_helper.js | UTF-8 | 635 | 2.609375 | 3 | [] | no_license | const Joi = require('joi');
function validateReqEmail(req) {
const schema = {
email: Joi.string().min(5).max(255).required().email(),
password: Joi.string().min(5).max(1024).required()
};
return Joi.validate(req, schema);
}
function validateReqPhone(req) {
const pattern = /^\(?([0-9... | true |
d01888b1872a4c042561f325fbdd0950fee10369 | JavaScript | GrzegorzJeremenko/Portfolio | /js/aboutme.js | UTF-8 | 584 | 3.328125 | 3 | [] | no_license | let skill = [0, 90, 0, 80, 0, 90, 0, 75, 0, 70, 0, 80];
function skillbarUpdate() {
let a = 0;
for(let i=0; i < skill.length/2; i++) {
skill[i*2] = skill[i*2]+(skill[i*2+1]-skill[i*2])*0.005;
document.getElementsByClassName("skillbar")[i].style.backgroundImage = "linear-gradient(90deg, #3498d... | true |
c3eb009a78a6c1e719c2d863fe3392b21cc35ea6 | JavaScript | vanderlei-martins/atividade_modulo2_react | /src/hooks/Books.js | UTF-8 | 452 | 2.734375 | 3 | [] | no_license | import React, { useEffect, useState } from "react";
import { getAll, update } from "../Api/BooksAPI";
// meu hook personalizado
export const useBooks = (renderizar) => {
const [books, setBooks] = useState([]);
useEffect(() => {
getAll().then(setBooks);
}, [renderizar]);
return books;
};
expor... | true |
d185829918ecd5d40ddb2dbf608e6fcc75772d8e | JavaScript | jgladch/recursion | /src/stringifyJSON.js | UTF-8 | 1,443 | 4 | 4 | [] | no_license | // this is what you would do if you liked things to be easy:
// var stringifyJSON = JSON.stringify;
// but you don't so you're going to write it from scratch:
var stringifyJSON = function(obj) {
console.log("next obj");
console.log(obj);
console.log(typeof obj);
var objToString = function(obj){
var object = o... | true |
7e22e9333ff85037042b83421c9659340aa53f0c | JavaScript | idettman/idettman.github.io | /examples/js/physics/goojs-master/src/goo/entities/systems/HtmlSystem.js | UTF-8 | 3,500 | 2.515625 | 3 | [
"MIT",
"BSD-3-Clause",
"BSD-2-Clause",
"Zlib"
] | permissive | var System = require('../../entities/systems/System');
var Renderer = require('../../renderer/Renderer');
var Vector3 = require('../../math/Vector3');
/**
* @extends System
* @example-link http://code.gooengine.com/latest/visual-test/goo/entities/components/HTMLComponent/HTMLComponent-vtest.html Working example
*/
... | true |
c6ed8ed7ee5ec8e3aa16d8a4201fc824d5a52121 | JavaScript | WeaselMicu/ci-trap | /test/test_ajax.js | UTF-8 | 2,064 | 2.625 | 3 | [
"MIT"
] | permissive | // TODO normalize test cases and contexts
// TODO simulateMouseMove is a very bad idea, it must be replaced ASAP
//
// Nextgen simulateMouseMove should support the followings:
// * time-based event triggering (it's hard! https://github.com/jamesarosen/Timecop.js)
// * exact screen / client -- X / Y handling
// * it mu... | true |
1b748d7d043d8981d402c945d77821657a55fabe | JavaScript | leuhvraiminoryo/DraftBot-A-Discord-Adventure | /src/commands/admin/testCommands/Player/GiveBadgeTestCommand.js | UTF-8 | 922 | 2.59375 | 3 | [
"MIT",
"JSON"
] | permissive | import {Entities} from "../../../../core/models/Entity";
module.exports.commandInfo = {
name: "givebadge",
commandFormat: "<badge>",
typeWaited: {
badge: typeVariable.EMOJI
},
messageWhenExecuted: "Vous avez maintenant le badge {badge} !",
description: "Donne un badge à votre joueur",
commandTestShouldReply: ... | true |
49297879cf8b666ee6c4b59be614ec2d8797b220 | JavaScript | tTomonori/YouAndPygmy_electron | /menu/ItemHandler.js | UTF-8 | 9,209 | 2.65625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"CC0-1.0"
] | permissive | class ItemHandler{
constructor(aItem,aCategory){
let tChoiceList=new Array();
this.item=aItem.name;
this.itemData=ItemDictionary.get(this.item);
switch (aCategory) {
case "consum"://消費アイテム
if(this.itemData.use)tChoiceList.push({name:"使う",key:"use"});
if(this.itemData.have)tChoiceList.push({name:"持たせ... | true |
b743c1a9db6f4f6d77fbe8b14c2925659fb4105d | JavaScript | XwilberX/fremp-app-citas | /frontend/src/citas.js | UTF-8 | 779 | 2.515625 | 3 | [] | no_license | import axios from "axios";
function checkCita() {
const token = localStorage.getItem("token")
if(token !== undefined){
axios.get("http://127.0.0.1:5000/api/cita/"+localStorage.getItem("user"))
.then((res) => {
localStorage.setItem("cita", JSON.stringify(res.data[0]))
lo... | true |
e4cc83506081d3ce9415a324a1e5c04c4a62afcc | JavaScript | UtpalTheDev/KeisaMovie | /app.js | UTF-8 | 3,498 | 2.796875 | 3 | [] | no_license | const api_key='';
const Api_Url=`https://api.themoviedb.org/3/discover/movie?sort_by=popularity.desc&api_key=${api_key}&page=`;
const img_path='https://image.tmdb.org/t/p/w500';
const search_url=`https://api.themoviedb.org/3/search/movie?api_key=${api_key}&query=`;
var form=document.querySelector(".form");
var search... | true |
6b58e99142bc7e9847e1d93c4789b447ea1f6552 | JavaScript | ytf2y/mockjs-receive-parammeters | /src/mock/index.js | UTF-8 | 3,551 | 2.84375 | 3 | [] | no_license | /**
* Created by apple on 2019/9/9.
*/
import Mock from 'mockjs'
Mock.mock('/list','get',{
"status":200,
"list|5":[
{ "id|+1":1,"name":'@cname',"age|18-30":0,"address":'@county(true)',"phone|13500000000-19299999999":1 }
]
});
//get方式接收的参数 放在url中,需要用字符串提取的方式拿到参数;
/*Mock.mock(/\/login.*!/,'get',fun... | true |
f6aeb99787f8bf64dc30bc72e422e374d40be1ff | JavaScript | konghouyin/node | /socket/src/js/socket.js | UTF-8 | 1,296 | 2.515625 | 3 | [] | no_license | var ws; //socket实例
function close(){
ws.close();
}
function send(obj) {
if (ws.readyState != WebSocket.OPEN) {
alert("正在连接请稍候!");
return false;
}
ws.send(JSON.stringify(obj));
}
//socket通信发送的对象
function WebSocketTest() {
if ("WebSocket" in window) {
// 打开一个 web socket
ws = new WebSocket("ws://192.168.137... | true |
56947c93932d2b04dfa073e6a203f35c6b7c196c | JavaScript | tracynle/eloquentJS | /chapter5/abstractingArray.js | UTF-8 | 2,037 | 4.28125 | 4 | [] | no_license | /* Chapter 5 p. 83
This section goes over different approaches to writing for loops
by abstracting it using forEach() function rather than using the traditional
for loop approach. Plain functions are a good way to build abstractions but
they can fall short and leave potential bugs.
*/
/* 1. Writing... | true |
408167dfcb5558142b124bf0a71f6234ec289f3c | JavaScript | TheEskhaton/Wig | /app/scripts/wig.js | UTF-8 | 2,955 | 2.625 | 3 | [] | no_license | define("Wig", ["jquery"],function($){
var globalData = {};
var Wig = function(selector){
selector = selector || '.wig';
this.$el = $(selector);
return this;
};
var setupEvent = function($el, cb){
var evt = $el.data('on') || 'click';
$el.on(evt, cb);
}
... | true |
bcfa804ac0d8f111ce6c2e9e1bd746ce9b70b048 | JavaScript | simsir-lin/wechat-miniprogram-mock | /src/index.js | UTF-8 | 2,028 | 2.53125 | 3 | [
"MIT"
] | permissive | /*
* Author: simsir-lin
* Github: https://github.com/simsir-lin
* Email: 15986907592@163.com
*/
function Mock(option = {}) {
let defaultOption = {
ignore: [],
delay: 0
}
this.options = Object.assign(defaultOption, option)
this.mockData = {}
}
Mock.prototype = {
constructor: Mock,
add: function(... | true |