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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
d52e8a21379625733d592fefd29db4ddbab027e2 | JavaScript | Kergo/Software-Technology-4.0-JavaScript | /Arrays/CommonElements.js | UTF-8 | 857 | 3.359375 | 3 | [] | no_license | function train(params) {
let wagons = params
.shift()
.split(' ')
.map(Number);
let capacity = params.shift();
for (let i = 0; i < params.length; i++) {
if(params[i].includes('Add')) {
wagons.push(params[i].split(' ').pop());
} else {
... | true |
d6a07a7c65e660d67b945b0efddbacd3abb42cc4 | JavaScript | ALPNP/Delivery | /delivery_client/platforms/android/assets/www/js/timer.js | UTF-8 | 273 | 2.515625 | 3 | [
"MIT"
] | permissive | (function(){
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady(){
setTimeout(function(){
var url = 'app.html';
$(location).attr('href', url);
}, 2000)
}
})(); | true |
bbde60f8e9bac4bb4e7908e5116cc2761259bed8 | JavaScript | Winnie-bear/ES6 | /闭包/enclosure.js | UTF-8 | 265 | 3.75 | 4 | [] | no_license | function Person(name){
let _age;
function getAge(){
return _age;
}
function setAge(newAge){
_age=newAge;
}
return {
name:name,
getAge:getAge,
setAge:setAge
}
}
let p=new Person('winnie');
p.setAge(21);
console.log(p.getAge());
| true |
3a41b90b7976e66c1ad96dfd66775eec0e723e61 | JavaScript | Coffee-Dust/My-Coffee-Table | /frontend/js/coffeetable_view_controller.js | UTF-8 | 3,582 | 3.171875 | 3 | [
"MIT"
] | permissive | class CoffeeTableViewController {
constructor(coffeeTable) {
this.coffeeTable = coffeeTable
this.view = document.querySelector("#coffee_table_view")
this.editModeIsActive = false
if (!this.view) {
throw new Error(`Could not find HTMLElement #coffee_table_view`)
}
this.displayEditButton... | true |
7053855a1e11f0f92f3f8b31d1e5c0848957651b | JavaScript | eddieb2/test | /js/index.js | UTF-8 | 9,823 | 2.78125 | 3 | [] | no_license | // Import GSAP
import { gsap } from "gsap";
/*************************************
* Declaring/Assigning variables
*************************************/
// Body selector
const body = document.querySelector("body");
// Header selector
const header = document.querySelector("header");
// Navigation items
const navI... | true |
25b9dc05a1d43ae0c41deb0669de858b88cd67bf | JavaScript | plumpNation/search-for-sum | /tests/binary.js | UTF-8 | 2,108 | 3.984375 | 4 | [
"MIT"
] | permissive | /**
* @see https://github.com/trekhleb/javascript-algorithms/blob/master/src/algorithms/search/binary-search/binarySearch.js
*/
exports.sorted = function _sorted(values = [], desiredSum = 0) {
let startIndex = 0;
let endIndex = values.length - 1;
for (let i = 0; i < values.length; i += 1) {
whil... | true |
f87a3b4035039fc0d9f3e328fb267aa17e2d9653 | JavaScript | zhuxinping/JS | /第三章正则/第四章/运动/第五天/js/tab.js | UTF-8 | 4,725 | 2.640625 | 3 | [] | no_license | (function () {
//1.获取并解析数据2.绑定数据3.延迟加载 4图片渐隐渐现5焦点自动轮播 6鼠标移入停止 移出继续
//7.点击焦点手动切换 8.点击左右按钮切换
var oBox=document.getElementById('box');
var oBoxInner=oBox.getElementsByTagName('div')[0];
var aDiv=oBoxInner.getElementsByTagName('div');
var oUl=oBox.getElementsByTagName('ul')[0];
var aLi=oBox.getE... | true |
7ee652d4d1d920658f28ac08c09cca715338c09c | JavaScript | padawin/Butterfly-js | /tests/tests-of-tests.js | UTF-8 | 1,752 | 2.765625 | 3 | [
"MIT"
] | permissive | /* global require */
if (typeof (require) != 'undefined') {
var loader = require('../src/js/loader.js').loader;
}
loader.executeModule('TestsOfTests', 'Tests', function (Tests) {
Tests.addSuite('tests', [
function () {
//Test if the method Tests.isA exists (A bit recursive logic...)
Tests.isA(Tests.isA, 'f... | true |
d33884ac899c76e2d0d7213b13e3c7ebbf6e3375 | JavaScript | burend/ASFA | /Javascripts/Source/Places/place118.js | UTF-8 | 1,470 | 2.578125 | 3 | [] | no_license | // Charm Debra at Home 2
function ShowPlace118()
{
var md = WritePlaceHeader();
var perDebra = findPerson("DebraKelly");
perDebra.showPersonDN("debra13b.jpg");
addPlaceTitle(md, "Debra Under a Spell");
if (isDay()) {
md.write(
'<p>You step outside into the garden with Debra, and she looks at you very sed... | true |
89cc8529dfd205ad81ca688bacc9aa5d40d2e81d | JavaScript | Alejanro001/project6 | /seed.js | UTF-8 | 1,408 | 2.96875 | 3 | [] | no_license | //lOOK AT DOWNLOAD.JS FROM TYLER (((FS AND MONGOOSE)))
require('./connection')
let names = require('./names.js')
let data = []
for (let i = 0; i < names.length; i++) {
data.push(require(`./pokemonJSON/pokemon-gen1/${names[i]}.json`))
}
let Pokemon = require('./pokemon/model')
let mongoose = require('mongoose')
/... | true |
c5e90352753a2169db554f896d0fd39275296198 | JavaScript | ryanjyost/movie-api | /src/util/validateSlackRequest.js | UTF-8 | 2,102 | 2.671875 | 3 | [] | no_license | const crypto = require("crypto");
const querystring = require("querystring");
// Adhering to RFC 3986
// Inspired from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent
function fixedEncodeURIComponent(str) {
return str.replace(/[!'()*~]/g, function(c) {
return (... | true |
5463824102dcd40c191e76d86d47483495377de4 | JavaScript | Lilchand1975/nytreact | /src/App.js | UTF-8 | 2,738 | 2.65625 | 3 | [] | no_license | import React, { Component } from 'react';
import './App.css';
import Jumbotron from "./components/Jumbotron";
import { Input, FormBtn } from "./components/Form";
import { Col, Row, Container } from "./components/Grid";
import SaveBtn from "./components/SaveBtn";
import { List, ListItem } from "./components/List";
impor... | true |
bc09de42f19ab14bb587e1938b41c8cf2584e6c6 | JavaScript | G984172019/find2 | /game.js | UTF-8 | 2,527 | 2.59375 | 3 | [] | no_license | const APPLICATION_KEY = "25109abf9bb96a6a929a3ae3d3a6de74320adf03dd33655e46e31d7eeb365c59";
const CLIENT_KEY = "c24f859e28e7281e30d0a72d679bddfcdd6c59004a47edc8d28b9df413b09a63";
const ncmb = new NCMB(APPLICATION_KEY,CLIENT_KEY);
const DBName = "GameScore";
let GameScore = ncmb.DataStore(DBName);
let timer = null;
cons... | true |
75160ffa99feb7af4b9f02d2f9de7c8ca99f829a | JavaScript | ourfe/phase2 | /task35/index.js | UTF-8 | 8,076 | 3.109375 | 3 | [] | no_license | /*可能不兼容IE*/
var directions = ["top", "right", "bottom", "left"]
var SmallBlock = function (options) {
this.initialize.call(this, options);
}
SmallBlock.prototype = {
initialize: function (options) {
this.index = options.index;
this.direct... | true |
1ea83632f83632c2da2cb2494a3ad4fab985fb32 | JavaScript | francescogior/advent-of-code-2020 | /07A.js | UTF-8 | 1,058 | 3.078125 | 3 | [] | no_license | // copy and paste this in the browser console at https://adventofcode.com/2020/day/7/input to get the solution
data = $('pre')
.textContent.split('\n')
.slice(0, -1)
.reduce((acc, line) => {
const [colorVariant, colorName, , , ...containedBagsArr] = line.split(' ');
const _containedBags = containedBagsAr... | true |
9a683ba0f4989f34707fa6106115b9edbe667c62 | JavaScript | dtarellano/Algos | /problems/minimumAbsoluteDifference.js | UTF-8 | 445 | 3.296875 | 3 | [] | no_license | function minimumAbsoluteDifference(n, arr) {
// Complete this function
let min;
let recurse = index => {
let check = arr[index];
if (arr[index] === undefined) {
return;
}
for (let i = index + 1; i < arr.length; i++) {
if (min === undefined) {
min = Math.abs(check - arr[i]);
} else if (min > Ma... | true |
73e3b2652b9b76b534d7925f79f904b0bd7adb25 | JavaScript | alessandroboscato/js-html-css-boolzap | /js/script.js | UTF-8 | 4,286 | 2.953125 | 3 | [] | no_license |
$(document).ready(function() {
//genero un numero random per l'ultimo accesso del contatto e lo stampo nel DOM
$(".contact-time").each(
function() {
var randomNumber = randomHour();
$(this).text(randomNumber);
}
)
// ordino i contatti in base all'ultimo accesso effettuato
$("#send-text")... | true |
8b42f84dcb54172a503381b4c00ba45c0e2b1b02 | JavaScript | lukasijus/codeforces-solutions-js | /EDUCATIONAL105/c.js | UTF-8 | 2,633 | 3.015625 | 3 | [] | no_license | 'use-strict'
process.stdin.resume();
process.stdin.setEncoding('utf8');
let data = '';
let currentLine = 0;
process.stdin.on('data', chunk => {
data += chunk;
});
process.stdin.on('end', () =>{
data = data.replace(/\s*$/, '')
.split('\n')
.map(str => str.replace(/\s*$/, ''));
let testCases = p... | true |
f0884b6ce65ebd64904f57e7927a5a05783ca416 | JavaScript | Neverland/markdown2gitbook | /util/log.js | UTF-8 | 636 | 2.796875 | 3 | [] | no_license | /**
* @file getEnv
* @author ienix(enix@foxmail.com)
*
* @since 2017/4/14
*/
/* global require, module */
const CHALK = require('chalk');
module.exports = (text, type = 'fail') => {
let prefix = '\n ';
let exitMap = /^(success|fail)$/g;
let log = CHALK[type];
switch (type) {
case 'succe... | true |
07042695829cdce6c8bc21ea1907d2afd06fc35d | JavaScript | sidd85/socialcommerce | /server/src/infra/customer/SequelizeCustomersRepository.js | UTF-8 | 2,718 | 2.53125 | 3 | [
"Apache-2.0",
"MIT"
] | permissive | const CustomerMapper = require('./SequelizeCustomerMapper');
const Customer = require('src/domain/customer/Customer');
class SequelizeCustomersRepository {
constructor({ CustomerModel }) {
this.CustomerModel = CustomerModel;
}
async getAll(...args) {
const customers = await this.CustomerModel.findAll(..... | true |
c2d1007880e9b00918ad9941fa8249b84dffb809 | JavaScript | derv82/balls | /balls/js/Collision.js | UTF-8 | 5,839 | 3.109375 | 3 | [] | no_license | // Functions for detecting and resolving collisions
function Collision(audio, canva) {
this.audio = audio;
this.canvas = canvas;
}
Collision.prototype = {
// Checks for and resolves collisions between a shape and a wall
wall: function(shape) {
// Left wall
if (shape.position.x - shape.radius < 0) {
shap... | true |
c8b875a4caf80e678e475e7f0378bd09044f2e66 | JavaScript | mjb14/zoohunts | /www/src/vendor/ub/local/js/common/eas_functions.js | UTF-8 | 6,245 | 2.640625 | 3 | [] | no_license | var QR = QR || {};
// -------------------------------------------------------------------------------------------
// START: Workflow related
// After submitting to workflow, hide all tabs and display only a confirmation tab
// -----------------------------------------------------------------------------------... | true |
b646d0b8a9c454a2fe4b3d880bd3e35a28c9a6a4 | JavaScript | econgamer/sharing | /public/eyeTesting/app.js | UTF-8 | 1,384 | 3.5 | 4 | [] | no_license |
var words = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w'
,'x','y','z'];
var randomNumber = 0;
var displayArea = document.querySelector('.displayArea');
var startTest;
var testOutput = document.querySelector('.testOutput');
document.querySelector('.changeButton').ad... | true |
d7186fa174dbd92e1518953d1a090f013f02e6e9 | JavaScript | shyding/warehouse-3d | /src/mesh-shelf.js | UTF-8 | 1,310 | 2.53125 | 3 | [] | no_license | import * as THREE from "three";
import {Warehouse} from "./index";
import {getRandomPosition} from "./util";
import {MapData} from "./map-data";
const InstancedMesh = require('three-instanced-mesh')(THREE);
export function initMeshShelf(scene) {
let shelvesData = MapData.shelves.map((data) => {
return {
... | true |
cf46d02d332e5c4e23d8d8bda67c268bd8b89c37 | JavaScript | duongnguyensv/shopify | /src/assets/progress2.js | UTF-8 | 3,622 | 2.890625 | 3 | [
"MIT"
] | permissive | var finishdate = new Date($("#finishdate").html());
var qtysold = $("#qtysold").html();
var qtyavailable = $("#qtyavailable").html();
var total_stock = $("#total_stock").html();
var total_variants = $("#total_variants").html();
var producttype = $("#producttype").html();
var max_stock = Number(total_variants)*5000;
v... | true |
6756e7a63826e06332c331950a9ad6455d670fc9 | JavaScript | CodingGarden/code-katas | /episode_49/adding-big-numbers.js | UTF-8 | 998 | 3.578125 | 4 | [] | no_license | function add(a, b) {
const length = Math.max(a.length, b.length);
a = a.padStart(length, '0');
b = b.padStart(length, '0');
const aDigits = [...a];
const bDigits = [...b];
const resultDigits = [];
let carry = 0;
for (let i = length - 1; i >= 0; i -= 1) {
const result = +aDigits[i] + +bDigits[i] +... | true |
fe40794efbe9ecd3a4d8c80d877239552d1193cb | JavaScript | snehavaddi/ASAOD_Assembly-Monitor | /formatter/formatter.js | UTF-8 | 5,232 | 2.671875 | 3 | [] | no_license | sap.ui.define([], function () {
"use strict";
return {
toBoolean: function (sValue) {
if (sValue === "true") {
return true;
}
return false;
},
Complete: function (s1, s2) {
var x = s2 / s1;
x = x * 100;
return x;
},
State: function (s1, s2, s3) {
if (s3 > 0) {
return "Error";
... | true |
056e87e966f2a2fc575aeff1b86b5b836ab51370 | JavaScript | rohitkeshav/pic-sy | /client/src/components/signup.js | UTF-8 | 4,609 | 2.515625 | 3 | [] | no_license | //kriti
import React, { Component } from 'react';
import classnames from 'classnames';
import { connect } from 'react-redux';
import { createUser } from '../actions';
import { Redirect } from 'react-router';
class Signup extends Component {
state = {
fname: '',
lname: '',
password: '',
email: '',
... | true |
24fdb37d9c1ea56f5022a7d481c9d17db72ca700 | JavaScript | MikeSE314/test | /New Unity Project/Assets/scripts/PlayerController2.js | UTF-8 | 869 | 2.65625 | 3 | [] | no_license | #pragma strict
function Start () {
}
// Move object using accelerometer
var speed = 10.0;
function Update () {
var dir : Vector3 = Vector3.zero;
// we assume that device is held parallel to the ground
// and Home button is in the right hand
// remap device acceleration axis to game coordinates:
// 1... | true |
8519fa5f6f7d2370ca08a7ef44db471f365d18fa | JavaScript | Lee-YuMin/ProjectEular | /problem_012.js | UTF-8 | 2,339 | 3.8125 | 4 | [] | no_license | let triangleNum = 1;
let nextNum = 2;
let divisors;
let limit = 500;
let primeNumList = [2]; // 소수 리스트
let startTime = new Date().getTime();
let endTime;
while(true) {
// 삼각수 증가
triangleNum += nextNum;
// 약수의 개수 구하기
divisors = getDivisorCount(triangleNum);
// 약수의 개수가 limit를 넘으면 끝
if(divis... | true |
05f8102bf3ef33bbc60e93ddbd26945bfbba0547 | JavaScript | richardoot/backend_CovidClicker | /bd/drop_bd.js | UTF-8 | 832 | 2.515625 | 3 | [] | no_license | const sqlite3 = require('sqlite3').verbose();
//Connexion à la BD
const db = new sqlite3.Database('database_cc.db', (err) => {
if(err){
return console.error(err);
}
console.log("Connecté à la base de données SQlite phe.");
});
//Requêtes SQL
db.serialize(() => {
//Montrer les données Av... | true |
ce57e264466e4108054840d1c2b9ad624c1c0f4f | JavaScript | yaclynlunapo01/webapp | /view/js/Histories.js | UTF-8 | 3,975 | 2.609375 | 3 | [] | no_license | $(document).ready(function(){
})
function formatNumber(number)
{
var format = "+7-(XXX)-XXX-XX-XX"
var res
for(var i = 0; i<number.length; i++)
{
res=format.replace(/X/, number.charAt(i))
format = res
}
var x = format.indexOf("X")
if (x==-1) x=format.length
var newFormat = "... | true |
a577b1ac503d4bfee49d3d6a66e1987956de23f9 | JavaScript | overlandandseas/koa-auth-handlebars-example | /assets/js/editor.js | UTF-8 | 1,235 | 2.90625 | 3 | [] | no_license | //client side javascript
AlloyEditor.editable("titleText");
AlloyEditor.editable("pageContent");
document.getElementById("save-changes-btn").addEventListener("click", function save() {
post("/post", buildFormObject(), "post");
});
function post(path, params, method) {
method = method || "post";
var form... | true |
a55aa27c74343251185ddd759c6e754d724572dd | JavaScript | LindaEng/search-and-destroy | /binary-search/binary-search.js | UTF-8 | 1,063 | 3.671875 | 4 | [] | no_license | 'use strict';
// Complete this algo
const binarySearch = (array, target, startIndex=0, endIndex=array.length) => {
if (array.length <= 0)
return false;
// find the actual midpoint index
const midpointIndex = Math.floor((startIndex + endIndex) / 2);
// cache the actual value at the midpoint
... | true |
f3a6faf0c608dd4476a99888210a707fc75e6e58 | JavaScript | PulseTile/PulseTile-RA-Lerna | /packages/pulsetile-react-admin/src/reducers/selectedFeedsReducer.js | UTF-8 | 661 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | import get from "lodash/get";
import { SET_SELECTED_FEEDS_ACTION } from "../actions/setSelectedFeedsAction";
const initialState = {
data: [],
loading: false,
error: null,
};
/**
* This component returns reducer for Feeds list action
*
* @author Bogdan Shcherban <bsc@piogroup.net>
* @param {shape} sta... | true |
ee7d92d80e1a8b14ed15503e7cb50ee5b3952781 | JavaScript | EricDuy/wechat_spider-1 | /second/utils.js | UTF-8 | 2,178 | 2.671875 | 3 | [
"MIT"
] | permissive | 'use strict';
const redis = require('../utils/redis');
const refDebug = require('debug');
const CRAWL_HISTORY_KEY = 'ws:mp:crawl:history';
const CRAWL_PROFILE_KEY = 'ws:mp:crawl:profile';
const DEFAULT_INTERVAL = 1000 * 60 * 60 * 8;
const TARGET_DATE = new Date('2018/7/1').getTime();
const debug = debugFn('utils');
... | true |
9d3377ca375d7155cdaf649f4e857ccfafb3c0fd | JavaScript | Manjuanand021/Node-JS | /Callback/app.js | UTF-8 | 128 | 2.921875 | 3 | [] | no_license | function greet(cb) {
console.log('inside greet function');
cb();
}
greet(function () {
console.log('callback');
}); | true |
bfddf6265698c833229212b474d3bdc5f9297448 | JavaScript | edisonvn92/CodeLearn | /easy/onesAndZeros.js | UTF-8 | 638 | 4.5 | 4 | [] | no_license | //Give a string s with length n contain only 1 and 0. Consider the following operation:
//choose any two adjacent positions in the string, and if one them contains 1,
//and the other contains 0, then remove these two digits from the string,
//obtaining a string of length n - 2 as a result. And what is the minimum len... | true |
cf41439f508119e460954cc8d0f71797d2dc27ac | JavaScript | shashankgbshashi/netflix-clone | /src/Banner.jsx | UTF-8 | 2,168 | 2.6875 | 3 | [] | no_license | import React, {useEffect,useState} from 'react'
import "./Banner.css"
import request from "./request"
import axios from "axios"
function truncate(str,n){
return str.len < 150 ? str : str.substr(0,n-1)+"..."
}
export default function Banner() {
const [movies,setMovie] = useState({
name : "",
... | true |
01859d071d1a4b77c0cfbac3c3352ebea057a7c3 | JavaScript | yashwan98/eggheadsmirrored | /clients/js/egg.js | UTF-8 | 4,614 | 3.1875 | 3 | [] | no_license | /*function validation(){
let form = document.getElementById("formGroup");
let email = document.getElementById('exampleInputEmail1').value;
let email_prop = document.getElementById('exampleInputEmail1');
let pattern = /^[^ ]+@[^ ]+\.[a-z]{2,3}$/;
let text = document.getElementById('emailHelp');
i... | true |
5915cd70612a575f84a448db460650b29a8b59fb | JavaScript | aiham/opentok-camera-filters | /src/filter.js | UTF-8 | 1,885 | 2.625 | 3 | [
"MIT"
] | permissive | const mockGetUserMedia = require('./mock-get-user-media');
const canvas = document.createElement('canvas');
canvas.getContext('2d'); // Necessary or Firefox complains
let videoElement;
let videoElementLoaded = false;
let selectedFilter;
let initialFilter;
// Mock out getUserMedia and replace the stream with the canv... | true |
7344c624acc2b587b5c0dc008c734e4d5ae8b030 | JavaScript | claudiobarsante/mymoney | /src/utils/rest.js | UTF-8 | 1,978 | 2.671875 | 3 | [] | no_license | import { useEffect, useReducer } from "react";
import axios from "axios";
const INITIAL_STATE = {
loading: false,
data: {},
};
const reducer = (state, action) => {
if (action.type === "REQUEST") {
return {
...state,
loading: true,
};
}
if (action.type === "SUCCESS") {
return {
... | true |
3336b32c844a7fa61c2b40558458317b6bd38e0a | JavaScript | volnei-ruthes/NodeJS | /NodeJS API Exemplo/server.js | UTF-8 | 2,451 | 3.171875 | 3 | [] | no_license | const express = require('express'); //instancio a express
const app = express() //e chamo na App.
const data = require("./data.json"); //apenas para simular dados do banco de dados
app.use(express.json()); //apenas dizendo ao express para usar o Json.
//Verbos HTTP
/*
GET - RECEBER dados de um resource.
POST - ENVIA... | true |
464a72a2310cd6a8f44b75203b39c21202f6836e | JavaScript | horsfallnathan/pmApp | /public/javascripts/dashboard.js | UTF-8 | 4,514 | 2.921875 | 3 | [] | no_license | const ctx = document.getElementById('dashboardChart').getContext('2d');
const printCharts = (label, perData) => {
console.log(perData);
// const myChart = new Chart(ctx, {
// type: 'doughnut',
// data: {
// labels: ['Todo', 'Ongoing', 'Completed'],
// datasets: [
// ... | true |
567c1e789caaa5dc9a063ff48b62b481770c1550 | JavaScript | hafiz229/recap-loop | /array-loop.js | UTF-8 | 288 | 3.640625 | 4 | [] | no_license | // var numbers = [45, 56, 32, 54, 23, 87, 98];
// for (var i = 0; i < numbers.length; i++) {
// console.log("element: " + numbers[i]);
// }
var items = ["bottle", "jug", "pen", "pencil", "book"];
for (var i = 0; i < items.length; i++) {
var item = items[i];
console.log(item);
}
| true |
33ec9bf73d7262a050a4b7aa501883d75f2257df | JavaScript | sonrisacc/tpPractice | /round-robin/linkList/deleteDuplicates.js | UTF-8 | 623 | 3.421875 | 3 | [] | no_license | const deleteDuplicates = function(head) {
let pre = null;
let cur = head;
while (cur != null && cur.next != null) {
// if unique
if (cur.val != cur.next.val) {
pre = cur;
cur = cur.next;
} else {
// keet going till find the next different node
while (cur.next != null && cur.nex... | true |
a481bb37415deb710debf1866c75462d54a124a2 | JavaScript | alexburdoy/AWUG3Project | /model/GameModel.js | UTF-8 | 3,850 | 2.65625 | 3 | [] | no_license | import { action, computed, makeObservable, observable } from "mobx";
import React, { createContext } from "react";
import { DebugInstructions } from "react-native/Libraries/NewAppScreen";
class GameModel {
constructor() {
this.games = null;
this.trending = null;
this.recomendations = null;
this.gameD... | true |
0c4a0fff310cf0631c2a8572200dd017807a2bfd | JavaScript | mrspeaker/ld41 | /pop/movement/wallslideWithGravity.js | UTF-8 | 2,062 | 3 | 3 | [] | no_license | import entity from "../utils/entity.js";
/*
Not used: was first pass for gravity, before "hits" were introduced.
Expects:
* an entity with the following characteristics:
* pos vector, w & h
* vel for vertical velocity
* jumping flag to indicate if it's in the air.
* a Pop Map for wallsliding.
*/
f... | true |
c4e3b5fbc65154f65800c435709efd0520cd7c29 | JavaScript | edwardnie/frame | /node/chat/socket.js | UTF-8 | 1,172 | 2.578125 | 3 | [] | no_license | var net = require('net');
var md5 = require('./node_modules/blueimp-md5/js/md5').md5;
var tools = require('./routes/tools');
var HOST = '127.0.0.1';
var PORT = 8000;
var SECRET = 'laonie';
// 创建一个TCP服务器实例,调用listen函数开始监听指定端口
// 传入net.createServer()的回调函数将作为”connection“事件的处理函数
// 在每一个“connection”事件中,该回调函数接收到的socke... | true |
c44b52ebb37c87753c7fe97d34d4f0e4cd5df97a | JavaScript | baymax-codecare/CustomerCare-React- | /src/opencell/modules/PageModule.js | UTF-8 | 2,555 | 2.609375 | 3 | [] | no_license | // Action Types
export const ALERT_ERROR = 'customercare/modules/pages/ALERT_ERROR';
export const ALERT_INFO = 'customercare/modules/pages/ALERT_INFO';
export const ALERT_WARNING = 'customercare/modules/pages/ALERT_WARNING';
export const CLEAR_ALERTS = 'customercare/modules/pages/CLEAR_ALERTS';
export const CLEAR_ERROR... | true |
9e5be190216ddf1c7f45993f778eb31cd1173f58 | JavaScript | oliban/ever-bday | /ever-bday.js | UTF-8 | 5,276 | 2.625 | 3 | [] | no_license | // This is my first github project
// Also note that I am not very good at js so use at your own risk.
// The Facebook login stuff was shamelessly copied from kdar's fbpoke project at https://github.com/kdar/fbpoke.git so all creds with the login goes to him.
// Running this requires phantomjs that can be found here: h... | true |
a685fd71abba8edd98adb7b0f80cd6b026b80044 | JavaScript | No-Max/sovaseo | /js/main.js | UTF-8 | 4,735 | 2.6875 | 3 | [] | no_license | $(document).ready(function() {
showSlide(1);
$(".header .call-me").click(function(){
optionsClear();
showSlide(5);
});
$(".arrows").on("click","a", function (event) {
event.preventDefault();
optionsClear();
showSlide($(this).attr("href")*1);
});
function addHandler(object, event, handler) {
if (obj... | true |
f4570848cb7fc3c90c480a0a800c0236028851ef | JavaScript | Parselian/pincet | /js/script.js | UTF-8 | 1,256 | 2.515625 | 3 | [] | no_license | 'use-strict';
window.addEventListener('DOMContentLoaded', () => {
const html = document.querySelector('html'),
burgerMenu = document.querySelector('.burger'),
burgerMenuBtn = burgerMenu.querySelector('.burger__button'),
promoCardButton = document.querySelector('.promo__card-btn'),
pr... | true |
a9778feb9389628a84116cd5a1d3a8bd96a4c44d | JavaScript | ziedmaaloul/full-mvc-php | /public/js/script.js | UTF-8 | 350 | 2.890625 | 3 | [] | no_license | window.onload = () => {
let boutons = document.querySelectorAll(".form-check-input");
for (let bouton of boutons){
bouton.addEventListener("click",activer);
}
}
function activer(){
let xmlhttp = new XMLHttpRequest;
xmlhttp.open("GET","/admin/activeannonces/"+this.dataset.id);... | true |
af622529fa86c2670ea15ad2af02ebd6ddcbf283 | JavaScript | lac617a/BarberiaPonce.github.io | /js/function.js | UTF-8 | 8,313 | 3.328125 | 3 | [] | no_license | 'use strict';
document.addEventListener('DOMContentLoaded', main);
// FUNCION PRINCIPAL
function main(){
caroucell();
my_time();
};
// CIRCULOS
const circle = document.querySelector('.circle');
const circle_i = document.querySelectorAll('.circle i');
// SLIDE DE IMAGENES
const slide = document.querySelector('.... | true |
1330735a11c5e65d2bf014c17d183d05570df956 | JavaScript | cs421sp21-homework/project-g13 | /code/frontend/src/components/RequestNickname.js | UTF-8 | 2,312 | 2.53125 | 3 | [] | no_license | import React, { Component } from "react";
import {FormControl, InputGroup, Modal, Button} from "react-bootstrap";
import 'bootstrap/dist/css/bootstrap.css';
export default class RequestNickname extends Component {
constructor(props) {
super(props);
this.state = {
showJoinModal: false,
... | true |
1366f658872da02d6b7433320da0d76f25cd7c57 | JavaScript | mustfeez/ElementAnimation | /eac.mounting-animations.1.0.1.js | UTF-8 | 1,170 | 3.6875 | 4 | [] | no_license | /**
* The loading animations run as soon as the window loads
* Remove this part if you want to start the animations in your own code
* Just add "new HTMLElementLoadingAnimation().run();" to your code
*/
window.onload = function(){
new HTMLElementLoadingAnimation().run();
}
/**
###################### HERE YOU C... | true |
a0adf55a53ffa1ba33807427987edd060621a5f2 | JavaScript | zhang1pr/LeetCode.js | /201-300/(282)ExpressionAddOperators.js | UTF-8 | 910 | 3.140625 | 3 | [
"MIT"
] | permissive | /**
* @param {string} num
* @param {number} target
* @return {string[]}
*/
var addOperators = function(num, target) {
const res = [];
DFS('', 0, 0, 0);
function DFS(path, start, eval, pre) {
if (start == num.length) {
if (target == eval) {
res.push(path);
}
return;
}
f... | true |
a57e04104eb3998b82e5ea39c27357049a7d69e4 | JavaScript | wahidmounir/openwebspider | /tools/crawl_the_web.js | UTF-8 | 1,868 | 3.046875 | 3 | [
"MIT"
] | permissive | /**
* Usage:
* $ node crawl_the_web.js http://www.example.com/
*
*/
var http = require("http");
var foundPages = {};
var pendingURLs = [];
function indexList()
{
var crawl_delay = 500 /* ms */;
var currentURL = pendingURLs.shift();
if (currentURL)
{
currentURL = currentURL.trim();
... | true |
7be9ce58dde081eca134dd7e384603c730a15472 | JavaScript | nicovg15/weatherApp | /src/App.js | UTF-8 | 1,684 | 2.625 | 3 | [] | no_license | import React, {useState} from 'react';
import './css files/App.css';
import Home from './components/Home'
const weatherApi = {
key: process.env.REACT_APP_WEATHER_API_KEY,
base: process.env.REACT_APP_WEATHER_API_BASE
}
function App() {
const [query, setQuery] = useState("")
const [weather, setWeather] = useSta... | true |
24cc86c809087c2305fbd662b0c078ea4fdc8c6c | JavaScript | IreneZhou0129/NodeJS | /createServer.js | UTF-8 | 1,228 | 3.328125 | 3 | [] | no_license | // http 作为服务端使用时
var http = require('http');
// 创建一个server,监听http客户端请求并返回响应
http.createServer(function(request, response){
response.writeHead(200,{'Content-Type':'text-plain'});
response.end('Hello World\n');
//监听8124端口 http://127.0.0.1:8124/
}).listen(8124);
// 每当来了一个client request,创建server时传入... | true |
7e23aaffe54d1c63b08058967a482a884cb99ada | JavaScript | Jolanrensen/WebADB-tcpip | /js/init.js | UTF-8 | 17,313 | 2.546875 | 3 | [
"MIT",
"BSD-3-Clause"
] | permissive | (function ($) {
$(function () {
$('.button-collapse').sideNav();
$('.scrollspy').scrollSpy();
/*** Animate word ***/
//set animation timing
var animationDelay = 2500,
//loading bar effect
barAnimationDelay = 3800,
barWaiting = barAni... | true |
21b7127816d09a4fe057dca36bc7649dc18a929a | JavaScript | r0cc4t0/rocketseat-starter | /JavaScript/modulo4/aula01.js | UTF-8 | 400 | 2.96875 | 3 | [] | no_license | var aula01 = 'Aula 01 - Requisições AJAX';
var xhr = new XMLHttpRequest();
xhr.open('GET', 'https://api.github.com/users/diego3g');
xhr.send(null);
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
setTimeout(function () {
console.log(aula01);
console.log(JSON.parse... | true |
4f8876283a630badfc3990ae4daebc64d83dac40 | JavaScript | Muhamad-Hasan/react-redux-basics | /resturant/src/App.js | UTF-8 | 1,248 | 2.640625 | 3 | [] | no_license | import React from 'react';
import logo from './logo.svg';
import './App.css';
import {connect} from 'react-redux';
import {newActions} from './actions/action';
class App extends React.Component{
constructor(props){
super(props);
this.state = {
todo_list : [],
text:''
};
this.add = this.a... | true |
2603c95f8af94dff6ee10fae2ddfd78249c74013 | JavaScript | noobmobile/edutrello | /front/src/utils/utils.js | UTF-8 | 820 | 2.859375 | 3 | [] | no_license | import * as React from "react";
export function getAbbreviation(name){
if (!name) return null
if (name.includes(" ")){
return name.split(" ")[0][0] + name.split(" ")[1][0] // Luiz Eduardo = LE
}
return name.substring(0, 2)
}
export function getRandomColor() {
const letters = '0123456789ABC... | true |
74cc1e7f425537a9c575c89dc013652e8c21b91d | JavaScript | Delonge12345/auth-app | /src/contexts/AuthContext.js | UTF-8 | 6,420 | 2.65625 | 3 | [] | no_license | import React, {
createContext,
useEffect,
useReducer
} from 'react';
import jwtDecode from 'jwt-decode';
import {axiosInstance} from '../utils/axiosInstance';
import SplashScreen from "../components/SplashScreen";
const initialAuthState = {
isAuthenticated: false,
isInitialised: false,
user: n... | true |
e7a45bda3b0759801ab292d8c73bf46db335ef1d | JavaScript | mihailt/splash | /lib/example04.js | UTF-8 | 2,335 | 2.578125 | 3 | [] | no_license | // Generated by CoffeeScript 1.6.1
(function() {
var Loader, SampleApp, app, clamp, colors, randomInteger,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } c... | true |
bdf04d4bca9b18d643097c9c2bf32aeda32d1249 | JavaScript | Trettin/Cubos-Academy | /Back-end/Modulo-03/back-autenticacao-criptografia/classe-01/controladores/pokemons.js | UTF-8 | 5,414 | 2.796875 | 3 | [] | no_license | const conexao = require("../conexao");
const jwt = require("jsonwebtoken");
const jwtSecret = require("../jwt_secret");
const listarPokemons = async (req, res) => {
const { token } = req.body;
if (!token) {
return res.status(400).json("O campo token é obrigatório.");
}
try {
jwt.verify(token, jwtSecr... | true |
55142390800b69d9b773a27df545a76b6c660c8e | JavaScript | rachid1982fsb/SaveJsCode | /LRUCache.js | UTF-8 | 1,647 | 4.0625 | 4 | [] | no_license | // LRU Cache
// Solution
// Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and put.
// get(key) - Get the value (will always be positive) of the key if the key exists in the cache, otherwise return -1.
// put(key, value) - Set or insert the ... | true |
fab3f01d4c9f7782639e50c59bd8caa18dc721b6 | JavaScript | qapla47/articulate-sample-teresa-strout | /code-challenge-teresa-strout/src/knowledgeBlock/uglyFunctional.js | UTF-8 | 3,508 | 2.921875 | 3 | [] | no_license | import React, {Component} from "react";
import data from "./data.json";
import kittensAndPuppies from './images/kittensAndPuppies.jpg';
import coffee from './images/d229V-nstxA6tZdi.gif';
import tRex from './images/T-Rex.jpg';
export default class UglyFunctional extends Component {
constructor(props) {
super(p... | true |
b614f2e4f596ce17fff1a2f72f5eddf25f1c8546 | JavaScript | MehedilslamRipon/Random-Quotes-Printer | /app.js | UTF-8 | 653 | 3.234375 | 3 | [] | no_license | const mathLibrary = require("./lib/math");
const quotesLibrary = require("./lib/quotes/index");
let application = {};
application.config = {
timeBetweenQuotes: 1000,
};
application.printAQuote = function printAQuote() {
const allQuotes = quotesLibrary.allQuotes();
const numberOfQuotes = allQuotes.length;
... | true |
beeb25186ef2e8e1bb97b1352933f680b82dee67 | JavaScript | oluSammy/leadpreneur-admin | /src/Redux/Search-User/searchUser.actions.js | UTF-8 | 1,899 | 2.640625 | 3 | [] | no_license | import { firestore } from '../../firebase/firebase.utils';
import { searchUserActionTypes } from './searchUser.types';
import Swal from 'sweetalert2';
const searchUsersStart = () => ({
type: searchUserActionTypes.SEARCH_USER_START
});
const searchUsersSuccess = searchResult => ({
type: searchUserActionTypes.S... | true |
336e3f3563932226c27a5669d972ae15262221ed | JavaScript | Doug-Fernando/trybe-exercises | /Fundamentals of Web Development/block_05/day_1/script.js | UTF-8 | 716 | 3.0625 | 3 | [] | no_license | let paragraph = document.getElementById("paragraph");
paragraph.style.color = "red";
document.getElementById('page-title').innerText = 'Horizon Zero Dawn';
// Pega um elemento pelo ID
document.getElementById('subtitle').innerHTML = 'Jogo muito dahora';
document.getElementById('second-paragraph').innerText = 'PS4 Pro... | true |
0897b84fc32e6647105323064fe567dd1c5d123b | JavaScript | gaomin-github/algorithm-explore | /source/create_self.js | UTF-8 | 1,360 | 3.421875 | 3 | [] | no_license | // 深拷贝部分的Object.create
function myCreate(obj){
if(obj===null) return null;
if(obj===undefined) return obj;
let typeOfVal=typeof obj;
if(typeOfVal==='number'||typeOfVal==='string'||typeOfVal==='boolean'||typeOfVal==='symbol') return obj;
if(Object.prototype.toString.call(obj)==='[object RegExp]'){
... | true |
d4198a7bdef2ad14c37fb1dcd6483742ba058aad | JavaScript | Peter-White/2020-04-08-Roll-your-own-Chrome-dashboard | /project/js/script.js | UTF-8 | 600 | 3.03125 | 3 | [
"MIT"
] | permissive | $(document).ready(function() {
let $title = $("h1#title");
let $data = $("div#data");
const data = {
"Dog" : "https://random.dog/woof.json",
"Cat" : "https://aws.random.cat/meow"
};
let random = Math.floor(Math.random() * Object.keys(data).length);
let head = Object.keys(data)[random];
$title.ht... | true |
c519a2483614052f402d0899d5acb48770e98c21 | JavaScript | atayahmet/WatermelonDB | /src/Model/helpers.js | UTF-8 | 679 | 2.5625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | // @flow
import hasIn from '../utils/fp/hasIn'
import type Model from './index'
const hasCreatedAt = hasIn('createdAt')
export const hasUpdatedAt = hasIn('updatedAt')
export const createTimestampsFor = (model: Model) => {
const date = Date.now()
const timestamps = {}
if (hasCreatedAt(model)) {
timestamps... | true |
51f85379ee99c97b34444c17654eb96b6b3a3320 | JavaScript | wisefredo/car-fe | /sample.js | UTF-8 | 2,039 | 2.703125 | 3 | [] | no_license | fetch('http://localhost:8080/store', {
method: 'put',
body: JSON.stringify({
'id': '3',
'website': 'storish.com',
'storeName': 'store 3',
'email': 'storess@gmail.com',
'phone': '3011221234'
}),
headers: {
'Accept': 'application/json',
'Content-Type': 'applicati... | true |
9469d266881cbc596f536df12f949138284e03ad | JavaScript | reddyismav/matic-withdraw-explorer | /src/cronjobs/BurnTxPoll.js | UTF-8 | 1,641 | 2.53125 | 3 | [] | no_license | const axios = require('axios');
const BurnTxEvent = require('../models/BurnTxEvent');
const { BRIDGE_API_WITHDRAW_ENDPOINT } = require('../constants/constants');
const checkStatusOfPendingBurnTxHashes = async () => {
checkStatusOfBurnTxHashes('Pending');
};
const checkStatusOfBurntBurnTxHashes = async () => {
... | true |
c54a27fb9192b16530e6f85e6bbe74df8d5f45f9 | JavaScript | aivantg/ethans-birthday | /typer/public/main.js | UTF-8 | 603 | 2.96875 | 3 | [] | no_license | fetch('http://heyhaha.codersonly.club?log=typers', {method: 'POST'}).catch(error => console.error('Error:', error));
function validate() {
fetch('/latestScore').then(response => {
return response.json();
}).then(data => {
console.log(data)
lastScore = Math.floor(data.score)
if (lastScore >= 135) {
... | true |
324542c44387b554b1ce456c80ada8ab4ba5c331 | JavaScript | thienlerva/JPA-Springboot | /HibernateServlet/ERS/src/main/webapp/ers.js | UTF-8 | 2,352 | 2.90625 | 3 | [] | no_license | window.onload = function(){
loadHomeView();
$('#createTicket').on('click', loadForm);
$('#homeNav').on('click', loadHomeView);
//$('#logout').on('click', loadLogoutView);
}
function loadForm() {
$('#form').removeAttr("hidden");
}
function displayUserName(){
//send request to /users
var xhr = new XMLHttpReq... | true |
daa9b7f07bb18c5a0443c272f2ed9b734a59ff10 | JavaScript | susanafre/entrega-hab | /JS/entrega-4/ejercicio1.js | UTF-8 | 2,918 | 4.125 | 4 | [] | no_license | "use strict";
/* CREAMOS DOS ARRAYS, UNO CON EL PRECIO DE LOS ARTÍCULOS Y OTRO CON EL NOMBRE DE LOS ARTÍCULOS */
const itemNames = ["Camisa", "Pantalón", "Calcetines"];
const itemPrices = [13, 27, 100];
//quiero tener los items para poder empezar a hacer el inventario y creamos la clase Item
//tendrán un nombre, un p... | true |
f3c0dac60c9dcc71d006d57080b412977f230f05 | JavaScript | megatiger/js-basic-book | /08/js/showBig.js | UTF-8 | 264 | 2.921875 | 3 | [] | no_license | var bigPic = document.querySelector("#cup");
var smallPic = document.querySelectorAll(".small");
for(var i=0; i<smallPic.length; i++) {
smallPic[i].onclick = showBig;
}
function showBig() {
var newPic = this.src;
bigPic.setAttribute("src", newPic);
} | true |
b4869b5e25d83610a6fff5bda664698d47a3c544 | JavaScript | nireo/Fullstack-osa5-osa8 | /osa7/bloglista-osa7/bloglist-frontend/src/reducers/userReducer.js | UTF-8 | 1,205 | 2.765625 | 3 | [] | no_license | import loginService from "../services/login"
import blogService from "../services/blogs"
const reducer = (state=null, action) => {
switch (action.type) {
case 'LOG_IN':
return action.data
case 'LOG_OUT':
return null
default:
return state
}
}
export c... | true |
a30b39c227f57d084d352733ebea06b3502ee53f | JavaScript | mar-hn/dockermanager | /app/Utils/miscUtils.js | UTF-8 | 1,188 | 2.859375 | 3 | [
"MIT"
] | permissive | import ConvertClass from 'ansi-to-html';
import xmlParser from 'xml-js';
class miscUtils
{
constructor()
{
this.convert = new ConvertClass()
}
escape(html)
{
const text = document.createTextNode(html);
const div = document.createElement('div');
div.appendChild(text... | true |
93aa6d531ba4b203090cc13251d45fa315bc52f0 | JavaScript | manavm1990/observer-pattern-spa | /components/users/AddUser.js | UTF-8 | 1,042 | 2.75 | 3 | [] | no_license | import { Component } from "../../lib/classes";
import { createObjectFromFormIds } from "../../lib/utils";
// 'extends' provides 'share method' 'update'
class AddUser extends Component {
constructor() {
super();
}
bindListeners() {
document.querySelector("form").addEventListener("submit", e => {
e.... | true |
6f15f568bba3c97c1f0df33cfc4291af5745be3d | JavaScript | davecate/GrubDash_API | /src/orders/orders.controller.js | UTF-8 | 4,507 | 2.8125 | 3 | [] | no_license | const path = require("path");
// Use the existing order data
const orders = require(path.resolve("src/data/orders-data"));
// Use this function to assign ID's when necessary
const nextId = require("../utils/nextId");
// order exists validator
const orderExists = (req, res, next) => {
res.locals.orderId = req.param... | true |
784663554bdcb4e49fa2d48ad08771043f7a4817 | JavaScript | vasil9v/jsonl-tree | /lib/jsonl-tree.js | UTF-8 | 3,473 | 3.015625 | 3 | [
"MIT"
] | permissive | const readline = require("readline");
/*
* Return the indentation level and the
* rest of the line.
* Supports both whitespace and alternatively
* an int specifying what the indentation
* level is.
*/
function getIndentation(s) {
let i = 0;
let sep = ' ';
if (s[0] === ' ' || s[0] === '\t') {
sep = s[0]... | true |
7ff276a2cea9dc23fa9c770bed6811e2cb0b3718 | JavaScript | Asit-website/Textutils-React | /src/component/TextForm.js | UTF-8 | 2,735 | 3.203125 | 3 | [] | no_license | import React, { useState } from 'react'
export default function TextForm(props) {
const handleUpClick = () =>{
// console.log("uppercase was clicked"+ text);
let newText = text.toUpperCase();
setText(newText);
// props.showAlert("Converted to uppercase","success");
}
... | true |
e9eb00d4e055d96f46b511137f329a4fa3e66aac | JavaScript | NicolasCambon/Project-WEB | /script.js | UTF-8 | 20,111 | 2.921875 | 3 | [] | no_license | class pendu
{
constructor() {
this.score;
if ('mydata' in localStorage)
{
this.arrayBestPlayer=JSON.parse(localStorage['mydata']);
}
else
{
this.arrayBestPlayer=new Array(10);
}
this.rang;
this.d1;
this.delay;
this.mot;
this.categorie;
this.motchercher="... | true |
b1c18026b3b3cd614817856adc19c44c77da1f52 | JavaScript | duqueg24/JavaScript-Nivel-Junior | /metodosCadena/toUpperCase.js | UTF-8 | 93 | 3.0625 | 3 | [] | no_license | let cadena = "ABCDEF";
resultado = cadena.toUpperCase();
document.write(resultado); // ABCDEF | true |
1d16b8b766b025c939cc0e0b591ce226db2c19fc | JavaScript | FREELANCER2017/rfvis | /rfvis/client/src/utils/compute_coordinates.js | UTF-8 | 5,529 | 3.078125 | 3 | [
"MIT"
] | permissive | /**
* This script contains the coordinate algorithm and is meant to be called in a child process,
* as it is computationally expensive and would otherwise block the event loop.
*/
import Vector from "./Vector.js";
/**
* Object returned by computeTreePositions()
* @typedef {Object} TreePosition
* @property {numb... | true |
0c2b39e76cf86babff45c2d66204f0715d6e8ebb | JavaScript | Oppadayo/social-media-dashboard | /js/main.js | UTF-8 | 527 | 2.796875 | 3 | [] | no_license | const toggle = document.getElementById('toggle')
const header = document.querySelector('header')
const body = document.querySelector('body')
const cards = document.querySelector('.cards')
const overview = document.querySelector('.overview')
toggle.addEventListener('change', (e)=>{
header.classList... | true |
1dabf61f72a84645531e7e68db08f90d6fcb8a49 | JavaScript | cinchpicks/cinchpicks-react-app | /src/components/admin/GetUsersList.js | UTF-8 | 1,045 | 2.59375 | 3 | [
"MIT"
] | permissive | import React, { useState, useEffect } from 'react';
import axios from 'axios';
function UserList() {
const [users, setUsers] = useState({ data: [] });
useEffect(() => {
const url = 'https://s34n9ig88f.execute-api.us-east-1.amazonaws.com/dev/';
const fetchData = async () => {
... | true |
6a0dc075735e753f7bea8369a6229d109c630d72 | JavaScript | royhobbstn/commodity-flow | /cfs_data/createPoints.js | UTF-8 | 768 | 2.84375 | 3 | [
"MIT"
] | permissive | // node --max-old-space-size=4096 createPoints.js
const fs = require('fs').promises;
const turf = require('@turf/turf');
main();
async function main() {
// load manually created cfs points file
const cfs_points = JSON.parse(await fs.readFile('./cfs_points.geojson'));
// read census zcta areas
const zip_geo... | true |
da3a04190dcf54c2de55a48c73f970962bae16d6 | JavaScript | efielding/intro-js | /js/number.js | UTF-8 | 735 | 3.90625 | 4 | [] | no_license | // number data type
var a = 10;
console.log(a);
var b = 100;
console.log(b);
var a =20;
console.log(a);
var c = 0x1E; //hex value of 30
console.log(c);
var d = 0.5;
console.log(d);
var sum =a+b;
console.log(sum);
// subtraction
var diff = d-c;
console.log(diff);
// multiplication
var mult = a*d;
console.log(mult);
... | true |
e9c39c7f7b082a78b4483d35369a59f82b5e1737 | JavaScript | nikoada/javascript_examples | /advance js/defaultarguments.js | UTF-8 | 166 | 3.28125 | 3 | [] | no_license | function multiply(a, b = 1) {
return a*b;
}
console.log(multiply(5, 2));
function myMultiply(a, b) {
if (!b) {
b = 1;
}
return a*b;
}
myMultiply(5);
| true |
86084124b355084d81aee0e7ce06a8915538336d | JavaScript | NathanM64/blind_test | /src/pages/Game/Questions.js | UTF-8 | 1,805 | 2.578125 | 3 | [] | no_license | import React, { useEffect, useState } from 'react';
import { Card, Image, QuestionsLayout, QuestionsWrapper, Text } from './index.style';
import ReactAudioPlayer from 'react-audio-player';
const Question = ({ data, chooseAnswer, startTime }) => {
const [sound, setSound] = useState();
const makeChoice = (answe... | true |
bc4b8e2af14727e152fe1b3b112496d24c8d5a6d | JavaScript | arch-code/Tips | /JavaScript/initializing.js | UTF-8 | 637 | 3.25 | 3 | [] | no_license | // Javascript - Initializing
const hasValue;
let receivingValue;
// Classical way
if (hasValue) {
receivingValue = hasValue;
}
else {
receivingValue = 'Initial value';
}
console.log(receivingValue) // Output: 'Initial value'
//Cleaning variable
receivingValue = null;
// Modern way
receivingValue = hasValue ... | true |
d54bc29f39b70e7ff8a7dac3cc30c50bd69291b0 | JavaScript | XIZORG/lms-thinking-hat | /lms_client_react/src/Components/Courses/CourseCreate/Parts/Materials/SingleMaterial.jsx | UTF-8 | 972 | 2.640625 | 3 | [] | no_license | import {useState} from "react";
export const SingleMaterial = (props) => {
const [selected, setSelected] = useState(props.selected);
console.log("SELECTED IDS", props.selectedMaterialsIds.current);
const toggleId = (id) => {
if (props.selectedMaterialsIds.current.find(materialId => id === material... | true |
93f539a7fbaf9604f67605219b7b63b5470e393f | JavaScript | AmitaAradwad/jspractice | /arrays/todo.js | UTF-8 | 405 | 3.453125 | 3 | [] | no_license | const todos=['complete js', 'start web', 'decide story', 'learn DS','allot tasks']
console.log('3rd item deleted from the list is:' + todos.splice(2,1))
todos.push('new last item')
console.log('first item removed from the list is:' +todos.shift())
console.log(`your new list have ${todos.length} todos:`)
todos.forEach(... | true |