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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
916031f427ffe9e0d711bc5a0b65833aab4163ea | JavaScript | ktdung/m4-4-node--promises-1 | /__workshop/exercise-1.js | UTF-8 | 531 | 4.09375 | 4 | [] | no_license | // Exercise 1
// ------------
const arrayOfWords = ['cucumber', 'tomatos', 'avocado'];
const complicatedArray = ['cucumber', 44, true];
const makeAllCaps = (array) => {
// write some code
};
const sortWords = (array) => {
// write some code
};
// Calling (testing)
makeAllCaps(arrayOfWords)
.then(sortWords)
.... | true |
6a93f8fa72b06cee47c5d8eb80a1794ce73cc3bb | JavaScript | professorqtaku/clearbnb | /src/components/BookingOverview.js | UTF-8 | 1,937 | 2.625 | 3 | [] | no_license | export default function BookingOverview(props) {
const { title, startDate, endDate, guests, totalPrice } = props
const changeDateFormat = (date) => {
date = date.toLocaleDateString();
return date;
};
const countDays = (start, end) => {
let diff = end - start;
return (Math.round(diff / 864000... | true |
8eb4f6d9d89c4b5d12b2c43cb5d2d4defc43bb30 | JavaScript | 157239n/Youtube-speed-adjust | /content.js | UTF-8 | 681 | 2.578125 | 3 | [] | no_license |
let vidElems = document.getElementsByTagName("video");
let vidElem = vidElems.length == 0 ? null : vidElems[0];
function sendUpdate() {
chrome.runtime.sendMessage({"message": "updateRate", "rate": vidElem.playbackRate});
}
// content.js
chrome.runtime.onMessage.addListener(
function(request, sender, sendResponse) ... | true |
c3517aa50eb638749ef28a2870c339b0ad169074 | JavaScript | nirnaeth/reversi | /www/js/board.js | UTF-8 | 2,038 | 3.234375 | 3 | [] | no_license | var Board;
Board = (function() {
function Board(otherBoard) {
var i;
if (otherBoard == null) otherBoard = {};
this.myBoard = [];
i = 0;
if (otherBoard.board !== void 0) {
while (i < 8 * 8) {
this.myBoard[i] = otherBoard.board[i];
i++;
}
}... | true |
e1cfdba622fdcf634ea56ebb622f3e0bb08e8bd8 | JavaScript | cloudyar/learningJS | /node.js/test.js | UTF-8 | 1,784 | 3.9375 | 4 | [] | no_license | //测试代码片段
function Base(name, color) {
this.name = name;
this.sayHello = function() {
console.log('Hello, ' + this.name);
}
//测试,添加一个引用类型
this.colors = ['red', 'blue', 'green'];
}
//Base的原型
Base.prototype.showName = function() {
console.log('My name is ' + this.name);
}
/*var base1 = new Base('base1');
var base... | true |
47943d947951bad32ea8d785785e2d69087515df | JavaScript | ghaseminya/hacknical | /frontend/pages/initial/index.js | UTF-8 | 2,853 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | import cx from 'classnames';
import { polyfill } from 'es6-promise';
import styles from './styles/initial.css';
polyfill();
const LOADING = ' .......... ';
const waitFor = ms => new Promise(resolve => setTimeout(resolve, ms));
class Rock {
constructor(containerDOM, waitTime = 100) {
this.$container = containerD... | true |
1954f317b319f78765e3bdb97db81e07aeec2a32 | JavaScript | eguser/custom-client-ui | /data/popup/popup.js | UTF-8 | 1,919 | 2.703125 | 3 | [] | no_license | var background = (function () {
var _tmp = {};
chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {
for (var id in _tmp) {
if (_tmp[id] && (typeof _tmp[id] === "function")) {
if (request.path === 'background-to-popup') {
if (request.method === id) _tmp[id](requ... | true |
458455a8b6c32c8298d8f3461a753550666e847c | JavaScript | Shubham-503/neogCamp-asgn-eight | /src/App.js | UTF-8 | 1,631 | 3.140625 | 3 | [] | no_license | import React, { useState } from "react";
import "./style.css";
const emojiDb = {
"😁": " Grinning Face",
"😘": "Kisssing Face",
"😒": "Not Amused Face",
"😊": "Smiling Face",
"😂": "Face with Tears of Joy",
"✌": "Victory",
"🤞": "Finger crossed",
"👀": "Eyes",
};
var emojisWeKnow = Object.keys(emojiDb)... | true |
0bd4ef53db262689717c53d49ac4c49327683940 | JavaScript | JosephKrusling/Programmable-Cellular-Automata | /game/entity/Tank.js | UTF-8 | 1,131 | 3.421875 | 3 | [] | no_license | const Entity = require('./Entity');
function Tank(x, y, radius, facing, attackCooldown=1000) {
Entity.call(this, x, y, radius);
this.facing = facing;
this.isShooting = false;
this.lastAttack = 0;
this.attackCooldown = attackCooldown;
this.points = 0;
this.name = "Unnamed";
}
Tank.pro... | true |
7df55e6eb66d1a2c673030519b2e801a9726472f | JavaScript | adeele/car-picker | /src/App.jsx | UTF-8 | 1,737 | 2.515625 | 3 | [] | no_license | import React, { useEffect, useState } from 'react';
import Picker from "./Picker";
import VehicleBrowser from "./VehicleBrowser";
import ErrorMessage from "./ErrorMessage";
import { getMakes, getModels, getVehicles } from "./API";
const App = () => {
const [{ makes, make, models, model, vehicles, vehicle, error },... | true |
82a8f5e21a2df8d00e277f26830a16028aaa5067 | JavaScript | maidnmw/javascript-task-1 | /roman-time.js | UTF-8 | 1,531 | 3.6875 | 4 | [] | no_license | 'use strict';
/**
* @param {String} time – время в формате HH:MM (например, 09:05)
* @returns {String} – время римскими цифрами (IX:V)
*/
function div(num, by) {
return (num - num % by) / by;
}
function parseTime(time, iter) {
let parsedNum = parseInt(time[iter], 10);
if (isNaN(parsedNum)) {
... | true |
3062701f4af5e45f61be4580319d940824360171 | JavaScript | zendesk/sitemap-generator | /src/helpers/__tests__/stringifyURL.js | UTF-8 | 539 | 2.75 | 3 | [
"MIT"
] | permissive | const stringifyURL = require('../stringifyURL');
describe('#stringifyURL', () => {
const url = {
protocol: 'http',
host: 'example.com',
uriPath: '/test',
};
test('should be a function', () => {
expect(stringifyURL).toBeInstanceOf(Function);
});
test('should return a string', () => {
con... | true |
60823a32f70793e8dac8f3fbf03681122f2a568c | JavaScript | mohamadrezaDakhili/crud | /public/javascript/index.js | UTF-8 | 3,724 | 2.78125 | 3 | [] | no_license | var trUser = null;
let idEdit = "";
let arr = [];
let success = false;
$(document).ready(function () {
$("#btn-modal").click(function () {
$("#myModal").modal("show");
});
});
$("#btn-create-account").click(function (e) {
e.preventDefault();
let name = $("#username").val();
let email = $("#email").val()... | true |
32e9b62589255a34fe331bacb951eca4a7409b51 | JavaScript | mardefronteira/AllBertinho | /src/components/HistoricoCompras/index.js | UTF-8 | 2,067 | 2.625 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
import { Row, Col, Card } from "react-bootstrap";
import { Link } from "react-router-dom";
import api from "../../services/api";
import CarrinhoCompras from "../Carrinho"
function HistoricoVendas() {
const [sales, setSale] = useState([]);
useEffect(() => {
... | true |
492e51d2fb9bd0a5c835d6395e3859b1997a15ff | JavaScript | TeselaGen/ve-range-utils | /src/adjustRangeToRotation.test.js | UTF-8 | 2,878 | 2.828125 | 3 | [
"MIT"
] | permissive | //const tap = require('tap');
//tap.mochaGlobals();
const adjustRangeToRotation = require('./adjustRangeToRotation.js');
const assert = require('assert');
describe('adjustRangeToRotation', function() {
it('defaults to a rotateBy=0 if a null or undefined is passed ', () => {
assert.deepEqual(adjustRangeToRo... | true |
e85138f6c07aa75914c98c9e81cc5c09b3298546 | JavaScript | Luccasoli/core | /packages/babel-plugin-skynexui/src/index.js | UTF-8 | 3,289 | 2.59375 | 3 | [
"MIT"
] | permissive | const NATIVE_PACKAGE = '@skynexui/native';
const WEB_PACKAGE = '@skynexui/web';
// const isCommonJS = (opts) => opts.commonjs === true;
function isSkynexNativeModule({ source, specifiers }) {
return source
&& source.value.startsWith(NATIVE_PACKAGE)
&& specifiers.length;
}
function isSkynexNativeRequire(t,... | true |
3fb8580f7ca4e9a46eb0b5c44be0eeccd3d59075 | JavaScript | zq9409img/i | /Public/include/mxigua911/foot.js | UTF-8 | 1,549 | 2.578125 | 3 | [] | no_license | /*// JavaScript Document
var div = document.createElement("div");
div.style.position="fixed";
div.style.bottom=0;
div.style.width="100%";
div.style.zIndex=1000000;
var img3=[];
img3[0] = "https://ae01.alicdn.com/kf/H0872796721604a0ea27fbc10399e1177b.jpg";
img3[1] = "https://ae01.alicdn.com/k... | true |
5ca6441e8577d49fa6af3f68e20e53bae522b5bc | JavaScript | edward870505/javascript-design-patterns | /第七章-工厂模式/7.4 示例:XHR工厂.js | UTF-8 | 4,907 | 2.5625 | 3 | [] | no_license | var Interface = require('../Interface.js');
var Library = require('../Library.js');
/**AjaxHandler interface */
var AjaxHandler = new Interface('AjaxHandler', ['request', 'createXhrObject']);
/**SimpleHandler class */
var SimpleHandler = function () {}; //implements AjaxHandler
Interface.Interface.ensureImplements(S... | true |
5740dbe5695dc02903cbebd7cc45ee4cc4ab0361 | JavaScript | best-salitest-hacker-news-trolls/front-end | /saltinator/src/actions/delete.js | UTF-8 | 963 | 2.515625 | 3 | [
"MIT"
] | permissive | import { axiosWithAuth } from "../utils/axiosWithAuth";
import { DELETE_LOADING, DELETE_SUCCESS, DELETE_FAILURE } from "./types";
export const deleteComment = (id, comment_id) => dispatch => {
dispatch({ type: DELETE_LOADING });
return axiosWithAuth()
.delete(`users/${id}/favorites/${comment_id}`)
.then(r... | true |
4f7db118cb09ad4c20a2d7c2d834f6c98ecf768d | JavaScript | viastudio/mergeatron | /bin/github_setup.js | UTF-8 | 1,565 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | "use strict";
var config = require('../config').config.plugins.github;
if (!config) {
console.log('Please set configure the github plugin first and then execute this script again!');
process.exit(1);
}
if (config.auth.type !== 'basic') {
console.log('Please set the auth type to "basic" and then execute this scri... | true |
adb18aa718af8ff69fd2ecf9d3d78593df35179c | JavaScript | WindUpDurb/address_book | /test.js | UTF-8 | 224 | 3.234375 | 3 | [] | no_license | /**
* Created by david on 4/15/16.
*/
var titleCase = function (string) {
var results = [];
var words = string.split(" ");
};
var test = "How can mirrors be real if our eyes";
console.log(titleCase(test)); | true |
ae5692a62eeb352474ce8da5830ae3ede6948342 | JavaScript | tectronics/excelsior | /js/main/LevelManager.js | UTF-8 | 585 | 2.6875 | 3 | [] | no_license | /**
* LevelManager
* Manage levels
**/
var LevelManager = function() {
this.level = null;
this.levels = [];
this.init = function() {
for (x in LevelConf) {
this.levels.push(x);
}
}
this.instantiate = function(name) {
console.log(name);
if (this.levels.indexOf(name) > -1) {
thi... | true |
fa7bdd9f4cada6239284e3fe62aa88994be7d804 | JavaScript | hzsrc/TextEncode | /textEncode.js | UTF-8 | 3,986 | 2.75 | 3 | [] | no_license | var iconv = require('iconv-lite');
var fs = require('fs');
/// <summary>
/// 获取文件的编码格式
/// </summary>
function TextEncode(defaultEnc) {
this.encoding = defaultEnc || 'GBK'
this.bom = [];
}
TextEncode.prototype = {
readTextEnc: function (fileName) {
var r = this.readText(fileName);
return {... | true |
634293c6bd1dcb7f9acafa742f2ccdd31113122d | JavaScript | turingschool-examples/memoize | /datasets/1811/duyTV.js | UTF-8 | 5,993 | 3.265625 | 3 | [] | no_license | const duyData = [
{
"id": 1,
"name": ".concat",
"definition": "The concat() method is used to merge two or more arrays. This method does not change the existing arrays, but instead returns a new array.",
"type": "accessor"
},
{
"id": 2,
"name": ".copyWithin",
"definition": "The copyWithin() method shallow copies part o... | true |
875ea3756b5c247a2b06a1abeefb1541591e7403 | JavaScript | webstylestory/figolia | /test/ngrams.spec.js | UTF-8 | 1,241 | 3.09375 | 3 | [
"MIT"
] | permissive | import { expect } from 'chai';
import ngrams from '../src/ngrams';
describe('Computing NGrams of a string', function() {
it('should return empty array with argument other than string', function() {
expect(ngrams(32)).to.eql([]);
expect(ngrams({ test: 'hello' })).to.eql([]);
expect(ngrams... | true |
ed995b365ace36950cc7c5113d3c2c03c1c269c4 | JavaScript | megofast/Neighborhood-Mapper | /js/view-model.js | UTF-8 | 2,557 | 2.859375 | 3 | [] | no_license | let viewModel = function() {
let self = this;
self.pois = ko.observableArray([]);
self.markers = ko.observableArray([]);
self.filterText = ko.observable('');
self.listVisible = ko.observableArray([]);
self.listSelected = ko.observableArray([]);
// Create all the POI in to the pois array, setup markers an... | true |
982d2dafb88dc278c272a37be8814f9db516435f | JavaScript | green-fox-academy/jokutianna | /week-02/day-03/drawing-01/drawingexercise1.js | UTF-8 | 548 | 3.421875 | 3 | [] | no_license | 'use strict';
// Boilerplate
const canvas = document.querySelector('.main-canvas');
const ctx = canvas.getContext('2d');
//Draw a rectangle//
ctx.fillRect(10, 10,100,100);
//Colored rectangle//
ctx.fillStyle = 'red';
ctx.fillRect(110, 110, 100, 100);
//Line//
ctx.beginPath();
ctx.moveTo(210, 210);
ctx.lineTo(300... | true |
ca209fb48795777ccb36ccbcadc6eb9dba9d5410 | JavaScript | JungHyunKwon/replaceAll | /js/replaceAll.min.js | UTF-8 | 459 | 2.59375 | 3 | [] | no_license | /**
* @name replaceAll
* @author JungHyunKwon
* @since 2018-09-05
* @version 1.0.0
* @param {string} value
* @param {string || regexp} from
* @param {string} to
* @return {string}
*/
!function(){"use strict";var t=Object.prototype.toString;window.replaceAll=function(e,n,r){var o="";return"string"==typeof e&&(o... | true |
63407972f227a9229e839aed778d31b3e310368b | JavaScript | SarveshMishra/JavaScript | /Coding Recipe/Compete with Neighbour.js | UTF-8 | 1,121 | 4.03125 | 4 | [
"MIT"
] | permissive | /*Description
You are provided an arrayarrwhich hasnintegers.
You need to find the count of all such integers in array which are larger than its neighbours.
Neighbours of a integer in array are its adjacent integers. Check hint for more understanding.
Input
Input Format :
First line of input contains N which is t... | true |
053490a0fde9993b302121ee7e869d66d5dc0f27 | JavaScript | arnoldczhang/node_test | /lib/isNumber.js | UTF-8 | 185 | 2.859375 | 3 | [
"MIT"
] | permissive |
module.exports = (num) => {
const type = typeof num;
if (type === 'number' || type === 'string') {
num = +num;
return num === num || !isFinite(num);
}
return false;
};
| true |
6e7e297997eaedb651abb2975bf163db76f72e13 | JavaScript | CastilloLuis/board_project | /web/scripts/main.js | UTF-8 | 1,769 | 2.703125 | 3 | [] | no_license | $(document).ready(() => {
console.log("THE DOC IS READY :)");
drawing();
clear();
});
var start = {};
var draw = {};
var endpath = {};
var myCanvas;
var ctx;
var dimensionProps;
var mouseisDown;
var brushColor;
function drawing() {
myCanvas = document.getElementById("canvas");
ctx = myCanvas.getCo... | true |
7826454447687ff28799d82ce113b90fd9af795a | JavaScript | burnca02/coachtools-11-1 | /models/Roster.js | UTF-8 | 943 | 2.578125 | 3 | [] | no_license | /**
* This file contains the model being used for the roster Database.
* Authors: Ricardo Hernandez, Cam Burns, and Kayl Murdough
* Date: Fall Semester 2020
*/
var mongoose = require('mongoose');
const playerSchema = mongoose.Schema({
Email: String,
Number: {
type: Number,
default: ... | true |
5b366b05e49453073af1f02e4b5455e866999df2 | JavaScript | matiasgarcia/nosql | /mongo/queries.js | UTF-8 | 5,122 | 3.25 | 3 | [] | no_license | db = db.getSiblingDB("GestionClub");
//Punto 1
//i. Obtener todos los documentos de la colección que contenga a los socios.
db.socios.find();
//ii. Obtener todos los documentos de forma organizada (pretty).
db.socios.find().pretty();
//iii. Obtener un array con los primeros 3 documentos de una colección.
db.socios.fi... | true |
fdfcde69162a10c69c81195b9f40525a31ba4cb0 | JavaScript | caiohamamura/2021-dsw417-aula06 | /Gabriel_Cruz_do_Cruz_Carmo/principal.js | UTF-8 | 1,043 | 3.296875 | 3 | [] | no_license | var canvas;
var ctx;
var dx = 50;
var x = 30;
var y = 0;
var WIDTH = 500;
var HEIGHT = 520;
var tile1 = new Image();
var posicao = 0;
var NUM_POSICOES = 6;
function KeyDown(evt){
switch (evt.keyCode) {
case 39:
if (x + dx < WIDTH){
x += dx;
posicao++;
if(posicao == NUM_POSICOE... | true |
ece14c21e1bcbcec698792e2889330091bff3995 | JavaScript | ajycc20/Leetcode-js | /按奇偶排序数组-922.js | UTF-8 | 761 | 3.921875 | 4 | [] | no_license | /**
* 给定一个非负整数数组 A, A 中一半整数是奇数,一半整数是偶数。
* 对数组进行排序,以便当 A[i] 为奇数时,i 也是奇数;当 A[i] 为偶数时, i 也是偶数。
*
* 输入:[4,2,5,7]
* 输出:[4,5,2,7]
* 解释:[4,7,2,5],[2,5,4,7],[2,7,4,5] 也会被接受。
*
*/
/**
* @param {number[]} A
* @return {number[]}
*/
var sortArrayByParityII = function(A) {
let left = [], right = [], res = [] // left... | true |
1caec713793102755054aa6e2f0be3227d3e2ac4 | JavaScript | terryatgithub/react_study | /src/pages/HookPage.js | UTF-8 | 3,643 | 3.25 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
import SetStatePage from "./SetStatePage";
// 1. 认识Hook
// Hook是什么? Hook是一个特殊的函数,它可以让你‘钩入‘React的特性,例如:useState是允许你在React函数组件中添加state的Hook
// 什么时候我会用Hook? 如果你在编写函数组件并意识到需要向其添加一些state,以前的做法是必须将它转化为class组件,现在你可以再现有的函数组件中使用Hook
// 2. 使⽤ Effect Hook
// Effect Hook 可以让你在... | true |
160fdd67774dd271a507406016d8d1227ef9bac9 | JavaScript | bfprietoc/IngeSoft2Proyectos | /tutorial-master/src/store.js | UTF-8 | 293 | 2.640625 | 3 | [] | no_license | import { createStore } from 'redux';
const reducer = (state,action) => {
if(action.type === "ADD_TO_STORE"){
return{
...state,
datos : state.datos.concat(action.texto)
}
}
return state;
};
export default createStore(reducer, {datos: [] }); | true |
8dc1ab97da24f95817febd9dac20a8d20c5490ca | JavaScript | gshengchen/websites | /web/jsguide5/chapter07/xsArray.js | UTF-8 | 195 | 3.09375 | 3 | [] | no_license |
var a1 = [ , , , ];
var a2 = new Array(3);
var a3 = [1,2,3];
console.log(a1.length);
console.log(0 in a1);
console.log(0 in a2);
a2[0] = 1;
console.log(a2.length);
console.log(0 in a3); | true |
9ad7b48a9e2c1c5f1cba007b1b52f486b79e5e63 | JavaScript | affafrai/lotide | /eqArrays.js | UTF-8 | 876 | 3.03125 | 3 | [] | no_license | const assertEqual = require('./assertEqual');
const eqArrays = function(testArr1,testArr2) {
if (testArr1.length === testArr2.length){
for(let i = 0; i < testArr1.length; i++){
if (testArr1[i] !== testArr2[i]){
return false;
}
}
return true;
}
}
// console.log(eqArrays([1, 2, 3], [... | true |
7a1e10896df965adf079a0ed666c0592bc10e2ca | JavaScript | mishyjari/hogwarts-nyc-web-033020 | /src/components/App.js | UTF-8 | 935 | 2.609375 | 3 | [] | no_license | import React, { Component } from "react";
import "../App.css";
import Nav from "./Nav";
import hogs from "../porkers_data";
import TileContainer from "./TileContainer";
class App extends Component {
state = {
hogs: hogs,
filter: 'none'
// none, onlyGreased, name, weightt
}
updateFilter = event => {
const... | true |
99b3516daa0b2de16b64944569f51ae8ff5d81ee | JavaScript | subratcall/study_javascript | /edabit_very_hard.js | UTF-8 | 6,158 | 4.15625 | 4 | [] | no_license | // How to run: *********** //
// npm install -g nodemon //
// nodemon <file-name> //
// *********************** //
// Edabit
// https://edabit.com/
// Challenges
// JavaScript
// Very Hard:
console.log(`
Challenges
JavaScript
Very Hard
`);
// Game of Thrones: Character Titles
// https://edabit.com/challenge... | true |
4e4e8fce25487c06c825b329eccf1c4180c63a76 | JavaScript | 64octets/boilerpress | /development/js/theme/functions.js | UTF-8 | 2,156 | 2.625 | 3 | [] | no_license | /**
* Smoothly scrolls the page to a specific location, either a target element
* or an arbitrary offset value (in pixels). By default, the duration of the
* scroll animation is set relative to the distance being scrolled.
*
* @param target: the target element to scroll to
* @param params: an object with custom... | true |
3ce736adc9d77f1a7a022125432a93b105e29203 | JavaScript | amit-aslia/Data_Structure_and_algorithms | /code/bubbleSort/index.js | UTF-8 | 511 | 3.84375 | 4 | [] | no_license | const arr = [70,80,90,85,75,15,-1,95,100,10];
const swap = (arr, i,j) => {
arr[i] = arr[i] + arr[j];
arr[j] = arr[i] - arr[j]
arr[i] = arr[i] - arr[j]
}
const bubbleSort = arr => {
const len = arr.length;
let count = 0;
for(let i=0;i<len;i++) {
for(let j=0; j<len-1-i; j++) {
... | true |
334d28cf3497bd9d57171ae85ad132260b45cf86 | JavaScript | davpascoal/mws-restaurant-stage-1 | /src/components/review/review.js | UTF-8 | 2,817 | 2.5625 | 3 | [] | no_license | import {addReview} from '../../js/requests'
import reviewRating from '../review-rating/review-rating'
import IDB from '../../js/idb'
import {toggleSyncMessage} from '../../js/shared'
/**
* Restaurant Review Component
*/
const review = (restaurantId, addReviewHandler) => {
const review = document.createElement('sec... | true |
b998a57733d716c0a18a48eca736875df8a821a5 | JavaScript | tiandahui/react | /webpackProject/src-03模拟v-model指令/状态的定义与修改.js | UTF-8 | 1,045 | 3.03125 | 3 | [] | no_license | import React from 'react';
class App extends React.Component {
constructor() {
super()
this.state = {
message: '2020',
n: 1
}
this.handleClick = this.handleClick.bind(this)
}
render() {
return (
<div>
<h2 id='h2'>{this.state.message}</h2>
<h2>{this.state.n}... | true |
46e5fa470269d71bee0c4a2c901975be72cd8961 | JavaScript | ryan-connor/shopping-cart | /src/App.js | UTF-8 | 1,422 | 2.8125 | 3 | [] | no_license | import './App.css';
import React, {useState} from "react";
import Routes from "./components/Routes";
function App() {
//state for cart items here
const [appCart, setAppCart] = useState([]);
//callback function to get each item from Item component, check if is already in cart and then add the item
const getItem = (in... | true |
685aeb855a7223e27209c17146fb72ad84a8ee05 | JavaScript | Minskyb/cow | /src/slider/slider.js | UTF-8 | 3,955 | 2.640625 | 3 | [] | no_license | /**
* Created by ASUS on 2016/7/4.
*/
var $ = require('jquery');
var Slider = function(element,options){
this.options = $.extend({},Slider.defaultOptions,options);
this.$element = $(element);
this.$content = $(".cow_slider_content",this.$element);
this.$items = this.$content.children();
this.$navs = $(".cow_... | true |
67303903458d9c74de6f50c56c9acbe4d590d077 | JavaScript | emrysr/apps | /www/js/gettext_module.js | UTF-8 | 1,572 | 3.09375 | 3 | [] | no_license | /**
* wrapper for gettext like string replace function
* @todo: create a central js translation system for all modules.
* @author: emrys@openenergymonitor.org
*/
const getText = (function () {
/**
* emulate the php gettext function for replacing php strings in js
*/
function translate (property) ... | true |
cbd72ea68bc313e4609c0f395744eb36fe2390bc | JavaScript | Ghislaine10/c4-js-2-debrief | /js/app.js | UTF-8 | 3,628 | 4.59375 | 5 | [] | no_license | // 1. This link contains instructions for completing #1: https://docs.google.com/document/d/1ACw6ILG_rk66ukkkS_84LWiH63hovGnEOKPNtcvRGlg/edit?usp=sharing
//A. You will be creating a Random Exercise Generator.
//Build an array with the items listed below in it.
//Then create a function (using regul... | true |
b3ca2041f2e0178f7bab45ef906a52b2d3eec8ea | JavaScript | Fundamentos2020/meme_studio | /scripts/crearMeme.js | UTF-8 | 1,900 | 2.703125 | 3 | [] | no_license | function crearHTMLMeme(meme){
let memeHTML =
`<div class="p-1 mb-2 col-s-12 col-m-8 offset-m-2 back-white rounded-border">
<div class="row">
<div class="col-s-12 offset-s-0 offset-m-2 col-m-8">
<div class="pb-1">
<h3 class="pb-0p25">${meme.titulo}</h3>
... | true |
9718e6b5fd2a391b1affc0c5f5820066ca0716dc | JavaScript | DylanVann/redux-shorthand-example | /src/userReducer.js | UTF-8 | 685 | 2.671875 | 3 | [] | no_license | const NAME_CHANGED = 'NAME_CHANGED'
const EMAIL_CHANGED = 'EMAIL_CHANGED'
export const onNameChanged = name => ({ type: NAME_CHANGED, payload: name })
export const onEmailChanged = email => ({ type: EMAIL_CHANGED, payload: email })
const reducer = (state = {
name: 'Example User',
email: 'example@example.com',
}, ... | true |
4da3855979ee53acabeec2e644413af8f984b61c | JavaScript | timerg/LearnInFLOLAC | /TexFigureSearch/electron-quick-start/renderer.js | UTF-8 | 2,715 | 2.84375 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"CC0-1.0"
] | permissive | const fs = require('fs');
const readline = require('readline');
let dirPath
let lofpath = "../main.lof"
let figure = {
number: null,
source: null,
exist: false,
caption: null
};
// Function
function searchFile() {
const rl = readline.createInterface({ // Open readline interface
input... | true |
2c82760b57cdf897e01348203260249c299d9a7c | JavaScript | westpsk/leetcode | /js/26-remove-duplicates-from-sorted-array.js | UTF-8 | 357 | 3.328125 | 3 | [] | no_license | /**
* @param {number[]} nums
* @return {number}
*/
const removeDuplicates = function(nums) {
if(nums.length < 2) return nums.length
let pointer = 1
let len = nums.length
for(let i = 1; i < len; i++){
if(nums[i] !== nums[i-1]){
nums[pointer] = nums[i]
pointer++
}
}
return pointer
}
co... | true |
448387a50529d2e06e41175f3bc136f585c3f99a | JavaScript | muhammad-fakhri/aesir-adonisjs | /app/Controllers/Http/Auth/RegisterController.js | UTF-8 | 2,445 | 2.5625 | 3 | [] | no_license | 'use strict'
//bring in the validator
const { validateAll } = use('Validator')
const User = use('App/Models/User')
const randomString = require('random-string')
const Mail = use('Mail')
class RegisterController {
async showRegisterForm({ view }) {
return view.render('auth.register')
}
async register({ request, s... | true |
f167d5849597d564f23cce1eb5c43c780887054e | JavaScript | DimitarKostadinov/JS-Advanced | /ExamsPreparation/StormWatcher.js | UTF-8 | 695 | 3.3125 | 3 | [] | no_license | (function () {
let id=0;
return class Record{
constructor(temperature,humidity,pressure,windSpeed){
this.id=id++;
this.temperature=temperature;
this.humidity=humidity;
this.pressure=pressure;
this.windSpeed=windSpeed;
}
toString(){
let status='Not stormy' ;
... | true |
993ad120ec6a5dd068d5d03beb64c21cd3d1d326 | JavaScript | le0tan/cs1101s-assignments | /jyx/Musical Diversions/2.js | UTF-8 | 1,646 | 3.046875 | 3 | [] | no_license | const major_arpeggio_interval = list(4, 3, 5, 4, 3, 5);
const minor_arpeggio_interval = list(4, 2, 6, 4, 2, 6);
function generate_arpeggio(letter_name, list_of_interval) {
return generate_list_of_note(letter_name, list_of_interval);
}
function arpeggiator_up(arpeggio, duration_each) {
if(length(arpeggio) <= 4)... | true |
1c433a694e99beb9d84728b70dac53bbcfd91c5c | JavaScript | vitipe/flagsfinder | /server/socket.js | UTF-8 | 4,397 | 2.890625 | 3 | [] | no_license | var Room = require('./modules/Room');
module.exports = io => {
var usernames = {};
var games = {};
var roomIds = [];
/* Method used for sending information to users in chat */
var sendInformation = function() {
let notFullRooms = [];
Object.keys(games).forEach(roomId => {
if (!games[roomId].isFull()) {
... | true |
b54665470d246c10b16cbffc5de0eacf576a65f7 | JavaScript | lana193/lizena-server | /src/controllers/objectsController.js | UTF-8 | 1,735 | 2.59375 | 3 | [] | no_license | import { getObjectService, getAllObjectsService, createObjectService, updateObjectService, deleteObjectService, updateObjectPhotosService } from '../services/ObjectsService';
export const getObjectController = async (req, res) => {
try {
res.json(await getObjectService(req.params.id));
} catch(e) {
... | true |
e6516b4d144da9a1627414120a3c2d5a9882d1b3 | JavaScript | artdiniz/cake-fake-browser | /src/window/WithNoFOUCOnShowWindow.js | UTF-8 | 973 | 2.984375 | 3 | [] | no_license | export function WithNoFOUCOnShowWindow(window) {
const showMethod = window.show.bind(window)
const loadURLMethod = window.loadURL.bind(window)
const readyWindowEventPromise = new Promise((resolve) => {
window.once('ready-to-show', () => {
resolve()
})
})
let readyWi... | true |
537e758f05fa2b93ddb89dc485004766af88eca8 | JavaScript | keeto/slab | /src/rhino.bootstrap.js | UTF-8 | 1,017 | 2.765625 | 3 | [
"MIT"
] | permissive | importPackage(java.io);
importPackage(java.lang);
function showHelp(){
java.lang.System.out.println('usage: slab file1.slab file2.slab ...');
quit(0);
}
function readStdin(){
var stdin = new BufferedReader(new InputStreamReader(System['in'])),
lines = [];
while(stdin.ready()) lines.push(stdin.readLine());
... | true |
80099ad53f62880faa7d08891dd191bf0b88442a | JavaScript | anthonydinino/afl-api | /public/fetch.js | UTF-8 | 575 | 2.640625 | 3 | [] | no_license | const getStandings = async () => {
try {
const res = await fetch("https://api.squiggle.com.au/?q=standings");
const body = await res.json();
return body.standings;
} catch (error) {
console.error(error);
}
};
const getGames = async () => {
try {
const res = await fetch(
`https://api.s... | true |
de957f11afd1b957859535d71e5aca8fb6581bac | JavaScript | sunilPeddamalli/AJAX-API_CountryDetails-application | /script.js | UTF-8 | 7,419 | 3.296875 | 3 | [] | no_license | 'use strict';
const btn = document.querySelector('.btn-country');
const countriesContainer = document.querySelector('.countries');
///////////////////////////////////////
const renderCountry = function (data, className) {
const html = `
<article class="country ${className}">
<img class="country__img"... | true |
0259fe01a1f955349368427209d55157aa52d6fe | JavaScript | RodrigoDeveloper1/Tesis_ClienteWeb | /Cliente Web/Tesis_ClienteWeb/Scripts/Views/Calificaciones/ModificarCalificaciones.js | UTF-8 | 11,202 | 2.53125 | 3 | [] | no_license | var idCurso = "";
var idLapso = "";
var idMateria = "";
var idEvaluacion = "";
var idAlumno = "";
var nota = "";
//Función que intenta convertir un string a número
function TryParseInt(str, defaultValue) {
var retValue = defaultValue;
if (str !== null) {
if (str.length > 0) {
if (!isNaN(st... | true |
862f6619eaf8259b13cbb8b44aaa1e9017b1b465 | JavaScript | 1204888712/my_living_be | /public/js/common.js | UTF-8 | 1,487 | 2.625 | 3 | [] | no_license | /*
* @LastEditors: liguobiao
* @LastEditTime: 2021-03-23 19:20:20
*/
const base64Img = require("base64-img");
class Common {
//格式化输出
outPut(code, data, msg = "") {
return { code: code, data: data, msg: msg };
}
//生成len位随机字符串
getCode(len) {
var chars = [
"0",
"1",
"2... | true |
76b4be14e33506dea9d0f5219f4bb2d6426502eb | JavaScript | SoSudon/HHH-Wildflower | /contact.js | UTF-8 | 871 | 3.25 | 3 | [] | no_license | function validation () {
var name = document.getElementById("name").value;
var email = document.getElementById("email").value;
var information = document.getElementById("information").value;
var error_message = document.getElementById("error_message");
var text;
if(name.length < 2){
tex... | true |
c782dd322ed7e47ee53e9d3fc530d5e184b1a474 | JavaScript | sajithdilshan/sajithdilshan.github.io | /assets/js/date.js | UTF-8 | 289 | 3.046875 | 3 | [
"MIT"
] | permissive | function adjustAge() {
document.getElementById("age").innerHTML = (new Date()).getFullYear() - (new Date(1990, 2, 26)).getFullYear();
}
function adjustCurrentYear() {
document.getElementById("currentYear").innerHTML = (new Date()).getFullYear();
}
adjustAge()
adjustCurrentYear() | true |
72dc999567c99c4ff2e2021194a37e0cd1e05765 | JavaScript | arvindnama/CodingRepository | /Javascript/DataStructure/Trees/DFS.js | UTF-8 | 544 | 3.578125 | 4 | [] | no_license | function TreeNode(val) {
this.val = val;
this.left = this.right = null;
}
var dfs= function(root){
var queue = [];
var node = root;
while(node) {
console.log(node.val);
if(node.left) queue.push(node.left);
if(node.right) queue.push(node.right);
node = queue.shift();
}
}
var root = new Tree... | true |
a030059726551e23de1fa143a8913d2130c7068a | JavaScript | cape-/auto-interval | /demos/example_setAutoInterval.js | UTF-8 | 210 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | const { setAutoInterval } = require('../setAutoInterval')
var clearAutoInterval = setAutoInterval(() => console.log("The Date.now() is ", Date.now()), 100)
setTimeout(clearAutoInterval, 5000) // Finish after 5s | true |
4645667b3c3d0933b4bfadb5a614bf944dd25d9a | JavaScript | davidoj/Footwork | /js/movement.js | UTF-8 | 4,821 | 2.859375 | 3 | [
"BSD-3-Clause"
] | permissive | //Movement mixins
//Balance statistic that governs whether various actions can be used
Game.Mixins.Balanced = {
name : 'Balanced',
groupName : 'Balanced',
init : function(properties) {
this._mbal = properties['mbal'] || 5; //Max balance
this._cbal = properties['cbal'] || 5; //Current balance
},
getBalance : ... | true |
353ae996f21a21ed084cce45f810b6ecd808e9ea | JavaScript | abdelbolanos/weatherApp | /app/scripts/directives/forecastResumen/forecastResumenDirective.js | UTF-8 | 1,546 | 2.515625 | 3 | [] | no_license | 'use strict';
/**
* @ngdoc function
* @name weatherApp.directive:forecastResumenDirective
* @description
* # forecastResumenDirective
* Directive for render forecast
*/
angular
.module('weatherApp')
.directive('forecastResumenDirective', function() {
return {
restrict: 'E',
... | true |
ebfb1db13dca13dec4aafa84aae76994079667b8 | JavaScript | matheusfreitaas/devWeb-Back | /course/course.js | UTF-8 | 1,393 | 2.6875 | 3 | [] | no_license | const Course = require('./course.model');
exports.getCourse = function(req, res, next){
Course.findById(req.params.id, function(err, course){
if(err){
res.status(400);
res.send('Ocorreu um erro.');
}else{
res.json(course);
}
});
};
exports.createCourse = function(req... | true |
cd9e8ff47ece70f8131664d29943153bf389e928 | JavaScript | svetlimladenov/JavaScript-Core | /JavaScript Applications/07.Exam Preparations/Spotify Retake Exam 21 December 2018/Spotify/scripts/handlers/handler.js | UTF-8 | 5,459 | 2.515625 | 3 | [
"MIT"
] | permissive | window.handler = window.handler || {};
handler.getHome = function () {
this.isLogged = !!sessionStorage.getItem('authtoken');
this.loadPartials({
header: './templates/common/header.hbs',
footer: './templates/common/footer.hbs',
}).then(function () {
this.partial('./templates/home/ho... | true |
3b018752e658e1ba60f836bdc081296c594d5039 | JavaScript | ramti/quiz | /static/js/flashcards.js | UTF-8 | 1,956 | 2.859375 | 3 | [] | no_license | let currentQuestion = 0;
let qbank = null;
function beginActivity() {
$("#flashcard-area").empty();
let html = '<input id="flashcard-1" type="checkbox" /><label for="flashcard-1">';
html += '<section class="front" id="front">' + qbank[currentQuestion][0] + '</section>';
html += '<section class="back" i... | true |
56847e627a968f17fe31005a17f008995ad79ffc | JavaScript | Cazuist/bhj-diploma | /public/js/ui/forms/CreateTransactionForm.js | UTF-8 | 1,060 | 2.515625 | 3 | [] | no_license | 'use strict';
class CreateTransactionForm extends AsyncForm {
constructor( element ) {
super(element);
this.renderAccountsList();
}
renderAccountsList() {
if(User.current()) {
Account.list( User.current(), (error, response) => {
const accounts = response.data;
const ... | true |
e8eceadd90230796c893c58f5e1328c074ada994 | JavaScript | shermam/cash-control | /public/js/reader.js | UTF-8 | 502 | 2.671875 | 3 | [
"MIT"
] | permissive | export function readAsText(file) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onerror = reject;
reader.onload = _ => {
resolve({
content: reader.result,
lastModified: file.lastModified,
lastMo... | true |
b86d3f8f28f3658604c00bd4d71a47e05e2cd64d | JavaScript | VZyryanov/git_test_repo | /math_test.js | UTF-8 | 127 | 3.09375 | 3 | [] | no_license | function rec_feb(num) {
if (num < 2) return num;
return rec_feb(num - 1) + rec_feb(num - 2);
}
console.log(rec_feb(5)) | true |
bee35257436ea8da986b31c1e7a99eb068acf48a | JavaScript | linkkingjay/homework | /haskell/curry.js | UTF-8 | 350 | 3.609375 | 4 | [] | no_license | function compare (x, y) {
if (x > y) {
return 'GT';
} else if (x === y) {
return 'EQ';
} else if (x < y) {
return 'LT';
} else {
return 'ERROR';
}
}
function compareWithHundred(x) {
return compare(x, 100);
}
console.log(compareWithHundred(99));
console.log(compareWithHundred(100));
console.... | true |
1836978e5085f5e5a96524a79f20f50097f78c07 | JavaScript | NoreenNaz1234/js-practise-set-4 | /q2/script.js | UTF-8 | 208 | 2.875 | 3 | [] | no_license | function calCube() {
let userPut = parseInt(document.querySelector("input").value);
let numOfCube = userPut * userPut * userPut;
alert("The cube of " + userPut + " is " + numOfCube);
} | true |
fe3e75a23eb42e22e5189e7aff038e98a55d62f7 | JavaScript | kshly/Javascript-Practice-Coding | /Objects/const.js | UTF-8 | 93 | 3.015625 | 3 | [] | no_license | const person = {
age: 30,
name: "Kishalay"
}
person.age = 28
console.log(person.age) | true |
a817e2cac97490e300ad5e0d5a23b7eadc8fa0d1 | JavaScript | jdi-testing/jdi-2.0 | /Tests/jdi-uitests-unittests/src/test/resources/JavaScript/rollerLeft.js | UTF-8 | 772 | 2.75 | 3 | [
"MIT"
] | permissive | var newLeft = LEFT_POS;
var leftRoller = document.querySelector('.col-sm-5 .ui-slider-handle');
var horizontalLine = document.querySelector('.col-sm-5 .ui-widget-header');
var currentWidth = parseInt(horizontalLine.style['width']);
var currentLeft = parseInt(leftRoller.style['left']);
var leftRollerCurrentLeftPosition ... | true |
3a414cccf497f46a12bb2648e3d47b6faaee16d6 | JavaScript | TiiToo/vegas | /SSAS/trunk/src/core/dumpObject.js | UTF-8 | 3,580 | 2.609375 | 3 | [] | no_license | /*
Version: MPL 1.1/GPL 2.0/LGPL 2.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software di... | true |
3b1839c9a788e634d02ad37607c4c7f878ea91d2 | JavaScript | gongrongyun/interview | /js/promise.js | UTF-8 | 2,630 | 3.609375 | 4 | [] | no_license | function MyPromise(executor) {
const self = this;
self.status = "pending";
self.data = undefined;
self.onResolvedCallback = [];
self.onRejectedCallback = [];
function resolve(value) {
if (self.status === "pending") {
self.status = "fulfilled";
self.data = value;
for (let i = 0; i < se... | true |
42850a49a9593da259372c23db91bf6b19e6bd28 | JavaScript | AbhishekMurumkar/AngularJSPracticePrograms | /form.js | UTF-8 | 1,123 | 2.625 | 3 | [] | no_license | var http=require('http');
var server=http.createServer(function (req,res) {
if(req.method=='post')
{
let body = '';
request.on('data', chunk => {
body += chunk.toString();
});
request.on('end', () => {
callback(parse(body));
});
}
... | true |
0755ff005f90c7958b52a7708df414c5dffc53b3 | JavaScript | Anis-Omic/hackathonVisionary | /training/sketch.js | UTF-8 | 3,019 | 3.078125 | 3 | [] | no_license | let featureExtractor;
let classifier;
let video;
let loss;
var signs = ["A", "B"]; //, "C", "D", "E"];
function setup() {
noCanvas();
// Create a video element
video = createCapture(VIDEO);
video.parent("videoContainer");
video.hide();
video.size(380, 300);
// Extract the already learned features from ... | true |
8c20adc8ba38ad318ef960e76d249b08842fe196 | JavaScript | future4code/Yvini-Mayza | /backend/aula40-NodeEPackege.json/node-package-template/Exercicio2/Exercicio2.js | UTF-8 | 483 | 3.953125 | 4 | [] | no_license | // EXERCICIO 2
const operation = process.argv[2];
const number1 = Number(process.argv[3]);
const number2 = Number(process.argv[4]);
switch(operation){
case "sum":
console.log(number1+number2)
break
case "sub":
console.log(number1-number2)
break
case "div":
console.log(numb... | true |
d86a50e0debe14e68e3d609a1590fd1e467902bd | JavaScript | diegocaetanop/Loterias | /public/js/reloj.js | UTF-8 | 2,589 | 2.734375 | 3 | [
"MIT"
] | permissive | $(document).ready(function(){
$('#modaladd').modal();
$('#Ingresar__').click(function(e){
e.preventDefault();
});
});
function hora(){
var url="/prueba";
var data;
var posting=$.get( url,data,function(resultado){
document.getElementById('hora').firstChild.nodeValue = resultado[0];
setTimeout("hora()"... | true |
f9b245e76f9a1f23c4b8875294dfb9cadfbc70d2 | JavaScript | kevlabs/lotide | /without.js | UTF-8 | 118 | 2.625 | 3 | [] | no_license | const without = function(arr, excl) {
return arr.filter(elem => !excl.includes(elem));
};
module.exports = without; | true |
d31d63a94c2857ca2bb17642169436b4dfd11dea | JavaScript | nelito987/JS-Core | /JS Fundamentals/2.LabControlFlow/10.ChessBoard.js | UTF-8 | 665 | 3.375 | 3 | [] | no_license | /**
* Created by neli on 26.5.2017 г..
*/
function solve(n) {
console.log('<div class="chessboard">');
let isBlack;
for(let i = 1; i <= n; i++){
if(i%2==1){
isBlack = true;
}else{
isBlack = false;
}
console.log('<div>');
for(let j = 1; j <=n;... | true |
558aaedaeb4547df338ae5370ddc37ba1139e041 | JavaScript | moppi213/chatbot | /dialogs/question.js | UTF-8 | 6,148 | 2.765625 | 3 | [] | no_license | const builder = require('botbuilder');
// このライブラリにtravelという名前をつける
var lib = new builder.Library('travel');
//質問内容を定義
const question = [
"予算は10万円以下?",
"おいしいものが食べたいですか?",
"世界遺産に興味はありますか?",
];
// ユーザーに問いかける際のメッセージと回答に関連する情報を定義する
const menu = {
"YES": {
score: 1
},
"NO": {
score: ... | true |
ef11d95134747cefcf2c7647350336064a7382dc | JavaScript | H6yV7Um/Project-1 | /shubi-project/shubi-api/src/Verify/controllers/lib/sms.lib.js | UTF-8 | 2,282 | 2.53125 | 3 | [] | no_license | var http = require('http');
var qs = require('querystring');
var moment = require('moment');
// 修改为您的短信账号
var un = "N4432525";
// 修改为您的短信密码
var pw = "9Nd2Hl1o5E18dd";
// 修改您要发送的手机号码,多个号码用逗号隔开
var phone = "15208205269";
// 短信域名地址
var sms_host = 'sms.253.com';
// 发送短信地址
var send_sms_uri = '/msg/send';
// 查询余额地址
var quer... | true |
79772933831034f653d058d5854c652ada4bdbc1 | JavaScript | Rickgg/Kaku | /src/frontend/js/components/searchbar/container.js | UTF-8 | 5,765 | 2.53125 | 3 | [
"MIT"
] | permissive | define(function(require) {
'use strict';
var ClassNames = require('classnames');
var Constants = require('backend/modules/Constants');
var Searcher = require('backend/modules/Searcher');
var TabManager = require('modules/TabManager');
var React = require('react');
const SEARCH_TIMEOUT = 400;
const BLU... | true |
c662fafdfeef5a859ec6d4d0f68e1f648be5fa43 | JavaScript | School-in-the-Cloud/BE | /auth/auth-router.js | UTF-8 | 2,617 | 2.578125 | 3 | [
"MIT",
"GPL-1.0-or-later"
] | permissive | const router = require('express').Router();
const bcrypt = require('bcryptjs');
const Users = require('./auth-model');
const { validateUser, getJwtToken } = require('./auth-helpers');
router.post('/register', async (req, res) => {
let user = req.body;
const validateResults = validateUser(user);
const role = us... | true |
2b6ebda3fe31f5c25faacd91da672a44361ff824 | JavaScript | tylerccarson/CCI | /Chapter1/URLify.js | UTF-8 | 374 | 3.40625 | 3 | [] | no_license | function URLify(string, length) {
string = string.slice(0, length);
var array = string.split('');
for (var i = 0; i < array.length; i++) {
if (array[i] === ' ' && array[i - 1] !== ' ' && array[i + 1] !== ' ') {
array[i] = '%20';
}
}
string = array.join('');
return string;
}
console.log(... | true |
e5903c8cd2753b36553d1f1ec36742e523f52518 | JavaScript | emilykdewitt/movie-history | /src/javascripts/helpers/SMASH.js | UTF-8 | 516 | 3.109375 | 3 | [] | no_license | // A function that takes in the id of the movie that is being clicked (e.g. -LgUlcUF6zA0nGPQzivk)
// It finds that object in firebase using the id
// It uses that id to find the necessary info (name, url, rating, image)
// And then assigns them as new values to the userMovie object in firebase
const userMoviesWithDeta... | true |
59e4174c63bb18cfd01015cefc09bcfb4157b509 | JavaScript | gbuonc/furnichannel | /src/components/book/SelectLocation.js | UTF-8 | 2,969 | 2.671875 | 3 | [] | no_license | import React, {Component} from 'react';
import { Dropdown, Container, Loader, Message, Button, Divider } from 'semantic-ui-react';
class SelectLocation extends Component{
constructor(){
super();
this.state = {
loading: false,
nearestShowRoom: null
}
}
/* get user position via navigator... | true |
8e6fbedeb7ad68ddf1d59dd64aa876719bac9d33 | JavaScript | behappytester/javascriptsamplecodes | /Concept/closure_timeout.js | UTF-8 | 194 | 2.9375 | 3 | [] | no_license | (function test(){
var m = 'mmm';
setTimeout(function(){console.log(m);},1000);
})();
(function test2(){
this.m = 'mmmmmmmmmmm';
setTimeout(function(){console.log(m);},1000);
})();
| true |
afbfad4c50022437543f7695f7f992f668ee82d1 | JavaScript | MarkMoretto/python-examples-main | /notebook-samples/assets/js/check-browser-support.js | UTF-8 | 1,049 | 3.78125 | 4 | [
"MIT"
] | permissive | /**
* Check ECMAScript 6 and 100 compatibility for a given browser.
* This will allow for adjusting code, as necessary, or simply avoiding usage of
* new or outdated features when creating new scripts.
*
* This will use an arrow / anonymous function
* :reference: https://developer.mozilla.org/en-US/docs/Web/Jav... | true |
2904b93cfd00652456ff920818ed6790dc9a5c63 | JavaScript | badunius/mhu-dom | /mDOM/Synth.js | UTF-8 | 1,805 | 3.5 | 4 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | const NODE = Symbol('node')
export class Synth {
/**
* Creates a wrapper around the node
* @param {HTMLElement} node - source node
*/
constructor(node) {
this[NODE] = node
}
/**
* Adds event listener
* @param {String} evt - event name
* @param {function} handler - handler function
*... | true |
3adf5218d170314b7cee371c9e2da1c0ec3d00e9 | JavaScript | garciadelcastillo/sketchpad.js | /docs/walkthrough/tags_labels/sketch.js | UTF-8 | 929 | 3.4375 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | // Create new instance of Sketchpad in target Canvas
var pad = new Sketchpad('sketchpadCanvas');
// Render a fixed text Tag on XY position
var title = new pad.Tag('This is a fixed Tag', 320, 40);
// Create a text Label linked to Node P
// Note how Label.compose takes as arguments all the elements
// the Label is chil... | true |
cccb2e7c58681150ef15255692b591fffbb3496a | JavaScript | lusketeer/aa-works | /w7/w7d1/app/assets/javascripts/pokedex-1C.js | UTF-8 | 580 | 2.59375 | 3 | [] | no_license | Pokedex.RootView.prototype.createPokemon = function (attrs, callback) {
var pokemon = new Pokedex.Models.Pokemon();
var view = this;
pokemon.save(attrs, {
success: function() {
view.pokes.add(pokemon);
view.addPokemonToList(pokemon);
callback(pokemon)
},
error: function() {
con... | true |