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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
c27ed831c2a3c5475fd7048c520b0d825c1bd021 | JavaScript | jeremyt0/jeremyt0.github.io | /ThreeJS/js/gallery/objects.js | UTF-8 | 5,201 | 3.09375 | 3 | [] | no_license |
// Objects
const createBox = function (width=1, height=1, depth=1, color=0x00ff00) {
let cube = new THREE.Mesh(
new THREE.BoxGeometry(width, height, depth),
new THREE.MeshPhongMaterial( { color: color } )
);
cube.position.y += height/2;
cube.receiveShadow = true;
cube.castShadow = ... | true |
c431d22abef64d7fe307ccc31ffdefaafd016a3b | JavaScript | SeanCCarter/olinjsLab1 | /routes/index.js | UTF-8 | 1,992 | 2.8125 | 3 | [] | no_license | //Contains the code for every route connected
//to the server
var express = require('express');
var path = require('path');
var Wiki = require(path.join(__dirname,'../models/wikiModel'));
var routes = {}
routes.home = function(req, res){
res.sendfile("./public/index.html");
}
routes.newTopic = function(req, res){... | true |
d6ede1ed3c7993c8d9d6aa22135e703af95b560c | JavaScript | musfirotus-backup/OOP-Challenge | /src/01.js | UTF-8 | 768 | 3.21875 | 3 | [] | no_license | const crypto = require("crypto");
class Hash {
static md5(text) {
const md5 = crypto.createHash("md5");
md5.update(text);
console.log(md5.digest('hex'));
}
static sha1(text) {
const sha1 = crypto.createHash("sha1");
sha1.update(text);
console.l... | true |
73e7d550c99a6335cb6373bb5a4169b36c5c264a | JavaScript | ascha19/120-Work | /hw-4-remake/sketch.js | UTF-8 | 2,097 | 3.609375 | 4 | [] | no_license | //Was gonna make him squish when clicked, now it's going to be blinked. Hopefully. I also don't know where to put an array.
//Update: He winks now, and his name is now Denom. Click for it to get worse.
let whatMouthDo = ["blep", "mlem" , "lick" , "slorp" , "*eats u*" , "rawr" , "come to me Eddie" , "*is alien*" , "*wi... | true |
dd657976dde0acf0b717a0b2a59aaed7727c984e | JavaScript | qcxd/front-end | /src/utils/util.js | UTF-8 | 3,234 | 2.609375 | 3 | [] | no_license | var app = getApp()
function formatTime(date) {
var year = date.getFullYear()
var month = date.getMonth() + 1
var day = date.getDate()
var hour = date.getHours()
var minute = date.getMinutes()
var second = date.getSeconds()
return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, se... | true |
37b6f752b7205508c8a9d54d39e7a469de854137 | JavaScript | bgoonz/UsefulResourceRepo2.0 | /GIT-USERS/johnsh/arr-diff/benchmark/code/while-push.js | UTF-8 | 301 | 2.859375 | 3 | [
"MIT"
] | permissive | 'use strict';
module.exports = function diff(arr, arrays) {
arrays = [].concat.apply([], [].slice.call(arguments, 1));
var len = arr.length;
var result = [];
while (len--) {
var ele = arr[len];
if (arrays.indexOf(ele) === -1) {
result.push(ele);
}
}
return result;
};
| true |
5773ecd2f005f4bdfd3c864d685b5846082c4401 | JavaScript | LanNguyen-Thi/1712552_KCPM_BTCN06 | /Diem.js | UTF-8 | 442 | 3.203125 | 3 | [] | no_license | module.exports = class Diem {
constructor(x, y) // Khởi tạo hoành độ, tung độ x,y cho điểm
{
this.x = x;
this.y = y;
}
static distance(diem1, diem2) {
const dx = diem1.x - diem2.x;
const dy = diem1.y - diem2.y;
return Math.hypot(dx, dy);
... | true |
a5c4b16dd1dc6ef5078efaa4a8c63b4d7cf6be94 | JavaScript | Clygm/leaguetags | /summoner.js | UTF-8 | 4,234 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | class summoner {
constructor(data, APIRoutes) {
// Modules
this.request = require("request");
// class data
if (!this.IsJsonString(data)) return;
data = JSON.parse(data)
this.APIRoutes = APIRoutes;
this.level = this.level || data.summonerLevel;
this.name = this.name || data.displayName;
... | true |
37e799cfbebd734d82c08724d6b437e0a87fe200 | JavaScript | RonanFelipe/CryptoPrices | /src/Components/Chart.js | UTF-8 | 2,043 | 2.5625 | 3 | [] | no_license | import React, {useEffect, useState} from 'react';
import { useDispatch, useSelector } from "react-redux";
import {LineChart, Line, XAxis, YAxis, ResponsiveContainer, CartesianGrid, Tooltip} from 'recharts';
import { fetchCoinsIfNeeded, loadCard } from "../actions";
import Title from './Title';
export default function ... | true |
c37cdb5862a6133fb0a5874713029842529269af | JavaScript | AMmetro/itech | /js/toast.js | UTF-8 | 4,659 | 2.84375 | 3 | [] | no_license |
document.querySelector('.button_error').onclick = function () {
var toastPopupError = new ToastPopupError('Error!!!Oops, somethink is wrong')
toastPopupError.makeToast();
};
document.querySelector('.button_warning').onclick = function () {
var toastPopupWarning = new ToastPopupWarning('Warning!!! Pay atention')... | true |
c4bf3a6986bb64388b18f92f592de81a0605eff9 | JavaScript | codegrid/2015-sound | /5_demo/convolver/main.js | UTF-8 | 2,227 | 2.765625 | 3 | [] | no_license | (function(global) {
'use strict';
var ctx = new global.AudioContext();
global.document.getElementById('jsPlayBtn').addEventListener('click', play, false);
global.document.getElementById('jsStopBtn').addEventListener('click', stop, false);
[].slice.call(global.document.getElementsByClassName('jsFilterRadio')... | true |
0e176f8348cd86f1594a76ede678a688afabc790 | JavaScript | haywhyze/iReporter | /server/middlewares/isValidStatus.js | UTF-8 | 353 | 2.578125 | 3 | [
"MIT"
] | permissive | const isValidStatus = (req, res, next) => {
const acceptedStatus = ['draft', 'under investigation', 'rejected', 'resolved'];
if (!acceptedStatus.includes(req.body.status)) {
return res.status(400)
.send({
status: 400,
error: 'Status not of accepted value',
});
}
return next();
}... | true |
68edca09543fbcc7fc5b0b961f5938d7d1ebbe87 | JavaScript | martingimenez7/CursoIngresoJS | /8-TPs/jsFerreteFacturacion.js | UTF-8 | 1,694 | 3.484375 | 3 | [] | no_license | /*1. Para el departamento de facturación:
A. Ingresar tres precios de productos y mostrar la suma de los mismos.
B. Ingresar tres precios de productos y mostrar el promedio de los mismos.
C. ingresar tres precios de productos y mostrar precio final (más IVA 21%).
*/
function Sumar ()
{
var preciouno;
var prec... | true |
8e8dcdd7c53ca0d8dd6030029f7f627571298165 | JavaScript | rbecerraj/jest-supertest-starter | /src/api/auth.api.js | UTF-8 | 452 | 2.59375 | 3 | [
"MIT"
] | permissive | class AuthApi {
constructor(client) {
this.client = client;
}
async login(email, password) {
const response = await this.client.request.post("/api/login").send({
email,
password
});
expect(response.status).toBe(200);
let body = response.body;
expect(body).toHaveProperty("token"... | true |
25c52cf2741127ddd1a17d9d02ce7d23fa6cadd9 | JavaScript | kritanai2548/pokecord-bot | /src/model/debug/autocatch.debug.js | UTF-8 | 1,142 | 2.5625 | 3 | [] | no_license | const CanvasTranformer = require('../autocatch/image/process.image.autocatch')
const Scraper = require('../autocatch/scrape/scraper.scrape')
async function imageDifference(src1, src2) {
const img1 = await new CanvasTranformer(src1)
const img2 = await new CanvasTranformer(src2)
const pixels1 = img1.toRaw().data
co... | true |
e65cb03fa0669257a86dcf3df6d79159406ec57c | JavaScript | QuyenThao/practice-js | /ex39.js | UTF-8 | 1,108 | 4.46875 | 4 | [] | no_license | /**
* In computer science and discrete mathematics, an inversion is a pair of places in a sequence where the elements
* in these places are out of their natural order. So, if we use ascending order for a group of numbers, then an
* inversion is when larger numbers appear before lower number in a sequence.
* Check... | true |
12ec69972d8d1626a9b2688a09c6e7ce98f7b925 | JavaScript | efmena1/fullstackOpen | /part2/data_for_countries/src/App.js | UTF-8 | 1,000 | 2.828125 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
import Filter from "./components/filter";
import DisplayData from "./components/countries";
import axios from "axios";
const App = () => {
const [countries, setCountries] = useState([]);
const [filter, setFilter] = useState("");
useEffect(() => {
axios.get... | true |
0c48b9704e6e7ab4cd9a9e1f99e185bb54ea0a9e | JavaScript | Dulian-Padilha1520/JavascriptEx | /Capitulo 5/Atividade02.js | UTF-8 | 761 | 3.34375 | 3 | [] | no_license | const fs = require('fs');
function getData(filename) {
return JSON.parse(fs.readFileSync(filename, "utf8"));
}
const ancestry = getData("ANCESTRY_FILE.json");
function average(array) {
function plus(a, b) { return a + b; }
return array.reduce(plus) / array.length;
}
function hasKnownMother(... | true |
7c3a72ab43185a9531d622ed884489fa8806c6c2 | JavaScript | Balajisri1998/ahamad | /hackfinal/js/script.js | UTF-8 | 588 | 2.546875 | 3 | [
"MIT"
] | permissive | $(document).ready(function(){
$(".stat-btn").click(function(){
$(".stat").removeClass("hidden");
});
$(".data1").click(function(){
$(".stat,.forecast,.api").addClass("hidden");
$(".data").removeClass("hidden");
});
$(".api1").click(function(){
... | true |
e9d3d637d9bb0cdc4ac37fb8b41763d626e9dd69 | JavaScript | victorfarias/piw_20201_react | /src/teste/Pessoa.js | UTF-8 | 219 | 2.5625 | 3 | [] | no_license | import React from 'react';
class Pessoa extends React.Component{
render(){
let nome = "joao";
return (<div> componente pessoa {nome} {1+2} {"joao" + "maria"} </div>);
}
}
export default Pessoa; | true |
e511ed8df896bd0078d6d82ef5328c97fcae30e9 | JavaScript | vitongos/mbitschool-intensivo-verano | /data/mongodb/solutions.js | UTF-8 | 5,452 | 2.953125 | 3 | [
"MIT"
] | permissive | // ***
// En la colección mkt.registerTiny:
// - Buscar todos los registros de New Haven en plataforma iPad
// - Buscar los 10 documentos con mayor número de prints
use mkt;
db.registerTiny.find({platform: "iPad", city: "New Haven"});
db.registerTiny.find().sort({prints: -1}).limit(10);
// ***
// ¿Qué índic... | true |
dc05d72037f3964fc5cde109ec496192eea9a875 | JavaScript | MSP95/stormtrader | /assets/js/graph.jsx | UTF-8 | 2,208 | 2.515625 | 3 | [] | no_license | import React from 'react';
import ReactDOM from 'react-dom';
import {Line} from 'react-chartjs-2';
export default class Graph extends React.Component {
constructor(props) {
super(props)
this.channel = this.props.channel;
this.getChart = this.getChart.bind(this)
this.state = {
names: [{id: 0, nam... | true |
b96403a1c4a10ea1d97fa44678825b4bd6a3d30e | JavaScript | NavaAmalfard/dantaeyoung.com | /js/Mobile.js | UTF-8 | 2,280 | 2.5625 | 3 | [] | no_license | Mobile = {};
Mobile.gyroCount = 0;
window.wasFlat = true;
Mobile.frequency = 200;
Mobile.checkIfMobile = function() {
var o = gyro.getOrientation();
if(o.beta == null) {
if(typeof(Mobile.isMobile) === 'undefined') {
Mobile.isMobile = false;
}
} else {
Mobile.isMobile ... | true |
ccabd5304ccab01bdd5294d5cb4771e81c18e1e6 | JavaScript | francomercuri/romabella_mercuri | /js/destacados.js | UTF-8 | 1,469 | 3.03125 | 3 | [] | no_license |
let destacados = []
const sectionDestacados = document.querySelector('#contenedor-destacados');
const carritoIndex = document.querySelector('#carrito-index');
$.getJSON('productos.json',(data) => {
data.forEach(el => {
if (el.destacado == true){
destacados.push(new Productos(el.id,el.destacado,el.nomb... | true |
fe3b552a095d92238a4e633dcd3793dba17543d3 | JavaScript | marshalloffutt/lego-builder | /src/helpers/legosLoader.js | UTF-8 | 1,010 | 2.53125 | 3 | [] | no_license | import parts from '../data/partsData';
import dropdown from '../components/Dropdown/dropdown';
import displays from '../components/LegoCharacter/legoCharacter';
const loadHeads = () => {
parts.getHeads()
.then((heads) => {
const allHeads = heads;
dropdown.headsInDropdown(allHeads);
displays.ini... | true |
c04a8ddb5fd12e1e29feb382486a018ea6e8a168 | JavaScript | mozert1988/Projeto-Detetive | /index.js | UTF-8 | 1,452 | 4.28125 | 4 | [] | no_license | //Projeto 01 – Projeto Detetive
//Faça um programa que faça 5 perguntas para uma pessoa sobre um crime. As
//perguntas são:
//1. "Telefonou para a vítima?"
//2. "Esteve no local do crime?"
//3. "Mora perto da vítima?"
//4. "Devia para a vítima?"
//5. "Já trabalhou com a vítima?"
//O programa deve no final emitir uma cl... | true |
ccbec8bf5e0c93e9eaa53b94c66eaf04029ab194 | JavaScript | Nazli64/DKA1213 | /script.js | UTF-8 | 106 | 2.6875 | 3 | [] | no_license | //creates a variable called myName
//assign your name to variable myName
//display output on console
| true |
7e10cf4ad68dfee93b7488679d58852c79b6217e | JavaScript | meneace/DevfGDL-1 | /clima/js/java.js | UTF-8 | 3,790 | 3.046875 | 3 | [] | no_license | var api = 'http://api.openweathermap.org/data/2.5/weather?q=';
//var ciudad = 'London';
var llave = '&lang=es&appid=0f40ca15b97954d021411d36147ac58b';
var unidades = '&units=metric';
function clima() {
if (validaInputs()) {
var settings = {
"async": true,
"crossDomain": true,
... | true |
0da229859f66ac4d648aba1b1475fa7a38058541 | JavaScript | hightio1/basic-js-syntax | /js/script.js | UTF-8 | 1,406 | 4.65625 | 5 | [] | no_license | /*
* Add code as indicated by the comments.
* Be careful not to change or modify the existing code.
*/
function sayHello() {
var name = 'Josh';
var message = 'Hello ' + name + '. Nice to meet you!';
console.log(message);
}
function evenOrOdd() {
var number = 5;
consol... | true |
f002fe2346d0b23c0c9eeabec3816f64349b00cf | JavaScript | sofiemjohansson/labbReact | /labbreact/src/EmployeeList.js | UTF-8 | 1,651 | 2.71875 | 3 | [] | no_license | import Employee from "./Employee";
import { useState } from "react";
function EmployeeList() {
const [employees, setEmployees] = useState([
{
name: "Sofie Johansson",
email: "sofiem.eriksson@gmail.com",
phone: "070123456789",
skills: "Specialistunder... | true |
06fd19697c5d9decfb691ab7b120217324bf0722 | JavaScript | xXD4rkC0d3rXx/data-structures-and-algorithms | /src/HuffmanTree/utils.js | UTF-8 | 579 | 3.1875 | 3 | [] | no_license |
export function getSymbolsFrequencyTable(text) {
const symbolsFrequencyTable = new Map(new Set(text).entries());
symbolsFrequencyTable.forEach((value, key) => {
symbolsFrequencyTable.set(key, 0);
});
let symbolFrequency = 0;
let symbol;
for (let i = 0; i < text.length; i++) {
... | true |
021444918198a6738b5ce132c6f29443218c15d4 | JavaScript | luotaoyeah/learning-npm | /src/doc/03-packages-and-modules/03-03-updating-and-managing-your-published-packages/03-03-02.js | UTF-8 | 679 | 2.703125 | 3 | [] | no_license | /*
* Packages and Modules
* Updating and Managing Your Published Packages
* Unpublishing Packages from The Registry
*/
console.log("\n-------------------------------------------------- 01");
{
/*
* 当包发布到仓库之后,在 72 小时之内,可以取消发布,
* 可以取消发布整个包,也可以取消发布包的某个版本,
* 如果取消发布了整个包,则之后不能再重新发布这个包,除非重新换个包名... | true |
492d732bd58870f6de11453da91944778435c841 | JavaScript | saber-qianqian/foxnode | /node/nest/lib/ejsFn.js | UTF-8 | 1,479 | 2.90625 | 3 | [
"MIT"
] | permissive | function getStringLength(s){
return s.replace(/[^\x00-\xff]/g,"**").length / 2;
}
function getStringLengthArr(s , len){
var w = 0;
var time = 0;
for(length=s.length; time<length; ){
if(/[^\x00-\xff]/.test(s[time])){
w+=2;
}else{
w+=1;
}
time ++;
if(w >= (len*2)){
break;
}
}
return time;
}
e... | true |
4456c65135a75df498fec917cf10d40bb3e58374 | JavaScript | hasanqadri/Viz-Georgia | /angular-src/src/assets/js/ga_map.js | UTF-8 | 15,938 | 2.78125 | 3 | [
"MIT"
] | permissive | // Used the following website for assistance:
// http://bl.ocks.org/mbeasley/6821149
//setting up basic chart variables
var width = 630,
height = 800;
var chartData = {};
var countyName = []
var svg = d3.select(".ga-map").append("svg")
.attr("width", width)
.attr("height", height);
var projection = d3.geo.merc... | true |
143e89fe9bfdb4228bf78511c4aad81eff23b358 | JavaScript | treejames/campus-guide | /src/reducers/__tests__/search-test.js | UTF-8 | 1,686 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | /**
*
* @license
* Copyright (C) 2016 Joseph Roque
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable ... | true |
a2c8d21f775b3fd1d67c2690a21e9f06bea08dc4 | JavaScript | mathvp/projeto-cinema | /back-end/Cinema/WebContent/View/index.js | UTF-8 | 522 | 2.9375 | 3 | [] | no_license |
//using template in component
Vue.component('hello-component', {
template: '#hello',
data: function () {
return {
msg: 'Olá '
}
},
props: ['usuario']
});
Vue.filter('caixabaixa', (key) => {
return key.toLowerCase()
})
new Vue({
el: '#app',
data: {
contato: null
},
//a função definida em mounted é ... | true |
6e39b1187e00f6c6c555a1b37ce0bcd3836d982b | JavaScript | Co-Help/backend | /manager/tokenManager.js | UTF-8 | 421 | 3.140625 | 3 | [] | no_license | class TokenManager {
constructor(arr = []) {
this.data = arr;
}
addToken(token) {
if (!this.data.includes(token)) {
this.data.push(token);
}
}
removeToken(token) {
this.data = this.data.filter((item) => item !== token);
}
isTokenAvailable(token) {
return this.data.includes(tok... | true |
7366f94b1e3dadc0f930c6575613ec279e376761 | JavaScript | computacionvisual/Talleres | /Taller 1/filter.js | UTF-8 | 6,940 | 2.75 | 3 | [] | no_license | let canvas;
let img_base;
let img_luma;
let img_mask;
let img_segmentated;
let video_base;
const R = 0, G = 1, B = 2;
const HISTOGRAM_HEIGHT = 230;
const HISTOGRAM_POSITION = 600;
function preload() {
let image_source = './images/Landscape.jpg';
img_base = loadImage(image_source);
img_luma = loadImage(image_s... | true |
f10360919e73511bb544c02ad78b10866c4c3d7b | JavaScript | flynx/ImageGrid | /legacy/ui/sort.js | UTF-8 | 12,555 | 2.671875 | 3 | [] | no_license | /**********************************************************************
*
* Image Sorting API
*
*
**********************************************************************/
// Used in sortImagesByFileNameSeqWithOverflow
var PROXIMITY = 30
var CHECK_1ST_PROXIMITY = false
var OVERFLOW_GAP = PROXIMITY * 5
... | true |
08f8ee83386625336c565c379f2fc1f78b6eef8a | JavaScript | jaisekhar/LAB6-Assignment | /customer_app.js | UTF-8 | 2,410 | 3.09375 | 3 | [] | no_license | const params = require('yargs');
const customers = require('./customer_crud.js');
const customer_id = {
describe: 'ID of the Customer',
demand : true,
alias : 'i'
};
const customer_name = {
describe: 'Name of the Customer',
demand : true,
alias : 'n'
};
const customer_email = {
describe... | true |
b318c38647862f49c8ef1cfbbdd4986f63a838cf | JavaScript | juliejames125/Guess_my_number | /game.js | UTF-8 | 2,129 | 3.609375 | 4 | [] | no_license | "use strict";
let randomNumber = Math.trunc(Math.random() * 20) + 1;
const check = document.querySelector(".check");
const message = document.querySelector(".message");
const scoreNumber = document.querySelector(".score");
const highNumber = document.querySelector(".highscore");
const again = document.querySelect... | true |
6745d22b08eb0704f46ee0672a728670af1589e4 | JavaScript | jpacsai/codeSignal | /TheCore/2_AtTheCrossroads/4_isInfiniteProcess.js | UTF-8 | 539 | 4.25 | 4 | [] | no_license | /*
Given integers a and b, determine whether the following pseudocode results in an infinite loop
while a is not equal to b do
increase a by 1
decrease b by 1
Assume that the program is executed on a virtual machine which can store arbitrary long numbers and execute forever.
Example
For a = 2 and b = 6... | true |
af9668a0cd0e40e28e946b5c0a07864a6cd1e655 | JavaScript | SadBamsi/toCourse | /English_for_kids/src/js/Header.js | UTF-8 | 1,689 | 2.703125 | 3 | [] | no_license | import { Menu } from "./Menu";
export class Header {
constructor(show, game) {
this.show = show;
this.game = game;
}
init() {
const fragment = document.createDocumentFragment();
const menuBtn = document.createElement('button');
const burger = document.createElement('... | true |
44307ad713043195c77e0dc5e09d6699bdd85a6f | JavaScript | TheMulittle/alude-code-challenge | /src/structures/Stack.js | UTF-8 | 1,013 | 3.75 | 4 | [] | no_license | import DoubleLinkedList from "./DoubleLinkedList.js";
export default class Stack {
constructor() {
this.list = new DoubleLinkedList();
}
/**
* Adds an item onto the top of the stack
* @param the item to be added
*/
push(item) {
this.list.addItemAtLastPosition(item);
}
/**
* Removes t... | true |
b5af02fe7ea144f8a4a4f5e7fad531270ea20340 | JavaScript | JohnnyMa/samples | /d3/src/index.js | UTF-8 | 4,855 | 2.671875 | 3 | [
"MIT"
] | permissive | import d3 from 'd3';
import newYorkTemp from 'shared/temperature-New-York.csv';
import sanFTemp from 'shared/temperature-San-Francisco.csv';
import Chart from 'core/chart.js';
import Series from 'core/series.js';
import { randomInt } from 'helpers/math.js';
let series = [];
[newYorkTemp, sanFTemp].forEach(function(da... | true |
94b10b5334f03cb66963ed7ac03cc221a709f4ab | JavaScript | koles14/hanoi-webgl | /Game.js | UTF-8 | 4,169 | 2.890625 | 3 | [] | no_license | var animating = false;
var bucket = [ [ 4, 5, 6, 7, 8 ], [], [] ];
function move(id, dest, timesec) {
var model = MODELTEXT[id];
var origin = null;
var period = timesec * 1000;
var beginTime = 0;
return function() {
if (!origin) {
origin = {
x: model.x,
... | true |
20649fa72209d978f5015f3fba4d0ed132af441f | JavaScript | astanchev/JS-Fundamentals | /Lesson 6 Objects and Classes/Exercise/01. Employees.js | UTF-8 | 435 | 3.6875 | 4 | [] | no_license | function employees(input) {
let emps = [];
for (const name of input) {
let employee = {
employeeName: name,
personalNum: name.length
};
emps.push(employee);
}
emps.forEach(e => console.log(`Name: ${e.employeeName} -- Personal Number: ${e.personalNum}`))... | true |
7e5011d48966c88c4c1956c73a1ad2e0ddc468e0 | JavaScript | lucasedfc/course-react-hooks-redux | /02-intro-javascript/src/bases/09-promises.js | UTF-8 | 707 | 3.015625 | 3 | [] | no_license | import { getHeroById } from "./bases/08-imp-exp";
// const promise = new Promise((resolve, reject) => {
// setTimeout(() => {
// const hero = getHeroById(2);
// resolve(hero)
// //reject('Hero not found')
// }, 2000);
// });
// promise.then((data) => {
// console.log('Data from pr... | true |
a92065b90c8922b3a7d2d9f64fa65c40f505e1e6 | JavaScript | CTimpone/AA_JavaScript | /JQuery_PlugIns/thumbnails/thumbnails.js | UTF-8 | 1,396 | 2.6875 | 3 | [
"MIT"
] | permissive | $.Thumbnails = function (el) {
this.$el = $(el);
this.$activeImg = $('.gutter-images > li:first-child').children();
this.$tempImg = null;
this.activate();
this.$el.find('.gutter-images').on('click', 'img', this.selectImage.bind(this))
this.$el.find('.gutter-images').on('mouseenter', 'img', this.hoverSelect.... | true |
85381498586c033ae2713e6d420eb5820fa67a4c | JavaScript | osusara/gpa-calculator-v2 | /src/components/resultSheets/shared/resultsTable.js | UTF-8 | 5,364 | 2.609375 | 3 | [] | no_license | import React, { useEffect, useState } from "react";
import { Form } from "react-bootstrap";
export const TableTopic = ({ year, semester }) => {
return (
<h5 className="p-2 mb-2 bg-dark text-white card-title text-center">
Year {year} Semester {semester}
</h5>
);
};
export const TableHead = () => {
... | true |
06988d8ec22aa484203bc207cea3d74ddd17d3c2 | JavaScript | uniondirfolder/JS-intro | /EcmaS/5_rest_spread.js | UTF-8 | 1,001 | 3.75 | 4 | [
"MIT"
] | permissive | //Rest
function averange(a, b, ...args) {
return args.reduce((acc, i) => acc += i, 0) / args.length;
}
console.log(averange(10,20,30,40));
//Spread
const array = [1,2,3,4,5,6,7];
console.log(...array);
console.log(Math.max.apply(null,array));
console.log(Math.max(...array));
console.log(Math.min(.... | true |
3115d8c39bedebfc74f0cbf93f56f5a627359f27 | JavaScript | cleefsouza/codecademy-javascript | /challenge-kelvin-weather.js | UTF-8 | 900 | 4.3125 | 4 | [] | no_license | /*
* No fundo do seu laboratório de meteorologia ao lado da montanha, o cientista louco Kelvin dominou a previsão do tempo.
* Recentemente, Kelvin começou a publicar suas previsões do tempo em seu site. No entanto, há um problema: todas as suas
* previsões descrevem a temperatura em Kelvin. Com o nosso conhecimento ... | true |
b448bb34daddbe379750955f7ee9ccdae936a79a | JavaScript | discordbotmakers/mikesbot-repo | /commands/fun/giveaway.js | UTF-8 | 2,745 | 3.125 | 3 | [] | no_license | const {MessageEmbed} = require('discord.js');
const ms = require('ms')
module.exports={
name: 'gcreate',
aliases: ['giveaway'],
description: 'Creates a giveaway',
usage: '<time><prize>', //🎉
category: 'fun',
run: async(bot,message,args)=>{
if(!args[0]) return message.channel.send(`No tim... | true |
c0b3d60294853de805f037d7b6c1353c243b0ada | JavaScript | iheb1919/holbertonschool-higher_level_programming | /0x13-javascript_objects_scopes_closures/9-logme.js | UTF-8 | 137 | 2.578125 | 3 | [] | no_license | #!/usr/bin/node
// number arguments
let num = 0;
exports.logMe = function (item) {
console.log(`${num}: ${item}`);
num = num + 1;
};
| true |
b5ce235084e04571fd0acee70d524425c646c038 | JavaScript | danm/thread-factory | /src/index.js | UTF-8 | 3,959 | 2.671875 | 3 | [
"MIT"
] | permissive | const fs = require('fs');
const zlib = require('zlib');
const cluster = require('cluster');
const numCPUs = require('os').cpus().length;
const EventEmitter = require('events');
module.exports = class ThreadFactory extends EventEmitter {
constructor(spec) {
super();
this.spec = spec;
this.end = false;
}... | true |
d9591bf4627afd0828ac4225556f0b6479c0ba88 | JavaScript | albabar/tooltip.js | /tooltip.js | UTF-8 | 1,047 | 2.96875 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | var toolTip = {
init: function() {
var links = document.getElementsByTagName('a');
for(var i = 0; i < links.length; i++) {
links[i].addEventListener('focus', this.showTipListener, false);
links[i].addEventListener('mouseover', this.showTipListener, false);
links[i].addEventListener('blur', this.hideTipLis... | true |
e444612b13f91b485c71ff1580291bd9f4b8c56c | JavaScript | funfox1/Screeps | /role.bringer.js | UTF-8 | 3,206 | 2.515625 | 3 | [] | no_license | var roleBringer = {
/** @param {Creep} creep **/
run: function(creep) {
if(creep.memory.dying && creep.ticksToLive > (CREEP_LIFE_TIME-100)) {
creep.memory.dying = false;
creep.say('back to work');
}
if(!creep.memory.dying && creep.ticksToLive < 150 ) {
if (cr... | true |
ab6ce6b226ed73baaabdb0aa50f40aae9f5cd05c | JavaScript | WinneyFung/training-thought | /src/agrorithm/lengthOfLastWord/lengthOfLastWord.js | UTF-8 | 775 | 3.9375 | 4 | [] | no_license | /**
* @param {string} s
* @return {number}
*/
var lengthOfLastWord1 = function (s) {
if (!s) {
return 0
}
s = s.trim()
const sperator = ' '
const words = s.split(sperator)
return words[words.length - 1].length
};
/**
* @param {string} s
* @return {number}
*/
var lengthOfLastWord2 = function (s)... | true |
18fb048dbe8fbf1f6b16f5845717ba93e47d978c | JavaScript | JBShort/Post-Bootcamp-MERN | /Mongoose/Jokes/server/controllers/jokes.controller.js | UTF-8 | 1,261 | 2.65625 | 3 | [] | no_license | const Joke = require("../models/jokes.model");
module.exports.findAllJokes = (req, res) => {
Joke.find()
.then(allJokes => res.json({ jokes: allJokes}))
.catch(err => res.json({message: "Something went wrong owo", error: err}));
}
module.exports.findSingleJoke = (req, res) => {
Joke.findOne({ ... | true |
1d50c51c3a6434bb0fb6e894a152074d52285e31 | JavaScript | joysagoo/CoinWorld-CryptoTracker2 | /components/CoinList.js | UTF-8 | 743 | 2.625 | 3 | [] | no_license | /*now whatever data the API will fetch for us, we will
only be using few parts of the jSON returned from filteredCoins */
import Coins from './Coins';
export default function CoinList({filteredCoins}) {
return (
<div>
{filteredCoins.map(coin => {
return (
<Coins
... | true |
f8366148233343a742cbb41115c9e4d6201f6d01 | JavaScript | kaushi019/beingzero-web-learn | /frontend/js/colors.js | UTF-8 | 1,153 | 3.328125 | 3 | [] | no_license |
function change(){
var r = document.getElementById("one").value;
var g = document.getElementById("two").value;
var b = document.getElementById("three").value;
// console.log(r);console.log(g);console.log(b);
//rgb code css
var code = "rgb("+r+", "+g+", "+b+")";
if(r+g+b<=341 || (g==0 ... | true |
58fa9756f844aeaf7511f9abf84599750cef8ac2 | JavaScript | brijkrpr22/project-food-delivery | /food-delivery/src/redux/reducer.js | UTF-8 | 1,029 | 2.65625 | 3 | [] | no_license | import { ADD_PRODUCT, ADD_TO_CART, REMOVE_FROM_CART } from "./actionTypes"
import data from "../utils/productData.json"
const initState={
productsArr: [...data],
cartItems:[]
}
const reducer = (state =initState, { type, payload }) => {
// console.log(payload)
console.log(state)
switch (type) {
... | true |
0f974302a552ee626d4dade287a1c70683334a3b | JavaScript | hyliss34/Cosmograve-M1-2017 | /Le_Site/public_html/js/gravitation/equation3d.js | UTF-8 | 1,481 | 2.9375 | 3 | [] | no_license | function eq3d(L,m,E) {
var a,b,c,d,gDelta,x,y,z,u,v,p,q,m,n,theta,k;
a=1-Math.pow(E,2);
b=-2*m;
c=Math.pow(L,2);
d=-2*m*Math.pow(L,2);
p=(c/a)-(Math.pow(b, 2.0)/(3*Math.pow(a, 2.0)));
q=((2*Math.pow(b, 3.0))/(27*Math.pow(a, 3.0)))-((b*c)/(3*Math.pow(a, 2.0)))+(d/a);
gDelta=4*Math.pow(p, 3.0)+27*Math.po... | true |
bd92a5d1df3ff345a1da6221525014d2268f96b4 | JavaScript | bytearcher/pitfalls-of-promisifying-by-hand | /perfect-deferredRead.js | UTF-8 | 784 | 2.734375 | 3 | [] | no_license | var Q = require('q');
function deferredRead(fs, file) {
var deferred = Q.defer();
var resolved = false;
try {
fs.readFile(file, "UTF-8", function(error, text) {
if (resolved) {
throw new Error("Already resolved.");
}
resolved = true;
i... | true |
dde3bd135d2f95895286d0df4b37dd0c311867b1 | JavaScript | dracero/coder-backend | /callbacks/00-filter.js | UTF-8 | 597 | 3.5625 | 4 | [] | no_license | const misNumeros = [0,1,2,3,4,5,6,7,8,9,10];
const misNumerosPares = misNumeros.filter(e=>e%2==0);
// const misNumerosParesMenoresA5 = misNumerosPares.filter(e=>e<5);
const misNumerosParesMenoresA5 = misNumeros.filter(e=>e%2==0).filter(e=>e<5);
console.log(misNumerosParesMenoresA5);
// const filtrar = (miArray, miFun... | true |
cffa37e441bc2e6c2e7ca09fb3da67e284cf8027 | JavaScript | ykttl/realtime-chat-drawing | /client/src/Canvas.js | UTF-8 | 2,666 | 2.953125 | 3 | [] | no_license | import React from "react";
import SocketIOClient from "socket.io-client";
//const socket = SocketIOClient("http://localhost:5000");
const socket = SocketIOClient("https://chat-and-canvas.herokuapp.com/");
class Canvas extends React.Component {
state = {
isDrawing: false,
currentX: 0,
currentY: 0,
cus... | true |
24f86cd165d173feaa70e4274299c178fb4ee02c | JavaScript | paulomi-mahidharia/WebDevSpring2016 | /public/experiments/protexteditor/textedit.controller.js | UTF-8 | 1,552 | 2.59375 | 3 | [] | no_license | /**
* Created by paulomimahidharia on 3/3/16.
*/
(function(){
angular
.module("NoteSpace", [])
.controller("TextEditorController", textEditorController );
function textEditorController($scope){
var widgets = [
{"_id": "000", "notetext":"This is my first note."},
... | true |
f87f8c36c18a77a6c64af906de0ec495e02a494c | JavaScript | AleksandarBoev/Softuni-JS-Advanced | /java-script-advanced-exam/tasks/t02-pizz-uni/tests.js | UTF-8 | 6,840 | 2.90625 | 3 | [] | no_license | const PizzUni = require('./pizz-uni');
const expect = require('chai').expect;
describe('"PizzUni" class tests', function () {
describe('constructor tests', function () {
it('when initializing object, default values are correct', function () {
const newObject = new PizzUni();
const ... | true |
4962fe968abd81553f7e96cd1fb357c279cd5122 | JavaScript | nikkypizza/shri-2018-II-task-1 | /js/surveillance.js | UTF-8 | 3,831 | 2.640625 | 3 | [] | no_license | import initStreams from "./modules/surveillance/init-streams.js";
import initCanvasVolumeGraph from "./modules/surveillance/init-canvas-volume-graph.js";
import {keyCodes, initialFilterValues} from "./modules/surveillance/constants.js";
const videoNodes = document.querySelectorAll(`.cameras__list-item-video`); // ?
con... | true |
f94aad0caf9093b36164b75cf5170db091b53ed1 | JavaScript | pmuellr/esc | /lib/logger.js | UTF-8 | 1,309 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env node
'use strict'
/** @typedef { import('./types').ILogger } ILogger */
module.exports = {
create
}
const path = require('path')
const pkg = require('../package.json')
const PROGRAM = pkg.name
/** @type {(fileName: string) => ILogger} */
function create (fileName) {
const relFileName = path.re... | true |
8aec1b8d959bade50284f772885c5380ae67f729 | JavaScript | ETBassist/js-fun-at-the-library | /src/librarian.js | UTF-8 | 787 | 3.390625 | 3 | [] | no_license | class Librarian {
constructor(name, library) {
this.name = name;
this.library = library;
}
greetPatron(patron, morning) {
if (morning) {
return `Good morning, ${patron}!`;
} else {
return `Hello, ${patron}!`;
}
}
findBook(title) {
let hasBook;
for (var key in this.l... | true |
47fb193578805cdd21c08f14027e8ebeb916e222 | JavaScript | rayoowoo/leetcode | /0012.js | UTF-8 | 1,251 | 3.71875 | 4 | [] | no_license | var intToRoman = function(num) {
const numString = num.toString();
let romanString = "";
const convert = {
"0": "",
"1": "I",
"5": "V",
"10": "X",
"50": "L",
"100": "C",
"500": "D",
"1000": "M"
}
let divisor = 1000;
while (num > 0) ... | true |
9fae9f58068ed571f32a8bf3833a86f94b857f4e | JavaScript | divinvishnu/calculator | /script.js | UTF-8 | 3,858 | 3.109375 | 3 | [] | no_license | const currentOutput = document.querySelector(".currentOutput");
const previousOutput = document.querySelector(".previousOutput");
const equals = document.querySelector("#equals");
const number = document.querySelectorAll(".number, .operant");
const clearAll = document.querySelector("#clearAll");
const backspace = docum... | true |
58edb6faa1f7818b9878f052481fa5cc924da998 | JavaScript | ojczeo/vuex-orm-graphql | /test/unit/Utils.spec.js | UTF-8 | 1,018 | 2.75 | 3 | [
"MIT"
] | permissive | import { prettify, downcaseFirstLetter, upcaseFirstLetter } from 'app/support/utils';
describe('capitalizeFirstLetter', () => {
it('capitalizes the first letter of a string', () => {
expect(upcaseFirstLetter('testFooBar')).toEqual('TestFooBar');
expect(upcaseFirstLetter('TestFooBar')).toEqual('TestFooBar');
... | true |
2b9f64a838aff968cbe557a2feb59668bacca4bc | JavaScript | Prakashn37/parking-management-system | /src/selectors/cars.js | UTF-8 | 212 | 2.578125 | 3 | [] | no_license | // Get visible expenses
export default (carList, { text }) => {
return carList.filter((car) => {
const textMatch = car.description.toLowerCase().includes(text.toLowerCase());
return textMatch;
})
};
| true |
b42fb24b319bee1fc90e377e0d2001c312a273bd | JavaScript | marceloSantosC/anotacoes | /2-Frontend Basico/JS/4 - Objetos/0 - Revisao.js | UTF-8 | 173 | 3 | 3 | [] | no_license | // objetos são dinâmicos
const obj = {}
obj.preco = 10
// Acessando atributos
const obj = {}
obj.preco
obj['Preco de obj']
// deletar atributo
delete obj['Preco de obj'] | true |
5565dd86d7f8a777248c81ff13e1c98abc0c9653 | JavaScript | kev123361/the-good-word | /backend/rss/rss.js | UTF-8 | 3,384 | 2.859375 | 3 | [] | no_license | var firebase = require("firebase");
var app = firebase.initializeApp({
apiKey: 'AIzaSyBiTz1cNiCndam8NFKy0qVhvVGfO1F1Dqw',
databaseURL: 'https://the-good-word.firebaseio.com'
});
const request = require ("request");
const FeedParser = require ("feedparser");
const urlTestFeed = "http://www.calendar.gatech.edu/feeds... | true |
7ec4f63ea5501052ead30b6b8fcf2a5638fae20c | JavaScript | sebaguzman13/mean-gestores | /server/src/app.js | UTF-8 | 1,505 | 2.875 | 3 | [] | no_license | /**
* En este archivo pondremos codigo relacionado con nuestro servidor/aplicacion
*
*
*
*/
// Para gestionar peticiones http desde angular utilizaremos el modulo express
const express = require('express');
// Utilizaremos el modulo morgan para ver por consola las peticiones que le llegan a nuestro servidor https:/... | true |
98ac199a9208f72861a280fb82dfcaf3f3dd7d54 | JavaScript | Task-Portal/planner | /server/controllers/board.controller.js | UTF-8 | 1,817 | 2.5625 | 3 | [] | no_license | const Board = require("../models/board.model");
const { errorHandler } = require("../helpers/dbErrorHandler");
exports.boardById = (req, res, next, id) => {
Board.findById(id).exec((err, board) => {
if (err || !board) {
return res.status(400).json({
error: "board does not exist",
});
}
... | true |
2f0575c72e9e9138b6958ea1a89f6a8812884af4 | JavaScript | NikolayKanchev/Chat-Node.js-Materialize | /test/test.js | UTF-8 | 2,516 | 2.703125 | 3 | [] | no_license | const chai = require('chai');
const chaiHttp = require('chai-http');
const main = require("../app.js");
const should = chai.should();
chai.use(chaiHttp);
describe('Database interaction', function(){
it('should register a new user on /register-user POST', function(done){
let testUser = {
"first... | true |
a4988321565e43d8e53adc0d1b344ce25f7dc37e | JavaScript | sagarbvora/game_form | /src/FormData.jsx | UTF-8 | 2,419 | 2.796875 | 3 | [] | no_license | import React, { useState } from 'react';
const FormData = () => {
const [inputtext,setname] = useState({
fname:"",
password:"",
email:"",
phone:""
});
const InputChange = (index) =>{
// console.log(index.target.value);
// console.log(index.target.name);
... | true |
368c9a98d3835a614ff99e821d483121c0205d4a | JavaScript | rahul97480/React | /src/component/UncontrolledComponent.js | UTF-8 | 792 | 2.75 | 3 | [] | no_license | import React, {useRef} from 'react'
function UncontrolledComponent() {
let inputRef = useRef(null)
let inputRef2 = useRef(null)
function submitform(e){
e.preventDefault();
let data = document.getElementById('input3').value;
console.log("input3 value :", data);
console.l... | true |
029a48adc5c7fa99deb1b0c6f2f479a214c4f375 | JavaScript | richad-m/la-maison-jungle | /src/components/Categories.js | UTF-8 | 620 | 2.65625 | 3 | [] | no_license | import { plantList } from '../datas/plantList'
function Categories({category, updateCategory}) {
const categories = plantList.reduce(
(acc, elem) =>
acc.includes(elem.category) ? acc : acc.concat(elem.category),
[]
)
return(
<select name="Category" id="plant-category" value={category} ... | true |
f89b8708cebfaa853af3b24abc35c11189266ede | JavaScript | L-huifeideyu/mishopping | /xiaomishop/routes/phoneLogin.js | UTF-8 | 1,708 | 2.65625 | 3 | [] | no_license | var https = require('https');
var qs = require('querystring');
//var express = require('express')
//var router = express.Router();
var apikey = '7b63f8dbf59db01d372c791637ffa6ac';
var mobile = '18845049775';
var codeArr = [];
for(var i = 0 ;i < 6 ;i ++)
{
codeArr.push(Math.ceil(Math.random()*9))
}
var code = codeArr.j... | true |
4c77022b06cdace487e64b61a2e97e49e3ef0e8d | JavaScript | donaldaverill/meteor-package-utils | /utils.js | UTF-8 | 273 | 2.609375 | 3 | [
"MIT"
] | permissive | Utils = Utils ? Utils : {};
Utils.repeat = (str, times) => {
return new Array(times + 1).join(str);
};
Utils.validateEmail = (email) => {
const re =
/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
return re.test(email);
};
| true |
ad3e3ed7a76c821eda120048194ccdcdd52f5d46 | JavaScript | kesava07/redux-basics | /src/Store/Reducers/DataReducer.js | UTF-8 | 822 | 2.5625 | 3 | [] | no_license | import * as actionTypes from '../Actions/ActionsTypes';
const initialState = {
data: [],
loading: false,
error: null
}
const dataReducer = (state = initialState, action) => {
switch (action.type) {
case actionTypes.START_FETCHING_DATA:
return {
...state,... | true |
01f3b081809f6f65e3071bf79834ba5d4f0af209 | JavaScript | alanerzhao/react-zero-learn | /src/js/comment/comment.js | UTF-8 | 3,972 | 3.03125 | 3 | [
"MIT"
] | permissive | /**Notes
* 属性从父传到子级通过props
* props是不可以改变的单一的
* state是组件私有的
* this.setState来改变状态,react是状态驱动的
* 静态用props 动态用state
* react使用驼峰命名规范
* refs 属性给子组件命名,this.refs引用对象getDOMNode获取引用对象对应的dom节点
*/
var converter = new showdown.Converter();
//实例一个commentBox组件
var CommentBox = React.createClass({//{{{
getInitialState: fu... | true |
4b2e6630af750a45bb0242749a279b53e0dc6675 | JavaScript | Artem-Rudko/goit-js-module01 | /js/js-20.js | UTF-8 | 709 | 2.671875 | 3 | [] | no_license | function checkStorage(available, ordered) {
let message;
// Пиши код ниже этой строки
if (ordered==0) {
message ='В заказе еще нет товаров';
} else if (ordered>available) {
message ='Слишком большой заказ, на складе недостаточно товаров!';
} else {
message ='Заказ оформлен, с вами свяжет... | true |
cf2c5fb186ee1eb4ac68cf5b71060b5c0e870fde | JavaScript | diegosevilla/centerpoint-web | /react-ui/src/reducers/survey.js | UTF-8 | 720 | 2.59375 | 3 | [
"MIT"
] | permissive | import { SET_SURVEY } from '../actions';
const initialState = {
id: '',
surveyName: '',
author: '',
details: '',
surveyId: '',
questions: [],
responseCount: 0
}
const survey = (state = initialState, action) => {
switch (action.type) {
case SET_SURVEY:
return Object.assign({}, state, {
... | true |
ea5f764a03824012647d8a3f69e410f4808b96f9 | JavaScript | veenedu/veen-platforms | /src/ajax/index.js | UTF-8 | 638 | 2.765625 | 3 | [] | no_license | let PROXY_URL = null;
/**
* This sets proxy for web requests
*/
export function setProxyUrl(proxyUrl){
PROXY_URL = proxyUrl;
}
/**
* Normalizes ajax options before send to ajax.
* adds proxy info if needed
* 'useProxy' is not there in returned object
*/
export function normalizeAjaxOptions(options){
let c... | true |
6e35a3a3f2ce3a51606a85dd1bda5acb70214640 | JavaScript | chemzqm/notice | /test/spec.js | UTF-8 | 804 | 2.640625 | 3 | [
"MIT"
] | permissive | /*global describe,it*/
var notice = require('..');
var assert = require('assert');
var styles = window.getComputedStyle;
describe('notice', function () {
it('should create new notice', function () {
var n = notice('test');
assert(/\bnotice-item\b/.test(n.el.className));
n.hide();
})
it('should be c... | true |
f3ae9933b134146220c6922c7067d89ada7820e7 | JavaScript | ninoloid/h8-p0-w4 | /exercise-5-UbahHuruf.js | UTF-8 | 2,461 | 3.59375 | 4 | [] | no_license | // Pakai regex
function ubahHuruf(kata) {
let hasil = '';
for (let i = 0; i < kata.length; i++) {
// regex digunakan untuk mencocokkan kata dengan a-y, /g = global, /i = case-insensitive
if (kata[i].match(/[a-y]/gi)) {
// charCodeAt untuk mengubah huruf menjadi unicode value
// fromCharCode untu... | true |
828656a5e716297e37e6d8fcf9248abdb20419ed | JavaScript | Marguelgtz/Live-Audio-Visualizer | /sketches/noiseColumns.js | UTF-8 | 9,611 | 2.71875 | 3 | [] | no_license | // Ensure ThreeJS is in global scope for the 'examples/'
global.THREE = require("three");
// Include any additional ThreeJS examples below
require("three/examples/js/controls/OrbitControls");
const canvasSketch = require("canvas-sketch");
const { Scene, ShaderMaterial, PositionalAudio } = require("three");
import ve... | true |
21b7815c59e9cf807fc69e4a349a3c9fb3f76bcc | JavaScript | karankrish/mywebapp | /home/js/img.js | UTF-8 | 256 | 2.734375 | 3 | [
"MIT"
] | permissive | (function ($) {
var x=0;
var y=0;
var img = $("#img");
img.css('backgroundPosition', x + 'px' + ' ' + y + 'px');
window.setInterval(function () {
img.css('backgroundPosition', x + 'px' + ' ' + y + 'px');
y--;
},90);
})(jQuery);
| true |
9b6a1b9c6947ea625970a29b6fedc526d7441712 | JavaScript | hamidak22/ak-react-web-app | /src/components/landing-page/blog/reducer.js | UTF-8 | 385 | 2.546875 | 3 | [] | no_license | import * as constants from './constants';
const defaultState = {
blog: [],
};
/*
BlogReducer sets all given data in redux
*/
const BlogReducer = (state = defaultState, action) => {
switch (action.type) {
case constants.SET_BLOGS:
return {
blog: action.payload.data,
};
defa... | true |
a244ff9ab8576cbc307acb0e18e1d92695e955b2 | JavaScript | tareqmahmud/Competitive-Programming | /HackerRank/10-Days-Of-JavaScript/Day 8/Create a Button/js/button.js | UTF-8 | 239 | 4 | 4 | [
"MIT"
] | permissive | // Get the button
const btn = document.querySelector("#btn");
// After click the button then increment the button value by 1
btn.addEventListener('click', () => {
btnValue = Number(btn.innerText) + 1;
btn.innerText = btnValue;
}); | true |
d05cf5fabce0db3020bcf856959970fdf8c5f1a7 | JavaScript | Machiavellii/node | /playground/hashing.js | UTF-8 | 608 | 2.625 | 3 | [] | no_license | // const { SHA256 } = require('crypto-js');
// const jwt = require('jsonwebtoken');
const bcrypt = require('bcryptjs');
let password = 'abc123';
// bcrypt.genSalt(10, (err, salt) => {
// bcrypt.hash(password, salt, (err, hash) => {
// password = hash;
// console.log(password);
// });
// });
let hashingP... | true |
0c125ace898beddf45471cf702b97404498b44ab | JavaScript | NordicMuseum/Nordic-Museum-Audio-Guide | /v2/src/utilities.js | UTF-8 | 2,296 | 2.703125 | 3 | [
"MIT"
] | permissive | import React from 'react';
import { Text, Platform } from 'react-native';
function isTag(str) {
switch (str) {
case '<i>':
case '<b>':
return true;
default:
return false;
}
}
function findClose(textArray) {
let count = 0;
const openTag = textArray[0];
const closeTag = `</${openTag.s... | true |
a4cdbe42db01952a10aa464c90422a37c42e4c45 | JavaScript | johnwangel/bruhdash | /js/bruh-dash.js | UTF-8 | 7,894 | 3.421875 | 3 | [
"MIT"
] | permissive | var global = window || GLOBAL;
/****************************************************************************************
* Function signatures have been intentionally left out of the comments describing what *
* each function does so that you can have practice looking up documentation. Please *
* Reference the d... | true |
1ec764c8513e8629b8f19c2ae19a50dc0ff52c42 | JavaScript | lexasss/tancoder | /src/components/code/editorUtils.js | UTF-8 | 4,530 | 3.234375 | 3 | [
"MIT"
] | permissive | /*
Here go credits to unknown author for tab insertion functionality
It used with some modifications.
*/
'use strict';
const TAB = ' ';
function getCurrentLineIndent( textarea ) {
let indentSize = 0;
let caretPos = textarea.getCaretPosition();
while (caretPos >= 0 && textarea.value.charAt( caretP... | true |