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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
5e5dc01a56bab3698f65b12dbbefe72b538b36d4 | JavaScript | littleball-games/lb-f | /lib/merge.test.js | UTF-8 | 742 | 2.703125 | 3 | [
"MIT"
] | permissive | const load = require('@std/esm')(module)
const test = require('ava')
const merge = load('./merge.mjs').default
test('curry', t => {
let a = {
aNumber: 'one'
}
let b = {
aLetter: 'B'
}
const result = merge(a, b)
t.deepEqual(
result,
{
aNumber: 'one',
aLetter: 'B'
},
'S... | true |
d1592d810b3e9eb06587328efff14e39f1973658 | JavaScript | kbabacheva/Software-University | /Lvl-2/JS-Apps2014/UnderscoreJS/_2_BookStore.js | UTF-8 | 2,466 | 3.625 | 4 | [] | no_license | // Problem 2. Book Store
// You are given an array of books. Using Underscore.js, perform the following operations:
// • Group all books by language and sort them by author (if two books have the same author, sort by price)
// • Get the average book price for each author
// • Get all books in English or German, with pr... | true |
f26deb0b5f70578bdee99fbeac264f357fedf9d7 | JavaScript | usmanasif/wExtensions | /js-functions/trimChar/trimChar.js | UTF-8 | 269 | 2.984375 | 3 | [
"MIT"
] | permissive | if(!String.prototype.trimChar) {
String.prototype.trimChar = trimChar = function(c) {
if (!c || c === ' ') { c = '\\s'; }
else if (c.match(/[\$\+\(\)\+\.\*\^\?\\]/)) { c = '\\' + c; }
return this.replace(new RegExp('^' + c + '+|' + c + '+$', 'g'), "");
};
}
| true |
9464d1c608b58660182f92a523a489b9415d8ad8 | JavaScript | metig/MyHomepage | /javascriptPractice/arrayReduce.js | UTF-8 | 184 | 3.53125 | 4 | [] | no_license | let arr =[1,2,3,4];
let sum = arr.reduce(function (a, b){
return a + b;
});
let multiply = arr.reduce(function (a, b){
return a* b;
});
console.log(sum);
console.log(multiply) | true |
d68ecbb2bb4a36304f0a18413eb654ef438bc061 | JavaScript | KentenRoth/Weather-App | /geocode/geocode.js | UTF-8 | 1,001 | 2.578125 | 3 | [] | no_license | const request = require('request')
const API_KEYS = require('./../../../API_KEYS/API_KEYS')
const mapquest_key = API_KEYS.mapquest_key
// Need to us input to find lat and lng of address
// Need to encode address so it can be read by the browser
const mapquestAddress = (address, callback) => {
const encodedAddre... | true |
9d21f031e3b5d31d95d4cb5edd0f62944167c321 | JavaScript | keymastervn/ReactOnRailsCoronaPhotocopyScubaParachute | /app/javascript/bundles/Guide/components/ShowGuide.jsx | UTF-8 | 4,001 | 2.734375 | 3 | [] | no_license | import PropTypes from 'prop-types';
import React from 'react';
import StarRatings from 'react-star-ratings';
class ShowGuide extends React.Component {
constructor(props, context) {
super(props, context)
this.state = {
comment: '',
rating: 0
};
this.handleReviewChange = this.handleReview... | true |
895c1b79a8309da1dd4227160db3d4fabafa9af4 | JavaScript | SarahVanDenBerghe/int4-back-to-your-roots | /web/www/src/models/AncestorModel.test.js | UTF-8 | 1,729 | 2.8125 | 3 | [] | no_license | import Ancestor from './AncestorModel';
import RootStore from '../stores';
test('Create a new ancestor', () => {
const store = new RootStore();
const ancestor = new Ancestor({ name: 'Test', store: store.ancestorStore });
expect(ancestor.name).toBe('Test');
});
test("Can't create a ancestor without a store", () ... | true |
da415c3bfb02d2ca09cae6a20e1ea570f6f633e2 | JavaScript | qhdong/sensor-server | /util/initdb.js | UTF-8 | 1,024 | 2.75 | 3 | [] | no_license | // 初始化并生成按照指定的方式生成PIN码,存储到数据库
// 使用方式:
// npm run initdb -- N K
// N: 多少个PIN码
// K: 每个PIN码多少位
// 例如: npm run initdb -- 50 4
const pin = require('./pinGenerator');
const MongoClient = require('mongodb').MongoClient;
const assert = require('assert');
const config = require('../config/config');
var N = 50;
var K = 4;
if... | true |
96fb4e981e017a8fae17be5f33c1705e940068db | JavaScript | lorranyhengles/scripts | /script.js | UTF-8 | 1,722 | 3.609375 | 4 | [] | no_license | function somar(a, b) {
return Number(a + b)
}
// console.log(somar(5,8))
function fazerEscada(material, degraus) {
let escada = material;
for (let i = 0; i < degraus; i++) {
console.log(escada);
escada += material;
}
}
function parOuImpar(a) {
if (a % 2 == 0) {
return 'é par... | true |
6e40cc02f00215a8b4338b018676f4a896cdecd5 | JavaScript | Ale-coder-zz/exercicios-js | /objeto/CriandoObj.js | UTF-8 | 1,054 | 4.25 | 4 | [] | no_license | // notacao literal
const obj1 = {}
console.log(obj1)
// Object em Js
console.log(typeof Object, typeof new Object)
const obj2 = new Object
console.log(obj2)
// Funçoes construtoras
function produto(nome, preco, desconto ){
this.nome = nome
this.getPrecoComDesconto = () => {
return preco * (1 - desconto)
}
}
... | true |
1921c6aaaacffd27fa2dfe189b2348585863a6c2 | JavaScript | node9909/exchatter | /src/time_of_day_export.js | UTF-8 | 2,099 | 2.78125 | 3 | [
"MIT"
] | permissive | var Contraction = require('./classes/Contraction.js'),
PatternHelper = require('./classes/PatternHelper.js'),
Normalizer = require('./classes/Normalizer'),
MessageObjectGenerator = require('./classes/MessageObjectGenerator'),
Helpers = require('./classes/Helpers'),
WordPOS = require('wordpos'),
_ = require('underscore'... | true |
0ec555f0f83c9e64c249847c34ec887864d8676f | JavaScript | vivek-nutcrackerz/react-themed-player | /src/utils.js | UTF-8 | 1,799 | 3.28125 | 3 | [
"MIT"
] | permissive | export const convertHexToRgbA = (hexVal, opacity) => {
var ret;
// If the hex value is valid.
if(/^#([A-Fa-f0-9]{3}){1,2}$/.test(hexVal)) {
// Getting the content after '#',
// eg. 'ffffff' in case of '#ffffff'
ret = hexVal.slice(1);
// Splitting each characte... | true |
87fe4aa6402a1c9fc050b8950fd227a1429f49c9 | JavaScript | scareaphina/JavaScript_practice | /Exercises/Challenge1.js | UTF-8 | 1,933 | 4.46875 | 4 | [] | no_license | /**********************
* CODING CHALLENGE 1
*/
/*
Mark and John are trying to compare their BMI (Body Mass Index), which is calculated using the formpula: BMI = mass / height^2 = mass / (height * height). (mass in kg and height in meters).
1. Store Mark and John's mass and height in variables
2. Calculate both... | true |
820ad9ecb9172116390a9a0f45b65b4386ffb60f | JavaScript | joaoelvas/Modelling-Demo-Web-GL | /modelling_demo.js | UTF-8 | 7,218 | 2.890625 | 3 | [] | no_license | // This is an Academic Project, and was published after finishing the lecture.
// @author Joao Elvas @ FCT/UNL
// @author Rodolfo Simoes @ FCT/UNL
var gl;
var canvas;
// GLSL programs
var program;
// Render Mode
var WIREFRAME=1;
var FILLED=2;
var renderMode = WIREFRAME;
var projection;
var modelView;
var view;
va... | true |
224363f3fa49a65b6c201e9d6189e1fba07c4d66 | JavaScript | EvilNine/widgets | /src/js/script.js | UTF-8 | 12,202 | 2.546875 | 3 | [] | no_license | 'use strict';
(function(){
class Widget {
constructor(options) {
this.frozenPrice = options.frozenPrice;
this.lastorder = options.lastorder;
this.inStock = options.inStock;
this.onlineVisitors = options.onlineVisitors;
this.todayVisitors = options.todayVisitors;
this.buyVisitors = options.buyVis... | true |
7be1e0102634475bf57df497460552361a699cf7 | JavaScript | tyelford/ninja_co | /javascript/windowSizes.js | UTF-8 | 2,090 | 3.25 | 3 | [] | no_license |
//Function to get the width of the viewport
function getScreenWidth(){
return Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
}
//Function to get the height of the viewport
function getScreenHeight(){
return Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
}
funct... | true |
d9a71ec01734066c61b3f27b31cdb0e78d58ca33 | JavaScript | Fonsciacob/CODERHOUSE | /Consigna-9(GENERAR HTML)/functions/vistaAutos.js | UTF-8 | 542 | 2.953125 | 3 | [] | no_license | //Carga los datos ingresados
const loadTable = () => {
let i = 0;
let viewTable = "";
viewTable += "<tr>";
automoviles.forEach(
(item) =>
(viewTable +=
"<tr>" +
`<th>${(i += 1)}</th>` +
`<td>${item.marca}</td>` +
`<td>${item.tipo}</td>` +
`<td>${item.fabricacio... | true |
49a5538dfc3e8ca136a8a4c1dd1b3d69bcec79cd | JavaScript | miloskince/forum-app | /src/components/register.jsx | UTF-8 | 2,022 | 2.6875 | 3 | [] | no_license | import React, { useState } from "react";
import { register } from "../utilities/services";
const Register = ({setUser, history}) => {
const [name, setName] = useState('')
const [surname, setSurname] = useState('')
const [username, setUsername] = useState('')
const [email, setEmail] = useState('')
... | true |
c6fbc5a2c9f93460d9be42d09749d8451d643647 | JavaScript | q15035395423/sugouapp | /js/index.js | UTF-8 | 1,296 | 2.6875 | 3 | [] | no_license | $(function(){
////////////////////////////////轮播图/////////////////////////////////////////////
let dian = $('.dian > li');
let box = $('.img-box');
let banna = document.querySelector('.banna');
box[0].innerHTML += box[0].innerHTML;
let img = $('.img-box > a');
box[0].style.width = img.length * img.width() + '... | true |
a4aa0b8bb10de321b89d3f1af553dacaa52504e9 | JavaScript | tobiah-Tan/loginDemo | /login/src/components/Flash/store/reducer.js | UTF-8 | 576 | 2.59375 | 3 | [] | no_license |
import * as actionTypes from './actionTypes';
// eslint-disable-next-line import/no-anonymous-default-export
export default(state=[],action)=>{
switch(action.type){
case actionTypes.ADD_FLASH:
return [
...state,
action.payload
];
case actionT... | true |
84480707454e1965ed4aae7c4a0cbecac1713b3a | JavaScript | malcomio/presentations | /csss/malcomio/malcomio.js | UTF-8 | 662 | 2.78125 | 3 | [
"MIT"
] | permissive |
function $(expr, con) { return typeof expr === 'string'? (con || document).querySelector(expr) : expr; }
function $$(expr, con) { return [].slice.call((con || document).querySelectorAll(expr)); }
(function(head, body, html){
var allLinks = $$('a', body);
allLinks.forEach(function(element) {
// open all lin... | true |
09a2322ad3cb569bd68702b40ff46a62f48a904d | JavaScript | frame-creator/javascript_coding_test | /number_string.js | UTF-8 | 486 | 3.59375 | 4 | [] | no_license | function solution(n) {
let answer = 0;
let temp = String(n).split('');
let arr = [];
for (let x of temp) arr.push(Number(x));
arr.sort((a,b) => b - a);
let a = arr.join('');
console.log(a)
return Number(a);
}
function solution(n) {
let answer = 0;
let temp = String(n).split('');... | true |
36edf42591cf42a31d8b82f6e729bb9adbdc3ccf | JavaScript | jaredshane/reddit-clone | /app/controllers/login.js | UTF-8 | 2,110 | 2.53125 | 3 | [
"MIT"
] | permissive | app.controller('LoginCtrl', function ($scope, authFactory, $location) {
console.log('hey, this is the LoginCtrl')
$scope.loginButton = function (e, p) {
var email = e
var password = p
authFactory.login(email, password)
.then(()=>{
$location.url("/")
})
} //end of $scope.loginButton
... | true |
10a36384c4efd8c46ac1fd0cc8b3ff45a841c63a | JavaScript | Transcranial-Solutions/iconpreps-react | /src/utils/sanitizeInput.js | UTF-8 | 336 | 2.65625 | 3 | [
"MIT"
] | permissive | const HTML_CHARACTERS_MAP = {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
'`': '`',
"'": ''',
'/': '/',
};
const REGEXP = /[&<>"'/]/gi;
export function sanitizeInput(string) {
return string
.replace(REGEXP, match => HTML_CHARACTERS_MAP[match])
.replace(/(?:\r\n|\r|\n... | true |
8980ec933041c1c84deb1211dac06e4793353b63 | JavaScript | MilindPen/Mastek-Collection-App---Agile | /sdt/MobileApp/sdt_mobile/platforms/ios/www/js/dashboard.js | UTF-8 | 4,384 | 2.671875 | 3 | [] | no_license | var dashboard = {
/***************************************mapping the day with date of the current week************************************************/
mapDateDay: function(){
//determining todays day and date
var todaysDay = Date.today().getDayName();
dataStorage.setData(TODAYS_DAY,today... | true |
28585a31e86976d8db21cee4c4cfc6a4c53eb952 | JavaScript | CountyGovernment/document_management_system | /server/controllers/users.js | UTF-8 | 4,811 | 2.578125 | 3 | [
"MIT"
] | permissive | const { User } = require('../models');
const { Document } = require('../models');
const jwt = require('jsonwebtoken');
const bcrypt = require('bcrypt');
const secretKey = 'yellow';
const salt = 7;
/* Defines Document Controller methods */
class UserController {
/**
* create method
* Creates a user
* ... | true |
944d106a1dae22bbe3776d930ed004da5e73eeb4 | JavaScript | Asduveneck/AA_Classwork | /W08D3/JS_exercises/skeleton/phase_1_arrays.js | UTF-8 | 1,600 | 3.734375 | 4 | [] | no_license | let arr = [1, 2, 3, 2, 3, 4, 5, 4, 7, 5];
let arr2 = [ 1, 3, -2, -3, 3, 2, -1, 1, 2, 4 ];
let matrix = [
[11, 12, 13],
[21, 22, 23],
[31, 32, 33]
];
// function uniq_arr(arr){
// let new_arr = [];
// arr.forEach(num => {
// if(!new_arr.includes(num)) {
// new_arr.push(num);
// }
// });
// re... | true |
e64ae374593672b99b0cffa6d955e71d5de8c4c4 | JavaScript | awesomerex/LD37 | /src/systems/updatePositionFromGamepad.js | UTF-8 | 2,219 | 2.625 | 3 | [] | no_license | var gamepads = require("html5-gamepad");
module.exports = function(entities) {
return function updatePositionFromGamepad(entities, elapsed) {
navigator.getGamepads(); // fix for chrome
var ids = entities.find("gamepad");
for (var i = 0; i < ids.length; i++) {
var position = entities.getComponent(id... | true |
43ed6f2e465e836df237db44b28ed17fbacb6f52 | JavaScript | disha-11/github | /sketch.js | UTF-8 | 745 | 2.96875 | 3 | [] | no_license | var ballimg,paddleimg;
function preload() {
ballimg=loadImage("ball.png");
paddleimg=loadImage("paddle.png");
}
function setup() {
createCanvas(400, 400);
ball=createSprite(200,200,10,10);
ball.addImage("ball",ballimg);
paddle=createSprite(350,200,10,10);
paddle.addImage("paddle",paddleimg);
ball.velocityX... | true |
8cc421c2aa734d3925d2d22efc901b04c0cc7836 | JavaScript | nicolaivasquez/weather-react-app | /src/reducer.js | UTF-8 | 632 | 2.578125 | 3 | [] | no_license | import {SET_LOADING_SCREEN, SET_WEATHER_DATA} from './actions';
const initialState = {
loading: false,
show: false,
weather: {
current: {},
fiveDay: {},
sixteenDay: {},
}
}
const weatherApp = (state = initialState, action) => {
switch(action.type) {
case SET_WEATHER_DATA:
return {
... | true |
ff161012aa46e35c571c296870a91a9602931f78 | JavaScript | LYL98/nyx | /utils/util.js | UTF-8 | 9,252 | 3.5 | 4 | [] | no_license | const formatTime = date => {
const year = date.getFullYear()
const month = date.getMonth() + 1
const day = date.getDate()
const hour = date.getHours()
const minute = date.getMinutes()
const second = date.getSeconds()
return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map... | true |
fd87c6e94b327ea18fb66134ba337b5dd21ecda0 | JavaScript | eliapasqualini/Gotta-Shop-Em-All-Pasqualini-Poggi-Konchenkov | /backend/shopping_cart/src/controllers/shopping_cartController.js | UTF-8 | 11,548 | 2.609375 | 3 | [] | no_license | const jwt = require("jsonwebtoken");
const ShoppingCart = require("../models/shopping_cart_model.js");
exports.addToShoppingCart = function(req, res) {
if (req.signedCookies.jwt != null) {
const token = req.signedCookies.jwt;
try {
var decodedPayload = jwt.verify(token, process.env.SECRET_KEY);
... | true |
9f16c9e94ac691e751ae7dc734082f2b75737c63 | JavaScript | Dimasta123/hw7 | /js/main.js | UTF-8 | 1,291 | 3.25 | 3 | [] | no_license | const ukraine = {tax: 0.195, middleSalary: 1789, vacancies: 11476};
const latvia = {tax: 0.25, middleSalary: 1586, vacancies: 3921};
const litva = {tax: 0.15, middleSalary: 1509, vacancies: 1114};
function getTaxes(salary) {
return +(this.tax * salary).toFixed(2);
}
console.log(
`На Украине ты заплатишь ст... | true |
f9687e92f30774bafc4da327eb30d43598508085 | JavaScript | Lidemy/mentor-program-5th-iris1020 | /homeworks/week7/hw3/index.js | UTF-8 | 1,315 | 3.453125 | 3 | [] | no_license | document.querySelector(".btn-new").addEventListener("click", () =>
{
const value = document.querySelector(".input-todo").value;
if (!value) return
const div = document.createElement("div")
div.classList.add("todo")
div.innerHTML =
`
<input class="todo__check" type="checkbox" />
<div class="todo__title">$... | true |
2fe167e9b363065436182a7fa01a0aa6164c3592 | JavaScript | DcguentherATX/databases | /server/models/index.js | UTF-8 | 847 | 2.546875 | 3 | [] | no_license | var db = require('../db');
module.exports = {
messages: {
get: function () {}, // a function which produces all the messages
post: function (obj) {
var sql = `INSERT INTO messages (tweet,sender,chatroom_id) values (${obj.message}, ${obj.userid}, ${obj.roomid})`;
db.query(sql, (err,result) => {
... | true |
7c052c29822211a73cde751ba24023d50e875f9c | JavaScript | justjewel/2048 | /js/main.js | UTF-8 | 3,667 | 2.59375 | 3 | [] | no_license | import BackGround from './runtime/background.js'
import GameManager from './runtime/gamemanager.js'
import Logo from './runtime/logo.js'
import Scores from './runtime/scores.js'
let ctx = canvas.getContext('2d')
const width = window.innerWidth
const height = window.innerHeight
const ratio = 1
const W = width * 0.8
/... | true |
8b3b8d1e1e1a2cda2d1725aca8913f5813854d1a | JavaScript | yshjft/jwt_auth | /routes/auth.js | UTF-8 | 3,457 | 2.609375 | 3 | [] | no_license | const express = require('express')
const router= express.Router()
const {User, sequelize} = require('../models')
const bcrypt = require('bcryptjs')
const jwt = require("jsonwebtoken");
const redis = require('./utils/redis')
const getToken = require('./utils/jwt')
const {checkAccessToken} = require('./middlewares/authe... | true |
2580caff903a7ed7e95ce354263728f0b1094c5c | JavaScript | nickbolton/toro-portal | /libraries/portlets-common/src/main/resources/rendering/javascript/formValidation.js | UTF-8 | 9,529 | 2.671875 | 3 | [] | no_license | modValidate = function (formRef,isPassOnly)
{
var buttonpressRef = window.buttonpress;
var defaultButton;
if (window.buttonpress && window.buttonpress.value=="Cancel")
{
var defaultActionId = formRef.id+"_defaultAction";
var defaultActionRef = document.getElementById(defaultActionId);
... | true |
2ba5a8ac645dc96b095abeefa1c60347131ca0ce | JavaScript | manikanta222010/movie | /src/movies/EditMovie.js | UTF-8 | 5,414 | 2.6875 | 3 | [] | no_license | import { useState, useEffect } from "react";
import Button from '@mui/material/Button';
import TextField from '@mui/material/TextField';
import { useHistory, useParams } from "react-router-dom";
import { useFormik } from "formik"
export function EditMovie() {
const { id } = useParams()
const [movie, setMovies] ... | true |
eff2efb57131b5c4c63e4f347918663cf2bbbc67 | JavaScript | br-data/2016-tatort-twitter-analyse | /import.js | UTF-8 | 1,855 | 2.59375 | 3 | [
"MIT"
] | permissive | // Import JSON files to MongoDB
var fs = require('fs');
var mongoClient = require('mongodb').MongoClient;
var mongoUrl = 'mongodb://localhost:27017/tatort';
var collectionName = 'tweets';
(function init() {
loadFiles();
})();
function loadFiles() {
var files = [];
var normalizedPath = require('path').join(__... | true |
010b5f0d38e46df21ce6cbc1d5c060d3a741db70 | JavaScript | umairsadiq88/JS-Tasks | /callbacks.js | UTF-8 | 2,238 | 3.859375 | 4 | [] | no_license | // Callback
//Any function that is passed as an argument is called a callback
// A callback is a function that is to be executed after another function has finished executing - hence the name 'call back'.
// Example
// const funA = () => {
// setTimeout(function(){
// console.log('welcome FunA');
// },300... | true |
25e890cda07085dd3c62769a9a8872e5bf8cd4e3 | JavaScript | Kaiofprates/snippetsChrome | /instagramStalker.js | UTF-8 | 900 | 2.78125 | 3 | [] | no_license | // Kaio Prates 31/09/19
// Abra o perfil no instagram e clique no primeiro post
//pega o número de posts
var npost = document.getElementsByClassName(' _81NM2')
// promise para um time de 2 segundos entre cada curtida
var esperaUmTikim = () => new Promise((resolve,reject) =>{
setTimeout(() => {
resolve(... | true |
a245d16d9a0ba689ff30ca02e52b8cd9d65a7f99 | JavaScript | maximetouroute/museum-narrator | /src/pages/generativeArtwork/generativeArtwork.js | UTF-8 | 5,391 | 3.0625 | 3 | [] | no_license | import React, {Component} from 'react';
import {artworkColorPalettes} from "../../content/content";
import {SolidStateMemory} from "../../utils/SolidStateMemory";
const canvasWidth = 500;
const canvasHeight = 500;
const numberOfAreas = 4;
const areaWidth = canvasWidth / numberOfAreas;
const areaHeight = canvasHeight /... | true |
ee48e3405023c1968fd8bee9a1d961bb9064cdf3 | JavaScript | ZickTron/gidget | /src/commands/utility/avatar.js | UTF-8 | 1,506 | 2.71875 | 3 | [] | no_license | const Discord = require('discord.js');
module.exports = {
run: async (bot, message, args) => {
if (args[1] === 'server') {
if (message.channel.type !== 'dm') {
var avatar = message.guild.iconURL({ dynamic: true });
const embed = new Discord.MessageEmbed()
.setTitle('Server icon')
.s... | true |
f921716ed0eb8751c0fead02a3d14cb2f2fad766 | JavaScript | nimigeanu/turnkey-streaming-platform | /lambda/FinishedTranscoding/index.js | UTF-8 | 1,551 | 2.5625 | 3 | [] | no_license | var AWS = require("aws-sdk");
const dynamo = new AWS.DynamoDB.DocumentClient();
console.log("dynamo: " + dynamo)
exports.handler = function(event, context, callback) {
let jobId = event.detail.jobId;
console.log("jobId: " + jobId);
let status = event.detail.status;
var params = {
TableName : process.en... | true |
3a9f109076811f7ac0d450fbce6a73e4430a3177 | JavaScript | ChrisTorres47/cookbookProject3 | /client/src/utils/API.js | UTF-8 | 1,717 | 2.703125 | 3 | [] | no_license | import axios from "axios";
export default {
//------------FOR USER LOGIN------------------------------
// logs in user
login: function(loginInfo) {
return axios.post("/api/users/login", loginInfo);
},
// signs up user, then logs them in
signup: function(signupInfo) {
return axios.post("/api/users/s... | true |
0e0c6c82c34353906dbc2c8e8d2c56b8c5ab3a5b | JavaScript | mvrikxix-dev/Recipe-Finder | /src/App.js | UTF-8 | 1,876 | 3.09375 | 3 | [] | no_license | import React, {Component} from 'react';
import './App.css';
import Search from './Search';
import View from './View';
import axios from 'axios';
class App extends Component {
state = {
name : null
}
// When App.js is mounted on index.html, the API will be called and a parameter named 'search' will be passed... | true |
8599b0c7506c9acb3eba89091b6f35b59b4b4614 | JavaScript | niutski/sweepstakes | /routes/index.js | UTF-8 | 1,455 | 2.625 | 3 | [] | no_license | 'use strict'
const express = require('express');
const router = express.Router();
const _ = require('lodash');
const footballDataService = require('../services/footballDataService');
const pointService = require('../services/pointService');
const countrycodes = require("../services/countrycodes");
router.get('/teams... | true |
a753afe025337a5f7bb2288845671448a0337cf1 | JavaScript | lauriharpf/cocktails | /react-ui/src/Ingredients.js | UTF-8 | 2,110 | 2.5625 | 3 | [
"MIT"
] | permissive | import React, { useContext } from "react";
import { AmountAndUnit } from "./AmountAndUnit";
import UnitSelectionRow from "./Components/UnitSelectionRow";
import { FaPlusSquare } from "react-icons/fa";
import CocktailDatabase from "./CocktailDatabase";
import { DrinkListContext } from "./DrinkListProvider";
export cons... | true |
c632f253f1573a678e4b0d782b7576cbf1627d38 | JavaScript | ediezindell/js-cms | /src/js/cms_view_editable/EditableView.GridClass.js | UTF-8 | 2,094 | 2.75 | 3 | [
"MIT"
] | permissive |
EditableView.GridClass = (function() {
/* ---------- ---------- ---------- */
var c = function() {
this.init();
}
var p = c.prototype;
/* ---------- ---------- ---------- */
this.grid = [];
p.init = function () {
this.grid = [];
}
p.initRecords = function (_grid){
this.grid = _grid;
if(this... | true |
bbabbdc3aba561f32245a4f8f51ad79d7da2cb12 | JavaScript | sliminality/chrome-remote-css | /src/metadata/index.js | UTF-8 | 1,620 | 2.671875 | 3 | [] | no_license | // @flow @format
import CSS_PROPERTIES from './cssProperties';
type CSSPropertyData = Array<{
name: string,
longhands?: Array<string>,
svg?: boolean,
inherited?: boolean,
}>;
class CSSMetadata {
_allProperties: Set<string>;
_inherited: Set<string>;
_longhands: Map<string, Array<string>>;
constructor(... | true |
d73433371f9d8b0a68578fc763d9155c260656ee | JavaScript | Phil-CST-BCIT/comp1930_team15 | /html/Scripts/cart.js | UTF-8 | 4,717 | 3.484375 | 3 | [] | no_license | /* ideas:
1. Create an table for items in the cart page accessing the cookies.
get all the involved elements.
2. load tbody and checkbox.
3. add onchange listener for each created checkbox,+button&-button.
4. select all item function
5. delete the items in cookie data array then update the array.
*/
// pa... | true |
d6d1912abb4f0e86fd87bf3c32933ffb9eb04e44 | JavaScript | fshaikh/Algos | /Misc/meeting-rooms-ii.js | UTF-8 | 2,025 | 4.5625 | 5 | [] | no_license | /**
Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...] (si < ei),
find the minimum number of conference rooms required.
Example 1:
Input: [[0, 30],[5, 10],[15, 20]]
Output: 2
Example 2:
Input: [[7,10],[2,4]]
Output: 1
ALGO:
This is a really tricky question. Logic is as... | true |
8f63a2024a3388eff979315b531dab0a666dfe08 | JavaScript | turnerem/d3-practice | /src/TimeLine.js | UTF-8 | 3,359 | 2.65625 | 3 | [] | no_license | import React, { Component } from 'react';
// import * as api from './api'
import * as d3 from 'd3'
class TimeLine extends Component {
state = {
data: {
date: [2014, 2015, 2016, 2017],
value: [3, 4, 2, 6],
},
topic: []
}
componentDidMount = () => {
// api.getData('topics')
// .t... | true |
c3a24d82df0ad74febf457e7560bcef9000e5f65 | JavaScript | LiamKeene/SlideThis | /js/jquery.slidethis.js | UTF-8 | 3,414 | 3 | 3 | [
"MIT"
] | permissive | /* SlideThis
Copyright (c) 2013 Liam Keene
Available under the MIT License
*/
(function($) {
$.fn.slidethis = function(options) {
// Default settings
var settings = $.extend({
'auto': true, // Boolean: automatically animate slides (true)
'pager': true, // Boolean... | true |
ca7bc98e09f48fc94d5346dac67849788b0d7cc6 | JavaScript | lucasmarcelli/programming-test-we | /src/Stores/Movies.js | UTF-8 | 2,383 | 2.703125 | 3 | [] | no_license | import Store from './Store';
import Dispatcher from './Dispatcher';
class Movies extends Store {
// I find the singleton pattern useful for stores, as it prevents accidentally creating multiple instances and
// feels more react-y than exporting an instance.
static get_instance() {
if(!Movies.insta... | true |
e10d5c7d824b1c1731a78a55ddacaad398130307 | JavaScript | artClown/captainclownfox | /mushywind/js/contentOptimizer.js | UTF-8 | 4,162 | 2.78125 | 3 | [] | no_license | /* selective content library by art. requires jquery. */
// ? Selective Content Helper Function
// array builder for selective content
function scToArray(){
var $val = [];
$('.selectiveContent').each(function(){
var $this = $(this),
$attr = $this.attr('data-selective-content');
... | true |
41ae8c3c9d19e35015907eb4b6dd782e06af2e2f | JavaScript | annibessie/VR-klient-server | /NewProject/script.js | UTF-8 | 1,070 | 3.140625 | 3 | [] | no_license | function validatePass(){
var firstpass = document.forms["register"]["pass"].value;
var secondpass = document.forms["register"]["pass2"].value;
if(first != second) {
document.getElementById("register").pass.style.color = "red";
document.getElementById("register").pass2.style.color = "red";
document.getElementBy... | true |
27796a839924cf006676eb6fb1f3f1952308b6af | JavaScript | Dimitreee/osomgame_reborn | /src/index.js | UTF-8 | 479 | 2.640625 | 3 | [] | no_license | import {AppController} from './app/app.controller';
import {raw} from './utils/raw';
document.addEventListener("DOMContentLoaded", () => {
raw(window, 'requestAnimationFrame', 'cancelAnimationFrame');
Object.prototype.getName = function () {
let funcNameRegex = /function (.{1,})\(/;
let result... | true |
29029f0511a5c98e0de15c6cf04bb06cba2a372f | JavaScript | dltjdgus3843/CCProject3 | /WalkingontheIceAddition.js | UTF-8 | 1,015 | 2.796875 | 3 | [] | no_license | let rs = 0;
function setup() {
createCanvas(windowWidth, windowHeight);
}
function draw() {
background(80, 125, 150);
randomSeed(rs);
let x, y, r;
let delta = 100;
let iceC = map(mouseX, 0, windowWidth, 0, 55);
let sunLight = map(mouseY, 0, windowHeight, 0, 100);
for (y=0; y<w... | true |
a88864491b41080b3f0929e147a59ae720c0d2ea | JavaScript | boyan-ast/SoftUni | /JS Applications/02.AsynchronousProgramming-Lab/03.Gighub-Commits/app.js | UTF-8 | 1,170 | 3.171875 | 3 | [] | no_license | function loadCommits() {
let username = document.getElementById('username').value;
let repo = document.getElementById('repo').value;
let url = `https://api.github.com/repos/${username}/${repo}/commits`;
fetch(url)
.then(response => {
if (response.ok) {
return respon... | true |
96efdedfb1a7812e135ace6875dad6ed7defa5a7 | JavaScript | CametDean/todo-tdd-skool-19 | /Todolist.js | UTF-8 | 393 | 3.15625 | 3 | [] | no_license | const TodoList = class TodoList{
constructor(items) {
this.myItems = items
}
addNewItem(item) {
this.myItems.push(item)
}
deleteLastItem() {
this.myItems.pop()
}
renameItem(itemOldName, itemNewName) {
const index = this.myItems.indexOf(itemOldName)
... | true |
7a387258e2538ed069f0aa2e917552de6c037a45 | JavaScript | PetterRein/IT2810-Project4-Frontend | /components/DetailView.js | UTF-8 | 2,932 | 2.53125 | 3 | [] | no_license |
import React, {Component, useEffect, useState} from 'react';
import { API_KEY } from 'react-native-dotenv'
import { useStateValue } from '../store/Store';
import { withNavigation } from 'react-navigation';
import {
Text,
View,
FlatList,
StyleSheet,
Image,
TouchableHighlight
} from 'react-native';
import { But... | true |
8f4835644c7edb5ce6796a43b7c52e0fdc8e899f | JavaScript | mihangdezhou/a | /waterfall/js/indedx2.js | UTF-8 | 2,553 | 3.109375 | 3 | [] | no_license | class Waterfall{
constructor(){
this.box = document.querySelectorAll(".box");
this.cont = document.querySelector(".cont");
this.clientH = document.documentElement.clientHeight;
this.clientW = document.documentElement.clientWidth;
this.url = "http://localhost/waterf... | true |
03903648315750e1b0e20ccc8402cfa9c85cefdb | JavaScript | windwhinny/datapipeline-exercise | /src/SideBar.js | UTF-8 | 1,009 | 2.5625 | 3 | [] | no_license | import React, { Component } from 'react';
import Department from './Department';
export default class SideBar extends Component {
/**
* 清空
*/
clear() {
Object.keys(this.refs).forEach(ref => {
const elem = this.refs[ref];
elem.checkAll(false);
});
}
/**
* 渲染部门列表
* @param {Obje... | true |
802518c0cd1332da0934708b0f33aa0a7fb45c0d | JavaScript | fortil/game-of-drones | /client/src/reducers/users.js | UTF-8 | 662 | 2.5625 | 3 | [
"MIT"
] | permissive | import { CHECK_USER_STATUS_START, CHECK_USER_STATUS_SUCCESS, CHECK_USER_STATUS_FAILURE } from '../constants/actionTypes'
import initialState from './initialState'
export default function usersReducer(state = initialState().users, action) {
switch (action.type) {
case CHECK_USER_STATUS_START:
return {
... | true |
374b72d764ee27a05ee8265c2584cf83e7278d98 | JavaScript | AlexTsarenkov/AlexTsarenkov-module13 | /controllers/cards.js | UTF-8 | 1,431 | 2.53125 | 3 | [] | no_license | const Card = require('../model/card');
const {
ForbiddenError, NotFoundError,
} = require('../errors/errors');
const getCards = (req, res, next) => {
Card.find({})
.then((card) => res.send(card))
.catch(next);
};
const postCard = (req, res, next) => {
const { name, link } = req.body;
Card.create({ nam... | true |
0eb0e149532fc89f16e3594d8426a157485d6e7a | JavaScript | wilantury/escuelajs-reto-06 | /src/containers/App.jsx | UTF-8 | 608 | 2.6875 | 3 | [
"MIT"
] | permissive | import React, { useState, useEffect } from 'react';
import MapContainer from '../components/MapContainer';
import '../styles/containers/App.styl';
const API = 'http://localhost:3000/locations';
const App = () => {
const [location, setLocation] = useState([]);//maneja el estado: videos-es el nombre del estado, setV... | true |
ba1c7f943a3d7ca01e408d724a1e4cb156aa213c | JavaScript | BackupTheBerlios/openweb-cms-svn | /branches/v1/www/backend/deversoir.js | UTF-8 | 4,008 | 2.890625 | 3 | [] | no_license | <!--
// script JAVASCRIPT permettant de gerer un deversoir (deux SELECT et deux boutons AJOUTER, ENLEVER)
// le formulaire doit s'appeler frmSaisie
//-------------- deverse l'option selectionee du select1 vers le select2
function dvrMove( select1, select2)
{
var sel
var optsel
var newOpt
// on recupere l'index de l'o... | true |
8339c41cc3c7340d642fb17dca812d0159899dd0 | JavaScript | baredh821/team-fullhouse-project-1 | /project01/script.js | UTF-8 | 1,276 | 2.65625 | 3 | [] | no_license | // var searchbutton = $("#searchbar").val().trim()
var key = "bf3bbf0ea22e7e35ceaa37777ebf0b82"
var proxy = "https://chriscastle.com/proxy/index.php?:proxy:";
https://www.googleapis.com/civicinfo/v2/elections
function electionInfo(searchValue, searchValue1) {
console.log(searchValue)
var searchURL = "https://w... | true |
c4d7e950d89bc86019cc7c15cea25fa68b73fde5 | JavaScript | xionzhi/webnotes | /9_jquery/9.4/js/main.js | UTF-8 | 449 | 3.4375 | 3 | [] | no_license | // 获取元素内所有文本
var text = $('#a').text();
console.log('text:', text);
$('#a').text('FUCK YOU BITCH')
text: 哇哈哈
// 获取元素内所有内用
var html = $('#a').html();
console.log('html:', html);
$('#a').html('fuuuuuck');
html: <p>哇哈哈</p>
// 在元素最后追加
$('#a').append('<div>append</div>');
在元素最前追加
$('#a').prepend('<div>prepend</div>');
... | true |
670527443a53667c4a4ca71e76e1c5ba5ee5993c | JavaScript | reddy7760/ECOMMERCE-BACKEND | /app/controllers/categoryController.js | UTF-8 | 1,845 | 2.640625 | 3 | [] | no_license | const express = require('express');
const router = express.Router();//express middleware
// console.log(router);
const { ObjectID } = require('mongodb');
const { Category } = require('../models/category');
const validateId = (req,res,next) => {
let id = req.params.id;
if(!ObjectID.isValid(id)){
res.sen... | true |
188dea714dd14f245fadc0a14768705742e2ee5f | JavaScript | chibicode/hydrogen | /spec/code-manager-spec.js | UTF-8 | 1,676 | 2.578125 | 3 | [
"MIT"
] | permissive | "use babel";
import * as CM from "../lib/code-manager";
describe("CodeManager", () => {
let editor;
beforeEach(() => {
editor = atom.workspace.buildTextEditor();
});
describe("Convert line endings", () => {
it("should replace CRLF and CR with LF line endings", () => {
const string = "foo\nbar";... | true |
8b681b0c4e0eca7caef3fdec23ac2d1cf4a6b06d | JavaScript | esbenholk/spiced-projects | /projects/spotify/script0.js | UTF-8 | 4,835 | 2.71875 | 3 | [] | no_license | (function() {
Handlebars.templates = Handlebars.templates || {};
var templates = document.querySelectorAll(
'script[type="text/x-handlebars-template"]'
);
Array.prototype.slice.call(templates).forEach(function(script) {
Handlebars.templates[script.id] = Handlebars.compile(script.innerHTM... | true |
70c74ebe1ecf40386d8d1877f9b845735ca02828 | JavaScript | HimanshuP90/React-Redux-Basic | /src/components/fetch.js | UTF-8 | 570 | 2.671875 | 3 | [] | no_license | import {
fetchHotelBegin,
fetchHotelSuccess,
fetchHotelFailure
} from "./action";
export function fetchHotels(API_URL) {
return dispatch => {
dispatch(fetchHotelBegin());
return fetch(API_URL)
.then(handleErrors)
.then(res => res.json())
.then(json => {
dispatch(fetchHotelSucc... | true |
c567b5ea050b594c5759d59b7f722c51081ce572 | JavaScript | SashaLavrov/BaseCampProject | /BCMyProject/wwwroot/js/MyPageBoard.js | UTF-8 | 1,861 | 2.6875 | 3 | [] | no_license | boardName.oninput = function () {
if (boardName.length == 0 || boardName.value =="") {
AddBoard.disabled = true;
} else {
AddBoard.disabled = false;
};
};
AddBoard.addEventListener('click', function (e) {
let form = new FormData();
form.append('boardName', boardName.value);
fe... | true |
8bb93ae02ecc48f47b0dec6cb695f3fe04ec304d | JavaScript | J-Dev1991/AutoMarket | /src/Context.js | UTF-8 | 4,308 | 2.609375 | 3 | [] | no_license | import React, { Component } from 'react';
// import carItems from './Data'
import Client from './Contentful';
const CarContext = React.createContext();
class CarProvider extends Component {
state = {
allCars: [],
sortedCars: [],
featuredCars: [], // boolean in data.js
... | true |
b4edd76ef318263cb13a8b04e947e672bceda321 | JavaScript | quimgc/PHPThinkering | /versio2.js | UTF-8 | 961 | 3.171875 | 3 | [] | no_license | function versioAnterior(){
//moustache
/*
* NPM -> forma moderna -> eina inclosa en node.
* per instal·lar moustache: npm install moustache
*
* Amb entorn web
* */
console.log("Hello World versio 2");
//Wiki moustache
//variable preexistent, JS ja dóna aquest objecte.
//getElementBy... | true |
8385960dd1fd78b33a2447cc8e21184f3f98763b | JavaScript | lambert2015/asexample | /three.js/src/cameras/Camera.js | UTF-8 | 817 | 2.609375 | 3 | [] | no_license | /**
* @author mrdoob / http://mrdoob.com/
* @author mikael emtinger / http://gomo.se/
* @author WestLangley / http://github.com/WestLangley
*/
THREE.Camera = function() {
THREE.Object3D.call(this);
this.matrixWorldInverse = new THREE.Matrix4();
this.projectionMatrix = new THREE.Matrix4();
this.... | true |
38fc0ef6d3db9174188a57e26b077aca3cf1a13e | JavaScript | Dhirajtemkar/aribus-user-webiste | /src/components/Voting/left.js | UTF-8 | 3,732 | 2.5625 | 3 | [] | no_license | import React, {useState, useEffect} from 'react'
import Button from '@material-ui/core/Button';
import FavoriteIcon from '@material-ui/icons/Favorite';
import TextField from '@material-ui/core/TextField';
import SearchRoundedIcon from '@material-ui/icons/SearchRounded';
import { makeStyles } from '@material-ui/core/sty... | true |
29ca4a80e5279fad81964bfa31eb37f327290acb | JavaScript | alexhiles/EMNIST | /static/index.js | UTF-8 | 2,757 | 3.09375 | 3 | [
"MIT"
] | permissive | (function() {
var canvas = document.querySelector("#canvas");
var context = canvas.getContext("2d");
canvas.width = 280;
canvas.height = 280;
var loc = {x:0, y:0};
var prev = {x:0, y:0};
context.fillStyle = "white";
context.fillRect(0, 0, canvas.width, canvas.height);
context.color = "black";
context.lineWid... | true |
f66f860d886e1056796a71731f5554b5fa31af4f | JavaScript | vbence86/giftassistant-client | /src/js/helpers/Session.js | UTF-8 | 1,095 | 2.65625 | 3 | [
"MIT"
] | permissive | import Storage from './Storage';
import EventEmitter from 'es6-event-emitter';
const STORAGE_KEY = 'session';
let singleton;
class Session extends EventEmitter {
constructor() {
super();
this.session = {};
}
set(key, value) {
this.session[key] = value;
this.syncToLocalStorage();
this.trigg... | true |
88b43cf753e3dcbc44598859d4606e3fe588cb0b | JavaScript | iliam14/ex4 | /load.js | UTF-8 | 1,312 | 2.6875 | 3 | [] | no_license | /**
* Created by Ilia and Liad
*/
var miniExpress = require('./miniExpress.js');
var http = require('http');
var port = 8675;
var app = miniExpress();
console.log('mounting at '+__dirname+'\\www');
app.use('/', miniExpress.static(__dirname+'\\www'));
app.listen(port);
var net = require('net');
var MaxClients = 5;
... | true |
1b735e33edbd8f42853b512c73ce0a54903ca1bd | JavaScript | AndrewPomo/mini-apps-1 | /challenge_3/client/app.jsx | UTF-8 | 4,066 | 3.375 | 3 | [] | no_license | class Board extends React.Component {
constructor(props) {
super(props);
this.state = {
'currentPlayer': 1, // 1 is red, 2 is black
'board': [
[0, 0, 0, 0, 0, 0, 0], // 0
[0, 0, 0, 0, 0, 0, 0], // 1
[0, 0, 0, 0, 0, 0, 0], // 2
[0, 0, 0, 0, 0, 0, 0], // 3
... | true |
d69490059d0bf06f89e06ce30491a58c7483a48b | JavaScript | zm1try/quadratic-equation | /src/index.js | UTF-8 | 590 | 3.09375 | 3 | [
"MIT"
] | permissive | module.exports = function solveEquation(equation) {
let arr = equation.split(' ');
arr[0] = parseInt(arr[0],10);
if (arr[3] === '-') arr[4] = -parseInt(arr[4],10);
else arr[4] = parseInt(arr[4],10);
if (arr[7] === '-') arr[8] = -parseInt(arr[8],10);
else arr[8] = parseInt(arr[8],10);
arr.splice(1... | true |
eb0f5b1bc3fd06fb1ca7bfabe8296f38df4a91af | JavaScript | openspc/ESTK | /chapter09/9-28.jsx | UTF-8 | 751 | 3.1875 | 3 | [] | no_license | // 正規表現で検索する文字列
var text = "会議の予定は3月15日。2回目は8月。次回は10月10日。最後は12月3日です。でも987月10日や睦月は嘘です。";
// 単純な文字置換。です。をでした。に置き換える
text = text.replace(/です。/g, "でした。");
// ●x月か●xx月にグローバルマッチさせ1月ずつ値を減らす
data = text.replace(/\D(\d{1,2})月/g, function(matchText,matchGroup, ptr, allText){
$.writeln(matchText);
$.writeln(matchGroup);
... | true |
69f765a00d0fbea66b6ee4979248077e61851cda | JavaScript | adammertel/municipalities-slovakia | /scrape.js | UTF-8 | 4,568 | 2.8125 | 3 | [] | no_license | const cheerio = require("cheerio");
var axios = require("axios");
var GeoJSON = require("geojson");
var converter = require("json-2-csv");
var shpConverter = require("geojson2shp");
var fs = require("fs");
var rootUrl = "https://sk.wikipedia.org/";
var tableUrl =
"https://sk.wikipedia.org/wiki/Zoznam_slovensk%C3%BD... | true |
7802c98bd60442236d0951d160aa5d65e3d20d54 | JavaScript | MelyHC/amazonas-hackathon-amda | /server/model/comunityProyects.js | UTF-8 | 2,303 | 2.625 | 3 | [] | no_license | const Response = require('../res-message');
const { admin } = require('../firebase-config');
const db = admin.firestore();
const FieldValue = admin.firestore.FieldValue;
const addProyect = (req, res) => {
console.log('Model: addProyect');
const { comunity, proyectName, typeProyect, statusProyect } = req.body.data... | true |
0baa011da168c343ea29b95bca5641ffbc36f27f | JavaScript | laola1technik/workshop-olympia-ticker | /src/js/parser.js | UTF-8 | 1,182 | 2.859375 | 3 | [
"BSD-2-Clause"
] | permissive | import Message from './Message'
export default class Parser {
constructor() {
this.messages = new Set();
}
parse(json) {
if (this.isInvalidFeed(json)) {
return [];
}
const messagesFromFeed = json.sportart.tickertxt.message;
this.messages.clear();
... | true |
4da7583616693b3f9672d2f80e15b8770ea7d2d2 | JavaScript | ejsmith13/burger_app | /public/assets/js/burger.js | UTF-8 | 2,024 | 3.4375 | 3 | [
"MIT"
] | permissive | document.addEventListener("DOMContentLoaded", (event) => {
if (event) {
console.info("DOM loaded");
}
const devourBtns = document.querySelectorAll(".devoured-btn");
// Set the event listener for the devour button
if (devourBtns) {
devourBtns.forEach((button) => {
button.addEventListener("click... | true |
3b5b149e3eacea60e491f6d7c3ae2c7ca1ce3d86 | JavaScript | omcaree/node-hmc6343 | /main.js | UTF-8 | 611 | 3.03125 | 3 | [] | no_license | //include the module
var hmc6343 = require('./src/hmc6343.js');
//create new instance
var compass = new hmc6343('/dev/i2c-3', 0x19);
//read in accelerometer data
compass.readAccel(function(accelData) {
console.log("Accel Data: " + accelData.ax + ", " + accelData.ay + ", " + accelData.az);
});
//read in magnetic dat... | true |
ae97aede119228bd8cbb33100d574090b4b0719a | JavaScript | ta-enomoto/go-chat-app-api-ver | /web-server/public/scripts/chatroom.js | UTF-8 | 6,860 | 2.921875 | 3 | [] | no_license | //WebSocketインスタンスと取得したチャットは各関数で使用するため、グローバルで定義しておく
let socket = null;
let wsuri = "ws://172.25.0.2/wsserver";
let allchats ="";
//ウィンドウ表示時に、APIからのチャットの取得と、WebSocketのハンドシェイク処理を行う
window.onload = async function() {
//API、WebSocket共通で使用するルームIDは、URLから取得
let url = location.href;
let roomid = url.replace("http://17... | true |
27e6df7eb766b81a1a1231b45e9aac610b3106e1 | JavaScript | muhammadlovlu/bored-api | /js/random.js | UTF-8 | 1,204 | 3.328125 | 3 | [] | no_license | // fetch("https://randomuser.me/api/?results=5000")
// .then(res => res.json())
// .then(data => {
// console.log(data)
// })
function generatePassword() {
fetch("https://randomuser.me/api/?password=special,32")
.then(res => res.json())
.then(data => {
const passwor... | true |
a48808b3c95b87db43a2694ab4418df289146ce3 | JavaScript | harunaltun38/PHP-JS-CSS-HTML | /CityWok_SHOP/warenkorb.js | UTF-8 | 5,773 | 3.109375 | 3 | [] | no_license | function purchaseClicked() {
"use strict";
alert('Danke für ihre Bestellung');
var cartItems = document.getElementsByClassName('cart-items')[0];
while (cartItems.hasChildNodes()) {
cartItems.removeChild(cartItems.firstChild);
}
updateCartTotal();
}
function removeCartItem(dom)... | true |
87c984ebfd45a279e03d7abf7e4bacbd9cf3a958 | JavaScript | gustavoleal-web/Pokedex-v2 | /src/Pokedex/MoreInfo/EvolutionChain/EvosMethods/EvosMethods.js | UTF-8 | 3,384 | 2.515625 | 3 | [] | no_license | import React, { useState, useEffect, useRef } from 'react';
import IndividualMethods from './IndividualEvosMethods/IndividualMethods';
import Pokedex from '../../../Pokedex';
import styles from './EvosMethods.module.css';
import axios from 'axios';
import Card from 'react-bootstrap/Card';
import pokeball from '../../..... | true |
a1396fc9da19a6946b4f2269e148f7caa124f41e | JavaScript | satu0king/RTOS-SchedulerVizualizer | /ux.js | UTF-8 | 3,274 | 2.90625 | 3 | [] | no_license |
var jobCount = 0;
function newJob() {
jobCount++;
let newTask =
`<li class="ui-state-default" id = "job${jobCount}">
<div class = "task">
<span class="ui-icon ui-icon-arrowthick-2-n-s"></span>
Name: <input type="text" name ="name" id = 'name' value = "Jo... | true |
106d538b88bd7bf7642982389f6c2272fb938190 | JavaScript | BrNogueira/lermelhor | /www/dou1/js/publishNavigator/CheckValidate.js | UTF-8 | 5,326 | 3.0625 | 3 | [] | no_license |
var Pass = new Array();
/**
Array Argument Pattern for CheckValidate()
* CheckValidate
(
formId,
numField ,
{FieldName_1, ... , FieldName_n} ,
{FieldTitle_1 , ... , FieldTitle_n} , ... ,
{FieldValue_1 , ... FieldValue_n}
[,'preview' ] @ For Preview Only
)
*/
function... | true |
6f5b44902aabf6516c39f0aa52acdc82126cb2ae | JavaScript | zhenchai/mall | /mall_site/src/main/webapp/js_max/customer/dateclass.js | UTF-8 | 1,859 | 3.15625 | 3 | [
"MIT"
] | permissive | /**
* 宁派电子商务平台前台会员部分 时间选项js文件
* @author NINGPAI-zhangqiang
* @since 2014年4月11日16:23:39
* @version 0.0.1版
*/
function DateSelector(selYear, selMonth, selDay){
this.selYear = selYear;
this.selMonth = selMonth;
this.selDay = selDay;
this.InitYearSelect();
this.InitMonthSelect();
}
/**
* 设置最大年份... | true |
9a1a14359fcf80c25a59542749e67b148c317ded | JavaScript | king-king/temp | /filter-blend.js | UTF-8 | 8,769 | 2.9375 | 3 | [] | no_license | /**
* Created by WQ on 2015/6/2.
*
*图像混合,说明文档:http://king-king.github.io/document/1/blendApi.html
*
*/
(function () {
function blend(imgData1, imgData2, model) {
var imgData = document.createElement("canvas").getContext("2d").createImageData(imgData1);
function loopArray(arr, step, func) {
... | true |
e64e812f2d955de73a1d11955609985eb60ef4eb | JavaScript | jinoogui/alibaixiu-stu | /routes/actions/category/findByIdAndUpdate.js | UTF-8 | 808 | 2.5625 | 3 | [] | no_license | // 验证模块
const Joi = require('joi');
// 用户模块
const { Category, validateCategory } = require('../../../model/Category');
module.exports = async (req, res) => {
// 待修改用户id
req.fields._id = req.params['id'];
console.log()
// 定义对象验证规则
const schema = {
_id: Joi.string().required().regex(/^[0-9a-fA-F]{24}$/).error(new... | true |