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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
8e4dce298ed2bc2350b2ed2b90532cec5a24c128 | JavaScript | hurlockr/authentication-with-passport-clinic | /server/src/routes/api/v1/userSessionsRouter.js | UTF-8 | 1,213 | 2.671875 | 3 | [] | no_license | import express from "express";
import passport from "passport";
const sessionRouter = new express.Router();
sessionRouter.post("/", (req, res, next) => {
return passport.authenticate("local", (err, user) => { // built into passport, uses the strategy we setup to find the user by looking at params
if (err) {
... | true |
db3e88da31e41b149732623042a26ab4b6798658 | JavaScript | joicenunes/hello-nodejs-v2-aula4 | /intro-knex/hello-knex-8.js | UTF-8 | 488 | 3.125 | 3 | [] | no_license | // hello-knex-8.js
"use strict"
const knex = require("./db");
if(!process.argv[2]){
console.log("usage: node hello-knex-8.js <nome>");
process.exit(0);
}
let q = "insert into convidado (nomeconvidado) values (:nome)";
let p = {
nome: process.argv[2]
};
knex.raw(q,p).then(() => {
// você pode encadear consult... | true |
3fe9d8327fa776f9c1094fcb0ed285732a403ad7 | JavaScript | jsdom/jsdom | /lib/jsdom/living/events/EventModifierMixin-impl.js | UTF-8 | 1,157 | 3.234375 | 3 | [
"MIT"
] | permissive | "use strict";
// This mixin doesn't have an IDL equivalent, but since MouseEvent and KeyboardEvent implement getModifierState() the
// same way, its implementation is shared here.
class EventModifierMixinImpl {
// Event's constructor assumes all options correspond to IDL attributes with the same names, and sets the... | true |
dc7eafe9cef6b8d349d6e538ea18dde97f90e266 | JavaScript | sajiro/ideas | /src/App.js | UTF-8 | 2,963 | 2.828125 | 3 | [] | no_license | import React, { useState , useRef} from 'react';
import { Icon } from 'antd'
import './App.css';
const axios = require('axios');
function App() {
const [ideas, setIdeas] = useState([{
id: 0,
title: "title 0",
created_date: "2018-05-14T01:29:21.000Z",
body: "body 0"
},
{
id: 1,
title: "... | true |
f7db5614c09a04e89c0cad864c8bafd6c953a46c | JavaScript | ldobbelsteen/eyevis | /src/data.js | UTF-8 | 2,166 | 2.984375 | 3 | [
"MIT"
] | permissive | const fs = require("fs");
const path = require("path");
const admzip = require("adm-zip");
// Paths of storage location of datasets and stimuli
const datasetsDir = path.join(__dirname, "/public/datasets/");
const stimuliDir = path.join(__dirname, "/public/stimuli/");
// Create storage locations if they don't yet exis... | true |
b3922f84e80773dd4f188c49cfd47976616e89a7 | JavaScript | JustBucket/bucketmatch | /server-sql/controllers/ua-controller.js | UTF-8 | 2,942 | 2.546875 | 3 | [] | no_license | "use strict";
const database = require('../models/database');
const sequelize = database.sequelize;
const UserActivity = database.UserActivity;
const Activity = database.Activity;
const FBUser = database.FBUser;
function index(req, res) { // displays all activities associated with users? for devs not production
Use... | true |
43f0de4b632e23b2effecad9b1572885de9277e4 | JavaScript | OctoberCity/HTML5fish | /js/smfish.js | UTF-8 | 3,102 | 2.84375 | 3 | [] | no_license | var smFish=function(){
this.x ;
this.y ;
this.smfishBody=[];
this.eye=[];
this.smfishTail=[];
this.angle ;
//尾巴摆动的变量
this.timers;
this.pictureNum;
//眼睛持续的变量
this.eyeTimers;
this.eyePictureNum;
this.eyeInterval;//持续的时间
//身体变化的变量
this.bodyTimers;
this.bodyPictureNum;
}... | true |
1f70526362d4ef20ecb169105a30985432a414df | JavaScript | jayvolr/BPCTools | /public/master.js | UTF-8 | 183 | 2.609375 | 3 | [] | no_license | var ribbon = document.getElementById('infoRibbon') || document.getElementById('errorRibbon');
if (!!ribbon) {
setTimeout(function(){
ribbon.style.top = '-100px';
}, 1200);
}
| true |
ab370186d6784262b18e15b633e18050f1a41bb4 | JavaScript | pradobruno/Curso-Web_JS-Udemy | /exerciciosJS/24.js | UTF-8 | 496 | 3.53125 | 4 | [] | no_license | function contarCaractere(caractereBuscado, frase) {
let contador = 0
for (let i = 0; i < frase.length; i++)
if (frase.charAt(i) === caractereBuscado)
contador++
return console.log(contador)
}
contarCaractere("r", "A sorte favorece os audazes") // retornará 2
contarCaractere("c", "Conhece-te a ti me... | true |
7a3b5b2e372f7c6bff82d80bca9320384687ef43 | JavaScript | jcsh4326/jchaos | /chaos/src/main/webapp/statics/js/utils/animate/chaos-animate.js | UTF-8 | 859 | 2.53125 | 3 | [
"MIT"
] | permissive | /**
* @project jchaos
* @package
* @file chaos-animate
* Created by <a href="mailto:jincheng.jcs@gmail.com">瑾诚</a> on 2016/1/21.
**/
'use strict';
;(function( $ ){
var defaultTurnOpts = {
speed: 500,
type: 'fade',
replace: ''
};
var _turn = function(replace, opts){
var ... | true |
9673bdec85138a67cf23f72cfcf7ea75bb724d70 | JavaScript | maximum454/babysafe.pro | /js/calc.js | UTF-8 | 14,335 | 3.0625 | 3 | [] | no_license | const price = 19990;
const priceFormOrder = document.getElementById('price-form-order');
const step1 = document.getElementById('step1');
const step2 = document.getElementById('step2');
const step3 = document.getElementById('step3');
const step4 = document.getElementById('step4');
const step5 = document.getElementById('... | true |
0d5c4d5dc43d3e7655de533040e83ab45a2e43c2 | JavaScript | AashirSohail/realtime-chat-mern | /src/components/Chat/Chat.js | UTF-8 | 1,673 | 2.578125 | 3 | [] | no_license | import React, {useState, useEffect} from 'react';
import socketio from 'socket.io-client';
import queryString from 'query-string';
import './chat.css';
import InfoBar from '../Infobar/infobar';
import Input from '../Input/input';
import Messages from '../Messages/messages';
let socket;
const Chat = ()... | true |
22fd8e2946c75159f5443f8ec6ac54179eb4c20f | JavaScript | deytonk/javascript-workbook | /07week/time-line/src/App.js | UTF-8 | 2,757 | 3.125 | 3 | [] | no_license | import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
class App extends Component {
constructor(props) {
super(props);
this.state = {
timelineData:[
{name: 'renee', post: 'I love kitties', id: 1},
{name: 'stevie', post: 'I love dogs', id: 2},
... | true |
30fd2d5cdea44ec0c6e710f08dee75a626db38b0 | JavaScript | quantum-rose/mini-tools | /create-resource-array/__create-resource-array-mp.js | UTF-8 | 1,415 | 3.09375 | 3 | [] | no_license | /**
* 创建项目所需的图片预加载列表,适用于微信小程序
*
* 需在 node 环境中运行!
* 本工具会深度遍历当前目录下所有图片类文件的名称,并输出到目标文件中
* 输出文件的内容为 js 代码
* 示例:“export default ['https://cdn.com/imgs/loading.png']”
* 因此可供其他 js 文件以符合 ES6 模块化规范的方式引入
*/
const fs = require('fs');
const path = require('path');
// 要排除的文件或文件夹
const EXCLUDE = /^dir1|dir2|exclude\.png$/;... | true |
876d0c3a723886811632355100dfccd26e3b4906 | JavaScript | KolinRobinson/learn-three-js | /demo-5/js/app.js | UTF-8 | 10,473 | 2.546875 | 3 | [] | no_license | import { GUI } from './dat.gui.module.js';
function main() {
const canvas = document.querySelector('#demo');
const renderer = new THREE.WebGLRenderer({ canvas });
const gui = new GUI();
const fov = 40; //Поле зрения в градусах
const aspect = 2; // соотношение сторон холста
const near = 0.1;
... | true |
3b5e43a2b71e41942b94b0349c32328691c4de85 | JavaScript | Deddy389/SaklarApp | /web_interface/js/devices.js | UTF-8 | 10,731 | 2.53125 | 3 | [
"MIT"
] | permissive | var IP_RANGE = '192.168.43.1-254';
var IP_LIST = ['192.168.43.2'];
function mapObject(object, callback) {
return Object.keys(object).map(function (key) {
return callback(key, object[key]);
});
};
function isFunction(functionToCheck) {
var getType = {};
return functionToCheck && getType.toString.call(function... | true |
4498a98cfe9a081492eef652b0eb3a403c8600e7 | JavaScript | emarifer/ejercicios_dom | /dom/teclado.js | UTF-8 | 1,912 | 3.0625 | 3 | [] | no_license | const d = document;
let x = 0,
y = 0;
export function moveBall(e, ball, stage) {
const $ball = d.querySelector(ball),
$stage = d.querySelector(stage),
$limitsBall = $ball.getBoundingClientRect(),
$limitsStage = $stage.getBoundingClientRect();
// console.log(e.keyCode);
// cons... | true |
d9604ccd4b4ede20d82157b37f9cb71403fd9705 | JavaScript | park002/javascript--practice | /es6-study/chap-1/let-const/main.js | UTF-8 | 160 | 3.09375 | 3 | [] | no_license | 'use strict';
let a = +prompt('a?', '');
switch (a) {
case 0: alert(0); break;
case 1: alert(1); break;
case 2:
case 3:
alert(`2,3`);
} | true |
722efda7178154837a57132e930d1aa4e3d59fff | JavaScript | xiaoyuqing/document-editor | /src/mock/mock.js | UTF-8 | 546 | 2.578125 | 3 | [
"MIT"
] | permissive | //引入mockjs文件
let Mock = require('mockjs');
let Random = Mock.Random;
module.exports = function() {
var data = {
headers: ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W"," X", "Y", "Z", "AA", "AB"],
files: []
};
//动态生成10条新闻数据
for (var... | true |
8458c313eb8310e8dab3245b73e6f67b36ca1674 | JavaScript | homonecloco/biojs2 | /biojs-vis-track/utils/d3_utils.js | UTF-8 | 1,013 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive | d3.selection.prototype.move_to_front = function() {
return this.each(function() {
this.parentNode.appendChild(this);
});
};
d3.selection.prototype.selectAncestor = function(type) {
type = type.toLowerCase();
var selfNode = this.node();
if (selfNode.parentNode === null) {
console.log("No mor... | true |
fbea6dc9aa4733516bf53094521e51ebfdb6d1dd | JavaScript | hackages-nl/github-profile | /index.js | UTF-8 | 335 | 2.75 | 3 | [] | no_license | // const responsePromise = fetch("https://api.github.com/users/davyengone");
// responsePromise
// .then(function (response) {
// const dataPromise = response.json();
// return dataPromise;
// })
// .then(function (data) {
// console.log(data);
// })
// .catch(function (err) {
// console.log(... | true |
8de2127823db0618f2c45d8eda89f0ec2c00eabd | JavaScript | yuku/old-textcomplete | /src/dropdown_item.js | UTF-8 | 3,834 | 2.875 | 3 | [
"MIT"
] | permissive | // @flow
import SearchResult from "./search_result"
export const DEFAULT_CLASS_NAME = "textcomplete-item"
const CALLBACK_METHODS = ["onClick", "onMouseover"]
/** @typedef */
export type DropdownItemOptions = {
className?: string,
}
// Declare interface instead of importing Dropdown itself to prevent circular depe... | true |
d73eecffb78486ccda4698677ab8b09d91f4d24e | JavaScript | kristenlk/node-http-all-together | /basketball-api/models/team.js | UTF-8 | 3,106 | 3.4375 | 3 | [] | no_license | 'use strict';
// Defining two schemas: a player schema and a team schema
module.exports = function(mongoose){
var Schema = mongoose.Schema;
var playerSchema = new Schema({
name: {
type: String,
required: true
},
// setting up a dependency. This is the mongoDB ID a document gets. We are... | true |
bcf7d31a18bde5f9c7516af1e512278fe255e00c | JavaScript | Little-Phoenix/react_frame | /src/redux-act/redux-act.js | UTF-8 | 743 | 2.71875 | 3 | [] | no_license | import { createStore } from 'redux'
import { createAction, createReducer } from 'redux-act'
const add = createAction('add some duff');
const increment = createAction('增加 increment')
const decrement = createAction('减小 decrement')
const counterReducer = createReducer({
[increment] : (state) => state + 1,
[decrement... | true |
d2fe9f44d366fecba22046f10c88cb89bfc43e70 | JavaScript | s2iwi2s/fasttrackd-student-work | /group-final-january-2021/client/src/services/teamService.js | UTF-8 | 1,262 | 2.6875 | 3 | [] | no_license | import axios from 'axios'
export const getTeamProjectsRequest = async (teamName, companyName) => {
let requestLink = "http://localhost:8080/teams/" + companyName + "/" + teamName + "/projects"
let response = await axios.get(requestLink)
console.log(response.data)
let projectNames = []
let project... | true |
37a222081bfd33fa21c5e2ff18af31b260fe7905 | JavaScript | kelvinatorr/relationshipanalytics | /js/loginScript.js | UTF-8 | 1,623 | 2.53125 | 3 | [
"MIT"
] | permissive | $(document).ready(function () {
$('input').each(function () {
$(this).on('focus', function () {
$(this).parent('.css').addClass('labelTop');
$(this).parent('.css').addClass('active');
});
$(this).on('blur', function () {
if ($(this).val().length == 0) {... | true |
802d7974f85d5f483db282000af58e277c6615c9 | JavaScript | tlatjdgh3778/Movie-Web-App | /src/store/modules/detail.js | UTF-8 | 6,009 | 2.59375 | 3 | [
"MIT"
] | permissive | // detail module
// ducks pattern
import axios from "axios";
import produce from "immer";
import { API_KEY } from "utils/constants";
// detail, cast, video, reco
export const FETCH_DETAIL_REQUEST = "detail/FETCH_DETAIL_REQUEST";
export const FETCH_DETAIL_SUCCESS = "detail/FETCH_DETAIL_SUCCESS";
export const FETCH_DETA... | true |
a77d7709751b2ff408635338cbb23cef80984a4c | JavaScript | OdysseyUA/JavaScript | /Head First O'Reilly/Unit 11/js/binding.js | UTF-8 | 1,232 | 3.84375 | 4 | [] | no_license | var theString = "Global string...";
function outer() {
var theString = "Inner string";
function inner() {
//console.log(theString);
return theString;
}
return inner;
}
var of = outer();
var result = of();
console.log(result);
function makeCounter() {
var count = 0;
funct... | true |
1950b4d97b0db3945e9cb9870342a2cbd2ef00e3 | JavaScript | aandrusky/Holiday-Road | /scripts/weather/WeatherList.js | UTF-8 | 1,653 | 3.046875 | 3 | [] | no_license | import { useParks } from "../parks/ParkProvider.js";
import { getWeatherItems } from "../weather/WeatherProvider.js"
import { WeatherBlock } from "./WeatherBlock.js";
import { useWeatherItems } from "./WeatherProvider.js"
const eventHub = document.querySelector(".container")
const weatherContainer = document.querySele... | true |
64b726db620e4c5f00967dfa6e247d6169c43c72 | JavaScript | Murugar/ReactCrudPostgres | /client/components/SingleUser.jsx | UTF-8 | 3,974 | 2.53125 | 3 | [] | no_license | import React, { Component } from 'react'
import axios from 'axios'
export default class SingleUser extends Component {
constructor(props) {
super(props)
this.state = {
name: '',
email: '',
phone: '',
editMode: false
}
this.handleChange... | true |
93fcc671d86061bf4e763ae56c6c1fac991017ed | JavaScript | yofine/qsort.js | /lib/filter.js | UTF-8 | 1,508 | 3.140625 | 3 | [
"MIT"
] | permissive | //filter
function filter(arg) {
var ERROR = {
err1 : 'NOT ARRAY OR ATRING',
err2 : 'NOT NUMARR',
err3 : 'NOT NUMSTR'
}
var wyr = Object.prototype.toString.call(arg);
if (wyr !== '[object Array]' && wyr !== '[object String]') {
throw err.err1;
}
if (wyr === '[object Array]') {
switch (... | true |
f85bcc2b91b0e0d0d8618e80aae6fb02d9c876eb | JavaScript | abdenny/react | /class3/src/components/Todo.js | UTF-8 | 1,465 | 2.90625 | 3 | [] | no_license | import React, { Component } from 'react';
class Todo extends Component {
constructor(props) {
super(props);
this.state = {
task: '',
tasks: [],
completedTask: ''
};
}
addNewTask = e => {
this.setState({
task: e.target.value
});
};
submitNewTask = e => {
this.... | true |
e3126d5e0bdea8339364e0b9dc80f90854857c96 | JavaScript | bowdwin/employee-tracker | /db/Database.js | UTF-8 | 1,124 | 2.625 | 3 | [] | no_license | const connection = require("./connection");
class Database {
constructor() {
this.connection = connection;
}
createDepartments(department) {
return this.connection.query("INSERT INTO departments SET ?", department);
}
createEmployee(employee) {
return this.connection.query("INSERT INTO employees... | true |
c3e4231438de5996308d4a3dbc6eb0f777bba8d7 | JavaScript | KajavathananM/Code_ComplexitySPM_Improved | /Code_Complexity_SPM/Back_End/Complexity_Algorithm/ComplexityByType.js | UTF-8 | 2,811 | 3.375 | 3 | [] | no_license |
var complexityByType = function (lineArr) {
var ctc_arr = [];
for (i = 0; i < lineArr.length; i++) {
var count = 0;
if (lineArr[i].includes("if")) {
count++;
// console.log(count)
if (lineArr[i].includes("&") || lineArr[i].includes("|")) {
v... | true |
54211ef89874472491760c6e8049d942b70e4fe3 | JavaScript | RiverZX/BaiduIfe | /js/a.js | UTF-8 | 5,630 | 2.953125 | 3 | [] | no_license | var openList = []; //开启列表,存节点Node
var closeList = []; //关闭列表
var COST_STRAIGHT = 1; //垂直方向或水平方向移动的路径评分
var row; //行
var column; //列
var Shortpath = [];
//从起点(x1,y1)查找目标(x2,y2),(-1:错误,0:没找到,1:找到了)
function search1(x1, y1, x2, y2) {
if (x1 < 0 || x1 >= row || x2 < 0 || x2 >= row || y1 < 0 || y1 >= column || y2 < 0 || y... | true |
013e13f79fff2bb0274c5044787fcc50a7040f9a | JavaScript | NylipekWolf/My-App-deezer_V | /src/store/reducers/songsReducer.js | UTF-8 | 767 | 2.71875 | 3 | [] | no_license | const initState = {
songs: [],
index: 0,
lastQuery: "",
errorMessage: "",
isFetching: false
};
const songsReducer = (state = initState, action) => {
switch (action.type) {
case "FETCHING_SONGS_START":
return {
...state,
isFetching: true
};
case "FETCHING_SONGS_SUCCESS":
... | true |
01b52afab2eae8a01cf134cb00399c3e5bd036ae | JavaScript | HDPham/doughnutworry | /scripts/script.js | UTF-8 | 7,067 | 2.828125 | 3 | [] | no_license | // onclick="$('#plainglaze').show()"
// onclick="$('#chocosprinkle').hide()"
// function ReceivedImage(data){
// console.log(data);
// $("#donutimage").attr("src", data.url);
// $("#frostingimage").attr("src", data.urlf);
// }
function ReceivedDonut(data){
console.log(data);
$("#donutimage").attr("src", da... | true |
5c31d1d0c6221deb9a3b0754b716c732e2295bbb | JavaScript | Zandvoort-Beste/maaltijd-keuze | /main.js | UTF-8 | 6,618 | 3.21875 | 3 | [] | no_license | const prompt = require('prompt-sync')({sigint: true});
const nieuwGerecht = require('./nieuw-gerecht');
const {_gerechten} = require('./gerechten');
let vleesGerechten = [];
let visGerechten = [];
let vegaGerechten = [];
let bijGerechten = [];
let kiesGerecht = [];
// Mijn befaamde pyPop functie!
const pyPop = (array,... | true |
6c0546c73dbac6fb9ab99d7a180cf1a3be8649e9 | JavaScript | jphacks/KB_1907 | /app/static/js/overview.js | UTF-8 | 3,576 | 2.78125 | 3 | [
"MIT"
] | permissive | var json = document.getElementById("json-data").textContent;
var obj = JSON.parse(json);
console.log(obj);
var topics = obj.topics;
var topic1 = document.getElementById("topic1");
topic1.textContent = topics[0];
var topic2 = document.getElementById("topic2");
topic2.textContent = topics[1];
var topic3 = document.getEl... | true |
019494cf7cbf6fb223900a6dbdc06f2bb32d9fad | JavaScript | Rachel-Zabib/M.A-store-backend | /controllers/usersController.js | UTF-8 | 7,200 | 2.53125 | 3 | [] | no_license |
let userModel=require("../models/userModel")
const bcrypt = require('bcrypt');
exports.findAllUsers= async (req,res)=>{
// try{
// let users=await userModel.find({});
// return res.json({error:false,message:"success",users})
// }
// catch(err){
// return res.json({error:true,messag... | true |
6add662f4f43cb1773b773c485a46d2ac4f98b79 | JavaScript | emiltsokov/redux-weather | /src/components/chart.js | UTF-8 | 703 | 2.59375 | 3 | [
"MIT"
] | permissive | import React from 'react';
import {Sparklines, SparklinesLine, SparklinesReferenceLine} from 'react-sparklines';
import _ from 'lodash';
function average(data) {
const sum = data.reduce((a,b) =>{
return a + b;
}, 0)
// console.log(sum);
// console.log('vanila', Math.round(sum/data.length));
// console.lo... | true |
cf85abd89ca42b47ec84eea4c984a9ff6f4d20f9 | JavaScript | tomhi/my | /Public/assets/scripts/jsm/util/RoleMap.js | UTF-8 | 2,463 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive | define("jsm/util/RoleMap",[],function(){
"use strict";
/**
* Reserved roles names are ["append","delete","get","set","getAll","has","set","length","hasOwnProperty"]
* @namespace jsm.util
* @class RoleMap
* @constructor
* @example
<pre><code>var roles=new RoleMap();
roles.set("master","Master");
ro... | true |
9bd201127f47b65c3a626dd8bba2177c46d1c100 | JavaScript | OyvindSabo/general-purpose-digital-shadow | /src/libraries/observable/utils.js | UTF-8 | 11,417 | 2.875 | 3 | [] | no_license | const Observable = include('src/libraries/observable/Observable.js');
const valueOf$ = (observable$) =>
observable$ instanceof Observable ? observable$.value : observable$;
const isObservable$ = (observable$) => observable$ instanceof Observable;
// Currently needs at least two arguments
const add$ = (...observabl... | true |
53e4843536df07866cf98d6a7b807307d5462959 | JavaScript | Chris-Bortel-401-advanced-javascript/dsa-practice | /code-challenges/linked-list/401-final-exam/linkedList.js | UTF-8 | 2,389 | 4 | 4 | [
"MIT"
] | permissive | 'use strict';
class Node {
constructor(value) {
this.value = value;
this.next = null;
}
}
class LinkedList{
constructor() {
this.head = null;
}
append(value) {
let node = new Node(value);
if (!this.head) {
this.head = node;
} else {
let current = this.head;
while ... | true |
f14a37bd8231d94e7096629a4cd21b39defb7997 | JavaScript | SophiaL1024/Udemy-Algorithm-Data-Structure-Excercise | /recursion/capitalizeWords.js | UTF-8 | 627 | 4.78125 | 5 | [] | no_license | /*
Write a recursive function called capitalizeWords.Given an array of words, return a new array containing each word capitalized.
*/
const capitalizeWords = (array)=>{
//base case
if (array.length === 1) {
return [array[0].toUpperCase()];
}
//assign res to the first element of the original array
const r... | true |
32d4f14b7d24f8e12330c6f49116cc8ec223ddac | JavaScript | wahyunurarizky/test-cud-nutech | /public/js/login.js | UTF-8 | 814 | 2.640625 | 3 | [] | no_license | // disable es-lint
import axios from 'axios';
export const login = async (username, password) => {
try {
console.log('asdsad');
const res = await axios({
method: 'POST',
url: '/api/v1/users/login',
data: {
username,
password,
},
});
if (res.data.status === 'suc... | true |
285235f37b30b3ca3f62e16489f0cfa4d96b4664 | JavaScript | sankarkota555/Brinz | /Brinz/BrinzWeb/src/main/webapp/resources/scripts/main/billling/billing.service.js | UTF-8 | 2,307 | 2.765625 | 3 | [] | no_license | "use strict";
{
function billingService($http) {
const me = this;
/**
* Function to save bill
*/
me.saveBill = function (bill) {
console.log("bill received in service: ");
console.log(bill);
bill = prepareBillDetails(bill);
... | true |
651880c05f46f336b48361eefafa4b754e0b6fef | JavaScript | rymo4/ColorSpace | /public/collision_detector.js | UTF-8 | 4,936 | 2.703125 | 3 | [] | no_license | window.CS = window.CS || {};
CS.collision_detector = CS.collision_detector || {};
//DIRECTION NUMBERS, THEY ARE CORRELATED TO THE ORDER OF THE VECTORS BELOW
var RIGHT = 0,
UP = 1,
LEFT = 2,
DOWN = 3,
UP_RIGHT = 4,
UP_LEFT = 5,
DOWN_LEFT = 6,
DOWN_RIGHT... | true |
78d69039ae1cf7c2fdd1287cebc2e5466865cc89 | JavaScript | curalate/specs | /server/ec2.js | UTF-8 | 946 | 2.625 | 3 | [
"MIT"
] | permissive |
'use strict'
let Promise = require('bluebird');
module.exports = EC2;
/**
* Create a new EC2 client.
*
* @param {AWS} aws - an aws client
*/
function EC2(aws){
this.ec2 = new aws.EC2();
}
/** Return a promise to return ec2 instances
* @public
*
* */
EC2.prototype.instances = function(ec2Instances){
... | true |
ee7b35ca42a33fcd252674e186b207fb645d0ba3 | JavaScript | lvis529/foodies_app | /index.js | UTF-8 | 11,708 | 2.53125 | 3 | [] | no_license | const express=require('express')
const path= require('path')
const app=express()
const bcrypt=require('bcryptjs')
const mongoose=require('mongoose')
const User=require('./model/user')
const Prof=require('./model/profile')
const Post=require('./model/post')
const port = process.env.PORT;
console.log(`Your port is ${port... | true |
f271577d9fd2d61813f47374f4ac071f1a42c531 | JavaScript | rai200890/bookmark-interface | /app/controllers/bookmark.list.controller.js | UTF-8 | 1,823 | 2.515625 | 3 | [] | no_license | function BookmarkListController(Bookmark) {
var ctrl = this;
ctrl.bookmarks = [];
ctrl.pagination = {
per_page: 10,
page: 1
};
ctrl.alerts = [];
ctrl.edit = function(bookmark) {
bookmark.editing = true;
};
ctrl.save = function(bookmark) {
Bookmark.upda... | true |
2139af730012e1f69657126e08d0fc5c413516ac | JavaScript | olleboll/demo | /src/game/weather/snow.js | UTF-8 | 1,867 | 2.75 | 3 | [] | no_license | import PIXI from 'engine';
const createSnow = ({ position, width, height, intensity, container }) => {
const flakes = [];
const particleContainer = new PIXI.Container(); //new new PIXI.particles.ParticleContainer()
const bounds = {
x: position.x,
y: position.y,
width,
height,
};
const rect = ... | true |
4e4d0ba56c88b96c52aa2a330bb8a26bfbfe4a94 | JavaScript | CodeCoreYVR/awesome_answers_react_november_2020 | /src/components/HookCurrentDateTime.js | UTF-8 | 1,078 | 3.375 | 3 | [] | no_license | import { useState, useEffect } from 'react';
const HookCurrentDateTime = () => {
const [date, setDate] = useState(new Date())
const [date2, setDate2] = useState(new Date())
const [a, setA] = useState(true);
// the useState hook accepts 1 argument: the initial state
// it returns an array with two elements:
... | true |
7bf8113b1f981f39b7b40437dd76d6c79690d501 | JavaScript | kdszafranski/sigma-mongoose-intro-lecture | /server/public/scripts/controllers/people.controller.js | UTF-8 | 1,459 | 2.796875 | 3 | [] | no_license | myApp.controller('PeopleController', ['$http', function($http) {
var self = this;
self.people = [];
self.newPerson = {};
// Start app
getData();
// Get all people
function getData() {
$http.get('/person')
.then(function(response) {
self.people = response.data;
},
... | true |
73da37a7d79d807d129abc84bff089c417df1bbe | JavaScript | lancewux/react16-webpack4 | /src/client/container/ErrorBoundary.jsx | UTF-8 | 1,145 | 2.546875 | 3 | [] | no_license | import React, { Component } from 'react';
class ErrorBoundary extends Component {
constructor(props) {
super(props);
this.state = { hasError: false };
}
componentDidCatch(error, info) {
// Display fallback UI
this.setState({ hasError: true });
// You can also log the error to an error report... | true |
f590f9ee8b142047055647b8b8e949c06c1b37c7 | JavaScript | miguelriverarios/MRR-Simple-Inject-Library | /src/injection.js | UTF-8 | 4,446 | 3.203125 | 3 | [
"MIT"
] | permissive | "use strict";
((w) => {
/** Class representing the overall DI framework */
class SimpleInject {
constructor() {
// Initializes the IOC container
this.dictionary = {};
// Error definitions
this.ERROR_CONSTRUCTOR =
"Feature Limit: Only constructors are currently supported.";
... | true |
111439e8f7e2280b18c6c58db201b8d4bb1210d3 | JavaScript | danialmalik/mastering-node | /chapter-2/defferedExecution/nextTick.js | UTF-8 | 295 | 2.875 | 3 | [] | no_license | var events = require('events');
function getEmitter() {
var emitter = new events.EventEmitter();
process.nextTick(function () {
emitter.emit('start');
});
return emitter;
}
var myEmitter = getEmitter();
myEmitter.on('start', function () {
console.log('Started');
})
| true |
1e79d51db4d626ed3c0daf2eee3115a7efac26c5 | JavaScript | Uki99/mini-web-shop | /src/public/js/script.js | UTF-8 | 2,068 | 3.21875 | 3 | [
"MIT"
] | permissive | //Potrebne promenljive
let sortiranje = document.querySelector("#sortiranje");
let login = document.querySelector("#login");
let zatvori_formu = document.querySelector("#x_dugme");
let pretraga = document.querySelector("#pretraga");
//Search listener. Kad se pritisne enter
pretraga.addEventListener("keyup", fun... | true |
549c2033500710fb0f7961a18ab63fe0795beaf9 | JavaScript | sodongit/hastings-direct | /src/shared/legal-text/legal-text.js | UTF-8 | 515 | 2.703125 | 3 | [] | no_license | import React, {useEffect, useState} from "react";
import './legal-text.scss';
const LegalText = ({legalTextArray = []}) => {
const [textArray, setText] = useState([]);
useEffect(() => {
if (legalTextArray.length > 0) {
setText(legalTextArray);
}
}, [legalTextArray]);
retu... | true |
4eeac11f44e584902343dfff70ef3a7a6d9b0bde | JavaScript | Dmitry-Sm/flow-builder | /src/js/controls.js | UTF-8 | 2,823 | 2.703125 | 3 | [] | no_license | import * as THREE from 'three';
const canvas = document.querySelector('.main-canvas');
export class Controls extends THREE.EventDispatcher {
scene;
// STATE = { NONE: - 1, PAN: 0 };
// state = this.STATE.NONE;
scroll = 1;
pressed = false;
moveStart = new THREE.Vector2(0, 0);
... | true |
0d8993558fe3854eb8f5954e14f7177ec9c50c6f | JavaScript | infotechvedas/localdatetimetogmtdatetime | /js/membership-script.js | UTF-8 | 483 | 2.796875 | 3 | [] | no_license | $(document).ready(function(){
var current_date = new Date();
var gmt_offset = current_date.getTimezoneOffset( ) / 60;
try{
$('#timezoneOffset').val(gmt_offset);
document.getElementById('timezoneOffsetId').innerHTML = gmt_offset;
var localTimeZoneDate = new Date();
document.getElementById('c... | true |
e9c43f277ea6e86449d224a8b07f37485926cfa4 | JavaScript | besnik/fractals | /tree_fractal_forest/configGenerator.js | UTF-8 | 2,160 | 3.421875 | 3 | [
"MIT"
] | permissive | /*
configGenerator class
generates array of tree fractals configuration
public methods
generate: generate array of fracal configuraiton
******************************************************************/
function generator() {
this.defaultConfig = {
items: 10,
maxDepth: { min: 4, max: 10 },
branchLength: {... | true |
7d7315b9478c238bc99fb533ea2c7d8a9c7cf6fa | JavaScript | horoeka-2021/Gilfoyle | /tests/path.test.js | UTF-8 | 862 | 2.765625 | 3 | [] | no_license | const request = require('supertest')
const { getData, updateData } = require("../utils");
const server = require('../server')
//home
test('GET / home returns correct response', (done) => {
request(server)
.get('/')
.expect(200)
.end((err, res) => {
expect(err).toBeNull()
expect(res.text).to... | true |
0be09588fa8042b606d6163ed99c2b36db4994ee | JavaScript | Deeathwiing/VSTU-Lab | /js/Registration.js | UTF-8 | 1,179 | 2.796875 | 3 | [] | no_license | /* eslint-disable no-plusplus */
class User {
constructor(email, firstName, lastName, password) {
this.firstName = firstName;
this.lastName = lastName;
this.email = email;
this.password = password;
this.deleteAccountRequest = false;
this.administration = false;
}
}
let BDusers = [];
BDusers ... | true |
7a8b9c4557e5d590f326091a6fd4780186100cca | JavaScript | mbinkhorst/actiz_en | /app/scripts/Components/CaseSelector.js | UTF-8 | 5,378 | 2.546875 | 3 | [] | no_license | 'use strict';
(function() {
function CaseSelector($element) {
var self = this;
// Store target
this.$element = $element;
// Create the items
this.items = [];
this.__currentFocus = false;
var info = I18n.get('cases');
this.$items = this.$element.find('.case').each(function(index, el) {
// Crea... | true |
9305c9207c683afb576d9fd013cd99178aef4b6d | JavaScript | fibarrah20/JavaScriptMaster | /curso_javascript_/008_Funciones/02_/file.js | UTF-8 | 602 | 3.75 | 4 | [] | no_license | 'use strict'
console.clear();
// Funciones
var numero1 = 10;
var numero2 = 10;
CalcOperaciones(numero1,numero2);
function CalcOperaciones(numero1, numero2){
console.log("Suma: " + (numero1 + numero2));
console.log("Resta: " + (numero1 - numero2));
console.log("Multiplicacion: " + (numero1 * ... | true |
774bc4e10de533089bfb8c165b2c466d1934748a | JavaScript | moshOntong-IT/mosh-portfolio | /pages/blog.js | UTF-8 | 289 | 2.625 | 3 | [] | no_license | let logo = document.querySelector(".logo-home");
let mediaQuery = (size) => {
if (size.matches) {
logo.src = "../assets/logo-small.svg";
} else {
logo.src = "../assets/logo.svg";
}
};
var x = window.matchMedia("(max-width: 768px)");
mediaQuery(x);
x.onchange = mediaQuery;
| true |
bf8dfd9b8217ee3a541c8d3913225be6534f29f6 | JavaScript | ForbesLindesay/intro-to-react | /src/steps/04-functional-components/test.js | UTF-8 | 1,409 | 2.84375 | 3 | [] | no_license | const nodeVersion = process.version;
const match = /^v(\d+)\.(\d+)\.(\d+)$/.exec(nodeVersion);
if (!match) {
printNodeAdvice();
}
const major = parseInt(match[1], 10);
const minor = parseInt(match[1], 10);
const patch = parseInt(match[1], 10);
if (major !== 8 && major !== 10) {
printNodeAdvice();
}
if (major === 8 ... | true |
5f1d7d3c474a87b91e62058abfe7cbb3da1880b1 | JavaScript | Delendik/news-explorer-frontend | /src/components/Login/index.jsx | UTF-8 | 1,360 | 2.53125 | 3 | [] | no_license | import React, { useState } from 'react';
import PopupWithForm from '../PopupWithForm';
import './index.css';
function Login({isOpenLogin, handlePopupRegister, closePopup, onLogin}){
const [data, setData] = useState({
email: '',
password: '',
});
const [active, setActive] = useState(false)
const [error,... | true |
35f36a565eefc882960644323e8de432c93dd1b8 | JavaScript | taylorc38/soundboard | /soundboard-server/controllers/api.js | UTF-8 | 3,863 | 2.59375 | 3 | [
"MIT"
] | permissive | // Models
const User = require('../models/User');
const SoundFile = require('../models/SoundFile');
const fs = require('fs');
const passport = require('passport');
const jwt = require('jsonwebtoken');
const _ = require('lodash');
const config = require('../config/main');
/**
* GET /api/upload
* File Upload API example... | true |
141f11306251a638a843471303c878bcf36b2039 | JavaScript | Graces-Toy-Barn/Graces-Toy-Barn | /client/components/GuestOrderConfirmation.js | UTF-8 | 985 | 2.609375 | 3 | [
"MIT"
] | permissive | import React from "react";
import penniesToDollars from "../Functions/PenniesToDollars";
const GuestOrderConfirmation = (props) => {
const localCart = JSON.parse(window.localStorage.getItem("cart"));
const { email, firstName, lastName, streetAddress, state, city, zipCode } =
props;
const { total, cartItems }... | true |
7ea9e8a0c210f65cf34c6a86208208fefaaefbd7 | JavaScript | egarim/BlazorJavaScriptInterop | /BlazorJavaScriptInterop/wwwroot/js/Signature.js | UTF-8 | 1,310 | 2.6875 | 3 | [] | no_license |
function ShowMessage(MessageText) {
alert(MessageText);
}
function InitSignature(SignatureModel,w,h) {
var canvas = document.querySelector("canvas");
var DataArea = document.getElementById("DataArea");
var SaveButton = document.getElementById("Save");
var ClearButton = document.getElement... | true |
fbd75bc85c293832d116e7d88324694f1010b035 | JavaScript | wzht1991/Course | /src/controller/student.js | UTF-8 | 2,621 | 2.703125 | 3 | [] | no_license | const Student =require('../model/student');
const StudentService=require('../service/StudentService');
const {Formatresponse}=require('../service/Formatresponse');
const Course=require("../model/course");
async function Register (req,res){
const{fistname,lastname,email,password,phone,status}=req.body;
// 是否有人注... | true |
fcee268b18b9b3748bb7369277f2bdaf04d4e3f7 | JavaScript | wayne-kim/Desktop-application-development-using-Javascript-and-Node.js | /NaN.js | UTF-8 | 172 | 2.828125 | 3 | [] | no_license | // console.log(NaN === NaN);
// console.log(NaN == NaN);
console.log(isNaN(NaN));
console.log(isNaN("1"));
console.log(Number.isNaN(NaN));
console.log(Number.isNaN("1")); | true |
d59f5e9a4c2854a7b6df8c9348c4de71e3a81777 | JavaScript | B00262505/Project-Management-Website-AndyFranklin-Honours-Project | /js/piechart.js | UTF-8 | 3,068 | 2.78125 | 3 | [] | no_license | /**
* Created by Andy on 30/01/2017.
*/
var userTaskCount = [];
var users = [];
var dataSet = [];
var dataFromServer = false;
function initPie(){
//Get all project users.
$.post("project.php",{action:'getuserlist'},function (result) {
users = JSON.parse(result);
for (var x=0 ; x<users.length; ... | true |
b8008102abb06f00ac0dcd6b88c0c2b8fb88e013 | JavaScript | boversauros/confusion-react | /src/components/DishdetailComponent.js | UTF-8 | 1,837 | 2.5625 | 3 | [] | no_license | import React, { Component } from 'react';
import { Card, CardImg, CardImgOverlay, CardText, CardBody, CardTitle } from 'reactstrap';
class DishDetail extends Component {
constructor(props)
{
super(props);
this.monthName = ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep",... | true |
12a1bd05d25c8893b88f3a6a19fc066b3d70bcef | JavaScript | TdWa/Webshop | /routers/orderRouter.js | UTF-8 | 1,695 | 2.671875 | 3 | [] | no_license | const { Router } = require("express");
const router = new Router();
const { User, Order, OrderProduct } = require("../models");
// As a customer I want to create a new empty order, so I can start purchasing products
// POST /orders (get the userId from the token)
router.post("/", async (req, res, next) => {
userId =... | true |
f4b9eaf0b671d5c565030afaef8ea2e4d55fc366 | JavaScript | mjedwards/ssrCryptoHound | /components/home/news.js | UTF-8 | 1,111 | 2.609375 | 3 | [] | no_license | import React, { useState } from 'react'
import NewsTable from '../tables/newsTable'
import Pagination from './pagination'
const News = ({news}) => {
let rows = { id: "", date: "", event: "", author: "", url: "" }
const [currentPage, setCurrentPage] = useState(1)
const [assetsPerPage] = useState(4);
... | true |
e1acd96e2c9a5bbcc71ead30fcf1c5a717ed28a0 | JavaScript | MonikaPatelIT/JavaScript-30 | /javascript30-08-fun-with-html5-canvas/js/index.js | UTF-8 | 2,089 | 3.21875 | 3 | [] | no_license | const canvas = document.querySelector("#draw");
const ctx = canvas.getContext("2d"); //get context in 2D
canvas.width = window.innerWidth; // set convas width as windows width
canvas.height = window.innerHeight; // set convas height as windows height
//set line properties
ctx.strokeStyle = "red";
ctx.LineJoin = "roun... | true |
1f811f8cb4a76bb05db8fe32d564f43882e69d82 | JavaScript | rh1456/newshuffle | /public/main.js | UTF-8 | 1,084 | 3.734375 | 4 | [] | no_license | const suits = ['hearts', 'clubs', 'spades', 'diamonds']
const rank = [
'Ace',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
'10',
'Jack',
'Queen',
'King'
]
const deck = []
//create the deck
const makeDeck = () => {
for (let suitsIndex = 0; suitsIndex < suits.length; suitsIndex++) {
for (le... | true |
3870aff78fb48e12d0ccdc5eb6a3fa2c53f849ad | JavaScript | AlexDuquenne/dev1-assignment2-tshirtdesign-AlexDuquenne | /tshirt.js | UTF-8 | 524 | 3 | 3 | [] | no_license | "use strict";
import context from "./scripts/context.js";
import * as Utils from "./scripts/utils.js";
let width = context.canvas.width;
drawDesign();
function drawDesign() {
context.fillStyle = Utils.hsl(30, 70, 50);
drawMickey(width / 2, 350, 100);
}
//REMOVE THIS CODE AND REPLACE WITH YOUR OWN <<<GENERAT... | true |
092bf8a77841038f36a09e9a25e35df649634640 | JavaScript | sarangk137/MYDEVOPS | /mkbackup/docker-project/node/server.js | UTF-8 | 223 | 2.578125 | 3 | [] | no_license | var http = require('http');
http.createServer(function(req,res){
res.writeHead(200,{'Content-Type':'text/html'});
res.end('<h2>Hello World</h2>')
}).listen(3000);
console.log("Service started and listening on port 3000"); | true |
3782b2443922e896313bfbb30ccbf5aa7c797f36 | JavaScript | wfwalker/bird-clicker | /src/Event.js | UTF-8 | 1,219 | 2.59375 | 3 | [] | no_license | var Event = Backbone.Model.extend({
defaults: {
'id': null,
'probability': 0.00, // 0.00 - 1.00 range
},
constructor: function(data) {
Backbone.Model.apply(this, arguments);
if(data.init) {
this.init = data.init;
}
if(data.canProceed) {
this.canProceed = data.canProceed;
... | true |
0f4c5e60a28132d58a93bdf358228760e4325210 | JavaScript | danieldrojas/ripping-recipes | /controllers/ingredientsController.js | UTF-8 | 2,616 | 2.578125 | 3 | [] | no_license | const express = require("express");
const router = express.Router();
const db = require("../models");
// READ ALL
router.get("/api/ingredients", (req, res) => {
db.Ingredient.find({})
.then((foundIngredients) => {
res.json({
error: false,
data: foundIngredients,
message: "Successful... | true |
40de620233cbe55f2756746557dff27aefad2c01 | JavaScript | LeafGlobalFintech/leafcelo | /backend/routes/public.js | UTF-8 | 1,988 | 2.53125 | 3 | [] | no_license | const express = require('express')
const UserModel = require('../models/UserModel')
const Utils = require('../services/Utils');
const jwtService = require('../services/jwtService')
const router = express.Router();
router.post('/register', async (req, res) => {
try {
let user = await UserModel.findOne({ username:... | true |
9a01cbdb552029ef410df6f9548cb8467be7c946 | JavaScript | FlorianSdorra/NASA | /src/App.js | UTF-8 | 1,529 | 2.6875 | 3 | [] | no_license | import React from 'react';
import './style/App.scss';
import DateInput from './components/DateInput';
import Photo from './components/Photo';
import InfoPart from './components/InfoPart';
import moment from 'moment';
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
... | true |
4f7c6270db2e5b5b72386d77d053fbcbd3b0a9aa | JavaScript | sharapinski/angular-program | /mock-server/services/core/courses/courses.middleware.js | UTF-8 | 1,316 | 2.546875 | 3 | [] | no_license | const express = require('express');
const router = express.Router();
const url = require('url');
module.exports = (server) => {
router.get('/courses', (req, res, next) => {
let url_parts = url.parse(req.originalUrl, true),
query = url_parts.query,
count = +query.count||5,
page = +query.page||1,
from = ... | true |
2862cae94b3650c2772fee7694843ddf2a71bdd9 | JavaScript | bjohn465/republia-times | /src/WorkScreen.js | UTF-8 | 1,267 | 3.015625 | 3 | [
"ISC"
] | permissive | import React, { useState } from 'react'
import SRContent from './ScreenReaderContent'
const dayStart = new Date('2019-01-01T06:00:00Z')
// const dayEnd = new Date('2019-01-01T18:00:00Z')
export default function WorkScreen() {
const [gameDate, setGameDate] = useState(dayStart)
return (
<>
<h1>Day 1</h1>... | true |
297601bcdb9fedafd064121d9a150ed19d42c5c0 | JavaScript | falvojr-phd/scc5900 | /List2/utils.js | UTF-8 | 826 | 3.515625 | 4 | [] | no_license | /**
* Created by falvojr on 22/06/16.
*/
String.prototype.isPalindrome = function () {
return this == this.split('').reverse().join('');
};
Array.prototype.max = function() {
return Math.max.apply(null, this);
};
Array.prototype.min = function() {
return Math.min.apply(null, this);
};
String.prototype.isUpp... | true |
e57be02ec803874bbb5e4f3eb5fee828faffb2bd | JavaScript | VeronicaM/pomodoro | /public/js/components/ClockWidget/clock.controller.js | UTF-8 | 7,298 | 2.765625 | 3 | [] | no_license | // helpers
import { updateText } from '../../common/utils';
import TimerController from '../SettingsWidget/TimerSection/timer.controller';
// constants
const blackCat = require('../../../images/black-cat.png');
const getTimeDigits = (time) => {
const timeString = time.toString();
return timeString.length > 1 ? ti... | true |
701b87b46bc49aa630009dacb6de962b0ae28f54 | JavaScript | kiranbandi/synteny-browser | /src/findGroups.js | UTF-8 | 2,599 | 2.65625 | 3 | [
"MIT"
] | permissive | export default function (linkGroups) {
var startOrd,
endOrd,
currOrd,
skips,
lg,
maxSkip = 10,
contiguous,
totalSkips,
skipSize;
for (var i = 0; i < linkGroups.length; i++) {
lg = linkGroups[i];
skips = new Map();
if (lg.li... | true |
39c8ffa40c952a7f4f9e23de4ee03ef2ff372100 | JavaScript | Tanmay53/cohort_3 | /submissions/sm_028_sagar/week_16/day_4/assignments/frontend/src/Components/Delete.js | UTF-8 | 2,455 | 2.546875 | 3 | [] | no_license | import React, { Component } from 'react'
import NavBar from './NavBar'
import axios from 'axios'
export default class Delete extends Component {
constructor(props){
super(props)
this.state = {
id : 0,
name : '',
email : '',
mobile : ''
}
}... | true |
4cae151a849a9cfe5e3b24f7238fe27b76968490 | JavaScript | ericgomez/platzi-store-webpack | /src/hooks/useInitialState.js | UTF-8 | 950 | 2.890625 | 3 | [
"MIT"
] | permissive | import { useEffect, useState } from 'react';
import axios from 'axios';
const API = 'https://us-central1-gndx-fake-api.cloudfunctions.net/api';
// Creamos una funcion por convension
const useInitialState = () => {
// Utilizamos useState para poder trabajar con los estados en las funcioines dentro de componenetes de... | true |
8521076c888f541854ba8989538ac949ee5eb846 | JavaScript | RoodrigoRoot/ejemploFetch | /UIPeople.js | UTF-8 | 1,448 | 3.03125 | 3 | [] | no_license | class UIPeople {
addPeople(people) {
const card = document.getElementById('people')
const element = document.createElement('div')
element.innerHTML = `<div class="card mb-2 border ">
<div class="card-body">
<strong> Usuario: </strong>${people.name}
<strong> N... | true |
30f95642298bdebd3c4c6563b57948677b77a2d6 | JavaScript | lemi1/evolveu_exercises | /React/linked-list/src/components/PeopleComp.js | UTF-8 | 1,441 | 2.859375 | 3 | [] | no_license | import React from 'react';
import lm from './People';
class PeopleComp extends React.Component {
constructor() {
super();
this.state = { myTribe: new lm.Family() };
}
addPeople = () => {
let name = document.getElementById('name').value;
let age = parseFloat(document.getElementById('age').value);
this.stat... | true |
eebb3fb61f5cc3e0d2ff254dc2a22010e44d1d91 | JavaScript | JoshMTM/lab-express-basic-auth | /routes/auth.routes.js | UTF-8 | 2,118 | 2.5625 | 3 | [] | no_license | const router = require("express").Router();
const UserModel = require("../models/User.model");
const bcrypt = require("bcryptjs");
router.get("/signup", (req, res, next) => {
res.render("auth/signup.hbs");
});
router.post("/signup", (req, res, next) => {
let { username, password } = req.body;
let salt = bcrypt.... | true |
0dc6d628ec16a1aba0dfc6a84d0725f0fff6ef43 | JavaScript | eprunier/exercism-javascript | /hamming/hamming.js | UTF-8 | 323 | 3.09375 | 3 | [] | no_license | let Hamming = function () {};
Hamming.prototype.compute = function (strand1, strand2) {
if (strand1.length !== strand2.length) {
throw new Error('DNA strands must be of equal length.');
}
return Array
.from(strand1)
.filter((nucleid, index) => nucleid !== strand2[index])
.length;
};
module.exports = Hammi... | true |
65516bff270b7f5c10c2adc219a15fdd27974683 | JavaScript | Matt1cheney/wordGuess_Game | /index.js | UTF-8 | 673 | 4.0625 | 4 | [] | no_license | // we need to make a word guess game!
// we will need to loop through possible words to guess.
// make a js file to list possible words.
// we will need to use inquirer to guess a letter.
// we need to set a remaining guesses count.
// if a letter is wrong, we need to tell them its wrong and
// subtract remain... | true |
ca231784f0f625edd571c21c9e64461ae3868997 | JavaScript | camilla-bachna/ejercicios-de-adalab | /JavaScript/modulo-2-leccion-4-ejercicio-6-logeando-errores/scripts/main.js | UTF-8 | 1,032 | 3.296875 | 3 | [] | no_license | 'use strict';
function getEl(a) {
if (a === '') {
console.log(`El selector no puede estar vacío`);
} else {
const elementDebbugger = document.querySelector(a);
if (elementDebbugger === null) {
console.log(`No existe ningún elemento con clase, id o tag llamado ${a}`);
} else {
... | true |
6ee624d95267d82591684cd50e162273718ffdab | JavaScript | daxz1/front-end-monorepo | /packages/lib-classifier/src/components/Classifier/components/SubjectViewer/components/InteractionLayer/helpers/getDefaultPosition/getDefaultPosition.js | UTF-8 | 1,084 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | const MIN_HEIGHT = 100
const MIN_WIDTH = 350
export default function getDefaultPosition (bounds = {}, minHeight = MIN_HEIGHT, minWidth = MIN_WIDTH) {
// Calculate default position
let x = 0
let y = 0
/*
Note: since we're using a modal that covers the entire screen, we only need
to calculate the position o... | true |