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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
c5a25a5976edb003473d31a5624fcef7d5995fe8 | JavaScript | 1jerry/sembr | /src/app/core/promises.js | UTF-8 | 2,053 | 2.859375 | 3 | [] | no_license | define(['jquery', 'underscore', 'backbone', 'marionette'], function($, _, Backbone, Marionette){
"use strict";
// Promises
// ---------
// Modelled closely on Marionette.Callbacks to provide a
// stack of promises which must be resolved/rejected before
// before the whole is resolved
var Promises = func... | true |
f7a3be986363635593e67aee29df9e353fc12c23 | JavaScript | lujiashen/coooooood | /双指针/[344]反转字符串.js | UTF-8 | 431 | 3.859375 | 4 | [] | no_license |
/**
* @param {character[]} s
* @return {void} Do not return anything, modify s in-place instead.
*/
var reverseString = function(s) {
for (let i = 0; i < s.length; i++) {
let start = i, end = s.length - 1 - i;
console.log(start, end)
if (start < end) {
[s[start], s[end]] = [s... | true |
d6bff3ece1f000c8506416f142f0c6c48283a35b | JavaScript | hammadtariq/react-canvas-poc | /src/context/CategoriesContext.js | UTF-8 | 1,642 | 2.546875 | 3 | [] | no_license | import createDataContext from "./createDataContext";
import { categories } from "./data/categories";
const categoryTypes = {
SET_CATEGORY: "SET/CATEGORY",
ADD_CATEGORY: "ADD/CATEGORY",
UPDATE_CATEGORIES: "UPDATE/CATEGORY",
CLEAR_ERROR: "CLEAR/ERROR",
};
const initialState = {
categories,
activeCategory: {... | true |
2f0845d6be2714cc28bb4cd4437139e6f2bfa599 | JavaScript | LaunchCodeEducationClassrooms/assignment-2v2-scrabble-scorer-JuliaVarney | /scrabble-scorer.js | UTF-8 | 3,766 | 3.90625 | 4 | [] | no_license | // inspired by https://exercism.io/tracks/javascript/exercises/etl/solutions/91f99a3cca9548cebe5975d7ebca6a85
// your job is to finish writing these functions and variables that we've named //
// don't change the names or your program won't work as expected. //
const input = require("readline-sync");
const oldPointS... | true |
4d9eef4be908b5fbf7fa77ffbab181ddc6b5a92b | JavaScript | ayanshaikh18/Firebase-File-Upload-in-React | /react-app/src/App.js | UTF-8 | 2,864 | 2.640625 | 3 | [
"MIT"
] | permissive | import logo from "./logo.svg";
import "./App.css";
import React, { useState } from "react";
import { storage } from "./firebase/firebase";
function App() {
const [imageAsFile, setImageAsFile] = useState("");
const [imageAsUrl, setImageAsUrl] = useState();
const handleImageAsFile = (e) => {
const image = e.t... | true |
0b6628cf6a8ad83c613215879188bb77625764c2 | JavaScript | aburkowsky9/shortly-express | /server/middleware/cookieParser.js | UTF-8 | 384 | 2.53125 | 3 | [] | no_license | const parseCookies = (req, res, next) => {
console.log(req.get('Cookie'));
var cookie = req.headers.cookie;
if (!cookie) {
next();
}
else {
var cookiesArr = cookie.split('; ');
cookiesArr.forEach((item) => {
var cookieSplit = item.split('=');
req.cookies[cookieSplit[0]] = cookieSplit[... | true |
e9b5a13beec3b5ecd6e8759328768821d8c3cac3 | JavaScript | armoriarty/Yelpcamp | /routes/comments.js | UTF-8 | 1,708 | 2.515625 | 3 | [
"MIT"
] | permissive | var express = require("express");
var router = express.Router({mergeParams: true});
// Schema settings
var Campground = require("../models/campground");
var Comment = require("../models/comment");
var User = require("../models/user");
// Comment New Route
router.get("/new", isLoggedIn, function (req, res) {
... | true |
e3032836d654e18a6b44db4110cadac08bf9169c | JavaScript | Abascal-jorge/curso_java_script | /09-Funciones/js/04-app.js | UTF-8 | 151 | 4.0625 | 4 | [] | no_license | //Difencia entre funcion y metodo
const numero = 2 ;
console.log( parseInt("2") ); // Funcion
console.log( numero.toString() ); // Este es un metodo | true |
9d3f66b99f5d268fa066fe78f8cadd7bdfd8b60f | JavaScript | RomanLavryniv/input-text-english | /script.js | UTF-8 | 320 | 2.703125 | 3 | [] | no_license | document.querySelector('#letters').onkeypress = function (e) {
console.log(e.keyCode);
if (e.keyCode < 65 || e.keyCode > 122) {
console.log('цифри заборонені для введення');
console.log('English only');
} else {
this.value += e.key;
}
return false;
} | true |
5846e812cf022f210aa13d4ca5ae71534e4693f9 | JavaScript | jldoan91/jldoan91.github.io | /Colt-Udemy-Bootcamp/js/main.js | UTF-8 | 560 | 2.859375 | 3 | [] | no_license | var scrollY = 0;
var distance = 40;
var speed = 24;
function smoothScroll(id) {
var currentY = window.pageYOffset;
var targetY = document.getElementById(id).offsetTop;
var bodyHeight = document.body.offsetHeight;
var yPos = currentY + window.innerHeight;
var animator = setTimeout('smoothScroll(\'' + id + '\'... | true |
2abbedbf3adc0d23a5dbbd9a7a43fd0b3fadc498 | JavaScript | Sambit-Android/TravellerSourceCode | /Traveller Source Code/bsmartcloud/WebContent/resources/bsmart.lib.js/print.js | UTF-8 | 378 | 2.671875 | 3 | [] | no_license |
function printcontent(content)
{
var mywindow = window.open('', '', '');
mywindow.document.write('<html><title>Print</title><body><div style="background-color:silver;">');
mywindow.document.write(content);
mywindow.document.write('</div></body></html>');
mywindow.document.clos... | true |
cb98a2c717bd466f826b9353181f45c4386b363c | JavaScript | ankerfeng/luotuotree | /source/plugin/xigua_integralmall/static/join.js | UTF-8 | 835 | 3.078125 | 3 | [] | no_license | /**
* Created by yzg on 2015/8/3.
*/
function idecre(){
var itext = document.getElementById('itxt');
if(!itext.value){
itext.value = 0;
}
if(itext.value>min){
itext.value = parseInt(itext.value) -1;
}else{
renum(itext, 1);
}
}
function iincre(){
var... | true |
7c5f68885feda959023c3abd125e286b396bcfe5 | JavaScript | adilson-lima/gostack-conceitos-reactjs | /src/App.js | UTF-8 | 1,550 | 2.875 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
import api from './services/api'
import "./styles.css";
function App() {
useEffect(() => {
api.get('repositories').then(response => {
setRepository(response.data)
//console.log(repositories)
})
}, [])
const [repositories, setRepository] ... | true |
3906b98beccb0283deefac234324d9a9d9439b2c | JavaScript | Xiaobo2020/test-platform | /src/task.js | UTF-8 | 955 | 2.984375 | 3 | [] | no_license | import { setImmediate } from "core-js";
function test1 () {
setTimeout(() => {
console.log('log - timeout');
}, 0);
const promise1 = new Promise((resolve) => {
console.log('log - promise1');
resolve('promise1');
});
setImmediate(() => {
console.log('log - setImmediate');
}, 0);
(async ()... | true |
0b32bc4127b9b9e05f88795a5f239e2964a1ffbf | JavaScript | CharlieKing27/calculator | /calc.js | UTF-8 | 4,301 | 2.734375 | 3 | [] | no_license | import React, { Component } from 'react';
import './calc.css';
import Screen from './screen';
import Button from './buttons';
class demo extends Component {
constructor() {
super();
this.state = {
question: '',
answer: '',
operator: '',
key: '',
error: ''
}
this.handleClick = this.handleClick.... | true |
b1f409b558dc058c35ccda77f64662ffdf3a771b | JavaScript | itsraxa/my-app | /src/components/TextForm.js | UTF-8 | 2,733 | 3.3125 | 3 | [] | no_license | import React,{useState} from 'react'
export default function TextForm(props) {
const [text,setText] = useState('Enter Text Here');
const handelUpClick = ()=>{
let newText = text.toUpperCase();
setText(newText);
props.showAlert("Text Capitalized successfully" ,"success")
}
const ... | true |
1837a0a6dfd4717a806586bce9658c797b720ea3 | JavaScript | yasmany1111/infinimy | /src/classes/PlayerShip.js | UTF-8 | 5,220 | 2.578125 | 3 | [] | no_license |
import { registerUpdate } from "../states/update";
import { playerShip } from "../states/create";
import { KeyboardHandler } from "../ui/keyboard";
import { MiningLaser } from "./tools/miningLaser";
import { Navigator } from "./tools/navigator";
import { InventoryModule } from "./systems/modules/Inventory";
import { E... | true |
96f508e608b1ba8153f7e4fa9a578f994c64e364 | JavaScript | niusha-mhd997/webProjectPhaseTwo | /src/main/webapp/js/managerPage.js | UTF-8 | 6,203 | 3.0625 | 3 | [] | no_license | function myFunction() {
var arr1 = [
["1", "1397/08/03", "شکایت", "مشاهده"]
, ["2", "1397/10/15", "درخواست", "مشاهده"]
, ["3", "1397/12/25", "انتقاد" ,"مشاهده"]
];
if (arr1.length !== 0) {
var table = document.getElementById("table1");
table.deleteRow(1);
... | true |
12600eac3654a049c80ece485eb0fb41ee1c9a2d | JavaScript | MisterrW/PDA | /project unit/p9-19/interactin with persistence/index.js | UTF-8 | 679 | 3.28125 | 3 | [] | no_license | window.onload = function(){
var helloText = document.getElementById("hello")
helloText.innerText = "hi there"
var retrievedText = document.getElementById("retrieved-text")
if(localStorage.getItem("textEntered") !== null){
console.log(localStorage)
retrievedText.innerText = localStorage.getItem("textEn... | true |
6d1b4ab96a8603182e9b3149790e5cf1465d01c7 | JavaScript | MehaBhandari/simple-react-redux-hooks | /src/reducer/employeeDetailsReducer.js | UTF-8 | 386 | 2.65625 | 3 | [] | no_license | export default function(state=[],action) {
if(action.type === 'SET_EMPLOYEE_LIST') {
return action.payload;
}
if(action.type === 'DELETE_EMPLOYEE') {
let filteredData = state.filter((emp)=> {
return (emp.id !== action.payload)
});
console.log(filteredData);
... | true |
04e5674189c052ce6bdd4e576dd1cce7fe8d012e | JavaScript | arbyte-br/Arbyte-Atividades | /turma-2/caickmarques/Lista_9/E2.js | UTF-8 | 380 | 2.515625 | 3 | [] | no_license | let fimc = require('fasam-imc-calc');
let FasamIMC = require('fasam-imc-calc');
let rs = require('readline-sync');
let peso = rs.questionInt('Informe o seu peso para descobrir o seu IMC: ');
let altura = rs.questionFloat('Agora informe sua altura: ');
let imc = new FasamIMC(peso, altura);
let resultadoIMC =... | true |
7192d64d73c0afd49b0ea8ba19f71d4644079ab8 | JavaScript | f/yarn | /src/util/normalize-manifest/validate.js | UTF-8 | 4,277 | 2.59375 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"BSD-3-Clause",
"MIT",
"LicenseRef-scancode-unknown-license-reference",
"Unlicense",
"Apache-1.1",
"Apache-2.0",
"BSD-2-Clause",
"WTFPL",
"ISC"
] | permissive | /* @flow */
import type {Reporter} from '../../reporters/index.js';
import {MessageError} from '../../errors.js';
import {isValidLicense} from './util.js';
import typos from './typos.js';
const isBuiltinModule = require('is-builtin-module');
const strings = ['name', 'version'];
const dependencyKeys = [
// npm reg... | true |
2e4c95597deee3f56e7035f914799385421720ad | JavaScript | greeflas/JavaScript | /lesson2/js/script.js | UTF-8 | 1,513 | 3.953125 | 4 | [] | no_license | /* if-else, do-while */
var login = '';
do {
login = prompt('Input your login', '');
if (login === null) {
alert('Log in is by user exited...');
break;
}
} while(login !== 'admin');
if (login === 'admin') {
var password = prompt('Input your password', '');
var message = '';
if... | true |
f30b874041d9645898d5b0926c6f1c1b3677bc3c | JavaScript | elmastudio/Heliblocks-App | /src/pages/documentation/docs-es.js | UTF-8 | 2,745 | 3.125 | 3 | [] | no_license | export default `
# Bienvenido a Heliblocks
Heliblocks nace con la necesidad de reutilizar y compartir fragmentos de HTML y CSS. Para ello hace uso de las capacidades de edición, del editor de bloques de WordPress y las posibilidades de personalización, de las variables nativas de CSS.
Para poder empezar a utilizar tus... | true |
a90bb14afe1301c85dc41c3db40a1c4aef1a8cd9 | JavaScript | shindad/FEGBA_Anim | /feugit/assets/javascript/main.js | UTF-8 | 32,979 | 2.75 | 3 | [] | no_license | ///GLOBAL VARIABLES///
//Global variables that control which toggled class categories load new html data from JS or not
var swordD = false, lanceD = false, axeD = false, bowD = false, cavD = false, flyD = false, lordD = false, mageD = false, monsterD = false, dancerD = false, spellD = false;
//Global Variables that c... | true |
7dfb9afc962572b31c002583f13ef6bc2d64e6eb | JavaScript | schematical/chaospixel | /src/helper.js | UTF-8 | 1,515 | 2.90625 | 3 | [
"Apache-2.0"
] | permissive | var Jimp = require('jimp');
var async = require("async");
const X_OFFSET = 256;
const TILE_SIZE = 16;
const MAP_WIDTH = 4352;
const MAP_HEIGHT = 1408
const ROOM_WIDTH = (MAP_WIDTH - X_OFFSET) / 16;//16 * TILE_SIZE;
const ROOM_HEIGHT = MAP_HEIGHT / 8;//11 * TILE_SIZE;
const DEST_PATH = '../data/zelda_map/';
// open a fi... | true |
0825d12a55881114781f73b0f338a99f75dead6b | JavaScript | kajjjak/notebook | /notebook/platforms/ios/www/js/utils_phonegap.js | UTF-8 | 634 | 2.546875 | 3 | [] | no_license | function fixDeviceHeaders(){
//FIX BUTTON AND HEADER
$(".fix_button").css("padding","4px");
$(".fix_button").css("border-radius","10px");
$(".fix_button").css("border-color","darkgray");
$(".fix_header").css("padding-bottom","8px");
if (window.device){
if (parseFloat(window.device.version) >= 7.0) {
... | true |
ed9815c5a645cae46e3213695731712ccbc03bbb | JavaScript | zwhitchcox/babel-plugin-proxy | /src/runtime.js | UTF-8 | 1,044 | 3.140625 | 3 | [
"MIT"
] | permissive | var defaultHandler = {
get: (obj, propName) => obj[propName],
set: (obj, propName, val) => { obj[propName] = val }
}
var Proxy = function (target, handler) {
this.target = target
this.handler = handler
this.handler.get = this.handler.get || defaultHandler.get
this.handler.set = this.handler.set || defaultH... | true |
e84980008fb8bd73b67885c6864c9b2427a31516 | JavaScript | ajlopez/RskUtils | /proclogs/blockstime.js | UTF-8 | 1,389 | 2.796875 | 3 | [
"MIT"
] | permissive |
const fs = require('fs');
const filename = process.argv[2];
const nmintxs = process.argv[3] ? parseInt(process.argv[3]) : 0;
const text = fs.readFileSync(filename).toString();
const lines = text.split('\n');
for (let k = 0, l = lines.length; k < l; k++) {
const line = lines[k].trim();
if (line.indexOf(... | true |
78a6c91d2f297443789042c056dda66906257b1c | JavaScript | winged259/stackOverMeme | /test/app.js | UTF-8 | 476 | 2.578125 | 3 | [] | no_license | // var width = window.innerWidth;
// var height = window.innerHeight;
// var stage = new Konva.Stage({
// container: 'container',
// width: width,
// height: height,
// });
// var imageObj = new Image();
// imageObj.onload = function() {
// var image = new Konva.Image({
// x: 200,
// y:... | true |
218489acab814208e9d0983b86146dcebaf9d055 | JavaScript | LMVR90/MEX-008-Cipher | /src/cipher.js | UTF-8 | 3,751 | 3.734375 | 4 | [] | no_license | //Implementa el objeto cipher. Este objeto contiene dos métodos:
// Método encode. El offset es el número de posiciones que queremos mover a la derecha en el alfabeto y string el mensaje (texto) que queremos cifrar.
window.cipher = {
encode: (offset, string) => {
let result = ""; //variable que recibirá y expresará ... | true |
24aada9e707e5e0eb3636e5de37365cfaf692a4a | JavaScript | amokrushin/stream-zip | /example/example-error-pass.js | UTF-8 | 528 | 3.125 | 3 | [
"MIT"
] | permissive | const { PassThrough } = require('stream');
const Zip = require('..');
const zip = new Zip({ forwardErrors: 'pass' });
const ps1 = new PassThrough({ objectMode: true });
const ps2 = new PassThrough({ objectMode: true });
ps1.pipe(zip);
ps2.pipe(zip);
ps1.write(1);
ps1.write(2);
ps1.write(3);
ps1.end();
ps2.write('a'... | true |
9ff401dc0d69b6e9f53d1e4f41cdc01046cea5da | JavaScript | iha2/OldProjects | /nodechat/public/assets/js/message.ctrl.js | UTF-8 | 837 | 2.609375 | 3 | [] | no_license | /*
* message.ctrl.js
* This controller handles the submission of message to be displayed
* by the user to other users and to the principal user as well.
* It takes advantage of the socket.io API to handle the sending and reciving
* of test to and from the user.
*/
function messageCtrl($rootScope, socke... | true |
039dfd5be3820c204bc31389e1d60c2479ef5e06 | JavaScript | G-Sravanthi/JS-Challenges | /Arrays/filters.js | UTF-8 | 320 | 3.4375 | 3 | [] | no_license | 'use strict';
// we should filter an array of words which starts with t and ends with r.
var words = ["tiger", "toast", "boat", "tumor", "track", "bridge"]
var newData = words.filter((elem) => {
return elem.startsWith('t') && elem.endsWith('r') ? true:false;
}); // returns ["tiger", "tumor"]
console.log(newData); | true |
904aceb3364bdf618f1a2043bfaa9672cdb411b0 | JavaScript | dewfall123/Diary | /leetcode/238.product-of-array-except-self.js | UTF-8 | 547 | 3.375 | 3 | [] | no_license | /*
* @lc app=leetcode id=238 lang=javascript
*
* [238] Product of Array Except Self
*/
/**
* @param {number[]} nums
* @return {number[]}
*/
var productExceptSelf = function(nums) {
const output = [];
let rightMuti = 1;
for (let i = nums.length - 1; i >= 0; i --) {
output[i] = rightMuti;
... | true |
7979969700ea64d27e1c988354bd69a857bcbda3 | JavaScript | jada7C7/https-github.com-CodersLab-WRO_FRO_S_03_JavaScript_prework | /5_Tablice/script6.js | UTF-8 | 607 | 3.375 | 3 | [] | no_license | /*fvar firstIndex = 0;
var tab = [3, 4, 3, 4, 5, 7, 8, 5, 6, 9,];
//tab.sort();
/*for (var i = 0; i<tab.length; i++){
for (j =0; j<tab.length; j++){
if (tab[i] < tab[j])
{
var tmp = tab[i];
tab[i] = tab[j];
tab [j] = tmp;
}
}
}*/
let box = [9, 7, 9, ... | true |
9f226f4578709a1c88f1c628185ac6fad576c53b | JavaScript | Freelance-tech-support/master | /models/User.js | UTF-8 | 874 | 2.53125 | 3 | [] | no_license | const mongoose = require("mongoose");
const bcrypt = require("bcryptjs");
const UserSchema = new mongoose.Schema({
username: {
type: String,
required: [true, "Username is required"],
minlength: 6,
unique: true,
},
password: {
type: String,
minlength: 8,
required: [true, "Password is required"],
sele... | true |
82cc4b3e195d096d1ab944b455e481118115183d | JavaScript | lsimonar/API_3 | /server.js | UTF-8 | 2,501 | 2.640625 | 3 | [] | no_license | require('dotenv').config();
var bodyParser = require("body-parser");
const express = require('express');
const cors = require('cors');
const app = express();
const mongoose = require('mongoose');
const dns = require('dns');
const urlparser = require('url');
// Basic Configuration
const port = process.env.PORT || 3000;
... | true |
5e3752d178a3653c82bfe868c08896797d421282 | JavaScript | rtothaoss/Sante | /public/js/appointments.js | UTF-8 | 1,497 | 2.78125 | 3 | [] | no_license | $(function() {
console.log("appointment.js is working");
$.get("/api/appointments", function(data) {
for (var i = 0; i < data.length; i++) {
var createNewRow = $("<tr>");
createNewRow.append("<td>" + data[i].name + "</td>");
createNewRow.append("<td>" + data[i].reasonForVisit + "</td>");
... | true |
46bd86cabca543910a9ea43aca4c474183caad65 | JavaScript | seenaburns/Marabu | /sources/scripts/theme.js | UTF-8 | 2,443 | 2.765625 | 3 | [
"MIT"
] | permissive | function Theme()
{
this.el = document.createElement("style");
this.active = null;
this.default = { background: "#222", f_high: "#fff", f_med: "#777", f_low: "#444", f_inv: "#000", b_high: "#000", b_med: "#affec7", b_low: "#000", b_inv: "#affec7" }
this.start = function()
{
if(localStorage.theme && is_js... | true |
435ffc736977f66d9c988b5756b68431901e79ea | JavaScript | ErnWong/lab | /src/scripts/fps.js | UTF-8 | 1,053 | 2.9375 | 3 | [
"MIT"
] | permissive | define(["events"], function(EventEmitter) {
function FPS() {
this.value = 0/0;
this.interval = 30;
this.framesPerTick = 1;
this.count = 0;
this.next = 0;
this.process = null;
this.listening = false;
this._handler = function(){};
}
var proto = FPS.prototype = new EventEmitter();
proto.startLog = ... | true |
7b6cd3dc709d7d349cd6576e54da5f799ef74690 | JavaScript | hieubui97/Digidinos_test | /Javascript/JS_basic1/ES5/js/es5.js | UTF-8 | 4,692 | 3.859375 | 4 | [] | no_license | "use strict";
$().ready(function () {
// strim: loại bỏ khoảng trắng 2 đầu
var str = " Hello World! ";
console.log(str.trim());
// isArray
var fruits = ["Banana", "Orange", "Apple", "Mango"];
console.log(Array.isArray(fruits));
// forEach
var txt = "";
var numbers = [... | true |
32978206d2ad3aae803be17994ca67bfee2581cb | JavaScript | gesa30527/DeveloperBotsJS | /index.js | UTF-8 | 762 | 2.796875 | 3 | [] | no_license | const Discord = require('discord.js');
const client = new Discord.Client();
const prefix = ",";
client.on('ready', () =>{
console.log("bot is online!");
setInterval(() => {
client.user.setActivity("ULTIMATE",{type: "WATCHING"})
}, 5000)
});
client.on("message", message => {
if (message.author.bot) retur... | true |
b776df66ad1e67bffc0cc08d30fab2a1daea527f | JavaScript | kevinpickett/golf-draft | /modules/data.js | UTF-8 | 1,665 | 2.578125 | 3 | [] | no_license | function importCSV(evt) {
return new Promise(resolve => {
Papa.parse(evt.target.files[0], {
header: true,
complete: function(results) {
inputData = results.data
window.localStorage.setItem('fileContent', JSON.stringify(inputData))
const... | true |
8c5395c3c6f1ba520f684df739c0e34b5cc76a01 | JavaScript | Guirongbaby/ES6-Demo | /20_function.js | UTF-8 | 267 | 3.265625 | 3 | [] | no_license | function add(a,b = 1){
return a+ b;
}
console.log('add(1) :',add(1));//2
console.log('add(1,undefined) :',add(1,undefined));//2
let x = 1;
function add(a,b = x){
return a+ b;
}
console.log('add(1) :',add(1)); //2
x +=1;
console.log('add(1) :',add(1)); //3
| true |
fcff203dc7be98852eff1a8c2af5d00bd8d3c082 | JavaScript | SeregaFreelance/freelance | /js/script.js | UTF-8 | 4,772 | 2.5625 | 3 | [] | no_license | function addClass(selList, selBurger){
const list = document.querySelector(selList),
burger = document.querySelector(selBurger)
burger.addEventListener('click', function(){
this.classList.toggle('active')
list.classList.toggle('active')
})
}
addClass('.header__menu', '.he... | true |
c66ef613b78f032e9fbfbae5346e3cc2cba18cee | JavaScript | shunwuyu/lesson_md | /interview/vue/all/sourcemap_demo/src/main.js | UTF-8 | 271 | 3.125 | 3 | [] | no_license | console.log('Interesting!!!')
// Create heading node
const heading = document.createElement('h1')
heading.textContent = 'Interesting!'
console.log(a); // 这一行会报错
// Append heading node to the DOM
const app = document.querySelector('#root')
app.append(heading)
| true |
3d0caf9905a41148a79ad7339b7e1bcdaba5bfd1 | JavaScript | lekrans/javascriptCode | /projects/atomic/objects/Arrays/indexOf/app.js | UTF-8 | 1,239 | 3.59375 | 4 | [] | no_license | const log = require('lekrans_code_helper');
const appName = 'indexOf';
log.header(appName);
log.subHeader1(
`Searches the array for the specified item and returns its index or -1
array.indexOf(item, start)
Parameter Description
item Required. The item to search for
start Optional. Where to start t... | true |
dd82c450054bf0ac2e60b3d0c147857bd1c53219 | JavaScript | meiraleal/rntest | /src/reducer.js | UTF-8 | 684 | 2.65625 | 3 | [] | no_license | import * as types from './ActionTypes';
const initialState = {
rows: [],
form: {
name: null,
date: null,
venueCity: null,
venueState: null
}
};
export default function reducer(state = initialState, action) {
switch (action.type) {
case types.FETCH_DATA: {
return {
...state,
... | true |
8f257307091000a733579f26f79fb4a7b51061b6 | JavaScript | cloudfour/cloudfour.com-patterns | /src/make-twig-include.js | UTF-8 | 2,147 | 3.1875 | 3 | [] | no_license | /**
* Convert an object of story arguments into a Twig `with` string for use in
* template source strings.
* @param {any} args
*/
export const makeArgsString = (args = {}) => {
if (Object.keys(args).length > 0) {
return ` with ${JSON.stringify(args, null, 2)}`;
}
return '';
};
/**
* Generate a twig sou... | true |
0414c66ac67b2bf2114e238e533c8dc72fb7214a | JavaScript | ebzeal/3Dscene | /backend/src/utils/passwordHash.js | UTF-8 | 827 | 2.8125 | 3 | [] | no_license | import argon2 from 'argon2';
/**
* @class PasswordHash
* @description Hashes and verifies passwords
*/
class PasswordHash {
/**
*
* @description Method to hash a user password
* @param {string} password user password
* @returns {string} hashed string
*/
static async hashPassword(password) {
try {
... | true |
28209c3cfdc0b0a418aeb8178da2b25e1932e12c | JavaScript | Gashu12/cs301 | /week1_day4/l4q2.js | UTF-8 | 374 | 3.53125 | 4 | [] | no_license | let prompt = require('prompt-sync')();
let phrase = prompt('Enter a Phras: ');
let num = prompt('Enter a number: ');
for(let i = 0; i < num; i++){
console.log(phrase);
}
/*
input: Get a phrase from the user.
Get a number from the user.
processing: check the number and print the phrase unti... | true |
2a2f85d9f7334500c5a246c9cfa3730b43f10a59 | JavaScript | ToJen/cryptoeconomics-notes | /lectures/ch1/utxoPayPalWithSigs.js | UTF-8 | 3,274 | 3.21875 | 3 | [
"MIT"
] | permissive | const EthCrypto = require('eth-crypto')
var accounts = {
'paypal': EthCrypto.createIdentity(),
'aparna': EthCrypto.createIdentity(),
'jing': EthCrypto.createIdentity()
}
var initialState = {
utxos: [0],
txOutputs: [{value: 1000, owner: accounts.paypal.address}]
}
var unsignedTxs = [
{
... | true |
8ecf3a95efd43a0465a5b27bdc281e24a402faad | JavaScript | brigidrose/mixed-feelings | /static/js/feelings.js | UTF-8 | 3,996 | 3.0625 | 3 | [] | no_license | var markers = [];
var map;
function filterByKeyword(keyword){
if(keyword == ""){
markers.forEach(function(marker){
marker.setMap(map);
})}else{
markers.forEach(function(marker){
if (marker.keyword != keyword)
marker.setMap(null);
else
marker.setMap(map);
});
}... | true |
1e8c10b44f8397457511b8cde037cfed23b00ec4 | JavaScript | cblupodev/frcdcmp_intrmdt_wiki | /script.js | UTF-8 | 1,948 | 2.703125 | 3 | [] | no_license | /**
* You must include the dependency on 'ngMaterial'
*/
var app = angular.module('app', ['ngMaterial']);
app.controller('Main', ['$scope', '$http', '$sce', function($scope, $http, $sce) {
$scope.submit = function() {
// set the local storage item to the search query
localStorage.setItem... | true |
8549a1499125afe8b256a931f8a1224174a29a02 | JavaScript | Plant-Purpose/pp-backEnd | /routes/taskRoutes/taskRoutes.js | UTF-8 | 1,797 | 2.5625 | 3 | [
"MIT"
] | permissive | const router = require('express').Router();
const Tasks = require('../../data/models/tasks/tasks');
router.get('/:id/tasks', (req, res) => {
const { id } = req.params;
Tasks.get(id)
.then(tasks => {
tasks.map(tasks => {
if (tasks.completed) {
tasks.compl... | true |
ae5795456185524a79d500219b498fdf1d85b815 | JavaScript | VivianeRoch/Teste-Pratico | /ApiLoca/node-str/src/entities/driverEntity.js | UTF-8 | 1,248 | 3 | 3 | [] | no_license | var base = {
"id": null,
"nome": null,
"cpf": null
};
var memoria = [];
function generateId(){
var maxId = getMaxId();
return (maxId + 1);
}
function getMaxId(){
maior = 0;
memoria.forEach(function(entity){
if(entity.id > maior){
maior = entity.id;
... | true |
7b18f702ccc0f060b5afd954ab5c92212e048ece | JavaScript | bowditch/genome-designer | /extensions/requireExtensions.js | UTF-8 | 600 | 2.53125 | 3 | [] | no_license | const fs = require('fs');
module.exports.load = (normalizedPath) => {
const extensions = {};
const manifests = {};
fs.readdirSync(normalizedPath).forEach(folder => {
if (folder.indexOf('.js') === -1) {
try {
manifests[folder] = JSON.parse(fs.readFileSync(normalizedPath + '/' + folder + '/manifes... | true |
1ea470da8e4f68ea768f4f0300090523a5613fb2 | JavaScript | ewerx/liquid-architecture | /Javascript/observe-playing-slot-index.js | UTF-8 | 915 | 2.671875 | 3 | [] | no_license | /**
* @author Michael Dean <myke@ckut.ca>
* @link https://soundcloud.com/wiklow
*/
/**
* Inlet is provided for the live.thisdevice object.
*/
inlets = 1
outlets = 1
/**
* Trigger the clip operations.
*/
function bang() {
get_playing_slot_index();
}
/**
* Observe the playing_slot_index property of the track... | true |
a4999526480a7fac385b41508a79fa813e0e49c5 | JavaScript | ztas108/asi108_capstone01 | /calculator.js | UTF-8 | 1,267 | 3.171875 | 3 | [] | no_license |
var historyId = 0;
var result;
function insert(n) {
document.calTxt.display.value += n;
}
function equal() {
if (isNaN(eval(document.calTxt.display.value))) {
document.calTxt.display.value = "";
}
... | true |
377d11ae6cd0549f8ab35904d4d69f100efe50a1 | JavaScript | Mimperial/my-html-learning | /js/test.js | UTF-8 | 203 | 2.640625 | 3 | [] | no_license | function changeImage()
{
var element=document.getElementById('myimage');
if (element.src.match("bulbon"))
{
element.src="image/eg_bulboff.gif";
}
else
{
element.src="image/eg_bulbon.gif";
}
} | true |
47f507a7a81df2e01a98048bc9ea1bd7d0bf8646 | JavaScript | tanguyprvst/chess | /public/javascripts/chessboard.js | UTF-8 | 2,678 | 2.828125 | 3 | [] | no_license | var e_drag = null;
var dropid = null;
var local = window.location.href
let localboard = []
let localuser = "";
let firstcase = null;
let overcase = null;
// #85F775
function allowDrop(ev) {
ev.preventDefault();
}
function click(target) {
a_case = target.id;
if(firstcase != null){
// remove col... | true |
c277860592ee9373f0c65ff16f487fbbe26ad6a7 | JavaScript | daweiyuanzhang/vercel-proxy | /api/index.js | UTF-8 | 1,040 | 2.609375 | 3 | [
"MIT"
] | permissive | const fetch = require('node-fetch');
const allowCors = fn => async (req, res) => {
res.setHeader('Access-Control-Allow-Credentials', true)
res.setHeader('Access-Control-Allow-Origin', '*')
// another common pattern; but there might not be origin (for instance call from browser)
// res.setHeader('Access-Control... | true |
aeb13185e5edc58aa429e2ca59f3241127527225 | JavaScript | tonngw/leetcode | /javascript/1834-single-threaded-cpu.js | UTF-8 | 740 | 3.125 | 3 | [
"MIT"
] | permissive | /**
* @param {number[][]} tasks
* @return {number[]}
*/
var getOrder = function(tasks) {
for(let i = 0; i < tasks.length; i++) tasks[i].push(i);
tasks.sort((a, b) => a[0] - b[0]);
const pq = new MinPriorityQueue({
compare: (e1, e2) => {
if(e1[1] === e2[1]) return e1[2] - e2[2];
... | true |
3b1e591cf9ae3093726f747d1eafe14e7156637f | JavaScript | keriweiss/dealers_choice_pg | /src/main/addtable.js | UTF-8 | 357 | 2.515625 | 3 | [] | no_license | import { createEl, content } from '../index';
const addTableToTables = async (newTable) => {
const tableDiv = createEl();
tableDiv.className = 'table';
tableDiv.id = `t${newTable.table_number}`;
tableDiv.innerHTML = `TABLE ${newTable.table_number}: <br>(${newTable.relation})`;
content.appendChild(tableDiv);
... | true |
f1fa9573235f5b066378a7704429d1bad402b456 | JavaScript | R0th3k/HTML5-Init | /src/js/main.js | UTF-8 | 87 | 2.96875 | 3 | [] | no_license | function saludo (nombre) {
return console.log('hola ' + nombre);
}
saludo('Mandita') | true |
f5a91e6471ed2091b04bc454749154a417b629ea | JavaScript | shivamacs/add-mod-hackerrank | /script/moderatorWithPuppeteer.js | UTF-8 | 4,625 | 2.65625 | 3 | [
"MIT"
] | permissive | /* Task -> Login into hackerrank website and add a moderator to each challenge. Moderator username is provided
as input arguments. Here, we are doing this using puppeteer
*/
let fs = require('fs');
let path = require('path');
let puppeteer = require('puppeteer');
let credentialsFile = process.argv[2];
let moderato... | true |
8fcd6842ded7ed9427fcb10c02f02da744788061 | JavaScript | trapple/icecream-angularjs | /app/js/mvc-example-angular.js | UTF-8 | 2,012 | 2.890625 | 3 | [] | no_license | var icecreamApp = angular.module('icecreamApp', []);
icecreamApp.controller('mainCtrl', ['$scope', function ($scope) {
$scope.icecreamModel = {
// 選択できるアイスクリーム一覧
listAll: [
{id: 't1', name:'バニラ'},
{id: 't2', name:'チョコレートチップ'},
{id: 't3', name:'オレンジシャーベット'},
{id: 't4', name:'チョコミント'... | true |
b574312ca8adbcd16ea994836726925b5457a1b9 | JavaScript | maral/matchbox | /src/Answers.js | UTF-8 | 1,195 | 2.96875 | 3 | [
"Apache-2.0"
] | permissive | import React, { Component } from 'react';
import { Button, Row, Col } from 'reactstrap';
export function AnswerBox(props) {
return (
<div>
<div className="Question">
{props.mode === "m" ? "Kolik sirek je v krabičce?" :
<div>Jakou hodnotu má <strong>x</strong>?</div>}
</div>
<... | true |
869917f91a1d631820956fe7e9a6f869b5e20ba4 | JavaScript | julisoulstar/TallerJavaScript | /public_html/p44/js/p44.js | UTF-8 | 677 | 3.390625 | 3 | [
"MIT"
] | permissive | function math() {
var number1 = $('#number1').val();
var number2 = $('#number2').val();
var result1 = parseInt(number1) + parseInt(number2);
var result2 = parseInt(number1) - parseInt(number2);
var result3 = parseInt(number1) * parseInt(number2);
var result4 = parseInt(number1) / parseInt(number2);
... | true |
a04a64f47b6b853c45e108e5b9a138bb18cc585e | JavaScript | gtrubio192/code-practice | /fibonacci.js | UTF-8 | 1,069 | 4.0625 | 4 | [] | no_license | // My code:
var fib = function(n) {
if(n <= 1) return n
return fib(n-1) + fib(n-2)
};
// Dynamic programming solution 1 - uses less memory
var fib = function(n) {
if (n === 0) return 0;
if (n < 2) return 1;
let dp = [0, 1];
for (let i = 2; i <= n; i++) {
dp[2] = dp[1] + dp[0];
dp[0] = dp... | true |
46d78e931435edef1e459f427c8d2a851c2503d0 | JavaScript | FPhilipi/FPhilipi.github.io | /04_facebookSignUp/script.js | UTF-8 | 2,121 | 2.9375 | 3 | [] | no_license | function buttonAlert() {
const buttonLogin = document.querySelector('#button-login');
const userEmailPhone = document.querySelector('#user-email-phone');
buttonLogin.addEventListener('click', function () {
alert(userEmailPhone.value);
});
}
buttonAlert();
function validateFieldsMessage() {
const button... | true |
afc3cf8b23cd46699fb044e1a15bebf7f709069a | JavaScript | MettaTan/Secure-Coding-Assignment | /BackEnd/model/hash.js | UTF-8 | 349 | 2.6875 | 3 | [] | no_license | const bcrypt = require('bcrypt');
const password = "abc123"
const saltRounds = 10
bcrypt.genSalt(saltRounds, function (err, salt) {
if (err) {
throw err
} else {
console.log(salt)
bcrypt.hash(password, salt, function(err, hash) {
if (err) {
throw err
} else {
console.log(ha... | true |
5c3f029d2d63285ecfdeffcabb0e78c51a2d7ffb | JavaScript | lgarest/js-exercises | /tests/control/lesson3.test.js | UTF-8 | 604 | 3.390625 | 3 | [] | no_license | // import the fn
const celsiusToFahrenheit = require('../../lessons/control/lesson3');
// and test it
const test = require('../../lib/test');
test('5 is an odd number', celsiusToFahrenheit(60), 140);
test('3 is an odd number', celsiusToFahrenheit(0), 32);
test('2 is not an odd number', celsiusToFahrenheit(-38), -36... | true |
d2e0e13eab94345ff42ff9dd68f59c9c3739e243 | JavaScript | Juwei-Wang/Project_synchronous_image_editor | /cookie_session.js | UTF-8 | 1,487 | 2.640625 | 3 | [] | no_license | const { v4: uuidv4 } = require('uuid');
//import { v4 as uuidv4 } from 'uuid';
let SESSION_DATA = {};
function getUUID(){
let uuid = uuidv4();
return uuid;
}
exports.setCookieAndSession = function (req,res,username){
let userID = getUUID();
res.writeHead(200,{
'Set-Cookie': `userid = ${userID}... | true |
af3e2995245becb2316fbd822b148c540a3d74cc | JavaScript | craig-harbottle/synchazard | /source/server/js/handlers/chat.js | UTF-8 | 2,737 | 2.703125 | 3 | [
"MIT"
] | permissive | (function () {
"use strict";
var ___ID = $NS$.id;
function cleanup (text, pre) {
return (pre ? '<pre>' : '') +
(text
.replace(/&(?![\w\#]+;)/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"'... | true |
a4b6e1c85f97a3b12c2e38ba869cfbef96bb04d9 | JavaScript | horinezachary/PorkchopBot | /commands/moderation/unban.js | UTF-8 | 1,313 | 2.671875 | 3 | [] | no_license | const Command = require(`${process.cwd()}/base/Command.js`);
const Discord = require("discord.js");
class unban extends Command {
constructor(client) {
super(client, {
name: "unban",
description: "Unbans a user from the server by mention/id.",
usage: "unban <user> <reason>",
aliases: [],
... | true |
706cb165202556b0cb9310de2ba75ee3c59d2779 | JavaScript | esalaz/raceCarGame | /assets/script.js | UTF-8 | 262 | 2.828125 | 3 | [] | no_license |
function listen(){
var a=20;
document.body.addEventListener('keydown',function(key){
if(key['code']==='Enter'){
console.log("You pressed Enter");
document.getElementById('playerOne').style.animationDuration=a+"s";
a-=2;
}
});
}
| true |
411e09b362c30d5d00d5c23d5a49e72ed2ddc3fc | JavaScript | WebTestingTrit/ejercicio-tema-2-Auriel96 | /src/models/stack.js | UTF-8 | 467 | 3.453125 | 3 | [
"MIT"
] | permissive | exports.Stack = class Stack {
constructor() {
this.contents = [];
this.top = 0;
}
size() {
return this.contents.length;
}
push(elementToPush) {
this.contents[this.top] = elementToPush;
this.top++;
}
pop() {
if (this.isEmpty()) {
thr... | true |
cd7a6ead1ff7eda03943b34fe97ef3936f7cb02c | JavaScript | 97-Jeffrey/data-structure | /linked list/palindromeLinkedList.js | UTF-8 | 664 | 3.796875 | 4 | [] | no_license | // we set slow as the middle point of the linked list, we reverse it, then compare it with complete(fast) linked list for values
function isPalidrome(head){
let fast = head;
let slow = head;
while(fast && fast.next){
fast = fast.next.next;
slow = slow.next;
}
fast = head;
slow = reverse(slow);
... | true |
e8a5bbf0fc99a8cb49c54893697a32c632874773 | JavaScript | glhrmarques/Read-more-button | /myScript.js | UTF-8 | 331 | 3.15625 | 3 | [] | no_license | const button = document.querySelector(".read-button");
const text = document.querySelector(".text");
button.addEventListener('click', (e) => {
text.classList.toggle('show-more');
if (button.innerHTML === "Read More") {
button.innerHTML = "Read Less";
} else {
button.innerHTML = "Read More";... | true |
cc17658d78b7c44c17cca8fc7205190adba1ba0b | JavaScript | yuanzheng-li/JavaScript30 | /28 - Video Speed Controller/scripts.js | UTF-8 | 842 | 3.03125 | 3 | [] | no_license | const video = document.querySelector(".flex");
const speed = document.querySelector(".speed");
const speedBar = document.querySelector(".speed-bar");
let isDown = false;
function handleMove(e) {
if (!isDown) {
return;
}
const y = e.pageY - this.offsetTop;
const min = 0.5;
const max = 5;
const percent ... | true |
b6072db8f49ffb0f5761c68ac73d13bf045edb4e | JavaScript | tomon9086/React-practice | /client/reducers/counter.js | UTF-8 | 254 | 2.859375 | 3 | [] | no_license | const initState = {
count: 0
}
const counter = (state = initState, action) => {
console.log("counter.js", state)
switch(action.type) {
case "increment":
return { count: state.count + 1 }
default:
return state
}
}
module.exports = counter
| true |
8d48e33a09cdecc61144e1e581033efdc04ff7f1 | JavaScript | emys-alb/ImersaoGameDev | /scripts/cenas/telaInicial.js | UTF-8 | 643 | 2.6875 | 3 | [
"MIT"
] | permissive | class TelaInicial {
constructor() {}
draw() {
this._imagemDeFundo();
this._texto();
this._botao();
}
_imagemDeFundo() {
image(imagemTelaInicial, 0, 0, width, height);
}
_texto() {
fill(0);
strokeWeight(2);
stroke(245, this.opacity);
textFont(fonteTelaInicial);
textAlign(... | true |
7973b494c8358fed4c2ad19c84c844c488b264a3 | JavaScript | Haering97/GDWWS1819HaeringHammerGuenthner | /app/fetcher.js | UTF-8 | 6,191 | 2.765625 | 3 | [] | no_license | var poi = require('./poi');
var fs = require('fs');
var path = require('path');
class Fetcher{
// Noch nicht ordentlich implementiert
/* static getWeather(latlong1,latlong2){
return new Promise(function (resolve, reject) {
var url1 = "http://dataservice.accuweather.com/locations/v1/ci... | true |
be315566a1bcfc2514852a4d9cb3509238817b30 | JavaScript | dscgeu/30daysofdev | /index.js | UTF-8 | 801 | 3.015625 | 3 | [] | no_license | $(document).ready(function () {
typing(0, $(".typewriter-text").data("text"));
function typing(index, text) {
var textIndex = 1;
var tmp = setInterval(function () {
if (textIndex < text[index].length + 1) {
$(".typewriter-text").text(text[index].substr(0, textIndex));
textIndex++;
} else {
set... | true |
cfcf5cbc5c92458ed0661d4db0044d0b9d10e388 | JavaScript | aaronm-2112/Design-Patterns | /Composite/NullIterator.js | UTF-8 | 661 | 2.71875 | 3 | [] | no_license | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//purpose: Allows us to
var NullIterator = /** @class */ (function () {
function NullIterator() {
}
//Question: null will never occur? Hasnext will prevent us from ever iterating into a nulliterator and calling next
NullIterat... | true |
69f530c2cdf961ca5ae58c30e268038a48d08788 | JavaScript | edubovit/CargoManager | /UI/src/main/webapp/resources/js/city/add.js | UTF-8 | 902 | 2.9375 | 3 | [] | no_license | $("#addButton").click(addCity);
function addCity() {
city.name = nameField.val();
if (!isSimpleName(city.name)) {
writeWrongValueMessage("city name");
return;
}
city.latitude = latitudeField.val();
if (isNaN(city.latitude)) {
writeRedStatus("Latitude value must be a number"... | true |
20c78d8d06d153947d8a0f6a76f844dfeb6192a7 | JavaScript | irenebuck/FETWeek5 | /index.js | UTF-8 | 887 | 3.515625 | 4 | [] | no_license | // p1 and p2 are players 1 and 2 respectively, users decide who goes first
var p1 = 'X';
var p2 = 'O';
let startBtn = $('#startBtn');
let xbtn = $('#xbtn');
let obtn = $('#obtn');
let choice = '';
let cells = []
//currentBoard collects data for the cell that has something in it's empty <p> element
//boardWin holds a... | true |
de65dd37e2417058cf5dce7c12cc04503e8e1805 | JavaScript | GabrielBorges-code/FRONT-END-SENAI | /Atividades/projeto-final/script.js | UTF-8 | 1,055 | 3.15625 | 3 | [] | no_license | function fazerGet(url){
let request = new XMLHttpRequest();
request.open("GET",url, false);
request.send();
return request.responseText;
}
function main(){
data = fazerGet("https://www.mercadobitcoin.net/api/BTC/ticker/");
bitcoin = JSON.parse(data);
data1 = fazerGet("https://www.mercadob... | true |
14099418cce2181ec77cc30f9303794f91efcfaf | JavaScript | fortjosef/nodepractice | /fileserver.js | UTF-8 | 755 | 2.625 | 3 | [] | no_license | const {createServer} = require('http');
const {createReadStream} = require('fs');
const sendFile = (res, status, type, filePath) => {
res.writeHead(status, {'Content-Type': type});
createReadStream(filePath).pipe(res);
}
createServer((req, res) => {
switch(req.url) {
case '/':
return ... | true |
892a3f0737aa0faa95b7ea0af78fba4a9ccfc64f | JavaScript | chytran/Portfolio-Live | /asset/projects/ecommerce-website/assets/js/shoppingCart.js | UTF-8 | 6,628 | 3.59375 | 4 | [] | no_license | function getCookie(cname) {
var name = cname + "=";
var decodedCookie = decodeURIComponent(document.cookie);
var ca = decodedCookie.split(';');
for(var i = 0; i <ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) ... | true |
6f44637bad63f5d51976266eb143597b10d77881 | JavaScript | krisgholson/aws-meetup-dynamodb | /index.js | UTF-8 | 4,313 | 2.65625 | 3 | [] | no_license | /*global require, module*/
var ApiBuilder = require('claudia-api-builder'),
AWS = require('aws-sdk'),
api = new ApiBuilder(),
docClient = new AWS.DynamoDB.DocumentClient(),
uuid = require('uuid');
module.exports = api;
/**
* Create a new product
*/
api.post('/product', function (request) {
'use ... | true |
7d62a52afde3444df917df6e4abfe85e86413f30 | JavaScript | BigLazyBrother/mini-appli-Android-Cordova | /appliRefaiteANDROID/app/src/main/assets/www/controleur/application.js | UTF-8 | 2,424 | 3.453125 | 3 | [] | no_license | //On créé une classe anonyme autoexecutante, c'est comme le main de java
(function(){
var daoRepas = null; //instancier n'est pas utile. sert juste à set à null au lieu de undefined
//on va bricoler un constructeur
//on n'a pas besoin de le mettre à la fin EN THÉORIE, le JS crée toutes les fonction lors du parsing... | true |
222076fe96d42ad128d897bab187f5146ef94167 | JavaScript | oznasi1/TakiEx3 | /src/server/gameApi.js | UTF-8 | 3,503 | 2.78125 | 3 | [] | no_license |
const express = require('express');
const router = express.Router();
const auth = require('./auth');
const gameApi = express.Router();
let exitGameCounts = [];
let activeGames = [];
gameApi.get('/', (req, res) => {
res.json(activeGames);
});
gameApi.get('/:gameName/counter', (req, res) => {
const gameName = req.... | true |
c691a88864be541d69661355d6048e521425d64c | JavaScript | buingockhang/Team-khang-nghia | /dentail.js | UTF-8 | 2,041 | 2.6875 | 3 | [] | no_license | var Fullname = document.getElementById("edtTen");
var CaoVoi = document.getElementById("cbCaoVoi");
var TayTrang = document.getElementById("cbTayTrang");
var ChupHinhRang = document.getElementById("cbChupHinhRang");
var Tram = document.getElementById("edtTramRang");
var Tien = document.getElementById("txtTien");
funct... | true |
8a42936ccb5b7eae1b2b3ecc7584fbe495f3c539 | JavaScript | darwinknowless/isay-api | /middlewares/upload/images.js | UTF-8 | 1,982 | 2.609375 | 3 | [] | no_license | const crypto = require("crypto");
const path = require("path");
const { S3Client, PutObjectCommand } = require("@aws-sdk/client-s3");
async function upload(req, res, next) {
try {
if (req.files) {
if (!req.files.media) next();
// cek apakah array
if (!req.files.media.length) {
req.files.media = [req.fi... | true |
e63bfd82f2993b9268624e327ec23acd98899cdc | JavaScript | gururajmca/Algorithms | /longestSubString.js | UTF-8 | 395 | 3.3125 | 3 | [] | no_license | const longestSubString = (s)=> {
var map = {};
var len = s.length;
var max = 0;
var start = 0;
for (var i = 0; i < len; i++) {
if (map[s[i]] !== undefined) {
start = Math.max(start, map[s[i]] + 1);
}
map[s[i]] = i;
max = Math.max(max, i - start + 1);
}
console.log(map);
return max... | true |
18c300e574aa15baf35c4d93083b1917fd53ff62 | JavaScript | y-sober/code_back | /my-vue/yvue_sec.js | UTF-8 | 2,501 | 3.34375 | 3 | [
"MIT"
] | permissive | // 响应式数据
function defineReactive(obj, key, val) {
console.log('lala')
Object.defineProperty(obj, key, {
get() {
return val
},
set(v) {
console.log('set', val)
if (v !== val) {
//保证如果newVal是对象依然可以响应式处理
observe(v)
val = v
}
},
})
}
function set(obj, key, val) {
defineReactive(obj, key... | true |
3c1907bca9e19f1becd6be5338e5f9937cdddefa | JavaScript | jienhua/ooxx-client | /src/components/board/board.jsx | UTF-8 | 2,503 | 2.671875 | 3 | [] | no_license | import React, {Component} from 'react'
import PureRenderMixin from 'react-addons-pure-render-mixin';
import styles from './board.css'
class Board extends Component{
constructor(props){
super(props)
this.shouldComponentUpdate = PureRenderMixin.shouldComponentUpdate.bind(this);
this.put = this.put.bind(this)
... | true |