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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
3a42a09c472d9aa3836d77411f1cf6ba4c026c76 | JavaScript | benst4ck/webpack | /wp3/parent.js | UTF-8 | 709 | 3.0625 | 3 | [] | no_license | import $ from 'jquery'
import * as c from './child' // 引入child模块中暴露的所有接口(*) 通过变量c来访问从child模块引入的接口 这时候c是一个对象
import {name, age, multiply} from './child2'
console.log(c.n)
console.log(c.sayHello('Ben'))
var person = name + age
var num = multiply(c.n, 2)
$(function(){ // 加载完文档就执行该函数
$("body").append("<div id='data'>... | true |
e0e410d7dde0eb2aa74e8a76ef7db2e945e7e6df | JavaScript | SoftwareAG/WxMonitoring | /assets/IS/Packages/WxMonitoring/pub/processes-specific.js | UTF-8 | 7,670 | 3.046875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | function refresh(){
var query_string = window.location.search;
if(!query_string){
resetDashboardState();
document.getElementById("resultsPerPage").value = getElementLastValue("resultsPerPage");
document.getElementById("requestedPageNumber").value = getElementLastValue("requestedPageNumber");
setRadioButtonVal... | true |
83000642c1df2c946f4a03a0fa10d322c3faea56 | JavaScript | piyalidas10/gulp-typscript-to-javascript | /output/assets/ts/main.js | UTF-8 | 906 | 3.390625 | 3 | [] | no_license | // TypeScript Class
var UserAccount = /** @class */ (function () {
function UserAccount(name, id) {
this.name = name;
this.id = id;
}
UserAccount.prototype.show = function () {
return "User Name is " + this.name;
};
return UserAccount;
}());
var user = new UserAccount("Murphy... | true |
8587620129108d96be6fae5b392afb128c0ee0ed | JavaScript | sushabhardy/fp-back | /controller/newsfeed/get-comments.js | UTF-8 | 982 | 2.5625 | 3 | [] | no_license | /**
* Get comments Handler
* @param {getCommentsUsecase, validationResult}
*/
const makeGetCommentsHandler = ({ getComments, validationResult }) => {
return async (req, res, next) => {
try {
/**
* To Check if req is valid
*/
const errors = validationResult(req)
if (!errors.isEmpty... | true |
56013dceb390d3af0820534818ccdf6330b8d394 | JavaScript | malee31/HalloweenDiscordBot | /commands/forcestartevent.js | UTF-8 | 800 | 2.578125 | 3 | [] | no_license | const {forceStartEvent} = require("../parts/randomEvent.js");
module.exports = {
name: 'forcestartevent',
aliases: ['fse'],
description: 'Force start a random event. Requires permission ADMINISTRATOR',
validate(message) {
console.log(`Event requested by: ${message.author.username}#${message.author.discriminator}... | true |
d290cf647d31fb1ef044e3ea162a0aed3e8ee3b3 | JavaScript | wanjarus/TurboTables | /TurboTables/public/javascripts/turbotables.js | UTF-8 | 19,958 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | //
//Copyright (c) Seagull Consulting, Inc. All rights reserved. See License.txt in the project root for license information.
//
//Version 0.9.1
//
//Public methods:
// setDataBinding(function)
// endDataBinding(totalItems)
// getPage()
// getPageSize()
// getSortColumn()
// getSortDirection()
// showSpin... | true |
5510fb8a842867a5f5b8c45476763986f3e6a63d | JavaScript | achingbrain/jvm.js | /src/main/javascript/common/core/SystemClassLoader.js | UTF-8 | 2,936 | 2.578125 | 3 | [] | no_license | jjvm.core.SystemClassLoader = {
_classes: [],
_objectRef: null,
addClassDefinition: function(classDef) {
// see if we are redefining the class
for(var i = 0; i < jjvm.core.SystemClassLoader._classes.length; i++) {
if(jjvm.core.SystemClassLoader._classes[i].getName() == classDef.getName()) {
// replace pr... | true |
1ecd49804c3291d15ea6588b7370f785546bd3a7 | JavaScript | Azraelless/add-calculator | /backend/server.js | UTF-8 | 884 | 2.765625 | 3 | [] | no_license | const express = require('express');
const bodyParser = require('body-parser');
const app = express();
app.use(bodyParser.json());
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Acc... | true |
8e4c2109ca19262c0ec2f0c66314cb0c72bbe05d | JavaScript | jsepia/utils | /test/unit/object.test.js | UTF-8 | 2,527 | 2.8125 | 3 | [
"Apache-2.0"
] | permissive | import { expect } from 'chai'
import { deepMerge, extend } from '../../lib'
describe('object tests', () => {
describe('deepExtend', () => {
it('merges objects deeply', () => {
const merged = deepMerge(
{
body: {
ribs: 5,
neck: {
skull: null
... | true |
a5e144b8d5dbfc6bf770ddcc83e9e6273b5888de | JavaScript | SunJiang9695/fit-share | /app/scripts/controllers/search.js | UTF-8 | 2,167 | 2.6875 | 3 | [] | no_license | 'use strict';
/**
* @ngdoc function
* @name ctlApp.controller:SearchController
* @description
* # SearchController
* Controller of the ctlApp
*/
angular.module('ctlApp')
.controller('SearchController', ['$scope', '$window', 'cmService', function($scope, $window, cmService) {
// Setting up the search contro... | true |
324e08051a2f26b47e68b1bf3237b678cc209859 | JavaScript | jo32/kdtree-js | /test/testtree.js | UTF-8 | 553 | 3.09375 | 3 | [] | no_license | var KDTree = require("../KDTree")
.KDTree;
console.log(KDTree)
var t = new KDTree({
"dimensions": ["x", "y"]
});
var p1 = {
"x": 3,
"y": 4
}
var p2 = {
"x": 2,
"y": 4
}
var p3 = {
"x": 5,
"y": 5
}
var p4 = {
"x": 4,
"y": 7
}
t.insertPoint(p1);
t.insertPoint(p2);
t.insertPoint(p3... | true |
2fda35e3c5f3a139550f19055c4da4dfa7f27eb0 | JavaScript | oslabs-beta/Helios | /server/controllers/aws/APIGateway/utils/APIUtilFunc.js | UTF-8 | 2,220 | 2.8125 | 3 | [
"MIT",
"LicenseRef-scancode-free-unknown"
] | permissive | //The following assumes that User Inputs the time timeRange (either in min, hours, days)
//input time range period for aggregating the metrics
//for e.g. if the time range selected on the front end is minutes, metrics from CloudWatch would be
// aggregated by 1 minute (60 seconds)
const timeRangePeriod = {
minutes:... | true |
3acf1f44d281deac0359c6282fbd0717aedca0f9 | JavaScript | davidwarrington/transcend-con | /server/routes/auth.js | UTF-8 | 2,976 | 2.640625 | 3 | [] | no_license | /**
* Import npm packages used
* within the script.
*/
const express = require('express');
const router = express.Router();
const passport = require('passport');
/**
* Import the authHandler function
* from the controllers directory.
*/
const authHandler = require('../handlers/authHandler');
/**
* Login R... | true |
9365ccfd29bb9281bbb9ab0c165298f776727be4 | JavaScript | nh8157/Web-Based-Chat-Room | /legacy/scripts/register.js | UTF-8 | 800 | 3.578125 | 4 | [] | no_license | // get the username and password from the user
document.getElementById("submit-button").onclick = function() {
// const username, pswrd1, pswrd2;
const username = document.getElementById("name").value;
const pswrd1 = document.getElementById("pass1").value;
const pswrd2 = document.getElementById("pass2")... | true |
d72b942b53e281db131d66957c7a6866b7d69b0b | JavaScript | Code-Institute-Submissions/paulvmking-Wanderers-Way_MayResub | /assets/js/sendEmail.js | UTF-8 | 663 | 2.53125 | 3 | [] | no_license | // To send mail from register form modal
function sendMail(registerForm) {
emailjs.send("gmail", "wanderers_way", {
from_email: registerForm.emailaddress.value,
});
return false;
}
// To provide user with feedback with password matching
$("#enter-password, #re-enter-password").on("keyup", function() {
if ($("#en... | true |
b8efbe4719e3826c3270cf5ff358274976cdd681 | JavaScript | JPMELO13/GDEZ.EDU | /js/registration-script.js | UTF-8 | 8,628 | 3.171875 | 3 | [] | no_license | const fields = document.querySelectorAll("[required]")
function ValidateField(field) {
// logica para verificar se existem erros
var cpfValid = isValidCPF();
var dataValid = isValidData();
function verifyErrors() {
let foundError = false;
for (let error in field.validity) {
... | true |
ec051d1515a429d342e2f57e1ced3dba5a9b0b76 | JavaScript | nikamshubham/Mean-Assignments | /Project 1/src/3.js | UTF-8 | 375 | 3.640625 | 4 | [] | no_license | class main {
static addition(x, y) {
return x + y;
}
substraction(x, y) {
return x - y;
}
multiplication(x, y) {
return x * y;
}
}
let add = main.addition(10, 5);
console.log(add);
let obj = new main;
let sub = obj.substraction(10, 5);
console.log(sub);
... | true |
7a65e5ee4530a0b959fe09a6eff58b0eedc3e90e | JavaScript | jayceeyili/iblink-public | /client/actions/authenticationActions.js | UTF-8 | 349 | 2.546875 | 3 | [] | no_license | import ActionType from './actionType';
export function loggedIn(userId) {
return ({
type: ActionType.GetUserID,
userId
})
}
export function getUserData(userId) {
fetch('/' + userId, {
method: 'GET'})
.then(function(response) {
return response;
})
.catch(function(err) {
console.log('you ... | true |
a6f41e75a8cad03e1f27502a3ab31696fe5dca3e | JavaScript | DevelopedByDay/workdayschedule | /assets/java.js | UTF-8 | 2,915 | 2.953125 | 3 | [] | no_license |
var today = function() {
var area = $("#currentDay")
.text(moment().format("dddd, MMMM Do"))
}
var createTask = function() {
};
var loadTasks = function() {
today();
var container = document.getElementById("schedule")
for(i = 7; i < 19; i++) {
var hour = i
if (i > 12) {
... | true |
547f463916419eadf2443a4263281d100185dd8f | JavaScript | Ducklett/aoc-2020-js | /day14/part2.js | UTF-8 | 1,541 | 3 | 3 | [
"Unlicense"
] | permissive | const fs = require('fs')
const input = fs.readFileSync(__dirname + '/input.txt', { encoding: 'utf-8' }).trim()
const parseInstruction = str => {
if (str[1] == 'a' /*mask*/) {
return { op: 'mask', mask: str.split(' = ')[1] }
} else /*mem*/ {
const [address, value] = str.match(/\d+/g).map(s => ... | true |
fa193a66d6099217017d40b97739d86380d1727b | JavaScript | 9-volt/ludum-dare-33 | /js/food.js | UTF-8 | 600 | 2.953125 | 3 | [] | no_license | function Food(game) {
this.game = game
// this.squidGroup = new SquidGroup(game)
this.submarineGroup = new SubmarineGroup(game)
}
Food.prototype.reset = function() {
this.submarineGroup.reset()
}
Food.prototype.update = function() {
// this.squidGroup.update()
this.submarineGroup.update()
}
Food.prototy... | true |
dc6d74450d700e44100e7ec556b9d2d209c30b14 | JavaScript | cah12/asteroidsEx2 | /lib/gameComponents/hud.js | UTF-8 | 1,949 | 2.734375 | 3 | [] | no_license | define(function(){
var HUD = function(details){
var self = this;
this.details = details = details || {};
this.restart = this.details.restart || null;
this.levelChanged = this.details.restart || null;
var scoreboardDiv = $("#scoreboardDiv");
var hudDiv = scoreboardDiv;
hudDiv[0].style.op... | true |
9d4a557a253ffbcef75ec24e1e953c789d3f0312 | JavaScript | asundberg/adventure-game | /node.js | UTF-8 | 1,031 | 3.34375 | 3 | [] | no_license | var Connection = require('./connection');
var Node = function(title, text) {
// Ex: 'the living room', 'Tastefully decorated, with an ominous feeling rising from below'.
// A location + description of the location.
this.title = title;
this.text = text;
this.connections = []; // Array of objects
this.conditions ... | true |
022ef8742f7e977b39b7094ccc25a5d88f70a189 | JavaScript | m-aldelah/Principal_Planner | /calendar.js | UTF-8 | 9,070 | 3.046875 | 3 | [] | no_license | let nav = 0;
let clicked = null;
let events = localStorage.getItem('events') ? JSON.parse(localStorage.getItem('events')) : [];
var rescheduleEventModal=document.getElementById('rescheduleEventModal');
var newEventModal=document.getElementById('newEventModal');
const deleteEventModal = document.getElementById('deleteEv... | true |
8d60893b84379065e3f50c806c36b54ae8c95b0b | JavaScript | Sreejan-Patel/My-Website | /js/script2.js | UTF-8 | 503 | 2.75 | 3 | [] | no_license | var img1="../img/1.jpeg"
var img2="../img/2.jpeg"
var img3="../img/3.jpeg"
var img4="../img/4.jpeg"
var img5="https://www.iiit.ac.in/img/iiit-new.png"
var count=0;
function imageShow() {
if(count==0)
document.getElementById("imgid").src=img1;
if(count==1)
document.getElementById("imgid").src=img2;
if(count==2)
... | true |
26a4ec1c3f9d7b029e15b580e20c082cd9a7696c | JavaScript | edavilaz/Javascript | /js/fechas.js | UTF-8 | 701 | 3.609375 | 4 | [] | no_license | // con esto encontramos la fecha actual del sistema
var fecha = new Date();
//imprimir la fecha
document.write(fecha);
document.write("<br>");
// extraer la hora
document.write(fecha.getHours());
document.write("<br>");
// extraer minutos
document.write(fecha.getMinutes());
document.write("<br>");
// extraer segundos... | true |
a39dee850ef2c66fad002ad137376387b00ccf26 | JavaScript | tongquhq/about | /lib/model/address.js | UTF-8 | 635 | 2.984375 | 3 | [
"MIT"
] | permissive | /**
* Created by at15 on 2016/9/8.
*/
'use strict';
/**
* @property zipCode {string}
*/
class Address {
constructor() {
this.zipCode = '';
this.city = '';
// State or province
this.state = '';
this.country = '';
// TODO: address line 1 & 2 & 3?
this.addre... | true |
434b9070469fb66fbb6cd976678fbe9a17a15acf | JavaScript | jwarby/jvc-tv-api | /src/TV.js | UTF-8 | 1,850 | 2.515625 | 3 | [] | no_license | const EventEmitter = require('events')
const fill = require('lodash.fill')
const wol = require('wol')
const keys = require('./keys')
const sendRequest = require('./sendRequest')
const SEND_REQUEST_THROTTLE = 100
class TV extends EventEmitter {
constructor(udn, options) {
super()
this.udn = udn
this.n... | true |
94b3d4a608e2ed053293b6beb250405477bb04ff | JavaScript | sdore2021/web-avancee | /newapp/public/javascripts/global.js | UTF-8 | 4,061 | 3.09375 | 3 | [] | no_license | var studentListData = [];
$(document).ready(function () {
fillHTMLTable();
$('#studentList table tbody').on('click', 'td a.linkshowstudent', displayStudentData);
$('#btnAddStudent').on('click', addStudent);
$('#studentList table tbody').on('click', 'td a.linkdeletestdent', deleteStudent);
});
function ... | true |
05ac94e8b473b31eb8f953c4b7ebe201f417eed7 | JavaScript | hawkesa1/TheGame | /WC/WebContent/js/touchControls.js | UTF-8 | 1,289 | 2.859375 | 3 | [] | no_license | var screenPressed = false;
var startX = 0;
var clickStartTime = 0;
function bindCanvasTouchControls() {
console.log("Binding Controls");
$("#controls").bind("mousedown", function(e) {
e.preventDefault();
screenPressed = true;
var audioElm = document.getElementById('audio');
var currentTime = ... | true |
8f35ba522214ef263f5bdfb86986ce953450ebdb | JavaScript | Samridh212/Project-64 | /App.js | UTF-8 | 3,301 | 2.625 | 3 | [] | no_license | import * as React from 'react';
import { Text, View, StyleSheet,TouchableOpacity } from 'react-native';
import {Header} from 'react-native-elements';
import {SafeAreaProvider} from 'react-native-safe-area-context';
import {TextInput} from 'react-native'
import dictionary from './localdb'
export default class App exte... | true |
dc78edffe345c53542cbb5612c2460a8ccdece11 | JavaScript | fixopen/study | /src/main/webapp/basic-example/js/class-activityInquiry.js | UTF-8 | 510 | 2.546875 | 3 | [] | no_license | window.addEventListener('load', function (evt) {
var loginButton = document.getElementById('login')
if (loginButton) {
loginButton.addEventListener('click', function (evt) {
var path = window.location.href;
window.location.replace("login.html?url=" + encodeURI(path));
}, ... | true |
aaf0bfc42ec79704ab9edf0aa29a7d77368c8131 | JavaScript | wowdyaln/fcc_nodejs_server | /http_client.js | UTF-8 | 2,618 | 3.859375 | 4 | [] | no_license | /*
## HTTP 客戶端 (練習題 7 之 13)
撰寫一個會對第一個參數所提供之URL(網址)發起 HTTP GET
請求(request)的程式。這個程式會把 每個
來自回應「data」事件的字串內容以新的一行顯示在終端機(標準輸出,stdout)上
。
─────────────────────────────────────────────────────────────────────────────
## 提示
在這個練習中,您將需要使用核心的 http 模組。
要閱讀 http 模組的文件,可以在瀏覽器中打開這個頁面:
file:///Users/Roro/.nvm/ver... | true |
180c6fbf68d5099dd15872e21944bce5c8c8cefa | JavaScript | JeremieINSINGA/javascript | /jour8/chuckNorris.js | UTF-8 | 235 | 2.671875 | 3 | [] | no_license | function getFact() {
request.get("https://api.chucknorris.io/jokes/random", function(error, response, body) {
console.log(response.statusCode);
var fact = JSON.parse(body);
console.log(fact.value);
});
} | true |
c80a3d9a7b463032db25af29bd46758fc7abeb6c | JavaScript | KoneidenKapinaAdele/vvk-ui | /js/vvk-radiator.js | UTF-8 | 2,362 | 2.90625 | 3 | [] | no_license | var vvkRadiator = function() {
this.start = function() {
this.fetchPlaces();
this.startPlaceStatusUpdatePoller();
};
this.startPlaceStatusUpdatePoller = function() {
window.setInterval(this.updatePlacesStatus.bind(this), 4000);
};
this.updatePlacesStatus = function() {
vvk.placeService.getP... | true |
97107148cda8712c8c5918f5c6ec3a8f6926a5f6 | JavaScript | NatoBoram/natoboram.github.io | /battleship/battleship.js | UTF-8 | 5,491 | 3.203125 | 3 | [] | no_license | /**
* Place les bateaux de façon aléatoire
* @param {Number} size
* @param {Array} grid
*/
function placerBateau(size, grid) {
var
pos1,
pos2,
bateauPlace,
allOrientations,
orientationsValides,
orientationsRestantes,
valide,
orientationChoisie;
do {
// X and Y
pos1 = Math.floor(Math.rando... | true |
8499ab392a7ec3b0d6efd5c0e2c3551fc0080905 | JavaScript | fmpr123/BackEnd | /ex/Trabalho1/P1_2015418_2015718/server.js | UTF-8 | 5,077 | 3.125 | 3 | [] | no_license | const express = require('express');
const bodyParser = require('body-parser');
const app = express();
const port = 3000;
const fs = require('fs');
const uuidv1 = require('uuid/v1'); //Gerador de uuid
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
extended: false
}));
app.listen(port, func... | true |
611404205826bc6571634657f30fbfbaffd337bf | JavaScript | leahpwatt/coding-challenge | /src/containers/Home.js | UTF-8 | 3,405 | 2.546875 | 3 | [] | no_license | import React, { Component } from 'react';
import { Link } from "react-router-dom";
import MuiThemeProvider from "material-ui/styles/MuiThemeProvider";
import Form from "../components/Form";
import Table from "../components/Table";
export default class Home extends Component {
state = {
data: [
{
"... | true |
99aa35a800053d0f2e24caa65d7fb1c0bf92f70e | JavaScript | Yunssss4410/LeetCode | /src/JS/LC1018.js | UTF-8 | 317 | 2.859375 | 3 | [] | no_license | /**
* @param {number[]} A
* @return {boolean[]}
*/
var prefixesDivBy5 = function (A) {
if (A.length < 1) return [];
let res = [];
let num = A[0];
res[0] = num === 0;
for (let i = 1; i < A.length; i++) {
num = num * 2 %10 + A[i];
res[i] = num % 5 === 0;
}
return res;
};
| true |
e23a2df214b6591e79bdc5585253033527ffaf5d | JavaScript | maxckelly/expensify-app | /src/playground/destructuring.js | UTF-8 | 1,448 | 4.125 | 4 | [] | no_license | // -------------------------
// OBJECT DESTRUCTION
// -------------------------
const person = {
name: 'Max',
age: 22,
location: {
city: 'Melbourne',
temp: 29
}
};
// The Anonymous is a default value if a name hasn't been entered.
// We can also change the name to another word such as firstName.
// c... | true |
8c30b4b2335c0428292faff3c3937c79b7ecb0c2 | JavaScript | olosinno/JUMP-2019-REST-Project-Team-3 | /AnimalShelterREST/src/main/resources/static/Index.js | UTF-8 | 68,833 | 2.8125 | 3 | [] | no_license | function initialize(){
//generate card decks
animalCards();
locationCards();
staffCards();
fosterCards();
//make about
aboutUs();
var video=document.getElementById("video");
$(video).on("click", function(e){
if(video.muted){
video.muted = false;
}
... | true |
55eab4cff0c38d75fd8638782fec81412dc0640e | JavaScript | gtoubiana/acte | /src/js/private/constants/jjFinCommuneDeParis.js | UTF-8 | 571 | 2.84375 | 3 | [
"CC-BY-4.0",
"MIT"
] | permissive | /**
* Nombre de jours juliens correspondants à l'abrogation du calendrier
* républicain dans le journal officiel lors de la Commune de Paris
* en 1871.
* @access private
* @author Gilles Toubiana
* @since 0.0.1
* @see {@link https://github.com/gtoubiana/acte|Projet sur GitHub}
* @constant {Number}
* @example
... | true |
8c6e772a822ccc2f0640698f4e464abaff9bccc8 | JavaScript | madan-tiwari/socialmediaWeb-Backend- | /validator/index.js | UTF-8 | 2,696 | 3.046875 | 3 | [] | no_license |
//validation for creating new post
exports.createPostValidator = (req, res, next) => {
req.check('title', 'TITLE IS REQUIRED').notEmpty()
req.check('title', 'TITLE must be between 4 - 150 characters').isLength({
min: 4,
max: 150
})
req.check('body', 'BODY IS REQUIRED').notEmpty()
r... | true |
f85db5e891ee95c9aa05556187eb786310e52c90 | JavaScript | bigsaigon333/boj-with-js | /src/5430.js | UTF-8 | 858 | 3.25 | 3 | [] | no_license | const input = require("fs").readFileSync(0, "utf-8").split("\n");
let line = 0;
const next = () => input[line++];
const ans = Array.from({ length: next() })
.map(() => {
const P = next().split("");
const N = Number(next());
const str = next().slice(1, -1);
const nums = str ? str.split(",").map(Numbe... | true |
1a8af379e37b8c868f65032eb761580bed75c6c3 | JavaScript | memunyawiri/notes-app | /spec/note-list-view-spec.js | UTF-8 | 402 | 2.796875 | 3 | [] | no_license | function testViewHTMLString() {
var noteList = new NoteList();
var noteListView = new NoteListView(noteList);
noteList.createNote("Favourite food: pesto");
noteList.createNote("Favourite drink: seltzer");
assert.isTrue(noteListView.viewHTML() === "<ul><li><div>Favourite food: pesto</div></li><li><div>Favourit... | true |
a2547b6e303f5ddc479f351d95f20383068824df | JavaScript | muxuechenshuang/wuliu2 | /src/main/webapp/statics/js/zz/gongdan2_zz.js | UTF-8 | 2,829 | 2.609375 | 3 | [
"MIT"
] | permissive | $("#sCity").change(function () {
var cityId = $("#sCity").val();
if(cityId!=null&&cityId!==""){
$.ajax({
type:"GET",
url:"queryBranchList.json",
data:{parentId:cityId},
dataType:"json",
success:function (data) {
if(data==null||d... | true |
38884cd00a8e99edec4bef5d8fac687e10dd5e12 | JavaScript | rkb716/imperial-metric-converter | /controllers/convertHandler.js | UTF-8 | 4,259 | 3.21875 | 3 | [] | no_license | function ConvertHandler() {
/*
splits the input string, returning the number
or "invalid number" if the number is not valid
*/
this.getNum = function(input) {
let regexResult = this.regexUnit(input);
let lastIndex;
if(regexResult != null) {
lastIndex = regexResult.index;
} else {
... | true |
714f1e24f138a541b59281226ac99ab7a4ea0e2a | JavaScript | imnomee/05-Project-Public-API-Requests | /js/app.js | UTF-8 | 9,250 | 3.609375 | 4 | [] | no_license | const gallery = document.getElementById("gallery"); //Gallery to draw cards
const searchContainer = document.getElementsByClassName("search-container")[0]; //Container for search
const body = document.getElementsByTagName("body")[0]; //Main body
const apiURL = "https://randomuser.me/api/?results=12&nat=ca,us,gb,nz,au"... | true |
9bdd2401baf6d39e71ec5aeb50207f7b3dfb9c88 | JavaScript | BenSymons/Rick-and-Morty | /src/components/episodes.jsx | UTF-8 | 2,085 | 2.609375 | 3 | [] | no_license | import React, { useState } from "react"
import { useQuery } from "@apollo/client"
import { EPISODES } from "../utils/queries"
import { Link } from "@reach/router"
const EpisodeList = () => {
// This uses the query in utils to GET all the episodes
const [page, setPage] = useState(1);
const [search, setSearc... | true |
bd4253b3afc3c7ebb26356eebf7613cfc11761cf | JavaScript | DraciVik/codewars_solutions | /8kyu-return-the-day.js | UTF-8 | 772 | 4.28125 | 4 | [
"MIT"
] | permissive | // Complete the function which returns the weekday according to the input number:
// 1 returns "Sunday"
// 2 returns "Monday"
// 3 returns "Tuesday"
// 4 returns "Wednesday"
// 5 returns "Thursday"
// 6 returns "Friday"
// 7 returns "Saturday"
// Otherwise returns "Wrong, please enter a... | true |
3cfe3d4540ad109c4c1dbf7cfb6dc43f267298f1 | JavaScript | Matou88/SteveMarchal_6_23072021 | /controllers/sauce.js | UTF-8 | 4,439 | 2.734375 | 3 | [] | no_license | const Sauce = require("../models/sauce"); // Importation du schéma des sauces.
const fs = require("fs"); // Importation du module 'file system' de Node pour avoir accès aux différentes opérations liées au système de fichier
/************ Création d'une sauce ************/
exports.createSauce = (req, res, next) => {
... | true |
679a23e93e80eb0ef2cf02572b613b5af6c4488b | JavaScript | pashapushak1996/js-homework | /lesson-4/homework-4.js | UTF-8 | 11,796 | 3.359375 | 3 | [] | no_license | // Реалізовуємо свій компютерний магазин.
// ===
// Необхідно реалізувати базовий клас комютера. Який має лише параметри:
// Оперативна память.
// Потужність процесора. (цифра від 0 до 1000)
// Назва.
// В кожного компютера має бути метод включання.
// ===
// Від базового компютрера треба реалізувати ноутбу... | true |
0ec823fd36844ca1256babe1f30c5e5e53aa9391 | JavaScript | montgomeryrd/tessio | /src/components/menu/HappyHour.js | UTF-8 | 2,031 | 2.515625 | 3 | [] | no_license | import { appetizers, tapBeers, houseWines, wells } from './data';
const HappyHour = () => {
const apps = appetizers.map((item, index) => {
return (
<li key={index}>
<p className="menu-item">
{item.item}, ${item.price}
</p>
<p ... | true |
2dbb17fdd6e97f639c03fa3afb8a2158f495746e | JavaScript | kessyus/ipet-backend | /api/services/user.service.js | UTF-8 | 1,259 | 2.625 | 3 | [] | no_license | const { user } = require('../models');
const crypto = require('../utils/crypto');
const userMapper = require('../mappers/user.mapper');
// Checks if user exists
const userIsValid = async (email, senha) => {
const userData = await user.findOne({
email,
senha: crypto.createHash(senha)
});
if (
!userDa... | true |
65b1e0e5c19951348b30ff876b70e8d4e9e76d26 | JavaScript | AmberSargeant/Finding-Nouv | /js/enemy.js | UTF-8 | 1,024 | 3 | 3 | [] | no_license | function Enemy(game,key, frame, position){
//call to Phaser.Sprite // new Sprite(game, x, y, key, frame)
Phaser.Sprite.call(this, game, 64,game.world.height-60,key,frame);
// add properties
this.anchor.set(0.5);
this.x = position;
game.physics.enable(this);
this.enableBody = true;
this.body.collideWorldBounds ... | true |
182321fb2afc1c6519f765627b99b0eca9170f94 | JavaScript | jackplug/orderupdate | /example/main.js | UTF-8 | 2,751 | 3.109375 | 3 | [] | no_license | /*jshint esversion: 6 */
//create an empty array on startup
let exampleHistory = [];
const API_BASE = "https://api.thecatapi.com/";
const API_EXAMPLE = API_BASE + "v1/images/search/?";
const API_SIZE = '&size=small';
const HISTORY_STORAGE_KEY = 'HISTORY_KEY';
/**
* generate example tag from a Javascript Object that... | true |
f2bef00970e9598bbf6d2508391ca7749d686730 | JavaScript | bhelx/AndroidTracker | /web/static/js/app.js | UTF-8 | 1,758 | 2.515625 | 3 | [
"MIT"
] | permissive | import "phoenix_html"
import socket from "./socket"
import L from "leaflet"
let map, marker, popup;
let ready = (fn) => {
if (document.readyState != 'loading'){
fn();
} else {
document.addEventListener('DOMContentLoaded', fn);
}
}
// Now that you are connected, you can join channels with a topic:
let ... | true |
44d4176c78b4d035aed3b188a71afba60bd3c729 | JavaScript | spancavil/glitch_nodeServerChatAndProducts | /api/Mensajes.js | UTF-8 | 1,136 | 2.984375 | 3 | [] | no_license | const fs = require('fs');
class Mensajes {
constructor(){
this.mensajes = [];
}
leerMensajes(){
try{
let contenido = fs.readFileSync( __dirname + '/log.txt', 'utf-8');
if (contenido) {
this.mensajes = JSON.parse(contenido);
return thi... | true |
762e91d848329e56e8aeb2f03c82c4585fff3b95 | JavaScript | derrickmstrong/EdabitChallenges | /convertnumbertomonth.js | UTF-8 | 537 | 3.5 | 4 | [] | no_license | const convertNumToMonth = (num) => {
return num === 1
? 'January'
: num === 2
? 'February'
: num === 3
? 'March'
: num === 4
? 'April'
: num === 5
? 'May'
: num === 6
? 'June'
: num === 7
? 'July'
: num === 8
? 'August'
... | true |
df424d7202002ba116c62a653ab8b1efd8eadc76 | JavaScript | giuseppe-falco/js-paliedispari | /palindroma/js/script.js | UTF-8 | 810 | 4.3125 | 4 | [] | no_license | // Palidroma
// Chiedere all’utente di inserire una parola
// Creare una funzione per capire se la parola inserita è palindroma
//richiesta parola
var word = prompt("Inserisci una parola");
//stampa parola
document.getElementById("word-user").innerHTML += word;
//dichiarazione e assegnazione funzione
var str = wor... | true |
d2ac00e266bf62d6a330d2f8359ba176b70e5004 | JavaScript | SuchSoftware/open-west-2018 | /getting-data-out-of-microservices/src/event-store/write.js | UTF-8 | 4,439 | 2.765625 | 3 | [] | no_license | function createWrite({ db, commitsTableName, messagesTableName }) {
/**
* @description Emits messages to stream(s)
* @param {Object[]} messages
* @param {string} messages[].stream A stream to emit to
* @param {Object} messages[].messages The messages to emit to the
* corresponding stream
*/
func... | true |
a15e1fac68521b5c99448dcc8b260b702cb937d0 | JavaScript | jasonly/web-historian | /helpers/archive-helpers.js | UTF-8 | 1,377 | 2.515625 | 3 | [] | no_license | var fs = require('fs');
var path = require('path');
var _ = require('underscore');
var request = require('http-request');
exports.paths = {
'siteAssets' : path.join(__dirname, '../web/public'),
'archivedSites' : path.join(__dirname, '../archives/sites'),
'list' : path.join(__dirname, '../archives/sites.txt')
};
... | true |
243d7c6b18ee77a1edb3fb4bf50a5a68cc243121 | JavaScript | Davor25793/Hatch | /app.js | UTF-8 | 1,018 | 2.859375 | 3 | [] | no_license | const buttons = [...document.querySelectorAll('.btn-item')];
let divs = [...document.querySelectorAll('.img-item')]
const navLinks = document.querySelectorAll('.nav-link');
navLinks.forEach(function(el) {
el.addEventListener('click', function(e){
e.preventDefault();
const id = this.getAttribute('href');... | true |
bb965245623b2a6562ef77b5a7faebab1b82b27e | JavaScript | ProgrammerDwarf/brawlhalla-tribute | /assets/js/script.js | UTF-8 | 716 | 2.5625 | 3 | [] | no_license | var modal = $('#modal');
var close = $('.cerrar');
var logo = $('.logo')
$(function() {
$('.polaroid>img').click(function(){
var idImg = $(this).attr("id");
console.log(idImg);
var srcImg = $(this).attr("src");
console.log(srcImg);
showModal(idImg, srcImg);
});
hideM... | true |
367cdd38214b428a2b859a8fa7d9235983afbd82 | JavaScript | ryneschillinger/cruds-against-humanity | /index.js | UTF-8 | 1,155 | 2.6875 | 3 | [] | no_license | // REQUIRES
var express = require("express");
var bodyParser = require("body-parser");
var ejsLayouts = require("express-ejs-layouts");
// APP VARIABLES
var app = express();
var db = require("./models");
// SET/USE STATEMENTS
app.set("view engine", "ejs");
app.use(ejsLayouts);
app.use(bodyParser.urlencoded({extend... | true |
5f4dc5a3d75e408d651f6b46c343c1ba285a8c5e | JavaScript | RakibRahman/JavaScript | /this/call-method.js | UTF-8 | 849 | 3.234375 | 3 | [] | no_license | let message = {
type: "email",
to: "labib",
from: "pain",
email: {
type: "Electronic Mail",
subject: "study",
msg: function () {
console.log(`Message received as ${this.type}`);
},
},
};
message.email.msg();
message.email.msg.call(message);
console.log("---------------------");
var n... | true |
45b9fa59a6cdfd70d59343f6bd076b46812f8457 | JavaScript | rafaelferreiram/nodebr | /lists/for-forin/services/index.js | UTF-8 | 621 | 2.90625 | 3 | [] | no_license | const commander = require('commander');
const service = require('./service');
const Personagem = require('./personagem');
async function main(){
commander.version('V-1.0')
.option('-n, --nome [value]', "Nome para buscar")
.option('-b, --buscar ', "Buscar dados")
.parse(process.argv);
const personag... | true |
63ca8e280e8a90c47bd196a745e69ef35ccd9c84 | JavaScript | artalisa/skillmatrix | /src/redux/actions/test.js | UTF-8 | 581 | 2.578125 | 3 | [] | no_license | export default {
testAction: function(state) {
// here we take advantage of Redux-thunk; instead of returning an object describing an action,
// we return a function that takes dispatch and getState as arguments. This function can then
// invoke dispatch, now or later using setTimeout or sim... | true |
76b55fde5745134993d66736315fb90268b7d1d2 | JavaScript | snakesilk/snakesilk-engine | /src/__tests__/Math-test.js | UTF-8 | 3,875 | 2.8125 | 3 | [] | no_license | const expect = require('expect.js');
const {
applyRatio,
clamp,
circlesIntersect,
findRatio,
nextPowerOf,
rectanglesIntersect,
} = require('../Math');
describe('Math', () => {
describe('#applyRatio()', () => {
it('should return value for a ratio between two numbers', () => {
expect(applyRati... | true |
fed96853486c3f27e46016cdf6dc349d466c1cf2 | JavaScript | AntonioGranados/RestServer-NodeJs | /routes/usuarios.routes.js | UTF-8 | 1,748 | 2.59375 | 3 | [] | no_license | const { Router } = require('express');
const { check } = require('express-validator');
const { rolValido, emailExistente, existeUsuarioPorId } = require('../helpers/dbValidators');
const { getUsuarios,
postUsuarios,
putUsuarios,
deleteUsuarios } = require('../controllers/usuarios.controller')... | true |
62e4a00acc3b9362a27ecc33bcdbe4f64aba32fc | JavaScript | angelbeltran/angelbeltran.github.io | /src/components/Asteroids/reducer/keys.js | UTF-8 | 921 | 2.65625 | 3 | [] | no_license | import * as constants from '../constants'
import initialState from './initial-state'
export default function (state = initialState, action) {
switch (action.type) {
case constants.KEY_UP: {
if (action.key && state.keysPressed[action.key]) {
const keysPressed = { ...state.keysPressed };
del... | true |
aed758f0baf66070939b88d411f15e7975d05504 | JavaScript | benjaminsunderland/BankJS | /spec/AccountSpec.js | UTF-8 | 661 | 2.765625 | 3 | [] | no_license | var Account = require("../src/Account.js")
var Statement = require("../src/Statement.js")
'use strict';
describe('Account',function(){
var account;
beforeEach(function(){
statement = new Statement
account = new Account(statement);
});
it('is able for a user to deposit', function(){
account.deposit... | true |
1f8be4200b98c20266a929bd8ff31f376f7aafed | JavaScript | Hussamjh/Assignment2_mobileWeb | /js/index.js | UTF-8 | 945 | 2.828125 | 3 | [] | no_license | "use strict";
$(function() {
$.getJSON("cat_data/data/cat_data.json", displayCats);
});
function displayCats(data) {
let $table = $("<table></table>");
$table.appendTo("main");
let breeds = data.breeds;
console.log(breeds)
breeds.forEach(function (breed, index) {
$table.append(
... | true |
af585f0eaa9db79718b4eae19c98568e199e35db | JavaScript | ExecutionLLC/pfr | /blockchain-rest-service/utils/utils.js | UTF-8 | 1,041 | 2.546875 | 3 | [] | no_license | const web3 = require('web3');
const Utils = {
isValidAddress(address) {
return web3.utils.isAddress(address);
},
isValidPrivateKey(privateKey) {
const prefixLength = privateKey.substring(0, 2) === '0x' ? 2 : 0;
const keyDigits = privateKey.length - prefixLength;
return keyDi... | true |
cec10133c6b1c1dc8ac3e9ce8bb29960c90e8412 | JavaScript | Sharmaz/ListItem | /src/forms/components/add-item-form.js | UTF-8 | 597 | 2.703125 | 3 | [] | no_license | // Dependencias
import React from 'react';
import './item-form.css'
/**
* En este componente renderemos un formulario con un input text
* le pasamos como props la función que va manejar el submit
* hacemos una referencia para obtener el valor del input
*/
const AddItemForm = (props) => (
<form
className="a... | true |
17d8ee087a929ca67b31369c4a451b4b85432317 | JavaScript | johannaniemi/hiq | /car.js | UTF-8 | 1,336 | 3.140625 | 3 | [] | no_license | import { getInputDirection } from "./input.js"
export const CAR_SPEED = 3
const carBody = [{ x: 11, y: 11 }]
let newSegments = 0
//placerar ut bilen
export function update() {
addSegments()
const inputDirection = getInputDirection()
for (let i = carBody.length - 2; i >= 0; i--) {
carBody[i + 1... | true |
20c660702f3d649f0e9b9806b9fff6c9b8bd83ec | JavaScript | kungfucsiga/Facebook-Like-Count | /js/fb_like_count.js | UTF-8 | 564 | 2.640625 | 3 | [] | no_license |
$(document).ready(function() {
$("#likes_of_a_page_button").live('click',function() {
var pageURL = $("#likes_of_a_page").val();
$(".likebox").attr('title' , pageURL );
$('span.likebox').fblikecount();
})
$("#likes_of_a_fb_page_button").live('click',function() {
... | true |
95a9574f71fc547d30fe2d18ff4e178c2de95d12 | JavaScript | Hetystars/aws-doc-sdk-examples | /javascript/example_code_v3/s3/photoViewer/s3_PhotoViewer.js | UTF-8 | 5,178 | 2.6875 | 3 | [
"CC-BY-NC-SA-4.0",
"Apache-2.0"
] | permissive | /* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
ABOUT THIS NODE.JS EXAMPLE: This example works with Version 3 (V3) of the AWS SDK for JavaScript,
which is scheduled for release later in 2020. The prerelease version of the SDK is available
at https://github.com/... | true |
99216634293962225ef417e18b1aac862b389681 | JavaScript | tonysoft45/sgafuenteweb | /vistas/inspeccion_deta.vista.js | UTF-8 | 4,578 | 2.515625 | 3 | [] | no_license | // ----------------------------------------------------------------------------------
// packinglist_deta.vista.js
// ----------------------------------------------------------------------------------
// Autor. Ing. Antonio Barajas del Castillo
// ------------------------------------------------------------------------... | true |
ca5b51fa53a15e48701551f9cf0705615fbedc54 | JavaScript | Hong-by/Renewal-Tesla | /js/slide.js | UTF-8 | 2,961 | 2.96875 | 3 | [] | no_license | // 슬라이드 이미지 변수 저장
const slide = document.querySelectorAll('.slideBox');
// 각 버튼 및 변경 항목 저장 저장
const prev = document.querySelector('.prev');
const next = document.querySelector('.next');
const dots = document.querySelectorAll('.dot');
const contxt = document.querySelectorAll('.slideTxt_body');
// 슬라이드 초기 값 설정
let clic... | true |
8d69b382147292e7e70991cd22f9f204db6c1477 | JavaScript | parthahluwalia/CCIS_SPACE | /public/modules/booking/services/booking.client.service.js | UTF-8 | 5,615 | 2.84375 | 3 | [] | no_license | 'use strict';
// Service that provides helper functions for Space Controller
angular
.module('booking')
.factory('BookingService', ['$http', '$q', 'lodash',
function ($http, $q, _) {
// Provide service functions as closure
return {
getBookings: getBookings,
... | true |
747a36ee67fbbda02e4eff29d5df2a1997f057ca | JavaScript | Skylice/Dinomlg | /dinomlg.js | UTF-8 | 2,119 | 2.84375 | 3 | [] | no_license | var btn = document.createElement("BUTTON");
btn.setAttribute("id","mlgb");
var t = document.createTextNode("GOTTA GO FAST M8");
btn.appendChild(t);
btn.onclick = function(){
stopint = setInterval(function(){Runner.instance_.setSpeed(0.0000000001)},1);
var ssheet = document.createElement('style');
ssheet.inner... | true |
a9f567efb3d8c1f52b12fddcd67832817a21d8a4 | JavaScript | MarksASP95/vistas_umakeit | /js/compras.js | UTF-8 | 733 | 2.734375 | 3 | [] | no_license | $(document).on('click', '#history tbody tr', function(){
let row = $(this).children('td');
let list = row.children('td ul');
let checkHtmlStr = "<input type=\"checkbox\" checked></input>"
let table = $("<table class=\"table\"><thead><th>Producto</th><th>Mantener</th></thead></table>");
let tbody ... | true |
690e0b68c15e3517342d06f26093b1733635baf6 | JavaScript | hashimkhanzada/Nutritional_Software | /D301 Web_App/wwwroot/js/calculator.js | UTF-8 | 7,530 | 3.015625 | 3 | [] | no_license |
var currentTdee = document.getElementById("tdee").innerHTML;
var updatedTdee = document.getElementById("adjusted_tdee");
var carbGoal = document.getElementById("carb_goal");
var proteinGoal = document.getElementById("protein_goal");
var fatGoal = document.getElementById("fat_goal");
var sfaGoal = document.getElement... | true |
977bb87ff9fe3171fa22f017529b211165b2e279 | JavaScript | tygrski/weatherDashboard | /assets/script.js | UTF-8 | 6,161 | 3.703125 | 4 | [] | no_license | //Empty array to store cities searched by the user
var cities = [];
// set from local storage
function setStorage (cities) {
localStorage.setItem("citiesLocalStorage", JSON.stringify(cities));
}
renderLastSearch();
// get from local storage
function getCities() {
// Parsing the JSON string to an object
var st... | true |
ff42495cd0233298189228b67e4772f81b2598a5 | JavaScript | TJBIII/exercismio | /javascript/strain/strain.js | UTF-8 | 491 | 3.0625 | 3 | [] | no_license | "use strict";
let Strain = {
keep: strainKeep,
discard: strainDiscard
};
function strainKeep (arr, f) {
if ( arr.length ) {
return arr.filter(f);
}
return new Array();
}
function strainDiscard (arr, f) {
if (arr.length) {
let filtered = arr.filter(f);
let discard = [];
for (let i in ... | true |
cf0b212fa3dc880f4e08f6e19b470e625d505d78 | JavaScript | sprour/dreamforce2014 | /public/javascripts/app.js | UTF-8 | 2,034 | 2.6875 | 3 | [
"MIT"
] | permissive | L.mapbox.accessToken = window.mapboxAccessToken;
var geocoder = L.mapbox.geocoder('mapbox.places-v1'),
mapboxTiles = L.tileLayer('https://{s}.tiles.mapbox.com/v3/' + window.mapboxMapId + '/{z}/{x}/{y}.png'),
map = L.map('map').addLayer(mapboxTiles);
function displayMap(zoom) {
return function (err, data) {
... | true |
40fa2ae98d88469ec40fca80e8f5105e04c65970 | JavaScript | uulwake/fancy-todo-1 | /server/controllers/TodoController.js | UTF-8 | 2,402 | 2.734375 | 3 | [] | no_license | const { Todo } = require('../models');
const axios = require('axios');
class TodoController {
// findAll
static findAll(req, res, next) {
let tmpTodos;
Todo.findAll({
where: { UserId: req.currentUserId },
order: [['id', 'ASC']]
})
.then(todos => {
// axios
tmpTodos = t... | true |
5a42b113a6ab89acabe27940e26c6a3e0fd84ac7 | JavaScript | anahigo/Trybe_Exercise_Front-End_React_Redux_Hooks | /16_03/Class/exercicio_group/src/Form.js | UTF-8 | 3,466 | 2.703125 | 3 | [] | no_license | import React from 'react'
import { connect } from 'react-redux';
import { addAssignment } from './actions';
const states = ['Selecione seu estado', 'AC', 'AL', 'AM', 'AP', 'BA', 'CE', 'DF', 'ES', 'GO', 'MA', 'MG', 'MS', 'MT', 'PA', 'PB', 'PE', 'PI', 'PR', 'RJ', 'RN', 'RO', 'RR', 'RS', 'SC', 'SE', 'SP', 'TO']
class Fo... | true |
dc4f48e3c8bd02f2d2e7a092013e67f8034d1ac6 | JavaScript | XingMXTeam/algorithm | /001Array/searchInRoatedArr-mxx.js | UTF-8 | 1,286 | 3.59375 | 4 | [
"MIT"
] | permissive | /**
* @param {number[]} nums
* @param {number} target
* @return {number}
*/
var search = function(nums, target) {
// 折半,然后在已排好序的数组里找目标值,另一半继续折半,在已排好序的数组里找
var searchInArr = function(arr, start, end, ta) {
if(start>end) return -1;
var mid = Math.floor((end+start)/2);
if(arr[mid]<ta) {... | true |
04ca4acce702b4c9cb00a77f5722fceda10cf1c6 | JavaScript | fergusean/vue-stash-nested | /src/store-accessor.js | UTF-8 | 873 | 2.59375 | 3 | [
"MIT"
] | permissive | export default function(key) {
return {
get() {
let path = key.split('.');
return path.reduce((pValue, cValue) => {
return pValue[cValue];
}, getOwnerStore(this, path[0]));
},
set(value) {
let path = key.split('.');
... | true |
ab8c2fb122d29ce8a99e01a3e08562340dd8f90c | JavaScript | A-Kyma/Bk | /lib/modules/customFields/customs/DateTimeExtension.js | UTF-8 | 914 | 2.59375 | 3 | [] | no_license | import DateTime from "../classes/DateTime";
import I18n from "../../../classes/i18n";
// Only for I18n functions
DateTime.relative = function(value) {
let now = new Date()
let diffTime = Math.abs(now - value);
let diffDays = Math.round(diffTime / (1000 * 60 * 60 * 24));
return I18n.get('Date.format.relative.d... | true |
d872e00a4bcd24c27fc2773f5b9b19219ee7340d | JavaScript | deepaksuthar/faceword | /src/image-processor.js | UTF-8 | 3,700 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | FaceWord.ImageProcessor = (function (FaceWord) {
var image,
ctx,
settings;
function init () {
image = {};
ctx = FaceWord.getCanvasContext();
settings = FaceWord.getSettings();
}
function process (img) {
var contrastRatio = settings.contrast,
contrastFactor = (259 * ... | true |
10cbc5ee707af15330a735abf0718d862776c2d5 | JavaScript | beckan/webpack-cleanup-plugin | /src/index.js | UTF-8 | 1,659 | 2.6875 | 3 | [
"MIT"
] | permissive | /**
* webpack-cleanup-plugin
* ---
*/
import fs from 'fs';
import path from 'path';
import chalk from 'chalk';
class CleanupPlugin {
/**
* Constructor, get options
* @param {[Object]} options [User options]
*/
constructor (options = {}) {
this.pluginName = 'CleanupWebpackPlugin';
this.options = option... | true |
54ba7c3ca7e445b3955be379a9ac42ade36d1040 | JavaScript | sidhlee/juno-course-notes | /winter-js-3/day11/this-practice.js | UTF-8 | 662 | 3.515625 | 4 | [] | no_license | const warrior = {
equipmentL: 'shield',
energy: 100,
location: {
x: 0,
y: 0,
},
walk(dx, dy) {
const { x, y } = warrior.location;
warrior.location = {
x: x + dx,
y: y + dy,
};
},
strike(damage) {
warrior.energy = warrior.energy - damage;
},
switchEquipment(newEquip)... | true |
9ed875152a9c12d678cc07e304d9756770ea8d6b | JavaScript | davidrochin/sae-ingles | /public/js/ocultar.js | UTF-8 | 414 | 2.5625 | 3 | [
"MIT"
] | permissive | jQuery(document).ready(function(){
$(".oculto").hide();
$(".inf").click(function(){
var nodo = $(this).attr("href");
if ($(nodo).is(":visible")){
$(nodo).hide();
return false;
}else{
$(".oculto").hide("slow"); ... | true |
937451c5c92113fe07277fa81e56f1952af5092d | JavaScript | gen8787/FSDI-103 | /103_proj/script.js | UTF-8 | 1,478 | 3.640625 | 4 | [] | no_license | let numberOfChildren = 1,
partnerName = "Woman",
geoLoc = "Las Vegas",
jobTitle = "Guide";
console.log("Your Fortune:\n\nYou will be a " + jobTitle + " in " + geoLoc + " and married to " + partnerName + " with " + numberOfChildren + " kids.");
console.log("\nYour Fortune:");
console.log(`You will be a ${j... | true |
dd758605323135349818db526f18600feeaa1a22 | JavaScript | markt5660/loc8r | /app_client/common/filters/formatDistance.filter.js | UTF-8 | 991 | 3.328125 | 3 | [] | no_license | (function () {
angular
.module('loc8rApp')
.filter('formatDistance', formatDistance);
/** (Private) Helper function to verify a value is a number */
var _isNumeric = function (n) {
return !isNaN(parseFloat(n)) && isFinite(n);
};
/** Filter to reformat distance to convenient, human-readable form.
** NOTE: Thi... | true |
7c5c9c66cd445b0f3a8cf0e6018ac725b46fbab0 | JavaScript | yraviraj/Mywork | /employees expressJS Final/public/update_employe.js | UTF-8 | 3,323 | 3.375 | 3 | [] | no_license | function updateName() {
//dynamic updating name in emp details box
let updateName = document.getElementById("emp-name"); //dynamically updating.
updateName.onkeydown = updateNameDisplay; //https://stackoverflow.com/questions/4790946/dynamically-displaying-input-values-using-javascript
updateName.onk... | true |
50fa5137462b8d2f2621c24d86c0de101252301e | JavaScript | AsterDecember/ApiRestLuuna | /routes/users.js | UTF-8 | 1,258 | 2.546875 | 3 | [] | no_license | let express = require('express')
let router = express.Router()
const User = require('../models/User')
const {getDbObject} = require('../middleware/getDbObject.js')
router.get('/', async (req, res) => {
try {
const users = await User.find()
res.status(200).json(users)
} catch (err) {
res.status(500).jso... | true |