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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
58df64870cc6e06b07d839a2c4a2d5118cac8cbc | JavaScript | MrJamesFeng/dinnerOnline | /pages/home/home.js | UTF-8 | 5,882 | 2.515625 | 3 | [] | no_license | // pages/home/home.js
var data = require('../../utils/data.js')
Page({
/**
* 页面的初始数据
*/
data: {
shop: {
name: '味觉牛庄',
desc: '凡在本店办理会员,一律享受8.8折优惠'
},
cart: {
count: 0,
total: 0,
list: {}
},
cartList: {},
showCartDetail: false,
goods: [],
goodLis... | true |
8129dd1793b275ebf426916b2d81c266dd8c3c06 | JavaScript | yuribelikov/HM | /js/DataRow.js | UTF-8 | 460 | 2.65625 | 3 | [] | no_license | /*global log objToString parseDateTime*/
/**
* @constructor
*/
function DataRow(timeKey)
{
/** @type {String} */
this.timeKey = timeKey;
/** @type {Number} */
this.time = parseDateTime(timeKey);
/** @type {Object} */
this.sensorsData = {}; // map<String sensorID, Number value>
}
/**
* @this {Data... | true |
e0a694c02e0a45e5ab7e62b2b4d38a30cf4e91e4 | JavaScript | AGBarbour/Spotify-Recommendations | /static/js/staticsong.js | UTF-8 | 1,506 | 3 | 3 | [] | no_license | var tableData = data;
var tbody = d3.select("#tbody1");
function staticData(data){
tbody.text("")
data.forEach(function(view){
row = tbody.append("tr")
Object.entries(view).forEach(function([key,value]) {
cell = row.append("td").text(value)
});
})};
var button1 = d3.select("#filter-btn");
var ... | true |
f43e9b21cb09551ea2a97f22dcb3372c4fffbcbf | JavaScript | CentroDL/sockets_chat | /index.js | UTF-8 | 617 | 2.703125 | 3 | [] | no_license | //network vars
var port = 3000;
var express = require('express');
var app = express();
var http = require('http');
var server = app.listen( port , function(){
console.log("listening on port " + port)
});
var io = require('socket.io')(server);
app.use( express.static("public") );
io.on('connection', fu... | true |
0465bef8bbac9d2dae3793a4ea66994e9dc10f69 | JavaScript | HunBurry/SBD-Bots | /commands/lb.js | UTF-8 | 6,297 | 2.609375 | 3 | [] | no_license | module.exports = {
name: 'lb',
description: 'Used by admins to say anything they want in a channel, given a channel id.',
async execute(args, message, client, databases) {
const axios = require('axios');
const Discord = require('discord.js')
url = 'https://sixbeersdeep.net/wp-content/plugins/... | true |
4782b044f33c409ce48cf5ec5fbe7a89f7eb523d | JavaScript | francoatmega/painel-senha | /src/presenters/utils.js | UTF-8 | 1,019 | 3.21875 | 3 | [] | no_license |
const getWeekDay = (numberDay) => {
if (numberDay < 0 || numberDay > 6) throw new Error('Dia inválido!')
const daysWeek = ['Domingo', 'Segunda-Feira', 'Terça-Feira', 'Quarta-Feira', 'Quinta-Feira', 'Sexta-Feira', 'Sábado']
return daysWeek[numberDay]
}
const getDateDiffInDays = (finalDate, initialDate) => {
re... | true |
c82a28128e14d576c7b519451fc000f2c17f41d0 | JavaScript | stahura/school-projects | /CS2550/CS2550-Assignment6/Scripts/index.js | UTF-8 | 1,267 | 3.1875 | 3 | [] | no_license | function requestForIndex() {
let request = new XMLHttpRequest();
//let jsmonth = null
console.log("making new xmlhttprequest...");
request.open("GET", './json/sample.json', false); //D:\Riley\Programming\Code\School\CS2550\CS2550-Assignment6\json\sample.json
request.send(null);
//Cross-Origin Request Bloc... | true |
e715545feaf623737bb62f69fa052d9dc95b6056 | JavaScript | fieldsfarmer/react-timer | /app/components/Clock.jsx | UTF-8 | 723 | 2.78125 | 3 | [] | no_license | var React = require('react');
var Clock = React.createClass({
getDefaultProps: function(){
return{
totalSeconds: 0
}
},
propTypes:{
totalSeconds: React.PropTypes.number
},
formatSeconds: function(total){
let s = total%60,
m = Math.floor(total/60)%3600,
h = Math.floor(tot... | true |
5b9f6a98ad81ccad3c8fb07567dc06ddf86876f6 | JavaScript | hewangup/A_Web_Blog_App | /models/user.js | UTF-8 | 1,441 | 2.859375 | 3 | [] | no_license | var mongodb = require('./db');
function User(user) {
this.name = user.name;
this.password = user.password;
this.email = user.email;
};
module.exports = User;
// store user info
User.prototype.save = function(callback) {
// user file to be stored in database
var user = {
name: this.name,
passwor... | true |
3c08d8ea7e17c0b6043c236f5044ccad4c1058d6 | JavaScript | travis4all/appborg | /js/lib/appborg_util.js | UTF-8 | 628 | 2.765625 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | (function() {
var decodeLine, encodeLine;
encodeLine = function(event) {
var data, json;
json = JSON.stringify(event);
data = new Buffer(json, 'utf-8');
return data.toString('base64') + "\n";
};
decodeLine = function(line) {
var base64, data;
if (typeof line !== 'string') {
line = ... | true |
3487ceff53dbc11d01e0e2fdb2be1a0b274b91ca | JavaScript | BorisLechev/JavaScript-Advanced | /6. Unit Testing with Mocha & Chai/Exercise/2.1 Even or Odd Assert/evenOrOddTests.js | UTF-8 | 904 | 3.375 | 3 | [
"MIT"
] | permissive | const assert = require("chai").assert;
const isOddOrEven = require("./evenOrOdd").isOddOrEven;
describe("is odd or even", () => {
it('should return undefined if the input is a number', function () {
const input = 65;
const result = isOddOrEven(input);
assert.equal(result, undefined);
... | true |
31f56b99746be051769a5f81e0ffce6242156da6 | JavaScript | mrrogercampbell/project-2 | /db/connection.js | UTF-8 | 798 | 2.515625 | 3 | [] | no_license | // Not sure where to require this to.
// Do I need to create a main models file that connects to all my other models.
const mongoose = require('mongoose')
mongoose.Promise = Promise
if (process.env.NODE_ENV == "production") {
mongoose.connect(process.env.MLAB_URL)
} else {
mongoose.connect("mongodb://localhost... | true |
619667c39515201ebe8f7bf12bf22555bdfa8409 | JavaScript | ayushthakkur1701/lwc-test | /src/modules/my/app/app.js | UTF-8 | 1,493 | 2.515625 | 3 | [] | no_license | /* eslint-disable @lwc/lwc/no-document-query */
/* eslint-disable no-alert */
import { LightningElement, track } from 'lwc';
export default class App extends LightningElement {
@track showDash = true;
@track showLogin = false;
@track chlidComponentHeading = '';
loginEmail = '';
loginPassword = '';
... | true |
f06e1d9c2ea6cc48bfb07131e342c300a1d7d111 | JavaScript | Gabbytam/RESTful_creatures | /OGindex.js | UTF-8 | 5,669 | 3.375 | 3 | [] | no_license | //NOTE: this file is used for reference of what the index.js looked like BEFORE using controllers, contains important notes
const express= require('express');
const app= express();
const ejsLayouts= require('express-ejs-layouts');
const fs= require('fs'); //import fs
//middleware section
app.set('view engine', 'ejs... | true |
ef71195b9a589926970e577fe01bba177d108d62 | JavaScript | FenixTrax18/Note-Taker | /server.js | UTF-8 | 2,808 | 3.15625 | 3 | [] | no_license | // Dependencies
// =============================================================
var express = require("express");
var path = require("path");
var fs = require("fs");
// Sets up the Express App
// =============================================================
var app = express();
var PORT = process.env.PORT || 3000;
/... | true |
f4ad672c9f277539b2c08568da3fb88859787757 | JavaScript | RoboPython/dndAreGo | /app.js | UTF-8 | 2,842 | 2.5625 | 3 | [] | no_license | var createError = require('http-errors');
var express = require('express');
var path = require('path');
var cookieParser = require('cookie-parser');
var logger = require('morgan');
//var indexRouter = require('./routes/index');
var socket_io = require("socket.io");
var app = express();
var io = socket_io... | true |
1b84b9f4e18032c27f0eac350f38698d81213c24 | JavaScript | BLuciano/Twitch-App | /js/app.js | UTF-8 | 3,501 | 3.046875 | 3 | [] | no_license | (function(){
var url, content, all =[], online =[], offline =[];
var searchArry = [], finalSearch = [];
var image, value, searching = false;
var streamers = [
"freecodecamp", "storbeck", "terakilobyte",
"habathcx", "RobotCaleb", "thomasballinger",
"noobs2ninjas","beohoff", "medrybw", "brunofin"
];
//Json ... | true |
a8f01d189bd2bbc82a01c30f29cc2dd3ced27ef3 | JavaScript | Tossapol-MT/JavaScript | /Test/RemoveDups.js | UTF-8 | 450 | 3.59375 | 4 | [] | no_license | function removeDups(arr) {
let mes = 0;
for (let i = 0; i < arr.length; i++) {
for (let j = i + 1; j < arr.length; j++) {
if (arr[i] == arr[j]) {
mes += 1;
}
}
}
for (let d = 0; d < mes; d++) {
arr.pop();
}
return arr;
}
console.l... | true |
6d63645ebe45a38665e7d15d332a555d62e55a93 | JavaScript | ly2011/babel-preset-env-demo | /src/index.js | UTF-8 | 297 | 2.875 | 3 | [] | no_license | import 'babel-polyfill';
class Person {
constructor(name) {
this.name = name;
}
getName() {
return this.name;
}
}
const person = new Person('yy');
console.log(person.getName());
const arr = [1, 3, 5, 7, 9];
console.log([...arr]);
console.log(person.foo());
export default Person;
| true |
7976af47fed3472d4810c5c3cbe9604c4757484c | JavaScript | mannatdhindsa0987/profilo | /src/app.js | UTF-8 | 1,430 | 2.703125 | 3 | [] | no_license | import React, {Component} from 'react'
class App extends Component {
state = {displayBio: false };
toggleRead = () => {
this.setState({displayBio: !this.state.displayBio});
}
render(){
return(
<div>
<div>
<h1>
Hello!
</h1>... | true |
ab7a6af549470c489435678cfb1c3cb7501e1771 | JavaScript | chaitalizn/Team-Profile-Generator | /_tests_/Employee.test.js | UTF-8 | 689 | 2.890625 | 3 | [] | no_license | const Employee = require("../lib/Employee");
test('can get name via getName', () => {
const name = 'Bob';
const e = new Employee(name);
expect(e.getName()).toBe(name);
})
test('can get id via getId', () => {
const testvalue = 2;
const e = new Employee('bob', testvalue);
expect(e.getId()).toBe... | true |
1faf1dcb2f2658460419302c7f7804cb71baeed6 | JavaScript | anonymousgrp/canny-tic-tac-toe | /src/redux/reducers/index.js | UTF-8 | 356 | 2.671875 | 3 | [] | no_license |
const initialState = {
turn: -1,
player1: [],
player2: []
}
export const reducer = (state = initialState, action ) => {
switch(action.type) {
case 'TOGGLE_TURN':
return {
...state,
turn: -state.turn
}
default:
return s... | true |
207e988d6921b85d36e7f50ea6c79defb7bc384a | JavaScript | GreenwaysTechnology/SONY-JS-NODE-Mar | /js-apps/src/index-wrappers.js | UTF-8 | 166 | 3.375 | 3 | [] | no_license | //wrappers :
let name = "hello".trim().toUpperCase();//create string object
console.log(name)
//Numbers
let stockValue =89.837342.toFixed(2)
console.log(stockValue) | true |
5878bfe9e181352f88c8408d79579e38ff00d652 | JavaScript | jackabe/My-Shop | /src/components/content.js | UTF-8 | 380 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | import React from "react";
class Content extends React.Component {
constructor(props) {
super(props);
this.state = {};
}
getScreen() {
try {
return this.props.screen();
} catch {
return "Sorry, this page cannot be found: 404";
}
}
render() {
return <div className="Conten... | true |
328cb8b3e46d6ae6a19a2ccc38f325709c584bc5 | JavaScript | prld010/EJDW | /HTML_JS/index.js | UTF-8 | 242 | 3.078125 | 3 | [] | no_license | document.write("<h1>SERIE FUBOnoseque</h1>");
txt1= parseInt(document.getElementById("txt").value);
var a=0;
var b=1;
var aux=0;
document.write(a," ",b)
for (var i=3;i<=parseInt(txt1);i++){
aux=a;
a=b+a;
b=aux;
document.write( " ", a )
}
| true |
a6f7849552526746b27cd4c5df21df16627c97a5 | JavaScript | itsvickie/CalculadoraJS | /scripts/scripts.js | UTF-8 | 2,011 | 3.515625 | 4 | [] | no_license | let num1 = "";
let num2 = "";
let num1Full = false;
let operator = 0;
let substring;
$(".number").on("click", function(event){
const numberValue = event.target.value;
if(num1Full === false){
num1 += numberValue;
$("#input").val(num1);
} else if (num1Full === true){
num2 += numberVa... | true |
529dae4be9b3b0b1f702536a0a1b428e6c0e38fc | JavaScript | tzynwang/simple-twitter-frontend | /src/store/modules/authorization.js | UTF-8 | 1,259 | 2.5625 | 3 | [] | no_license | const state = {
token: '',
user: {
id: -1,
name: '',
email: '',
account: '',
cover: '',
avatar: '',
introduction: '',
role: '', // 'user'或'admin'
createdAt: ''
},
isAuthenticated: false
}
const getters = {
getUser: state => state.user,
getToken: state => state.token,
g... | true |
bb895589faed2c6c4ffab86f1b18573b2ceefe45 | JavaScript | priyaanto/Pucking-Mangos- | /sketch.js | UTF-8 | 2,800 | 2.640625 | 3 | [] | no_license | const Engine = Matter.Engine;
const World = Matter.World;
const Bodies = Matter.Bodies;
const Body = Matter.Body;
const Render = Matter.Render;
const Constraint=Matter.Constraint;
var engine,world;
var ground, tree, stone, boy;
var mango1,mango2,mango3,mango4,mango5,mango6,mango7,mango8,mango9;
var launcher;
var launc... | true |
5b38794fa01bdfa601b7cec613872e068555fd2c | JavaScript | LeoUral/tz_lotus | /src/components/Main.js | UTF-8 | 3,253 | 2.515625 | 3 | [] | no_license | import React from 'react';
import Store from '../store/Store';
import LogIn from './LogIn';
import Welcome from './Welcome';
export default class Main extends React.Component {
constructor(props) {
super(props);
this.state = {
nameCompany: '',
activityCompany: '',
... | true |
089b4cf2543321f36a6ad61de13b029fbc430356 | JavaScript | Koalacrisp/Colosseum | /public/logic/logic.js | UTF-8 | 1,386 | 3.078125 | 3 | [] | no_license | // // Globals
// var games = ["570", "730","578080", "440", "611500"];
// var titles = [];
// var descriptions = [];
// // Dependencies
// var request = require("request");
// // Function for obtaining news information
// newsGet = function(){
// for (i=0; i<games.length; i++){
// var queryURL = "http://a... | true |
5c637e5fb4c733e4d25d2277a3fb812f0b4802ae | JavaScript | RiderGj/SwordOffers | /demo4.js | UTF-8 | 1,269 | 3.53125 | 4 | [] | no_license | // function reConstructBinaryTree(pre, vin)
// {
// // write code here
// var top = pre[0];
// var res = {
// val: top,
// left:null,
// right:null};
// var index_top = vin.indexOf(top);
// if (pre.length>1){
// res.left = reConstructBinaryTree(pre.slice(1, 1+index_top), vin.... | true |
6a90b8228760b5b806015f62d925279b931d4e1e | JavaScript | showzyl/my-algorithm-study | /scriptoj/38.可以开车了吗.js | UTF-8 | 390 | 3.015625 | 3 | [] | no_license | // http://scriptoj.mangojuice.top/problems/38
"use strict"
const MissLi = (callback) => {
setTimeout(() => {
callback('MissLi')
}, 10) // 上车时间不一定
}
const MrWang = (callback) => {
setTimeout(() => {
callback('MrWang')
}, 3) // 上车时间不一定
}
function driveCustomers(...arg) {
}
driveCustomers(MissLi, Mr... | true |
bd7d3dd89754827764a86908e25a1a2b35540202 | JavaScript | bestsuperdev/what2eat | /websrc/src/entries/main.js | UTF-8 | 3,076 | 2.8125 | 3 | [] | no_license | require('styles/main.less')
/*
动态设置publicPath,在正式环境运行的时候为绝对路径,如果需要手动指定,可以直接设置
__webpack_public_path__的值,如 __webpack_public_path__ = '/base/bundles/'
*/
var scripts = document.getElementsByTagName('script')
for (var i = scripts.length - 1; i >= 0; i--) {
if(scripts[i].src.indexOf('.bundle.js') >= 0){
var src = ... | true |
dea8dc88bae1b7cd50836de4c2e14957bb9200a3 | JavaScript | alexgul1/PM-HW | /PM-HW-5/tasksWithNumbers.js | UTF-8 | 985 | 3.515625 | 4 | [] | no_license | const numbersRange = function (n, m) {
n = parseInt(n, 10);
m = parseInt(m, 10);
return m >= n ?
Array.from({length : m - n + 1}, (_, index) => index + n) : "Введены некорректные данные";
}
const exponentiationExpression = function (a, b = 2) {
let ans = Math.pow(+a, +b);
return Number.isFinite(ans) ? an... | true |
aee8c1a04af9749dd0be5bd7fb360c05d2d189ad | JavaScript | JoaquinKnupfer/programadorWeb-2945 | /Clase 01/Alumno/Ejercicio/js/index.js | UTF-8 | 567 | 3.96875 | 4 | [] | no_license | //var firstName = prompt ('Ingrese su nombre')
//console.log ('Hola' + ' ' + firstName)
//var number = 5
//var age = prompt ('Ingrese su edad')
//var parsedAge = parseInt(age, 10)
//console.log (parsedAge + number)
//var number = 7
//var age = prompt ('Ingrese su edad')
//var parsedAge = parseInt(age, 10)
//co... | true |
07608aca0e54674fc0918e1c6a944edc42c3d459 | JavaScript | paulsc/hvc | /front/src/Recipe.js | UTF-8 | 2,563 | 2.578125 | 3 | [] | no_license | import React, { Component } from 'react';
import { ListGroup, ListGroupItem } from "react-bootstrap";
import api from './api';
export default class Recipe extends Component {
state = {
information: {}
}
componentDidMount() {
let id = this.props.match.params.id;
console.log('ID'... | true |
a99c50a527216681ff0f427137998cfc20ff3a68 | JavaScript | jcbasson/Hotels-NET-CORE | /HotelsCombined/Client/hotels-component/initHotelsComponent.js | UTF-8 | 2,521 | 2.796875 | 3 | [] | no_license | 'use strict';
import './styles/style.css';
import immutable from 'immutable'
import HotelsComponent from './components/hotels-component';
import HotelsHeaderComponent from './components/hotels-header-component';
import HotelsViewComponent from './components/hotels-view-component';
import HotelComponent from './componen... | true |
42259dc95ecd902ae9ef7b8287310ab92fc91f1e | JavaScript | farhangani619/weather_app | /src/utlis/getWeather.js | UTF-8 | 601 | 2.71875 | 3 | [] | no_license | const request = require('request')
const key = 'E2M4g3LtiALk8PpmyT2Gd5UToxKz3HPi';
const getWeather= (id , callback)=>{
const base='http://dataservice.accuweather.com/currentconditions/v1/';
const query= `${id}?apikey=${key}`;
const url = base + query;
request({url : url , json:true}, (error, response)... | true |
553bd381c3159751431ff65b03584b61c0f2d5f5 | JavaScript | MCSMDS/genshin_impact_tool | /src/algorithm/Media.js | UTF-8 | 4,520 | 2.53125 | 3 | [] | no_license | import ffmpeg from 'ffmpeg.js/ffmpeg-mp4.js'
export const MediaFile = class {
#file
constructor(file) {
this.#file = file
}
toFile() {
switch (this.#file.constructor.name) {
case 'File':
return new File([this.#file], '')
case 'HTMLCanvasElement':
return new File([new Uint8Ar... | true |
33b6bb97d563b1ff3d93b87f44f0e2f359b77b6a | JavaScript | codeAligned/codingChallenges | /codewars/bitCounting.js | UTF-8 | 507 | 4.4375 | 4 | [] | no_license | // https://www.codewars.com/kata/bit-counting/train/javascript
/*
Write a function that takes an (unsigned) integer as input, and returns the number of bits that are equal to one in
the binary representation of that number.
Example: The binary representation of 1234 is 10011010010, so the function should return 5 ... | true |
1c670ee839bbff93e202a515d39c3aadbfa675c9 | JavaScript | Jk1979/trdm | /closepublic/zapas/1pricecalc.js | UTF-8 | 7,636 | 2.5625 | 3 | [] | no_license |
function is_numeric (mixed_var) {
return (typeof(mixed_var) === 'number' || typeof(mixed_var) === 'string') && mixed_var !== '' && !isNaN(mixed_var);
}
function isNumeric(n) {
return !isNaN(parseFloat(n)) && isFinite(n);
}
var timeout_id = null;
function price_calculate(element_id, timeout, sign){
var count... | true |
1f8b4d5494a054f1df0911e0a07f5ffb85eb4115 | JavaScript | wbmmusic/wbm-config | /src/Components/utilities/pickers/SelectionType.jsx | UTF-8 | 863 | 2.5625 | 3 | [] | no_license | import React from "react";
export default function SelectionType(props) {
const options = ["Specific", "Multiple", "Range", "Any"];
let tbl = [];
function handleClick(e) {
props.sendData(props.type, e.target.innerHTML);
}
for (var i = 0; i < options.length; i++) {
var cellStyle = {
border: "1... | true |
c26122a506dc6efbef36d555200a585e28ef7cb9 | JavaScript | reillywatson/rolodx | /rolodx/main/static/scripts/item.js | UTF-8 | 6,115 | 2.875 | 3 | [] | no_license | Item = function ( data ) {
this.init(data);
};
Item.prototype = {
name : null,
occupation : null,
rating : null,
numRatings : null,
street_address : null,
website : null,
email : null,
hours : null,
description : null,
icon: null,
constructor : Item,
init : function( data ) {
function starsNumToSt... | true |
c7372ae8b5e1d8fdbd1559e07b98091aac353d13 | JavaScript | beb-at-ga/jquery-quiz | /js/main.js | UTF-8 | 3,066 | 3.640625 | 4 | [] | no_license | let questions = [{
prompt: "Question 1: What is the name of his dog?",
answers: ["Justin", "Wayne", "Tim", "Mike"],
correctAnswer: "Justin"
},
{
prompt: "Question 2: What is the name of his cat?",
answers: ["Caesar", "Milo", "Rocky", "Sox"],
correctAnswer: "Caesar... | true |
2928d858c6b9f466784b660f9d8571d5c15a05b8 | JavaScript | zencephalon/zencephalon-mt | /client/lib/caret.js | UTF-8 | 1,124 | 2.546875 | 3 | [] | no_license | Caret = {
set : function(input, pos) {
this.setSelectionRange(input, pos, pos);
},
get : function(el) {
if (el.selectionStart) {
return el.selectionStart;
} else if (document.selection) {
el.focus();
var r = document.selection.createRange();
... | true |
a29aba8fa1d4b7ab29cdb47d7ee0b5cf78e3fa89 | JavaScript | Simongrosman/Connect-4 | /sage-code/week2/day1/ExersiceDay1.js | UTF-8 | 1,118 | 3.515625 | 4 | [] | no_license | // // // part1
function changestyle(selector) {
var changed = document.querySelectorAll(selector);
for (var i = 0; i < changed.length; i++) {
console.log(changed[i]);
changed[i].style.textDecoration = "underline";
changed[i].style.fontStyle = "italic";
changed[i].style.fontWeight... | true |
61e043121f3f80d825c8398cf253f1bfb3478a37 | JavaScript | nphillips78/Code-Challenges | /JavaScript/deepEquals.js | UTF-8 | 1,468 | 4.34375 | 4 | [] | no_license | /* Given a positive (or 0) number, return a string of 1's and 0's representing it's binary value:
toBinaryString(6) should return "110" (no leading 0).
Use of the native method number.toString(2); is disallowed.
console.log(toBinaryString(0)); // <--- 0
console.log(toBinaryString(1)); // <--- 1
console.log(to... | true |
2025983ddf3c80b82c3f9005bd3b76d83c159150 | JavaScript | ammons/ke-web-animation | /Week-05/js/timelineControl.js | UTF-8 | 1,984 | 3.109375 | 3 | [] | no_license |
function controlTimeline( timeline ) {
var mx = 0;
var windowWidth = window.innerWidth;
var progress = 0;
var shiftKeyPressed = false;
var totalAnimationTime = timeline.duration();
console.log( "timeline: totalAnimationTime -> " + totalAnimationTime );
var labels = timeline.getLabelsArray();
showLabels();
... | true |
9f2d50e0bb9dbe718f740acffee602eab4933a0b | JavaScript | joshwcomeau/Words-with-Strangers | /lib/modules/game_logic.js | UTF-8 | 9,117 | 3.046875 | 3 | [] | no_license | "use strict";
Modules.gameLogic = {
addTilesToPlayerRack({playerId, gameId, num=1}) {
_.times(num, () => {
let letter = selectRandomLetter();
let letterPoints = LETTER_POINTS[letter];
Tiles.insert({
playerId: playerId,
gameId: gameId,
letter: letter,
points:... | true |
a8c195719b17e1a9d227289312bf9af983cc19de | JavaScript | ajay-gandhi/alfred | /util/transform.js | UTF-8 | 8,316 | 2.90625 | 3 | [] | no_license | /**
* Module for transforming data
*
* This file contains functions that take in data and return the same data in a
* different format. Some functions may use other external tools, such as menu
* data.
*/
const FuzzAldrin = require("fuzzaldrin");
const MongoClient = require("mongodb").MongoClient;
const Levensht... | true |
8e4be150fc4556486cceacc4d1dc992e11a44239 | JavaScript | 2239559319/professionaljs | /第6章/6.2创建对象/6.2.2.js | UTF-8 | 699 | 4.65625 | 5 | [] | no_license | //构造函数模式
/* 没有显式创建对象
* 直接将属性和方法赋值给this
* 没有return语句
* */
/* 1 创建一个新对象
* 2 将构造函数的作用域赋给新对象
* 3 执行构造函数中的代码为对象添加属性
* 返回新对象
* */
function Person(name,age){
this.name = name;
this.age = age;
this.getName=function(){
console.log(this.name);
}
}
var person1=new Person("xia... | true |
36d90e8727942477959c54a887f12ddbd6c4e05c | JavaScript | tahseen447/js-object-oriented-bind-call-apply-this-lab-v-000 | /index.js | UTF-8 | 322 | 3.625 | 4 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | //Your code here
function justInvoke(fn) {
return fn();
}
function setThisWithCall(fn, name, age){
return fn.call(name, age);
}
function setThisWithApply(fn, thisValue, args){
return fn.apply(thisValue, args);
}
function returnNewFunctionOf(fn, thisValue){
let newFunc = fn.bind(thisValue);
return newFunc;
... | true |
753311fc7de9bb19b6a1b589fbdf8ee5fb5896ab | JavaScript | krill89/Checkers | /src/js/main.js | UTF-8 | 2,654 | 2.875 | 3 | [] | no_license | var Game = {
turn: "white",
whiteScore: 0,
blackScore: 0;
stageGame: function() {
for (var i = 0; i < boardFields.length; i++) {
temp.push(boardFields[i]);
if (temp.length == 8) {
coordinates.push(temp);
temp = [];
}
}
for (var i = 0; i < coordinates.length; i++) {... | true |
60a501c9b9e6902f1c1020d2fcf55f811cc880dd | JavaScript | lalwanivikas/hangman-test | /single-player/js/app.js | UTF-8 | 6,697 | 3.40625 | 3 | [] | no_license | /*
** Global variables
*/
var canvas = document.querySelector('.sf');
var ctx = canvas.getContext('2d');
var canvasWidth;
var canvasHeight;
var wordList = ["delhi", "mumbai", "new york", "london", "buenos aires", "tokyo", "berlin", "los angeles", "moscow", "hong kong", "rome", "prague", "dublin","amitabh bacchan", "s... | true |
e2787ae6affcf58b0022bb13b862c297bca77ae8 | JavaScript | NickMomotenko/react-todo | /src/components/TodoList.js | UTF-8 | 3,418 | 2.84375 | 3 | [] | no_license | import React, { Component } from 'react';
import TodoForm from './TodoForm';
import Todo from './Todo';
class TodoList extends Component{
state = {
todos:[],
todoToShow : "all",
toggleAllComplete:true,
}
addTodo = (todo) =>{
this.setState({
todos: [todo, ...th... | true |
12961356170e393eee88e027f56f05fe6f86b60a | JavaScript | bgoktugozdemir/fugostaj | /filipin.js | UTF-8 | 3,823 | 3.1875 | 3 | [
"MIT"
] | permissive | var wordList = []; //Saved Words
var wordsText = ``; //Saved Words String
var addedWordCount = 0;
var letterList = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
'I', 'J', 'K', 'L', 'M', 'N', 'Ñ', 'Ng','O', 'P',
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
var currentLetterId = 1;
var win;
var waitTime = 100;
functi... | true |
ec430e03a4e7ad75fba54e06251899aefc0f6978 | JavaScript | SVEENASHARMA/project2-ripebananas | /static/js/marker-cluster-map.js | UTF-8 | 1,822 | 2.75 | 3 | [] | no_license | // Creating map object
var myMap = L.map("subscriber-map", {
center: [37.697, -97.314],
zoom: 5
});
// Adding tile layer to the map
L.tileLayer("https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}", {
attribution: "© <a href='https://www.mapbox.com/about/maps/'>Mapbox</a> © <a href... | true |
2e4e55fad1008088a532b6ecc3bfe4bd369be22a | JavaScript | chrome-extension/snip-it | /src/modules/SnipButton.js | UTF-8 | 627 | 2.984375 | 3 | [] | no_license | "use strict";
import HTMLElement from "./HTMLElement";
const snipButtonId = "snipItButton";
const snipButtonText = "<s/>";
const snipButtonTitle = "SnipIt!";
class SnipButton extends HTMLElement
{
constructor() {
super("button", snipButtonId, true, true);
}
create() {
let btn = super.cre... | true |
e34bea4c7c882c93b66f1815629a6412843a1257 | JavaScript | yasinstc/yasinstc.github.io | /html5-canvas-bird-game/game.js | UTF-8 | 12,423 | 2.796875 | 3 | [] | no_license | class Bird {
constructor(context) {
this.context = context;
this.src = "bird.png";
this.width = 50;
this.height = 50;
this.x = 100;
this.y = 150;
this.speed_x = 0;
this.speed_y = 0;
this.gravity = 0.01;
this.gravitySpeed = 0;
th... | true |
5e93dfd04f94c97760eee7fbed39be44b80d73b9 | JavaScript | ohidetoshi/Roomclip | /app/assets/javascripts/tag_add.js | UTF-8 | 2,368 | 2.84375 | 3 | [] | no_license | // 選択タグ追加処理
$(function() {
function buildTag(mainTag) {
var html =`
<div class="main-tag tag-back radius-min" id="main-tag-${mainTag}" data-mainTag="${mainTag}" >${mainTag}
<span id="remove-mainicon" class="fontello tag-close" data-mainTag="${mainTag}">x</span></div>`
return html
}
$(function()... | true |
a1a20006343e40334ce2ceb166a5feb7e16d91d6 | JavaScript | davionli/davionli.github.io | /CSS452-Final/src/engine/renderables/renderable.js | UTF-8 | 1,996 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | /*
* File: renderable.js
*
* Encapsulate the Shader and vertexBuffer into the same object (and will include
* other attributes later) to represent a Renderable object on the game screen.
*/
"use strict";
import * as glSys from "../core/gl.js";
import Transform from "../utils/transform.js";
import * as s... | true |
4abbda382cdc75d0a959cea04b389131c3836c2c | JavaScript | bd82/graphql-advanced-parser | /examples/fault_tolerance/multiple_errors_spec.js | UTF-8 | 1,483 | 2.671875 | 3 | [
"MIT"
] | permissive | const { expect } = require("chai")
const { parse } = require("graphql-advanced-parser")
describe("The capability of the graphql-advanced-parser to report errors", () => {
it("can report a single error", () => {
const input = `
# missing comma in the arguments array
query queryName($foo ComplexType, $site... | true |
0261e040ab7ca357cafe03aad29b99072ea8faef | JavaScript | xNavid/toy-robot-simulator-v2 | /src/Robot.js | UTF-8 | 3,157 | 3.34375 | 3 | [
"MIT"
] | permissive |
// Require table size
const tableSize = { x: 5, y: 5 };
// Require valid directions and corresponding surrounding directions
const directions = {
north: {
value: 'north',
left: 'west',
right: 'east'
},
south: {
value: 'south',
left: 'east',
right: 'west'
... | true |
1c140551a8130787b584b5dd8de5b0097bca7dcd | JavaScript | LandRegistry-Attic/concept-performance-dashboard | /spec/shared/common/collections/spec.journey.js | UTF-8 | 826 | 2.84375 | 3 | [
"MIT"
] | permissive | define([
'common/collections/journey',
'extensions/collections/collection',
'extensions/collections/matrix'
], function (JourneyCollection, Collection) {
describe('JourneyCollection', function () {
describe('getTableRows', function () {
var collection;
beforeEach(function () {
collectio... | true |
242290ac1a57ac97296c89f1f325027f9879aff7 | JavaScript | zhukoff-av/Brain-Games | /src/games/even.js | UTF-8 | 486 | 2.71875 | 3 | [] | no_license | import { cons } from 'hexlet-pairs';
import startGame from '..';
import generateRandom from '../calculation';
const isEven = num => num % 2 === 0;
const rule = 'Answer "yes" if number even otherwise answer "no".';
const startPoint = () => startGame(rule, giveQuestionAnswer);
export default startPoint;
export const... | true |
4e26154d8ef21e4d110e555f4c79b0766d446227 | JavaScript | homework12345/homework | /WebRoot/summernote-develop/test/unit/base/core/list.spec.js | UTF-8 | 3,642 | 2.90625 | 3 | [
"MIT"
] | permissive | /**
* list.spec.js
* (c) 2013~ Alan Hong
* summernote may be freely distributed under the MIT license./
*/
define([
'chai',
'jquery',
'summernote/base/core/list'
], function (chai, $, list) {
'use strict';
var expect = chai.expect;
describe('base:core.list', function () {
describe('head', function... | true |
7d1b53a27d0c23d148b491377c730b2cd12f1417 | JavaScript | viveksinra/oasismanors | /routes/api/v1/public/enquiry.js | UTF-8 | 3,579 | 2.71875 | 3 | [] | no_license | const express = require("express");
const router = express.Router();
// Load Enquiry Model
const Enquiry = require("../../../../Models/Public/Enquiry");
// @type POST
// @route /api/v1/public/enquiry/
// @desc Route for creating a new enquiry
// @access Public
router.post("/", (req, res) => {
if(!req.bod... | true |
e9d422444b0da94fadb06bd09d8f30e2bfa8f8ce | JavaScript | shubham-debug/ECommerce-FrontEnd | /src/user/Signup.js | UTF-8 | 4,071 | 2.546875 | 3 | [] | no_license | import React from "react";
import { useState } from "react";
import { Link } from "react-router-dom";
import { signup } from "../auth/helper";
import Base from "../core/Base";
const Signup = () => {
const [values, setValues] = useState({
fname : "",
lname : "",
mail : "",
password... | true |
062f627c0ae94d95424ebe8d9164368d5f5c0829 | JavaScript | buhairong/kaikeba2 | /高级5期/第十二章React/20200203 - react-1/reactapp/src - 副本/app.js | UTF-8 | 596 | 2.59375 | 3 | [] | no_license | import React,{Component} from "react";
// state 修改之后,会同步我们的视图
class App extends Component {
// state = {
// nub: 0
// }
constructor(props){
super(props);
this.state = {
nub: 0
}
}
render(){
let {nub} = this.state;
return (<div>
... | true |
ae7b9cb52d42df5a96eab4eeb584926912097833 | JavaScript | karu19961j/Front-End | /JavaScript/Practice/jsObjects.js | UTF-8 | 1,752 | 4.53125 | 5 | [] | no_license | // var ageGroup = {
// 30: "age",
// 100: "veryOld"
// }
// console.log(ageGroup['30'])
//Reference Data Type and Primitive Data Types:
// The primitive data type String is stored as a value
// var person = "Karan"
// var anotherPerson = person
// person = "Neha"
//
// console.log(anotherPerson)
// console.log(p... | true |
227b823baf870311fe2dbefef727364aad6b421d | JavaScript | leu650/portfolio | /js/nav.js | UTF-8 | 2,057 | 2.78125 | 3 | [] | no_license | // vars
let headerHeight = document.querySelector('.about .fullscreen'),
menuToggler = document.querySelector('.menu-toggler'),
menuOpen = document.querySelector('.menu-toggler ion-icon[name="menu"]'),
menuClose = document.querySelector('.menu-toggler ion-icon[name="close"]'),
nav = document.querySelector('.nav'),... | true |
d7a2ccb8004a734e801e11ecf53509cdd82f5542 | JavaScript | Michu6/Condicionales-JS | /TAREA6-condicionales/6.js | UTF-8 | 254 | 3.859375 | 4 | [] | no_license | // EJERCICIO 6
function multiplos() {
var numero = 3000;
var suma = 12;
document.write("1,11,");
for(i=12;i<=numero;i++){
if(i%11===0) {
suma += i;
document.write(i + ",");
}
} document.write("<br> La suma de tus números es " + suma);
}; | true |
8294bc227224953360654c4164a5ba75af4484a3 | JavaScript | muriuki54/fobsandkeys | /main.js | UTF-8 | 2,001 | 2.578125 | 3 | [] | no_license | const tl = gsap.timeline({defaults:{ease:"power1.out"}});
// tl.fromTo(".welcome_overlay svg", {y: "-100%"}, {y: 0, stagger: 0.4, duration: 0.75})
tl.fromTo(".welcome_overlay svg", {y: 0}, {y: "-100%", stagger: 0.4, duration: 0.75, delay: 1.5});
tl.fromTo(".welcome_overlay", {transform: "scale(1)"}, {transform: "scale... | true |
07ad981a133f705108955f5b9d21b7d4a5d27343 | JavaScript | kshunz/dulcejs | /tests/util/inflector.js | UTF-8 | 4,515 | 2.78125 | 3 | [
"MIT"
] | permissive | describe('The INFLECTOR util', function() {
var path = require('path'),
sourceFile = __filename.replace('tests', 'src').replace('.js', ''),
Inflector = require(sourceFile),
inflector = new Inflector();
it('should have a CAMELIZE mode', function() {
expect(inflector.camelize).to.not.be.undefin... | true |
f8046a0212b002cd2241b0460d792c449a537b79 | JavaScript | PareshRadadiya/flux-todo-app | /src/components/TodoApp.react.js | UTF-8 | 1,587 | 2.578125 | 3 | [] | no_license | var Header = require( './Header.react' );
var Footer = require( './Footer.react' );
var MainSection = require( './MainSection.react' );
var React = require( 'react' );
var TodoStore = require( '../stores/TodoStore' );
var TodoConstants = require( '../constants/TodoConstants' );
function getTodoState() {
return {
al... | true |
d3d7ae6a81f3f26e2347ef89ff26489fc52f7ee8 | JavaScript | rodrigo-muniz/hora-desafio-bit | /spec/server.spec.js | UTF-8 | 1,344 | 2.796875 | 3 | [] | no_license | var request = require("request");
var idNovoPlaneta;
describe("API Planetas", () => {
describe("api/planeta post", () => {
it("Deve inserir planeta no banco", (done) => {
let planetaTeste = {
"nome": "Nome Teste 02",
"clima": "Clima Teste 01",
... | true |
7ebce05cfd6b72475260a41356eba04e1ba352d6 | JavaScript | arkeus/jsrpg | /app/assets/javascripts/ashen/models/entity/equipped_set.js | UTF-8 | 544 | 2.6875 | 3 | [] | no_license | var EquippedSet = function() {
this.weapon = null;
this.helmet = null;
this.chest = null;
this.pants = null;
this.boots = null;
this.amulet = null;
this.stat = function(type) {
var value = 0;
var items = [this.weapon, this.helmet, this.chest, this.pants, this.boots, this... | true |
5a436afbdd34d031b72d2376054d6da961668881 | JavaScript | bajiSuan/WebGL-Programming-Guide | /Chapter2/HelloCanvas/HelloCanvas.js | UTF-8 | 498 | 3.265625 | 3 | [] | no_license | // HelloCanvas.js
function main()
{
// Retrieve <canvas> element
let canvas = document.getElementById('webgl')
// Get the rendering context for WebGL
let gl = getWebGLContext(canvas)
if (!gl)
{
console.log('Failed to get the rendering context for WebGL')
return
}
// S... | true |
a1c2913af6efc24445388670ad0d413effd93c1c | JavaScript | Zeref97/chatbot | /fb_server/node.js | UTF-8 | 7,472 | 2.59375 | 3 | [] | no_license | // # SimpleServer
// A simple chat bot server
var logger = require('morgan');
var http = require('http');
var bodyParser = require('body-parser');
var express = require('express');
var router = express();
var FormData = require('form-data');
var fs = require('fs');
var https = require('https');
var app = express();
ap... | true |
83bdf9ad27afc9e2d47844807f31e140e950895b | JavaScript | ElenaMihai3/online_exercise | /js/script.js | UTF-8 | 1,390 | 3.1875 | 3 | [] | no_license | import Particle from "./classes/Particle.js";
import Vector from "./classes/Vector.js";
//import {random} from "./functions/lib.js"
{
const $canvas = document.querySelector(`.canvas`);
const ctx = $canvas.getContext(`2d`);
let raindrops = [];
const mouse = new Vector($canvas.width / 2, $canvas.height ... | true |
eb861d4ba57b088bc09f6b3773ac96e2b3e7d1c9 | JavaScript | Efrain62/0001-bases-nodejs | /app1.js | UTF-8 | 387 | 3.28125 | 3 | [] | no_license | const fs = require('fs');
let base = 5;
let tabla = '';
for(let i=1; i<=10; i++){
tabla += `${base} X ${i} = ${base * i}\n`;
//console.log(base + 'X' + i + '=' + base * i );
//console.log(`${base} X ${i} = ${base * i}`);
}
fs.writeFile(`tablas1/tabla-${base}.txt`, tabla, (err) => {
if (err) throw err;
console.... | true |
ea234daa675b7c6ac3f859b884b15dfcae80ba47 | JavaScript | noisyui/leetcode | /16.最接近的三数之和.js | UTF-8 | 919 | 3.375 | 3 | [] | no_license | /*
* @lc app=leetcode.cn id=16 lang=javascript
*
* [16] 最接近的三数之和
*/
// @lc code=start
/**
* @param {number[]} nums
* @param {number} target
* @return {number}
*/
var threeSumClosest = function(nums, target) {
let best = 10000000;
let result;
nums.sort((a, b) => a - b);
for (let i = 0; i < nums... | true |
d0d91ad4f757c080350ccd259268454f8475eca4 | JavaScript | Varsine/react-ts-component-demo | /src/DisplayData/DisplayData.jsx | UTF-8 | 683 | 2.515625 | 3 | [] | no_license | import React from 'react'
import {shape, string, number, arrayOf} from 'prop-types'
const DisplayData = ({data}) => {
return (
<div>
<div>Name: {data.name}</div>
<div>Alias: {data.alias.join(', ')}</div>
<div>Powers: {data.powers.join(', ')}</div>
<div>Ratin... | true |
f24d24c4b729188579b3b88d33d61a8e5735cc9e | JavaScript | nttran123/Irate-phonegap | /www/js/index.js | UTF-8 | 7,442 | 2.890625 | 3 | [
"MIT"
] | permissive | $(document).on("ready", function(){
handleDb.createDatabase();
});
document.getElementById("btn_add_form").addEventListener("click", addReview);
function addReview(){
var resName = $("#res_name").val();
var resType = $("#res_type").val();
var dateVisit = $("#date_visit").val();
var avgPrice = $("#av... | true |
975ea86b7e5683d2fd2e952f2ff2fa5460033546 | JavaScript | comet-ml/kangas | /frontend/lib/formatValue.js | UTF-8 | 1,439 | 3.46875 | 3 | [
"Apache-2.0"
] | permissive | import truncateValue from './truncateValue';
function formatValue(value, columnType) {
if (value === null) {
return 'None';
}
let retval = value;
if (columnType === 'DATETIME') {
const timestampObj = new UnixTime(value);
retval = timestampObj.format('YYYY-MM-DD HH:mm:ss');
... | true |
0e817fbfb1c09d4cdb96722306e601835eeecf1b | JavaScript | linnearud/dogs-table | /src/App.js | UTF-8 | 2,000 | 2.578125 | 3 | [] | no_license | import React, { Component } from 'react';
import logo from './IMG_2712.png';
import { Jumbotron, Navbar, Nav, NavItem } from 'react-bootstrap';
import './App.css';
import DogsTable from './DogsTable';
import DogsChart from './DogsChart';
import DogsList from './DogsList';
import * as d3 from 'd3-fetch';
class App exte... | true |
5b02d102e1fd09846a4ae8e5cfd5e195661bbdfc | JavaScript | mdebarros/ml-api-adapter | /test/unit/lib/util.test.js | UTF-8 | 2,595 | 2.703125 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | 'use strict'
const Test = require('tape')
const Util = require('../../../src/lib/util')
Test('util', utilTest => {
utilTest.test('formatAmount should', formatAmountTest => {
formatAmountTest.test('format integer', test => {
const value = parseInt('100')
test.equal(Util.formatAmount(value), '100.00')... | true |
2c596210f278ec74a7857b06ddd1ea6756409708 | JavaScript | arifikhsan/javascript-dicoding | /conditional/truthy.js | UTF-8 | 137 | 3.046875 | 3 | [] | no_license | let namee = "";
if (namee) {
console.log(`Halo, ${namee}`);
} else {
console.log("Nama masih kosong");
}
/* output:
Nama masih kosong
*/
| true |
4369b4ba11cb8c9e6bae97f34955c0b24db101d7 | JavaScript | Yuri-Predborskiy/js-fiddles-for-leetcode | /problems/380. Insert Delete GetRandom O(1)/map.js | UTF-8 | 2,491 | 4.4375 | 4 | [] | no_license | /*
Idea: this should be done using two hash tables:
first table contains values and their indexes
second table contains indexes and related values
first is used for adding values, checking if value exists and deleting values
second is used only to get random elements by index
*/
/**
* Initialize ... | true |
bb7523f7c2d9d9b7bb0c4081ced37faf4896319d | JavaScript | habibalam/0004-RT0004Health_InsuranceApps | /src/main/webapp/static/js/activeformvalidation.js | UTF-8 | 2,408 | 2.515625 | 3 | [
"MIT"
] | permissive | $(document).ready(function() {
console.log("Active form working ..");
$('#tempwdcheck').hide();
$('#newpwdcheck').hide();
$('#conpasscheck').hide();
var tempwd_err = true;
var newpwd_err = true;
var confirmPwd_err = true;
$('#temppwd').keyup(function(){
tempwd_password();
});
function tempwd_passwo... | true |
8ca1680190ec947a51c123b6afe9a81f5b4f3c30 | JavaScript | joserenecampa/estudo | /webext/webextension/add-on-chrome-java/background.js | UTF-8 | 579 | 3.03125 | 3 | [] | no_license | /*
On startup, connect to the "ping_pong" app.
*/
var port = chrome.runtime.connectNative("java_ping_pong");
/*
Listen for messages from the app.
*/
port.onMessage.addListener(function(response) {
console.log("Received: " + response);
alert("Received from Java: " + response);
});
port.onDisconnect.addListener(fun... | true |
5253e095d568823f702d73021c49db7b9683ba47 | JavaScript | greatshah222/SATO_CHALLENGE | /src/utils/index.js | UTF-8 | 692 | 2.578125 | 3 | [] | no_license | export const findById = (id, items) => {
let result = items.find(item => item.id === id);
if (!result) {
items.forEach(item => {
if (item.items) {
result = findById(id, item.items);
}
});
}
return result;
};
export const findParentById = (id, node) => {
let result;
if (node.ite... | true |
dae97b693ae71fa393a9d89d7c77fcfd4cede65e | JavaScript | SumanaPedapudi/my_first_repo | /jscript.js | UTF-8 | 1,844 | 3.984375 | 4 | [] | no_license | try{
var date = window.prompt("Enter date")
aaaaaa
console.log(date)
}
catch{
function f() {
// body...
document.getElementById('demo').innerHTML = "onclick event"
}
function f1(){
document.getElementById('d1').innerHTML ="double click event"
}
}
finally{
n = window.prompt("Enter a number")
document.write... | true |
89250b4e7fdd553ccf003c206ec08b14676a5f55 | JavaScript | gittooghorardeem/quote-generator | /local.js | UTF-8 | 151 | 2.90625 | 3 | [] | no_license | function newQuote() {
const quote = localQuotes[Math.floor(Math.random() * localQuotes.length)];
console.log(quote);
}
// On Load
newQuote(); | true |
9f50a929bce505218e062873b7f1d02e8376d424 | JavaScript | ethanbz/project-m4-twitter-clone | /client/src/components/TweetActions.js | UTF-8 | 2,973 | 2.609375 | 3 | [] | no_license | import React, { useState } from 'react'
import { share, repeat, messageCircle, heart } from 'react-icons-kit/feather/'
import { Icon } from 'react-icons-kit'
import styled from 'styled-components'
const TweetActions = ({ tweet }) => {
const [likes, setLikes] = useState(tweet.numLikes)
const [retweets, setRetwe... | true |
cffd23881b74ae1eca9c581fef25e600a94624dc | JavaScript | tiffaniechia/Martian-Robots | /src/service/input_service.js | UTF-8 | 826 | 2.65625 | 3 | [] | no_license | var fs = require('fs');
var _ = require('underscore')._;
var parseInputData = function(){
var inputData = fs.readFileSync('input.txt', 'utf8');
return _.compact(inputData.split("\n"));
};
var getGridData = function(){
return parseInputData()[0];
};
var getRawRobotsData = function(){
var rawRobotsDat... | true |
3d354d5224c34f13f27d9fcddfcc693447be1942 | JavaScript | RADHAMANISPRS/Timeline-Preview | /assets/js/common.js | UTF-8 | 7,561 | 2.59375 | 3 | [] | no_license | var ZOMATO_API_KEY = "42c836c550d776cf1e0c2cc7fa24283a";
var FETCH_COUNT = 10;
var map;
//get_res_by_location("bangalore", "", "", 10);
$(".search").submit(function(e) {
//get_res_by_location($(this).find("#search-loc").val(), "", "", FETCH_COUNT);
e.preventDefault();
})
function initAutocomplete() {
map =... | true |
be622184ac5dc8204eb3f7d696a8502b17ebb20a | JavaScript | wanted7751/basicmomentum | /todo.js | UTF-8 | 2,303 | 3.5 | 4 | [
"MIT"
] | permissive | const toDoForm = document.querySelector(".js-toDoform"),
toDoInput = toDoForm.querySelector("input"),
toDoList = document.querySelector(".js-toDoList");
const TODOS_LS = "toDos"
let toDos = [
];
function deleteToDo(event){
const btn = event.target;
const li = btn.parentNode;
toDoList.removeChild(l... | true |
59b112512772afd87603c7146dbcd77b81329294 | JavaScript | elishevaelbaz/react-kaiju-tracker | /src/KaijuCard.js | UTF-8 | 976 | 2.65625 | 3 | [] | no_license | // React
import React from 'react'
// Components
import EditKaijuForm from './EditKaijuForm'
class KaijuCard extends React.Component {
state = {
showEditForm: false
}
handleEditClick = () => {
this.setState(prevState => ({
showEditForm: !prevState.showEditForm
}))
}
// How can we show t... | true |
0cb501775aa6c6905b3776ea91c78750a3fb9b8c | JavaScript | sid4861/react-native-blog-app | /src/Components/Form.js | UTF-8 | 1,164 | 2.640625 | 3 | [] | no_license | import React, { useState } from 'react';
import { Text, View, StyleSheet, TextInput, Button } from 'react-native';
const Form = ({ onSubmit, initialValues }) => {
const [title, setTitle] = useState(initialValues.title);
const [content, setContent] = useState(initialValues.content);
return (
<View... | true |