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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
4d0bb3633fb00d945c2967490ebf42c4d75fce86 | JavaScript | israelcrux/sendlist | /client/source/scripts/services/session_service.js | UTF-8 | 1,329 | 2.59375 | 3 | [] | no_license | /**
*
* Session service
* Basically read and write to localStorage (default)
* or whatever storage (Not implemented)
*/
angular.module('sendlist.SessionService',[])
.factory('SessionService',[function(){
/**
* Storage
*/
// var storage = window.localStorage;
var storage = window.sessionStorage;
return... | true |
52ffe45b3cbc21be3f4598652798e282c13c3644 | JavaScript | jgalmeida/protractor-example | /todo-server/handlers.js | UTF-8 | 904 | 2.671875 | 3 | [] | no_license | module.exports = {
get: get,
post: post,
complete: complete,
del: del,
auth: auth
}
var todos = [];
function get(req, res, next) {
var filteredTodos = todos.filter(function(todo) {
return (todo.status === req.query.status) || !req.query.status;
})
res.send(filteredTodos)
}
function post(req, res... | true |
48fd5662f575944843151a88025fb777bcf5d124 | JavaScript | OahidZihad/programmingHero | /exploreJS/Apply JS Concept/factorial.js | UTF-8 | 782 | 4.71875 | 5 | [] | no_license | //// Iteretive functions
///// Using Function and For loop
///// Using Function and For loop
function factorial(num){
var fact = 1;
for(var i=1; i<=num; i++){
fact = fact*i;
}
return fact;
}
var factorial = factorial(5);
console.log(factorial);
////// Using Function and While L... | true |
23a774ef2352c543f10d8bb58261296c86d11189 | JavaScript | studentinsights/studentinsights | /app/assets/javascripts/service_uploads/Api.js | UTF-8 | 866 | 2.53125 | 3 | [
"MIT",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | import {
apiFetchJson,
apiPostJson,
apiDeleteJson
} from '../helpers/apiFetchJson';
class Api {
createServiceUploads(params = {}) {
return apiPostJson('/service_uploads.json', params);
}
deleteServiceUpload(id) {
return apiDeleteJson('/service_uploads/' + id + '.json');
}
fetchServiceTypeName... | true |
a183a9f94d016c9c2121fc7877a2051c75929e96 | JavaScript | zachystuff/toy_problems | /leetcode_countElements.js | UTF-8 | 652 | 3.625 | 4 | [] | no_license | /**
* @param {number[]} arr
* @return {number}
*/
var countElements = function (arr) {
const store = {};
let count = 0;
for (let i = 0; i < arr.length; i++) {
if(!store[arr[i]]) {
store[arr[i]] = 1
} else {
store[arr[i]]++
}
}
for(let i = 0; i < ar... | true |
c1f1d72504d40a9e1263e3089a19f24aef08d7f6 | JavaScript | roietik/react-crud-express | /client/src/components/todos.js | UTF-8 | 3,117 | 2.625 | 3 | [
"MIT"
] | permissive | import React, { Component } from "react";
import Api from "../api/api";
class Todos extends Component {
constructor() {
super();
this.state = {
todos: [],
loading: true,
act: 0,
next: "",
edit: "",
error: ""
};
}
componentDidMount() {
this.refs.todo.focus();
... | true |
70686cad966ad6af898877215faed38ca14531f5 | JavaScript | macCormack/haxreact | /src/components/about.js | UTF-8 | 2,316 | 2.5625 | 3 | [
"MIT"
] | permissive | import React, { Component } from 'react';
class About extends Component {
constructor(props) {
super(props);
this.state = {
error: null,
isLoaded: false,
page: [],
fetchPage: 'http://localhost:3000/api/about-pages'
};
}
authenticate()... | true |
42340a88fb81e2aa54628178a2d76a3ffd0c519d | JavaScript | lukaszkania/DeployOfSpaceTravels | /src/components/flights/SingleFLight.js | UTF-8 | 1,398 | 2.609375 | 3 | [] | no_license | import React, { Component } from 'react'
import axios from 'axios';
import { FLIGHTS_API_URL } from '../../constants/API_URLS';
import { Link } from 'react-router-dom/cjs/react-router-dom';
class SingleFlight extends Component {
// State of every single flight which is in api
state = {
singleFlightData... | true |
19775f46a41916ecf2d1c9a7795a416dd53d88a1 | JavaScript | mark-wiemer/hacker-rank | /NewYearChaos/solution.js | UTF-8 | 3,078 | 3.6875 | 4 | [] | no_license | 'use strict';
process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', inputStdin => {
inputString += inputStdin;
});
process.stdin.on('end', _ => {
inputString = inputString.replace(/\s*$/, '')
.split('\n')
.map(str => str.replace(/... | true |
45dcdc0b9cead64994467b011636f2c927714e9c | JavaScript | DeyvidNascimento/exercicios-js | /fundamentos-js/booleanos.js | UTF-8 | 938 | 3.71875 | 4 | [] | no_license | let isAtivo = false
console.log(isAtivo);
isAtivo = true
console.log(isAtivo);
isAtivo = 1
console.log(!!isAtivo); //!!True
console.log(!isAtivo); //!False
console.log('Os verdadeiros...');
console.log(!!3);
console.log(!!-3); //todo numero inteiro é true, com a excessao do 0
console.log(!!' ');
console.log(!!'text... | true |
a3a0179a7d3e6ed956d9af11b4d49954c4f1f571 | JavaScript | simonasorlescu/learn | /algorithms/longest-word.js | UTF-8 | 428 | 3.921875 | 4 | [] | no_license | // Find the longest word in a string
function findLongestWord(str) {
var arr = str.split(' '),
currentLength,
maxLength = 0;
for (var i = 0, len = arr.length; i < len; i++) {
currentLength = arr[i].length;
if (currentLength > maxLength) {
maxLength = currentLength;... | true |
a577b20023fd900cb3407ea0d62567dd6fbef2c7 | JavaScript | Tefferson/heroku | /public/js/events.js | UTF-8 | 646 | 2.671875 | 3 | [] | no_license | var toJson = () => {
var xml = document.getElementById('xmlArea').value;
if(empty(xml)) return;
var dom = parseXml(xml);
var json = xml2json(dom," ");
document.getElementById('jsonArea').value = json.replace('undefined','');
};
var toXml = () => {
var json = document.getElementById('jsonArea').value;
if(... | true |
e980bf2ff8181234e6b188df56de86a43597d505 | JavaScript | Tate-Young/Tate-Young.github.io | /search/js/gtag.js | UTF-8 | 2,165 | 2.8125 | 3 | [
"MIT"
] | permissive | /**
* gtag 首页埋点
*/
const createFunctionWithTimeout = (callback, opt_timeout) => {
let called = false;
function fn() {
if (!called) {
called = true;
callback();
}
}
setTimeout(fn, opt_timeout || 1000);
return fn;
}
// 统一的 gtag 点击事件
const gtagEventClick = (param, fn, action = 'click') => {... | true |
5344c3de04944850fd0046e00246acde29154b12 | JavaScript | curtisyungen/Recipe-Finder | /public/javascript/searchRecipe.js | UTF-8 | 3,750 | 3.046875 | 3 | [] | no_license | // =========================
// GLOBALS
// =========================
var searchLimit = 15;
var cuisine = "";
var diet = "";
var allergy = "";
// ============================================================================================================================
// Yummly APIs: Search Recipe API, Get... | true |
876170b9ab7e0e744a96fc15fd552417bbdfc2da | JavaScript | nicsalsa/nicole_salceda_project5 | /src/App.js | UTF-8 | 2,867 | 2.671875 | 3 | [] | no_license | import React, { Component, Fragment } from 'react';
import './App.css';
import firebase from './firebase';
import {
BrowserRouter as Router,
Route,
Link
} from 'react-router-dom';
import classNames from 'classnames';
//Components
import Header from './components/header/Header';
import GroceryItem from './compone... | true |
716ed0773315c40e0ac371d8ebab5bf6d7acb1ec | JavaScript | alexkates/tdd-aws-s3 | /src/getObject.test.js | UTF-8 | 744 | 2.65625 | 3 | [] | no_license | jest.mock('aws-sdk', () => ({ S3: jest.fn(() => mockS3) }));
const mockS3 = {
getObject: jest.fn().mockReturnThis(),
promise: jest.fn(),
};
describe('When getting an object from AWS S3', () => {
it('should use the aws-sdk getObject method', async () => {
// Arrange
const expectedObject = {};
const r... | true |
95fd1c07f38bf56d282ba3c622c4c412e1f2b1ce | JavaScript | wilonweb/JsAudio | /melody-maker/script.js | UTF-8 | 1,058 | 3.53125 | 4 | [] | no_license | //GLOBALS
let CANVAS;
//let SPACING;
function main() {
CANVAS = document.getElementById("myCanvas");
fitToScreen();
//window.addEventListener('resize', fitToScreen);
drawScene();
}
function drawNote(ctx,location){
ctx.fillStyle="black";
ctx.strokeStyle="black";
ctx.lineWidth=1;
ctx.beg... | true |
3a319affe32311f63d71f5e75c0813417b141229 | JavaScript | HLQ311/mblApp | /js/init.js | UTF-8 | 958 | 3.078125 | 3 | [
"MIT"
] | permissive | let currClientWidth, fontValue,originWidth;
//originWidth用来设置设计稿原型的屏幕宽度(这里是以 Iphone 6为原型的设计稿)
originWidth=375;
__resize();
//注册 resize事件
window.addEventListener('resize', __resize, false);
function __resize() {
currClientWidth = document.documentElement.clientWidth;
//这里是设置屏幕的最大和最小值时候给一个默认值
if (currClient... | true |
461d617a2e13a0d2230c38692fa9f6cadf93af20 | JavaScript | AntonyGuilherme/cursos-JsTs | /curso-javascript-rxjs/promise/promise.js | UTF-8 | 506 | 3.828125 | 4 | [] | no_license | let p = new Promise(function(cumprirPromessa,rejeitarPromessa){
cumprirPromessa(['antony','guilherme'])
})
/*
Cada retorno de um then é passado ao próximo
Pode-se usar quantos for preciso sem problemas
*/
p
.then((response)=> response.map(element => `Nome: ${element}`))
.then((item)=> console.log(item));
p... | true |
9c65eccec3be91bf9241561c892ab8facef73b4b | JavaScript | jessica33tsai33/impact_present_project | /js/xlsx_process.js | UTF-8 | 1,028 | 3.265625 | 3 | [] | no_license | /*
FileReader共有4種讀取方法:
1.readAsArrayBuffer(file):將檔案讀取為ArrayBuffer。
2.readAsBinaryString(file):將檔案讀取為二進位制字串
3.readAsDataURL(file):將檔案讀取為Data URL
4.readAsText(file, [encoding]):將檔案讀取為文字,encoding預設值為'UTF-8'*/
var wb; //讀取完成的資料
var jsonObj; // input xlsx 的 json 檔
function importf(obj) { //匯入
if (!obj.files) {
... | true |
0d2c03ac7f1f8958e07f3594c6475d1ee1d8c32c | JavaScript | Furoth/rpg_adventure_xtra | /public/js/avatar2.js | UTF-8 | 9,887 | 2.703125 | 3 | [
"MIT"
] | permissive | class avatar{
constructor(pos_x, pos_y,url_ava){
this.x = pos_x;
this.y = pos_y;
this.pj = draw.image(url_ava).attr({
x: this.x,
y: this.y,
id: 'avatar'
});
this.casilla = 0;
this.cash = 0;
this.lvl = 0;
}
move(x){
for(var i=0; i<x; i++){
if(this.x < 1000){
if(this.casilla == 13 ... | true |
0128988323bf03fdc928c174db9a95299c2efb6f | JavaScript | misagfo/table | /src/App.js | UTF-8 | 1,425 | 2.640625 | 3 | [] | no_license | import React from 'react'
import './App.css';
import Table from '@material-ui/core/Table';
import TableBody from '@material-ui/core/TableBody';
import TableCell from '@material-ui/core/TableCell';
import TableContainer from '@material-ui/core/TableContainer';
import TableRow from '@material-ui/core/TableRow';
import Pa... | true |
5d131f07049e19253a87a04c4839d3702d235392 | JavaScript | xjc-xx/arcgisAPIStudy_Youtube | /ski-resort-map/app/utils.js | UTF-8 | 2,171 | 2.5625 | 3 | [] | no_license | /*
* @Author: your name
* @Date: 2020-12-11 16:15:16
* @LastEditTime: 2020-12-11 18:13:28
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \arcgisAPIStudy_Youtube\ski-resort-map\app\utils.js
*/
define([], function () {
const vertices = [];
const random = new Math.see... | true |
98bf8c215c29df0df864a9c01eb1e6567aefb14e | JavaScript | SirSerje/eight-millimeter-shelter | /server/routes/delete.js | UTF-8 | 1,109 | 2.53125 | 3 | [] | no_license | const express = require('express');
const database = require('../database');
const router = express.Router();
const DATABASE_MOVIES_SELECTOR = require('../constants').DATABASE_MOVIES_SELECTOR;
function removeItem(successCallback, notFound, failCallback, database, id) {
database
.ref(`${DATABASE_MOVIES_SELECTOR}... | true |
1346a5a7194b1b5144c80bbba98ab84c0755cdf0 | JavaScript | kokarn/ai-comms | /opponents/easy/index.js | UTF-8 | 1,302 | 2.875 | 3 | [
"MIT"
] | permissive | const socket = require( 'socket.io-client' )( 'ws://localhost:3000/' );
const moves = [
'rock',
'paper',
'scissors',
];
let move = false;
let gamesPlayed = 0;
function getRandomIntInclusive( min, max ) {
min = Math.ceil( min );
max = Math.floor( max );
return Math.floor( Math.random() * ( m... | true |
7f5982c737093961b53bd1f880ffa269b5776ad2 | JavaScript | llamaquellama/suru | /public/js/controladorActualizarUsuario.js | UTF-8 | 8,778 | 2.84375 | 3 | [] | no_license | 'use strict'
// capturamos el nombre de usuario del sessionStorage
let nombreUsuarioSession = sessionStorage.getItem('nombreUsuario');
const btnSubirFotoPerfil = document.querySelector('#btnSubirImagen');
const btnActualizarUsuario = document.querySelector('#btnActualizarUsuario');
let inputTipoID = document.q... | true |
69173fc04933e642ead07c2d0ed9bdf5ca324145 | JavaScript | bliew93/queryableJS | /lib/dom_node_collection.js | UTF-8 | 3,959 | 3.140625 | 3 | [] | no_license | const _forEach = Symbol('forEach');
class DOMNodeCollection {
constructor(HTMLElements) {
this.HTMLElements = HTMLElements;
}
html(string) {
if(string) {
this[_forEach]( (element) => {
element.innerHTML = string;
});
}
else {
return this.HTMLElements[0].innerHTML;
}... | true |
7cc1ca0ad0cd51b5d17e581ae9950b549debd609 | JavaScript | tal/time-between | /time-between.spec.js | UTF-8 | 2,745 | 2.90625 | 3 | [
"MIT"
] | permissive | var timeBetween = require('./time-between')
describe('timeBetween', () => {
describe('simple, durring week', () => {
var start = new Date('March 1 2017 12:00:00')
var end = new Date('March 2 2017 12:00:00')
it('should work for single day, overnight', () => {
var hours = timeBetween(start, end)
... | true |
730a83d0986d0ff990678dfaac751d9cd8793549 | JavaScript | aliulgr13/JavaScript1 | /Week1/homework/js-exercises/logNumber.js | UTF-8 | 170 | 3.1875 | 3 | [
"CC-BY-4.0"
] | permissive | 'use strict'
let numberX;
console.log("I did not assign any value to numberX");
console.log(numberX);
numberX = 13;
console.log("numberX might be");
console.log(numberX); | true |
115a081d1256bfef165aa347c4871eacaa5d854a | JavaScript | michaelleone/webstormtest | /src/Person/Person.js | UTF-8 | 1,372 | 2.71875 | 3 | [] | no_license | import React, {PureComponent} from 'react'
import PropTypes from 'prop-types'
class Person extends PureComponent {
constructor (props) {
super(props)
console.log('[Person.js] Inside Constructor', props)
}
componentWillMount () {
console.log('[Person.js] Inside componentWillMount()')
}
componentDi... | true |
4e11ac78d7493334056df559393bb13d7f173941 | JavaScript | luism3090/CursoReactDeCeroAExperto | /3_counter-app/src/tests/base/09-promesas.test.js | UTF-8 | 989 | 2.65625 | 3 | [] | no_license | import {getHeroeByIdAsync} from '../../base/09-promesas';
import heroes from '../../data/heroes';
describe('validando el archivo 09-promesas.js', () => {
// cuando se valide funciones async y que tengan una promesa se debe usar done
test('Debe validar la funcion asincrona getHeroeByIdAsync retornando un ... | true |
b514d35844dda5791ff4f06f0337199be6786bc5 | JavaScript | ssexton1/productivity-pal-react-app | /src/Task Files/TaskForms.js | UTF-8 | 1,026 | 3.0625 | 3 | [] | no_license | import { useState } from "react";
export function AddTaskForm(props) {
const [inputtedTask, setInputtedTask] = useState("");
const [length, setLength] = useState("");
const handleTaskChange = (event) => {
let newValue = event.target.value;
setInputtedTask(newValue);
};
const handleTimerChange = (event) => {... | true |
d3548e436307702140480cda2024341647409342 | JavaScript | Moshmel/Gallery | /projects/proj-safe-content/js/user-controller.js | UTF-8 | 380 | 2.765625 | 3 | [
"MIT"
] | permissive | function init()
{
console.log('Todos App');
createUsers();
}
function onDoLogin()
{
var form=document.getElementsByTagName('form');
if(doLogin(form[0][0].value,form[0][1].value)!==undefined)
{alert('ahalan ahalan')
document.getElementById('formContent').style.display='none';
... | true |
d56b7e93b52d105a10aaba4100747fb611ea1704 | JavaScript | moogiecodes/redux-microblog | /src/components/PostForm.js | UTF-8 | 3,026 | 2.515625 | 3 | [] | no_license | import React, { useState } from 'react';
import { Col, FormGroup, Form, Label, Input, Container, Button } from 'reactstrap';
import { Link } from 'react-router-dom';
import { useDispatch } from 'react-redux';
import { updatePostInAPI } from '../actions/actions';
function PostForm({ add, isEditing, toggleEdit, currPos... | true |
d5d8fdd6a1e5aa3bbd51a42f95e240478fdb202d | JavaScript | brijeshpanchal127/youtube-video-search | /src/utils/refine.util.js | UTF-8 | 656 | 2.515625 | 3 | [] | no_license | import { REFINE_RESULTS } from "../constants/action.types"
export const refineResults = (refineText, onlyHD, results) => {
console.log(refineText, onlyHD, results)
let refinedResults = [];
results.forEach(video => {
if (video.publishedAt.toLowerCase().includes(refineText.toLowerCase())) {
... | true |
0ab83ee2b12ff1b2b768b184eadd252843f17b9f | JavaScript | matheusrodrisantos/learning_js | /aula14/ex017/script.js | UTF-8 | 345 | 3.578125 | 4 | [] | no_license | function calcular()
{
var numero=document.getElementById("n").value;
var resultado=document.getElementById("resultado");
numero=Number(numero)
resultado.innerHTML=`A tabuada do ${numero} é:<br>`
for(var c = 1; c<11; c++)
{
var total=numero*c
resultado.innerHTML+=`<br>${numero} X ... | true |
70cd04df4cc084f803e58371083514f3addd2dd7 | JavaScript | heartycreates/challenge3 | /script.js | UTF-8 | 2,572 | 2.671875 | 3 | [] | no_license | mapboxgl.accessToken = 'pk.eyJ1IjoiaGVhcnR5Y3JlYXRlcyIsImEiOiJja3BwYmptdnowNjczMm5xemlwbGdnZmM2In0.qTZfLJzxfuJAf7WtJQuR7g';
// Initialate map
var map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/heartycreates/ckppcymsj0r1818qh6h5dtj92',
center: [4.322840, 52.067101],
zoom: 14.15
});
... | true |
a06b0f0db046650f2e203f43ead88c9bf74310b4 | JavaScript | discatte/json_scratcher | /json_scratcher.js | UTF-8 | 887 | 3.703125 | 4 | [] | no_license | // How big each chunk should be
var chunk_size = 1000000;
// Open big json file
var fs = require('fs');
var json_object = JSON.parse(fs.readFileSync('big.json', 'utf8'));
console.log("Big file has", json_object.length, "entries");
var iteration;
var number_of_chunks = Math.ceil(json_object.length/chunk_size);
console... | true |
9ba2edae45cf88ec39773b49f4af6655da4540e3 | JavaScript | yourjumbly/1st-arborfield-alexa | /osm.js | UTF-8 | 2,969 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive | /**
* Arborfield Cubs and Scouts
* Lara Button 2018
*/
var request = require('request-promise'); // "Request" library
var Config = require('./configuration');
const OSM_BASE_URL = "https://www.onlinescoutmanager.co.uk/";
var UserId = null;
var Secret = null;
var authenticate = function(callback) {
... | true |
7c5c8291b70d33a87d817cc8895ee7e60512ac14 | JavaScript | camilooob/mycode | /Holberton/Money APP/app/app.js | UTF-8 | 15,698 | 3.296875 | 3 | [
"MIT"
] | permissive | //Comentarios
// * todo es importante
// ? es importante
// ! es muy importante
// TODO: Pendiente por hacer
// TODO:01-MODULOS INDIVIDUALES MODULO CONTROLADOR })();
var controladorPresupuesto = (function () {
var Gasto = function (id, descripcion, valor, porcentaje) {
this.id = id;
this.descripcion = des... | true |
c7980d82861f8911337ea24365b3d354f8e0243a | JavaScript | Andronikus/pomodoro-rock-backend | /tests/user.controller.test.js | UTF-8 | 11,552 | 2.578125 | 3 | [] | no_license | const User = require('../src/model/__mocks__/user').User;
const createUser = require('../src/controllers/user').createUser(User);
const loginUser = require('../src/controllers/user').loginUser(User);
const bcrypt = require('bcryptjs');
const jwt = require('jsonwebtoken');
describe('Create a new user controller', funct... | true |
aa34261c6421bd4f6a5a633a3d40318e1145e3c0 | JavaScript | Final-Project-KG-001/Server | /service/waiting-list-service/test/appointment-update.test.js | UTF-8 | 3,032 | 2.640625 | 3 | [] | no_license | const request = require("supertest");
const app = require("../app");
describe("PUT /appointment/:id", () => {
const data = {
status: "process",
};
const userToken =
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVmM2QwMjY2NzQ4ZTIyM2E5NGRhMzdlYSIsImVtYWlsIjoidXNlcjFAbWFpbC5jb20iLCJpYXQiOjE1OTc4NDI4MDd9.... | true |
23e091b6fec331ad33afcc7eb4bd61ad4d56ec88 | JavaScript | jessiemarinellofullsail/Marinello_Jessica_WPF | /Expressions_Personal/js/script.js | UTF-8 | 1,549 | 3.90625 | 4 | [] | no_license | //Jessie Marinello
//Expressions_Personal
//May 2015
//Estimate your BAC (Blood Alcohol Level)
//BAC = (A*5.14/W*r) - 0.15*H)
//Where A = total number of liquid ounces of alcohol consumed
//Where 5.14 is a constant for average alcohol percent in beverage (can be changed if needed)
//Where W = weight of person in pound... | true |
05319ec094999ac51d62b888cb41971fb5d5ebf0 | JavaScript | lorenzobarilla/pra2 | /sketch.js | UTF-8 | 7,803 | 3.171875 | 3 | [] | no_license | //variables
var myInitLoc;
var currentLat;
var currentLon;
//?????????????????????????????
// var showPosition;
//html div
var latCurr;
var longCurr;
var latInit;
var longInit;
var latIncr;
var longIncr;
var testBg;
var fenceNum;
const fencePosIncr = 0.00004;//in coordinates
var fence0;
var fence1;
var fence2;
var ... | true |
69561b1ce5b35057a1756de99c3d4bc6d88e6211 | JavaScript | RomeraGomezJorge/district-entry-and-exit-of-vehicles-control | /public/assets/js/police/user/form/show.password.constraints.upfront.and.update.it.in.real.time.js | UTF-8 | 1,223 | 3.5625 | 4 | [] | no_license | $(document).ready(function () {
$('input[name="password"]').on('keyup',function(){
const password = $(this).val();
constraintNumberOfCharacters (password);
constraintsAtLeastOneUppercaseCharacter(password);
constraintsAtLeastOneNumber(password);
});
});
function constraint... | true |
f3ba1ccad88f9017fb040ce8c4531578b53608df | JavaScript | blehr/d3beer | /src/app 2.js | UTF-8 | 2,199 | 2.546875 | 3 | [] | no_license | import * as d3 from "d3";
import { map } from "./map";
import { loadData } from "./loadData";
import { mapPoints } from "./mapPoints";
import { dropdownMenu } from "./dropdownMenu";
(async function() {
// Selecting and appending elements
const margin = {
top: 50,
bottom: 50,
left: 100,
right: 100
... | true |
58104c2304e3e3def70d40e82f0abf5417b4f0d9 | JavaScript | mnewelski/TwitchDB | /helpers.js | UTF-8 | 2,009 | 2.6875 | 3 | [] | no_license | var batch = require('batchflow'),
http = require('https'),
config = require('./config');
function chunks(array, size) {
var results = [];
while(array.length) {
results.push(array.splice(0, size));
}
return results;
}
var inArray = function(value, array) {
return array.indexOf(value) > -1;
};
var shuffle... | true |
f704783f6fc516497616b791e38d584c78ec9516 | JavaScript | xiechaojun/js_fullstack | /codewars/likes/likes.js | UTF-8 | 916 | 3.5 | 4 | [] | no_license | // 1. 跟phone number 一样的解法
// 字符串模式, 数组的遍历
// 2. 多种模式情况 [下标]
// nums.length
function likes(names) {
// 规则模板数组
var templates = [
'no one like this',
'{name} like this',
'{name} and {name} like this',
'{name}, {name} and {name} like this',
'{name}, {name} and {n} others like th... | true |
fce3eea1b7383f41e1731b33f9e6a1e6bb359731 | JavaScript | simonkoener66/iWA-chat-backend | /controllers/event/actions/updateEvent.js | UTF-8 | 20,797 | 2.59375 | 3 | [] | no_license | 'use strict';
/**
* The action update the event details data.
*
* Pre conditions:
* # req.session must exist
* # user is authenticated
* # user is authorised to modify the event's details data
* # req.processed must exist
* # req.processed object may have the next attributes
* {
... | true |
fc24c74127669c775e95cb57402cac0c2c01d00e | JavaScript | Robertoabr/Algorithm-and-Data-Structures-Practice | /Misc/validParentheses.js | UTF-8 | 1,661 | 4.65625 | 5 | [] | no_license | /*
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.
An input string is valid if:
Open brackets must be closed by the same type of brackets.
Open brackets must be closed in the correct order.
Note that an empty string is also considered valid.
Exam... | true |
8299d6c989e8d2de50f5596256a98d27d4a47413 | JavaScript | arbyte-br/Arbyte-Atividades | /turma-2/marimaiko/Lista_9/E5.js | UTF-8 | 793 | 3.328125 | 3 | [] | no_license | const ageCalculator = require('age-calculator');
const rs = require('readline-sync');
let {AgeFromDateString, AgeFromDate} = require('age-calculator');
// Be careful: Javascript months start at 0 (so zero stands for january)
// let date=rs.question('Informe a data do seu nascimento (aaaa-mm-dd): ')
l... | true |
52e4268835726971f12a5880f9f62bef1e07a955 | JavaScript | pfeiffk/COMM329-A3 | /page.js | UTF-8 | 1,194 | 2.78125 | 3 | [] | no_license | var slideIndex = 1;
showSlides(slideIndex);
function navToggle() {
var x = document.getElementById("main-nav");
if (x.className === "top") {
x.className += " responsive";
} else {
x.className = "top";
}
}
function plus(n) {
showSlides(slideIndex += n);
}
function current(n) {
showSlides(slideI... | true |
f50958f5cdfa45e72bfaf3be36020123fa8e6ee4 | JavaScript | mryash04/CRUDAPP | /src/app.js | UTF-8 | 2,061 | 2.6875 | 3 | [] | no_license | const express = require("express");
require("./db/connection");
const Student = require("./models/student");
const app = express();
console.log(Student);
app.use(express.json());
const port = process.env.PORT || 8000;
app.get("/", (req, res) =>{
res.send("<h2>This is from home page side</h2>");
});
app.post("/... | true |
7e6573f1cd7fac739643beb3b8537adb9b7427b7 | JavaScript | BrandinO771/cloud_pipeline_1 | /app/dev_versions/bb_app_2_/bb_acme_db/app_foodsnap_js_.js | UTF-8 | 12,555 | 2.703125 | 3 | [] | no_license |
image_selection = d3.selectAll("#b2")
place_img_here = d3.select("#img2")
submit_pic_butt = d3.select('#b3')
var restart_but = d3.select('#resets')
restart_but.on("click", function()
{
console.log("restart button pressed")
});
function uploaded_file(image_name)
{
urlz = `/show/${image_name}`
urls =... | true |
52f90db0bf400d23b7d314aace62f639e4e5efed | JavaScript | cabbibo/touchTutorial | /helperFunctions.js | UTF-8 | 482 | 2.890625 | 3 | [] | no_license | function getDistanceFromPointables( object ){
var dif = { x:0 , y:0 }
for (var i = 0; i < frame.pointables.length; i++) {
var pos = leapToScene(frame.pointables[i].tipPosition);
dif.x += object.translation.x - pos.x;
dif.y += object.translation.y - pos.y;
}
return dif
}
function leapToScene... | true |
33db7d88d2c4ef9faa0653fdb30a73cf97a9bcdb | JavaScript | itaytaa/express-intro | /src/index.js | UTF-8 | 5,902 | 3.046875 | 3 | [] | no_license | const express = require('express') // retriving express module
const app = express() // using express function in a veriable
const bodyParser = require('body-parser') // module for reading json
const port = 3000 // port we will use
const users = []; ... | true |
c7cd95d9cdde3420f69803f6b27157306c469e8d | JavaScript | MohammadAfandy/dicoding-submissions | /frontend-pemula/bookshelf-app/js/script.js | UTF-8 | 1,032 | 2.78125 | 3 | [] | no_license | document.addEventListener("DOMContentLoaded", () => {
const inputBookIsCompleteCheckbox = document.getElementById("inputBookIsComplete");
inputBookIsCompleteCheckbox.addEventListener("change", (event) => {
const bookSubmitButton = document.getElementById("bookSubmit");
if (event.target.checked) {
book... | true |
839548a91e55c1634dea8cef930d34c2b2494128 | JavaScript | danhigham/skywriter_radiant_extension | /public/javascripts/admin/bespin.js | UTF-8 | 504 | 2.515625 | 3 | [] | no_license | var textArea;
var editor;
window.onBespinLoad = function() {
textArea = $$("textarea.bespin")[0];
// Get the environment variable.
var form = textArea.form;
Event.observe(form, 'submit', function() {
textArea.value = editor.value;
});
var env = textArea.bespin;
// Get the editor.
editor =... | true |
ace656d336bb19f65559c2425e482d011b12b990 | JavaScript | hcicodes/hci-codes-server | /src/validators/name.js | UTF-8 | 274 | 2.78125 | 3 | [] | no_license | class NameValidator {
static validate(name) {
if (!name) {
return 'name cannot be empty';
} else {
if (!name.match(/^[a-zA-Z\s]+$/))
return 'only letters in name';
}
}
}
module.exports = NameValidator; | true |
816b502a5cf43e7af85bc67dccb612b8b8b339a4 | JavaScript | nosdeedson/Curso-Udemy-Web-Moderno-javascript | /funcao/funcaoConstrutora.js | UTF-8 | 713 | 3.875 | 4 | [] | no_license | function Car( highSpeed = 200, delta = 5)
{
// private atribute
let currentSpeed = 0
// public method
this.acelera = function()
{
if( currentSpeed + delta <= highSpeed)
{
currentSpeed += delta
}else
{
currentSpeed = highSpeed
}
}
... | true |
9efebad2badf30379f32067d48cc198c6e1dbaea | JavaScript | dee-bee/decisionz | /decisionz/lib/JointJS/www/src/joint.dia.erd.js | UTF-8 | 5,275 | 2.546875 | 3 | [
"MIT"
] | permissive | (function(global){ // BEGIN CLOSURE
var Joint = global.Joint,
Element = Joint.dia.Element,
point = Joint.point;
/**
* @name Joint.dia.erd
* @namespace Holds functionality related to Entity-relationship diagrams.
*/
var erd = Joint.dia.erd = {};
/**
* Predefined arrow. You are free to use this arrow as ... | true |
99c84730e5d72dbd7af1ca277c45efdbece38dd9 | JavaScript | weston/weston.github.io | /hh_to_script/js/generate_lines.js | UTF-8 | 6,988 | 2.859375 | 3 | [] | no_license | BET = "BET"
CALL = "CALL"
CHECK = "CHECK"
IP = "IP"
JAM = "JAM"
JAM_THRESHOLD_PCT = Number("0.6")
OOP = "OOP"
RAISE = "RAISE"
ROOT = "ROOT"
class BetConfig {
constructor(
flopBets,
turnBets,
riverBets,
flopRaises,
turnRaises,
riverRaises){
this.flopBets = flopBets
this.turnBets = turnBets
this.rive... | true |
087ef33efa2dccf0cc4c01e31060d5219bc13c97 | JavaScript | KJW9458/remon-devguide-quickstart | /record.js | UTF-8 | 1,223 | 2.609375 | 3 | [
"MIT"
] | permissive | var video = document.getElementsByTagName('video')[0],
recordRTC = null,
videoURL = '',
options = {
type: 'video',
video: { width: 320, height: 240 },
canvas: { width: 320, height: 240 }
};
function init() {
try {
navigator.getUserMedia = navigator.getUser... | true |
a8e36bb7828c2f7882e77fcbe037eab8964a064b | JavaScript | Suneski/little-web-assignments | /day-36-react-app/src/SimpleList.js | UTF-8 | 1,058 | 3.1875 | 3 | [] | no_license | import React from 'react';
import './simplelist.css';
class SimpleList extends React.Component {
constructor() {
super();
this.state = {
value: '',
items: []
};
this.handleKeyUp = this.handleKeyUp.bind(this);
}
handleKeyUp(evt) {
// console.log(evt.keyCode);
if (evt.keyCode ... | true |
d57797d583e3f308251a6a4fd2c92180d3dfccae | JavaScript | erikdesjardins/babel-preset-more-optimization | /src/plugins/store-to-load.js | UTF-8 | 2,070 | 2.78125 | 3 | [
"MIT"
] | permissive | // Store-to-load forwarding, i.e. copy propagation
// Only constant->constant copies are propagated,
// as tracking mutation would require more complex dataflow analysis.
module.exports = function storeToLoadPlugin({ types: t }) {
return {
visitor: {
VariableDeclarator(path) {
if (!t.isIdentifier(path.node.i... | true |
cd2a88a8fae4490f743c7e57c0d97d43c5565ef5 | JavaScript | Eleven-Finance/bigfoot-app | /src/hooks/useApiStats.js | UTF-8 | 609 | 2.6875 | 3 | [] | no_license | import { useState, useEffect } from 'react'
function useApiStats(props) {
const [isLoadingApiStats, setIsLoadingApiStats] = useState(true);
const [apiStats, setApiStats] = useState(null);
useEffect( () => {
updateApiStats();
}, []);
const updateApiStats = () => {
fetch( process.env.REACT_APP_API_UR... | true |
60b0d02ec46c6fc8fe99705a6985511a2014daec | JavaScript | chandrak96/project_offline | /script/purchase.js | UTF-8 | 3,472 | 2.734375 | 3 | [] | no_license | // global variable that save current product name
// to modify
var product_name = '';
function getVat(){
var type = document.getElementById('productGroup').value;
document.getElementById('productVat').value = vatArray[type];
}
function insertDetails(){
var drug = document.getElementById('productName').value;
cons... | true |
e8148628f2cf651f4c916a07f1ebb2c03b004ff7 | JavaScript | luongnv89/algorithms | /test/JSHashTable.test.js | UTF-8 | 3,473 | 3.03125 | 3 | [
"MIT"
] | permissive | const { JSHashTable } = require('../data_structs/JSHashTable');
describe('Test init a new HashTable', () => {
test('should return a HashTable with some properties', () => {
const hTable = new JSHashTable();
expect(hTable.size()).toEqual(0);
expect(hTable).toHaveProperty('_size');
expect(hTable).toHav... | true |
66fdac22f5e25e7d31756f4fba61646aba1c8c7e | JavaScript | BhatMonu/ReactFinalProject | /reactAppBegin/App2.js | UTF-8 | 1,805 | 2.765625 | 3 | [] | no_license | import React, { Component } from 'react';
import { createStore, applyMiddleware } from 'redux';
import thunk from 'thunk';
import { Provider } from 'react-redux'
import Login from './components/Login';
const initialState = {
name: "Hello",
}
const reducer = (prevState = initialState, action) => {
switc... | true |
02170a3f5333a04051fc34e66e201d2e274f012f | JavaScript | DustyDood/JavaScript_Projects | /Basic_JavaScript_Projects/More_Projects/JavaScript/RapidFirePractice.js | UTF-8 | 1,229 | 2.71875 | 3 | [] | no_license |
var rexrex = document.getElementById("gonezo");
rexrex.classList.add("fade-out");
function blankTest() {
var nia = document.forms["formTest"]["phoneNumber"].value;
if (nia == "") {
alert("You must enter something in this field!");
return false;
}
}
/*Popup form testing*/
/*Clicking the bu... | true |
91a168c73f57ea73b1ef18a01c3d7a492c5027f5 | JavaScript | Silje32/ma2 | /javascript1_ma2.js | UTF-8 | 2,897 | 4.375 | 4 | [] | no_license | //MODULE ASSIGNMENT 2 - LEVEL 1
//1. Create a function that displays prototypal inheritance
function Dog(){
this.make = "Kira"
}
Dog.prototype.species = function () {
};
var Tara = new Dog();
Tara.species();
//2. Create an array of numbers from 1 - 10; slice the 5th number in the array
var myNumbers = [1, ... | true |
29fb0b348ddea6e864588affb7958da07ef8a71c | JavaScript | qwop/userscript | /monolith/20/410712.user.js | UTF-8 | 1,618 | 2.6875 | 3 | [] | no_license | // ==UserScript==
// @name New Tabs for New Posts
// @namespace DutchSaint
// @description Opens all topics with new posts in separate tabs and then marks all topics as read
// @include http://*nolinks.net/boards/search.php*
// @version 0.1
// @grant GM_openInTab
// ==/UserScript==
// V... | true |
1d55802a582d469ec9c8deba484f9fc9bf360478 | JavaScript | theMackabu/crew-store | /js/index.js | UTF-8 | 1,281 | 2.59375 | 3 | [] | no_license | function precisionRound(number, precision) {
var factor = Math.pow(10, precision);
return Math.round(number * factor) / factor;
}
$('.owl-carousel').owlCarousel({
loop:true,
margin:20,
nav:true,
startPosition: 1,
dots: false,
navText: ['<i class="material-icons"></i>','<i class="material-i... | true |
5824f9ef4c104b3007283c5374a509e95bdcce88 | JavaScript | itsthakuramit/JavascriptDemo10 | /ArrayExercise.js | UTF-8 | 2,537 | 3.109375 | 3 | [] | no_license |
console.log("After Spliting through space :")
var inputString="select * from ipl.csv where team1=rcb and team2=csk";
var stringArray=inputString.split(" ");
console.log(stringArray);
console.log("\nCondition Array :")
var afterWhere=inputString.split("where");
var conditionPart=afterWhere[1];
var condtionSplit=condi... | true |
04b27f247134155f854af624a82d7eacaf048324 | JavaScript | sufangyu/file-upload | /app/router/upload.js | UTF-8 | 559 | 2.53125 | 3 | [] | no_license | /**
* 登录 模块
*
* @param {any} req
* @param {any} res
* @returns
*/
exports.upload = function(req, res) {
// const requestMethod = req.method;
// 上传页面渲染
res.render('upload.html', {
pageTitle: 'File upload',
});
};
exports.postUpload = function(req, res) {
const file = req.body;
console.log... | true |
584a400f3731f97b825d86ddb2ae69bcb5fc65b5 | JavaScript | Jaunty-Jackalopes/project-greenfield | /client/Components/Reviews/Reviews.jsx | UTF-8 | 1,544 | 2.53125 | 3 | [] | no_license | import React from "react";
import Grid from "@material-ui/core/Grid";
import ReviewListContainer from "../../containers/ReviewListContainer.jsx";
import ReviewMetaContainer from "../../containers/ReviewMetaContainer.jsx";
class Reviews extends React.Component {
constructor(props) {
super(props);
this.state =... | true |
dbdf20c10c3f1eab5d07b8d5be07360efa5f5b67 | JavaScript | Mona-Safari/Mona-Safari.github.io | /Portfolio1.js | UTF-8 | 3,798 | 3.1875 | 3 | [] | no_license | var image = null;
function loadimage(){
var canvas = document.getElementById("canvas");
var filename = document.getElementById("image");
image = new SimpleImage(filename);
image.drawTo(canvas);
}
function GrayScale(){
if(image == null || !image.complete()){
alert ("Image not loaded");
return;
}
... | true |
533ef4861c9ff23f61ca0e44082bdda52ce9d4e4 | JavaScript | lxfriday/WaterM | /src/utils/transformSize.js | UTF-8 | 665 | 3.015625 | 3 | [] | no_license | /**
* B to KB or MB
* @time 2018/09/01
* @author lxfriday
*/
export default (bResult) => {
if (bResult >= 1024) {
// kb
const kbResult = bResult / 1024;
if (kbResult >= 1024) {
// mb
const mbResult = kbResult / 1024;
if (mbResult >= 1024) {
// gb
const gbResult = mbR... | true |
b0a6f6f95e74554162fa9106acd0da921f337a1a | JavaScript | jbnilles/fav-things | /js/scripts.js | UTF-8 | 784 | 2.984375 | 3 | [] | no_license | $(document).ready(function () {
$('#submit').click(function () {
event.preventDefault();
favoriteThings.push($('#name').val());
favoriteThings.push($('#place').val());
favoriteThings.push($('#animal').val());
favoriteThings.push($('#color').val());
favoriteThings.push($('#food').val());
/... | true |
80c05a4c0b04ba207f5c133a21a1c09deedcbfde | JavaScript | loyalchicken/minesweeper.ai | /client/src/utilities/functions.js | UTF-8 | 6,117 | 3.671875 | 4 | [] | no_license | /**
* Generates a list of numbers corresponding to the 1D coordinates of the squares that are mines
* O(n) time, where n = rows*cols
* @param numMines (number of mines)
* @param rows (number of rows)
* @param cols (number of cols)
* @return a list of numbers
**/
const generateMines = (numMines,rows, cols) => ... | true |
eb6428601e8e046f7033be34d5277dad3e99940e | JavaScript | ChristofferNygren/ecchat | /BETA v. 0.7/app.js | UTF-8 | 8,204 | 2.625 | 3 | [] | no_license | "use strict";
//----------------------------------------------------------------------------------------------------------------------
let http = require('http');
let express = require('express');
let app = express();
let bodyParser = require('body-parser');
let fs = require("fs");
let server = http.createServer(app);
... | true |
807345ab738d470bc2176dd69ec2f7122553a451 | JavaScript | krishpranav/scrcpy-gui | /src/test/execa.js | UTF-8 | 458 | 2.59375 | 3 | [] | no_license | const shell = require('child_process')
function test(){
const workerProcess = shell.exec('adb tcpip 1111')
workerProcess.stdout.on('data', function (data) {
console.log(`stdout: ${data}`)
})
workerProcess.stderr.on('data', function (data) {
if (data.includes('more than one device/emulator')) {
shell.execSy... | true |
3e549c56a158f3e1814b5df4efeb6c934d2a12cc | JavaScript | virus231/JS-app | /src/question.js | UTF-8 | 825 | 3 | 3 | [] | no_license | export class Question {
static create(question) {
return fetch('https://question-app-362ac.firebaseio.com/questions.json', { //Ссилка к базе Данних
method: 'POST',
body: JSON.stringify(question),
headers: {
'Content-Type': 'application/json'
}... | true |
806775f14a573ac3d11989c1dfb13bfbdcf50497 | JavaScript | davidrud135/programming-tasks | /max-average-subarray-1.js | UTF-8 | 972 | 3.828125 | 4 | [] | no_license | /*
Task Link: https://leetcode.com/problems/maximum-average-subarray-i/
Difficulty: Easy
Description:
Given an array consisting of n integers, find the contiguous subarray of given length k that has the maximum average value.
And you need to output the maximum average value.
Example:
Input: [1,12,-5,-6,50,3], k = 4
... | true |
c7142928ca8b148b47c0b030b5424ad6dd162fee | JavaScript | ReyesMagos/Node-js-Tutorials | /writefunction.js | UTF-8 | 247 | 2.890625 | 3 | [] | no_license | var fs = require('fs');
function escribir(name, data){
fs.writeFile(name,data,function(err){
if(err)
console.log('Hubo un Error al Escribir. '+ err);
console.log('El Archivo ha sido Guardado Con exito');
});
}
exports.escribir= escribir; | true |
d7d6a463767cc6cc80e45df9a6a919af95311aca | JavaScript | adriancmiranda/describe-type | /is/string/string.unit.js | UTF-8 | 850 | 2.5625 | 3 | [
"MIT"
] | permissive | import test from 'ava';
import * as datatypes from '../../.fixtures/datatypes.fixture';
import * as describeType from '../../index.next';
import string from './string.next';
test('describeType.is.string exposure', (t) => {
t.is(toString.call(describeType.is.string), '[object Function]', 'should be a function');
});
... | true |
fe89c5ec0e0bf4b81ac1d9837248e3a1c458a345 | JavaScript | QuadDamn/rp-diet-recipes | /src/utils/contentfulManagement.js | UTF-8 | 3,255 | 2.6875 | 3 | [] | no_license | import {createClient} from 'contentful-management';
const client = createClient({
accessToken: process.env.REACT_APP_CONTENTFUL_MANAGEMENT_API_TOKEN
});
export async function createEntry(contentType, data, imageData) {
const localeObject = addLocaleToObjectData(data);
try {
const space = await clie... | true |
d9fe9d00daf0d26f5a6dc7401a7c74a106bbee9f | JavaScript | dkkop225/nodejs | /dns.js | UTF-8 | 596 | 2.9375 | 3 | [] | no_license | //dns - ip를 사람이 읽을수 있는 주소로 변경해주는 것
'use strict'
const dns = require('dns')
dns.lookup('test.com',(err,address,family)=> {
console.log(`address:${address},${family}`)
// family => ip 버전 , 4면 ipV4 사용중인것
})
dns.resolve4('archive.org',(err,addresses)=>{
if(err) throw err
const res= JSON.stringify(add... | true |
c3835173adf79e6c40e7b10b2b7dc1c3cf748bae | JavaScript | landeruxin/Desarrollo-Web | /ejercicios/3.3_Ejercicios_Javascript/Ejercicio_7/ejercicio7.js | UTF-8 | 751 | 3.578125 | 4 | [] | no_license |
function inicio(){
var nombre = prompt("Introduzca su nombre:");
var fecha = new Date();
var hora = fecha.getHours();
/*las partes del día se dividen en Mañana: de 6 a 12, Tarde: de 12 a 20 ,Noche: de 20 6 */
if(hora>=6 && hora<12){ //Caso de la mañana entre las 6 y 12
... | true |
900b9fbc6f1e576e6fcdc33a2a949dc068bdef2a | JavaScript | Optimizory/examples-vrest-ng | /test/zephyr-demo/utilities/getZephyrTestStatus.js | UTF-8 | 388 | 2.8125 | 3 | [] | no_license | (function(){
var aFunction = function(){
let vars = this.variables,
isExecuted = vars.$tc.result.isExecuted,
isPassed = vars.$tc.result.isPassed,
result;
if(isExecuted){
if(isPassed){
result = 1;
} else {
result = 2;
}
} else {
result = -1... | true |
7ec3f9288df28f15cf004be0eb71970e793116e6 | JavaScript | beemoboy/keigai | /src/math.js | UTF-8 | 2,363 | 3.484375 | 3 | [
"BSD-3-Clause"
] | permissive | /**
* @namespace math
*/
let math = {
/**
* Generates bezier curve coordinates for up to 4 points, last parameter is `t`
*
* Two point example: (0, 10, 0, 0, 1) means move straight up
*
* @method bezier
* @memberOf math
* @return {Array} Coordinates
* @example
* // Moving straight down
* let p1 =... | true |
4c6f07f872cec37923aaa0d8a0d4a5454cc53c7c | JavaScript | Robin-ou/learnGit | /JSLearningRecord/前端框架/React/react-cli-app/src/pages/ToDoList.jsx | UTF-8 | 2,835 | 2.65625 | 3 | [] | no_license | import React, { Component } from 'react';
import { hashHistory } from 'react-router';
import './ToDoList.less'
class ToDoList extends Component {
constructor(props) {
super(props)
this.state = {
id: 3,
todoList: [{
id: 1,
todo: '学习react'
... | true |
0c85a6a12180ad15534e949543e0057abd84d308 | JavaScript | radugavenea/organizer | /organizer-frontend/WebContent/app/services/eventService.js | UTF-8 | 2,009 | 2.546875 | 3 | [] | no_license | /**
* Created by radu on 27.06.2017.
*/
(function () {
var eventServiceModule = angular.module('eventService', []);
eventServiceModule.factory('EventService', ['$http', 'config',
function ($http, config) {
var service = {}
service.getAllByUserId = getAllByUserId;
... | true |
0240d985903b281d3d0df9b7ca8fb7aa8cb439b5 | JavaScript | lgrinter/js_tutorial | /day.js | UTF-8 | 367 | 3.296875 | 3 | [] | no_license | function dayName(date) {
const daysOfTheWeek = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
return daysOfTheWeek[date.getDay()];
}
function greeting(date) {
const greetingPerDay = ["Good Morning", "Hello", "Good Day", "G'Day", "You Right?", "Whats up!", "Hey You"]... | true |
a050db51328143b8e04c83de59fe9bd72238f52d | JavaScript | itsme-sunil/ReactMiniChallenge | /src/Fact.jsx | UTF-8 | 710 | 3.0625 | 3 | [] | no_license | import React from "react";
// TO DO: Create a Fact Functional component which returns a div in the format below
// NOTE: In order to maintain CSS styling, do not alter the existing tags or their classNames
const Fact = (props) => {
const { animal, fact, image, favorite } = props.info;
console.log('props from Fact'... | true |
53690012e563b1316b1087cb0b437e8e597e17ca | JavaScript | NicoleVenachi/Platzi_Curso_Basico_JS | /clase1_valores.js | UTF-8 | 225 | 3.15625 | 3 | [] | no_license | // primitivos
40 //booolean
'hola' //string
true // boolekan
false
null //empty values
undefined //intentar evitarlos
// tipo objeto
[1,2,3] //array
{nombre: 'Diego'} //Json, objeto
typeof //puedo saber el tipo del dato
| true |
50db61a988a864a2db7becc8070efb64fdd536fb | JavaScript | nettalee19/fitness-app | /client/src/components/ActivityPage/Activity.jsx | UTF-8 | 2,213 | 2.71875 | 3 | [] | no_license | import React, { useState, useEffect} from 'react'
import StopWatch from '../Stopwatch/StopWatch'
import moment from 'moment';
import "./Style/Style.css"
import api from '../ApiSource/api';
import ActivityName from './ActivityName';
export default function Activity({dateToday, totalTime, calories, activity}) {
... | true |
30d635da3f1ed279c744c418c31dc6fe7adafe45 | JavaScript | ZinchenkoVadym/GeekHomeWork | /homeWorkTwo/task2.js | UTF-8 | 3,209 | 4.25 | 4 | [] | no_license | // 2. Task two
class Tamagochi {
constructor() {
this.name = 'Tom';
this.health = 150;
this.eat = 150;
this.drink = 150;
this.sleep = 150;
this.walk = 150;
this.dance = 150;
}
healthTom() {
let myTimer = setInterval(() => {
this.... | true |
58ee4c0901d75cd4dd262a618a288d8a5be87fa4 | JavaScript | alanMarcosA/Ta-Te-Ti | /javas/js.js | UTF-8 | 3,412 | 3.21875 | 3 | [] | no_license | var turno = "X";
var cantPlayer = 1;
var player = "X";
nuevo_juego();
function nuevo_juego() {
let celda = document.querySelectorAll("p");
for (let i = 0; i < celda.length; i++) {
celda[i].innerText = "";
}
if (player != turno && cantPlayer == 1) {
playBot(`${statusTable()}/${turno}`);
}
}
function ju... | true |
1dd352680ef92f136209829dc961347c7ad9950a | JavaScript | i5tong/lesson_shuidi | /interview/js/100题/5.js | UTF-8 | 696 | 3.828125 | 4 | [] | no_license | // 下面代码a 在什么情况下会打印1?
// var a = ?;
// var a = {
// i: 1,
// toString() {
// return a.i++;
// }
// } // 简单数据类型不可能
// a 是变化的 对象
//方法2
// var a = {
// num: 0
// };
// a.valueOf = function () {
// return ++a.num;
// }
// 方法3
// let a = {
// gn: (function* () {
// yield 1;
// yield 2;
// yield ... | true |