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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
5326a205c9a266cfe1bce7d4d8aa22ee55052769 | JavaScript | kavindadilshan/PHP-POS | /js/orderJS.js | UTF-8 | 266 | 2.609375 | 3 | [] | no_license | $("#btnProceed").click(function () {
var customerFormData=$("#formOrder").serialize();
$.ajax({
url:"transaction.php",
method:"post",
async:true,
data:customerFormData
}).done(function (res) {
alert(res)
})
}); | true |
5948161a0264857afd92b65d970bf1534706e046 | JavaScript | masturdating2035/justro | /js/app.js | UTF-8 | 857 | 2.875 | 3 | [] | no_license | const containerFluid = document.querySelector('.container-fluid');
const main = document.querySelector('.main');
setTimeout(function () {
containerFluid.style.display = 'block'
main.style.display = 'none';
}, 3000)
// Smooth Scrolling
const btn = document.getElementById('btn');
document.body.ons... | true |
1b3383182088610753dd22d249cf2d62a9a617ba | JavaScript | RebelRae/Botaniki | /audio.js | UTF-8 | 755 | 3.09375 | 3 | [] | no_license | var audioCtx = new (window.AudioContext || window.webkitAudioContext)()
function boop() {
let oscillator = audioCtx.createOscillator()
oscillator.connect(audioCtx.destination)
oscillator.type = 'triangle'
let startTime = audioCtx.currentTime
let frequencyMax = Math.floor(Math.random()*(9000-4000+1)+4000)
o... | true |
9dbd9f85be08cf09a9da90b80dea853da68dcc19 | JavaScript | manuligit/gcp | /src/renderer/Clock.js | UTF-8 | 2,664 | 3.0625 | 3 | [] | no_license | import React from 'react';
class Clock extends React.Component {
constructor(props) {
super(props);
this.state = {
curr: new Date(),
reset: '',
hours: '',
minutes: '',
seconds: '',
lastWeekly: '',
lastMontly: '',
resetWeekly: '',
resetMonthly: '',
};
... | true |
c27976f0677b25635b447396501fa2394a82b941 | JavaScript | aggeorgiev/NewsBot | /news-service.js | UTF-8 | 834 | 2.59375 | 3 | [] | no_license | var chrono = require('chrono-node');
var nlp = require('compromise')
var NewsAPI = require('newsapi');
var newsapi = new NewsAPI(process.env.NEWS_API_KEY);
exports.getNews = function(text) {
console.log(text);
var r = nlp(text);
var topic = r.match('. about [.]').out('normal');
console.log(topic);
... | true |
cccdf18c3f46d7e53493dcbe1f7548194c67e30d | JavaScript | michaeldjeffrey/OOP---GTD-app | /js/TodoObject.js | UTF-8 | 2,355 | 3.359375 | 3 | [] | no_license | // require user to provide text
function Task (obj) {
//console.log('Task object created', 'obj: ' + JSON.stringify(obj))
// this._id = Math.floor(Math.random()*100) // init to number of tasks +1
this._id = localStorage.length + 1; // init to number of tasks +1
this.status = obj.status || 'incomplete' // ini... | true |
9a6715363cf7439d76d9e2f58ce00b57e3298307 | JavaScript | PatrykDublinowski/Generator | /js/text_loader.js | UTF-8 | 2,043 | 3.6875 | 4 | [] | no_license | var words = [
'Hasła',
'PESEL',
'NIP',
'REGON',
'NUMERU DOWODU'
];
var letters = "abcdefghijklmnopqrstuvwxyz#%&^+=-",
speed = 350,
steps = 6,
loader = document.querySelector('#loader');
var index = 0;
function getRandomLetter() {
var randomLetter = letters[Math.floor(Math.random() * letters.le... | true |
26ded7deebb31fa3655a1d3a947fccf980227050 | JavaScript | standardgalactic/map-maker | /src/vue-app/services/datalayer.service.js | UTF-8 | 1,783 | 2.609375 | 3 | [
"MIT"
] | permissive | import { ipcRenderer } from "electron";
export default class DatalayerService {
constructor(changedKeyHandler, mapReadyhandler) {
this.mapReadyhandler = mapReadyhandler;
this.changedKeyHandler = changedKeyHandler;
this.dimensions = [20,20];
this.selectedCell = "";
this.keyMa... | true |
3322a34a5514e35089ab27631b029be86847a345 | JavaScript | atsid/gcal-leave-scraper | /server/components/CalendarUtils.js | UTF-8 | 3,429 | 2.890625 | 3 | [
"Apache-2.0"
] | permissive | const moment = require('moment');
const debug = require('debug')('app:server:components:CalendarUtils');
const models = require('../persistence/index').models;
const User = models.GmailUser;
require('moment-range');
/**
* Converts a month / year to a moment-range object.
* @param targetMonth Zero-based month
* @par... | true |
8cbb21ec60e28831fb82bd368047058b70dc3052 | JavaScript | IftekarE/Rockgame | /Deciding_winner.js | UTF-8 | 3,571 | 3.21875 | 3 | [] | no_license | function deciding_winner(){ //this function decides the winner of the game after 5 rounds
if(rounds == 0){//this is checking if the system should conclude the game
reset = 0;
}else{
if(rounds < 0){//this is checking if the system should conclude the game
reset = 0;
}
}
if(reset == 1... | true |
7cb916341c04def33a2a5d5bfa65170aa9aea0e5 | JavaScript | Itzli2000/kueski | /main.js | UTF-8 | 943 | 3.609375 | 4 | [] | no_license | /*
* Complete the function below.
* Use console.log to print the result, you should not return from the function.
*/
var data;
var txtFile = new XMLHttpRequest();
txtFile.open("GET", "https://jsonmock.hackerrank.com/api/movies/search/?Title=spiderman&page=1", true);
txtFile.onreadystatechange = function() {
if (t... | true |
73a4aeae4abfd71c86545b24191c21376f7290f7 | JavaScript | pgswinter/sentify_stocks | /src/redux/reducers/addData.reducers.js | UTF-8 | 1,347 | 2.703125 | 3 | [] | no_license | import {createConstant} from "../_constant";
const INITIAL_STATE = {
newPost:{
post:null,
error: null,
loading: true
}
}
export default function(state = INITIAL_STATE, action){
let error;
switch(action.type){
case(createConstant.CREATE_POST):
return {
... | true |
3e035dc67fc9e1fb7da8ad20d01e8c45c242a162 | JavaScript | sajjadafzal/SheetDesigner | /scr/Colors.js | UTF-8 | 260 | 3.078125 | 3 | [] | no_license | class myColors{
constructor(Red, Green, Blue){
this.Red = Red;
this.Green = Green;
this.Blue = Blue;
}
toRGBString() {
let clr = `rgb(${this.Red},${this.Green},${this.Blue})`;
return clr;
}
}
| true |
e174624c7e0f1205223bda3be2f1758420ab5472 | JavaScript | Jprnp/INF0047-DW-2019-1-A | /calculadora_imc/scripts/util.js | UTF-8 | 1,140 | 3.46875 | 3 | [] | no_license | function printQtd() {
let altura = document.getElementById("altura");
let peso = document.getElementById("peso");
if (altura.value <= 0) {
altura.value = "";
document.getElementById("alerta").hidden = false;
return;
}
if (peso.value <= 0) {
peso.value = "... | true |
5cdd6acea2d83fab9e34542027d93cd2e20893ca | JavaScript | SANTOMY/PlaceIt | /back/src/route/spotController.js | UTF-8 | 4,448 | 2.65625 | 3 | [] | no_license | const { v4: uuidv4 } = require('uuid');
const {info, debug, warning, error} = require("../winston");
const Spot = require("../objects/spot");
const fileLabel = "spotController";
const SpotSQL = require("../database/SpotSQL");
const util = require('util');
module.exports = class SpotController{
constructor(){
... | true |
1bfc0ab6b2841619396b0acd3a8e314e051875ee | JavaScript | alaminse/ema-john-simple | /src/components/Cart/Cart.js | UTF-8 | 1,300 | 2.703125 | 3 | [] | no_license | import React from 'react';
import Review from './../Review/Review';
const Cart = (props) => {
const cart = props.cart;
//const totalPrice = cart.reduce((total, prd) => total + prd.price, 0);
console.log(cart)
let totalPrice = 0;
for(let i = 0; i < cart.length; i++){
const product = cart[i]... | true |
62d708f4a4cfe5d2b08b6077442a32ce721d86c0 | JavaScript | emily-curry/electron-snowpack | /playground/playground/src/renderer/index.js | UTF-8 | 987 | 2.59375 | 3 | [
"MIT"
] | permissive | import mwp from 'module-with-process';
const os = require('os');
const v8 = require('v8');
function formatBytes(bytes, decimals = 2) {
if (bytes === 0) return '0 Bytes';
const k = 1024;
const dm = decimals < 0 ? 0 : decimals;
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
const i =... | true |
9299c6b9def899c9f30c4064fc84d999fedce459 | JavaScript | katherfrain/html-101 | /AJAX/scripts.js | UTF-8 | 1,915 | 3.5625 | 4 | [] | no_license | /*const request = new XMLHttpRequest();
request.onreadystatechange = function() {
if(this.status === 200) {
console.log(this);
}
};
request.open("GET", "./sample.txt");
request.send();
fetch('./sample.txt').then(function(response) {
console.log(response);
});
*/
window.addEventListener('DOMContent... | true |
3176f2109ba4386c4a5c13de1a76f8365369ecb6 | JavaScript | jovicaandric/PlanTECH | /MeasurementsDAL/mockData.js | UTF-8 | 1,572 | 2.515625 | 3 | [] | no_license |
var connectionDB = require('../routers/connection.js');
module.exports.WriteMeasurements = function () {
connectionDB.fakeSystemMeasurers(function (data) {
var measurers = JSON.parse(data.measurers);
for (var i = 0; i < measurers.length; i++) {
var value = {
"id": measurers[i].Id,
... | true |
da9cf429837c09c706bc1f3aa110141396f0ded1 | JavaScript | LogiCadi/person_page | /case_7_admin/index.js | UTF-8 | 3,465 | 2.765625 | 3 | [] | no_license |
// 初始化日历
const myCalendar = new SimpleCalendar('.sc-container');
myCalendar.updateSize('100%', '320px');
// 初始化显示今天的计划
showPlan(formatDate(myCalendar.getSelectedDay(), 'yyyy-MM-dd'))
// 添加计划 时间输入框 显示当天日期
$('.add-plan').click(function () {
// input-date 显示当天
let today = inputDateInit()
//完成赋值
$('#sta... | true |
6d73c365a3aa67f1086efa4ca78cff6b94511eea | JavaScript | LETMADE/payments | /app/client/dispatcher.js | UTF-8 | 2,055 | 2.6875 | 3 | [] | no_license | // This dispatcher modifies some of the ideas in Facebook's template:
// https://github.com/facebook/flux/blob/master/src/Dispatcher.js
/** Private variables */
var _prefix = 'asm_';
var _lastId = 0;
var _callbacks = {};
var _isPending = {};
var _isHandled = {}
var _isDispatching = false;
var _pendingPayload = null;... | true |
064f47fc0c9ce1838a898f8bd5e2a35d0ade5300 | JavaScript | Sujan-Kandeepan/Eruku-Mesi | /components/functions/NewsStoryFunctions.js | UTF-8 | 1,944 | 2.75 | 3 | [] | no_license | import { del, get, paragraphs, post, text } from '../../shared/SharedFunctions';
// Fetch news stories and populate component state array
export const fetchNewsStories = (props, setStories, callback) => {
get(`${props.baseURL}/newsStories`)
.then(response =>
setStories(response.map(item =>
({ id: i... | true |
07698e567302ae7a9dd5636615576417c9117c72 | JavaScript | FedeGB/DungeonsAndDragons | /dungeons-dragons/react-dungeon/src/PlayerSheet/Base.js | UTF-8 | 5,302 | 2.546875 | 3 | [] | no_license | import React from "react"
import './Base.css'
class Base extends React.Component {
state = {
dataKey: null,
stackId: null,
charName: '',
prevcharName: '',
playerName: '',
class: '',
level: '',
race: '',
age: '',
gender: ''
}
constructor(props) {
super(props)
this.handleChange =... | true |
c435312ba8f78c494cc7a7d7a63c4ad235daa6c3 | JavaScript | i-rebel-aj/SalaryPortal | /lib/employeeValidator.js | UTF-8 | 334 | 2.6875 | 3 | [] | no_license | exports.getDesignationInfoById=(body, id)=>{
try{
let foundDesignation={}
body.forEach((designation)=>{
if(designation._id.toString()==id.toString()){
foundDesignation=designation
}
})
return foundDesignation
}catch(err){
console.lo... | true |
725dd668f6e540c09bf35cbfd321c7d6d349f6f0 | JavaScript | mithleshk/lazy.js | /lib/counted_sequence.js | UTF-8 | 433 | 2.703125 | 3 | [
"MIT"
] | permissive | // TODO: This should return an object too (like GroupBySequence).
var CountedSequence = CachingSequence.inherit(function(parent, keyFn) {
this.each = function(fn) {
var grouped = {};
parent.each(function(e) {
var key = keyFn(e);
if (!grouped[key]) {
grouped[key] = 1;
} else {
... | true |
01dc25ab53ad2361f9c6a4ecf815bd955d7d7a9a | JavaScript | nixford/SoftUni-JavaScript-2020-TasksAndExams | /JS-Advanced/Tasks/Objects-&-Classes-More-Exercise/Objects-&-Classes-More-Exercise.js | UTF-8 | 15,048 | 3.71875 | 4 | [
"MIT"
] | permissive | // 01. Rectangle
class Rectangle{
constructor(width, height, color){
this.width = width,
this.height = height,
this.color = color
}
calcArea(){
return this.width * this.height;
}
}
// 02. Score to HTML
function scoreToHTML(input){
let arr = JSON.parse(input);
... | true |
426cd2c5b75a8b04818691384e7a4b3acb607121 | JavaScript | dangaakamm/study | /node/liu/auto.js | UTF-8 | 2,192 | 2.96875 | 3 | [] | no_license | #!C:/Users/DefaultAppPool/node.exe
var process=require("process");
var pathobj=require("path");
var fs=require("fs");
class auto{
constructor(){
this.srcs=[];
this.tasks=[];
this.cmds=[];
this.argv=process.argv[2]||"defult";
}
task(name,callback){
var obj={};
... | true |
6822c3b6f50788c8a9286e391ea6c207348eabba | JavaScript | Sprite-FFF/LeetCode | /144.二叉树的前序遍历.js | UTF-8 | 1,118 | 3.625 | 4 | [] | no_license | /*
* @lc app=leetcode.cn id=144 lang=javascript
*
* [144] 二叉树的前序遍历
*/
// @lc code=start
/**
* Definition for a binary tree node.
* function TreeNode(val, left, right) {
* this.val = (val===undefined ? 0 : val)
* this.left = (left===undefined ? null : left)
* this.right = (right===undefined ? null ... | true |
2aedca6ebb121cadc3df8d9a5cb29eb853d1b715 | JavaScript | kashanmalick/Light-on-Off | /app.js | UTF-8 | 904 | 2.71875 | 3 | [] | no_license | function lightOn(){
var Lo = document.getElementById("offimage").src="./images/lighton.jpg";
}
function lightOff(){
var Lf = document.getElementById("offimage").src="./images/lightoff.jpg";
}
function imgchange(){
var img1 = document.getElementById("bndimg");
if(img1.src.match('lightoff')){
img1... | true |
71dc717478a18f65a504ca8a9489098757e9db36 | JavaScript | nobitco/apifake | /tests/fixtures/assignments.js | UTF-8 | 3,215 | 3.109375 | 3 | [] | no_license | 'use strict'
const faker = require('faker')
// Retorna un entero aleatorio entre min (incluido) y max (excluido)
// ¡Usando Math.round() te dará una distribución no-uniforme!
function getRandomInt (min, max) {
return Math.floor(Math.random() * (max - min)) + min
}
var roles = ['practicante', 'tutor', 'je... | true |
628f2f73bcda9471c4deaabd0a33183cd84724aa | JavaScript | leafty/futuristic | /lib/monad-core.js | UTF-8 | 1,059 | 3.140625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | /**
* monad-core.js
* -------------
* Generic monad definitions
* Author: Johann-Michael Thiebaut <johann.thiebaut@gmail.com>
*/
/**
* Monad class represents elements of a monad.
* unit or return is the class constructor
* bind is also called flatMap (in particular for container monads)
*/
var Monad = functio... | true |
95a8760b4a682e11e5270cbf8bfd60289385b816 | JavaScript | xitanggg/tag-cloud-in-tipstory-explore-page | /src/TagCloud/utils/isTagCollided.js | UTF-8 | 1,051 | 3.328125 | 3 | [
"MIT"
] | permissive | /**
* isTagCollised checks if tagObj collides with any tagObjs in
* the tagList array. It returns true to indicate a collision.
*
* @param {Object} tagObj
* @param {Array} otherTags
*/
const isTagCollided = (tagObj, otherTags) => {
const { x1, y1, x2, y2 } = tagObj;
// notOnTop is the list of tags that current ... | true |
94b31b7d39038130c21f0fd059146024c64482f1 | JavaScript | Qwazii/csci-380 | /2-counter/app.js | UTF-8 | 1,024 | 3.609375 | 4 | [] | no_license | // Nitin Kumar
// uses 'animals' list
// set inital value to zero
let count = 0;
// select value and buttons
const value = document.querySelector("#value");
const btns = document.querySelectorAll(".btn");
console.log(btns)
// for (let i = 0; i < btns.length; i++) {
// // btn.addEventListener()
// }
const animals =... | true |
d098643f04cbfef5c71baed338baad77eaf4b7bf | JavaScript | tatsianaclifton/Cloud-Development | /Event API/controllers/auth.js | UTF-8 | 787 | 2.515625 | 3 | [] | no_license | var passport = require('passport');
var BasicStrategy = require('passport-http').BasicStrategy;
var User = require('../models/user');
//manage authentication for API endpoints
passport.use(new BasicStrategy(
function(username, password, callback){
User.findOne({username: username}, function(err, user){
if(err) {... | true |
6fcc982bb8de7143f71db1ff75a16acb353158d4 | JavaScript | kigiri/dom-js | /harder-bigger-bolder-stronger/solution.js | UTF-8 | 712 | 3.59375 | 4 | [] | no_license | const body = document.querySelector('body')
const shapes = [...Array(100).keys()]
const random = (min, max) => {
min = Math.ceil(min)
max = Math.floor(max)
return Math.floor(Math.random() * (max - min + 1)) + min
}
const alphabet = 'abcdefghijklmnopqrstuvwxyz'
export const generateLetters = () => {
shapes.f... | true |
38b7e3b0342278633df40bf49b9d7a95d841199f | JavaScript | ladjs/remark-license | /index.js | UTF-8 | 3,333 | 2.53125 | 3 | [
"MIT"
] | permissive | 'use strict';
var parse = require('parse-author');
var spdxLicenseList = require('spdx-license-list');
var heading = require('mdast-util-heading-range');
module.exports = license;
var fs;
var path;
try {
fs = require('fs');
path = require('path');
} catch (err) {}
var LICENSE = /^licen[cs]e(?=$|\.)/i;
var htt... | true |
9d6e25c1fc9a07523bab045de0d61afcf3e32386 | JavaScript | Gustavomdcl/module_course | /assets/js/jquery.main.js | UTF-8 | 11,030 | 2.796875 | 3 | [] | no_license | /* Main v1.00.0 | (c) 2018 | Agência Webnauta ⊙‿⊙ ʕ•ᴥ•ʔ ಠ_ಠ */
//DICIONÁRIO
/*
1) Tipos de Funções:
- Listener: Funções que atualizam variáveis de acordo com algum estado do sistema (várias vezes a partir de mudança);
- Setup: Funções que declaram condições do sistema (somente uma vez);
- Action: Funções qu... | true |
bcac5cf719d9bc1b877d9a0890351bba2ff3e3e4 | JavaScript | bergen-design/bergen-design.github.io | /about-script.js | UTF-8 | 4,439 | 2.84375 | 3 | [] | no_license |
// // image slide in
window.onscroll = function () { myFunction() };
function myFunction() {
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
let img = document.getElementsById("myTop");
img.className = "show";
console.log(img);
... | true |
38cdc52da0aad6cbe1ce9d43cd3bec4c693a5633 | JavaScript | weaverHope/upgrade-basic-algoritms | /Iteration#1.js | UTF-8 | 379 | 4.625 | 5 | [] | no_license | /*
1.1 Crea una variable llamada myFavoriteHero, asigna el valor Hulk a ella.
1.2 Crea una variable llamada x, asigna el valor 50 a ella.
1.3 Crea una variable llamada 'h' con el valor 5 y otra 'y' con el valor 10.
1.4 Crea una otra variable 'z' y asignale el valor de 'h' + 'y'.
*/
let myFavoriteHero = "Hulk";
let x =... | true |
e9bdd2a12174644a667e05d253fab489ed0d9d7a | JavaScript | anildalar/WebTraining101 | /export_es6.js | UTF-8 | 140 | 2.953125 | 3 | [] | no_license | //1. Function
//Named Export
export function a(){ //export keyword introduced in ES6 ESCMA 2015
console.log("Hello from a function");
} | true |
7b75f76cc0d4e1c8db7f996c1f0efe1a7c13681f | JavaScript | jayrbolton/tipo | /lib/match-any.js | UTF-8 | 629 | 2.53125 | 3 | [] | no_license | const R = require('ramda')
const matchTypes = require("./match-types")
const TypeMatchError = require('./errors/type-match-error')
const printType = require('./print-type')
const matchAny = R.curryN(3, (node, a, bs) => {
const result = R.map(matchNoErr(node, a) , bs)
if(!R.all(result)) {
bTypes = R.map(printTy... | true |
c8f97ffb09ce72cea9b1c92aee6471cdca27ba8e | JavaScript | ardok/python-playground | /python-flask/static/js/view.js | UTF-8 | 3,962 | 3.015625 | 3 | [] | no_license | /**
* Get element
* @param elem element to find on DOM
* @returns {*}
*/
function getViewElem(elem) {
if (elem && elem.toString() != '[object HTMLDivElement]') {
// for id
var elemById = document.getElementById(elem);
if (elemById) elem = elemById;
// for class
var elemsByClass = document.get... | true |
912ea4ea94837aa495676719307e15fb32a5fadf | JavaScript | Toobabintemoin/Blockchain | /blockchain.js | UTF-8 | 1,770 | 3.296875 | 3 | [] | no_license | let sha256 = require('js-sha256')
const Block = require('./block')
class Blockchain {
constructor(genesisBlock){
this.blocks = []
this.addBlock(genesisBlock)
}
addBlock(block){ // we create this method to add block in the blocks if blocks is emp... | true |
1e28ebd0a0437c92fcf37bc600d895bc543256cf | JavaScript | LLouLiang/codecademy | /rockPaperScissors.js | UTF-8 | 1,564 | 3.8125 | 4 | [] | no_license | const getUserChoice = (userInput) => {
userInput = userInput.toLowerCase();
if(userInput == 'rock' || userInput == 'paper' || userInput == 'scissors'){
return userInput;
}else{
console.log('error');
}
}
const getComputerChoice = ()=>{
let randomNumber = Math.floor(Math.random() * 3);
let resul... | true |
517df11806f4070acb57d5a59dbe6e79a1ef34d5 | JavaScript | zyhon96/andela-server | /src/helpers/joi.js | UTF-8 | 502 | 2.515625 | 3 | [] | no_license | const joiValidator = async (data, schema) => {
let message;
const validationOptions = {
allowUnknown: true, // allow unknown keys that will be ignored
stripUnknown: true, // remove unknown keys from the validated data
abortEarly: true, // validate all inputs befor flagging error
};
try {
await s... | true |
81d944fccbc2d030d8ff206e9864d4875e121b91 | JavaScript | pabloLagioia/pong | /app.js | UTF-8 | 4,573 | 2.59375 | 3 | [] | no_license | var WebSocketServer = require("websocket").server,
http = require("http"),
project = require("./package.json"),
config = require("./config.json"),
path = require("path"),
fs = require("fs"),
Ball = require("./Ball"),
Espectator = require("./Espectator"),
Player = require("./Player"),
... | true |
499240c0baafc0b601efec8ce2fe2746e733c1cd | JavaScript | Sydney584/irbooks-frontend | /src/components/UserForm.js | UTF-8 | 2,633 | 2.984375 | 3 | [] | no_license | // import { BASE_URL } from "../constraints";
// import { useState, useEffect } from "react";
// export default function UserForm({user, deleteUser, initialDelay=0}) {
// const [users, setUsers] = useState({ first_name: "", last_name: "", user_name: "", email: "" })
// const [newUser, setNewUser] = u... | true |
64fc581edb39785d780eec7a81540919b8f0490b | JavaScript | rao-karthik/masai-local | /Unit-2/week_08/02-23 Fetch/6_masaiRegistration/login.js | UTF-8 | 1,168 | 3.046875 | 3 | [] | no_license | var loginbtn = document.getElementById("loginForm");
loginbtn.addEventListener("submit", loginMe);
var password = document.getElementById("passwordLogin");
var username = document.getElementById("usernameLogin");
function loginMe(e){
e.preventDefault();
var userData = {
password: password.value,
... | true |
ea186bd98bbf1a8fe9156791b709425b107c5712 | JavaScript | WeiAnAn/React-Todo-List | /src/Components/AddTodoInput/AddTodoInput.jsx | UTF-8 | 935 | 2.59375 | 3 | [] | no_license | import React, { Component } from 'react';
import { addTodo } from '../../Actions/Action.jsx';
import './AddTodoInput.scss';
class AddTodoInput extends Component {
constructor(props){
super(props);
this.state = {
todoInput: ""
}
}
onChangeTodoInput(e){
this.setSta... | true |
20cec38bbeab0f27ae1380cee0a695c058dd98ec | JavaScript | peterjhan88/storio | /client/components/Search.jsx | UTF-8 | 2,360 | 2.59375 | 3 | [] | no_license | import React, { useState } from 'react';
import { withRouter } from 'react-router-dom';
const Search = props => {
const [city, setCity] = useState('');
const [state, setState] = useState('');
const [cityError, setCityError] = useState('');
const [stateError, setStateError] = useState('');
const handleCityCh... | true |
27610740c5195e4da9c33af8a26b9b0c0a57b257 | JavaScript | denrolya/myby | /packages/custom/transactions/public/services/transaction.js | UTF-8 | 2,421 | 2.578125 | 3 | [
"MIT"
] | permissive | 'use strict';
angular
.module('mean.transactions')
.factory('TransactionService', TransactionService);
TransactionService.$inject = ['$filter'];
function TransactionService($filter) {
var service = {
generateGetRequestParameters: generateGetRequestParameters,
validateTransaction: validateT... | true |
c48717e85f72567ec31ef4a07662be28d7870376 | JavaScript | loreLin/javascript | /gobang/gobang.js | UTF-8 | 2,868 | 2.765625 | 3 | [] | no_license | window.onload = start;
var th = document.getElementsByTagName("th");
var record = new Array(100);
var top = 0;
var flag = 1;
var win = 0;
function start() {
document.getElementById("newStart").onclick = newStart;
document.getElementById("back").onclick = back;
for (var i = 0; i < 100; i++) {
th[i].... | true |
871367e91901541dca3100270d084be0f0de4674 | JavaScript | DnAp/DnNearestLinkFinder | /helpers.js | UTF-8 | 1,573 | 3.390625 | 3 | [
"MIT"
] | permissive | const TWO_PI = Math.PI * 2;
/**
* @param {Number[]} v1
* @param {Number[]} v2
* @return {number}
*/
function distanceSqrt(v1, v2) {
return Math.pow((v2[0] - v1[0]), 2) + Math.pow((v2[1] - v1[1]), 2);
}
/**
* Find the nearest point on a segment A,B
*
* @param {Number[]} a
* @param {Number[]} b
* @param {N... | true |
d7344546968a71105ed64611b62d21eca51f16ca | JavaScript | pashaigood/ru.fun-box.testwork | /src/app/components/points/point.factory.js | UTF-8 | 3,766 | 2.8125 | 3 | [] | no_license | (function () {
angular
.module('ruFunBoxTestwork')
.factory('pointFactory', pointFactory);
/**
* Фабрика создаёт новую сущность точки.
* @ngInject
* @returns {Function}
*/
function pointFactory($http, $log) {
function Point(data) {
data = data || {};... | true |
57839bd7740991fd731105dbf4d7b0b75dbb2a1b | JavaScript | fpmacedo/fase03introaoreact | /src/components/Techitem.js | UTF-8 | 544 | 2.625 | 3 | [] | no_license | import React, {Component} from 'react';
import PropTypes from 'prop-types';
function TechItem({tech, onDelete}){
return(
<li>
{tech}
<button onClick={onDelete} type="button">Remover</button>
</li>
);
}
// //preenche por default caso algum parametro na seja passado a funcao
// TechI... | true |
3bfdc06031c26b99a88d6eeb5888f557f2a53a9e | JavaScript | tripleeagle/OnlineChat | /frontend/src/reducers/signalrReducer.js | UTF-8 | 1,655 | 2.984375 | 3 | [] | no_license | import * as messageTypes from '../actions/types';
const initialState = {
items: []
};
export default function(state = initialState, action) {
switch (action.type) {
case messageTypes.NEW_MESSAGE_NOTIFICATION:
return {
...state,
items: [...state.items, actio... | true |
f6b9d7d6c12125bac52268f3e152080b29f3884a | JavaScript | sabpsuj/JavaScriptWorkshop | /Warsztaty/4_Menu/js/app.js | UTF-8 | 641 | 2.96875 | 3 | [] | no_license | document.addEventListener("DOMContentLoaded", function () {
console.log('Działa!');
var mainList = document.querySelectorAll('.nav>ul>li');
console.log(mainList);
for(var i=0; i<mainList.length; i++){
mainList[i].addEventListener('mouseover', function (event) {
if(this.children.len... | true |
63ad47a0f221079fa4ada09a6e768c9c21dd48e2 | JavaScript | barondi/self-learning | /000-ES6/5.扩展运算符(含深浅拷贝).js | UTF-8 | 3,310 | 3.734375 | 4 | [] | no_license | // function spread(x, ...args) {
// //sum.apply(null,args);//改变了this,注意和call传递参数的区别
// sum(...args);//展开运算符
// }
// function sum(a,b,c,d) {
// console.log(a, b, c, d);
// }
// spread('x',1,2,3,4);
// let arr=[...[1,2,3],...[4,5,6]];
// //let arr=[1,2,3].concat([4,5,6])
// console.log(arr);
// console.log(M... | true |
23110d7410b0dab6fbfa54759a29b14e05a01028 | JavaScript | mrcsrc/nordeng.github.io | /js/script.js | UTF-8 | 1,468 | 3.171875 | 3 | [] | no_license | // inicio menu mobile
let menuContent = document.querySelector('#menu-content');
let menuClose = document.querySelector('#menu-close');
let menuOpen = document.querySelector('#menu-open');
menuClose.classList.add('visible-true');
const menuOpenHandler = () => {
menuContent.classList.add('hide-menu');
men... | true |
8d63a74fcb25f76aba83df867733c1bb44ddb8d2 | JavaScript | musefind/mobx-models | /src/Schema.js | UTF-8 | 2,158 | 3.359375 | 3 | [] | no_license | /**
* Class Schema provides the functionality to parse javascript objects into Model instances.
*
* @example
* const authorSchema = new Schema(Author)
* const blogSchema = new Schema(Blog, {
* author: authorSchema,
* })
*
* const data = {
* id: 1,
* title: 'test',
* content: 'blog',
* auth... | true |
1b8c9c955a4f850b9a32bbe644499efab3839bc2 | JavaScript | Polidoro/minesweeper-react-native | /components/PunAnswer.js | UTF-8 | 868 | 2.734375 | 3 | [] | no_license | import React from 'react';
import styles from '../styles';
import { Text, View, Platform } from 'react-native';
const PunAnswer = React.createClass({
calculateLetter(letterObject) {
let displayCharacter = (letterObject.actualLetter === ' ') ? ' ' : '_';
if(letterObject.revealed) {
displayCharacter = l... | true |
22cbf3b90e399906367276d679b0a6229559b5fd | JavaScript | Jelhill/BuyCoinChallenge | /script.js | UTF-8 | 3,088 | 2.921875 | 3 | [] | no_license | const baseUrl = "https://api.github.com/graphql"
const githubInfo = {
"token": "bf1fc737a45e7f73557940497d5558a27f7c709a",
"username": "jelhill"
}
const headers = {
"Content-Type": "application/json",
Authorization: "Bearer " + githubInfo.token
}
const body = {
"query": `
query {
... | true |
8c267fae9481192ad7a4541feaaff09f9abde8dd | JavaScript | emangano2816/e-commerce | /routes/api/tag-routes.js | UTF-8 | 3,779 | 2.78125 | 3 | [
"MIT"
] | permissive | const router = require('express').Router();
const { Tag, Product, ProductTag } = require('../../models');
// The `/api/tags` endpoint
//GET Tags Route
router.get('/', async (req, res) => {
try {
// find all tags; include associated Product data
const tagData = await Tag.findAll({
include: [{ model: Pr... | true |
834bfb5812e6b6af856c7741d691acc2680adb4a | JavaScript | rabiulalam1/lab-es6-promises | /public/javascripts/script.js | UTF-8 | 2,242 | 3.921875 | 4 | [] | no_license | // This will print in the wrong order
// we added it for you to test to make sure data is loaded
// 🚨🚨🚨 comment out the next 3 lines when you start working on the code
for (let i = 0; i < mashPotatoes.length; i++) {
//addFood(steak[i], '#steak');
console.log(mashPotatoes[i]);
}
// Iteration 1 using callbacks
ad... | true |
a3ad3a4f79ebf47c1e1c74cee752383cdc2eb2f2 | JavaScript | drklrd56/Hotel-Management-System | /implementation/src/js/models/CheckFunctions.js | UTF-8 | 592 | 2.78125 | 3 | [] | no_license |
function validateEmail(email) {
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(String(email).toLowerCase());
}
export const EmailCheck = (email) => {
if(validateEmail(email... | true |
fb1104fd25b306e2fa686d874c9c8af4fca1f8a6 | JavaScript | negabaro/react-router-example | /react-router-4-example-clone/src/app_hoge.jsx | UTF-8 | 2,550 | 2.828125 | 3 | [
"MIT"
] | permissive | import React from 'react';
import ReactDOM from 'react-dom';
import { createStore } from 'redux';
import { Provider, connect } from 'react-redux';
/* Actionsの実装 */
// Action名の定義
const SEND = 'SEND';
// Action Creators
function send(value) {
// Action
return {
type: SEND,
value,
};
}
/* Reducersの実装 */
... | true |
2430b0e1e26349a6627bbeb683f891670470ff46 | JavaScript | dev-oddments/algorithm | /boj/2407(조합,DP).js | UTF-8 | 1,463 | 3.4375 | 3 | [] | no_license | // 조합
// https://www.acmicpc.net/problem/2407
const fs = require('fs');
const stdin = (process.platform === 'linux'
? fs.readFileSync('/dev/stdin').toString().trim()
: `5 3`
).split('\n');
const input = (() => {
let line = 0;
return () => stdin[line++];
})();
const [N, M] = input()
.split(' ')
.map((each... | true |
07e7fe04b97a0b7cdee7cac342e0b1979f257a70 | JavaScript | alyani17/tugas2 | /soal4.js | UTF-8 | 344 | 3.828125 | 4 | [] | no_license | var n=100;
var counter = 0;
var primeNumbers = "Prime Numbers: ";
for(var i=2; i<n; ++i)
{
counter=0;
for(var j=0; j<n; ++j)
{
if(i>j && i%j === 0)
{
++counter;
}
}
if(counter === 1)
{
primeNumbers = primeNumbers + i + " ";
}
}
co... | true |
aa0a74004b3a002936c87050cd5f74594b96d9fe | JavaScript | sorwarduet/TabsApps | /TabsProject/src/screens/Albums.js | UTF-8 | 1,055 | 2.640625 | 3 | [] | no_license |
import React, { Component } from 'react';
import { View, ScrollView } from 'react-native';
//import third party library
import axios from 'axios';
//import create own Component
import AlbumDetail from '../components/AlbumDetail';
class Albums extends Component {
state = {
albums: [],
userId: 1,
... | true |
963973a4986907ecc8c91d598308a76494b9e99b | JavaScript | ndemeyvan/AppCostApi | /utils/mailer.js | UTF-8 | 5,357 | 2.609375 | 3 | [] | no_license | "use strict";
module.exports.mailer = function (data) {
const nodemailer = require("nodemailer");
let info = {
platform: data.platform,
price: data.price,
sector: data.sector,
name: data.name
}
function responseToHtml() {
let html = ``;
data.response.forEach((quesAan) => {
html+= ... | true |
7390955706e5ab343be8485ebe6625ff31e7bfd1 | JavaScript | pomirkovany/CacheAPI | /src/components/dummyStrings/dummyStringsService.js | UTF-8 | 1,495 | 3.15625 | 3 | [] | no_license | class DummyStringsService {
constructor(model) {
this.model = model;
}
/**
* Retrieves value from cache or generates new
* one in case of cache miss
*
* @param key
* @returns {Promise<*>}
*/
async getDummyString(key) {
let dummyStr = await this.model.getByK... | true |
6f8df0d6f27701a82fd2026bdab28a74b816295c | JavaScript | hugogit120/itemfinder-frontend | /src/pages/products/AddProduct.js | UTF-8 | 3,512 | 2.78125 | 3 | [] | no_license | import React, { Component } from "react";
import apiService from "../../services/Api";
import service from "../../services/UploadService"
import './AddProduct.css'
class AddProduct extends Component {
state = { title: "", image: "", description: "", price: "", category: "", image: "https://cdn.samsung.com/etc/desi... | true |
6e301d329af4d21d349efebb93404294f66db7a0 | JavaScript | samilawson/Kyros | /commands/fun/emoji.js | UTF-8 | 608 | 2.859375 | 3 | [
"MIT"
] | permissive | const { Command } = require("discord.js-commando");
module.exports = class EmojiCommand extends Command {
constructor(client) {
super(client, {
name: "emoji",
group: "fun",
memberName: "emoji",
description: "Gets the custom emojis of a guild if any exist.",
examples: ["emoji"]
}... | true |
f9fb23b4c4b0481bda7e9b3ecaedc6f284b15cee | JavaScript | luciacheila/ctesp-backend | /ficha4/app.js | UTF-8 | 655 | 3.109375 | 3 | [] | no_license | var Config = require("./config");
var Emitter = require("./emitter");
var emtr = new Emitter();
emtr.on("LOGIN", function() {
console.log("Welcome user teste");
});
emtr.on(Config.LOGIN, function() {
console.log("Welcome user");
});
emtr.emit("LOGIN");
var person = {
name: "Cheila",
age: 19,
ge... | true |
f091163d152ff960503fbc7bd4c611e337289840 | JavaScript | josephpeyton/temperature-monitor | /example.spec.js | UTF-8 | 1,560 | 2.6875 | 3 | [] | no_license | describe("Example App Test Suite", function() {
describe("Example Test Suite", function() {
it("true will be truthy", function() {
expect(true).toBeTruthy();
});
});
describe("Example Service Test Suite", function() {
beforeEach(function() {
module('app')... | true |
82dc96e168287cb0d9604735d6829b3ba17b9200 | JavaScript | mannyy91s/w5d2-test-a-library | /js/tests.js | UTF-8 | 3,133 | 3.03125 | 3 | [] | no_license | // Mocha & Chai Test Suite (for Tuesday's assignment)
var expect = chai.expect;
describe('MoDom', function() {
describe('md Global Variable', function() {
it('should exist', function() {
expect(md).to.exist
})
})
describe('md.one()', function() {
it('should return one thing', function() {
... | true |
57f53250b3e165c2390add5f1fc4acafd6439b1b | JavaScript | benduran/unpm | /lib/respond/json.js | UTF-8 | 235 | 2.609375 | 3 | [
"MIT"
] | permissive | module.exports = json
function json(status, data) {
this.res.writeHead(status, {
'Content-Type': 'application/json'
})
try {
return this.res.end(JSON.stringify(data))
} catch(err) {
return this.onError(err)
}
}
| true |
af4f0f685f1f1df0b459ce1f2c13a81fa9da23c0 | JavaScript | nandansn/protractor | /interview/2.js | UTF-8 | 407 | 3.453125 | 3 | [] | no_license | // prototype chain
// a prototype is an object that serves as a blueprint for creating instances of objects with similar properties and methods. The prototype chain refers to the relationship between an object and its prototype, and how this relationship affects property and method access.
let vehicles = {
move: ... | true |
8ec24f348a8e4583844d150312a8788c77499b1a | JavaScript | manel-gh/checkpointRedux | /src/JS/Reducers/listTasks.js | UTF-8 | 969 | 2.6875 | 3 | [] | no_license | import {
ADD_TASK,
DELETE_TASK,
DONE_TASK,
EDIT_TASK,
} from "../ActionTypes/listTasks";
const initialState = {
listTasks: [],
};
const TaskReducer = (state = initialState, { type, payload }) => {
switch (type) {
case ADD_TASK:
return { ...state, listTasks: [...state.li... | true |
62aec6c29616af84cca4c199e1f036c23a632329 | JavaScript | shrihariharanba/node-basket | /myfirst-node/events/my-http/myHttp.js | UTF-8 | 1,373 | 2.765625 | 3 | [] | no_license | const http = require('http');
const server = http.createServer((req, res) => {
// console.log(req.method);
// res.write('Hello World');
// res.write('Hello from Node JS');
// res.write('Node is awesome');
// res.write('Nodemon is awesome');
// res.write('I have created a server');
// res.end();
if (req... | true |
cf65c3d8d68d3bfc0b975754abe8ca6470b048fe | JavaScript | BaronVonPerko/react-todo | /app/js/services/TodoService.js | UTF-8 | 1,211 | 2.53125 | 3 | [] | no_license | import AjaxService from './AjaxService';
export default class TodoService {
constructor() {
this.ajax = new AjaxService();
}
getTodos = (listId) => {
return new Promise((resolve, reject) => {
const url = 'http://localhost:8080/api/todo/' + listId;
this... | true |
4e4934d035354415af103d4c5e34d0d179b461a7 | JavaScript | annahaff/vefforritun | /views/tonleikar.js | UTF-8 | 1,655 | 2.53125 | 3 | [
"MIT"
] | permissive | $(document).ready(function(){
$('form').submit(function(e)
{
// kóði til að keyra þegar form submittað
// this er formið, $(this) býr til jQuery hlut af forminu
var form = $(this);
$('div.resault').empty();
e.preventDefault();
//náum í gögn úr gagnagrunninum
var request = $.ajax({
'url': 'http://apis... | true |
a06d15c3ed111d74311a8d44feeb21d7f44a2b63 | JavaScript | csamelian27/Algorithms | /Helper Methods/averagePair-multiplePointers.js | UTF-8 | 892 | 4.25 | 4 | [] | no_license | // Write a function called averagePair. Given a sorted arr of integers and a target average,
// determine if there is a pair of values in the arr where the average of the pair equals the target average.
// There may be more than one pair that matches the average target.
// Lizzy Solution
function averagePair(arr, avg)... | true |
77698359387dbe4b74bfb4befb8ae69099bee8d4 | JavaScript | andrew09/weather-hill | /components/Weather.js | UTF-8 | 2,989 | 2.84375 | 3 | [] | no_license | import React from 'react'
import Request from 'superagent'
class Weather extends React.Component {
constructor(props) {
super(props);
this.state = {
currentStatus: '',
currentDay: '',
currentCelsius: '',
days: []
}
}
componentWillMount() {
var currentURL = 'http... | true |
4780b99be8cca75b40a895533e5302feaf97f4c1 | JavaScript | bobbyroe/p5-play | /tree-01/index.js | UTF-8 | 1,879 | 3.015625 | 3 | [] | no_license | // Tree code converted from Jean-no's excellent Processing example : http://www.openprocessing.org/visuals/?visualID=1758
let tree;
let mid = { x: 0, y: 0 };
const TO_RADIANS = Math.PI / 180;
function getBranch(props) {
let { length, angle, generation } = props;
let children = [];
let counter = 0;
let multipli... | true |
39e826f30dd6b0a1be47ec3c7fffa175a3a1fd4f | JavaScript | jakerobers/nodejs-angular-jsonapi-demo | /jsonapi-server-demo/app.js | UTF-8 | 1,670 | 2.5625 | 3 | [] | no_license | var express = require('express');
var app = express();
var HospitalSerializer = require('./serializers/hospital.js');
var EquipmentSerializer = require('./serializers/equipment.js');
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origi... | true |
ddc7ebf2f84548fe93c72fb248a34540594be847 | JavaScript | giahungcr7/giahungcr7 | /bai-test-js/ex5-xd-nam-nhuan/js/test.js | UTF-8 | 295 | 2.96875 | 3 | [] | no_license |
var year = new Date();
var y = year.getFullYear();
document.getElementById('p').innerHTML = y;
if((y%4===0 && y%100!==0 && y%400!==0)||(y%400===0 && y%100 ===0)){
document.getElementById('s').innerHTML = "nhuận";
}else{
document.getElementById('s').innerHTML = "không nhuận";
} | true |
2c35b542923a09fcaf85029b6d49c9222700806e | JavaScript | Cour-de-cassation/sder | /dist/modules/authenticator/lib/passwordHandler.js | UTF-8 | 3,439 | 2.609375 | 3 | [] | no_license | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.passwordHandler = void 0;
var lodash_1 = require("lodash");
var lib_1 = require("../../../lib");
var MIN_LOWER_CASE_CHARACTERS_COUNT = 2;
var MIN_UPPER_CASE_CHARACTERS_COUNT = 2;
var MIN_DIGITS_COUNT = 2;
var MIN_SPECIAL_CHARACTERS_COU... | true |
799a4ca694c062048836ed05491e54912fd01995 | JavaScript | grnnn/RitualGame | /src/StateMachine/State.js | UTF-8 | 1,601 | 3.671875 | 4 | [] | no_license | "use strict";
//Dinky little state class
class State
{
constructor()
{
//public
this.transitions = [];
this.data = {};
this.update = function(state){};
//private
this._resetData = {};
}
setTransition( state /*: State*/, conditional /*:bool(State)*/, priority /*:int*/)
{
var tran... | true |
d44aec0791df792611263953288b85548015684c | JavaScript | nik-el/137060-what-to-watch-4 | /src/reducer/view/reducer.js | UTF-8 | 601 | 2.546875 | 3 | [] | no_license | import {extend} from "../../utils/extend.utils";
import {ActionType} from './actions';
const FEED_LIMIT = 8;
const initialState = {
currentGenre: null,
feedLimit: FEED_LIMIT
};
export const reducer = (state = initialState, action) => {
switch (action.type) {
case ActionType.SET_GENRE:
const currentGe... | true |
4515eea69774190e9cacf6d33d6e92b669f46749 | JavaScript | pankkap/fullstack-2021 | /index.js | UTF-8 | 1,256 | 2.65625 | 3 | [] | no_license | // Required Dependencies
var express = require("express");
var bodyParser = require("body-parser");
var mongoose = require("mongoose");
// Create our Express App
const app = express();
//Convert Data to Json
app.use(bodyParser.json());
app.use(express.static("public"));
app.use(
bodyParser.urlencoded({
urlencod... | true |
fefab373895fb4e40a66515f6ee8ab5584394b7b | JavaScript | uGeek/orgmodeweb | /test/data/OrgParser.test.js | UTF-8 | 23,367 | 2.546875 | 3 | [
"MIT"
] | permissive | /* eslint-disable max-lines */
QUnit.module("OrgParser Tests", () => {
const orgfile = `
* only title heading
** TODO heading with todo kwd
some text
* [#A] heading with PRIORITY
* heading with two tags :tag1:tag2:
* TODO [#C] heading with TODO and PRIORITY
* TODO heading with TODO and three tags :tag1:t... | true |
901ea2c8f8ad17f3bd9faa6f23fc79dcf0bfc065 | JavaScript | pmacMaps/leaflet-pa-gis-conference-2016 | /js/map.js | UTF-8 | 377 | 2.703125 | 3 | [] | no_license | // Map object constructor
// Uncomment to run code in strict mode. This helps with debugging.
//'use strict';
/****************
*** Variables ***
*****************/
var map;
/************
*** L.map ***
*************/
// API reference - http://leafletjs.com/reference.html#map-usage
map = L.map('m... | true |
1e17853c3e64975f32f3961fd3a3e29edafb774a | JavaScript | hamidebay/WebDesignBasic | /Loops/myWork.js | UTF-8 | 579 | 3.8125 | 4 | [] | no_license | /*let zufalsZahl = Math.floor(Math.random() * 100);
function playing() {
for (let i = 1; i <= 8; i++) {
let zahl = prompt("Sayi tahmin et");
if (zufalsZahl == zahl) {
alert("you win");
} else if (zahl > zufalsZahl) {
alert("tahmini azaltin");
} else {
... | true |
e68035c2a429cbed372de95c01c8d3d4d9af77c4 | JavaScript | dannypule/mongoose_scotch_tutorial | /4.js | UTF-8 | 419 | 2.609375 | 3 | [] | no_license | // 4: Read - find one
//=================================
var mongoose = require('mongoose');
var User = require('./app/models/user');
mongoose.connect('mongodb://localhost/myappdatabase'); // connect to a MongoDB database (either local or hosted)
User.find({ // get the user starlord55
username: 'starlord55'
},... | true |
4133441edf096171be7f5e77250fe700b6582d27 | JavaScript | uniplaces/ember-cli-countries | /tests/unit/utils/countries-test.js | UTF-8 | 2,770 | 2.6875 | 3 | [
"MIT"
] | permissive | import Ember from 'ember';
import { module, test } from 'qunit';
import countries from 'dummy/utils/countries';
module('Unit | Utility | countries');
const { Logger } = Ember;
const TEST_CODE = 'PT';
const EXPECTED_NAME = 'Portugal';
const EXPECTED_CALLING_CODE = '+351';
const EXPECTED_TOTAL = 250;
test('getCountry... | true |
75cac32196aea43d588d7509512bb343c71cf892 | JavaScript | Ali-Hasnain-17/react-pagination | /src/App.js | UTF-8 | 634 | 2.59375 | 3 | [] | no_license | import React, { useState, useEffect } from 'react';
import axios from 'axios';
import PaginatedPosts from './PaginatedPosts';
const BASE_URL = 'https://jsonplaceholder.typicode.com/posts';
function App() {
// state
const [posts, setPosts] = useState([]);
const [error, setError] = useState('');
// call api
... | true |
9310eb19ad73203e8a437aa786384143caa7e6a8 | JavaScript | M1nified/Shapes | /shapes/Polygon.js | UTF-8 | 4,640 | 2.96875 | 3 | [
"MIT"
] | permissive | class Polygon extends Shape {
constructor() {
super();
this.corners = [];
}
addCorner(point) {
if (!(point instanceof Point))
throw `Argument 0 has to be an instance of Point.`;
this.corners.push(point);
return this;
}
static makeRegularPolygon(cor... | true |
185db1cec10557e25514b1f654bc22162de628d6 | JavaScript | flamingspaz/wembley-events-cal | /src/app.js | UTF-8 | 3,501 | 2.546875 | 3 | [] | no_license | var Xray = require('x-ray');
var xray = Xray();
var ical = require('ical-generator');
var moment = require('moment')
var sourceUrl = "https://www.wembleystadium.com/events";
xray(sourceUrl, {
pageTitle: 'title',
events: xray('div.fa-filter-content__item', [{
title: 'h2',
date: 'div.ali... | true |
865475b49abccec6c0d80e6fca513592095598e3 | JavaScript | gustavovazquez/Leviatan | /src/js/distributions.js | UTF-8 | 3,416 | 2.703125 | 3 | [
"MIT"
] | permissive | /***
* La finalidad de este archivo es de definir las distribuciones a utilizar.
*/
const jStat = require('jstat').jStat;
export const distributions = {
NORMAL: {
name: 'Normal',
parameters: [
{
name: 'mean',
displayName: 'Mean',
default... | true |