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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
462000f535e1b3a593e92f8aeba6f63b4ed28ece | JavaScript | CharlesRandom/lab-javascript-chronometer | /starter-code/javascript/main.js | UTF-8 | 2,535 | 3.421875 | 3 | [] | no_license | // var imported = document.createElement('script');
// imported.src = './chronometer.js';
// document.head.appendChild(imported);
var chronometer = new Chronometer();
var btnLeft = document.getElementById('btnLeft');
var btnRight = document.getElementById('btnRight');
var minDec = document.getElementById('... | true |
c97bb819eb8b141aaa786144aaa5f143f3bf3148 | JavaScript | androidwifi/OpenGL_Example | /books-sourcecode/opengles3.0游戏开发/第17章 基于WebGL的3D楼盘展示系统/ResidentialGarden/js/loadHouseObj.js | GB18030 | 1,621 | 2.765625 | 3 | [] | no_license | function loadHouseObjFile(url,object,id)
{
var req = new XMLHttpRequest();
req.onreadystatechange = function () { processHouseLoadObj(req,object,id) };
req.open("GET", url, true);
req.responseType = "text";
req.send(null);
}
function createHouse(objDataIn,object,id)
{
if(shaderProgArray[id])
{
//õ
switch(obj... | true |
9972b6a0e85528258dab7f19a255970bb480c5ea | JavaScript | acquatorba/trentose-run | /test-code/js/coach.js | UTF-8 | 1,099 | 3.296875 | 3 | [] | no_license | /* Coach main file */
var Activity = {
walk : 50,
bike : 100,
run : 150
};
var Program = {
easy : 500,
normal : 1000,
crazy : 2000
};
var Coach = {
_activities : {},
_program : null,
GENDER_MALE : "male",
GENDER_FEMALE : "female",
LEVEL_SINGLE : "single",
LEVEL_MEH : "me... | true |
dbd4e28667aab9b0d307f5a1a6dd301be6af33ef | JavaScript | EmilioCR/pruebaThreeJs | /js/main.js | UTF-8 | 752 | 2.53125 | 3 | [] | no_license | var scene = new THREE.Scene();
var camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 );
var renderer = new THREE.WebGLRenderer();
var renderer = new THREE.WebGLRenderer({
alpha: true // remove canvas' bg color
});
// Make scene renderer the size of the screen
renderer.setSize... | true |
d7db0389fb17b727d81e03a25e89f4aef9509a78 | JavaScript | spektraldevelopment/spektraltools | /src/modules/Window.js | UTF-8 | 3,685 | 2.671875 | 3 | [
"MIT"
] | permissive |
//WINDOW - getURLPath
Spektral.getURLPath = function () {
var
protocol = location.protocol, hostName = location.hostname,
pathName = location.pathname, pathArray = Spektral.splitString(pathName, { character: "/" }),
queryString = location.search, hashTag = location.h... | true |
00c10739eca29dcc43db76d9b4e544e7e7d8b684 | JavaScript | B2BProgrammer/Ajjarani_Codes_FrontEnd | /JavaScript/3_JavaScriptObjects.js | UTF-8 | 1,096 | 3.953125 | 4 | [] | no_license |
/**
* PART 3
*
* In JavaScript most are :
* - Objects : properties & methods are availble for all objects
*
* Objects Eg :
* 1. Functions
* 2. Dates
* 3. Maths
* 4. Regular Exp
*
*
* Primitives[5] are NOT objects : [they are immutable : they are hardcoded ]
* 1. String
* 2. number
* 3. boolean
* 4. n... | true |
d7311e5b521aba912409d3a6c0a043ef87a7f0aa | JavaScript | jakeboyles/sc_class_demo | /main.js | UTF-8 | 1,307 | 2.8125 | 3 | [] | no_license | (function () {
$('body').on("click",".play,.song img",function(){
var id = $(this).parent().data("id");
var title = $(this).parent().data('title');
$("audio").attr("src",`http://api.soundcloud.com/tracks/${id}/stream?client_id=03e4633e2d85874a921380e47cac705d`);
$("#title").text(title);
$('audio'... | true |
817ff2f1787d94fbdb7e9017371e50c895475dc2 | JavaScript | rahulyhg/theastrologist-front | /app/common/src/service/cacheService.js | UTF-8 | 1,659 | 2.546875 | 3 | [] | no_license | /**
* Created by Samy on 27/10/2015.
*/
'use strict';
angular.module('theastrologist.services').service('cacheService', ['$q', function ($q) {
this.cache = {};
this.getData = function (id, loadFunction, transformFunction, errorFunction, forceReload) {
var deferred = $q.defer();
var that = th... | true |
4b94d6086c65703fe99f7d492ccc655d50c27693 | JavaScript | seanmadden/media-tracker | /service/models/user.js | UTF-8 | 1,768 | 2.71875 | 3 | [] | no_license | /**
* Created by Sean on 7/19/2014.
* Inspired by http://devsmash.com/blog/password-authentication-with-mongoose-and-bcrypt
*/
var bcrypt = require('bcryptjs');
var mongoose = require('mongoose'),
Schema = mongoose.Schema;
var SALT_WORK_FACTOR = 10;
var UserSchema = new Schema({
email: { type: String, requ... | true |
d02693b68bbb3f0a39e52ee43bbe502fb19b2338 | JavaScript | Beatrice084/lab5 | /script.js | UTF-8 | 4,285 | 2.90625 | 3 | [] | no_license | $('#bookButton').click(function(){
$('#serviceName').text('Break Repair');
$('#serviceCost').text('$65');
})
$('#bookButton1').click(function(){
$('#serviceName').text('Puncture Repair');
$('#serviceCost').text('$20');
})
$('#bookButton2').click(function(){
$('#serviceName').text('Maintenance');
$('#servi... | true |
5544ea1a7da5273fd8f26a1dc5c3771380b31552 | JavaScript | yanggui1/node-mongo | /3_fs/app.js | UTF-8 | 527 | 3.34375 | 3 | [] | no_license | //文件系统
//1.引入文件系统模块
var fs = require('fs');
//2.通过对象调用方法
//var readme = fs.readFileSync('readme.txt','utf-8');//同步读取
//console.log(readme);
//fs.writeFileSync('writeme.txt',readme);
//异步读取文件
fs.readFile('readme.txt','utf-8',function(err,data){
if (err) throw err;
console.log(data);
});
fs.readFile('readme.... | true |
3b45aeee071746b9da0e4b1254bd6083a065c588 | JavaScript | AmalAbed/prep-answers | /todos.js | UTF-8 | 4,231 | 3.796875 | 4 | [] | no_license | // generateID is a *function* that, when invoked, returns a number representing
// an ID.
var generateID = makeCounter();
// By using a counter, we have a function that will always generate a new number
// -- this is great for generating unique IDs for things.
// Try the following at your console:
// generateID(); //... | true |
e4d053c579ba1e1f573c21434f04b4867db7f9ab | JavaScript | DavidMoraes-DEV/JavaScript | /ConceitosDeJavaScript/Arquivos_JS/Fundamentos/Hoisting.js | UTF-8 | 1,118 | 3.296875 | 3 | [] | no_license | //Em outras linguagem o código é lido de cima para baixo de forma sequencial porem em js não é feito 100% dessa forma
//CURIOSIDADE:
//Hoisting: É um comportamento padrão de mover a declaração da variável de tipo var para o topo.
console.log("a =" + a) //Em js variáveis do tipo var são "jagadas para cima ou também cha... | true |
a9e17bdc2394061d8e1064f1e72be3e06036c92b | JavaScript | vineet89/kuber | /sections/cashflow.js | UTF-8 | 1,103 | 2.75 | 3 | [] | no_license | function addCashFlowSection(cashFlowTable, numYears) {
const insightsData = { title: 'Cash flow insights', data: [] };
// Extract net profit data
const cashFlowData = cashFlowTable.find(e => e.get(CONSANTS.METRIC_HEADER).indexOf(CONSANTS.CASH_OPERATING_ACTIVITY) !== -1);
// Calculate growth rate over... | true |
0b52e91d47e96ac663c44de2bb99402c2ddc6937 | JavaScript | jane0819tw/thaiskr | /js/ytPlayer.js | UTF-8 | 10,030 | 2.875 | 3 | [] | no_license | class Vec2 {
constructor(x, y) {
this.x = x || 0
this.y = y || 0
}
add(v) {
return new Vec2(this.x + v.x, this.y + v.y)
}
sub(v) {
return new Vec2(this.x - v.x, this.y - v.y)
}
set(x, y) {
this.x = x
this.y = y
}
move(x, y) {
this.x += x
this.y += y
}
equal(v) {
... | true |
08ab6d86dd91877d97002562081b7f19dc1c9cf1 | JavaScript | krockot/ccc | /src/ccc_library.js | UTF-8 | 7,866 | 3.0625 | 3 | [] | no_license | /**
* Native function library.
*
* This provides some convenient interface for establishing named bindings to
* native function implementations for import into a program environment.
*
* Library objects can be imported into a live Environment using the environment's
* importLibrary method.
*/
ccc.Library = func... | true |
899291a4ad33b650f38fecb118a1bba08b309593 | JavaScript | DevhTor/NodeWebPage | /src/public/script/multistep.js | UTF-8 | 1,992 | 2.984375 | 3 | [] | no_license | const
slidePage = document.querySelector(".slide-page");
var nextBtnFirst = document.querySelector(".firstNext");
var prevBtnSec = document.querySelector(".prev-1");
var nextBtnSec = document.querySelector(".next-1");
var prevBtnThird = document.querySelector(".prev-2");
var nextBtnThird = document.querySelector(".ne... | true |
b342cad3f349da3407c81f8c052cae18f4c86339 | JavaScript | Jemeline/study-buddy | /functions/test/advertisement_test.js | UTF-8 | 3,219 | 3.09375 | 3 | [] | no_license | /* eslint-disable max-len */
/* eslint-disable linebreak-style */
/* eslint-disable no-undef */
/* Author: Jada Pfeiffer
Purpose: Backend unit testing for Advertisement object. In each unit test, the following
Course is instantiated and added to the Advertisement collection in MongoDB:
const ad = new AdvertisementMo... | true |
3f28aff073300b2c276ff173e456f9ad51d8b871 | JavaScript | mateuszarchicinski/TDD-Helpdesk-Web-App-Project | /frontend/src/js/controllers/login-ctrl.js | UTF-8 | 1,779 | 2.609375 | 3 | [
"MIT"
] | permissive | /**
* @class angular_module.Module:app.Controller:loginCtrl
* @description This is an AngularJS controller component, can be defined in JavaScript object or as a value of attribute ng-controller
* @example
* {
* controller: 'loginCtrl as LC'
* }
* @example
* <div ng-controller="loginCtrl as LC"></div>
*/
ap... | true |
525248a6586387ce4fc01729873d6761e6927528 | JavaScript | alanbuzek/codility_problem1 | /ranks.js | UTF-8 | 560 | 3.3125 | 3 | [] | no_license | function solution(ranks) {
const rankCounts = {};
let solution = 0;
ranks.forEach(rank => {
if (rankCounts[rank]) {
rankCounts[rank] += 1;
} else {
rankCounts[rank] = 1;
}
});
console.log(JSON.stringify(ranks));
for (let rank in rankCounts) {
const rankToReport = rank + 1;
... | true |
94802da5c677b00a1043e7e45dbde4c6f00422cd | JavaScript | stho32/Eyesense-Music-Bot | /commands/music/bassboost.js | UTF-8 | 2,142 | 2.578125 | 3 | [
"MIT"
] | permissive | const { SlashCommandBuilder } = require("@discordjs/builders");
const { embedMessage } = require("../../modules/embedSimple");
module.exports = {
data: new SlashCommandBuilder()
.setName("bassboost")
.setDescription("bassboost Audio Filter")
.addStringOption((option) =>
option
.setName("mod... | true |
1005b8e3e599d1dc876c29295f1a51a30f841a3e | JavaScript | excleupload/jsp | /src/main/resources/static/assets/custom/js/calculation.js | UTF-8 | 2,131 | 2.53125 | 3 | [] | no_license | $( document ).ready(function() {
$(document).on("input paste keyup", ".product_qty", function( event ) {
var product_quantity = 0;
var product_price = 0;
var gst_amount = 0;
var sub_total = 0;
/* var total_qty = 0; */
var grand_total = 0
... | true |
02894224f6b11e850a07e6806dcaa17b5f35e9cc | JavaScript | KingJA/FiveChess | /web/js/websocket.js | UTF-8 | 1,913 | 2.734375 | 3 | [
"MIT"
] | permissive | var webSocket = null;
var url = null;
$(function () {
});
/**
* 建立WebSocket连接
* @param urlPath
*/
function connect(urlPath) {
console.log("初始化WebSocket")
if (!("WebSocket" in window)) {
alert("当前浏览器不支持WebSocket,请更换浏览器或者升级到最新版本");
}
if (window.location.protocol == 'http:') {
url = ... | true |
33b649701e1cd2980bd27606ff1a545b2eef2399 | JavaScript | trongkhanh/Goods4life | /Client/good4life/src/api/checkPassword.js | UTF-8 | 200 | 2.78125 | 3 | [] | no_license | const checkPassword = (input) => {
var passw = /^[A-Za-z]\w{6,20}$/;
if (passw.test(input)) {
return true;
} else {
return false;
}
};
module.exports = checkPassword; | true |
f2da77a8e5c0b7fcdff34990953378430639d971 | JavaScript | seedubgh1/conFusionApp | /trivia_skill/emitMethod.js | UTF-8 | 421 | 2.734375 | 3 | [] | no_license | var request = require("request");
var EventEmitter = require("events").EventEmitter;
var body = new EventEmitter();
var questions = {};
request('https://opentdb.com/api.php?amount=5&category=11', function(error, response, data) {
body.data = data;
body.emit('update');
});
body.on('update', function () {
... | true |
3c07fd3e62c9b4ee9367dc33bda1c04fdc332428 | JavaScript | ConsoleGameApi/GameReviewAPI | /server/database/model/add.game2Genre.model.js | UTF-8 | 808 | 2.609375 | 3 | [] | no_license | const db = require('../db');
const addGame2GenresModel = module.exports;
addGame2GenresModel.isGame2GenreExists = (gameId, genreId) => {
// console.log('inside addGameGames2Genres check params are: ', gameId, genreId);
return db('Games2Genres').where({
game_id: gameId,
genre_id: genreId,
}).select('id')... | true |
8e6337bd376a78b0bf756dca41e599935f744e05 | JavaScript | Fellway/Meetings | /src/main/resources/static/script/register.js | UTF-8 | 4,481 | 2.65625 | 3 | [] | no_license | var login = $("#login");
var email = $("#email");
var password = $("#password");
var cpassword = $("#confirm_password");
var usernameRegex = /^[a-zA-Z0-9]{5,20}$/;
var emailRegex = /^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$/;
/*This regular expression expects atleast 1 ... | true |
11aa2d43759d64274ba2f4edb3cf51e81868a081 | JavaScript | ItsPack/scrollVideo | /script.js | UTF-8 | 366 | 3.015625 | 3 | [] | no_license | var video = document.getElementById("animation");
$( document ).ready(function() {
setVideoTime(video, 5.4);
$( window ).scroll(function() {
var time = ($(document).scrollTop() / 500) + 5.4;
setVideoTime(video, time);
// console.log($(document).scrollTop()/200);
});
});
function setVideoTi... | true |
6e23fc5c53e516a88fb2446698b03583c7866a05 | JavaScript | AhmadSyahab/d3-wimbledon | /script.js | UTF-8 | 1,636 | 2.953125 | 3 | [] | no_license | /* global d3 */
// d3.tsv('afcw-results.tsv', (rows) => {
// console.log(rows)
// })
// Our canvas
const width = 750,
height = 300,
margin = 20
marginLeft = 40
// Drawing area
let svg = d3.select('#results')
.append('svg')
.attr('width', width)
.attr('height', height)
// .style('background', '#cacaca')
... | true |
7c247fbe7d8a1fb5131f97a920eb51cf5d3c7763 | JavaScript | Sido-A/london-pt-fe-030320 | /24-for-loop-exercise/index.js | UTF-8 | 3,288 | 4.21875 | 4 | [] | no_license | const myName = "Sido"; // SET YOUR NAME
const visitors = ["Alex", "Mike", "Sam","Bob","Lucie"]; // Add at least 5 names
/**
* Exercise 1
*
* create a function {greetVisitors} and inside it write for loop which
* will greet all people from "visitors" for each person you should
* console.log "Hi {name}, my name is... | true |
7b3573259ec9b7977bb7df9ca2a0a4740532df70 | JavaScript | abhishekk-cuelogic/JavaScript | /Codes/function.js | UTF-8 | 222 | 3.484375 | 3 | [] | no_license |
function addNumbers(NumOne,NumTwo){
return NumOne+NumTwo;
}
// function expression
var addNumbers=function(NumOne,NumTwo){
return NumOne+NumTwo;
}
//Arrow Function
var addNumbers=(NumOne,NumTwo)=>NumOne+NumTwo;
| true |
778febda2c8a8b2cf79495ed503ecb600384f97b | JavaScript | iamdevlinph/common-utils-pkg | /docs/docs.js | UTF-8 | 3,591 | 2.765625 | 3 | [
"MIT"
] | permissive | (function () {
$.getJSON('./mapped_source.json', function (data) {
var mapped_source = _(data).toPairs().sortBy(0).fromPairs().value();
var reference = document.getElementById('reference');
_.forOwn(mapped_source, function (val, key) {
// create card
var card = document.createElement('div');
... | true |
574b1fd1f27830157a76c0f67255ec5e4e3e9c31 | JavaScript | JW-Ellis/Wayfinder | /trailSearch.js | UTF-8 | 1,835 | 2.875 | 3 | [
"MIT"
] | permissive | const fetch = require('node-fetch');
const zipcodes = require('zipcodes');
require('dotenv').config();
const hikeKey = process.env.HIKINGKEY;
exports.randomTrail = async function search(zip, length) {
let trailName;
let trailSummary;
let trailDifficulty;
let trailStars;
let trailLocation;
let trailImg;
... | true |
3ef116040144b60d246dfd593f9b8a4fcbd0751a | JavaScript | GOMYWAY-NETWORKS/codenvy | /cdec/installation-manager-resources/src/main/resources/patches/4.3.4/single_server/update_mongo.js | UTF-8 | 2,737 | 2.609375 | 3 | [] | no_license | /* https://jira.codenvycorp.com/browse/CODENVY-667 */
var fixAcl = function(collectionName, objectType) {
var organizationDb = db.getSiblingDB("organization");
var collection = organizationDb.getCollection(collectionName);
var updateNumber = 0;
var objectIterator = collection.find();
while (objectIterator.ha... | true |
3b872f29a7633bcdd2db01660a9cde0846977779 | JavaScript | ramkbhattarai/CTCI_Problems | /arraysAndStrings/urlify.js | UTF-8 | 1,052 | 4.1875 | 4 | [] | no_license | /**
* URLify: Write a method to replace all spaces in a string with '%20'.
* You may assume that the string has sufficient space at the end
* to hold the additional characters,
* and that you are given the "true" length of the string.
* (Note: if implementing in Java,
* please use a character array so that y... | true |
f73ac7e183a5130f5ff186555c631c433152f5c0 | JavaScript | devjaoperaro/api-admin-loja | /app/Middleware/ContentRangeAdd.js | UTF-8 | 1,262 | 2.53125 | 3 | [] | no_license | /** @typedef {import('@adonisjs/framework/src/Request')} Request */
/** @typedef {import('@adonisjs/framework/src/Response')} Response */
/** @typedef {import('@adonisjs/framework/src/View')} View */
class ContentRangeAdd {
/**
* @param {object} ctx
* @param {Request} ctx.request
* @param {Function} ... | true |
52b601b88daa2472563be83057469d45ea517461 | JavaScript | Snake-Oil-Supplies/snake-oil-supplies | /server/permissions/index.js | UTF-8 | 585 | 2.609375 | 3 | [
"MIT"
] | permissive | const deny = next => {
const err = new Error('NOT ALLOWED')
err.status = 401
next(err)
}
const _isLoggedIn = req => !!req.user
const _isAdmin = req => req.user.isAdmin
const _isSelf = req => req.user.id === req.requestedUser.id
const isLoggedIn = function (req, res, next) {
_isLoggedIn(req) ? next() : deny(nex... | true |
ddda645e383670fe64fd8a9abb454af207489382 | JavaScript | josefm09/billetesMonedas | /js/pantallaMostrador.js | UTF-8 | 1,368 | 2.546875 | 3 | [] | no_license | var vitrina = localStorage.getItem('vitrina')
var {BrowserWindow}=require('electron').remote
const app = require('electron').app
const path = require('path')
const url = require('url')
var btnGrupo = document.getElementsByClassName('btnGrupo')
var buscaGrupos = function(){
localStorage.setItem("mostrador", this.val... | true |
8716a3ef374fdbd81fbb211b38e28e485c49b8d9 | JavaScript | alessandro-calo/photoshop-scripts | /Enumerate Layers.jsx | UTF-8 | 415 | 2.53125 | 3 | [] | no_license | var doc = app.activeDocument;
function getName(group, i) {
return group === doc ? i : (group.name) + '.' + i;
}
function renameLayers (group) {
for (var i = 1; i <= group.layers.length; i++) {
var layer = group.layers[i - 1];
layer.name = getName(group, i);
if (layer.typename !== "ArtL... | true |
515bbea00b93a6501ae08da3862eab44e0eeab67 | JavaScript | stacan/JavaScript | /snake.js | UTF-8 | 14,756 | 3.296875 | 3 | [] | no_license | 'use strict';
const settings = { //обьект настроек
rowCount: 10, //размеры поля
colCount: 10,
startPositionX: 0, //координаты точки по х, у
startPositionY: 0,
startDirection: 'right', //стартовое направление
stepsInSecond: 5, //скорость
playerCellColor: '#AA3333', //колоры, игрока и пус... | true |
21360be87a143f075baab5708637885354cb5250 | JavaScript | renjinhui/2018_13 | /week11/day2/5_接口.js | UTF-8 | 842 | 2.59375 | 3 | [] | no_license | let fs = require('fs');
let http = require('http');
let url = require('url'); // 专门处理路径上的参数的模块
// 前端通过 localhost:8000/list 能获取我们的数据
http.createServer(function(req,res){
res.setHeader('Access-Control-Allow-Origin','*')
// setHeader(响应头的属性,对应的属性值)
// console.log(req.url)
// let obj = url.parse(req.url,tru... | true |
0bc72824f7e8cae72626b34b07ad8a4b2adc9f27 | JavaScript | SohilaBogdadyNagdy/khazna-app | /products-service/model/index.js | UTF-8 | 1,318 | 2.71875 | 3 | [] | no_license | const db = require("../db");
!async function createTable() {
const tableQuery = `CREATE TABLE IF NOT EXISTS products (
id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(255) NOT NULL,
brand VARCHAR(255) NOT NULL,
category VARCHAR(255) NOT NULL,
price DECIMAL(8,2) NOT NULL,
... | true |
094f9b1df3570c1ed0de4dc4db76713b9ef1fe93 | JavaScript | zeel-pathak/todo-l33Z | /todo.js | UTF-8 | 3,624 | 3.375 | 3 | [] | no_license | // var h = document.createElement('h1')
// var myValue = document.createTextNode('Hello World!')
// h.appendChild(myValue)
// document.querySelector('h1').appendChild(h);
// var val = 5;
// while (val > 0) {
// console.log(val);
// val--
// }
var ul = document.getElementById('list');
var li;
refresh();
... | true |
22c297c921cdea5a9b7412424430ab2f4ccf206e | JavaScript | NikhilGrover23/Project-34---Virtual-Pet-1 | /sketch.js | UTF-8 | 960 | 3.4375 | 3 | [] | no_license | //Create variables here
var dog, sad_dog, happy_dog;
var database;
var foodS, foodStock;
function preload()
{
//load images here
var dog_img = loadImage("images/dogImg1.png");
var happy_dog_img = loadImage("images/dogImg.png");
}
function setup() {
database = firebase.database();
createCanvas(800, 700);
... | true |
5e1857c9d9af282221fa118897f13f16ff285392 | JavaScript | DiegoDeJotaWeb/Estudo-js | /exercicios/curso-javascript/modulo-1/exer3/script.js | UTF-8 | 495 | 3.640625 | 4 | [] | no_license | function experiencia(anos) {
if(anos >= 0 && anos <= 1){
console.log('De 0-1 ano: Iniciante');
}
if(anos <= 3){
console.log('De 1-3 anos: Intermediário');
}
if(anos > 3 && anos <= 6){
console.log('De 3-6 anos: Avançado');
}
if(anos >=7){
console.log('De 7 acima: Jedi Master')... | true |
23aea5d78857991db6007807e5d84c6edf0adbe3 | JavaScript | ljubomirgu/school_diary_frontend | /src/Components/Teachers/TableOfTeachers.js | UTF-8 | 15,248 | 2.515625 | 3 | [] | no_license | import React, { Component } from 'react';
import TeacherForm from './TeacherForm';
import CreateTeacherForm from './CreateTeacherForm';
import '../Table.css'
import TeacherView from './TeacherView';
import NewTeacherView from './NewTeacherView';
class TableOfTeachers extends Component {
constructor(props) {
... | true |
a4635dd62db7fd5a7a9c9674efec45e249ef8fd4 | JavaScript | CADBOT/june-intuit-customjs-1 | /day-1/functions/var-const-let.js | UTF-8 | 272 | 3.96875 | 4 | [] | no_license | // const isn't actually constant. You just can't re-assign.
// It's like the Java final keyword
const MY_ARRAY = [];
MY_ARRAY[0] = 4;
if (true) {
var x = 4;
let y = 5; // ES6 ONLY
const z = 10; // ES6 ONLY
z = 4
}
console.log(x);
console.log(z);
console.log(y);
| true |
c6f94004790799b76eb6d1c67b98b90a659ddd80 | JavaScript | fla1004/app-pedidos | /src/controllers/CategoriaController.js | UTF-8 | 3,634 | 2.8125 | 3 | [] | no_license | const Categoria = require('./../models/Categoria');
const guardar = function(req,res)
{
const datos = req.body;
const cat = new Categoria();
cat.titulo = datos.titulo;
cat.descripcion = datos.descripcion;
if(cat.descripcion != "")
{
cat.save((err, cat_save) => {
if(err... | true |
2481745ceb52f90bb72109126f10b2a0b2f7cb7d | JavaScript | gabrielh-silvestre/Churrascometro | /scripts/script.js | UTF-8 | 2,046 | 3.640625 | 4 | [] | no_license | // Carne - 400 gr por pessoa + de 6 horas - 650
// Cerveja - 1200ml por pessoa + de 6 horas - 2000ml
// Refrigerante/agua - 1000ml por pessoa + de 6 horas 1500ml
// crianças valem 0,5 (meio)
var input_adults = document.getElementById("adults");
var input_kids = document.getElementById("childrens");
var inpu... | true |
535ed0b7c1eaa6d16a768e0d41aeb9564a747739 | JavaScript | thinhcubi/CD_FEET_METER | /JS.js | UTF-8 | 261 | 3.109375 | 3 | [] | no_license | function FeetToMeter(Feet){
Meter = 0.305 * Feet;
document.getElementById("result").innerHTML = "Ket qua Meter =" + Meter
}
function MeterToFeet(Meter){
Feet= 3.279*Meter;
document.getElementById("result1").innerHTML = "Ket qua Feet =" + Feet
} | true |
77ddb922fe9903c73e494deb51b39a9e793ab5c4 | JavaScript | tobyjorris/homespotter-demo | /src/Components/WeatherDisplay/weatherDisplay.js | UTF-8 | 4,022 | 2.609375 | 3 | [] | no_license | import React from 'react';
import './weatherDisplay.css';
import { Container, Row, Col } from "react-bootstrap";
import ConvertDate from '../../Helpers/dateConvertor/dateConvertor';
const WeatherDisplay = props => {
return (
<Container fluid>
<Row>
<Col className="d-flex justify... | true |
96dda3403d79c5f1eb8e446f57114708a0448d1c | JavaScript | AbedMHroub/ChatApp | /src/components/LogIn.js | UTF-8 | 1,703 | 2.53125 | 3 | [] | no_license | import React, { Component } from 'react';
import '../style/common.css';
export class LogIn extends Component {
constructor(props){
super(props)
this.state={
username:'',
password:''
}
}
handleUsernameChange = e =>{
this.setState({
username:e.targ... | true |
a9284497833a5459c52620088e72abd8609bf4d8 | JavaScript | lacolaco/plain-ajax | /index.js | UTF-8 | 1,454 | 2.8125 | 3 | [] | no_license | class XhrWrapper {
static sendAsync(xhr) {
return new Promise((resolve, reject) => {
xhr.addEventListener('load', (evt) => {
resolve(evt.target.response);
}, false);
xhr.addEventListener('error', (evt) => {
reject(evt.target.error);
... | true |
771dfe53d48653bf83c9741405fd34b43fac33b9 | JavaScript | ziyunting/personal-project | /jd/swiper/index.js | UTF-8 | 6,397 | 2.921875 | 3 | [] | no_license | (function () {
// 面向对象编程方式 --->
// 所有变量以对象属性的方式存在
// 把所有的函数 以对象方法的形式存在
function Swiper(options) {
// 把需要用到的方法属性保存到对象身上
// 轮播图的父级
this.wrap = options.wrap;
// 需要轮播的图片列表
this.imgList = options.imgList;
// 轮播土拍你的长度
this.imgLen = this.imgList.len... | true |
a9555abcd05a9a849afe3b388e514f9aa5abc6ae | JavaScript | yhikishima/backbone-env | /07.MarionetteJs/src/js/app.js | UTF-8 | 1,104 | 2.625 | 3 | [] | no_license |
class TextNumber {
constructor() {
this.func();
consoel.log('ddd');
}
static func() {
console.log('test');
}
}
// console.log(new Backbone.Marionette.Application());
let App = new Backbone.Marionette.Application();
// App起動時に呼ばれる
App.addInitializer(() => {
var router = new Router();
});
let R... | true |
0efda143d8ff161a1ed2ed373b36bec884c6c3a4 | JavaScript | Zhenzhong-Zhou/MERN-E_Commerce | /server/controllers/carts.js | UTF-8 | 1,162 | 2.65625 | 3 | [
"MIT"
] | permissive | import Cart from "../models/cart.js";
// CREATE
export const create = async (req, res) => {
const createCart = new Cart(req.body);
try {
const newCart = await createCart.save();
res.status(200).json(newCart);
} catch (error) {
res.status(500).json(error);
}
};
// UPDATE
export const update = async (req, res)... | true |
b4a3a86d88056536fd2911f6074c0c164336a9bd | JavaScript | marcelopajr/estudo | /javascript/javascript-completo-origamid/javascript-para-iniciantes/funcoes/script.js | UTF-8 | 1,760 | 4.40625 | 4 | [] | no_license | // Crie uma função para verificar se um valor é Truthy
function isTruthy(value) {
return !!value;
}
console.log(isTruthy('teste'));
console.log(isTruthy(0));
// Crie uma função matemática que retorne o perímetro de um quadrado
// lembrando: perímetro é a soma dos quatro lados do quadrado
function perimetro(lado) {
... | true |
9f58afea9fec0b3f29d315469cf4d89429e66a06 | JavaScript | yunderboy/guhao5000 | /src/reducers/home.js | UTF-8 | 474 | 2.734375 | 3 | [] | no_license | /**
* Created by younderboy on 21-02-2017.
*/
const initialState = {
coordinates: {
x: 0,
y: 0,
z: 0,
claw: 0
}
};
// Reducer
export default function home(state = initialState, action) {
switch (action.type) {
// SET COORDINATES
case "SET_COORDINATES":
... | true |
db92e556ef1318f94082f27ebbe736bd129bab59 | JavaScript | reddevill007/News-dekho | /app.js | UTF-8 | 2,168 | 2.78125 | 3 | [] | no_license | let newsAccordian = document.getElementById('containerNews');
let source = 'the-times-of-india';
let apiKey = '35f8498746684954afcc7780fd86323c';
const xhr = new XMLHttpRequest();
xhr.open('GET', `https://gnews.io/api/v4/search?lang=en&country=in&q=sports&token=be3d5b0e883f00ffabb233f6f7032716`, true);
xhr.o... | true |
5907fbab9abdf8cee005787d6aa08001254dd3f7 | JavaScript | gsong-archive/async-js-tutorial | /callback.js | UTF-8 | 322 | 2.875 | 3 | [] | no_license | var fs = require('fs');
function readFile(file, cb) {
if (file === 'text.txt') {
setImmediate(function() {
cb(null, 'This is text');
});
return;
}
fs.readFile(file, 'utf8', cb);
}
readFile('text.txt', function(err, result) {
if (err) throw err;
console.log(result);
});
console.log('done')... | true |
daf07be1238d8c5d232e2c9963d3e2da9ab45a07 | JavaScript | eamoh/frontend-nanodegree-resume | /js/resumeBuilder.js | UTF-8 | 8,985 | 2.515625 | 3 | [] | no_license | // create bio object
var bio = {
"name": "Ebenezer Amoh",
"role": "Web Developer",
"contacts": {
"mobile": "+1 (123) 456-7890",
"email": "ebamoh@hotmail.com",
"github": "eamoh",
"twitter": "@EbenezerAmoh",
"location": "New York"
},
"welcomeMsg": "Banker by day... | true |
8f936dcad1c00d4d430bff50cc19fdf6b040b9e2 | JavaScript | jsd1710/ASU-SER421-F15 | /KGARY_SER421_EXAMPLES/javascript3/remote/JSLoadRace2Sleepy.js | UTF-8 | 244 | 2.625 | 3 | [
"CC0-1.0"
] | permissive | function sleep(milliSeconds){
var startTime = new Date().getTime(); // get the current time
while (new Date().getTime() < startTime + milliSeconds); // hog cpu
}
sleep(3000);
console.log('EXTERNAL SCRIPT EXECUTED OFF DCS');
alert('DCS');
| true |
1b5929244b3a66114ddc73cbf1a720a990e32a39 | JavaScript | noobmaster001/interview | /question5.js | UTF-8 | 207 | 2.90625 | 3 | [] | no_license | var obj = [
{id : 4,name :'abc'},
{id : 10,name :'ab2'},
{id : 5,name :'abc3'},
{id : 6,name :'abc5'}
]
const data = obj.sort((a, b) => (a.id > b.id) ? 1 : -1)
console.log(data); | true |
2289e44dcd4bbf4f87423572e696d3384b4ca464 | JavaScript | tse2partrick/page_refer_to_blete | /js/percentBox.js | UTF-8 | 2,025 | 2.890625 | 3 | [] | no_license | var percentBox = function(){
var box = $('.percent-box');
var boxNum = box.length;
var ani = document.styleSheets[1];
box.each(function(index){
var percent = parseInt($('.percent-box:eq('+index+')').attr('data-percent'));
var word = $('.percent-box:eq('+index+')').attr('data-word');
$('.percent-box:eq... | true |
3195327223d567f78e59752be19850deb5c9ee3a | JavaScript | kvndai/CDrepo | /MEAN/FullMEAN/qa/Application/server/controllers/controller.js | UTF-8 | 1,432 | 2.53125 | 3 | [] | no_license | var mongoose = require('mongoose');
var Question = mongoose.model('Question');
var Answer = mongoose.model('Answer');
module.exports = {
createQuestion: (req, res, next) => {
let q = new Question(req.body);
q.save()
.then((data) => {
res.json(data);
console.log(q);
})
.catch((err) => ... | true |
e1f6cea082fd521d19b98b09f499b369ef99ca40 | JavaScript | sergiofmc/loteria | /LoteriaController.js | UTF-8 | 1,267 | 2.59375 | 3 | [] | no_license | var ang = angular.module('Loteria', []);
ang.controller('LoteriaController', LoteriaController);
LoteriaController.$inject = ['$scope','$rootScope','$http','$filter','$interval','$timeout'];
function LoteriaController($scope,$rootScope, $http,$filter,$interval,$timeout){
$scope.listaNumerosPendientes;
$scope.... | true |
6e445b4a1eca0480875501f27f82dfd6673c544e | JavaScript | atarka/auto_complete | /src/services/api.js | UTF-8 | 1,013 | 2.71875 | 3 | [] | no_license | const filterNames = [
{name: 'Jorge Valencia'},
{name: 'Michael Jordan'},
{name: 'Archetype Vicarius'},
{name: 'Benedict Bandersnatch'},
{name: 'Rambo Bloodaxe'},
{name: 'Hugo Rune'},
{name: 'Barry the Time Sprout'},
{name: 'Nanny Ogg'},
{name: 'Granny Weatherwax'},
{name: 'Samuel Vimes'},
{name: ... | true |
da7ac1abd870086a8cad4aacfcde155aa4179ac8 | JavaScript | ferdinandw/web-fetch | /index.js | UTF-8 | 2,665 | 2.953125 | 3 | [] | no_license | const URL = 'http://35.240.201.155:3000/'
fetch(`${URL}api/v1/wanderlink/show/idn/destination`)
.then(res => {
return res.json()
})
.then(data => {
console.log(data);
dataWonderLink = data;
for (let i = 0; i < 9; i++) {
addWonderLink(data[i]);
}
//... | true |
4b696b81e64e21c2f5c2857b72fe3601477ca974 | JavaScript | henokyazie/js-functions-lab-bootcamp-prep-000 | /index.js | UTF-8 | 401 | 3.421875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | // write your code below!
function happyHolidays(){return(`${happyHolidays}!`)}
function happyHolidaysTo(greeting, name){return`${greeting}, ${name}!`}
happyHolidaysTo("happyHolidays", "Henok");
function happyHolidaysTo(holidays, name){return`${happy}, ${holidays}, ${name}!`}
function holidayCountdown(holiday, days){re... | true |
62825b1e8d7bb3ba336d3cca97b5ab21e7c39c30 | JavaScript | forestturner/FutonSurfing | /frontend/util/maker_manger.js | UTF-8 | 1,471 | 3.1875 | 3 | [] | no_license |
export default class MarkerManager {
constructor(map, handleClick){
this.map = map;
this.handleClick = handleClick;
this.markers = [];
//permanently bind instance methods
this._createMarkerFromFuton = this._createMarkerFromFuton.bind(this);
this._removeMarker = this._removeMarker.bind(this);
... | true |
7c7b6d368752b2aa5326e5f8390aa5e9c05e5089 | JavaScript | apprentice3d/forge-convert-utils | /test/local-svf-to-gltf.js | UTF-8 | 1,315 | 2.6875 | 3 | [
"MIT"
] | permissive | /*
* Example: converting an SVF (without property database) from local file system
* into (1) vanilla glTF, (2) glTF with Draco compression, (3) binary glTF, and
* (4) binary glTF with Draco compression.
* Usage:
* node local-svf-to-gltf.js <path to svf file> <path to output folder>
*/
const path = require('... | true |
3ac6cf3a057738f2e22ab918c1910b712e6609a9 | JavaScript | gigatexal/alexandarnarayan | /JavaScript/Camel.js | UTF-8 | 1,089 | 3.734375 | 4 | [] | no_license | String.prototype.toCamelCase = function() {
words = this.split(' ')
var upperCased = '';
for (var i = 0; i < words.length; i++) {
for (var y = 0; y < words[i].length; y++) {
if (y == 0) {
upperCased += words[i][y].toUpperCase();
}
else {
upperCased += words[i][y];
}
}
upperCased += ' ';//RE... | true |
274172d31889a21cb30b269a6573051b57d12e04 | JavaScript | ryan0/WebglParticleDemo | /webgl.js | UTF-8 | 5,062 | 2.734375 | 3 | [] | no_license | var vertexShaderSource = `
attribute vec2 a_point;
uniform highp float u_aspect;
uniform highp float u_timer;
uniform highp vec2 u_offset;
void main() {
float angle = a_point.x;
float magnitude = a_point.y * u_timer;
gl_Position = vec4(((cos(angle) * magnitude) + u_offset.x) / u_aspect, (sin(angle) * magnitude) + ... | true |
9977d03646ad89e22c4913a40f4f5d2ab8737f59 | JavaScript | BertFrontEnd/my-sandbox | /mixed-sandbox/javascript-course/53-enhanced-object-literals/finish.js | UTF-8 | 1,812 | 3.9375 | 4 | [] | no_license | /** ЗАДАЧА 53 - Сокращенное написание свойств объектов
*
* 1. Исправьте все ошибки в коде.
*
* 2. Измените объект, возвращаемый функцией "photosGallery", используя:
* - Сокращенные имена свойств
* - Сокращенные имена методов
* - Также нужно изменить одно свойство объекта
* и сделать его вычисляемым свойством... | true |
2157dd79a94a6d7300397f6a940e0f04e618fe0a | JavaScript | Gesh4o/MineSoftUniAdventure | /SoftUni 2.0/FrontEnd/Exams/11-May-2016/02.bunnies-kill.js | UTF-8 | 1,744 | 3.375 | 3 | [] | no_license | function solve(args) {
"use strict";
function bombMatrix(matrix, bombRow, bombCol) {
let startCol = Math.max(0, +bombCol - 1);
let endCol = Math.min(matrix[bombRow].length - 1, +bombCol + 1);
let startRow = Math.max(0, +bombRow - 1);
let endRow = Math.min(matrix.length - 1, +bo... | true |
bcbe12d08e3d2a3bba67d5c1332df8a962586342 | JavaScript | Hasindu98/PafPracticalTest | /patient1/WebContent/Component/main.js | UTF-8 | 3,043 | 2.734375 | 3 | [
"MIT"
] | permissive | $(document).ready(function() {
if ($("#alertSuccess").text().trim() == "") {
$("#alertSuccess").hide();
}
$("#alertError").hide();
});
//SAVE ============================================
$(document).on("click", "#btnSave", function(event) {
// Clear status msges-------------
$("#aler... | true |
8b348f3709503dfd14cacdaa3049bee1771a4f16 | JavaScript | stephje/team-profile-generator | /__test__/generateEngineerCards.test.js | UTF-8 | 3,298 | 2.921875 | 3 | [] | no_license | const generateEngineerCards = require('../utils/generateEngineerCards.js');
const prettier = require('prettier');
describe('generateEngineerCards', () => {
it('generates an empty string when given an empty engineer array', () => {
const emptyEngineerArray = [];
const output = generateEngineerCards(... | true |
565828881c5bf2b490829978f0859c2ba3be0b7b | JavaScript | andrewscher1990/Hondana-old | /public/javascripts/shelfsearch.js | EUC-JP | 2,935 | 2.765625 | 3 | [] | no_license | var entry = [];
var urls = [];
var statuses = [];
var shelfnames = [];
var romas = [];
var descs = [];
var listtable;
var listdiv;
var listinitialized = false;
function getXmlHttpObject() {
var xmlhttp;
/*@cc_on
@if (@_jscript_version >= 5)
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} ca... | true |
0753b1001b6036be8cf554d3002e21d49c6fce67 | JavaScript | 3chordme/mario | /script.js | UTF-8 | 578 | 2.78125 | 3 | [] | no_license | $(document).ready(function(){
$(this).keydown(function(k){
console.log(k.keyCode);
if (k.keyCode === 37) {//left
$('div').animate({left:'-=10px'},150);
$('img').addClass('.left'); //not working
}
if (k.keyCode === 38) {//up
$('div').animate({top:'-=10px'},150);
... | true |
9a6b305f912f5cec6c00a745bbe973d7ab1329c6 | JavaScript | alsonshareef/loan-shark | /loanee.js | UTF-8 | 1,297 | 3.296875 | 3 | [
"MIT"
] | permissive | class Loanee {
constructor(){
this.firstName = ''
this.lastName = ''
this.email = ''
this.loanAmount = 0
this.loanDate = ''
}
getfirstName (){
return this.firstName;
}
setFirstName (firstName){
this.firstName = firstName;
}
getLastNa... | true |
9a988de8b82a4eedd8e7efc9168e1088b0653119 | JavaScript | abrown28/stuff | /js/queue.js | UTF-8 | 838 | 2.59375 | 3 | [] | no_license | // Generated by CoffeeScript 1.10.0
(function() {
var Queue;
Queue = (function() {
Queue.prototype.ips = [];
function Queue(i, o, len) {
this.i = i;
this.o = o;
this.len = len;
if (this.len == null) {
this.len = 10;
}
this.i.onmessage = function(msg) {
v... | true |
0de5c57bb3c074f8c6e8c3dcf384773ad64b95e0 | JavaScript | sduck1/testProjectSolomon | /app/js/index.js | UTF-8 | 691 | 3.015625 | 3 | [] | no_license | document.getElementById('menu-btn').onclick = openMenu;
document.querySelector('.menu-block').onclick = closeMenu;
let left = 0;
let timer = 0;
autoTime();
function autoTime() {
timer = setTimeout(function () {
let block = document.getElementById('slider');
left+= 192;
if (left>400) {
... | true |
2f4fd4840747d6aa0162993ae67f70bfe8187e1e | JavaScript | SyedHasibRahman/es6-phython | /JavaScript/Chapter 2/math.js | UTF-8 | 445 | 2.9375 | 3 | [] | no_license | console.log(Math.E);
console.log(Math.PI);
var n = 4.589
console.log(Math.abs(n));
console.log(Math.floor(n));
console.log(Math.ceil(n));
console.log(Math.round(n));
console.log(Math.max(400, 500, 600));
console.log(Math.min(400, 500, 300));
console.log(Math.pow(2, 3));
console.log(Math.pow(3, 5));
console.log(Math... | true |
58d3038707e9a55f4742faac3c8b97c154370f9c | JavaScript | marcogozzi/ISS-2020-Docs | /project/robot-web-sprint3/src/main/resources/static/app.js | UTF-8 | 6,421 | 2.59375 | 3 | [] | no_license | var stompClient = null;
var hostAddr = "http://localhost:8080/move";
var i = 1;
//SIMULA UNA FORM che invia comandi POST
function sendRequestData( params, method) {
method = method || "post"; // il metodo POST � usato di default
//console.log(" sendRequestData params=" + params + " method=" + method);
var... | true |
578ca2a0300c405fa58349facac6a62a48a705bf | JavaScript | ipqhjjybj/online | /js/form_get.js | UTF-8 | 3,104 | 2.59375 | 3 | [
"MIT"
] | permissive | // JavaScript Document
var jishu = 0;
/*
var form = document.getElementById("register");
alert("form"+form);
$(document).ready(function()
{
alert("3");
$('#infomation_submit').click(function (){
var params=$('input').serialize(); //序列化表单的值
if(check_all(form)){
alert("ajax_now");
$.ajax({
... | true |
b9beb163f78347faefab9a93d7a0623813e7423c | JavaScript | CarlosRdeV/TypeScript-Test | /TypeScript/Interfaces/interfaces.js | UTF-8 | 592 | 3.296875 | 3 | [] | no_license | "use strict";
var usuario1 = { nombreUsuario: "Juan", password: "12345", confirmarPassword: "12345" }; //Objeto con todos los atributos
var usuario2 = { nombreUsuario: "Carlos", password: "12345" }; //Objeto sin opcional
console.log(usuario1); //Mostramos en consola todo el objeto
console.log(usuario2); //Mostramos... | true |
b33962e6c8cd61c31c0065a55d335915c69ef2c9 | JavaScript | Corned/draw | /client/src/views/Draw/components/Canvas/index.js | UTF-8 | 2,975 | 2.5625 | 3 | [] | no_license | import React from "react"
import "./index.scss"
class Canvas extends React.Component {
constructor(props) {
super(props)
this.state = {
drawing: false,
lastPoint: { x: null, y: null },
socket: props.socket,
}
}
componentDidMount() {
const socket = this.state.socket
const ... | true |
ef470909676ebb57376450ce808105368f42214b | JavaScript | SebastianLF/journalapp | /src/components/SignForm.js | UTF-8 | 1,917 | 2.671875 | 3 | [] | no_license | import React, { useState } from 'react'
import { Form, Button, Alert } from 'react-bootstrap'
import axios from 'axios'
import { API_HOST } from '../utils/env'
function SignForm({ setIsAuth, url = '/signin', title = 'Signin', buttonLabel = 'Sign in' }) {
const [name, setName] = useState('')
const [password, setPas... | true |
fb9de64f0181958d9e4f8a054c1d91d3c247413d | JavaScript | Durga944/do_loop_js | /sum.js | UTF-8 | 75 | 2.671875 | 3 | [] | no_license | let sum=0
let i=0
do{
sum=sum+i
console.log(sum)
i++
}
while(i<=10)
| true |
26b9f096ddc75930a4db8ffb808fac45653fd7eb | JavaScript | mavi888/sls-components-table | /code/todo.js | UTF-8 | 1,483 | 2.53125 | 3 | [] | no_license | const AWS = require('aws-sdk');
const dynamo = new AWS.DynamoDB.DocumentClient({ region: 'us-east-1' });
const tableName = process.env.todoTableName;
function create(event, context, callback) {
const item = JSON.parse(event.body);
dynamo.put(
{
Item: item,
TableName: tableName
},
(err, resp) => {
if... | true |
63a46f0fbb115f6ad6394b0446e91266252b05dc | JavaScript | dqtkien/shorten-link_MVC_C1903L_Aptech | /client/src/Slug.jsx | UTF-8 | 1,153 | 2.71875 | 3 | [] | no_license | import axios from "axios";
import { useEffect, useState } from "react";
import { useParams } from "react-router-dom";
const Slug = () => {
const [timer, setTimer] = useState(5);
const [slugString, setSlugString] = useState("");
const [flag, setFlag] = useState(true);
const { slug } = useParams();
useEffect... | true |
412883f9e63584a8194677d1904a0c4e2ff5fb7c | JavaScript | isotope2011/ReactHooksQuiz | /src/context/reducers/globalReducer.js | UTF-8 | 863 | 2.578125 | 3 | [] | no_license | export const globalStates = {
data: null,
index: 0,
debugData: null,
error: null,
score: {
correct: 0,
wrong: 0,
},
status: null,
};
export const globalReducer = (
state,
{ type, data, error, debugData, index, status, score }
) => {
switch (type) {
case "THROW_ERROR":
return {
... | true |
257864edce0540d0f5d5fca22dd23197faee35d3 | JavaScript | chris19960730/stocks-tracker | /public/javascripts/profile.js | UTF-8 | 2,363 | 3 | 3 | [
"MIT"
] | permissive | const getCurrentUserProfile = async () => {
const res = await fetch('/myProfile');
const data = await res.json();
return data;
};
const showUserProfile = async () => {
const myProfile = document.querySelector('#myProfile');
const user = await getCurrentUserProfile();
if (!user || user.length === 0) {
r... | true |
d7ff7f45a520b3549a7fea96ad971e6a3cb65d41 | JavaScript | aptleung/Q-and-A-WebApp | /backend/src/index.js | UTF-8 | 3,138 | 3.0625 | 3 | [] | no_license | // Import Dependecies
// requires -> loads the librarys installed with NPM
const express = require("express");
const bodyParser = require("body-parser");
const cors = require("cors");
const helmet = require("helmet");
const morgan = require("morgan");
const jwt = require("express-jwt");
const jwksRsa = require("jwks-r... | true |
b4e4ee8111ed60cd144945bdcf6794032fa15cd1 | JavaScript | M-Moein-M/Weather-app-nodejs | /app.js | UTF-8 | 2,171 | 2.796875 | 3 | [] | no_license | const express = require('express');
const fetch = require('node-fetch');
require('dotenv').config();
// creating database
const Datastore = require('nedb');
const database = new Datastore({filename: 'database.db'});
database.loadDatabase();
app = express();
const port = process.env.port||3000;
app.use(express.stat... | true |
0c27b6e5b1439806eabd4aae3f053203b59ead48 | JavaScript | kflasch/einwald | /ui.js | UTF-8 | 3,989 | 2.515625 | 3 | [] | no_license | Game.UI = {
update: function() {
Game.UI.Status.update();
Game.UI.Messages.update(); // necessary?
},
addMessage: function(msg) {
Game.UI.Messages.pushMessage(msg);
Game.UI.Messages.update();
}
};
Game.UI.Status = {
update: function() {
var elemStatus = docu... | true |
7c096ee16f464ce387b73468b28c82e365845ff0 | JavaScript | amcmerrell/palindromes | /js/scripts.js | UTF-8 | 1,069 | 3.734375 | 4 | [] | no_license | $(document).ready(function(){
$("form").submit(function(event) {
var inputs = $("input#word").val().split("");
var reverseInputs = inputs.slice().reverse();
var counter = 0;
for (var i = 0; i < inputs.length; i += 1) {
if (inputs[i] === reverseInputs[i]) {
counter += 1;
}
}
... | true |
ae2d0c40a21b814704e81400bd7980957c3c8052 | JavaScript | samdutton/apprtc-c | /js/ws.js | UTF-8 | 665 | 2.5625 | 3 | [] | no_license | // 'use strict';
// function WS(uri) {
// return new WebSocket(uri);
// }
// WS.prototype.getInfo = function() {
// return this.color + ' ' + this.type + ' apple';
// };
// this.send(message) {
// this.send(message);
// }
// this.onopen = function(event) {
// console.log('open', event);
// }... | true |
f5d2bee38a1a6fa1f1c429db7aa0e97a2e76234c | JavaScript | TatsianaH/CWSolutions | /Simple remove duplicates.js | UTF-8 | 317 | 3.609375 | 4 | [] | no_license | // https://www.codewars.com/kata/5ba38ba180824a86850000f7/train/javascript
function solve(arr){
let res = [];
arr.forEach((el, i) => {
if(arr.lastIndexOf(el) === i) res.push(el);
});
return res;
}
// 2 case
function solve(arr){
return arr.filter((val,i) => arr.lastIndexOf(val) == i);
} | true |
1804b1112048bbb7d703b4f329580f6e869cc633 | JavaScript | raman744405/week4 | /week4/js/main.js | UTF-8 | 533 | 4.21875 | 4 | [] | no_license | //var date = new Date()
//alert(date)
//console.log("today is" + date)
//var cat = date
//document.body.innerHTML = "<h1> the date is" + cat + " </h1>"
//document.body.innerHTML = "<h1> the date is " + cat.getMonth() + "/" + cat.getDate() + "/" + cat.getFullYear() + " </h1> "
//how to put this code in function calle... | true |