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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
e2c6d3f3cfb915eafa1a3a390df37ae737d49445 | JavaScript | saswat-sahoo/Top_Down_deploy | /public/bullet.js | UTF-8 | 757 | 3.046875 | 3 | [] | no_license | function Bullet(X, Y, PX, PY) {
this.speed = 20;
this.x = PX;
this.y = PY;
this.z = 0;
this.r = 5;
this.speed = 10;
// let bulletsprite;
this.bulletsprite = createSprite();
this.bulletsprite.width = 10;
this.bulletsprite.height = 10;
this.bulletsprite.shapeColor = color(255, ... | true |
d30973d370414d9d6e25912038806bb22307b8df | JavaScript | Kelas-Pemrograman-Mobile-IF-18/UAS-18421026-Feri-Backend | /controller/Kopi.js | UTF-8 | 2,799 | 2.515625 | 3 | [] | no_license | const kopi = require('../model/Kopi.js')
const response = require('../config/response')
const mongoose = require('mongoose')
const ObjectId = mongoose.Types.ObjectId
// INPUT //
exports.inputDataKopi = (data, gambar) =>
new Promise( async (resolve, reject)=> {
const kopiBaru = new kopi({
kodeK... | true |
d3de699fa19d7fc6e324306ae7f307f2074023b6 | JavaScript | 8secz-johndpope/_locations-recommender-api | /src/api/middlewares/time.js | UTF-8 | 902 | 2.59375 | 3 | [] | no_license | const models = require('../../models');
const ApiError = require('../errors/ApiError');
const getDurationInMilliseconds = (start) => {
const NS_PER_SEC = 1e9
const NS_TO_MS = 1e6
const diff = process.hrtime(start)
return (diff[0] * NS_PER_SEC + diff[1]) / NS_TO_MS
}
module.exports = async (req, res,... | true |
2a2046bc28793683ffd31e27ca25862b92f8f243 | JavaScript | azar2612/react-basics | /src/Menu.jsx | UTF-8 | 669 | 2.625 | 3 | [] | no_license | import React from "react";
// Array
const menuData = ["Home", "About", "Gallery", "Contact"];
// Named Export
export const Menu = () => (
<ul>
{menuData.map((c) => (
<li>{c}</li>
))}
</ul>
);
// Array with Object
const navMenuData = [
{
name: "chaal",
location: "vellore",
},
{
nam... | true |
a57c35cdf1b7d983eafb7290f3fc4e92d6340afa | JavaScript | Michalstanczak97/CalorieApp | /src/components/Calculator.js | UTF-8 | 5,337 | 2.734375 | 3 | [] | no_license | import React, {useEffect, useState} from 'react';
import '../scss/calculator.scss'
import {logDOM} from "@testing-library/react";
import history from "./history";
const Calculator = ({getResult}) => {
const [error, setError] = useState({
weight_error: false,
sex_error: false,
height_error: f... | true |
1688fefa525dd710406ea3e8fbb6aa57503b4ba8 | JavaScript | gj-wes/country-search | /src/utils.js | UTF-8 | 519 | 3.078125 | 3 | [] | no_license | export const checkDarkMode = () => {
if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
return true;
}
return false;
}
export const themeSwitcher = () => {
const body = document.querySelector('body')
body.classList.toggle('dark')
}
export const getCharCode = (char) => {
const c = char.to... | true |
5c837d0b95a08a7f329059291ec5fd1c06166e1f | JavaScript | nafidurmus/note | /client/src/components/EditListForm.js | UTF-8 | 2,103 | 2.546875 | 3 | [] | no_license | import React, { Component} from 'react';
class EditListForm extends Component {
constructor(props) {
super(props)
this.state = {
id: this.props.list.id,
title: this.props.list.title,
excerpt: this.props.list.excerpt
}
this.handleChange = this.handleChange.bind(this)
th... | true |
0b91c7695f7490b3ee5f5970c448caa59355c0b9 | JavaScript | ajay-staruss/Women-Ridesharing- | /logPage/static/js/mapLocate.js | UTF-8 | 1,229 | 2.875 | 3 | [] | no_license | function initMap() {
console.log("initMap")
//console.log(params)
// var directionsService = new google.maps.DirectionsService();
// var directionsRenderer = new google.maps.DirectionsRenderer();
// var map = new google.maps.Map(document.getElementById('map'), {
// zoom: 7,
// center:... | true |
af2f3d794d93b75f1ebd083585f47550626b82b0 | JavaScript | dongliang1993/leetcode | /242.有效的字母异位词.js | UTF-8 | 746 | 3.078125 | 3 | [] | no_license | /*
* @lc app=leetcode.cn id=242 lang=javascript
*
* [242] 有效的字母异位词
*/
// @lc code=start
/**
* @param {string} s
* @param {string} t
* @return {boolean}
*/
var isAnagram = function (s, t) {
return s.split('').sort().join() === t.split('').sort().join()
};
var isAnagram = function (s, t) {
if (s.length !== ... | true |
fc3ed945bcc2346e30f40e69c4e42705d25230db | JavaScript | aliotta/data-structures | /sprint-one/src/pseudoclassical/stack.js | UTF-8 | 784 | 3.765625 | 4 | [] | no_license | var Stack = function() {
//Pseudoclassical instantiation
//Create object to store nodes
this.storage = {};
//Create counter to track current stack size.
this.stackSize = 0;
};
//Add items to the top of the stack
Stack.prototype.push = function(value){
this.storage[this.stackSize] = value;
//Increment stac... | true |
7c33349196ed48d434c81b0ca6e0466e964b4dd5 | JavaScript | younggeeks/visual-ds | /src/lib/graph.ds.js | UTF-8 | 2,095 | 3.140625 | 3 | [
"MIT"
] | permissive | export var Graph = /** @class */ (function () {
function Graph(noOfVertices) {
this.noOfVertices = noOfVertices;
this.list = new Map();
}
Graph.prototype.addVertice = function (value) {
this.list.set(value, []);
};
Graph.prototype.addEdge = function (src, dest) {
this.list.get(src).push(dest);... | true |
bbf075557011f4407e349ba5b40bc5df9cc15bfc | JavaScript | berbuscar/Employees | /MasGlobal.Employees.Web/Content/Js/Employees/employee.js | UTF-8 | 2,339 | 2.5625 | 3 | [
"MIT"
] | permissive | function ConsularEmpleados() {
var inputIdEmployee = $("#inputIdEmployee");
var $buttonConsultar = $("#btnGetInfoEmployee");
var urlConsulta = $buttonConsultar.data("datos");
$('#loadingmessage').show();
//sleep(3000);
$.ajax({
async: false,
cache: false,
type: "POST"... | true |
6e0e8f14275a1a6a7d4ae45296411054823364d9 | JavaScript | edele/goeat | /resources/assets/scripts/utilities/object/diff.js | UTF-8 | 579 | 3 | 3 | [] | no_license | 'use strict'
/**
* Метод, который сравнивает два объекта и возвращает массив ключей, значениях которых
* отличаются.
*
* Проход происходит по первому переданному объекту.
*/
export default function (target, source) {
const result = []
for (let attr in target) {
if (target.hasOwnProperty(attr)) {... | true |
d06bcc94a614df6caa471f3d2f1d86f668c07d64 | JavaScript | nulldreams/javascript-procedural-dungeons | /t.js | UTF-8 | 1,404 | 3.296875 | 3 | [] | no_license | const snake = document.getElementsByClassName("snake")[0]
const directions = {
top: 'margin-top',
left: 'margin-left',
right: 'margin-left',
bottom: 'margin-top'
}
const position = { top: 1, left: 1, right: 1, bottom: 1 }
const gameOptions = {
paused: false,
snake: {
speed: 1,
po... | true |
4be3bec258bb9d91f46c5400c70e5d23f0698732 | JavaScript | VeranoSA/bootcamp-terminal-tests | /totalPhoneBill.js | UTF-8 | 444 | 2.84375 | 3 | [] | no_license | module.exports = function totalPhoneBill(callSms){
var arr = callSms.split(",");
var call = 0;
var sms = 0;
for (var i = 0;i < arr.length;i++){
var trimCall = arr[i].trim();
if (trimCall.startsWith("call")){
call++;
}
if (trimCall.startsWith("sms")){
sms++;
}
... | true |
573cc3bcc916606b3c5416e777573ee78909b020 | JavaScript | DFLovingWM/leetcode-solving | /weekly-contest/weekly-contest-163/3-greatest-sum-divisible-by-three/BottomupDP-v1.js | UTF-8 | 698 | 3.125 | 3 | [] | no_license | /**
* Bottom-up DP(推导方向:curr <== prev)
*
* 时间:O(N), 244ms
* 空间:O(N), 56.3MB
*/
var maxSumDivThree = function (nums) {
const n = nums.length;
// dp[i][r]表示前i个数中,余数为r的最大和
const dp = Array.from({ length: n + 1 }, () => Array.from({ length: 3 }, () => -Infinity));
// 边界
dp[0][0] = 0;
// 迭代
for (let i =... | true |
5735c72e5735eefc1c8b72cd06b9976269e8ebe4 | JavaScript | gaetan-varlet/tutoriel-react-redux | /exercices-dawan/projet-liste-de-course/App.jsx | UTF-8 | 2,230 | 2.640625 | 3 | [] | no_license | import React, { Component } from "react";
import { connect } from "react-redux";
import {
ajouterProduitListe,
ajouterProduitPanier,
supprimerProduit
} from "./actions/actions.js";
import ListeProduits from "./components/ListeProduits.js";
import PanierProduits from "./components/PanierProduits.js";
import Ajoute... | true |
834088b6f7d605f7dd3f01f8476de1d16465088e | JavaScript | Ed30/A-Study-on-Wealth-and-Contentment | /js/BubbleChart.js | UTF-8 | 12,305 | 2.828125 | 3 | [] | no_license |
let bubbleChart = {
boroughs : [],
years : [],
selectedYear : "",
maxNumberOfPeople : 0,
minHappiness : Number.MAX_SAFE_INTEGER,
maxHappiness :0,
margins : { top: 10, right: 10, bottom: 30, left: 38 },
height : 0,
width : 0,
maxBubbleRadius : 60,
xScale: null,
xScale... | true |
11069231cfc11e1071e8f9a8badcd7cb6e936fd5 | JavaScript | s-inshiy/fcc-intermediate-algorithm-scripting | /challenges/missing-letters.js | UTF-8 | 604 | 3.8125 | 4 | [] | no_license | // Find the missing letter in the passed letter range and return it.
// If all letters are present in the range, return undefined.
// fearNotLetter("abcdefghjklmno") should return "i".
// fearNotLetter("stvwx") should return "u".
// fearNotLetter("stvwx") should return "u".
const fearNotLetter = str => {
const alph... | true |
9e0091624a5059146d0ff73d6a9828f4ddd00545 | JavaScript | marclitchfield/topicnet | /service/handler.js | UTF-8 | 569 | 2.53125 | 3 | [] | no_license | function successHandler(response, result) {
if (result === undefined) {
response.send(200);
} else {
response.json(result);
}
}
function errorHandler(response, error) {
var statusCodes = {
'notfound': 404,
'duplicate': 400,
'badrequest': 400,
'noauth': 403
};
console.log(error);
response.send(erro... | true |
27d9163b14711e243dcb27336cfb4e1b5342c0b7 | JavaScript | PandeyMaheshwar/JavaScript | /Javascript/Practice project/myscript.js | UTF-8 | 941 | 4.3125 | 4 | [] | no_license | var firstName = prompt("First Name");
var lastName = prompt("Last name");
var age = prompt("Age please");
var height = prompt("height");
var petName = prompt("pet name");
//Four conditions
var nameCond = null;
var ageCond = null;
var heightCond =null ;
var petCond = null;
//Name condition
if(firstName[0]... | true |
76af2e3c58d29de6e33345b677c7c0f9c2540130 | JavaScript | NachoMerino/lilSiri-VoiceControl | /app/views/assets/js/modules/voiceSynthesizer.js | UTF-8 | 772 | 3.421875 | 3 | [] | no_license | // create a voice Synthesis of whatever we set in 'text'
export default function speech(text) {
const synth = window.speechSynthesis;
const utterThis = new SpeechSynthesisUtterance(text);
// Find the voice you want
const voices = synth.getVoices();
const voice = voices
.find(voice => voice.name === 'Fiona... | true |
7cfd328f807be3893762bb5f7d42a5b00c7833f3 | JavaScript | thinkful-ei22/its_a_date_client | /src/reducers/AuthReducer.test.js | UTF-8 | 2,076 | 2.515625 | 3 | [] | no_license | import reducer from './Auth';
import {authRequest, authError} from '../actions/Auth';
import { fetchProtectedDataError,
requestProtectedData,
changeCurrentUser,
fetchUserEventsSuccess} from '../actions/ProtectedData';
describe('AuthReducer', () => {
it('should handle Auth Request action', () => {
const ... | true |
55f1e0ff820b3ed30dbb9c0d7319937bf29f2658 | JavaScript | cashmonides/sentence_graph | /latinist/test_transfer.js | UTF-8 | 756 | 2.703125 | 3 | [] | no_license | //// master function
// iterate through old_map
// rename values
// convert root list to a map with string-integers
///////////////////end of psuedocode
/// get value
///
var add_old_value_to_new_key = function (new_dictionary, new_key, old_value) {
}
var convert_dictionary = function () {
};
var alte... | true |
58507eb33922810f4a67af3cb77b5d1577f10f15 | JavaScript | Lyxcious/h8-p0-w4 | /review.js | UTF-8 | 544 | 3.796875 | 4 | [] | no_license | // var user = {
// sayHi: function() {
// console.log("Hello");
// }
// }
// user.sayHi()
// var user = {
// sayHi() {
// console.log("Hello");
// }
// }
// user.sayHi()
// yang bawah shorthand hasilnya
// var user = {
// name: "Jhon",
// hi() {
// console.log(user.nam... | true |
a0d94d574e33a73687647f83810e46b789ba97dd | JavaScript | alephno/chip8-js | /public/client/index.js | UTF-8 | 2,403 | 3.359375 | 3 | [] | no_license | const canvas = document.getElementById('chip8-canvas')
const gamesList = document.getElementById('games-select')
const startStopButton = document.getElementById('start-stop-button')
const stepButton = document.getElementById('step-button')
const resetButton = document.getElementById('reset-button')
const scale = 8
can... | true |
d09df0123985bc1d1d7948e1136db4570273d1c4 | JavaScript | YoungChen96/web2.0 | /web/8_sign up/hw/handle.js | UTF-8 | 4,357 | 2.5625 | 3 | [] | no_license | var fs = require("fs");
var url = require("url");
var querystring = require("querystring");
//传递请求的文件
function getPage(req, res, postData, statu) {
console.log("Send Page.");
var pathname = url.parse(req.url).pathname;
console.log(pathname);
var path = pathname.substr(1);
if (path == "/" || path ==... | true |
b68bb1c4691bdfab4e59ad3d1e3fc9bade9c285c | JavaScript | weirui222/algrithom | /hw3/Boggle.js | UTF-8 | 2,580 | 4.125 | 4 | [] | no_license | Boggle (Find all possible words in a board of characters) | Set 1
Given a dictionary, a method to do lookup in dictionary and a M x N board where
every cell has one character. Find all possible words that can be formed by a
sequence of adjacent characters. Note that we can move to any of 8 adjacent
characters, but a wo... | true |
f5a1df7db9be2897054084a0946412a696df87e1 | JavaScript | Remus432/travel-to-usa | /app.js | UTF-8 | 2,407 | 2.640625 | 3 | [] | no_license | const navbar = document.querySelector(".discover__navbar")
const yellowstoneItem = document.querySelector(".discover__navbar-item-1")
const centralItem = document.querySelector(".discover__navbar-item-2")
const goldenItem = document.querySelector(".discover__navbar-item-3")
const discover = document.querySelector(".dis... | true |
e05670c6d86ced8124fd08d2938b6d4904d84f89 | JavaScript | lancecaraccioli/Javascript-Experiments | /gallery-development/js/LC/lib/LC/Bulletin.js | UTF-8 | 5,816 | 2.640625 | 3 | [] | no_license | /*!
* Author:Lance Caraccioli
* (c) May 1 2009
*
*/
(function($){
LC.Bulletin = function(){
LC.Bulletin.superclass.constructor.apply(this, arguments);
this.initialize();
};
//private data
var bulletinCollection = null;
LC.extend(LC.Bulletin, LC.Component, {
//public
... | true |
82b26ce7c66bb9a571b3f2ba74df3471034a76bf | JavaScript | elbiesmith/objectHeroes | /js/site.js | UTF-8 | 2,211 | 2.96875 | 3 | [] | no_license | let heroes = JSON.parse(localStorage.getItem('heroesArray')) || [];
let results = document.getElementById('results');
function getValues() {
let firstName = document.getElementById('firstName').value;
let lastName = document.getElementById('lastName').value;
let heroName = document.getElementById('heroNam... | true |
ba3b57e642313b517e99984bb2f80a77135262dc | JavaScript | zhuzihope/wzlcode | /Houseboard/js/main.js | UTF-8 | 9,447 | 2.5625 | 3 | [] | no_license |
$(document).ready(function() {
$("a.mainimg-link").on("click", function(){
window.location ="#";
window.scrollTo(0, 0);
$("div.main-page").css("display","none");
makeSingleDesignPage(this);
});
$(".likebook").on("click", function(){
var tag = $(this).find(".like_tag").html();
//console.log(tag);
... | true |
6b3f9d48961bafc5ccf40996f7062a7348e0bc9b | JavaScript | janjanmedinaaa/fore | /Sample/Portfolio/Project/js/index.js | UTF-8 | 4,318 | 2.71875 | 3 | [] | no_license | var oldOnload = window.onload;
window.onload = function() {
if (typeof oldOnload == 'function') {
oldOnload();
}
webSkill();
}
window.onresize = function() {
if(window.innerWidth <= 600){
let skillcon1 = document.getElementById("skills-web-con");
skillcon1.style.display = "inl... | true |
979fb851ca8a21b9248d98d2beadd2015ba1fb85 | JavaScript | djermy/bootstrap-example | /script/script.js | UTF-8 | 283 | 3.265625 | 3 | [] | no_license | function typeLetter(text) {
var x = document.getElementById('typing-title');
x.innerHTML += text[0];
if (text.length > 1) {
setTimeout(() => {
typeLetter(text.substring(1, text.length));
}, 100)
}
}
typeLetter('Web Development & Hosting') | true |
92bb3f54f46a0b97e4e4c5b869e3d45fb887271f | JavaScript | eyjs/workspace-sts-3.9.11.RELEASE | /servletSite/WebContent/comm.js | UTF-8 | 2,417 | 3.40625 | 3 | [] | no_license | /**
* 공통자바스크립트파일
*/
function loadingFocus(e) {
e.focus();
}
function isNull(v1) {
if (v1 == "") {
return true;
}
return false;
}
function isSame(v1, v2) {
if (v1 == v2) {
return true;
}
return false;
}
//두개의 폼에 입력된 값이 같은지 비교(비밀번호, 비밀번호 확인)
/*
function isSame(obj1, obj2) {
var st... | true |
3cce22a0abed619ec0e730b1d8b1974af2247e39 | JavaScript | ucr-riple/DynCallGraphJS | /examples/test52.js | UTF-8 | 998 | 3.265625 | 3 | [
"UPL-1.0"
] | permissive | function main(propName){
var obj= {
MyName:function(){
return "John Doe"
},
MyPhone:function(){
return "123-456-7890"
}
}
var arr = ["MyName"]
obj[arr[0]]() //Get
var retPropName = function(){
return "MyPhone"
}
obj[retPropName()](); //Func... | true |
97bab3c1e0295ee611cda52b5a2600ff41b34d8c | JavaScript | greywidget/jamstack-js-dom-intro | /src/js/stay.js | UTF-8 | 311 | 2.8125 | 3 | [] | no_license | function dontGoThere() {
var theLink = document.getElementById('task4-link');
var myInterceptFunction = function (event) {
event.preventDefault();
alert("Won't you stay? (Just a little bit longer...)");
};
theLink.addEventListener('click', myInterceptFunction);
}
dontGoThere();
| true |
db285c6860e3a22363a82f20aee98d9111d926d2 | JavaScript | pedrodelgallego/js-katas | /katas/orm-jquery/orm.js | UTF-8 | 1,844 | 2.890625 | 3 | [] | no_license | /*
*/
(function($, exports){
// Object.create() takes one argument, a prototype object, and returns
// a new object with the specified prototype object. In other words,
// you give it an object, and it returns a new one, inheriting from
// the one you specified.
// see http://javascript.crockford.com/prototy... | true |
e7d27303fed4916c5e45b198a6f648205c47a03f | JavaScript | sherryptk/js_bootcamp | /todo-app/todo-app-functions.js | UTF-8 | 2,655 | 3.65625 | 4 | [] | no_license | //grab todos from local storage
const getTodos = () => {
const todosJSON = localStorage.getItem('todos')
try {
return todosJSON ? JSON.parse(todosJSON) : []
} catch (error) {
return []
}
}
//save todos to local storage
const saveTodos = (todos) => {
localStorage.setItem('todos', JS... | true |
6a0f85a142955775422c86788e15adf925805300 | JavaScript | vladislav-o0/study | /Module_2/Home_work_9/js/myLib.js | UTF-8 | 459 | 2.84375 | 3 | [] | no_license | !function() {
window.myLib = {
getMin(arr) {
return Math.min.apply(null, arr);
},
getMax(arr) {
return Math.max.apply(null, arr);
},
getАverage(arr) {
let sum = arr.reduce(function(sum, current) {
return sum + current;
... | true |
819e4c6299e6e826c9699444e69ddb120338c76e | JavaScript | leszek-qrek/timeline---dobry | /js/main_script.js | UTF-8 | 2,861 | 2.78125 | 3 | [] | no_license | $(document).ready(function(){
timeLine();
});
function timeLine(){
var d = new Date();
var n = d.getDate();
var dateProgress = 3.3334;
var dateProgress2 = n * dateProgress;
var eventDate;
var eventContent;
var eventIcon;
$('#t1').html(events[0][2]);
$('#t2').ht... | true |
4ba8a6045f88bbc5667a0666ab28a70205367c86 | JavaScript | Marcos-PaRoTe/Proffy_1.0 | /public/scripts/addField.js | UTF-8 | 811 | 3.625 | 4 | [
"MIT"
] | permissive | // Procurar o botão //
document.querySelector("#add-time")
// Ação de clicar no botão //
.addEventListener('click', cloneField)
// Após o clique, aconteça isso: //
function cloneField() {
const newFieldContainer = document.querySelector('.schedule-item').cloneNode(true) // Boolean = True or False //
// Res... | true |
74a99ae9140c593c65581c9aaadff6cf697be4f1 | JavaScript | eunsol814/Pathfinding-Visualizer | /searchAlgorithms.js | UTF-8 | 4,378 | 3.328125 | 3 | [] | no_license | //import {Stack, Queue, PriorityQueue, Node} from 'util';
function depthFirstSearch(problem) {
var answer = null;
var explored = [];
var future = [problem.getStartState()];
var frontier = new Stack();
var start = new Node(problem.getStartState(), null, null, 0);
frontier.push(start);
while (answer == null) {
... | true |
13a7fa7bfd251f6bf7d9c97f6a939ab502b92d47 | JavaScript | ededals/FCC | /04 fcc-data-visualisation/04 fcc-chloropeth-map/script.js | UTF-8 | 4,706 | 2.703125 | 3 | [] | no_license | const EDUCATION_DATA_URL = "https://raw.githubusercontent.com/no-stack-dub-sack/testable-projects-fcc/master/src/data/choropleth_map/for_user_education.json";
const US_COUNTY_DATA_URL = "https://raw.githubusercontent.com/no-stack-dub-sack/testable-projects-fcc/master/src/data/choropleth_map/counties.json";
const chartD... | true |
e9759c22f7872dce9099698f1d903c4ec25e46a8 | JavaScript | CrazyAlien1/NodeProj | /model/errorHandler.js | UTF-8 | 382 | 2.9375 | 3 | [] | no_license | class ErrorHandler
{
constructor()
{
this.errorsCounterID = 0;
this.errors = new Map();
}
addError(msg){
this.errors.set(this.errorsCounterID, msg);
this.errorsCounterID++;
}
getErrors(){
let erros = [];
for(var [key, erro] of this.errors){
erros.push(erro);
}
return erros;
}
clearErrors()... | true |
9d8fed77ae90ec3cbf39412650b87d744d2fe43e | JavaScript | GiangHoang9912/PokeAPI | /pokemon.js | UTF-8 | 3,723 | 3.328125 | 3 | [] | no_license | const apiLink = "https://pokeapi.co/api/v2/";
const loadingGifLink = "https://media.giphy.com/media/sSgvbe1m3n93G/giphy.gif";
const imgPokemonLink = "https://pokeres.bastionbot.org/images/pokemon/";
const myStorage = window.localStorage;
let currentId = 0;
const getPokemon = async (pokeID) => {
try {
if (isNaN(p... | true |
c8c37fa634264499e204e31053ccad202074776d | JavaScript | diegomura/react-pdf | /packages/layout/src/steps/resolveZIndex.js | UTF-8 | 748 | 2.546875 | 3 | [
"MIT"
] | permissive | import * as P from '@react-pdf/primitives';
const getZIndex = node => node.style.zIndex;
const shouldSort = node => node.type !== P.Document && node.type !== P.Svg;
const sortZIndex = (a, b) => {
const za = getZIndex(a);
const zb = getZIndex(b);
if (!za && !zb) return 0;
if (!za) return 1;
if (!zb) return... | true |
ce6a2d5c3f049d34bc5d91e39ceea665d2ecca88 | JavaScript | andreusfreeman/banner | /src/script/create-element.js | UTF-8 | 3,295 | 2.9375 | 3 | [] | no_license | //https://www.html5rocks.com/ru/tutorials/file/dndfiles/
class ChangeElement {
constructor(elem, nameClass, id, text, style, source, dataElem, imageWidth, font) {
this.elem = elem;
this.nameClass = nameClass;
this.id = id;
this.text = text;
this.style = style;
this.source = source;
this.dataElem = dataEl... | true |
66e75d4725c1183b81ed8241b063bf1d3dce012d | JavaScript | Digital-Menu-FHICT-S3/Online-Menu-View | /src/components/ShoppingCart/ShoppingCart.js | UTF-8 | 4,536 | 2.59375 | 3 | [] | no_license | import React, {useState, useEffect} from "react";
import "./ShoppingCart.sass";
import Container from "react-bootstrap/container";
import Row from "react-bootstrap/row";
import Col from "react-bootstrap/col";
import ShoppingCartItem from "./ShoppingCartItem/ShoppingCartItem";
import Tips from "./Tips/Tips";
import axio... | true |
ff8da2f76825dde5c37bd15dd76e002afc9b75a1 | JavaScript | doggor/vue-face-tracking-demo | /src/helpers/drawRightEyeBrow.js | UTF-8 | 1,063 | 2.84375 | 3 | [] | no_license | /**
*
* @param {CanvasRenderingContext2D} paint , canvas 2D object
* @param {Array<Array<number>>} modelPositions , facial model positions
* @param {string} color, filled color
*/
export default function drawLeftEyeBrow(paint, modelPositions, color) {
paint.beginPath()
paint.moveTo(
modelPositions[... | true |
5f1aa13e503174dbc9241a191558304302f6bb37 | JavaScript | zack37/sandbox | /fancy-console.js | UTF-8 | 666 | 2.578125 | 3 | [] | no_license | const { Console } = require('console');
const tinydate = require('tinydate');
const console = new Console({
stdout: process.stdout,
stderr: process.stderr,
colorMode: false,
});
const stamp = tinydate('[{HH}:{mm}:{ss}]');
const baseLog = fn => (...args) => {
const time = stamp();
// Ew...
if (fn === 'dir... | true |
98a6d57bc2259842aad5457c12a47654eae8a05f | JavaScript | vperron/exo-stage | /js/htmlTable.js | UTF-8 | 6,070 | 3.3125 | 3 | [] | no_license | //// FUNCTIONS
// Parses a CSV content into a sorted JavaScript 2D array
function csvToJavaScript(txt) {
// Regular expression definition
var rentRegExp = new RegExp("((.+),){4}(.+)\n", "g");
var rentals = txt.match(rentRegExp);
txt = null;
// Result to return
var javaTable = new ... | true |
855e9ebbd9ec809ba2fb7e1d3de6b92899c067f1 | JavaScript | UlyanaKapeshina/949959-code-and-magick-17 | /js/setup.js | UTF-8 | 4,142 | 2.828125 | 3 | [] | no_license | 'use strict';
(function () {
var COAT_COLORS = ['rgb(101, 137, 164)', 'rgb(241, 43, 107)', 'rgb(146, 100, 161)', 'rgb(56, 159, 117)', 'rgb(215, 210, 55)', 'rgb(0, 0, 0)'];
var EYES_COLORS = ['black', 'red', 'blue', 'yellow', 'green'];
var FIREBALL_COLORS = ['#ee4830', '#30a8ee', '#5ce6c0', '#e848d5', '#e6e848'];
... | true |
61915768d70ab278ce2723c1f0360be4dac34f6e | JavaScript | krittiyaclark/Javascript-pratice | /class24/cascade-badge/js/main.js | UTF-8 | 1,220 | 4.5 | 4 | [] | no_license | //Arrays
//Your pokemon party order which is a list of pokemon has been leaked to Misty. Please create a function that reverses your list and prints it to the console.
function reversesNum(arr) {
return arr.reverse()
}
console.log(reversesNum([1, 2, 3, 4, 5]))
//Given two integer arrays a, b, both of length >= 1, crea... | true |
e92339548909d5ba705fcabef7eb369fa3170b5f | JavaScript | chandanjainn/postsapi | /controllers/users.js | UTF-8 | 1,021 | 2.53125 | 3 | [] | no_license | const User = require('../models/user');
exports.userSignUp = async (req, res) => {
const user = new User({ email: req.body.email, password: req.body.password });
try {
await user.save();
const token = await user.generateAuthToken();
res.status(201).send({ user, token, message: 'User created successfull... | true |
086bcc52718533853d3c132c37e9e7786d9a4e14 | JavaScript | karkranikhil/react-redux-2020 | /src/reducers/userReducers.js | UTF-8 | 415 | 2.640625 | 3 | [] | no_license | import {USERS_TYPES} from '../actionTypes'
const initialState = {
users:[],
loading:true
}
const usersReducer = (state = initialState, action)=>{
console.log(state)
switch(action.type){
case USERS_TYPES.GET_USERS:
return {
...state,
users:action.payload,
... | true |
135d205c477e0dac563dad47e15e5c1172128220 | JavaScript | brsdv/815063-big-trip-9 | /src/components/point.js | UTF-8 | 2,717 | 2.703125 | 3 | [] | no_license | import AbstractComponent from './abstract-component.js';
import {pointTypes, setDefaultIcon} from '../utils.js';
import moment from 'moment';
class Point extends AbstractComponent {
constructor({type, destination, dateFrom, dateTo, price, offers}) {
super();
this._type = type;
this._town = destination.na... | true |
72b229a5b2a52c0cb6c28591d350f7139dee1249 | JavaScript | torolchuk/arc_game | /src/functions/helpers.js | UTF-8 | 678 | 2.796875 | 3 | [] | no_license | export const getRndInteger = (min, max) => {
return Math.floor(Math.random() * (max - min)) + min;
};
export const getRandomTrueFalse = chance => {
return getRndInteger(0, chance) === chance - 1;
};
export const hexToRgbCode = hex => {
let c = hex.substring(1).split("");
if (c.length == 3) {
c = [c[0], c[... | true |
be2acbf7672c80c951d0920ea40c4629d9f4c722 | JavaScript | HealthSamurai/jute-example | /oru-hl7.js | UTF-8 | 1,974 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env node
const jute = require("./jute.js/lib/jute");
const hl7grok = require("./hl7grok/lib/hl7grok");
const fs = require("fs");
var isBlank, removeBlanks;
isBlank = function(val) {
return val === null || val === void 0 || val === '' || (Array.isArray(val) && val.length === 0);
};
removeBlanks = functi... | true |
30a3738ce52adc53c2841ed7290c08d3bc522673 | JavaScript | mwatson86/text-file-words | /src/utils/read.js | UTF-8 | 624 | 2.96875 | 3 | [] | no_license |
import path from 'path';
import fs from 'fs';
// file path
export const filePath = path.resolve(__dirname, '..', 'file.txt');
// read, returns promise
export const read = (resolve, reject) => {
// set data to empty string
let data = '';
// create read stream, passing in file path
const rstream = fs.createRe... | true |
1d42710b97d0ed4a1b0ac3813858eefc42d0e568 | JavaScript | Thurzas/La_Manu_javascript_exercice1_partie2 | /js/exo1.js | UTF-8 | 201 | 2.5625 | 3 | [] | no_license | var changment=false;
function change(){
var img =document.getElementsByTagName('img')[0];
changment==true? img.src ='img/image1.jpg':img.src ='img/image1_2.jpg';
changment=!changment;
};
| true |
d2a092b40d5d222924cb6419aadfc107bc5e8f63 | JavaScript | jojo2357/jojos-bot | /Code/message-reaction.js | UTF-8 | 629 | 2.734375 | 3 | [
"MIT"
] | permissive | const addReactions = (message, reactions) => {
message.react(reactions[0])
reactions.shift()
if (reactions.length > 0) {
setTimeout(() => addReactions(message, reactions), 750)
}
}
module.exports = async (client, id, text, reactions = []) => {
const channel = await client.channels.fetch(id)
channel.me... | true |
27fbf3b2f42d615084fbbb7dc52625e5da719d4f | JavaScript | V0vaSL/BookMark | /client/src/components/context/user/UserReducer.js | UTF-8 | 2,026 | 2.65625 | 3 | [] | no_license | /* eslint-disable import/no-anonymous-default-export */
import {
LOGIN_SUCCESS,
LOGIN_FAIL,
LOGOUT,
REGISTER_SUCCESS,
REGISTER_FAIL,
GET_USER_BOOKS,
} from '../types';
export default (state, action) => {
const filterBooks = (list, filteredList) => {
return list.filter((book) => book.readingList === f... | true |
38681f4613c49bfbffdcb7525a170b58b15d3552 | JavaScript | pafrias/chatterbox-client | /client/scripts/messages.js | UTF-8 | 911 | 2.65625 | 3 | [] | no_license | var Messages = {
_storage: [],
newMessage: function(text, roomname) {
// make a new object
//assign user room and text keys
//generate a createdAt string
//post to server
//on successful post, GET from setver and display new messages
var message = {
username: App.username,
ro... | true |
9f12d2139746b9d1cfe45a335a6176a2a8e5f38d | JavaScript | RobertBowie/TP | /phonePadMap.js | UTF-8 | 1,462 | 4.0625 | 4 | [] | no_license | /*
Given a digit string, return all possible letter combinations that the number could represent.
Input: "23"
Output: ["ad", "ae", "af", "bd", "be", "bf", "cd", "ce", "cf"]
*/
/**
* @param {string} digits
* @return {string[]}
*/
var letterCombinations = function(digits) {
var digitArr = digits.split(''); // ['2'... | true |
b7ba3f5799d9a148337c104a9c66ee305d0d85b4 | JavaScript | JKrayg/Train-station-schedule | /assets/javascript/script.js | UTF-8 | 2,577 | 2.796875 | 3 | [] | no_license | // Initialize firebase
var firebaseConfig = {
//
//
//
//
//
//Add API key!
apiKey: "AIzaSyD_-IWOWvOWHSuCkko7G0crYLy8YT2xQ8M",
authDomain: "trainschedule-478a8.firebaseapp.com",
databaseURL: "https://trainschedule-478a8.firebaseio.com",
projectId: "trainschedule-478a8",
stora... | true |
b3f9838c1b8933f585efff297fa9478f20e5f4f6 | JavaScript | Neusi75/M10_leaflet_coordenadas | /Nivell_2_3/map.js | UTF-8 | 912 | 2.671875 | 3 | [] | no_license |
let myMap = L.map("myMap").setView([41.386843, 2.170158], 16);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(myMap);
const iconMaker = L.icon({
iconUrl: "Pin.png",
iconSiz... | true |
f9b0071e41256d9c96edc30fbb6aebfca8a6792e | JavaScript | ElizCarvalho/SON-Trilha_Mestre_em_JQuery | /Iniciando com JQuery3/navegacao.js | UTF-8 | 900 | 3.203125 | 3 | [] | no_license | //Difere do 'ready' pq só executa depois q td tiver pronto.. inclusive carregamento de imagens
// $(window).on('load',function(){
// alert($('body').html())
// });
//executa assim q o carregamento do html ficar pronto
//(carregamento de img não seria o caso... ele executaria antes)
$(document).ready(function(){
... | true |
472333ddb8714d7fecb1244925cc7bfdb8cd2dd8 | JavaScript | michaelsauter/MotionJS | /bundles/org.motionjs.core/lib/server/developmentServer.js | UTF-8 | 1,406 | 2.921875 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | /**
* This is a simple NodeJS server responsible for various tasks in development context
* The tasks are:
* 1) Serving the motion core
* 2) Serving an arbitrary file
* 3) Serving an arbitrary identifier
*/
var http = require('http')
, url = require('url')
, port = process.argv[2]
, assembler = require('.... | true |
e043ec7bd3b47990a15d2c812a4083b4b00ab078 | JavaScript | jl2/WebGL-Stuff | /objects/gl_code.js | UTF-8 | 3,950 | 2.5625 | 3 | [] | no_license | function createShader(gl, str, type) {
var shader = gl.createShader(type)
gl.shaderSource(shader, str)
gl.compileShader(shader)
return shader
}
function createProgram(gl, vstr, fstr) {
var program = gl.createProgram()
var vshader = createShader(gl, vstr, gl.VERTEX_SHADER)
var fshader = crea... | true |
69e9404f2a32dd395ce05d350f503b131ba8c6b3 | JavaScript | AllMight0027/Notes | /controllers/folder.js | UTF-8 | 2,082 | 2.53125 | 3 | [] | no_license | const Folder = require("../models/Folder");
const ObjectId = require("mongodb").ObjectID;
//folder param (middleware)
exports.getFolderById = (req, res, next, id) => {
Folder.findById(id)
.then((folder) => {
if (!folder)
return res
.status(400)
.json({ status: "Failed"... | true |
0f807fef5c21b0db30b635c3c79de5f041dee438 | JavaScript | cciochina/web-visuals-challenge | /StarterCode/static/js/app.js | UTF-8 | 8,219 | 3.34375 | 3 | [
"MIT"
] | permissive | function getSampleNames() {
/*
Funtction to get the sample names from the samples.json file
And populate them in the selector from index.html which id is selDataset
*/
// testing to see if works, opening the index.html file
// and inspecting the code & looking at the terminal - we should see t... | true |
e48902a8c8376f9904093ccc89982c42ec3957b8 | JavaScript | skabongo/skabongo.github.io | /bower_components/augment.js/lib/augment.date.toISOString.js | UTF-8 | 735 | 2.671875 | 3 | [
"MIT"
] | permissive | if (!Date.prototype.toISOString) {
Date.prototype.toISOString = (function () {
var pad = function (n, length) {
length = length || 2
return (n = n + "", n.length === length) ? n : pad("0" + n, length);
}
return function () {
var year = this.getUTCFullYear()
year = (year... | true |
44ecf30b82843b7387b02a9af0852caa972d97dc | JavaScript | taoqf/node-html-parser | /test/benchmark/compare-htmljs-parser.mjs | UTF-8 | 2,799 | 2.765625 | 3 | [
"MIT"
] | permissive | import { createParser } from "htmljs-parser";
import benchmark from 'htmlparser-benchmark';
export default function htmljsParser() {
return new Promise((res) => {
var bench = benchmark(function (html, callback) {
const parser = createParser({
onText: function (event) {
// Text within an HTML element
... | true |
75c5f8040641ef4270713d51b93fcd79f8337c6a | JavaScript | cameronprattedwards/cat-dog | /dog/dog.js | UTF-8 | 248 | 2.796875 | 3 | [] | no_license | define(function() {
var listeners = [];
return {
addListener: function(callback) {
listeners.push(callback);
},
bark: function() {
console.log("Bark bark!");
listeners.forEach(function(listener) {
listener();
});
}
};
}); | true |
67af7e05633fee1f04e64d1499367e58d90eae4e | JavaScript | npmcomponent/jprichardson-ymd | /lib/ymd.js | UTF-8 | 329 | 2.578125 | 3 | [
"MIT"
] | permissive | module.exports = function ymd (date) {
return date.getFullYear() + '-' + ('0' + (1 + date.getMonth())).slice(-2) + '-' + ('0' + date.getDate()).slice(-2)
}
module.exports.utc = function utc (date) {
return date.getUTCFullYear() + '-' + ('0' + (1 + date.getUTCMonth())).slice(-2) + '-' + ('0' + date.getUTCDate()).sl... | true |
1e91ecb15e771192435b8a7ab3af58e6ab31c82e | JavaScript | TheFrisk/local | /public/serverhttp.js | UTF-8 | 2,863 | 2.796875 | 3 | [] | no_license | /*============Mongo DB ===============*/
var MongoClient = require('mongodb').MongoClient;
/*=========== FIN ============*/
/*============ SOCKET ET SERVEUR =========*/
var express = require('express');
var http = require('http');
var io = require('socket.io');
/*============= FIN ============*/
/*=========== Déc... | true |
ef30b72d33c6fc57abfc1ef0e7e2153c95b03866 | JavaScript | DDjackson272/TE566-final-project | /server/index.js | UTF-8 | 21,053 | 2.546875 | 3 | [] | no_license | const express = require('express');
const db = require("./models/index");
const cors = require("cors");
const bodyParser = require("body-parser");
const PORT = 81;
const app = express();
function salaryAfterTax(salary) {
const stateTaxRate = 0.0495;
const ficaRate = 0.062;
const medicareRate = [0.0145, 0.... | true |
a603dd08fbf8faaeb5d72db142434e8e07eed4cd | JavaScript | xr71/udacity_intermediate_javascript | /p2_functional_js/02_functional_js_syntax/03_reduce.js | UTF-8 | 1,064 | 4.21875 | 4 | [] | no_license |
// To do this, reduce only passes the function two arguments, the total so far - or accumulator,
// and the current item value. Another way that it differs from the first two array methods is
// that it does not necessarily return an array. In the case of the example above, reduce would return a single integer of the ... | true |
104b2c5ac0fe4433e8408be0b3c038571da704bb | JavaScript | gehrmanng/cutting-layouter | /src/reducers/itemReducer.js | UTF-8 | 1,359 | 2.546875 | 3 | [] | no_license | // Local Redux action imports
import { ADD_ITEM, REMOVE_ITEM, UPDATE_ITEM } from '../actions/actionTypes';
// Local data object imports
import { Item } from '../bin-packing';
import osbItems from '../data/osbitemdata';
import { testItems } from '../data/testitemdata';
// Initial state definition
const initialState =... | true |
5389d7c2a793d82f8832dadd9508d209bc25c87a | JavaScript | cuishoulong/2020 | /C模块/day09/复习.js | UTF-8 | 1,087 | 3.8125 | 4 | [] | no_license | // JSON的方法
var obj={name:"li",age:10};
var obj3=JSON.stringify(obj);//JSON.parse(普通对象),将普通对象转换为JSON对象
var obj2=JSON.parse(obj3);//将json对象转为普通对象
console.log(obj3,obj2);
// 深克隆
var obj={name:"li",age:10};
var obj2=JSON.parse(JSON.stringify(obj));//生成一个与原来一模一样,但毫不相关的对象
// class类
class Fn{
//既不是块级作用域,也不是对象
//con... | true |
1ad1897ba883b3d8dd6d5ac7c4c1d38e6eef0c29 | JavaScript | caseycling/jwt-auth | /routes/posts.js | UTF-8 | 1,459 | 2.53125 | 3 | [] | no_license | const router = require('express').Router();
const User = require('../models/User');
const Post = require('../models/Post');
const verify = require('./verifyToken');
//GET CURRENT USER
router.get('/', verify, (req, res) => {
console.log(`GET CURRENT USER:`);
console.log(req.user);
res.send(req.user);
User.findB... | true |
153f6ad5c54f5290b92da3bd87def3c713ee1c12 | JavaScript | textchimp/wdi19-homework | /jessica_tran/week_01/wednesday/arrays/js/exercise2.js | UTF-8 | 336 | 4.03125 | 4 | [] | no_license | /* Define a function maxOfThree that takes three numbers as arguments and returns the largest of them.*/
var maxOfThreeNumbers = function (num1, num2, num3){
if (num1>num2 && num1>num3){
return num1;
} else if (num2>num1 && num2>num3){
return num2;
} else {
return num3
}
}
console.log(maxOfThreeNu... | true |
cf751320f64935a834cc15836f1431622bd06a78 | JavaScript | ConnectFirst/AgentLibrary | /src/chat/chatTyping.request.js | UTF-8 | 1,076 | 2.515625 | 3 | [] | no_license |
var ChatTypingRequest = function(uii,message) {
this.uii = uii;
this.message=message;
};
/*
* External Chat:
* Agent sends typing message to notify client widgets,
* but the agent's pending message is not sent going this direction.
* {"ui_request":{
* "@destination":"IQ",
* "@type":"CHAT-TYPIN... | true |
0c024a3904f5b9604d28e28a969bbb6441e5d8b3 | JavaScript | fuouo/UIParserHTML | /script/uicreate.js | UTF-8 | 4,100 | 2.96875 | 3 | [] | no_license | var uiElements = [];
var uiPanel = $("#uipanel");
$("#createLabel").click(function(event){
//width, height, text
var labelWidth = $("#labelWidth").val() || $("#labelWidth").attr('placeholder');
var labelHeight = $("#labelHeight").val() || $("#labelHeight").attr('placeholder');
var labelFontSize = $("#labelFontSize... | true |
392784ba238f399a397888217e6d27c17147f9ab | JavaScript | AlpanetVE/Vogues | /js/datevin.js | UTF-8 | 723 | 2.515625 | 3 | [] | no_license | var input1 = $('#p_fecha').pickadate({editable: false, container: '#date-picker',
monthsFull: ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
weekdaysShort: ['Dom', 'Lun', 'Mar', 'Mier', 'Jue', 'Vie', 'Sab'],
today: 'Hoy',
clear... | true |
4aecdb58685e994abf26eb4c926103508ec54cdb | JavaScript | vic30004/Restaurant | /routes.js | UTF-8 | 1,107 | 2.84375 | 3 | [
"MIT"
] | permissive | // var express = require("express");
// var path = require("path");
// var app = express();
// var PORT = 3030;
let tables = [{
name: "Andrew Tocchi",
phone: "5307012179",
email: "andrewtocchi@gmail.com"
},
{
name: "Mike Brown",
phone: "5555555555",
email: "mikebrown@gmail.com",
},
{},
{},
{},
];
var queue = [... | true |
35314de7445c6d5662aac238bd9c114fe7a87fea | JavaScript | slonikmak/missionCreator | /mapmodule/src/main/resources/com/oceanos/mapmodule/html/js/fromJavaToJs.js | UTF-8 | 3,437 | 2.671875 | 3 | [] | no_license | //
//Объект, содержащий функции для обработки сообщения из JAVA
var fromJavaToJs = {
prefix: "[JAVA-JS]",
echo: function (msg) {
fromJsToJava.logMsg(this.prefix+ " echo");
fromJsToJava.logMsg(msg)
},
//FIXME: options must be prepared json string
addMarker: function (lat, lng, opt... | true |
9c96000ea59d927df23dee59268036ed9f11f31d | JavaScript | plnicolas/kana-practice | /public/scripts/hiragana.js | UTF-8 | 35,002 | 3.421875 | 3 | [] | no_license |
// client-side js
// run by the browser each time your view template is loaded
var buttonHiraganas = document.getElementById('buttonHiragana');
var textInput = document.getElementById('userInput');
var kanaP = document.getElementById('kana');
var wordDefinition = document.getElementById('definition');
var correctPic... | true |
eb9b5d8652a6f3a4394a283d37599dfbc897b534 | JavaScript | ambreanant/node_mongo | /index.js | UTF-8 | 1,428 | 2.734375 | 3 | [] | no_license | // // const note = require('./note.js');
// // const validator = require('validator');
// // // const name = 'anant';
// // console.log(note(2,4));
// // // console.log(name);
// // console.log(validator.isEmail('anantgmail.com'))
// // console.log(validator.isURL('anant@gmail.com'))
// // const chalk = ... | true |
01ad8001ececef6503e372636943e6167242a9d6 | JavaScript | JavierPons/exercise_platfrom | /02_javascript/block6/exercise9.js | UTF-8 | 395 | 3.546875 | 4 | [] | no_license |
// Write a function called sumAll that takes one argument, an object, and sums all it's values. If no object is provided or if the
// object is empty sumAll should return 0.
function sumAll(obj) {
var count= 0;
if(obj == null || obj == undefined){
return 0;
}else{
for(var key in obj){
co... | true |
ad74cf57acbb6df1af44ee0092732225a754d79e | JavaScript | kvazimode/497391-pixel-hunter | /js/view/view-three-pic.js | UTF-8 | 1,241 | 2.59375 | 3 | [] | no_license | import ViewAbstract from './view-abstract';
export default class ViewTwoPic extends ViewAbstract {
constructor(state) {
super();
this.state = state;
}
get template() {
const task = this.state.tasks[this.state.level];
return `
<section class="game">
<p class="game__task">${task.question... | true |
61121efa5b35c4b092dfea88ce54d0f05c57fb45 | JavaScript | Monica14/wheatherdata | /models/user.js | UTF-8 | 1,556 | 2.578125 | 3 | [] | no_license | var mongoose = require('mongoose');
var bcrypt = require('bcrypt');
var userdata = mongoose.Schema({
username : {
type : String,
unique : true,
trim : true
},
firstname : {
type : String
},
middlename : {
type : String
},
lastname : {
type : S... | true |
81ceccfc0f9cd567e80e46cb60daeeaf5096a673 | JavaScript | stewoe/functional-javascript-presentation | /1_recur_2.js | UTF-8 | 347 | 4.03125 | 4 | [] | no_license |
function fibIter(n) {
if(n == 1 || n == 2) {
return 1;
}
var ret = 0;
var fib1 = 1;
var fib2 = 1;
var idx = 3;
while(idx <= n) {
ret = fib1 + fib2;
fib1 = fib2;
fib2 = ret;
idx++;
}
return ret;
}
function fib(n) {
return (n == 1 || n == 2)
? 1
: fib(n-1) + fib(n-2)... | true |
0005fa0430a9a3a7a0b52905a465a8bba046fb45 | JavaScript | fordepowers/cyberhawks-bot | /commands/greet.js | UTF-8 | 596 | 2.578125 | 3 | [] | no_license | module.exports = {
name: '!greet',
description: 'Greet newcomers',
execute(msg, args) {
let newcomer = msg.mentions.users.first();
let author = args;
if (newcomer === undefined && author === undefined) return;
let greeting =
`>>> **Hello ${newcomer ? newcomer.toString() : author}, welcome to... | true |
ccd7f1142a0ee05ed10a9a1872d241e9ba54c336 | JavaScript | atsushigo/Node-projects | /0726blog2/model/user.js | UTF-8 | 1,020 | 2.59375 | 3 | [] | no_license | module.exports = class User extends require('./model'){
//登入驗證
static login(username,password){
return new Promise((resolve,reject)=>{
let sql = "SELECT id,username FROM `user` WHERE username = ? AND `password` = ?"
this.query(sql,[username,password]).then(results=>{
//這邊可以console.log(results) 和 console.l... | true |
e3fd3824caa406ffa5efe51af807341ae43c6182 | JavaScript | Rob-Rychs/javascripting | /ES6-Complete-Guide/array-helper-methods/name-survey-example.js | UTF-8 | 865 | 3.421875 | 3 | [] | no_license | const names = ["Jim", "Rose", "Mack", "Mandi", "Eddie", "Jim", "Mack"]
const result = names.reduce((allNames, name) => {
if(allNames[name]){
allNames[name]++
} else {
allNames[name] = 1;
}
return allNames
}, {})
console.log(result)
const filter = names.reduce((filtered, name) => {
}, [])
con... | true |
2212b5fc03ec53df2cb245f8ee858dae193eb225 | JavaScript | vicedox/primenumbers | /app.js | UTF-8 | 565 | 4.0625 | 4 | [] | no_license | // function isPrime(num) {
// for (let i = 2, max = Math.sqrt(num); i <= num; i++) {
// if (num % i === 0) {
// return false;
// }
// }
// return num > 1;
// }
// console.log('2', isPrime(2));
function isPrime(num) {
for (let i = 2, max = Math.sqrt(num); i <= max; i++) {
if (num % i === 0) ... | true |
541d0ff0fcdea02a20601e8a6282cc360f16035a | JavaScript | RafaelSdm/Curso-Web-Moderno-com-Javascript | /Javascript/Exercicios/exercicio02.js | UTF-8 | 383 | 3.171875 | 3 | [
"MIT"
] | permissive | function especieTriangulos(ld1,ld2,ld3){
if(ld1 == ld2 && ld1 == ld2 && ld2 == ld3){
console.log('Equilatero')
}else if((ld1 == ld2 && ld3 != ld1 )|| (ld1 == ld3 && ld2 != ld1) || (ld2 == ld3 && ld1 != ld2) ){
console.log('isosceles')
}else if(ld1 != ld2 && ld1 != ld3 && ld2 != ld3){
... | true |
8fdc62816ea92b48b3b93b8df033d43dd4761058 | JavaScript | jiguoqing/sales_front | /src/utils/DateUtil.jsx | UTF-8 | 1,990 | 3.15625 | 3 | [] | no_license | import * as TypeUtil from './TypeUtil';
/**
* 灰度时间策略时间格式
*
* @type {string}
*/
export const GRAY_TIME_POLICTY_DATE_FORMAT = "YYYYMMDDHHmm";
/**
* 格式化日期
*
* @param date 日期
* @param fmt 格式: yyyy-MM-dd hh:mm:ss
* @returns {*}
*/
export function format(date, fmt) {
var d = new Date(date);
var o = {
... | true |